Browse Source

Set the bitrate when decoding speex.

The bitrate of the first frame is used as bitrate for the speex stream.
tags/n2.3
Carl Eugen Hoyos 12 years ago
parent
commit
ef48ac6523
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavcodec/libspeexdec.c

+ 4
- 1
libavcodec/libspeexdec.c View File

@@ -43,7 +43,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
SpeexHeader *header = NULL; SpeexHeader *header = NULL;
int spx_mode; int spx_mode;


avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avctx->sample_fmt = AV_SAMPLE_FMT_NONE;
if (avctx->extradata && avctx->extradata_size >= 80) { if (avctx->extradata && avctx->extradata_size >= 80) {
header = speex_packet_to_header(avctx->extradata, header = speex_packet_to_header(avctx->extradata,
avctx->extradata_size); avctx->extradata_size);
@@ -125,6 +125,7 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
AVFrame *frame = data; AVFrame *frame = data;
int16_t *output; int16_t *output;
int ret, consumed = 0; int ret, consumed = 0;
avctx->sample_fmt = AV_SAMPLE_FMT_S16;


/* get output buffer */ /* get output buffer */
frame->nb_samples = s->frame_size; frame->nb_samples = s->frame_size;
@@ -159,6 +160,8 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,


*got_frame_ptr = 1; *got_frame_ptr = 1;


if (!avctx->bit_rate)
speex_decoder_ctl(s->dec_state, SPEEX_GET_BITRATE, &avctx->bit_rate);
return consumed; return consumed;
} }




Loading…
Cancel
Save