MERGING MediaPortal Url Source Splitter & IPTV Filter (5 Viewers)

georgius

Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    I am planning to implement a new onlinevideos site that plays direct TV through m3u8 playlists, but I have a 2 questions:
    1. I have seen that those lists have the tag called #EXT-X-KEY:METHOD=AES-128,URI="http://www.XXXXX.com/key=NNNNNN&prm=NXXNXNXXNXNNXNXNX........NXNXNXNXNXNXNXNNXNXNX". Does this filter support this kind of tags? (Searched in the fourm about this but nothing found).
    2. In this case, the m3u8 playlists are 12 segments long, and the "web" is doing requests to new m3u8 playlists every few seconds, sometimes receiveing new segments and sometimes receiveing some new and some repeated (really for me it's not a problem because the web player does not show repeated chunks). The question is, the repeted requests to download new m3u8 playlists is autometized or do I have to do something special? This has to be implemented as onlinevideos site or can/should be done in the IPTV plugin? (It is version #EXT-X-VERSION:3 if that helps). If you need a sample of a real m3u8 playlist ask me in private please.

    Thank you very much for your effort!!
    1. Encrypted streams are not supported (one exception is encrypted streams on SVT). But, if you make dump of communication (Fiddler should be good start, because you can dump requests and responses), I can take a look, if it is possible to decrypt such stream.
    2. Request are done automatically (until playlist contains #EXT-X-ENDLIST which means end of stream).
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    @georgius
    I found a problem in the current IPTV filter. A certain section of code is causing PMT sections to be thrown away:
    https://github.com/MediaPortal/Medi...urce/MPIPTVSource/MPIPTVSourceStream.cpp#L521

    The problem happens when:
    • TS contains more than one program
    • PMT for more than one program is carried on the same PID
    • a TS packet contains more than one PMT section
    The code accepts and parses the first section in the packet. That is okay. However, it throws away the remaining data in the packet, which could contain additional PMT sections (or at least the start of the next PMT section).

    Also, it seems like this code:
    https://github.com/MediaPortal/Medi...urce/MPIPTVSource/MPIPTVSourceStream.cpp#L493

    ...only does what it is intended to do when the PMT section is aligned with the start of the TS packet. This will not always be the case, even when the TS only contains one program. For example, if the PMT section is larger than 183 bytes (ie. requires more than one packet). In this case, "if (pmtParser->IsValidPacket())" will fail.
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    @georgius
    I found a problem in the current IPTV filter. A certain section of code is causing PMT sections to be thrown away:
    https://github.com/MediaPortal/Medi...urce/MPIPTVSource/MPIPTVSourceStream.cpp#L521

    The problem happens when:
    • TS contains more than one program
    • PMT for more than one program is carried on the same PID
    • a TS packet contains more than one PMT section
    The code accepts and parses the first section in the packet. That is okay. However, it throws away the remaining data in the packet, which could contain additional PMT sections (or at least the start of the next PMT section).

    Also, it seems like this code:
    https://github.com/MediaPortal/Medi...urce/MPIPTVSource/MPIPTVSourceStream.cpp#L493

    ...only does what it is intended to do when the PMT section is aligned with the start of the TS packet. This will not always be the case, even when the TS only contains one program. For example, if the PMT section is larger than 183 bytes (ie. requires more than one packet). In this case, "if (pmtParser->IsValidPacket())" will fail.
    It's true. PAT and PMT parser are correctly working only when whole PAT or PMT is in one MPEG2 TS packet and is aligned to start of MPEG2 TS packet. I assume that you don't need to use filtering PID in PMT or changing SID or MPT PID. In that case can be fix easier.

    EDIT: If you have some eaxmple of such stream, I want to test how will behave merged filter on such situation.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    It's true. PAT and PMT parser are correctly working only when whole PAT or PMT is in one MPEG2 TS packet and is aligned to start of MPEG2 TS packet.
    PAT and PMT sections will almost always fit in one packet and are usually carried on separate PIDs, so I understand why you prefer the simpler code. However, when the code assumptions are not met there is no warning (!!!). Since there was no warning, it took me almost 2 days to find this problem (checking the packet sync, section decoder etc.).. :(

    Also, about packet alignment: there is never any guarantee about this.

    I assume that you don't need to use filtering PID in PMT or changing SID or MPT PID.
    Correct.

    In that case can be fix easier.
    I modified the "if" clause:
    Code:
    if ((postedData > 0) && (this->keepPidValues != NULL) && (this->keepPidValues[PID_PAT] == KEEP_PID_IN_STREAM))

    So, if PID filtering is not active (which is the normal case) then the problem code is avoided.

    EDIT: If you have some eaxmple of such stream, I want to test how will behave merged filter on such situation.
    See attached sample. The sample only contains PAT and PMT to keep the file size small.

    P.S.: Who is using this PID filtering, and what is the purpose/value?
     

    Attachments

    • multiple PMT on single PID.zip
      6.6 KB

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    In that case can be fix easier.
    I modified the "if" clause:
    Code:
    if ((postedData > 0) && (this->keepPidValues != NULL) && (this->keepPidValues[PID_PAT] == KEEP_PID_IN_STREAM))

    So, if PID filtering is not active (which is the normal case) then the problem code is avoided.
    This will not help, because MPEG2 TS packets with PID from 0x0000 until (including) 0x000F and also 0x1FFF are always kept in stream. I was thinking about boolean variable like filteringActive which will be set to false in Load() method (line 1107) and set to true after line 1121.

    EDIT: If you have some eaxmple of such stream, I want to test how will behave merged filter on such situation.
    See attached sample. The sample only contains PAT and PMT to keep the file size small.
    Thanks, I'll check the behaviour of merged filter in such case.

    P.S.: Who is using this PID filtering, and what is the purpose/value?
    Probably @Sebastiii , but he's using merged filter as I know. He has MPEG2 TS stream with one dummy video track and several radio tracks. In such case, TV server creates one TV channel with several audio tracks, but user wants to have several radio channels.
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Hi :)
    Yep free IPTV deliver Radio channel as ont TV channel with multiplse audio track :)
    So if i"m able to help ping me :p

    I have also a TVStream where PMT change depend of source server (different source server it seems).
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    This will not help, because MPEG2 TS packets with PID from 0x0000 until (including) 0x000F and also 0x1FFF are always kept in stream.
    Yes. However, even PID 0 etc. is not put in the keepPidValues array unless PID filtering is configured. So, it does actually work.

    I was thinking about boolean variable like filteringActive which will be set to false in Load() method (line 1107) and set to true after line 1121.
    My code above has the same effect. Yours is probably more understandable. :)
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Yep free IPTV deliver Radio channel as ont TV channel with multiplse audio track :)
    How can the PID filtering help if it is configured in MPIPTVSource.ini? Do you only filter out the video track, or...???
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Yep free IPTV deliver Radio channel as ont TV channel with multiplse audio track :)
    How can the PID filtering help if it is configured in MPIPTVSource.ini? Do you only filter out the video track, or...???
    In new IPTV filter MPIPTVSource.ini is not used anymore (i think) for sure i didn't use that lol
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    Yep free IPTV deliver Radio channel as ont TV channel with multiplse audio track :)
    How can the PID filtering help if it is configured in MPIPTVSource.ini? Do you only filter out the video track, or...???
    It is passed in URL in special format, e.g:
    Code:
    C:|url=http://my.provider.url|KeepPidValue=1024
    In that case in stream are left packets with PIDs: 0x0000 - 0x000F, 0x1FFF and 0x0400.
     

    Users who are viewing this thread

    Top Bottom