[FFmpeg-devel] [rfc] Applehttp proto documentation Was: [FFmpeg-commits] Add Apple HTTP Live Streaming protocol handler

Martin Storsjö martin
Mon Mar 7 12:04:41 CET 2011


On Mon, 7 Mar 2011, Stefano Sabatini wrote:

> On date Monday 2011-03-07 12:47:32 +0200, Martin Storsj? encoded:
> > On Mon, 7 Mar 2011, Stefano Sabatini wrote:
> > 
> > > BTW would it make sense to integrate the Chase Douglas mpegts
> > > segmenter:
> > > http://svn.assembla.com/svn/legend/segmenter/segmenter.c
> > > 
> > > in tools, or would be better implement it as a write protocol?
> > 
> > Hmm, as a write protocol would be interesting, but I'm not sure if it's 
> > feasible. I guess the mpegts muxer outputs "headers" (whatever that's 
> > called in mpegts terminology) regularly? Ideally, when cutting segments, 
> > new headers would be output at the start of each segment, to ease starting 
> > decoding from that point (which the segmenter above doesn't do, iirc). Is 
> > there a convenient way to trigger emission of such headers at a certain 
> > point?
> 
> Currently AVOutputFormat.write_header() initializes the de/muxer and
> writes the header (if any), similarly AVOutputFormat.write_trailer()
> writes the trailer (if any) and uninit the de/muxer.
> 
> We could split the two functions, i.e. have a separate
> AVOutputFormat.init() and AVOutputFormat.uninit() callbacks. I suppose
> this implies a major revamp of all the de/muxers.
> 
> Or we could add an argument to write_header/trailer():
> int av_write_header2(AVFormatContext *s, int init);
> int av_write_trailer2(AVFormatContext *s, int uninit);
> 
> when init is set to 1 the muxer is initialized before to write the
> header.

That feels like overkill and probably would do more than what would be 
desired here. Mpegts sends these "headers", SDT, PAT and PMT, regularly 
anyway, after a certain number of packets (see retransmit_si_info in 
lavf/mpegtsenc.c). It would be enough to have some flag that can be set, 
saying "please write new headers now", or perhaps named "output stream 
restarted" or something similar, that would force these to be written.

// Martin



More information about the ffmpeg-devel mailing list