diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2003-11-10 15:21:16 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2003-11-10 15:21:16 +0000 |
commit | 962d6ae6c5a15a801f5df6e869fc0c01aeb8f963 (patch) | |
tree | b169af895a17e20bdcd2c7d1d46ffd0d48f4d9e2 | |
parent | 8dbcc9f226df8bbdce95d0b766e0f6a8fe7e117c (diff) | |
download | ffmpeg-962d6ae6c5a15a801f5df6e869fc0c01aeb8f963.tar.gz |
exported mpa_decode_header for new parser API
Originally committed as revision 2491 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/mpegaudio.h | 1 | ||||
-rw-r--r-- | libavcodec/mpegaudiodec.c | 27 |
2 files changed, 12 insertions, 16 deletions
diff --git a/libavcodec/mpegaudio.h b/libavcodec/mpegaudio.h index 7aba13200b..e50e8bd6f6 100644 --- a/libavcodec/mpegaudio.h +++ b/libavcodec/mpegaudio.h @@ -19,6 +19,7 @@ #define MPA_MONO 3 int l2_select_table(int bitrate, int nb_channels, int freq, int lsf); +int mpa_decode_header(AVCodecContext *avctx, uint32_t head); extern const uint16_t mpa_bitrate_tab[2][3][15]; extern const uint16_t mpa_freq_tab[3]; diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 51c8ef1305..e94d91900d 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -1207,15 +1207,10 @@ static int decode_header(MPADecodeContext *s, uint32_t header) } /* useful helper to get mpeg audio stream infos. Return -1 if error in - header */ -int mp_decode_header(int *sample_rate_ptr, - int *nb_channels_ptr, - int *coded_frame_size_ptr, - int *decoded_frame_size_ptr, - uint32_t head) + header, otherwise the coded frame size in bytes */ +int mpa_decode_header(AVCodecContext *avctx, uint32_t head) { MPADecodeContext s1, *s = &s1; - int decoded_frame_size; if (check_header(head) != 0) return -1; @@ -1226,25 +1221,25 @@ int mp_decode_header(int *sample_rate_ptr, switch(s->layer) { case 1: - decoded_frame_size = 384; + avctx->frame_size = 384; break; case 2: - decoded_frame_size = 1152; + avctx->frame_size = 1152; break; default: case 3: if (s->lsf) - decoded_frame_size = 576; + avctx->frame_size = 576; else - decoded_frame_size = 1152; + avctx->frame_size = 1152; break; } - *sample_rate_ptr = s->sample_rate; - *nb_channels_ptr = s->nb_channels; - *coded_frame_size_ptr = s->frame_size; - *decoded_frame_size_ptr = decoded_frame_size * 2 * s->nb_channels; - return 0; + avctx->sample_rate = s->sample_rate; + avctx->channels = s->nb_channels; + avctx->bit_rate = s->bit_rate; + avctx->sub_id = s->layer; + return s->frame_size; } /* return the number of decoded frames */ |