Mercurial > libavcodec.hg
annotate flac.h @ 12042:dc4feabd4dab libavcodec
Fix 100L in vp8dsp asm init
author | darkshikari |
---|---|
date | Thu, 01 Jul 2010 22:09:22 +0000 |
parents | 7dd2a45249a9 |
children |
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 /** | |
11644
7dd2a45249a9
Remove explicit filename from Doxygen @file commands.
diego
parents:
9254
diff
changeset
|
23 * @file |
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 | |
9231 | 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 { |
9208
443f056ba7e7
share channel mode constants between the FLAC decoder and FLAC encoder
jbr
parents:
9188
diff
changeset
|
38 FLAC_CHMODE_INDEPENDENT = 0, |
443f056ba7e7
share channel mode constants between the FLAC decoder and FLAC encoder
jbr
parents:
9188
diff
changeset
|
39 FLAC_CHMODE_LEFT_SIDE = 8, |
443f056ba7e7
share channel mode constants between the FLAC decoder and FLAC encoder
jbr
parents:
9188
diff
changeset
|
40 FLAC_CHMODE_RIGHT_SIDE = 9, |
443f056ba7e7
share channel mode constants between the FLAC decoder and FLAC encoder
jbr
parents:
9188
diff
changeset
|
41 FLAC_CHMODE_MID_SIDE = 10, |
443f056ba7e7
share channel mode constants between the FLAC decoder and FLAC encoder
jbr
parents:
9188
diff
changeset
|
42 }; |
443f056ba7e7
share channel mode constants between the FLAC decoder and FLAC encoder
jbr
parents:
9188
diff
changeset
|
43 |
443f056ba7e7
share channel mode constants between the FLAC decoder and FLAC encoder
jbr
parents:
9188
diff
changeset
|
44 enum { |
8659 | 45 FLAC_METADATA_TYPE_STREAMINFO = 0, |
46 FLAC_METADATA_TYPE_PADDING, | |
47 FLAC_METADATA_TYPE_APPLICATION, | |
48 FLAC_METADATA_TYPE_SEEKTABLE, | |
49 FLAC_METADATA_TYPE_VORBIS_COMMENT, | |
50 FLAC_METADATA_TYPE_CUESHEET, | |
51 FLAC_METADATA_TYPE_PICTURE, | |
52 FLAC_METADATA_TYPE_INVALID = 127 | |
53 }; | |
54 | |
9054 | 55 enum FLACExtradataFormat { |
56 FLAC_EXTRADATA_FORMAT_STREAMINFO = 0, | |
57 FLAC_EXTRADATA_FORMAT_FULL_HEADER = 1 | |
58 }; | |
59 | |
9254
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
60 #define FLACCOMMONINFO \ |
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
61 int samplerate; /**< sample rate */\ |
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
62 int channels; /**< number of channels */\ |
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
63 int bps; /**< bits-per-sample */\ |
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
64 |
6728 | 65 /** |
66 * Data needed from the Streaminfo header for use by the raw FLAC demuxer | |
67 * and/or the FLAC decoder. | |
68 */ | |
69 #define FLACSTREAMINFO \ | |
9254
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
70 FLACCOMMONINFO \ |
6728 | 71 int max_blocksize; /**< maximum block size, in samples */\ |
72 int max_framesize; /**< maximum frame size, in bytes */\ | |
8661 | 73 int64_t samples; /**< total number of samples */\ |
6728 | 74 |
6729 | 75 typedef struct FLACStreaminfo { |
76 FLACSTREAMINFO | |
77 } FLACStreaminfo; | |
78 | |
9254
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
79 typedef struct FLACFrameInfo { |
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
80 FLACCOMMONINFO |
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
81 int blocksize; /**< block size of the frame */ |
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
82 int ch_mode; /**< channel decorrelation mode */ |
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
83 } FLACFrameInfo; |
8d570fb097f8
flacdec: split frame header decoding and validation into a separate
jbr
parents:
9231
diff
changeset
|
84 |
6729 | 85 /** |
86 * Parse the Streaminfo metadata block | |
87 * @param[out] avctx codec context to set basic stream parameters | |
88 * @param[out] s where parsed information is stored | |
89 * @param[in] buffer pointer to start of 34-byte streaminfo data | |
90 */ | |
91 void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, | |
92 const uint8_t *buffer); | |
93 | |
9054 | 94 /** |
95 * Validate the FLAC extradata. | |
96 * @param[in] avctx codec context containing the extradata. | |
97 * @param[out] format extradata format. | |
98 * @param[out] streaminfo_start pointer to start of 34-byte STREAMINFO data. | |
99 * @return 1 if valid, 0 if not valid. | |
100 */ | |
101 int ff_flac_is_extradata_valid(AVCodecContext *avctx, | |
102 enum FLACExtradataFormat *format, | |
103 uint8_t **streaminfo_start); | |
104 | |
9146
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
105 /** |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
106 * 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
|
107 * @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
|
108 * @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
|
109 * @param[out] type metadata block type |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
110 * @param[out] size metadata block size |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
111 */ |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
112 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
|
113 int *last, int *type, int *size); |
b980183eb831
flacdec: Add a shared function for parsing a FLAC metadata block header.
jbr
parents:
9106
diff
changeset
|
114 |
9216
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
9208
diff
changeset
|
115 /** |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
9208
diff
changeset
|
116 * Calculate an estimate for the maximum frame size based on verbatim mode. |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
9208
diff
changeset
|
117 * @param blocksize block size, in samples |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
9208
diff
changeset
|
118 * @param ch number of channels |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
9208
diff
changeset
|
119 * @param bps bits-per-sample |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
9208
diff
changeset
|
120 */ |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
9208
diff
changeset
|
121 int ff_flac_get_max_frame_size(int blocksize, int ch, int bps); |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
9208
diff
changeset
|
122 |
7760 | 123 #endif /* AVCODEC_FLAC_H */ |