[FFmpeg-devel] [PATCH] MpegEncContext must be initialized before calling ff_h263_decode_init

Kostya kostya.shishkov
Sat Jun 27 20:14:01 CEST 2009

On Sat, Jun 27, 2009 at 07:43:38PM +0200, Reimar D?ffinger wrote:
> On Sat, Jun 27, 2009 at 07:38:05PM +0300, Kostya wrote:
> > On Sat, Jun 27, 2009 at 11:19:48AM +0200, Reimar D?ffinger wrote:
> > > Hello,
> > > ff_h263_decode_init calls MPV_common_init which then need mb_width to
> > > calculate mb_stride.
> > > So my conclusion is, MpegEncContext needs to be initialized before
> > > calling this function.
> > > This is probably what issue1233 is about.
> >  
> > I've read issue 1233 and looks like the problem is with him not
> > initializing codec properly - you should set width and height to
> > real values before calling avcodec_open(), otherwise it's GIGO.
> Yes, the documentation say so, but if the detection finds different
> dimensions it will still crash, there is no way the application could
> avoid that (except by parsing the VC1 stream itself).
> Also, how does the VC1 decoder handle streams that change resolution
> mid-stream? Because I have the suspicion that it's exactly the same
> code that is needed for both cases...

Well, resolution change inside stream is always fun unless codec was
designed to handle that (like RV3/4).

If that occurs in VC-1 it's possible to catch that in sequence
header parsing and tell decoder to reinit. And I suspect
MPV_common_{init,end} would be enough for that.

Anyway, that seems rather theoretical to me...

More information about the ffmpeg-devel mailing list