mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
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: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
707a07f3c2
commit
d3068d25ca
@ -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, \
|
||||
|
Loading…
Reference in New Issue
Block a user