summaryrefslogtreecommitdiff
path: root/ffmpeg/libavcodec/libspeexdec.c
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
committerTim Redfern <tim@eclectronics.org>2013-12-29 12:19:38 +0000
commitf7813a5324be39d13ab536c245d15dfc602a7849 (patch)
treefad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavcodec/libspeexdec.c
parentb7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff)
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavcodec/libspeexdec.c')
-rw-r--r--ffmpeg/libavcodec/libspeexdec.c14
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"),
};