Commit d3068d25 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec: Add avpriv_mpa_decode_header2()

The difference to avpriv_mpa_decode_header() is that it doesnt need or modify the context
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 707a07f3
......@@ -108,7 +108,7 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
return 0;
}
int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)
int avpriv_mpa_decode_header2(uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate, enum AVCodecID *codec_id)
{
MPADecodeHeader s1, *s = &s1;
......@@ -121,16 +121,16 @@ int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_r
switch(s->layer) {
case 1:
avctx->codec_id = AV_CODEC_ID_MP1;
*codec_id = AV_CODEC_ID_MP1;
*frame_size = 384;
break;
case 2:
avctx->codec_id = AV_CODEC_ID_MP2;
*codec_id = AV_CODEC_ID_MP2;
*frame_size = 1152;
break;
default:
case 3:
avctx->codec_id = AV_CODEC_ID_MP3;
*codec_id = AV_CODEC_ID_MP3;
if (s->lsf)
*frame_size = 576;
else
......@@ -143,3 +143,8 @@ int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_r
*bit_rate = s->bit_rate;
return s->frame_size;
}
int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)
{
return avpriv_mpa_decode_header2(head, sample_rate, channels, frame_size, bit_rate, &avctx->codec_id);
}
......@@ -56,6 +56,8 @@ int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header);
header, otherwise the coded frame size in bytes */
int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
int avpriv_mpa_decode_header2(uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate, enum AVCodecID *codec_id);
/* fast header check for resync */
static inline int ff_mpa_check_header(uint32_t header){
/* header */
......
......@@ -29,7 +29,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 50
#define LIBAVCODEC_VERSION_MINOR 51
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
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