FFmpeg
Loading...
Searching...
No Matches
adts_header.h
Go to the documentation of this file.
1/*
2 * AAC ADTS header decoding prototypes and structures
3 * Copyright (c) 2003 Fabrice Bellard
4 * Copyright (c) 2003 Michael Niedermayer
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef AVCODEC_ADTS_HEADER_H
24#define AVCODEC_ADTS_HEADER_H
25
26#include "adts_parser.h"
27#include "defs.h"
28
29typedef enum {
34
35typedef struct AACADTSHeaderInfo {
36 uint32_t sample_rate;
37 uint32_t samples;
38 uint32_t bit_rate;
39 uint8_t crc_absent;
40 uint8_t object_type;
42 uint8_t chan_config;
44 uint32_t frame_length;
46
47struct GetBitContext;
48
49/**
50 * Parse the ADTS frame header to the end of the variable header, which is
51 * the first 54 bits.
52 * @param[in] gbc BitContext containing the first 54 bits of the frame.
53 * @param[out] hdr Pointer to struct where header info is written.
54 * @return the size in bytes of the header parsed on success and
55 * AAC_PARSE_ERROR_* values otherwise.
56 */
58
59/**
60 * Wrapper around ff_adts_header_parse() for users that don't already have
61 * a suitable GetBitContext.
62 */
65
66/**
67 * Parse the ADTS frame header contained in the buffer, which is
68 * the first 54 bits.
69 * @param[in] buf Pointer to buffer containing the first 54 bits of the frame.
70 * @param[in] size Size of buffer containing the first 54 bits of the frame.
71 * @param[out] phdr Pointer to pointer to struct AACADTSHeaderInfo for which
72 * memory is allocated and header info is written into it. After using the header
73 * information, the allocated memory must be freed by using av_free.
74 * @return 0 on success, AAC_PARSE_ERROR_* values on invalid input and
75 * ordinary AVERROR codes otherwise.
76 */
77int avpriv_adts_header_parse(AACADTSHeaderInfo **phdr, const uint8_t *buf, size_t size);
78
79#endif /* AVCODEC_ADTS_HEADER_H */
AACParseError
Definition adts_header.h:29
@ AAC_PARSE_ERROR_SAMPLE_RATE
Definition adts_header.h:31
@ AAC_PARSE_ERROR_SYNC
Definition adts_header.h:30
@ AAC_PARSE_ERROR_FRAME_SIZE
Definition adts_header.h:32
int ff_adts_header_parse_buf(const uint8_t buf[AV_AAC_ADTS_HEADER_SIZE+AV_INPUT_BUFFER_PADDING_SIZE], AACADTSHeaderInfo *hdr)
Wrapper around ff_adts_header_parse() for users that don't already have a suitable GetBitContext.
Definition adts_header.c:76
int ff_adts_header_parse(struct GetBitContext *gbc, AACADTSHeaderInfo *hdr)
Parse the ADTS frame header to the end of the variable header, which is the first 54 bits.
Definition adts_header.c:30
int avpriv_adts_header_parse(AACADTSHeaderInfo **phdr, const uint8_t *buf, size_t size)
Parse the ADTS frame header contained in the buffer, which is the first 54 bits.
Definition adts_parser.c:50
#define AV_AAC_ADTS_HEADER_SIZE
Definition adts_parser.h:25
Misc types and constants that do not belong anywhere else.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
Definition defs.h:40
uint8_t num_aac_frames
Definition adts_header.h:43
uint32_t sample_rate
Definition adts_header.h:36
uint32_t frame_length
Definition adts_header.h:44
uint8_t sampling_index
Definition adts_header.h:41
int size