[WiP] TV Server hardware-specific code refactoring (3 Viewers)

ColinT

Portal Pro
January 21, 2007
72
1
Home Country
United Kingdom United Kingdom
Sorry about the delay, Ive been on holiday.
Test build apears to work now!, Logs attached. Not sure if the previous failure was finger trouble on my part, I was a bit rushed.
This time I disabled all other recievers, and only had 7 enabled.

I will try your latest build tomorrow, time willing:D

Regards Colin
 

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Great to hear from you again ColinT :)
    I confess I was getting a little concerned. Hope you enjoyed your holiday though...

    Your log looks perfect to me now. I can see that your card is being detected correctly and all 3 of the DiSEqC port switching commands that you use are working. I have to say that it is much easier to read the log with the other cards disabled ;)
    The previous build failure was *definitely not your fault*. You can blame that completely on me. I made a small mistake with that build that I corrected in the debug build. I've added that change to the "main" builds in the first post so absolutely feel free to try them. The build for 1.1.1 should work now too. I'd be interested to know if everything still works fine when you disable all the other cards. There shouldn't be a problem but it doesn't hurt to make sure.

    Oh, one other thing.

    I don't know if you still use analog TV but apparently the analog TV tuner on the BGT3595 doesn't work with MediaPortal. I'm trying to help out some other people with that over here. No solution yet, but I've found one cause and a bug in TV Server so I'm making good progress. Like I said, I don't know if you use analog TV or FM but I'd appreciate having another tester just to confirm that things work correctly. No pressure at all. Just thought you might possibly be interested...

    Ciao
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Home Country
    Denmark Denmark
    I just gave this patch a spin.

    It seems to work for my 3 dvb-s devices (4xlnb diseqc switches)-

    skystar2 (wdm)
    floppydtv
    hauppauge nova dvb-s2

    morpheus, as u know, did do some nice refactoring that I personally would love to see brought up to date.

    /gibman
     

    mm1352000

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

    Great to hear that the refactoring works for you :)
    I have had a really good look at morpheus_xx's branch. He has some fantastic ideas! I wasn't sure whether to throw away what I've done and update his code or to continue refactoring the existing code to integrate his ideas (reusing his code where possible). I'll see how I go but I'm hoping to have something new to test in the next 1-2 weeks...
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    AW: TV Server hardware-specific code refactoring

    one part that is not yet implemented in the branch is the custom graph building that is required for some CI:

    i.e. WinTV CI needs an additional filter, and DigitialDevices also.

    this means, if you continue there, you should also make changes to the graph building: i.e. when constructing the graph all providers should be checked, if they require additional filters and let them to the work.

    (doing this refactoring should also keep MD*PI in mind, it should be treated like any other ConditionalAccess provider!)
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Yes, that will need to be done (I don't know anything about MD*** so I might need some help when I get to that point). I notice that you didn't get to fully integrate the DiSEqC_Helper class either. I want to be really careful with the DiSEqC interfaces/implementation to reuse code where possible but also allow room for future extensions such as Unicable...
     

    mm1352000

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

    It's been a month since I posted the last version of this patch (so much for two weeks! ;)). Since then I have been working hard to integrate the ideas and code from morpheus_xxx's branch. There is now a new version (v5) of the patch for 1.1.0, 1.1.1, and SVN head attached to the first post in this thread. I have implemented support for providers that require filters to be added to the graph (ie. WinTV CI, DigitalDevices) and refactored the CI/CAM code. Although I am not quite finished - I still need to add morpheus_xxx's plugin loader - I think the code is now at the point where it can and *needs* to be tested.

    I'd really appreciate anyone that would be willing to take the time try the patch. FTA channels should work, but descrambling and DiSEqC functionality needs to be tested. In particular, I'd be really happy if anyone with DigitalDevices or WinTV CIs could try the patch (remember that support for DigitalDevices is only available in 1.2.0a so you need to use the SVN head patch).

    mm1352000

    p.s. I wanted to build a version for 1.2.0a but I couldn't find the tag revision number. I think the patch for SVN head should work with 1.2.0a installations...
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Home Country
    Denmark Denmark
    Im currently running SVN version of tvservice.

    using the stress test tool found on setupTV I realized that I did not have a 100% stable diseqc switching.

    atleast not on my hauppauge card (nova hd dvb-s2).

    I randomly get a "no signal" exception.

    If I do this quick and dirty hack, then all is working.
    stresstest have been running 80 tunings, and no one failed yet :)


    in method:
    public override bool LockedInOnSignal()

    Code:
    ....
    if (!isLocked)
            {
              ts = DateTime.Now - timeStart;
              Log.Log.WriteFile("dvb:  LockedInOnSignal waiting 20ms");
    
              if (System.IO.File.Exists("c:\\diseqc.txt"))
              {
                if (_previousChannel is DVBSChannel)
                {
                  bool diseqCsucceded = _conditionalAccess.SendDiseqcCommand(_parameters, (DVBSChannel)_previousChannel);
                }
              }
    
              System.Threading.Thread.Sleep(20);
            }

    _previousChannel is actually the current channel at this time in code.
    but the main thing is it seems do wonders to do an additional SendDiseqcCommand CMD for those card drivers.

    why is this even a problem ?

    do we call SendDiseqcCommand from the wrong place in code ?

    no idea how this fares on your patch.
    probably the same.

    /gibman
     

    mm1352000

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

    Thank you for the comment!
    There is currently a very bad (in my opinion) hack in the code to try and support DiSEqC switching on Hauppauge cards. What it does is to:

    1. Try send DiSEqC command normally (before graph is running).
    2. Run graph.
    If DiSEqC command failed:
    3. Don't check for lock.
    4. Stop the graph.
    5. Tune again.

    I am aware through experience with my card that some cards require the DiSEqC commands to be sent *after* the graph is running. This is exactly why I even started making this patch - to support DiSEqC switching on my card which was not working unless the command was sent after the graph was started. MediaPortal currently sends the command *before* the graph is running and most cards seem to work okay. In fact there are probably some cards that require the commands to be sent at that time. Maybe some of the Hauppauge cards are like mine?

    We could try to take out the hack and do the following (for all cards - more robust):
    1. Try send DiSEqC command normally (before graph is running).
    2. Run graph.
    3. Before checking for lock, resend the DiSEqC command if the first command failed.

    Very easy to implement for switch control from within the ConditionalAccess class after my refactoring :D
    Not so easy to implement for motor control. Do you have a dish motor?
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Home Country
    Denmark Denmark
    no motor here.

    Please take note of this: Even though I get an ok reply back (=0) from the driver when setting DiseqC, I often end up with "no lock" when tuning.

    easy to repro with stress test and 2 channels, one on each diseqc switch.

    So could we set the diseqC again after a failed lock as it seems we cant trust the return value from the driver, atleast not from my card?

    and yes, the work-around is ugly.

    /gibman

    Hi gibman

    Thank you for the comment!
    There is currently a very bad (in my opinion) hack in the code to try and support DiSEqC switching on Hauppauge cards. What it does is to:

    1. Try send DiSEqC command normally (before graph is running).
    2. Run graph.
    If DiSEqC command failed:
    3. Don't check for lock.
    4. Stop the graph.
    5. Tune again.

    I am aware through experience with my card that some cards require the DiSEqC commands to be sent *after* the graph is running. This is exactly why I even started making this patch - to support DiSEqC switching on my card which was not working unless the command was sent after the graph was started. MediaPortal currently sends the command *before* the graph is running and most cards seem to work okay. In fact there are probably some cards that require the commands to be sent at that time. Maybe some of the Hauppauge cards are like mine?

    We could try to take out the hack and do the following (for all cards - more robust):
    1. Try send DiSEqC command normally (before graph is running).
    2. Run graph.
    3. Before checking for lock, resend the DiSEqC command if the first command failed.

    Very easy to implement for switch control from within the ConditionalAccess class after my refactoring :D
    Not so easy to implement for motor control. Do you have a dish motor?
     

    Users who are viewing this thread

    Top Bottom