[FFmpeg-cvslog] pcm_bluray: Return AVERROR_INVALIDDATA instead of -1 on header errors

Christian Schmidt git at videolan.org
Tue Aug 6 19:45:21 CEST 2013


ffmpeg | branch: master | Christian Schmidt <schmidt at digadd.de> | Tue Aug  6 10:21:42 2013 +0200| [1c6d2bb9a9279d8df4e8bcdc1e1e2741723dc7c9] | committer: Diego Biurrun

pcm_bluray: Return AVERROR_INVALIDDATA instead of -1 on header errors

Signed-off-by: Diego Biurrun <diego at biurrun.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c6d2bb9a9279d8df4e8bcdc1e1e2741723dc7c9
---

 libavcodec/pcm-mpeg.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/pcm-mpeg.c b/libavcodec/pcm-mpeg.c
index e13e2b0..7b7afed 100644
--- a/libavcodec/pcm-mpeg.c
+++ b/libavcodec/pcm-mpeg.c
@@ -1,6 +1,6 @@
 /*
  * LPCM codecs for PCM formats found in MPEG streams
- * Copyright (c) 2009 Christian Schmidt
+ * Copyright (c) 2009, 2013 Christian Schmidt
  *
  * This file is part of Libav.
  *
@@ -72,7 +72,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
     avctx->bits_per_coded_sample = bits_per_samples[header[3] >> 6];
     if (!avctx->bits_per_coded_sample) {
         av_log(avctx, AV_LOG_ERROR, "reserved sample depth (0)\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? AV_SAMPLE_FMT_S16 :
                                                              AV_SAMPLE_FMT_S32;
@@ -93,7 +93,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
         avctx->sample_rate = 0;
         av_log(avctx, AV_LOG_ERROR, "reserved sample rate (%d)\n",
                header[2] & 0x0f);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     /*
@@ -107,7 +107,7 @@ static int pcm_bluray_parse_header(AVCodecContext *avctx,
     if (!avctx->channels) {
         av_log(avctx, AV_LOG_ERROR, "reserved channel configuration (%d)\n",
                channel_layout);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     avctx->bit_rate = FFALIGN(avctx->channels, 2) * avctx->sample_rate *
@@ -135,11 +135,11 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data,
 
     if (buf_size < 4) {
         av_log(avctx, AV_LOG_ERROR, "PCM packet too small\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
-    if (pcm_bluray_parse_header(avctx, src))
-        return -1;
+    if ((retval = pcm_bluray_parse_header(avctx, src)))
+        return retval;
     src += 4;
     buf_size -= 4;
 



More information about the ffmpeg-cvslog mailing list