[Live-devel] how to build FramedSource from character/uint8 buffer

Ross Finlayson finlayson at live555.com
Mon May 1 11:03:15 PDT 2006


>i want to stream mpeg2 ts read from /dev/dvb/adapter0/dvr0 to an ip 
>multicast address through rtp. it's been converted to PES

If you have the original Transport Stream data, then it's far better 
to just stream that, as is. rather than first converting to PES, and 
then converting PES back to Transport Stream.

To stream from a file that contains Transport Stream data, simply 
read from a "ByteStreamFileSource" that has been created to use a 
fixed block size (an integral multiple of 33 - the Transport Stream 
packet size).  See the code for "testMPEG2TransportStreamer" for illustration.

>  and put on a buffer. my understanding is that i have to build 
> MPEG1or2Demux --> MPEG1or2DemuxedElementaryStream --> 
> MPEG2TransportStreamFromPESSource --> RTPSink. but how can i build 
> a FramedSource from the buffer to be fed to MPEG1or2Demux? which 
> class should i subclass and which methods should i override?

If, however, you *must* stream from PES-format data, then you will 
need to write your own class (a subclass of "FramedSource") that 
delivers complete, discrete PES packets, one at a time.  For a model 
of how to do this, see "liveMedia/DeviceSource.cpp",  Your class 
would then feed into a "MPEG2TransportStreamFromPESSource", which 
would in turn feed into a new class - which you would write - that 
collects 33-byte Transport Stream packets into groups of 7, to make a 
packet sized appropriately for streaming.

But to make a long story short, it is *much* easier if you can read 
the data in Transport Stream (rather than PES) format - then you can 
just stream it as is (see above).


	Ross Finlayson
	Live Networks, Inc. (LIVE555.COM)
	<http://www.live555.com/>



More information about the live-devel mailing list