FFmpeg: libavformat/oggparseflac.c Source File
Go to the documentation of this file. 1 /*
2 * Copyright (C) 2005 Matthieu CASTET
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <stdlib.h>
28
29 #define OGG_FLAC_METADATA_TYPE_STREAMINFO 0x7F
30
31 static int
33 {
39
41 return 0;
42
46
48 uint8_t *streaminfo_start = os->
buf + os->
pstart + 5 + 4 + 4 + 4;
49 uint32_t samplerate;
50
52 if(
get_bits(&gb, 8) != 1)
/* unsupported major version */
53 return -1;
54 skip_bits(&gb, 8 + 16);
/* minor version + header count */
56
57 /* METADATA_BLOCK_HEADER */
59 return -1;
60
64
68
70 if (!samplerate)
72
76 }
77
78 return 1;
79 }
80
81 static int
83 {
91
92 if (!parser)
93 return -1;
94
97
99 if (!avctx) {
102 }
103
107
112
114
118 return 0;
119 }
120
122 return 1;
127 }
128
131 .magicsize = 5,
133 .nb_header = 2,
134 };
135
138 .magicsize = 4,
140 .nb_header = 0,
141 };
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
enum AVMediaType codec_type
General type of the encoded data.
int sample_rate
samples per second
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
const struct ogg_codec ff_flac_codec
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int old_flac_header(AVFormatContext *s, int idx)
AVCodecParserContext * av_parser_init(int codec_id)
static int flac_header(AVFormatContext *s, int idx)
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
#define OGG_FLAC_METADATA_TYPE_STREAMINFO
enum AVStreamParseType need_parsing
AVCodecParameters * codecpar
Codec parameters associated with this stream.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
#define FLAC_STREAMINFO_SIZE
struct ogg_stream * streams
int extradata_size
Size of the extradata content in bytes.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static void skip_bits1(GetBitContext *s)
#define PARSER_FLAG_COMPLETE_FRAMES
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
@ FLAC_METADATA_TYPE_VORBIS_COMMENT
main external API structure.
int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st, const uint8_t *buf, int size)
Parse Vorbis comments and add metadata to an AVStream.
int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int64_t pts, int64_t dts, int64_t pos)
Parse a packet.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
const struct ogg_codec ff_old_flac_codec
Copyright (C) 2005 Michael Ahlberg, Måns Rullgård.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
void av_parser_close(AVCodecParserContext *s)
Generated on Tue Feb 28 2023 21:34:08 for FFmpeg by
doxygen
1.8.17