mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-21 22:40:18 +01:00
avcodec/adts_header: Add ff_adts_header_parse_buf()
Most users of ff_adts_header_parse() don't already have an opened GetBitContext for the header, so add a convenience function for them. Also use a forward declaration of GetBitContext in adts_header.h as this avoids (implicit) inclusion of get_bits.h in some of the users that now no longer use a GetBitContext of their own. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include "parser.h"
|
||||
#include "get_bits.h"
|
||||
#include "adts_header.h"
|
||||
#include "adts_parser.h"
|
||||
#include "mpeg4audio.h"
|
||||
@@ -45,7 +44,6 @@ static int ftr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
FTRParseContext *ftr = s->priv_data;
|
||||
uint64_t state = ftr->pc.state64;
|
||||
int next = END_NOT_FOUND;
|
||||
GetBitContext bits;
|
||||
AACADTSHeaderInfo hdr;
|
||||
int size;
|
||||
|
||||
@@ -71,10 +69,9 @@ static int ftr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
|
||||
state = (state << 8) | buf[i];
|
||||
AV_WB64(tmp, state);
|
||||
init_get_bits(&bits, tmp + 8 - AV_AAC_ADTS_HEADER_SIZE,
|
||||
AV_AAC_ADTS_HEADER_SIZE * 8);
|
||||
size = ff_adts_header_parse_buf(tmp + 8 - AV_AAC_ADTS_HEADER_SIZE, &hdr);
|
||||
|
||||
if ((size = ff_adts_header_parse(&bits, &hdr)) > 0) {
|
||||
if (size > 0) {
|
||||
ftr->skip = size - 6;
|
||||
ftr->frame_index += ff_mpeg4audio_channels[hdr.chan_config];
|
||||
if (ftr->frame_index >= avctx->ch_layout.nb_channels) {
|
||||
|
||||
Reference in New Issue
Block a user