[FFmpeg-cvslog] Set the bitrate when decoding speex.

Carl Eugen Hoyos git at videolan.org
Mon Apr 14 16:44:02 CEST 2014


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Mon Apr 14 15:36:01 2014 +0200| [ef48ac6523c738d77636456afaef18be92c694f8] | committer: Carl Eugen Hoyos

Set the bitrate when decoding speex.

The bitrate of the first frame is used as bitrate for the speex stream.

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

 libavcodec/libspeexdec.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c
index afe1176..53e06d9 100644
--- a/libavcodec/libspeexdec.c
+++ b/libavcodec/libspeexdec.c
@@ -43,7 +43,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
     SpeexHeader *header = NULL;
     int spx_mode;
 
-    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+    avctx->sample_fmt = AV_SAMPLE_FMT_NONE;
     if (avctx->extradata && avctx->extradata_size >= 80) {
         header = speex_packet_to_header(avctx->extradata,
                                         avctx->extradata_size);
@@ -125,6 +125,7 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
     AVFrame *frame     = data;
     int16_t *output;
     int ret, consumed = 0;
+    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
 
     /* get output buffer */
     frame->nb_samples = s->frame_size;
@@ -159,6 +160,8 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
 
     *got_frame_ptr = 1;
 
+    if (!avctx->bit_rate)
+        speex_decoder_ctl(s->dec_state, SPEEX_GET_BITRATE, &avctx->bit_rate);
     return consumed;
 }
 



More information about the ffmpeg-cvslog mailing list