Mercurial > libavcodec.hg
annotate flac.h @ 9190:5b4f4d83431f libavcodec
Split TrueHD decoder from MLP
author | ramiro |
---|---|
date | Thu, 19 Mar 2009 21:23:39 +0000 |
parents | f534d0cca450 |
children | 443f056ba7e7 |
rev | line source |
---|---|
6728 | 1 /* |
2 * FLAC (Free Lossless Audio Codec) decoder/demuxer common functions | |
3 * Copyright (c) 2008 Justin Ruggles | |
4 * | |
5 * This file is part of FFmpeg. | |
6 * | |
7 * FFmpeg is free software; you can redistribute it and/or | |
8 * modify it under the terms of the GNU Lesser General Public | |
9 * License as published by the Free Software Foundation; either | |
10 * version 2.1 of the License, or (at your option) any later version. | |
11 * | |
12 * FFmpeg is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
18 * License along with FFmpeg; if not, write to the Free Software | |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
20 */ | |
21 | |
22 /** | |
8718
e9d9d946f213
Use full internal pathname in doxygen @file directives.
diego
parents:
8661
diff
changeset
|
23 * @file libavcodec/flac.h |
6728 | 24 * FLAC (Free Lossless Audio Codec) decoder/demuxer common functions |
25 */ | |
26 | |
7760 | 27 #ifndef AVCODEC_FLAC_H |
28 #define AVCODEC_FLAC_H | |
6728 | 29 |
6732 | 30 #include "avcodec.h" |
31 | |
8660 | 32 #define FLAC_STREAMINFO_SIZE 34 |
9188
f534d0cca450
share some constants between the FLAC encoder and FLAC decoder
jbr
parents:
9146
diff
changeset
|
33 #define FLAC_MAX_CHANNELS 8 |
f534d0cca450
share some constants between the FLAC encoder and FLAC decoder
jbr
parents:
9146
diff
changeset
|
34 #define FLAC_MIN_BLOCKSIZE 16 |
f534d0cca450
share some constants between the FLAC encoder and FLAC decoder
jbr
parents:
9146
diff
changeset
|
35 #define FLAC_MAX_BLOCKSIZE 65535 |
8660 | 36 |
8659 | 37 enum { |
38 FLAC_METADATA_TYPE_STREAMINFO = 0, | |
39 FLAC_METADATA_TYPE_PADDING, | |
40 FLAC_METADATA_TYPE_APPLICATION, | |
41 FLAC_METADATA_TYPE_SEEKTABLE, | |
42 FLAC_METADATA_TYPE_VORBIS_COMMENT, | |
43 FLAC_METADATA_TYPE_CUESHEET, | |
44 FLAC_METADATA_TYPE_PICTURE, | |
45 FLAC_METADATA_TYPE_INVALID = 127 | |
46 }; | |
47 | |
9054 | 48 enum FLACExtradataFormat { |
49 FLAC_EXTRADATA_FORMAT_STREAMINFO = 0, | |
50 FLAC_EXTRADATA_FORMAT_FULL_HEADER = 1 | |
51 }; | |
52 | |
6728 | 53 /** |
54 * Data needed from the Streaminfo header for use by the raw FLAC demuxer | |
55 * and/or the FLAC decoder. | |
56 */ | |
57 #define FLACSTREAMINFO \ | |
58 int max_blocksize; /**< maximum block size, in samples */\ | |
59 int max_framesize; /**< maximum frame size, in bytes */\ | |
60 int samplerate; /**< sample rate */\ | |
61 int channels; /**< number of channels */\ | |
62 int bps; /**< bits-per-sample */\ | |
8661 | 63 int64_t samples; /**< total number of samples */\ |
6728 | 64 |
6729 | 65 typedef struct FLACStreaminfo { |
66 FLACSTREAMINFO | |
67 } FLACStreaminfo; | |
68 | |
69 /** | |
70 * Parse the Streaminfo metadata block | |
71 * @param[out] avctx codec context to set basic stream parameters | |
72 * @param[out] s where parsed information is stored | |
73 * @param[in] buffer pointer to start of 34-byte streaminfo data | |
74 */ | |
75 void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, | |
76 const uint8_t *buffer); | |
77 | |
9054 | 78 /** |
79 * Validate the FLAC extradata. | |
80 * @param[in] avctx codec context containing the extradata. | |
81 * @param[out] format extradata format. | |
82 * @param[out] streaminfo_start pointer to start of 34-byte STREAMINFO data. | |
83 * @return 1 if valid, 0 if not valid. | |
84 */ | |
85 int ff_flac_is_extradata_valid(AVCodecContext *avctx, | |
86 enum FLACExtradataFormat *format, | |
87 uint8_t **streaminfo_start); | |
88 | |
9146
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
89 /** |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
90 * Parse the metadata block parameters from the header. |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
91 * @param[in] block_header header data, at least 4 bytes |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
92 * @param[out] last indicator for last metadata block |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
93 * @param[out] type metadata block type |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
94 * @param[out] size metadata block size |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
95 */ |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
96 void ff_flac_parse_block_header(const uint8_t *block_header, |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
97 int *last, int *type, int *size); |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
98 |
7760 | 99 #endif /* AVCODEC_FLAC_H */ |