Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-21 22:08:05 +0300
committerMichael Niedermayer <michaelni@gmx.at>2014-11-21 22:08:05 +0300
commitd96d8e121f1e423ba31dca972c07613cf32076c6 (patch)
tree83573f06eb021f5785be56a30c7064628373e256 /libavcodec/libspeexdec.c
parent2ae2c60554c2731e21a41c3f32a225f0a9fb9b26 (diff)
avcodec/libspeexdec: support zygoaudio
Fixes Ticket1873 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libspeexdec.c')
-rw-r--r--libavcodec/libspeexdec.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c
index 5e149a5d5c..1e4c05a9aa 100644
--- a/libavcodec/libspeexdec.c
+++ b/libavcodec/libspeexdec.c
@@ -33,6 +33,7 @@ typedef struct {
SpeexStereoState stereo;
void *dec_state;
int frame_size;
+ int pktsize;
} LibSpeexContext;
@@ -50,14 +51,20 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_WARNING, "Invalid Speex header\n");
}
if (avctx->codec_tag == MKTAG('S', 'P', 'X', 'N')) {
+ int quality;
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) {
+
+ quality = avctx->extradata[37];
+ if (quality > 10) {
av_log(avctx, AV_LOG_ERROR, "Unsupported quality mode.\n");
return AVERROR_PATCHWELCOME;
}
+
+ s->pktsize = ((int[]){5,10,15,20,20,28,28,38,38,46,62})[quality];
+
spx_mode = 0;
} else if (header) {
avctx->sample_rate = header->rate;
@@ -143,9 +150,11 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
*got_frame_ptr = 0;
return buf_size;
}
+ if (s->pktsize && buf_size == 62)
+ buf_size = s->pktsize;
/* set new buffer */
speex_bits_read_from(&s->bits, buf, buf_size);
- consumed = buf_size;
+ consumed = avpkt->size;
}
/* decode a single frame */