aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/pcm.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-27 19:24:47 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-26 12:01:06 -0400
commit381e195b46d080aee1d9b05ef2b6b140e9463519 (patch)
treea8886e2453d3d7925a718ad56f974f5aa32df675 /libavcodec/pcm.c
parent6b94711f15257dfd1b45596e060b88a26059bc0d (diff)
downloadffmpeg-381e195b46d080aee1d9b05ef2b6b140e9463519.tar.gz
pcmdec: move DVD PCM bits_per_coded_sample check near to the code that sets
the sample size.
Diffstat (limited to 'libavcodec/pcm.c')
-rw-r--r--libavcodec/pcm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 4b115836fd..158366c19a 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -279,10 +279,15 @@ static int pcm_decode_frame(AVCodecContext *avctx,
sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
/* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
- if (CODEC_ID_PCM_DVD == avctx->codec_id)
+ if (CODEC_ID_PCM_DVD == avctx->codec_id) {
+ if (avctx->bits_per_coded_sample != 20 &&
+ avctx->bits_per_coded_sample != 24) {
+ av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
+ return AVERROR(EINVAL);
+ }
/* 2 samples are interleaved per block in PCM_DVD */
sample_size = avctx->bits_per_coded_sample * 2 / 8;
- else if (avctx->codec_id == CODEC_ID_PCM_LXF)
+ } else if (avctx->codec_id == CODEC_ID_PCM_LXF)
/* we process 40-bit blocks per channel for LXF */
sample_size = 5;
@@ -433,9 +438,6 @@ static int pcm_decode_frame(AVCodecContext *avctx,
src = src8;
}
break;
- default:
- av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
- return -1;
}
samples = (uint8_t *) dst_int32_t;
break;