Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
libavcodec
flac.h
Go to the documentation of this file.
1
/*
2
* FLAC (Free Lossless Audio Codec) decoder/demuxer common functions
3
* Copyright (c) 2008 Justin Ruggles
4
*
5
* This file is part of Libav.
6
*
7
* Libav 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
* Libav 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 Libav; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
27
#ifndef AVCODEC_FLAC_H
28
#define AVCODEC_FLAC_H
29
30
#include "
avcodec.h
"
31
#include "
get_bits.h
"
32
33
#define FLAC_STREAMINFO_SIZE 34
34
#define FLAC_MAX_CHANNELS 8
35
#define FLAC_MIN_BLOCKSIZE 16
36
#define FLAC_MAX_BLOCKSIZE 65535
37
#define FLAC_MIN_FRAME_SIZE 11
38
39
enum
{
40
FLAC_CHMODE_INDEPENDENT
= 0,
41
FLAC_CHMODE_LEFT_SIDE
= 8,
42
FLAC_CHMODE_RIGHT_SIDE
= 9,
43
FLAC_CHMODE_MID_SIDE
= 10,
44
};
45
46
enum
{
47
FLAC_METADATA_TYPE_STREAMINFO
= 0,
48
FLAC_METADATA_TYPE_PADDING
,
49
FLAC_METADATA_TYPE_APPLICATION
,
50
FLAC_METADATA_TYPE_SEEKTABLE
,
51
FLAC_METADATA_TYPE_VORBIS_COMMENT
,
52
FLAC_METADATA_TYPE_CUESHEET
,
53
FLAC_METADATA_TYPE_PICTURE
,
54
FLAC_METADATA_TYPE_INVALID
= 127
55
};
56
57
enum
FLACExtradataFormat
{
58
FLAC_EXTRADATA_FORMAT_STREAMINFO
= 0,
59
FLAC_EXTRADATA_FORMAT_FULL_HEADER
= 1
60
};
61
62
#define FLACCOMMONINFO \
63
int samplerate; \
64
int channels; \
65
int bps; \
66
67
71
#define FLACSTREAMINFO \
72
FLACCOMMONINFO \
73
int max_blocksize; \
74
int max_framesize; \
75
int64_t samples; \
76
77
typedef
struct
FLACStreaminfo
{
78
FLACSTREAMINFO
79
}
FLACStreaminfo
;
80
81
typedef
struct
FLACFrameInfo
{
82
FLACCOMMONINFO
83
int
blocksize
;
84
int
ch_mode
;
85
int64_t
frame_or_sample_num
;
86
int
is_var_size
;
90
}
FLACFrameInfo
;
91
98
void
avpriv_flac_parse_streaminfo
(
AVCodecContext
*avctx,
struct
FLACStreaminfo
*s,
99
const
uint8_t *
buffer
);
100
108
int
avpriv_flac_is_extradata_valid
(
AVCodecContext
*avctx,
109
enum
FLACExtradataFormat
*format,
110
uint8_t **streaminfo_start);
111
119
void
avpriv_flac_parse_block_header
(
const
uint8_t *block_header,
120
int
*last,
int
*type,
int
*
size
);
121
128
int
ff_flac_get_max_frame_size
(
int
blocksize,
int
ch,
int
bps
);
129
138
int
ff_flac_decode_frame_header
(
AVCodecContext
*avctx,
GetBitContext
*gb,
139
FLACFrameInfo
*fi,
int
log_level_offset);
140
#endif
/* AVCODEC_FLAC_H */