On Mon, Nov 24, 2014 at 04:14:06AM +0100, Lukasz Marek wrote: > On 24.11.2014 03:07, Michael Niedermayer wrote: > >On Mon, Nov 24, 2014 at 01:17:29AM +0100, Lukasz Marek wrote: > >>Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com> > >>--- > >> libavcodec/libxvid.c | 4 ++++ > >> 1 file changed, 4 insertions(+) > >> > >>diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c > >>index 020af32..70d52b9 100644 > >>--- a/libavcodec/libxvid.c > >>+++ b/libavcodec/libxvid.c > >>@@ -488,6 +488,7 @@ static av_cold int xvid_encode_init(AVCodecContext > >>*avctx) > >> if (!x->twopassbuffer || !x->old_twopassbuffer) { > >> av_log(avctx, AV_LOG_ERROR, > >> "Xvid: Cannot allocate 2-pass log buffers\n"); > >>+ ret = AVERROR(ENOMEM); > >> goto fail; > >> } > >> x->twopassbuffer[0] = > >>@@ -503,6 +504,7 @@ static av_cold int xvid_encode_init(AVCodecContext > >>*avctx) > >> fd = av_tempfile("xvidff.", &x->twopassfile, 0, avctx); > >> if (fd == -1) { > > > >unrelated to your patch but this should by fd < 0 > > > >and fd would be the error code > > changed. There is a bug in av_tempfile doc btw.
fixed, thanks > > > > > > >> av_log(avctx, AV_LOG_ERROR, "Xvid: Cannot write 2-pass > >> pipe\n"); > >>+ ret = AVERROR(EIO); > >> goto fail; > >> } > >> x->twopassfd = fd; > >>@@ -510,12 +512,14 @@ static av_cold int xvid_encode_init(AVCodecContext > >>*avctx) > >> if (!avctx->stats_in) { > >> av_log(avctx, AV_LOG_ERROR, > >> "Xvid: No 2-pass information loaded for second > >> pass\n"); > >>+ ret = AVERROR(EINVAL); > >> goto fail; > >> } > >> > >> if (strlen(avctx->stats_in) > > >> write(fd, avctx->stats_in, strlen(avctx->stats_in))) { > >> av_log(avctx, AV_LOG_ERROR, "Xvid: Cannot write to 2-pass > >> pipe\n"); > >>+ ret = AVERROR(EIO); > > > >strictly, this should be errno when write returns -1, also av_log() > >might change errno so it has to be read before > >but EIO as it is, is fine too > > Changed. Patch attached. > > libxvid.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > 76629a7567d7360e682c10176848f9624ba9e127 > 0001-lavc-libxvid-return-meaningful-error-codes.patch > From f4481a7af950a1d6ed9f83fd5fdf0ca39fc29b25 Mon Sep 17 00:00:00 2001 > From: Lukasz Marek <lukasz.m.lu...@gmail.com> > Date: Mon, 24 Nov 2014 01:11:45 +0100 > Subject: [PATCH] lavc/libxvid: return meaningful error codes LGTM [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel