[FFmpeg-devel] [PATCH] Add an RTSP muxer

Martin Storsjö martin
Tue Jan 5 11:31:32 CET 2010


Hi Luca, Ronald,

On Tue, 5 Jan 2010, Martin Storsj? wrote:

> On Mon, 4 Jan 2010, Luca Abeni wrote:
> 
> > - I need to better understand your rtpenc.c patches. Well, I understand what
> > the patches do, but I do not understand why all those changes are needed (for
> > example, patch 10/24 says "Use the AVStream st member from RTPMuxContext
> > instead of AVFormatContext->streams[0]", but it does not explain why. BTW, I
> > just noticed that the "st" field of RTPMuxContext seems to be unused...).
> 
> > It seems that your goal is to use the rtpenc code without using an 
> > output format context... Why? Cannot the RTSP muxer create one or more 
> > proper RTP muxers, and use them, instead of exposing some of the RTP 
> > muxer internals?
> 
> Yes, that was my goal. I wasn't really sure how to chain the muxers, to 
> connect the AVStream* that the user set in the RTSP AVFormatContext to the 
> internal RTP AVFormatContexts (just simply copy the pointers?), and thus I 
> thought using RTPMuxContext directly would be leaner.
> 
> From both your and Ronalds reactions, I see that you'd prefer me to use 
> the full AVFormatContext interface inbetween.

I tried creating full proper RTP muxers for each of the streams, and while 
it does work, it feels more messy to me. Attached is a patch that 
describes the changes I made to my RTSP muxer to switch it from using my 
internal RTP muxer interface to using a full AVFormatContext inbetween.

If this approach is chosen, I can drop most of my patches to the RTP muxer 
and some of the SDP patches, though.

Downsides to this approach, in my opinion:

- I store the RTP AVFormatContext in rtsp_st->transport_priv, and thus 
initializes it long before the proper initialization point in 
rtsp_open_transport_ctx. This, since I need to create the AVFormatContexts 
before doing the setup, in order to use the contexts for creating the SDP 
(as the correct approach was, as I understood from Luca).

- To get the codec parameters available to the RTP muxer, I simply free 
the newly created AVCodecContext and copy the pointer to the 
AVCodecContext of the original AVStream in the RTSP muxer. Instead of 
copying the pointer, the relevant parts (extradata, frame_size, etc) could 
be copied instead, of course.

Given this comparison, what's your opinion - internal RTP muxer interface 
or proper chained AVFormatContexts within the RTSP muxer?

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtp-muxer-interface.patch
Type: text/x-diff
Size: 5479 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100105/e788c50e/attachment.patch>



More information about the ffmpeg-devel mailing list