FFmpeg
demux_utils.c
Go to the documentation of this file.
1 /*
2  * Various utility demuxing functions
3  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
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 #include "libavutil/version.h"
23 
24 #include "libavutil/avassert.h"
25 #include "libavcodec/bytestream.h"
27 #include "avformat.h"
28 #include "avio_internal.h"
29 #include "demux.h"
30 #include "internal.h"
31 
33 {
34  return cffstream(st)->parser;
35 }
36 
38 {
39  ffstream(st)->need_parsing = type;
40 }
41 
43  int64_t start, int64_t end, const char *title)
44 {
45  FFFormatContext *const si = ffformatcontext(s);
46  AVChapter *chapter = NULL;
47  int ret;
48 
49  if (end != AV_NOPTS_VALUE && start > end) {
50  av_log(s, AV_LOG_ERROR, "Chapter end time %"PRId64" before start %"PRId64"\n", end, start);
51  return NULL;
52  }
53 
54  if (!s->nb_chapters) {
55  si->chapter_ids_monotonic = 1;
56  } else if (!si->chapter_ids_monotonic || s->chapters[s->nb_chapters-1]->id >= id) {
57  for (unsigned i = 0; i < s->nb_chapters; i++)
58  if (s->chapters[i]->id == id)
59  chapter = s->chapters[i];
60  if (!chapter)
61  si->chapter_ids_monotonic = 0;
62  }
63 
64  if (!chapter) {
65  chapter = av_mallocz(sizeof(*chapter));
66  if (!chapter)
67  return NULL;
68  ret = av_dynarray_add_nofree(&s->chapters, &s->nb_chapters, chapter);
69  if (ret < 0) {
70  av_free(chapter);
71  return NULL;
72  }
73  }
74  av_dict_set(&chapter->metadata, "title", title, 0);
75  chapter->id = id;
76  chapter->time_base = time_base;
77  chapter->start = start;
78  chapter->end = end;
79 
80  return chapter;
81 }
82 
84 {
85  FFFormatContext *const si = ffformatcontext(s);
86  si->inject_global_side_data = 1;
87  for (unsigned i = 0; i < s->nb_streams; i++) {
88  AVStream *st = s->streams[i];
89  ffstream(st)->inject_global_side_data = 1;
90  }
91 }
92 
94 {
95  FFFormatContext *const si = ffformatcontext(s);
96  int ret;
97  for (unsigned i = 0; i < s->nb_streams; i++)
98  if (s->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC &&
99  s->streams[i]->discard < AVDISCARD_ALL) {
100  if (s->streams[i]->attached_pic.size <= 0) {
102  "Attached picture on stream %d has invalid size, "
103  "ignoring\n", i);
104  continue;
105  }
106 
108  &s->streams[i]->attached_pic,
109  av_packet_ref, 0);
110  if (ret < 0)
111  return ret;
112  }
113  return 0;
114 }
115 
117  AVBufferRef **buf, int size)
118 {
119  AVStream *st = st0;
120  AVPacket *pkt;
121  int ret;
122 
123  if (!st && !(st = avformat_new_stream(s, NULL)))
124  return AVERROR(ENOMEM);
125  pkt = &st->attached_pic;
126  if (buf) {
127  av_assert1(*buf);
129  pkt->buf = *buf;
130  pkt->data = (*buf)->data;
131  pkt->size = (*buf)->size - AV_INPUT_BUFFER_PADDING_SIZE;
132  *buf = NULL;
133  } else {
134  ret = av_get_packet(pb, pkt, size);
135  if (ret < 0)
136  goto fail;
137  }
140 
141  pkt->stream_index = st->index;
143 
144  return 0;
145 fail:
146  if (!st0)
147  ff_remove_stream(s, st);
148  return ret;
149 }
150 
152  uint64_t channel_layout, int32_t sample_rate,
154 {
155  uint32_t flags = 0;
156  int size = 4;
157  uint8_t *data;
158  if (!pkt)
159  return AVERROR(EINVAL);
160 
161  if (sample_rate) {
162  size += 4;
164  }
165  if (width || height) {
166  size += 8;
168  }
170  if (!data)
171  return AVERROR(ENOMEM);
172  bytestream_put_le32(&data, flags);
173  if (sample_rate)
174  bytestream_put_le32(&data, sample_rate);
175  if (width || height) {
176  bytestream_put_le32(&data, width);
177  bytestream_put_le32(&data, height);
178  }
179  return 0;
180 }
181 
183 {
184  if (ffifmt(s->iformat)->read_play)
185  return ffifmt(s->iformat)->read_play(s);
186  if (s->pb)
187  return avio_pause(s->pb, 0);
188  return AVERROR(ENOSYS);
189 }
190 
192 {
193  if (ffifmt(s->iformat)->read_pause)
194  return ffifmt(s->iformat)->read_pause(s);
195  if (s->pb)
196  return avio_pause(s->pb, 1);
197  return AVERROR(ENOSYS);
198 }
199 
201 {
202  static const uint8_t avci100_1080p_extradata[] = {
203  // SPS
204  0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
205  0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
206  0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
207  0x18, 0x21, 0x02, 0x56, 0xb9, 0x3d, 0x7d, 0x7e,
208  0x4f, 0xe3, 0x3f, 0x11, 0xf1, 0x9e, 0x08, 0xb8,
209  0x8c, 0x54, 0x43, 0xc0, 0x78, 0x02, 0x27, 0xe2,
210  0x70, 0x1e, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00,
211  0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xca,
212  0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213  // PPS
214  0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
215  0xd0
216  };
217  static const uint8_t avci100_1080i_extradata[] = {
218  // SPS
219  0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
220  0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63,
221  0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19,
222  0x18, 0x21, 0x03, 0x3a, 0x46, 0x65, 0x6a, 0x65,
223  0x24, 0xad, 0xe9, 0x12, 0x32, 0x14, 0x1a, 0x26,
224  0x34, 0xad, 0xa4, 0x41, 0x82, 0x23, 0x01, 0x50,
225  0x2b, 0x1a, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2e,
226  0x11, 0x12, 0x08, 0xc6, 0x8c, 0x04, 0x41, 0x28,
227  0x4c, 0x34, 0xf0, 0x1e, 0x01, 0x13, 0xf2, 0xe0,
228  0x3c, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03,
229  0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x20,
230  // PPS
231  0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48,
232  0xd0
233  };
234  static const uint8_t avci50_1080p_extradata[] = {
235  // SPS
236  0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
237  0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
238  0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
239  0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
240  0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
241  0x6e, 0x6c, 0xd3, 0x3c, 0x05, 0xa0, 0x22, 0x7e,
242  0x5f, 0xfc, 0x00, 0x0c, 0x00, 0x13, 0x8c, 0x04,
243  0x04, 0x05, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
244  0x00, 0x03, 0x00, 0x32, 0x84, 0x00, 0x00, 0x00,
245  // PPS
246  0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
247  0x11
248  };
249  static const uint8_t avci50_1080i_extradata[] = {
250  // SPS
251  0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28,
252  0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
253  0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
254  0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6e, 0x61,
255  0x87, 0x3e, 0x73, 0x4d, 0x98, 0x0c, 0x03, 0x06,
256  0x9c, 0x0b, 0x73, 0xe6, 0xc0, 0xb5, 0x18, 0x63,
257  0x0d, 0x39, 0xe0, 0x5b, 0x02, 0xd4, 0xc6, 0x19,
258  0x1a, 0x79, 0x8c, 0x32, 0x34, 0x24, 0xf0, 0x16,
259  0x81, 0x13, 0xf7, 0xff, 0x80, 0x02, 0x00, 0x01,
260  0xf1, 0x80, 0x80, 0x80, 0xa0, 0x00, 0x00, 0x03,
261  0x00, 0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00,
262  // PPS
263  0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
264  0x11
265  };
266  static const uint8_t avci100_720p_extradata[] = {
267  // SPS
268  0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29,
269  0xb6, 0xd4, 0x20, 0x2a, 0x33, 0x1d, 0xc7, 0x62,
270  0xa1, 0x08, 0x40, 0x54, 0x66, 0x3b, 0x8e, 0xc5,
271  0x42, 0x02, 0x10, 0x25, 0x64, 0x2c, 0x89, 0xe8,
272  0x85, 0xe4, 0x21, 0x4b, 0x90, 0x83, 0x06, 0x95,
273  0xd1, 0x06, 0x46, 0x97, 0x20, 0xc8, 0xd7, 0x43,
274  0x08, 0x11, 0xc2, 0x1e, 0x4c, 0x91, 0x0f, 0x01,
275  0x40, 0x16, 0xec, 0x07, 0x8c, 0x04, 0x04, 0x05,
276  0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03,
277  0x00, 0x64, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
278  // PPS
279  0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
280  0x11
281  };
282  static const uint8_t avci50_720p_extradata[] = {
283  // SPS
284  0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x20,
285  0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18,
286  0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c,
287  0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6f, 0x37,
288  0xcd, 0xf9, 0xbf, 0x81, 0x6b, 0xf3, 0x7c, 0xde,
289  0x6e, 0x6c, 0xd3, 0x3c, 0x0f, 0x01, 0x6e, 0xff,
290  0xc0, 0x00, 0xc0, 0x01, 0x38, 0xc0, 0x40, 0x40,
291  0x50, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00,
292  0x06, 0x48, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
293  // PPS
294  0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12,
295  0x11
296  };
297 
298  const uint8_t *data = NULL;
299  int ret, size = 0;
300 
301  if (st->codecpar->width == 1920) {
303  data = avci100_1080p_extradata;
304  size = sizeof(avci100_1080p_extradata);
305  } else {
306  data = avci100_1080i_extradata;
307  size = sizeof(avci100_1080i_extradata);
308  }
309  } else if (st->codecpar->width == 1440) {
311  data = avci50_1080p_extradata;
312  size = sizeof(avci50_1080p_extradata);
313  } else {
314  data = avci50_1080i_extradata;
315  size = sizeof(avci50_1080i_extradata);
316  }
317  } else if (st->codecpar->width == 1280) {
318  data = avci100_720p_extradata;
319  size = sizeof(avci100_720p_extradata);
320  } else if (st->codecpar->width == 960) {
321  data = avci50_720p_extradata;
322  size = sizeof(avci50_720p_extradata);
323  }
324 
325  if (!size)
326  return 0;
327 
328  if ((ret = ff_alloc_extradata(st->codecpar, size)) < 0)
329  return ret;
330  memcpy(st->codecpar->extradata, data, size);
331 
332  return 0;
333 }
334 
335 int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
336 {
337  int ret = ff_alloc_extradata(par, size);
338  if (ret < 0)
339  return ret;
340  ret = ffio_read_size(pb, par->extradata, size);
341  if (ret < 0) {
342  av_freep(&par->extradata);
343  par->extradata_size = 0;
344  av_log(logctx, AV_LOG_ERROR, "Failed to read extradata of size %d\n", size);
345  return ret;
346  }
347 
348  return ret;
349 }
350 
352 {
353  for (unsigned i = 0; i < s->nb_streams; i++)
354  if (s->streams[i]->id == id)
355  return i;
356  return -1;
357 }
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:427
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
avpriv_packet_list_put
int avpriv_packet_list_put(PacketList *packet_buffer, AVPacket *pkt, int(*copy)(AVPacket *dst, const AVPacket *src), int flags)
Append an AVPacket to the list.
Definition: avpacket.c:541
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:69
AVChapter::metadata
AVDictionary * metadata
Definition: avformat.h:1218
AVERROR
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
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
ffformatcontext
static av_always_inline FFFormatContext * ffformatcontext(AVFormatContext *s)
Definition: internal.h:188
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AV_DISPOSITION_ATTACHED_PIC
#define AV_DISPOSITION_ATTACHED_PIC
The stream is stored in the file as an attached picture/"cover art" (e.g.
Definition: avformat.h:674
AV_FIELD_PROGRESSIVE
@ AV_FIELD_PROGRESSIVE
Definition: defs.h:200
FFInputFormat::read_pause
int(* read_pause)(struct AVFormatContext *)
Pause playing - only meaningful if using a network-based format (RTSP).
Definition: demux.h:116
int64_t
long long int64_t
Definition: coverity.c:34
AVPacket::data
uint8_t * data
Definition: packet.h:522
AVChapter::start
int64_t start
Definition: avformat.h:1217
data
const char data[16]
Definition: mxf.c:148
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
@ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
Definition: packet.h:599
cffstream
static const av_always_inline FFStream * cffstream(const AVStream *st)
Definition: internal.h:422
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:577
sample_rate
sample_rate
Definition: ffmpeg_filter.c:409
ff_generate_avci_extradata
int ff_generate_avci_extradata(AVStream *st)
Generate standard extradata for AVC-Intra based on width/height and field order.
Definition: demux_utils.c:200
avformat_queue_attached_pictures
int avformat_queue_attached_pictures(AVFormatContext *s)
Definition: demux_utils.c:93
ff_remove_stream
void ff_remove_stream(AVFormatContext *s, AVStream *st)
Remove a stream from its AVFormatContext and free it.
Definition: avformat.c:114
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:417
fail
#define fail()
Definition: checkasm.h:179
AVStreamParseType
AVStreamParseType
Definition: avformat.h:591
avpriv_new_chapter
AVChapter * avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base, int64_t start, int64_t end, const char *title)
Add a new chapter.
Definition: demux_utils.c:42
AVChapter
Definition: avformat.h:1214
FFInputFormat::read_play
int(* read_play)(struct AVFormatContext *)
Start/resume playing - only meaningful if using a network-based format (RTSP).
Definition: demux.h:110
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AVStream::attached_pic
AVPacket attached_pic
For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached pictu...
Definition: avformat.h:841
avassert.h
AV_PKT_DATA_PARAM_CHANGE
@ AV_PKT_DATA_PARAM_CHANGE
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
Definition: packet.h:73
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
@ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
Definition: packet.h:600
AVChapter::end
int64_t end
chapter start/end time in time_base units
Definition: avformat.h:1217
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
avpriv_stream_set_need_parsing
void avpriv_stream_set_need_parsing(AVStream *st, enum AVStreamParseType type)
Definition: demux_utils.c:37
av_read_play
int av_read_play(AVFormatContext *s)
Start playing a network-based stream (e.g.
Definition: demux_utils.c:182
channels
channels
Definition: aptx.h:31
ff_add_attached_pic
int ff_add_attached_pic(AVFormatContext *s, AVStream *st0, AVIOContext *pb, AVBufferRef **buf, int size)
Add an attached pic to an AVStream.
Definition: demux_utils.c:116
FFFormatContext
Definition: internal.h:64
FFStream::need_parsing
enum AVStreamParseType need_parsing
Definition: internal.h:386
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:219
AVFormatContext
Format I/O context.
Definition: avformat.h:1255
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:766
AVPacket::buf
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
Definition: packet.h:505
NULL
#define NULL
Definition: coverity.c:32
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
avio_pause
int avio_pause(AVIOContext *h, int pause)
Pause and resume playing - only meaningful if using a network streaming protocol (e....
Definition: aviobuf.c:1224
av_packet_ref
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
Definition: avpacket.c:435
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:73
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
AVPacket::size
int size
Definition: packet.h:523
av_format_inject_global_side_data
void av_format_inject_global_side_data(AVFormatContext *s)
This function will cause global side data to be injected in the next packet of each stream as well as...
Definition: demux_utils.c:83
size
int size
Definition: twinvq_data.h:10344
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
height
#define height
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:528
FFFormatContext::raw_packet_buffer
PacketList raw_packet_buffer
Raw packets from the demuxer, prior to parsing and decoding.
Definition: internal.h:109
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
avio_internal.h
AVChapter::id
int64_t id
unique ID to identify the chapter
Definition: avformat.h:1215
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:56
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:254
demux.h
av_read_pause
int av_read_pause(AVFormatContext *s)
Pause a network-based stream (e.g.
Definition: demux_utils.c:191
AVCodecParameters::field_order
enum AVFieldOrder field_order
Video only.
Definition: codec_par.h:161
av_get_packet
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
Allocate and read the payload of a packet and initialize its fields with default values.
Definition: utils.c:103
AVCodecParserContext
Definition: avcodec.h:2707
version.h
AVStream::disposition
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
Definition: avformat.h:812
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:743
avformat.h
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
id
enum AVCodecID id
Definition: dts2pts.c:364
FFFormatContext::chapter_ids_monotonic
int chapter_ids_monotonic
Set if chapter ids are strictly monotonic.
Definition: internal.h:180
av_dynarray_add_nofree
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
Definition: mem.c:313
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:749
av_packet_new_side_data
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
Definition: avpacket.c:231
av_stream_get_parser
struct AVCodecParserContext * av_stream_get_parser(const AVStream *st)
Definition: demux_utils.c:32
ffifmt
static const FFInputFormat * ffifmt(const AVInputFormat *fmt)
Definition: demux.h:133
ff_get_extradata
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and f...
Definition: demux_utils.c:335
AVPacket::stream_index
int stream_index
Definition: packet.h:524
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
packet_internal.h
ff_find_stream_index
int ff_find_stream_index(const AVFormatContext *s, int id)
Find stream index based on format-specific stream ID.
Definition: demux_utils.c:351
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVPacket
This structure stores compressed data.
Definition: packet.h:499
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
av_dict_set
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:88
ff_add_param_change
int ff_add_param_change(AVPacket *pkt, int32_t channels, uint64_t channel_layout, int32_t sample_rate, int32_t width, int32_t height)
Add side data to a packet for changing parameters to the given values.
Definition: demux_utils.c:151
int32_t
int32_t
Definition: audioconvert.c:56
bytestream.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
FFStream::parser
struct AVCodecParserContext * parser
Definition: internal.h:387
ffio_read_size
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:661
AVChapter::time_base
AVRational time_base
time base in which the start/end timestamps are specified
Definition: avformat.h:1216
ff_alloc_extradata
int ff_alloc_extradata(AVCodecParameters *par, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0.
Definition: utils.c:239