[Pending] Late dynamic refreshrate changer or fps detection without mediainfo (1 Viewer)

disaster123

MP Donator
  • Premium Supporter
  • May 14, 2008
    3,546
    432
    Germany Germany
    Country flag
    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: https://forum.team-mediaportal.com/...ty-development-81148/index113.html#post749721 or use my provided binary package for MP 1.2 beta.

    Greets Stefan
     

    Attachments

    disaster123

    MP Donator
  • Premium Supporter
  • May 14, 2008
    3,546
    432
    Germany Germany
    Country flag
    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.
     

    Holzi

    Super Moderator
  • Team MediaPortal
  • April 21, 2010
    7,930
    2,234
    Ba-Wü
    Germany Germany
    Country flag
    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    A binary to test would be nice!
     

    disaster123

    MP Donator
  • Premium Supporter
  • May 14, 2008
    3,546
    432
    Germany Germany
    Country flag
    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    Binary package added to 1st post.
     

    disaster123

    MP Donator
  • Premium Supporter
  • May 14, 2008
    3,546
    432
    Germany Germany
    Country flag
    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.
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Denmark Denmark
    Country flag
    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
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Code:
    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:
    while (--maxretries > 0);
    will only test 99 times, not 100 like intended (althou it wont make any real difference) :)

    Code:
        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.
     

    Owlsroost

    Development Group
  • Team MediaPortal
  • October 28, 2008
    5,540
    5,038
    Cambridge
    United Kingdom United Kingdom
    Country flag
    Also I would prefer that dshowhelper side would be able to provide more exact estimates / guesses about the fps
    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
     

    disaster123

    MP Donator
  • Premium Supporter
  • May 14, 2008
    3,546
    432
    Germany Germany
    Country flag
    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 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
    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.
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    Top Bottom