From f7813a5324be39d13ab536c245d15dfc602a7849 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 29 Dec 2013 12:19:38 +0000 Subject: basic type mechanism working --- ffmpeg/libavcodec/libspeexdec.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'ffmpeg/libavcodec/libspeexdec.c') diff --git a/ffmpeg/libavcodec/libspeexdec.c b/ffmpeg/libavcodec/libspeexdec.c index 7c1ffa6..afe1176 100644 --- a/ffmpeg/libavcodec/libspeexdec.c +++ b/ffmpeg/libavcodec/libspeexdec.c @@ -50,7 +50,17 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx) if (!header) av_log(avctx, AV_LOG_WARNING, "Invalid Speex header\n"); } - if (header) { + if (avctx->codec_tag == MKTAG('S', 'P', 'X', 'N')) { + if (!avctx->extradata || avctx->extradata && avctx->extradata_size < 47) { + av_log(avctx, AV_LOG_ERROR, "Missing or invalid extradata.\n"); + return AVERROR_INVALIDDATA; + } + if (avctx->extradata[37] != 10) { + av_log(avctx, AV_LOG_ERROR, "Unsupported quality mode.\n"); + return AVERROR_PATCHWELCOME; + } + spx_mode = 0; + } else if (header) { avctx->sample_rate = header->rate; avctx->channels = header->nb_channels; spx_mode = header->mode; @@ -170,6 +180,7 @@ static av_cold void libspeex_decode_flush(AVCodecContext *avctx) AVCodec ff_libspeex_decoder = { .name = "libspeex", + .long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"), .type = AVMEDIA_TYPE_AUDIO, .id = AV_CODEC_ID_SPEEX, .priv_data_size = sizeof(LibSpeexContext), @@ -178,5 +189,4 @@ AVCodec ff_libspeex_decoder = { .decode = libspeex_decode_frame, .flush = libspeex_decode_flush, .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DELAY | CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"), }; -- cgit v1.2.3