IPTV/DVB-IP in MP: Support for http, rtp and udp (1 Viewer)

Stepko

Retired Team Member
  • Premium Supporter
  • September 29, 2007
    186
    152
    Hamburg/Wolfsburg
    Home Country
    Germany Germany
    Hi all,

    What is it?
    it is possible to watch TV not only via dvb-t/s or c, you can also watch TV via DVB-IP aka IPTV. The TV streams are transmitted on your internet connection. More and more ISPs offer TV on their networks.

    DVB-IP in MP
    The good thing is that the TV-Server already comes with a software DVB-IP "card". You can enable it in the TV config under "TV Servers" -> <your Servername>.
    The bad thing is that MP only supports udp streams. But some ISPs uses rtp or even http to transmit the streams. Dimka and me developed a direct show filter based on mikeykos original version that supports rtp and http. With that filter you are able to play rtp and http streams as well as udp streams. The new filter supports uni- and mulitcast (on udp and rtp). This was done one year ago.

    There is an old thread where you can find all the infos on the development.

    Over the last few weeks I changed some things on the filter. As the changes are quite big and the old thread was getting more and more confusing, I think its time to start a new one.

    New version
    When it comes to rtp and udp the filter now works far more stable than ever before. The old filter lost packets when the system was busy. The new filter works very reliable.

    Need your help / Report a bug
    If you want to help us to improove the filter or if you found a bug, please report it in the development thread for the IPTV filter. All development is done there, now. :D

    Compatibility
    New version is compatible and tested with MP 1.1.3 and MP 1.2.0 Beta.

    Installation
    To use the new version just follow these simple steps:
    • Stop the TV service in the TV Config (under "Manual Control")
    • Go to the TV server directory (e.g. C:\Program files\Team MediaPortal\MediaPortal TV Server)
    • Make a backup of the original MPIPTVSource.ax
    • Replace the original file with the one attached
    • Start the TV Service in the TV Config

    You need a playlist file for your ISP to do the channelscan. The urls are in the form "rtp://233.1.1.1:1234" or "udp://123.1.2.3:1111" or "http://123.1.2.3:1111".

    Download
    You can download the latest version in the development thread.

    :D for testing and have fun.
    Stepko
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    Hi,

    are sources of latest MPITVSource in SVN or you have your own copy without checking changes in SVN?
     

    Stepko

    Retired Team Member
  • Premium Supporter
  • September 29, 2007
    186
    152
    Hamburg/Wolfsburg
    Home Country
    Germany Germany
    AW: Re: IPTV/DVB-IP in MP: Support for http, rtp and udp

    Hi georgius,

    no, the sources are unfortunately not in the svn. You can find the sources for the old version of the filter in the development forum. I didn't upload the source for ther new version, yet.

    Stepko
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    Re: AW: Re: IPTV/DVB-IP in MP: Support for http, rtp and udp

    Hi Stepko,

    can you post sources of new version here? I have access to UDP streams and I think that with latest source code I can find and fix problems with UDP streams faster than you (you wrote that you don't use UDP streams).

    georgius
     

    Stepko

    Retired Team Member
  • Premium Supporter
  • September 29, 2007
    186
    152
    Hamburg/Wolfsburg
    Home Country
    Germany Germany
    AW: Re: AW: Re: IPTV/DVB-IP in MP: Support for http, rtp and udp

    Hi georgius,

    it would be great, if you would help fixing the udp bug. But there is a little problem: Due to my new job I'm travelling a lot, and the sources are on my computer at home. Thats why I can't upload the source before the weekend, sorry!

    In the new version of the filter I changed the way how the filter gets the data from the winsocket. The old way was to check every x milliseconds if there are data in the socket (polling). The new filter registers a callback event and sleeps until this event is set or a timeout occurs. Thats why the data getting part now runs in a different thread. To synchronize data between these two threads I needed to introduce a buffer for udp. I'm sure that the problem is this new introduced buffer, either filling the buffer or reading the buffer.

    I will describe the process a bit more when I upload the sources.

    Stepko
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    Re: AW: Re: AW: Re: IPTV/DVB-IP in MP: Support for http, rtp and udp

    Hi Stepko,

    I'm looking forward for your source codes and I hope that we will fix UDP streams :)
     

    velis

    MP Donator
  • Premium Supporter
  • July 16, 2009
    237
    50
    Radovljica
    Home Country
    Slovenia Slovenia
    I agree. Though I thought I'd be fixing UDP :) No prob, I much rather someone else does it }:)
    Geourgius, if you'll be doing the fixing, could you also look into this post and see if you can do that as well? I explained how I'd do it a bit later in the thread (same page though). It shouldn't be too hard...
     

    georgius

    Retired Team Member
  • Premium Supporter
  • October 31, 2010
    1,376
    654
    Bratislava
    Home Country
    Slovakia Slovakia
    As soon as Stepko post here his source codes, I'll look on your enhancement request. I think that your post is good idea. In language resources I found resource with ID 100749 "TV/No signal" so it seems that MP has ability to alert user that there is no signal.
     

    velis

    MP Donator
  • Premium Supporter
  • July 16, 2009
    237
    50
    Radovljica
    Home Country
    Slovenia Slovenia
    Yes, but lately I was thinking of simply composing some "snow" short clip and be done with it. "snow" as in no analog signal, as it used to be with television sets of old :) There's not even any need to complicate things with "no signal" text.
     

    Stepko

    Retired Team Member
  • Premium Supporter
  • September 29, 2007
    186
    152
    Hamburg/Wolfsburg
    Home Country
    Germany Germany
    AW: Re: IPTV/DVB-IP in MP: Support for http, rtp and udp

    Hi ho,

    find attached the source of the current version. The project file is a VS2005 file, but newer versions of VS should convert it without any problems. I think you need the DirectX sdk to build it (not sure).
    As I already wrote I think the bug is somewhere in the buffer that I needed to add. Luckily the udp part is rather small. You just need to check 2 parts: The part where the buffer gets filled is in method "WinsockWorker". This method runs in a different thread than the rest of the filter. The udp part is beginning with line 598 and ends with line 682 of mpiptvsource.cs.
    The second part is in methos "FillBuffer" and goes from line 419 to line 451 of the same file. The rest of the source are rtp, http and setup things.
    My idea was to use a buffer of fixed size. I wanted to aviod "new"-calls on every single packet. From my experience "new" and "delete" calls are the most expensive calls. When the buffer is filled up, the size is doubled and the old content is copied to the new buffer. There are 4 variables for this buffer:
    • dataBuffer: Pointer to the buffer
    • currentBufferSize: Total size of buffer
    • dataStart: Pointer to the first data within the buffer. Must be somewhere between dataBuffer and (dataBuffer+currentBufferSize)
    • currentBufferUsed: Bytes of data in the buffer. Must be smaller or equal to currentBufferSize

    The buffer logic got quite complex because the data is never moved within the buffer. When the end of the buffer is reached, the buffer size is doubled (buffer is full from beginning to end) or the data is written at the begining of the filter (the first bytes are already sent to the next directShow filter and the beginning of the buffer is marked as "free").
    I thought this is the less cpu consuming way to do it. But perhaps you have a better idea...

    I you have any questions, just ask.

    Stepko
     

    Attachments

    • MPIPTVSource.zip
      47.7 KB

    Users who are viewing this thread

    Top Bottom