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

Michael Niedermayer michaelni
Sun Jun 29 16:43:56 CEST 2008


On Sun, Jun 29, 2008 at 08:56:32AM -0400, Ronald S. Bultje wrote:
> 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...).

You could use "" as filename, which would at least initialize the
array holding the filename

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080629/7004505c/attachment.pgp>



More information about the ffmpeg-devel mailing list