Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2015-10-15 01:36:38 +0300
committerMarton Balint <cus@passwd.hu>2015-10-22 06:07:46 +0300
commite2b416b68e85f3495d1a55f202dd405824c044c8 (patch)
tree6ce00fe52d962832b820a74e03d285021620098f /ffmpeg.c
parentf4730a58454283ef1141be4152b53a2b45e5a200 (diff)
ffmpeg: factorize checking decoder result
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 4a6031f16f..fc29ad5e7d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1925,6 +1925,15 @@ int guess_input_channel_layout(InputStream *ist)
return 1;
}
+static void check_decode_result(int *got_output, int ret)
+{
+ if (*got_output || ret<0)
+ decode_error_stat[ret<0] ++;
+
+ if (ret < 0 && exit_on_error)
+ exit_program(1);
+}
+
static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
{
AVFrame *decoded_frame, *f;
@@ -1947,11 +1956,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
ret = AVERROR_INVALIDDATA;
}
- if (*got_output || ret<0)
- decode_error_stat[ret<0] ++;
-
- if (ret < 0 && exit_on_error)
- exit_program(1);
+ check_decode_result(got_output, ret);
if (!*got_output || ret < 0)
return ret;
@@ -2088,11 +2093,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
ist->st->codec->has_b_frames);
}
- if (*got_output || ret<0)
- decode_error_stat[ret<0] ++;
-
- if (ret < 0 && exit_on_error)
- exit_program(1);
+ check_decode_result(got_output, ret);
if (*got_output && ret >= 0) {
if (ist->dec_ctx->width != decoded_frame->width ||
@@ -2200,11 +2201,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
int i, ret = avcodec_decode_subtitle2(ist->dec_ctx,
&subtitle, got_output, pkt);
- if (*got_output || ret<0)
- decode_error_stat[ret<0] ++;
-
- if (ret < 0 && exit_on_error)
- exit_program(1);
+ check_decode_result(got_output, ret);
if (ret < 0 || !*got_output) {
if (!pkt->size)