[MPlayer-dev-eng] [PATCH] Pass down error code from muxer_lavf av_write_header
Diego Biurrun
diego at biurrun.de
Sun Jul 3 13:15:40 CEST 2011
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.
> --- 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.
Diego
More information about the MPlayer-dev-eng
mailing list