diff options
Diffstat (limited to 'ffmpeg/libavcodec/libspeexdec.c')
| -rw-r--r-- | ffmpeg/libavcodec/libspeexdec.c | 14 |
1 files changed, 12 insertions, 2 deletions
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"), }; |
