[Approved] - FM radio signal detection

Discussion in 'Archive' started by mm1352000, September 16, 2010.

  1. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,730
    Ratings:
    +8,196 / 17
    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
     

    Attached Files:

    • Like Like x 4
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. rmeredit
    • Premium Supporter

    rmeredit MP Donator

    Joined:
    April 10, 2007
    Messages:
    164
    Likes Received:
    20
    Location:
    Melbourne
    Ratings:
    +20 / 0
    Home Country:
    Show System Specs
    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.
     
  4. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,730
    Ratings:
    +8,196 / 17
    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...
     
    • Like Like x 1
  5. rmeredit
    • Premium Supporter

    rmeredit MP Donator

    Joined:
    April 10, 2007
    Messages:
    164
    Likes Received:
    20
    Location:
    Melbourne
    Ratings:
    +20 / 0
    Home Country:
    Show System Specs
    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.
     
  6. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,730
    Ratings:
    +8,196 / 17
    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.]
     
    • Like Like x 1
  7. rmeredit
    • Premium Supporter

    rmeredit MP Donator

    Joined:
    April 10, 2007
    Messages:
    164
    Likes Received:
    20
    Location:
    Melbourne
    Ratings:
    +20 / 0
    Home Country:
    Show System Specs
    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.
     
    • Like Like x 1
  8. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,730
    Ratings:
    +8,196 / 17
    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]
     
    • Like Like x 1
  9. rmeredit
    • Premium Supporter

    rmeredit MP Donator

    Joined:
    April 10, 2007
    Messages:
    164
    Likes Received:
    20
    Location:
    Melbourne
    Ratings:
    +20 / 0
    Home Country:
    Show System Specs
    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
     
  10. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,730
    Ratings:
    +8,196 / 17
    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.
     
    • Like Like x 1
  11. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,518
    Likes Received:
    4,730
    Ratings:
    +8,196 / 17
    Home Country:
    New Zealand New Zealand
    Hmm: attachment didn't get attached. I'll try again...
     

    Attached Files:

    • TVLibrary.zip
      File size:
      150.6 KB
      Uploaded:
      October 6, 2010
      Views:
      168
    • Like Like x 1
Loading...

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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!