1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

libspeexdec: move the SpeexHeader from LibSpeexContext to where it is used

This commit is contained in:
Justin Ruggles 2012-09-30 23:09:19 -04:00
parent 892695c851
commit 908e22b93a

View File

@ -32,7 +32,6 @@ typedef struct {
SpeexBits bits; SpeexBits bits;
SpeexStereoState stereo; SpeexStereoState stereo;
void *dec_state; void *dec_state;
SpeexHeader *header;
int frame_size; int frame_size;
} LibSpeexContext; } LibSpeexContext;
@ -43,13 +42,13 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
const SpeexMode *mode; const SpeexMode *mode;
int spx_mode; int spx_mode;
if (avctx->extradata_size >= 80)
s->header = speex_packet_to_header(avctx->extradata, avctx->extradata_size);
avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->sample_fmt = AV_SAMPLE_FMT_S16;
if (s->header) { if (avctx->extradata && avctx->extradata_size >= 80) {
avctx->channels = s->header->nb_channels; SpeexHeader *header = speex_packet_to_header(avctx->extradata,
spx_mode = s->header->mode; avctx->extradata_size);
avctx->channels = header->nb_channels;
spx_mode = header->mode;
speex_header_free(header);
} else { } else {
switch (avctx->sample_rate) { switch (avctx->sample_rate) {
case 8000: spx_mode = 0; break; case 8000: spx_mode = 0; break;
@ -153,7 +152,6 @@ static av_cold int libspeex_decode_close(AVCodecContext *avctx)
{ {
LibSpeexContext *s = avctx->priv_data; LibSpeexContext *s = avctx->priv_data;
speex_header_free(s->header);
speex_bits_destroy(&s->bits); speex_bits_destroy(&s->bits);
speex_decoder_destroy(s->dec_state); speex_decoder_destroy(s->dec_state);