FFmpeg: libavcodec/codec_par.c Source File
Go to the documentation of this file. 1 /*
2 * AVCodecParameters functions for libavcodec
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 /**
22 * @file
23 * AVCodecParameters functions for libavcodec.
24 */
25
26 #include <string.h>
31
33 {
37
38 memset(par, 0, sizeof(*par));
39
55 }
56
58 {
60
61 if (!par)
64 return par;
65 }
66
68 {
70
71 if (!par)
72 return;
74
76 }
77
80 {
82 int nb_dst = *pnb_dst;
83
85 return 0;
86
90
91 for (
int i = 0;
i < nb_src;
i++) {
94
98
101 *pnb_dst = ++nb_dst;
102 }
103
104 return 0;
105 }
106
108 {
110
113
116 dst->extradata_size = 0;
118 dst->nb_coded_side_data = 0;
119 if (
src->extradata) {
123 memcpy(
dst->extradata,
src->extradata,
src->extradata_size);
124 dst->extradata_size =
src->extradata_size;
125 }
127 src->coded_side_data,
src->nb_coded_side_data);
130
134
135 return 0;
136 }
137
140 {
142
144
148
154
170 break;
182 break;
186 break;
187 }
188
189 if (
codec->extradata) {
195 }
196
198 codec->coded_side_data,
codec->nb_coded_side_data);
201
202 return 0;
203 }
204
207 {
209
213
219
235 break;
248 break;
252 break;
253 }
254
256 codec->extradata_size = 0;
259 if (!
codec->extradata)
263 }
264
270
271 return 0;
272 }
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.
This struct describes the properties of an encoded stream.
enum AVColorSpace color_space
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
int seek_preroll
Audio only.
AVRational framerate
Video only.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
enum AVChannelOrder order
Channel order used in this layout.
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
enum AVColorPrimaries color_primaries
const struct AVCodec * codec
int bits_per_raw_sample
This is the number of valid bits in each output sample.
enum AVColorTransferCharacteristic color_trc
#define AV_PROFILE_UNKNOWN
int frame_size
Audio only.
AVRational sample_aspect_ratio
Video only.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
int nb_coded_side_data
Amount of entries in coded_side_data.
void av_packet_side_data_free(AVPacketSideData **psd, int *pnb_sd)
Convenience function to free all the side data stored in an array, and the array itself.
void avcodec_parameters_free(AVCodecParameters **ppar)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
Rational number (pair of numerator and denominator).
enum AVPacketSideDataType type
AVChannelLayout ch_layout
Audio only.
@ AVCOL_RANGE_UNSPECIFIED
int sample_rate
Audio only.
int extradata_size
Size of the extradata content in bytes.
An AVChannelLayout holds information about the channel layout of audio data.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
enum AVAlphaMode alpha_mode
Video with alpha channel only.
int profile
Codec-specific bitstream restrictions that the stream conforms to.
@ AVCHROMA_LOC_UNSPECIFIED
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
static void codec_parameters_reset(AVCodecParameters *par)
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
#define i(width, name, range_min, range_max)
static int codec_parameters_copy_side_data(AVPacketSideData **pdst, int *pnb_dst, const AVPacketSideData *src, int nb_src)
int block_align
Audio only.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
enum AVColorRange color_range
Video only.
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
void * av_calloc(size_t nmemb, size_t size)
enum AVFieldOrder field_order
Video only.
@ AVALPHA_MODE_UNSPECIFIED
Unknown alpha handling, or no alpha channel.
#define AV_INPUT_BUFFER_PADDING_SIZE
enum AVChromaLocation chroma_location
int trailing_padding
Audio only.
main external API structure.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
int video_delay
Video only.
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
int initial_padding
Audio only.
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
Generated on Tue Nov 18 2025 19:22:04 for FFmpeg by
doxygen
1.8.17