FFmpeg
ffmpeg_demux.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include "ffmpeg.h"
20 
21 #include "libavutil/avassert.h"
22 #include "libavutil/error.h"
23 #include "libavutil/time.h"
24 #include "libavutil/timestamp.h"
25 #include "libavutil/thread.h"
27 
28 #include "libavcodec/packet.h"
29 
30 #include "libavformat/avformat.h"
31 
32 typedef struct DemuxMsg {
34  int looping;
35 
36  // repeat_pict from the demuxer-internal parser
38 } DemuxMsg;
39 
40 static void report_new_stream(InputFile *file, const AVPacket *pkt)
41 {
42  AVStream *st = file->ctx->streams[pkt->stream_index];
43 
44  if (pkt->stream_index < file->nb_streams_warn)
45  return;
46  av_log(file->ctx, AV_LOG_WARNING,
47  "New %s stream %d:%d at pos:%"PRId64" and DTS:%ss\n",
49  file->index, pkt->stream_index,
50  pkt->pos, av_ts2timestr(pkt->dts, &st->time_base));
51  file->nb_streams_warn = pkt->stream_index + 1;
52 }
53 
55  int64_t last_duration)
56 {
57  /* the total duration of the stream, max_pts - min_pts is
58  * the duration of the stream without the last frame */
59  if (ist->max_pts > ist->min_pts &&
60  ist->max_pts - (uint64_t)ist->min_pts < INT64_MAX - last_duration)
61  last_duration += ist->max_pts - ist->min_pts;
62 
63  if (!f->duration ||
64  av_compare_ts(f->duration, f->time_base,
65  last_duration, ist->st->time_base) < 0) {
66  f->duration = last_duration;
67  f->time_base = ist->st->time_base;
68  }
69 }
70 
72 {
73  AVFormatContext *is = ifile->ctx;
74  InputStream *ist;
75  int ret;
76 
77  ret = avformat_seek_file(is, -1, INT64_MIN, is->start_time, is->start_time, 0);
78  if (ret < 0)
79  return ret;
80 
81  if (ifile->audio_duration_queue_size) {
82  /* duration is the length of the last frame in a stream
83  * when audio stream is present we don't care about
84  * last video frame length because it's not defined exactly */
85  int got_durations = 0;
86 
87  while (got_durations < ifile->audio_duration_queue_size) {
89  ret = av_thread_message_queue_recv(ifile->audio_duration_queue, &dur, 0);
90  if (ret < 0)
91  return ret;
92  got_durations++;
93 
94  ist = input_streams[ifile->ist_index + dur.stream_idx];
96  }
97  } else {
98  for (int i = 0; i < ifile->nb_streams; i++) {
99  int64_t duration = 0;
100  ist = input_streams[ifile->ist_index + i];
101 
102  if (ist->framerate.num) {
103  duration = av_rescale_q(1, av_inv_q(ist->framerate), ist->st->time_base);
104  } else if (ist->st->avg_frame_rate.num) {
106  } else {
107  duration = 1;
108  }
109 
111  }
112  }
113 
114  if (ifile->loop > 0)
115  ifile->loop--;
116 
117  return ret;
118 }
119 
120 static void ts_fixup(InputFile *ifile, AVPacket *pkt, int *repeat_pict)
121 {
122  InputStream *ist = input_streams[ifile->ist_index + pkt->stream_index];
123  const int64_t start_time = ifile->ctx->start_time;
124  int64_t duration;
125 
126  if (debug_ts) {
127  av_log(NULL, AV_LOG_INFO, "demuxer -> ist_index:%d type:%s "
128  "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s\n",
129  ifile->ist_index + pkt->stream_index,
134  }
135 
137  ist->st->pts_wrap_bits < 64) {
138  int64_t stime, stime2;
139 
141  stime2= stime + (1ULL<<ist->st->pts_wrap_bits);
142  ist->wrap_correction_done = 1;
143 
144  if(stime2 > stime && pkt->dts != AV_NOPTS_VALUE && pkt->dts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {
145  pkt->dts -= 1ULL<<ist->st->pts_wrap_bits;
146  ist->wrap_correction_done = 0;
147  }
148  if(stime2 > stime && pkt->pts != AV_NOPTS_VALUE && pkt->pts > stime + (1LL<<(ist->st->pts_wrap_bits-1))) {
149  pkt->pts -= 1ULL<<ist->st->pts_wrap_bits;
150  ist->wrap_correction_done = 0;
151  }
152  }
153 
154  if (pkt->dts != AV_NOPTS_VALUE)
155  pkt->dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
156  if (pkt->pts != AV_NOPTS_VALUE)
157  pkt->pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
158 
159  if (pkt->pts != AV_NOPTS_VALUE)
160  pkt->pts *= ist->ts_scale;
161  if (pkt->dts != AV_NOPTS_VALUE)
162  pkt->dts *= ist->ts_scale;
163 
164  duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);
165  if (pkt->pts != AV_NOPTS_VALUE) {
166  pkt->pts += duration;
167  ist->max_pts = FFMAX(pkt->pts, ist->max_pts);
168  ist->min_pts = FFMIN(pkt->pts, ist->min_pts);
169  }
170 
171  if (pkt->dts != AV_NOPTS_VALUE)
172  pkt->dts += duration;
173 
174  *repeat_pict = -1;
175  if (ist->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
176  av_stream_get_parser(ist->st))
177  *repeat_pict = av_stream_get_parser(ist->st)->repeat_pict;
178 }
179 
180 static void *input_thread(void *arg)
181 {
182  InputFile *f = arg;
183  AVPacket *pkt;
184  unsigned flags = f->non_blocking ? AV_THREAD_MESSAGE_NONBLOCK : 0;
185  int ret = 0;
186 
187  pkt = av_packet_alloc();
188  if (!pkt) {
189  ret = AVERROR(ENOMEM);
190  goto finish;
191  }
192 
193  while (1) {
194  DemuxMsg msg = { NULL };
195 
196  ret = av_read_frame(f->ctx, pkt);
197 
198  if (ret == AVERROR(EAGAIN)) {
199  av_usleep(10000);
200  continue;
201  }
202  if (ret < 0) {
203  if (f->loop) {
204  /* signal looping to the consumer thread */
205  msg.looping = 1;
206  ret = av_thread_message_queue_send(f->in_thread_queue, &msg, 0);
207  if (ret >= 0)
208  ret = seek_to_start(f);
209  if (ret >= 0)
210  continue;
211 
212  /* fallthrough to the error path */
213  }
214 
215  break;
216  }
217 
218  if (do_pkt_dump) {
220  f->ctx->streams[pkt->stream_index]);
221  }
222 
223  /* the following test is needed in case new streams appear
224  dynamically in stream : we ignore them */
225  if (pkt->stream_index >= f->nb_streams) {
228  continue;
229  }
230 
231  if (pkt->flags & AV_PKT_FLAG_CORRUPT) {
233  "%s: corrupt input packet in stream %d\n",
234  f->ctx->url, pkt->stream_index);
235  if (exit_on_error) {
238  break;
239  }
240  }
241 
242  ts_fixup(f, pkt, &msg.repeat_pict);
243 
244  msg.pkt = av_packet_alloc();
245  if (!msg.pkt) {
247  ret = AVERROR(ENOMEM);
248  break;
249  }
250  av_packet_move_ref(msg.pkt, pkt);
251  ret = av_thread_message_queue_send(f->in_thread_queue, &msg, flags);
252  if (flags && ret == AVERROR(EAGAIN)) {
253  flags = 0;
254  ret = av_thread_message_queue_send(f->in_thread_queue, &msg, flags);
255  av_log(f->ctx, AV_LOG_WARNING,
256  "Thread message queue blocking; consider raising the "
257  "thread_queue_size option (current value: %d)\n",
258  f->thread_queue_size);
259  }
260  if (ret < 0) {
261  if (ret != AVERROR_EOF)
262  av_log(f->ctx, AV_LOG_ERROR,
263  "Unable to send packet to main thread: %s\n",
264  av_err2str(ret));
265  av_packet_free(&msg.pkt);
266  break;
267  }
268  }
269 
270 finish:
271  av_assert0(ret < 0);
272  av_thread_message_queue_set_err_recv(f->in_thread_queue, ret);
273 
275 
276  return NULL;
277 }
278 
279 static void free_input_thread(int i)
280 {
281  InputFile *f = input_files[i];
282  DemuxMsg msg;
283 
284  if (!f || !f->in_thread_queue)
285  return;
287  while (av_thread_message_queue_recv(f->in_thread_queue, &msg, 0) >= 0)
288  av_packet_free(&msg.pkt);
289 
290  pthread_join(f->thread, NULL);
291  av_thread_message_queue_free(&f->in_thread_queue);
292  av_thread_message_queue_free(&f->audio_duration_queue);
293 }
294 
296 {
297  int i;
298 
299  for (i = 0; i < nb_input_files; i++)
301 }
302 
303 static int init_input_thread(int i)
304 {
305  int ret;
306  InputFile *f = input_files[i];
307 
308  if (f->thread_queue_size <= 0)
309  f->thread_queue_size = (nb_input_files > 1 ? 8 : 1);
310 
311  if (f->ctx->pb ? !f->ctx->pb->seekable :
312  strcmp(f->ctx->iformat->name, "lavfi"))
313  f->non_blocking = 1;
314  ret = av_thread_message_queue_alloc(&f->in_thread_queue,
315  f->thread_queue_size, sizeof(DemuxMsg));
316  if (ret < 0)
317  return ret;
318 
319  if (f->loop) {
320  int nb_audio_dec = 0;
321 
322  for (int i = 0; i < f->nb_streams; i++) {
323  InputStream *ist = input_streams[f->ist_index + i];
324  nb_audio_dec += !!(ist->decoding_needed &&
326  }
327 
328  if (nb_audio_dec) {
329  ret = av_thread_message_queue_alloc(&f->audio_duration_queue,
330  nb_audio_dec, sizeof(LastFrameDuration));
331  if (ret < 0)
332  goto fail;
333  f->audio_duration_queue_size = nb_audio_dec;
334  }
335  }
336 
337  if ((ret = pthread_create(&f->thread, NULL, input_thread, f))) {
338  av_log(NULL, AV_LOG_ERROR, "pthread_create failed: %s. Try to increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(ret));
339  ret = AVERROR(ret);
340  goto fail;
341  }
342 
343  return 0;
344 fail:
345  av_thread_message_queue_free(&f->in_thread_queue);
346  return ret;
347 }
348 
350 {
351  int i, ret;
352 
353  for (i = 0; i < nb_input_files; i++) {
355  if (ret < 0)
356  return ret;
357  }
358  return 0;
359 }
360 
362 {
363  InputStream *ist;
364  DemuxMsg msg;
365  int ret;
366 
367  if (f->readrate || f->rate_emu) {
368  int i;
369  int64_t file_start = copy_ts * (
370  (f->ctx->start_time != AV_NOPTS_VALUE ? f->ctx->start_time * !start_at_zero : 0) +
371  (f->start_time != AV_NOPTS_VALUE ? f->start_time : 0)
372  );
373  float scale = f->rate_emu ? 1.0 : f->readrate;
374  for (i = 0; i < f->nb_streams; i++) {
375  InputStream *ist = input_streams[f->ist_index + i];
376  int64_t stream_ts_offset, pts, now;
377  if (!ist->nb_packets || (ist->decoding_needed && !ist->got_output)) continue;
378  stream_ts_offset = FFMAX(ist->first_dts != AV_NOPTS_VALUE ? ist->first_dts : 0, file_start);
379  pts = av_rescale(ist->dts, 1000000, AV_TIME_BASE);
380  now = (av_gettime_relative() - ist->start) * scale + stream_ts_offset;
381  if (pts > now)
382  return AVERROR(EAGAIN);
383  }
384  }
385 
386  ret = av_thread_message_queue_recv(f->in_thread_queue, &msg,
387  f->non_blocking ?
389  if (ret < 0)
390  return ret;
391  if (msg.looping)
392  return 1;
393 
394  ist = input_streams[f->ist_index + msg.pkt->stream_index];
396 
397  *pkt = msg.pkt;
398  return 0;
399 }
input_thread
static void * input_thread(void *arg)
Definition: ffmpeg_demux.c:180
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:422
pthread_join
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
Definition: os2threads.h:94
av_gettime_relative
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
Definition: time.c:56
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
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
nb_input_files
int nb_input_files
Definition: ffmpeg.c:147
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:57
av_compare_ts
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare two timestamps each in its own time base.
Definition: mathematics.c:147
is
The official guide to swscale for confused that is
Definition: swscale.txt:28
thread.h
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
InputFile::nb_streams_warn
int nb_streams_warn
Definition: ffmpeg.h:453
AV_TIME_BASE_Q
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:260
InputFile::index
int index
Definition: ffmpeg.h:430
ts_fixup
static void ts_fixup(InputFile *ifile, AVPacket *pkt, int *repeat_pict)
Definition: ffmpeg_demux.c:120
AV_THREAD_MESSAGE_NONBLOCK
@ AV_THREAD_MESSAGE_NONBLOCK
Perform non-blocking operation.
Definition: threadmessage.h:31
AVFormatContext::streams
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1284
LastFrameDuration::stream_idx
int stream_idx
Definition: ffmpeg.h:425
AVStream::avg_frame_rate
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:1028
ifile_duration_update
static void ifile_duration_update(InputFile *f, InputStream *ist, int64_t last_duration)
Definition: ffmpeg_demux.c:54
ffmpeg.h
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:392
DemuxMsg::pkt
AVPacket * pkt
Definition: ffmpeg_demux.c:33
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
av_read_frame
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
Definition: demux.c:1439
InputStream::decoding_needed
int decoding_needed
Definition: ffmpeg.h:321
LastFrameDuration
Definition: ffmpeg.h:424
av_packet_free
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition: avpacket.c:73
InputStream
Definition: ffmpeg.h:316
debug_ts
int debug_ts
Definition: ffmpeg_opt.c:169
finish
static void finish(void)
Definition: movenc.c:342
fail
#define fail()
Definition: checkasm.h:133
InputStream::nb_packets
uint64_t nb_packets
Definition: ffmpeg.h:413
scale
static av_always_inline float scale(float x, float s)
Definition: vf_v360.c:1389
pts
static int64_t pts
Definition: transcode_aac.c:654
av_thread_message_queue_recv
int av_thread_message_queue_recv(AVThreadMessageQueue *mq, void *msg, unsigned flags)
Receive a message from the queue.
Definition: threadmessage.c:174
do_pkt_dump
int do_pkt_dump
Definition: ffmpeg_opt.c:165
AVRational::num
int num
Numerator.
Definition: rational.h:59
InputFile
Definition: ffmpeg.h:429
ifile_get_packet
int ifile_get_packet(InputFile *f, AVPacket **pkt)
Get next input packet from the demuxer.
Definition: ffmpeg_demux.c:361
InputStream::last_pkt_repeat_pict
int last_pkt_repeat_pict
Definition: ffmpeg.h:355
InputStream::first_dts
int64_t first_dts
dts of the first packet read for this stream (in AV_TIME_BASE units)
Definition: ffmpeg.h:344
avassert.h
InputStream::dts
int64_t dts
dts of the last packet read for this stream (in AV_TIME_BASE units)
Definition: ffmpeg.h:345
report_new_stream
static void report_new_stream(InputFile *file, const AVPacket *pkt)
Definition: ffmpeg_demux.c:40
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_PKT_FLAG_CORRUPT
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
Definition: packet.h:430
av_thread_message_queue_send
int av_thread_message_queue_send(AVThreadMessageQueue *mq, void *msg, unsigned flags)
Send a message on the queue.
Definition: threadmessage.c:158
duration
int64_t duration
Definition: movenc.c:64
input_streams
InputStream ** input_streams
Definition: ffmpeg.c:144
InputStream::framerate
AVRational framerate
Definition: ffmpeg.h:371
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
seek_to_start
static int seek_to_start(InputFile *ifile)
Definition: ffmpeg_demux.c:71
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
av_usleep
int av_usleep(unsigned usec)
Sleep for a period of time.
Definition: time.c:84
arg
const char * arg
Definition: jacosubdec.c:67
pthread_create
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Definition: os2threads.h:80
AVCodecParserContext::repeat_pict
int repeat_pict
This field is used for proper frame duration computation in lavf.
Definition: avcodec.h:2818
AVFormatContext
Format I/O context.
Definition: avformat.h:1216
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1108
AVStream::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avformat.h:978
NULL
#define NULL
Definition: coverity.c:32
InputStream::st
AVStream * st
Definition: ffmpeg.h:318
time.h
av_packet_move_ref
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
Definition: avpacket.c:479
InputStream::min_pts
int64_t min_pts
Definition: ffmpeg.h:359
init_input_thread
static int init_input_thread(int i)
Definition: ffmpeg_demux.c:303
input_files
InputFile ** input_files
Definition: ffmpeg.c:146
error.h
f
f
Definition: af_crystalizer.c:122
av_ts2timestr
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: timestamp.h:76
InputStream::wrap_correction_done
int wrap_correction_done
Definition: ffmpeg.h:349
InputStream::start
int64_t start
Definition: ffmpeg.h:340
threadmessage.h
av_err2str
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:121
start_time
static int64_t start_time
Definition: ffplay.c:331
InputStream::got_output
int got_output
Definition: ffmpeg.h:379
copy_ts
int copy_ts
Definition: ffmpeg_opt.c:166
avformat_seek_file
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
Definition: seek.c:659
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
free_input_thread
static void free_input_thread(int i)
Definition: ffmpeg_demux.c:279
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:373
InputStream::max_pts
int64_t max_pts
Definition: ffmpeg.h:360
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:380
av_packet_alloc
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: avpacket.c:62
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
av_thread_message_queue_alloc
int av_thread_message_queue_alloc(AVThreadMessageQueue **mq, unsigned nelem, unsigned elsize)
Allocate a new message queue.
Definition: threadmessage.c:42
DemuxMsg::looping
int looping
Definition: ffmpeg_demux.c:34
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:367
packet.h
init_input_threads
int init_input_threads(void)
Definition: ffmpeg_demux.c:349
AV_TIME_BASE
#define AV_TIME_BASE
Internal time base represented as integer.
Definition: avutil.h:254
av_thread_message_queue_set_err_send
void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, int err)
Set the sending error code.
Definition: threadmessage.c:190
exit_on_error
int exit_on_error
Definition: ffmpeg_opt.c:170
InputFile::ctx
AVFormatContext * ctx
Definition: ffmpeg.h:432
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
av_rescale
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:129
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:948
AV_LOG_FATAL
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition: log.h:174
normalize.ifile
ifile
Definition: normalize.py:6
avformat.h
av_get_media_type_string
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
Definition: utils.c:28
AVPacket::stream_index
int stream_index
Definition: packet.h:376
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
start_at_zero
int start_at_zero
Definition: ffmpeg_opt.c:167
do_hex_dump
int do_hex_dump
Definition: ffmpeg_opt.c:164
LastFrameDuration::duration
int64_t duration
Definition: ffmpeg.h:426
InputStream::ts_scale
double ts_scale
Definition: ffmpeg.h:368
AVPacket
This structure stores compressed data.
Definition: packet.h:351
DemuxMsg
Definition: ffmpeg_demux.c:32
av_thread_message_queue_free
void av_thread_message_queue_free(AVThreadMessageQueue **mq)
Free a message queue.
Definition: threadmessage.c:93
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:394
timestamp.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
av_thread_message_queue_set_err_recv
void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, int err)
Set the receiving error code.
Definition: threadmessage.c:201
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
av_stream_get_parser
struct AVCodecParserContext * av_stream_get_parser(const AVStream *s)
Definition: demux_utils.c:32
av_ts2str
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: timestamp.h:54
av_pkt_dump_log2
void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, const AVStream *st)
Send a nice dump of a packet to the log.
Definition: dump.c:117
AVStream::pts_wrap_bits
int pts_wrap_bits
Number of bits in timestamps.
Definition: avformat.h:1117
free_input_threads
void free_input_threads(void)
Definition: ffmpeg_demux.c:295
DemuxMsg::repeat_pict
int repeat_pict
Definition: ffmpeg_demux.c:37