Commit a3e7eed0 authored by bellard's avatar bellard

exported mpa_decode_header for new parser API


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@2491 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent dc23ae5c
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define MPA_MONO 3 #define MPA_MONO 3
int l2_select_table(int bitrate, int nb_channels, int freq, int lsf); 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_bitrate_tab[2][3][15];
extern const uint16_t mpa_freq_tab[3]; extern const uint16_t mpa_freq_tab[3];
......
...@@ -1207,15 +1207,10 @@ static int decode_header(MPADecodeContext *s, uint32_t header) ...@@ -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 /* useful helper to get mpeg audio stream infos. Return -1 if error in
header */ header, otherwise the coded frame size in bytes */
int mp_decode_header(int *sample_rate_ptr, int mpa_decode_header(AVCodecContext *avctx, uint32_t head)
int *nb_channels_ptr,
int *coded_frame_size_ptr,
int *decoded_frame_size_ptr,
uint32_t head)
{ {
MPADecodeContext s1, *s = &s1; MPADecodeContext s1, *s = &s1;
int decoded_frame_size;
if (check_header(head) != 0) if (check_header(head) != 0)
return -1; return -1;
...@@ -1226,25 +1221,25 @@ int mp_decode_header(int *sample_rate_ptr, ...@@ -1226,25 +1221,25 @@ int mp_decode_header(int *sample_rate_ptr,
switch(s->layer) { switch(s->layer) {
case 1: case 1:
decoded_frame_size = 384; avctx->frame_size = 384;
break; break;
case 2: case 2:
decoded_frame_size = 1152; avctx->frame_size = 1152;
break; break;
default: default:
case 3: case 3:
if (s->lsf) if (s->lsf)
decoded_frame_size = 576; avctx->frame_size = 576;
else else
decoded_frame_size = 1152; avctx->frame_size = 1152;
break; break;
} }
*sample_rate_ptr = s->sample_rate; avctx->sample_rate = s->sample_rate;
*nb_channels_ptr = s->nb_channels; avctx->channels = s->nb_channels;
*coded_frame_size_ptr = s->frame_size; avctx->bit_rate = s->bit_rate;
*decoded_frame_size_ptr = decoded_frame_size * 2 * s->nb_channels; avctx->sub_id = s->layer;
return 0; return s->frame_size;
} }
/* return the number of decoded frames */ /* return the number of decoded frames */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment