diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-10 03:09:46 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-10 03:45:23 +0100 |
commit | afc0a24d7d60f855676d8069011624d52361d7ed (patch) | |
tree | 5480e1c0a3f177805d9a2a85321117a94a2bf878 /libavcodec/sipr.c | |
parent | dec354ba1dcc3c7858277d30c73dac030e2a441e (diff) | |
parent | f1f6d3615f3f9a81f41905ea0c8116b4985870e4 (diff) | |
download | ffmpeg-afc0a24d7d60f855676d8069011624d52361d7ed.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
avcodec: add support for planar signed 8-bit PCM.
ra144enc: add sample_fmts list to ff_ra_144_encoder
smackaud: use uint8_t* for 8-bit output buffer type
smackaud: clip output samples
smackaud: use sign_extend() for difference value instead of casting
sipr: use a function pointer to select the decode_frame function
sipr: set mode based on block_align instead of bit_rate
sipr: do not needlessly set *data_size to 0 when returning an error
ra288: fix formatting of LOCAL_ALIGNED_16
udp: Allow specifying the local IP address
VC1: Add bottom field offset to block_index[] to avoid rewriting (+10L)
vc1dec: move an if() block.
vc1dec: use correct hybrid prediction threshold.
vc1dec: Partial rewrite of vc1_pred_mv()
vc1dec: take ME precision into account while scaling MV predictors.
lavf: don't leak corrupted packets
Conflicts:
libavcodec/8svx.c
libavcodec/ra288.c
libavcodec/version.h
libavformat/iff.c
libavformat/udp.c
libavformat/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/sipr.c')
-rw-r--r-- | libavcodec/sipr.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c index 098d1074a7..20d9da15e6 100644 --- a/libavcodec/sipr.c +++ b/libavcodec/sipr.c @@ -480,15 +480,24 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx) SiprContext *ctx = avctx->priv_data; int i; - if (avctx->bit_rate > 12200) ctx->mode = MODE_16k; - else if (avctx->bit_rate > 7500 ) ctx->mode = MODE_8k5; - else if (avctx->bit_rate > 5750 ) ctx->mode = MODE_6k5; - else ctx->mode = MODE_5k0; + switch (avctx->block_align) { + case 20: ctx->mode = MODE_16k; break; + case 19: ctx->mode = MODE_8k5; break; + case 29: ctx->mode = MODE_6k5; break; + case 37: ctx->mode = MODE_5k0; break; + default: + av_log(avctx, AV_LOG_ERROR, "Invalid block_align: %d\n", avctx->block_align); + return AVERROR(EINVAL); + } av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n", modes[ctx->mode].mode_name); - if (ctx->mode == MODE_16k) + if (ctx->mode == MODE_16k) { ff_sipr_init_16k(ctx); + ctx->decode_frame = ff_sipr_decode_frame_16k; + } else { + ctx->decode_frame = decode_frame; + } for (i = 0; i < LP_FILTER_ORDER; i++) ctx->lsp_history[i] = cos((i+1) * M_PI / (LP_FILTER_ORDER + 1)); @@ -518,8 +527,6 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap, av_log(avctx, AV_LOG_ERROR, "Error processing packet: packet size (%d) too small\n", avpkt->size); - - *data_size = 0; return -1; } @@ -530,8 +537,6 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap, av_log(avctx, AV_LOG_ERROR, "Error processing packet: output buffer (%d) too small\n", *data_size); - - *data_size = 0; return -1; } @@ -540,10 +545,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *datap, for (i = 0; i < mode_par->frames_per_packet; i++) { decode_parameters(&parm, &gb, mode_par); - if (ctx->mode == MODE_16k) - ff_sipr_decode_frame_16k(ctx, &parm, data); - else - decode_frame(ctx, &parm, data); + ctx->decode_frame(ctx, &parm, data); data += subframe_size * mode_par->subframe_count; } |