annotate aac_parser.h @ 11530:86e4be64519e libavcodec

Disallow VLC coding with more than 8 bits as there are several bugs in that code that could lead to broken files. AC coding is unaffected.
author michael
date Mon, 22 Mar 2010 21:12:31 +0000
parents 9592af8b6ce0
children fdafbcef52f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8549
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
1 /*
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
2 * AAC parser prototypes
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
3 * Copyright (c) 2003 Fabrice Bellard
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
4 * Copyright (c) 2003 Michael Niedermayer
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
5 *
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
6 * This file is part of FFmpeg.
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
7 *
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
12 *
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
16 * Lesser General Public License for more details.
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
17 *
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
21 */
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
22
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
23 #ifndef AVCODEC_AAC_PARSER_H
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
24 #define AVCODEC_AAC_PARSER_H
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
25
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
26 #include <stdint.h>
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
27 #include "aac_ac3_parser.h"
9428
0dce4fe6e6f3 Rename bitstream.h to get_bits.h.
stefano
parents: 8549
diff changeset
28 #include "get_bits.h"
8549
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
29
9633
9592af8b6ce0 Move the ADTS header size to the parser's header file.
alexc
parents: 9428
diff changeset
30 #define AAC_ADTS_HEADER_SIZE 7
9592af8b6ce0 Move the ADTS header size to the parser's header file.
alexc
parents: 9428
diff changeset
31
8549
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
32 typedef struct {
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
33 uint32_t sample_rate;
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
34 uint32_t samples;
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
35 uint32_t bit_rate;
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
36 uint8_t crc_absent;
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
37 uint8_t object_type;
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
38 uint8_t sampling_index;
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
39 uint8_t chan_config;
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
40 uint8_t num_aac_frames;
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
41 } AACADTSHeaderInfo;
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
42
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
43 /**
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
44 * Parses AAC frame header.
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
45 * Parses the ADTS frame header to the end of the variable header, which is
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
46 * the first 54 bits.
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
47 * @param gbc[in] BitContext containing the first 54 bits of the frame.
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
48 * @param hdr[out] Pointer to struct where header info is written.
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
49 * @return Returns 0 on success, -1 if there is a sync word mismatch,
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
50 * -2 if the version element is invalid, -3 if the sample rate
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
51 * element is invalid, or -4 if the bit rate element is invalid.
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
52 */
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
53 int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
54
2cbfa4cd4670 Support ADTS AAC files in the ffaac decoder (limited to streams containing one
superdump
parents:
diff changeset
55 #endif /* AVCODEC_AAC_PARSER_H */