aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-03-06 23:56:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-07 00:01:32 +0100
commitff9b607489e6b295d57b9b97f1c23b0a66b273a6 (patch)
tree80809ec3d8a177a713f5706fafc4a7985e51cb78
parent90f8b2ce48cfbffeb64779a8c2d55a1e078b4657 (diff)
parent5a4e9fe855282a99586050a507d0a486ad39df5b (diff)
downloadffmpeg-ff9b607489e6b295d57b9b97f1c23b0a66b273a6.tar.gz
Merge commit '5a4e9fe855282a99586050a507d0a486ad39df5b'
* commit '5a4e9fe855282a99586050a507d0a486ad39df5b': avcodec/internal: Fix #if DECODE_AUDIO / ENCODE_AUDIO name mismatch shorten: use the unsigned type where needed Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/internal.h2
-rw-r--r--libavcodec/shorten.c17
2 files changed, 12 insertions, 7 deletions
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 14f7918dbd..af9e58eead 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -62,7 +62,7 @@ typedef struct AVCodecInternal {
*/
int is_copy;
-#if FF_API_OLD_DECODE_AUDIO
+#if FF_API_OLD_ENCODE_AUDIO
/**
* Internal sample count used by avcodec_encode_audio() to fabricate pts.
* Can be removed along with avcodec_encode_audio().
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 82cc06cf1c..3a6d634012 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -87,7 +87,7 @@ typedef struct ShortenContext {
GetBitContext gb;
int min_framesize, max_framesize;
- int channels;
+ unsigned channels;
int32_t *decoded[MAX_CHANNELS];
int32_t *decoded_base[MAX_CHANNELS];
@@ -338,7 +338,11 @@ static int read_header(ShortenContext *s)
s->internal_ftype = get_uint(s, TYPESIZE);
s->channels = get_uint(s, CHANSIZE);
- if (s->channels <= 0 || s->channels > MAX_CHANNELS) {
+ if (!s->channels) {
+ av_log(s->avctx, AV_LOG_ERROR, "No channels reported\n");
+ return AVERROR_INVALIDDATA;
+ }
+ if (s->channels > MAX_CHANNELS) {
av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);
s->channels = 0;
return AVERROR_INVALIDDATA;
@@ -347,10 +351,11 @@ static int read_header(ShortenContext *s)
/* get blocksize if version > 0 */
if (s->version > 0) {
- int skip_bytes, blocksize;
+ int skip_bytes;
+ unsigned blocksize;
blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));
- if (!blocksize || blocksize > (unsigned)MAX_BLOCKSIZE) {
+ if (!blocksize || blocksize > MAX_BLOCKSIZE) {
av_log(s->avctx, AV_LOG_ERROR,
"invalid or unsupported block size: %d\n",
blocksize);
@@ -500,13 +505,13 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data,
s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
break;
case FN_BLOCKSIZE: {
- int blocksize = get_uint(s, av_log2(s->blocksize));
+ unsigned blocksize = get_uint(s, av_log2(s->blocksize));
if (blocksize > s->blocksize) {
av_log(avctx, AV_LOG_ERROR,
"Increasing block size is not supported\n");
return AVERROR_PATCHWELCOME;
}
- if (!blocksize || blocksize > (unsigned)MAX_BLOCKSIZE) {
+ if (!blocksize || blocksize > MAX_BLOCKSIZE) {
av_log(avctx, AV_LOG_ERROR, "invalid or unsupported "
"block size: %d\n", blocksize);
return AVERROR(EINVAL);