FFmpeg
libavcodec
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
29
typedef
enum
{
30
AAC_PARSE_ERROR_SYNC
= -0x1030c0a,
31
AAC_PARSE_ERROR_SAMPLE_RATE
= -0x3030c0a,
32
AAC_PARSE_ERROR_FRAME_SIZE
= -0x4030c0a,
33
}
AACParseError
;
34
35
typedef
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
;
41
uint8_t
sampling_index
;
42
uint8_t
chan_config
;
43
uint8_t
num_aac_frames
;
44
uint32_t
frame_length
;
45
}
AACADTSHeaderInfo
;
46
47
struct
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
*/
57
int
ff_adts_header_parse
(
struct
GetBitContext
*gbc,
AACADTSHeaderInfo
*hdr);
58
59
/**
60
* Wrapper around ff_adts_header_parse() for users that don't already have
61
* a suitable GetBitContext.
62
*/
63
int
ff_adts_header_parse_buf
(
const
uint8_t buf[
AV_AAC_ADTS_HEADER_SIZE
+
AV_INPUT_BUFFER_PADDING_SIZE
],
64
AACADTSHeaderInfo
*hdr);
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
*/
77
int
avpriv_adts_header_parse
(
AACADTSHeaderInfo
**phdr,
const
uint8_t *buf,
size_t
size
);
78
79
#endif
/* AVCODEC_ADTS_HEADER_H */
AV_AAC_ADTS_HEADER_SIZE
#define AV_AAC_ADTS_HEADER_SIZE
Definition:
adts_parser.h:25
AACADTSHeaderInfo::samples
uint32_t samples
Definition:
adts_header.h:37
AACADTSHeaderInfo::bit_rate
uint32_t bit_rate
Definition:
adts_header.h:38
AAC_PARSE_ERROR_FRAME_SIZE
@ AAC_PARSE_ERROR_FRAME_SIZE
Definition:
adts_header.h:32
GetBitContext
Definition:
get_bits.h:108
AACADTSHeaderInfo::chan_config
uint8_t chan_config
Definition:
adts_header.h:42
AACParseError
AACParseError
Definition:
adts_header.h:29
ff_adts_header_parse
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
AACADTSHeaderInfo::num_aac_frames
uint8_t num_aac_frames
Definition:
adts_header.h:43
ff_adts_header_parse_buf
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
AACADTSHeaderInfo::sampling_index
uint8_t sampling_index
Definition:
adts_header.h:41
AACADTSHeaderInfo::frame_length
uint32_t frame_length
Definition:
adts_header.h:44
avpriv_adts_header_parse
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
size
int size
Definition:
twinvq_data.h:10344
AACADTSHeaderInfo::object_type
uint8_t object_type
Definition:
adts_header.h:40
AAC_PARSE_ERROR_SYNC
@ AAC_PARSE_ERROR_SYNC
Definition:
adts_header.h:30
AAC_PARSE_ERROR_SAMPLE_RATE
@ AAC_PARSE_ERROR_SAMPLE_RATE
Definition:
adts_header.h:31
AACADTSHeaderInfo::sample_rate
uint32_t sample_rate
Definition:
adts_header.h:36
adts_parser.h
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition:
defs.h:40
AACADTSHeaderInfo::crc_absent
uint8_t crc_absent
Definition:
adts_header.h:39
defs.h
AACADTSHeaderInfo
Definition:
adts_header.h:35
Generated on Sun Dec 1 2024 19:21:23 for FFmpeg by
1.8.17