[FFmpeg-devel] Bug in av_open_input_stream() since r11071 (ByteIOContext change) [3rd try to send]

matthieu castet castet.matthieu
Sat Dec 22 20:48:57 CET 2007


Hi,

Stefan Lucke wrote:
> Old version in libavformat/utils.c from r11007 looks like:
> 
> int av_open_input_stream(AVFormatContext **ic_ptr,
>                          ByteIOContext *pb, const char *filename,
>                          AVInputFormat *fmt, AVFormatParameters *ap)
> {
>     int err;
>     AVFormatContext *ic;
>     AVFormatParameters default_ap;
> 
>     if(!ap){
>         ap=&default_ap;
>         memset(ap, 0, sizeof(default_ap));
>     }
> 
>     if(!ap->prealloced_context)
>         ic = av_alloc_format_context();
>     else
>         ic = *ic_ptr;
>     if (!ic) {
>         err = AVERROR(ENOMEM);
>         goto fail;
>     }
>     ic->iformat = fmt;
>     if (pb)
>         ic->pb = *pb;
> 
> This instruction was a structure-copy if an address of a
> ByteIOContext is supplied.
> ic's own ByteIOContext was initialized in av_alloc_format_context();
> 
> In current svn version (r11278), supplied parameter pointer gets ic's
> pb independent of it's value.
> 
> line 377: ic->pb = pb;
> 
> It may be NULL in case current format has AVFMT_NOFILE set.
> 
> Attached patch fixes this issue.
AFAIK, format with AVFMT_NOFILE doesn't use ByteIOContext, so it doesn't 
need to be allocated. That the same issue than av_open_input_file.


See http://article.gmane.org/gmane.comp.video.ffmpeg.devel/59965

Matthieu

PS : Are you the author of softdevice ?




More information about the ffmpeg-devel mailing list