[Patch] MultiTuner Bug with different PVR cards (1 Viewer)

FlipGer

Retired Team Member
  • Premium Supporter
  • April 27, 2004
    2,658
    115
    48
    Leipzig, Germany
    Home Country
    Germany Germany
    Hi,

    there is a bug in the LoadDefinitions()-method of the TVCaptureDevice-class. This bug causes MP to choose the wrong filter-moniker for the capture cards. In my case it always chooses the PVR 150 filters for my PVR 350. So TV and Radio does not work for the PVR 350.

    This code is obsolete and can be deleted:
    Code:
    filter = al[0] as Filter;
    string filterMoniker = filter.MonikerString;
    int posTmp = filterMoniker.LastIndexOf("#");
    if (posTmp >= 0) filterMoniker = filterMoniker.Substring(0, posTmp);

    This line
    string moniker = FindUniqueFilter(filterMoniker, Instance);
    has to be changed into this
    string moniker = FindUniqueFilter(captureDeviceDeviceName, Instance);

    Patch can be found here:
    https://sourceforge.net/tracker/index.php?func=detail&aid=1394740&group_id=107397&atid=647927

    Happy new year with MP to everyone! :)

    Flip
     

    FlipGer

    Retired Team Member
  • Premium Supporter
  • April 27, 2004
    2,658
    115
    48
    Leipzig, Germany
    Home Country
    Germany Germany
    Hi,

    csberto said:
    Is 'TVCaptureDeviceEx.cs' the patch? If yes, what should I do with it?

    Yes, this is the patch. Its a modified C# file of the latest CVS. If you want to apply it, you have to download the CVS source, change the TVCaptureDeviceEx.cs and compile a new version.

    Hopefully it will find its way soon into official CVS, than you can download a prebuild daily snapshot.

    Flip.

    PS: Or PM me, if you want a compiled version, just tell me what MP version you have. RC2 would be easiest.
     

    Frodo

    Retired Team Member
  • Premium Supporter
  • April 22, 2004
    1,518
    121
    52
    The Netherlands
    Home Country
    Netherlands Netherlands
    FlipGer, i debugged the original cvs code and looked at your patch
    The original cvs code is working for me.
    I do have a PVR 350 which works just fine for me
    (Note i dont have a PVR 150)

    I did not add your patch to CVS yet, since i fail to see why this
    would be correct.
    Instead of using the filter moniker string, you are now using the
    moniker based on the capture filter moniker.
    Let me explain:
    a graph normally consists of filters. each filter has a moniker string.
    A pvr 150 for example has
    - tv tuner filter
    - audio tuner filter
    - crossbar filter
    - capture filter

    Now for hauppage all these filters have the same moniker format and thus your patch will work.
    example for the PVR 150 all filters have this part in the filter monikers:
    ven_4444&dev_0016&subsys_88010070&rev_01

    However some other cards (like twinhan) have completely different filters for each filter
    example the twinhan tuner filter may look like
    ven_109e&dev_0878&subsys_00011822&rev_11
    and the twinhan capture filter may look like
    vid_0fe9&pid_db50

    Now when i apply your patch, it always uses the capture filter moniker to determine the unique filter name. I have the feeling that this will fail for the twinhan look-a-like cards?

    Frodo
     

    FlipGer

    Retired Team Member
  • Premium Supporter
  • April 27, 2004
    2,658
    115
    48
    Leipzig, Germany
    Home Country
    Germany Germany
    Hi frodo,

    thanks for looking into the code.

    Ok, let me explain, what happens on my machine without the patch.

    1) PVR 350 standalone (150 taken out of comp)
    - works fine

    2) PVR 150 standalone (350 taken out of comp)
    - works fine

    3) PVR 150 together with PVR 350
    - PVR 150 works fine
    - PVR 350 does not work. I get a black picture and an error message in error.log:
    23.11.2005 23:14:39 SinkGraph:FAILED to connect Encoder->mpeg2 demuxer:80040217

    Looking at the graphs i can see that MP picks the filters of the PVR 150 for the PVR 350.

    Moniker of PVR 150:
    ven_4444&dev_0016&subsys_88010070&rev_01
    Moniker of PVR 350:
    ven_4444&dev_0803&subsys_40000070&rev_01

    Taking a look into the mediaportal.log I can see that MP takes the 150-moniker as unique filter for the PVR 350.
    (sorry no log here, i am at work)

    This is because the foreach-loop is simply wrong. (In my eyes ;))
    Code:
    foreach (string key in AvailableFilters.Filters.Keys)
    - This loop takes all available filter, so far so good. I have two of them (150/350).
    Code:
    filter = al[0] as Filter; // TAKES the first filter
    string filterMoniker = filter.MonikerString;
    int posTmp = filterMoniker.LastIndexOf("#");
    if (posTmp >= 0) filterMoniker = filterMoniker.Substring(0, posTmp);
    - In this part the very first filter-moniker is read in. In my case PVR 150, because it is the first in the list. This code part does not make sense.

    Why? In the following for-loop this filter-moniker is compared to the first filter-moniker. So it will be compared to itself! MP will always find the unique filter in the first run of the for-loop. It reads the first filter and compares it to its own...

    Code:
    string moniker = FindUniqueFilter(filterMoniker, Instance);
    for (int filterInst = 0; filterInst < al.Count; ++filterInst)
    {
     filter = al[filterInst] as Filter; // TAKES the first filter
     string tmpMoniker = filter.MonikerString.Replace(@"\", "#");
     tmpMoniker = tmpMoniker.Replace(@"/", "#");
      // COMPARES first filter with first filter -> always TRUE
     if (tmpMoniker.ToLower().IndexOf(moniker.ToLower()) >= 0)
     {
       Log.Write("use unique filter moniker:{0}", filter.MonikerString);
       filterFound = true;  
       break;
     }
    }

    If I use this code
    Code:
    string moniker = FindUniqueFilter(captureDeviceDeviceName, Instance);
    this comparision
    Code:
    if (tmpMoniker.ToLower().IndexOf(moniker.ToLower()) >= 0)
    will only be true if the filter-moniker is the same like the given one in the CaptureCardsDefinition.xml

    I do not know, if this will cause problems with TwinHan cards, but I do not think so. The code will still compare the moniker of the definition file with the moniker of the filter.

    But I know, that the current code does not work with multiple PVR cards. My patch does work. :)

    Hopefully this makes sense. Just ask back, if there are any questions left. I will try to go on IRC this evening. Have to go back to work now... ;)

    Flip.
     

    FlipGer

    Retired Team Member
  • Premium Supporter
  • April 27, 2004
    2,658
    115
    48
    Leipzig, Germany
    Home Country
    Germany Germany
    Hi,

    an addition. I now understand what you mean with the TwinHan example and you are right, it might cause problems.... :(

    Flip.
     

    FlipGer

    Retired Team Member
  • Premium Supporter
  • April 27, 2004
    2,658
    115
    48
    Leipzig, Germany
    Home Country
    Germany Germany
    Hi frodo,

    there was no reaction to my comment on this issue.

    So I do not know, if you see the problems which occur on multituner systems?

    Anyway. I do now understand, why this code was implemented and I see the dilemma with all those nifty filters. But the current code does not work with multiple tuner cards (especially PVR). And my changes will not work with cards, that use different moniker strings like the TwinHan. :(

    So only this solution came to my mind:

    Extend the CaptureCardsDefinitions.xml with moniker strings for each filter (if necessary) like this:
    Code:
    <filters>
      <filter cat="tvtuner"  name="Hauppauge WinTV PVR PCI II TvTuner"  checkdevice="true" moniker="xyz120938erter"></filter>
      <filter cat="tvaudio"  name="Hauppauge WinTV PVR PCI II TvAudio"  checkdevice="true" moniker="xyz12345345"></filter>
      <filter cat="crossbar" name="Hauppauge WinTV PVR PCI II Crossbar" checkdevice="true" moniker="xyz1209asd"></filter>
      <filter cat="capture"  name="Hauppauge WinTV PVR PCI II Capture"  checkdevice="true" moniker="xyz1202523"></filter>
    </filters>

    And change LoadDefinitions(), to take the additional moniker info of the filter.

    I will make some more research. Just give me a hint, if this makes sense or not... ;)

    Thanks for your great efford in MP! :)

    Flip
     

    TimmyT

    Portal Pro
    October 18, 2004
    107
    11
    Zurich
    Home Country
    Switzerland Switzerland
    Hi FlipGer

    I have the same setup as you, a PVR-350 and a PVR-150. But I can only confirm that the radio doesn't work anymore if I insert the PVR-150. Unlike you, I can watch/record with both my cards simultaneously. But I'm still using RC1 with a CVS from somewhen in december.

    Do you have this problem only in RC2 or did you encounter it before?

    Or does the driver version makes the difference? I'm using the original Hauppage drivers, not the shspvr.com version.

    Greetings,
    TimmyT
     

    FlipGer

    Retired Team Member
  • Premium Supporter
  • April 27, 2004
    2,658
    115
    48
    Leipzig, Germany
    Home Country
    Germany Germany
    Hi Timmy,

    TimmyT said:
    Do you have this problem only in RC2 or did you encounter it before?

    Or does the driver version makes the difference? I'm using the original Hauppauge drivers, not the shspvr.com version.

    I did have this prob also with RC1 and, if I remember right, also some time before RC1. And, if i remember right, my code did find its way into CVS for RC1 for a short time, but was taken out again later (RC2).

    The drivers could make a difference, but they do not solve the problem, because the current code produces really problems picking up the wrong filter with multiple cards.

    1) Are you sure both cards work? Did you change the prios (first 150 high, than 350)?

    2) Could you please post / send your mediaportal.log. Just start MP and stop it again, this should be enough...

    3) Are you on IRC some times?

    Flip.
     

    Users who are viewing this thread

    Top Bottom