[FFmpeg-devel] [PATCH]yuv4mpeg: Do not set interlaced_frame

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Feb 2 00:13:16 CET 2013


Michael Niedermayer <michaelni <at> gmx.at> writes:

> > > > The documentation of interlaced_frame says that it should 
> > > > only be written by libavcodec, the yuv4mpeg demuxer 
> > > > currently violates this.
> 
> does this fix an actual bug or ticket or is it just 
> a API docs based fix ?

It fixes the following commands with the sample from ticket #2190:
$ ffmpeg -i clip.yuv -f yuv4mpegpipe out1
$ ffmpeg -i clip.yuv -f yuv4mpegpipe -vcodec copy out2
Both output files currently do not contain the 
interlaced property from the input file.

[...]

> > @@ -587,11 +593,6 @@ static int yuv4_read_packet
> >      else if (ret != packet_size)
> >          return s->pb->eof_reached ? AVERROR_EOF : AVERROR(EIO);
> >  
> > -    if (st->codec->coded_frame) {
> > -        st->codec->coded_frame->interlaced_frame = s1->interlaced_frame;
> > -        st->codec->coded_frame->top_field_first  = s1->top_field_first;
> > -    }
> 
> I think this leaves some unused fields

I will send a new patch.

> also did you check that these AVFrame fields still 
> get correctly set after the decoder with this patch ?

I did not check but yuv4mpeg only contains rawvideo 
and our rawvideo decoder sets exactly those fields.
(But I wonder if this shouldn't be set in utils.c 
because if not every decoder has to do it but this 
is a possible future patch.)

> [...]
> >  yuv4mpeg.c |    3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 1d1f91378634a390894503a48e63169bf4472396  patchyuv4mpegnofail.diff
> > diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
> > index ff039bd..7d49b7a 100644
> > --- a/libavformat/yuv4mpeg.c
> > +++ b/libavformat/yuv4mpeg.c
> > @@ -442,10 +442,9 @@ static int yuv4_read_header(AVFormatContext *s)
> >              case 'm':
> >                  av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains mixed "
> >                         "interlaced and non-interlaced frames.\n");
> > -                return -1;
> > +                break;
> 
> ok

Hunk applied.

> >              default:
> >                  av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n");
> > -                return -1;
> 
> does this fix an actual file ?

No, dropped if you prefer.

Carl Eugen



More information about the ffmpeg-devel mailing list