FFmpeg
Loading...
Searching...
No Matches
flac_parse.h
Go to the documentation of this file.
1/*
2 * FLAC (Free Lossless Audio Codec) decoder/parser 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/**
23 * @file
24 * FLAC (Free Lossless Audio Codec) decoder/parser common functions
25 */
26
27#ifndef AVCODEC_FLAC_PARSE_H
28#define AVCODEC_FLAC_PARSE_H
29
30#include "avcodec.h"
31#include "get_bits.h"
32
33typedef struct FLACStreaminfo {
34 int samplerate; /**< sample rate */
35 int channels; /**< number of channels */
36 int bps; /**< bits-per-sample */
37 int max_blocksize; /**< maximum block size, in samples */
38 int max_framesize; /**< maximum frame size, in bytes */
39 int64_t samples; /**< total number of samples */
41
42typedef struct FLACFrameInfo {
43 int samplerate; /**< sample rate */
44 int channels; /**< number of channels */
45 int bps; /**< bits-per-sample */
46 int blocksize; /**< block size of the frame */
47 int ch_mode; /**< channel decorrelation mode */
48 int64_t frame_or_sample_num; /**< frame number or sample number */
49 int is_var_size; /**< specifies if the stream uses variable
50 block sizes or a fixed block size;
51 also determines the meaning of
52 frame_or_sample_num */
54
55/**
56 * Parse the Streaminfo metadata block
57 * @param[out] avctx codec context to set basic stream parameters
58 * @param[out] s where parsed information is stored
59 * @param[in] buffer pointer to start of 34-byte streaminfo data
60 *
61 * @return negative error code on failure or >= 0 on success
62 */
64 const uint8_t *buffer);
65
66/**
67 * Validate the FLAC extradata.
68 * @param[in] avctx codec context containing the extradata.
69 * @param[out] format extradata format.
70 * @param[out] streaminfo_start pointer to start of 34-byte STREAMINFO data.
71 * @return 1 if valid, 0 if not valid.
72 */
74 uint8_t **streaminfo_start);
75
76/**
77 * Validate and decode a frame header.
78 * @param logctx context for logging
79 * @param gb GetBitContext from which to read frame header
80 * @param[out] fi frame information
81 * @param log_level_offset log level offset. can be used to silence error messages.
82 * @return non-zero on error, 0 if ok
83 */
84int ff_flac_decode_frame_header(void *logctx, GetBitContext *gb,
85 FLACFrameInfo *fi, int log_level_offset);
86
88
89#endif /* AVCODEC_FLAC_PARSE_H */
channels
Definition aptx.h:31
Libavcodec external API header.
#define s(width, name)
Definition cbs_vp9.c:198
long long int64_t
Definition coverity.c:34
int ff_flac_decode_frame_header(void *logctx, GetBitContext *gb, FLACFrameInfo *fi, int log_level_offset)
Validate and decode a frame header.
Definition flac.c:51
int ff_flac_is_extradata_valid(AVCodecContext *avctx, uint8_t **streaminfo_start)
Validate the FLAC extradata.
Definition flac.c:149
void ff_flac_set_channel_layout(AVCodecContext *avctx, int channels)
Definition flac.c:173
int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer)
Parse the Streaminfo metadata block.
Definition flac.c:187
bitstream reader API header.
main external API structure.
Definition avcodec.h:443
int blocksize
block size of the frame
Definition flac_parse.h:46
int channels
number of channels
Definition flac_parse.h:44
int samplerate
sample rate
Definition flac_parse.h:43
int is_var_size
specifies if the stream uses variable block sizes or a fixed block size; also determines the meaning ...
Definition flac_parse.h:49
int64_t frame_or_sample_num
frame number or sample number
Definition flac_parse.h:48
int ch_mode
channel decorrelation mode
Definition flac_parse.h:47
int bps
bits-per-sample
Definition flac_parse.h:45
int bps
bits-per-sample
Definition flac_parse.h:36
int samplerate
sample rate
Definition flac_parse.h:34
int max_blocksize
maximum block size, in samples
Definition flac_parse.h:37
int max_framesize
maximum frame size, in bytes
Definition flac_parse.h:38
int64_t samples
total number of samples
Definition flac_parse.h:39
int channels
number of channels
Definition flac_parse.h:35
static char buffer[20]
Definition seek.c:32