[Pending] - Late dynamic refreshrate changer or fps detection without mediainfo

Discussion in 'Submit: code patches (MediaPortal/TV-Server/etc.)' started by disaster123, June 23, 2011.

    • Premium Supporter

    disaster123 MP Donator

    Hello,

    at the moment the current MP implementation of the dynamic refreshrate changer is based on the output of mediainfo. But this does not work for streams. (for example Onlinevideos).

    I made a patch using some new functions owlroost implemented for me in V84 of his great directshowhelper.dll (THANKS owlroost).

    So how does it work?
    1.) check if the FPS is known by mediainfo
    2.) if not - start a seperate thread which waits until the video is played
    3.) get fps from running video and check if we need to change the fps according to your dynamic refreshrate settings
    4.) wait again and recheck the fps (sometimes the first check is not correct - it depends on stream and type)

    This patch is for the current MP SVN or MP 1.2 beta. To use it you also NEED owlroost directshowhelper.dll in ver. V84. You can get it from here: http://forum.team-mediaportal.com/g...ty-development-81148/index113.html#post749721 or use my provided binary package for MP 1.2 beta.

    Greets Stefan

    Attached Files:

    • Like Like x 5
    • Premium Supporter

    disaster123 Thread Starter MP Donator

    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    I can provide binaries for MP 1.2 beta - if anybody could tell me which SVN version it was.
    • Team MediaPortal

    Owlsroost Development Group

    System Specs
    • Team MediaPortal

    Holzi Super Moderator

    System Specs
    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    A binary to test would be nice!
    • Premium Supporter

    disaster123 Thread Starter MP Donator

    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    Binary package added to 1st post.
    • Premium Supporter

    disaster123 Thread Starter MP Donator

    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    Updated Binary and patch.

    Added a 2time verify - some online stuff seems to be very hard to detect it. So it loops now at least for 2 times to verify that the refreshrate is constant and correct.
    • Team MediaPortal

    gibman Development Group

    on quick inspection of the code I couldn't help but notice a lot of thread.sleep calls.

    it should be possible to use some manual reset events instead.
    eg. waiting for the graph .. if it doesn't provide a mechanism for "IsGraphReady".. then we should probably look into this rather than rely on thread.sleeps.

    /gibman
    • Team MediaPortal

    tourettes Development Group

    Code (text):
    if (Math.Abs(fps - newfps) > 1 && VMR9Util.g_vmr9 != null)
    What happens if the 1st detection is 24.000Hz and the 2nd 23.976Hz? Wont we end up in the wrong refresh rate? Also I would prefer that dshowhelper side would be able to provide more exact estimates / guesses about the fps since the code on C# side is really ugly :)

    Also like gibman states, sleeps should be replaced with events.

    Code (text):
    while (--maxretries > 0);
    will only test 99 times, not 100 like intended (althou it wont make any real difference) :)

    Code (text):

        public static void DelayedRefreshrateChanger(string strFile, MediaPortal.Player.g_Player.MediaType type)
     
    Exception handling should be added, a thread that doesn't have such will take whole C# application down to desktop if some code that gets run in the thread will throw an exception.
    • Team MediaPortal

    Owlsroost Development Group

    System Specs
    It's actually hard for the dshowhelper code to work out which is the 'best' estimate - I've seen situations where the fps estimates derived from the EVR mixer, the sample durations and the inter-sample time differences are all different, so how does it guess which one is the 'correct' fps ? :)

    I'll try and improve the 'best estimate' algorithm - maybe a bit of 'majority voting' logic would help ;)

    Tony
    • Premium Supporter

    disaster123 Thread Starter MP Donator

    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    OK i'll try to make my code better. Some questions before i can start:
    1.) i wasn't able to find something like IsGraphReady or another way to determine if the graph is started and playing? Can someone help with an idea?
    2.) should i put a try and catch around the whole stuff in the thread functions? Or only while calling external stuff?

    tourettes
    What is the problem here? Are there tv's which can display 24.000Hz and 23.976Hz? I thought all TVs can only display 24hz - so the nearest one would be 24hz and 25hz and i check for a difference smaller than 0.1.

Share This Page

Users Viewing Thread (Users: 0, Guests: 0)

Running the latest version?

V1.3.0 FINAL - released March 2013
Releasenews | Download
Changelog
 | Requirements
HTPC
Team-MediaPortal
 
About
Contact |  Press
Partners