[FFmpeg-cvslog] nellymoserdec: Use sidedata to support mid stream sample rate changes.

Michael Niedermayer git at videolan.org
Wed Nov 30 21:30:51 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov 30 21:17:57 2011 +0100| [11828b8885cc1d87ffc7b1b4bbe642ce9720b194] | committer: Michael Niedermayer

nellymoserdec: Use sidedata to support mid stream sample rate changes.

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

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

 libavcodec/nellymoserdec.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index cd05482..cf73121 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -149,6 +149,7 @@ static int decode_tag(AVCodecContext * avctx,
                       void *data, int *data_size,
                       AVPacket *avpkt) {
     const uint8_t *buf = avpkt->data;
+    const uint8_t *side=av_packet_get_side_data(avpkt, 'F', NULL);
     int buf_size = avpkt->size;
     NellyMoserDecodeContext *s = avctx->priv_data;
     int data_max = *data_size;
@@ -179,6 +180,8 @@ static int decode_tag(AVCodecContext * avctx,
      * 22050 Hz - 4
      * 44100 Hz - 8
      */
+    if(side && blocks>1 && avctx->sample_rate%11025==0 && (1<<((side[0]>>2)&3)) == blocks)
+        avctx->sample_rate= 11025*(blocks/2);
 
     for (i=0 ; i<blocks ; i++) {
         if (avctx->sample_fmt == SAMPLE_FMT_FLT) {



More information about the ffmpeg-cvslog mailing list