[FFmpeg-devel] [PATCH] allow empty params for av_open_input_stream()

Ronald S. Bultje rsbultje
Sun Jun 29 14:56:32 CEST 2008


Hi,

On Sun, Jun 29, 2008 at 4:25 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> Index: ffmpeg/libavformat/utils.c
>> ===================================================================
>> --- ffmpeg.orig/libavformat/utils.c   2008-06-28 15:17:54.000000000 -0400
>> +++ ffmpeg/libavformat/utils.c        2008-06-28 17:32:38.000000000 -0400
>> @@ -381,7 +381,7 @@
>>      ic->pb = pb;
>>      ic->duration = AV_NOPTS_VALUE;
>>      ic->start_time = AV_NOPTS_VALUE;
>> -    av_strlcpy(ic->filename, filename, sizeof(ic->filename));
>> +    if (filename) av_strlcpy(ic->filename, filename, sizeof(ic->filename));
>>
>>      /* allocate private data */
>>      if (fmt->priv_data_size > 0) {
>
> I dont see the sense of this hunk

So in order to allocate a AVFormatContext for the real demuxer in my
RDT parser, I use av_open_input_stream(&ctx, NULL, rdt_parser, NULL,
NULL);, where rdt_parser is completely empty except for RMContext
size. I could then use av_close_input_stream() to close it all. The
filename is NULL, so av_strlcpy() crashes. Alternatively, I could use
a fake filename (I don't have access to the RTSP stream filename at
this level...).

Ronald




More information about the ffmpeg-devel mailing list