[FFmpeg-devel] [PATCH] fix sdp(file) vs rtsp dep

Luca Abeni lucabe72
Thu Nov 12 10:20:22 CET 2009

Diego Biurrun wrote:
> On Wed, Nov 11, 2009 at 11:28:24AM +0100, Luca Abeni wrote:
>> Luca Abeni wrote:
>> [...]
>>>> Anyway, the patch is quite big.  Maybe you could split it by first
>>>> moving the functions around.
>>> Ok; I'll try to do this when I'll find some more time to work on this
>>> patch.
>> Next round of patches:
>> - move_functions-2.diff moves some code around, to simplify the following
>>   patches
> Luca B told me on IRC that moving functions around is OK, so you should
> just commit this.

Ok; I am going to commit it soon.

>> - split_read-1.diff splits the sdp_read_packet() function out of
>>   rtsp_read_packet(). This allows to avoid compiling RTSP code when not
>>   needed (as done in the next patch).
>> - add-ifdefs.diff adds some ifdefs to avoid compiling the RTSP code when
>>   the RTSP demuxer is disabled, and removes a useless "#if 
>> The last patch should make it clear why I think that the RTSP demuxer
>> should depend on the SDP demuxer and not vice-versa...
>> I did not do any renaming yet, but I think it can be done later.
>> Some work is still needed to split the code in two different files
>> (sdp.c and rtsp.c) but I have no time right now...
> I'm not sure if this is really simpler than renaming and splitting the
> file right away, whatever, if you think it is, go for it...

It surely is faster... And I have not much time right now :)
I'll commit this unless anyone disagrees.

>> --- ffmpeg.orig/libavformat/rtsp.c	2009-11-11 09:11:15.000000000 +0100
>> +++ ffmpeg/libavformat/rtsp.c	2009-11-11 09:12:48.000000000 +0100
>> @@ -43,6 +43,8 @@
>>  //#define DEBUG
>>  //#define DEBUG_RTP_TCP
>> +static int tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
>> +                           uint8_t *buf, int buf_size);
>>  static int rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
>>                             unsigned char **content_ptr,
>>                             int return_on_interleaved_data);
> Ugh, more forward declarations.  Can't these be avoided?

this one (tcp_read_packet()) can be avoided by moving the tcp_read_packet()
function (which is used only by RTSP, hence is under "#if CONFIG_RTSP_DEMUXER")
before sdp_read_packet(). So, this would increase the number of "#if"s.
If this is ok, I can remove the forward declaration for tcp_read_packet().

The forward declaration for rtsp_read_reply() could be avoided by removing
its invocation from udp_read_packet() (and moving it to rtsp_read_packet()).
But this would be a functional change that can potentially break something,
so I'd prefer to have it in a different commit. (I still have to try such
an idea, so I have no patch yet).


More information about the ffmpeg-devel mailing list