[Approved] FM radio signal detection (1 Viewer)

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hi all

    I've been a user of MediaPortal since version 0.2.3, however this is the first time I've submitted a patch so please go easy on me. I have tried to follow all the guidelines so hopefully I've done everything correctly...

    ----------------------------------------------------------------------------------------------------------

    Recently I bought myself two second hand Pinnacle 7010ix 4 in 1 (2xhybrid DVB-T/Analog TV/FM + 2xDVB-S) tuner cards from Ebay Germany. They are fantastic cards and work nicely with MediaPortal except for two issues:
    1. FM radio didn't work correctly
    2. DiSEqC switching doesn't work

    This patch is meant to solve issue 1 (I have a solution for issue 2 as well but I'm still working on the implementation).

    Problem detail:
    I need to be more specific about what I mean when I say FM radio didn't work "correctly". The tuning and playback of FM radio *did* actually work - it is just that the card failed to detect or lock on actual stations. This means that when I did an FM scan, the card would detect random frequencies (90% of which were not real stations - in fact they were usually about as far away from any real station frequency as it was possible to get!). You could successfully tune to the random frequencies picked up by the scan and hear white noise or sometimes "fuzzy" music/speech if the frequency was close to a real station. However you couldn't fix the frequency of one of the random stations or manually add a new station with a real frequency - the tuner just refused to lock.

    Investigation detail:
    It turns out that my card's driver was returning signal strength values outside of the range specified by the DirectShow interface. IAMTuner:: SignalPresent specifies that the driver should return '1' if the tuner is locked, however my card was returning 2, 3, 4 and sometimes even 5 for frequencies where there were real stations. I think the driver probably contains a manufacturer specific implementation of signal strength/quality with 1 being the weakest lock and 5 being the strongest :rolleyes:. Note that the driver does correctly return 0 (meaning 'no signal') when there is really no station present.

    Fix detail:
    The fix is very simple - only one line of code is changed. Instead of determining lock by checking for 'signal present' or 'has-no-signal-strength', I assume lock and check for 'no lock' to determine if the tuner isn't actually locked.

    Okay well hopefully I have given all the information that needs to be given. The patch (which is taken from the SVN HEAD) is attached!
    :)

    [Edit: I meant to also say that perhaps this issue is connected to Mantis issue 0002445. The card is not a Hauppauge, however you never know...]

    ----------------------------------------------------
    Update 2010-11-18
    - Add binary patch for 1.2.0a

    ----------------------------------------------------
    Update 2010-12-18
    - Add binary patch for 1.1.2

    ----------------------------------------------------
    Update 2011-04-03
    - Add binary patch for 1.1.3
     

    Attachments

    • FM_Radio[SVN_HEAD].patch
      821 bytes
    • Binary[1.2.0a].zip
      153.8 KB
    • Binary[1.1.0].zip
      150.7 KB
    • Binary[1.1.2].zip
      150.9 KB
    • Binary[1.1.3].zip
      151 KB

    rmeredit

    MP Donator
  • Premium Supporter
  • April 10, 2007
    164
    20
    Melbourne
    Home Country
    Bumping (apologies if this violates any accepted practices!) so that this doesn't fall off the radar - would love to see this evaluated for 1.2.0 as it's a show stopper for the radio function for people with certain fairly common tuner cards.

    Cheers,

    R.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    rmeredit: have you tried the patch to see if it solves your issues? Just interested. If it doesn't then perhaps I could help you diagnose/solve your issue as well...
     

    rmeredit

    MP Donator
  • Premium Supporter
  • April 10, 2007
    164
    20
    Melbourne
    Home Country
    Hi,

    No I haven't as I'm not set up to compile and test on my 'production' htpc - the family would go nuts if stuff broke ;).

    What you describe as the problem above neatly explains what I see, though, when trying to tune my card - only weak signals get locked in, suggesting a numerical range greater than 0-1 being returned by the card for signal strength.

    Cheers,

    Rob.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    This patch changes one line of code - it is ***very*** unlikely to break your production machine. What version of MP are you running? I may be able to compile a TVLibrary.dll for you if you want. Literally all you would have to do would be to make a backup of the TVLibrary.dll that is in your TV Server install folder and then replace the standard DLL with my modified version. Once you've done that, you restart the TV Server and you're good to go! Easy :)

    [Edit: ...and of course in the unlikely event that my DLL stopped TV/Video/whatever-you-think-is-critical from working you simply delete my DLL, reinstate the standard DLL, restart TV Server and you're back in business.]
     

    rmeredit

    MP Donator
  • Premium Supporter
  • April 10, 2007
    164
    20
    Melbourne
    Home Country
    I'm less worried about your 1 line of code, more about the other untested bits that would be in an SVN compile alongside your patch. But if you're able to get me a patched .dll, I'm more than happy to test it out.

    Cheers,

    Rob.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    I agree - there is reasonable risk from an SVN build, and the code download is pretty large. However, there is no need to run an SVN build if you don't want to. I can build a patch to suit the stable version of MP that you're running. That is why I was asking what version you are running. I can temporarily revert my SVN build to your version, add *only* my patch, and then compile you the one DLL that you'd need.

    Again, what version are you running?

    [Edit: your profile says 1.1.0 but I just want to make sure]
     

    rmeredit

    MP Donator
  • Premium Supporter
  • April 10, 2007
    164
    20
    Melbourne
    Home Country
    That would be excellent. I'm still running 1.1.0. Let me know if there's anything other than the obvious you'd want me to test.

    Cheers,

    Rob
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Okay here is the DLL for MP 1.1.0.
    Just so we're clear, instructions for use:
    1. Stop TV Server
    2. Take backup of existing TVLibrary.dll (in the TV Server install folder)
    3. Download and unzip my patched version of TVLibrary.dll and place it in the TV Server install folder
    4. Restart TV Server

    There is nothing else to test other than the obvious check that FM radio starts to work properly for you. It is entirely possible that the patch will make no difference so if it doesn't, clean out your logs, try tune to one station that should work and then post your tv.log file here. I'll see if I can find what is going wrong in your situation and patch that too. It may require me to give you a new DLL with more debug, however for now try the one attached to this post.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hmm: attachment didn't get attached. I'll try again...
     

    Attachments

    • TVLibrary.zip
      150.6 KB

    Users who are viewing this thread

    Top Bottom