[FFmpeg-cvslog] libspeex: support ZygoAudio (quality 10 mode)

Piotr Bandurski git at videolan.org
Sat Mar 23 15:59:11 CET 2013


ffmpeg | branch: master | Piotr Bandurski <ami_stuff at o2.pl> | Wed Jan 16 19:32:54 2013 +0100| [e26b066cd8db361feba90e943c6cfdf062c52272] | committer: Michael Niedermayer

libspeex: support ZygoAudio (quality 10 mode)

Fixes "quality 10" mode from Ticket1873

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e26b066cd8db361feba90e943c6cfdf062c52272
---

 libavcodec/libspeexdec.c |   12 +++++++++++-
 libavformat/isom.c       |    1 +
 libavformat/mov.c        |    4 +++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c
index 7c1ffa6..213eee4 100644
--- a/libavcodec/libspeexdec.c
+++ b/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;
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 3f419a8..4078c0d 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -293,6 +293,7 @@ const AVCodecTag ff_codec_movaudio_tags[] = {
     { AV_CODEC_ID_QDM2,            MKTAG('Q', 'D', 'M', '2') },
     { AV_CODEC_ID_QDMC,            MKTAG('Q', 'D', 'M', 'C') },
     { AV_CODEC_ID_SPEEX,           MKTAG('s', 'p', 'e', 'x') }, /* Flash Media Server */
+    { AV_CODEC_ID_SPEEX,           MKTAG('S', 'P', 'X', 'N') },
     { AV_CODEC_ID_WMAV2,           MKTAG('W', 'M', 'A', '2') },
     { AV_CODEC_ID_EVRC,            MKTAG('s', 'e', 'v', 'c') }, /* 3GPP2 */
     { AV_CODEC_ID_SMV,             MKTAG('s', 's', 'm', 'v') }, /* 3GPP2 */
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 577c0e9..3c54ef3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1033,7 +1033,9 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     if ((uint64_t)atom.size > (1<<30))
         return AVERROR_INVALIDDATA;
 
-    if (st->codec->codec_id == AV_CODEC_ID_QDM2 || st->codec->codec_id == AV_CODEC_ID_QDMC) {
+    if (st->codec->codec_id == AV_CODEC_ID_QDM2 ||
+        st->codec->codec_id == AV_CODEC_ID_QDMC ||
+        st->codec->codec_id == AV_CODEC_ID_SPEEX) {
         // pass all frma atom to codec, needed at least for QDMC and QDM2
         av_free(st->codec->extradata);
         st->codec->extradata_size = 0;



More information about the ffmpeg-cvslog mailing list