[MPlayer-dev-eng] [PATCH] Pass down error code from muxer_lavf av_write_header

Tobias Diedrich ranma+mplayer at tdiedrich.de
Mon Jul 4 20:43:10 CEST 2011


Diego Biurrun wrote:
> On Fri, Jul 01, 2011 at 01:15:19PM +0200, Tobias Diedrich wrote:
> > The proper fix for the division by 0 when av_write_header failed is
> > to pass down the error code and not try to write chunks with the
> > muxer in a bad state.
> > 
> > This changes the cont_write_header, muxer_flush and
> > muxer_write_chunk prototypes to return an int (1 on success, 0 on
> > failure) and adjusts all the calling sites.
> > 
> > For mencoder I used a small wrapper that calls mencoder_exit if
> > muxer_write_chunk fails, alternatively we could check the success
> > at each call.
> 
> I like the patch overall, not sure if the wrapper is better than
> checking each call.  Maybe Reimar has an opinion.
> 
> > --- libmpcodecs/ve_qtvideo.c.orig	2011-07-01 12:50:40.050956000 +0200
> > +++ libmpcodecs/ve_qtvideo.c	2011-07-01 13:03:09.300796000 +0200
> > @@ -198,6 +198,7 @@
> >      int height = mpi->height;
> >      int stride = width*2;
> > +    int ret=0;
> > @@ -277,7 +278,10 @@
> >      printf("Ratio: %i:1\n",(stride*height)/compressedsize);
> >  #endif
> > -    muxer_write_chunk(mux_v, compressedsize , similarity?0:0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
> > +    ret=muxer_write_chunk(mux_v, compressedsize , similarity?0:0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
> 
> Please give the '=' some room to breathe.

Done

> > --- mencoder.c.orig	2011-07-01 12:50:40.223889000 +0200
> > +++ mencoder.c	2011-07-01 13:03:16.532250000 +0200
> > @@ -286,6 +286,14 @@
> >  
> > +
> > +static void mencoder_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double dts, double pts)
> 
> nit: Please break this overly long line.

Done, updated patch attached.

-- 
Tobias						PGP: http://8ef7ddba.uguu.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: muxer_check_errorcode.patch
Type: text/x-diff
Size: 19342 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20110704/14b4539f/attachment.bin>


More information about the MPlayer-dev-eng mailing list