Libav
mux.c
Go to the documentation of this file.
1 /*
2  * muxing functions for use within Libav
3  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4  *
5  * This file is part of Libav.
6  *
7  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "avformat.h"
23 #include "avio_internal.h"
24 #include "internal.h"
25 #include "libavcodec/internal.h"
26 #include "libavcodec/bytestream.h"
27 #include "libavutil/opt.h"
28 #include "libavutil/dict.h"
29 #include "libavutil/pixdesc.h"
30 #include "metadata.h"
31 #include "id3v2.h"
32 #include "libavutil/avassert.h"
33 #include "libavutil/avstring.h"
34 #include "libavutil/internal.h"
35 #include "libavutil/mathematics.h"
36 #include "libavutil/parseutils.h"
37 #include "libavutil/time.h"
38 #include "riff.h"
39 #include "audiointerleave.h"
40 #include "url.h"
41 #include <stdarg.h>
42 #if CONFIG_NETWORK
43 #include "network.h"
44 #endif
45 
46 #undef NDEBUG
47 #include <assert.h>
48 
54 /* fraction handling */
55 
66 static void frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
67 {
68  num += (den >> 1);
69  if (num >= den) {
70  val += num / den;
71  num = num % den;
72  }
73  f->val = val;
74  f->num = num;
75  f->den = den;
76 }
77 
84 static void frac_add(AVFrac *f, int64_t incr)
85 {
86  int64_t num, den;
87 
88  num = f->num + incr;
89  den = f->den;
90  if (num < 0) {
91  f->val += num / den;
92  num = num % den;
93  if (num < 0) {
94  num += den;
95  f->val--;
96  }
97  } else if (num >= den) {
98  f->val += num / den;
99  num = num % den;
100  }
101  f->num = num;
102 }
103 
105 {
106  const AVCodecTag *avctag;
107  int n;
108  enum AVCodecID id = AV_CODEC_ID_NONE;
109  unsigned int tag = 0;
110 
117  for (n = 0; s->oformat->codec_tag[n]; n++) {
118  avctag = s->oformat->codec_tag[n];
119  while (avctag->id != AV_CODEC_ID_NONE) {
120  if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codec->codec_tag)) {
121  id = avctag->id;
122  if (id == st->codec->codec_id)
123  return 1;
124  }
125  if (avctag->id == st->codec->codec_id)
126  tag = avctag->tag;
127  avctag++;
128  }
129  }
130  if (id != AV_CODEC_ID_NONE)
131  return 0;
132  if (tag && (st->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL))
133  return 0;
134  return 1;
135 }
136 
137 
139 {
140  int ret = 0, i;
141  AVStream *st;
142  AVDictionary *tmp = NULL;
143  AVCodecContext *codec = NULL;
144  AVOutputFormat *of = s->oformat;
145 
146  if (options)
147  av_dict_copy(&tmp, *options, 0);
148 
149  if ((ret = av_opt_set_dict(s, &tmp)) < 0)
150  goto fail;
151 
152  // some sanity checks
153  if (s->nb_streams == 0 && !(of->flags & AVFMT_NOSTREAMS)) {
154  av_log(s, AV_LOG_ERROR, "no streams\n");
155  ret = AVERROR(EINVAL);
156  goto fail;
157  }
158 
159  for (i = 0; i < s->nb_streams; i++) {
160  st = s->streams[i];
161  codec = st->codec;
162 
163  switch (codec->codec_type) {
164  case AVMEDIA_TYPE_AUDIO:
165  if (codec->sample_rate <= 0) {
166  av_log(s, AV_LOG_ERROR, "sample rate not set\n");
167  ret = AVERROR(EINVAL);
168  goto fail;
169  }
170  if (!codec->block_align)
171  codec->block_align = codec->channels *
172  av_get_bits_per_sample(codec->codec_id) >> 3;
173  break;
174  case AVMEDIA_TYPE_VIDEO:
175  if (codec->time_base.num <= 0 ||
176  codec->time_base.den <= 0) { //FIXME audio too?
177  av_log(s, AV_LOG_ERROR, "time base not set\n");
178  ret = AVERROR(EINVAL);
179  goto fail;
180  }
181 
182  if ((codec->width <= 0 || codec->height <= 0) &&
183  !(of->flags & AVFMT_NODIMENSIONS)) {
184  av_log(s, AV_LOG_ERROR, "dimensions not set\n");
185  ret = AVERROR(EINVAL);
186  goto fail;
187  }
188 
190  codec->sample_aspect_ratio)) {
191  if (st->sample_aspect_ratio.num != 0 &&
192  st->sample_aspect_ratio.den != 0 &&
193  codec->sample_aspect_ratio.den != 0 &&
194  codec->sample_aspect_ratio.den != 0) {
195  av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between muxer "
196  "(%d/%d) and encoder layer (%d/%d)\n",
198  codec->sample_aspect_ratio.num,
199  codec->sample_aspect_ratio.den);
200  ret = AVERROR(EINVAL);
201  goto fail;
202  }
203  }
204  break;
205  }
206 
207  if (of->codec_tag) {
208  if (codec->codec_tag &&
209  codec->codec_id == AV_CODEC_ID_RAWVIDEO &&
210  !av_codec_get_tag(of->codec_tag, codec->codec_id) &&
211  !validate_codec_tag(s, st)) {
212  // the current rawvideo encoding system ends up setting
213  // the wrong codec_tag for avi, we override it here
214  codec->codec_tag = 0;
215  }
216  if (codec->codec_tag) {
217  if (!validate_codec_tag(s, st)) {
218  char tagbuf[32];
219  av_get_codec_tag_string(tagbuf, sizeof(tagbuf), codec->codec_tag);
220  av_log(s, AV_LOG_ERROR,
221  "Tag %s/0x%08x incompatible with output codec id '%d'\n",
222  tagbuf, codec->codec_tag, codec->codec_id);
223  ret = AVERROR_INVALIDDATA;
224  goto fail;
225  }
226  } else
227  codec->codec_tag = av_codec_get_tag(of->codec_tag, codec->codec_id);
228  }
229 
230  if (of->flags & AVFMT_GLOBALHEADER &&
231  !(codec->flags & CODEC_FLAG_GLOBAL_HEADER))
233  "Codec for stream %d does not use global headers "
234  "but container format requires global headers\n", i);
235 
236  if (codec->codec_type != AVMEDIA_TYPE_ATTACHMENT)
238  }
239 
240  if (!s->priv_data && of->priv_data_size > 0) {
242  if (!s->priv_data) {
243  ret = AVERROR(ENOMEM);
244  goto fail;
245  }
246  if (of->priv_class) {
247  *(const AVClass **)s->priv_data = of->priv_class;
249  if ((ret = av_opt_set_dict(s->priv_data, &tmp)) < 0)
250  goto fail;
251  }
252  }
253 
254  /* set muxer identification string */
255  if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
256  av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
257  }
258 
259  if (options) {
260  av_dict_free(options);
261  *options = tmp;
262  }
263 
264  return 0;
265 
266 fail:
267  av_dict_free(&tmp);
268  return ret;
269 }
270 
271 static int init_pts(AVFormatContext *s)
272 {
273  int i;
274  AVStream *st;
275 
276  /* init PTS generation */
277  for (i = 0; i < s->nb_streams; i++) {
278  int64_t den = AV_NOPTS_VALUE;
279  st = s->streams[i];
280 
281  switch (st->codec->codec_type) {
282  case AVMEDIA_TYPE_AUDIO:
283  den = (int64_t)st->time_base.num * st->codec->sample_rate;
284  break;
285  case AVMEDIA_TYPE_VIDEO:
286  den = (int64_t)st->time_base.num * st->codec->time_base.den;
287  break;
288  default:
289  break;
290  }
291  if (den != AV_NOPTS_VALUE) {
292  if (den <= 0)
293  return AVERROR_INVALIDDATA;
294 
295  frac_init(&st->pts, 0, 0, den);
296  }
297  }
298 
299  return 0;
300 }
301 
303 {
304  int ret = 0;
305 
306  if (ret = init_muxer(s, options))
307  return ret;
308 
309  if (s->oformat->write_header) {
310  ret = s->oformat->write_header(s);
311  if (ret < 0)
312  return ret;
313  }
314 
315  if ((ret = init_pts(s)) < 0)
316  return ret;
317 
318  return 0;
319 }
320 
321 //FIXME merge with compute_pkt_fields
323 {
324  int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
325  int num, den, frame_size, i;
326 
327  av_dlog(s, "compute_pkt_fields2: pts:%" PRId64 " dts:%" PRId64 " cur_dts:%" PRId64 " b:%d size:%d st:%d\n",
328  pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index);
329 
330 /* if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE)
331  * return AVERROR(EINVAL);*/
332 
333  /* duration field */
334  if (pkt->duration == 0) {
335  ff_compute_frame_duration(&num, &den, st, NULL, pkt);
336  if (den && num) {
337  pkt->duration = av_rescale(1, num * (int64_t)st->time_base.den * st->codec->ticks_per_frame, den * (int64_t)st->time_base.num);
338  }
339  }
340 
341  if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && delay == 0)
342  pkt->pts = pkt->dts;
343 
344  //XXX/FIXME this is a temporary hack until all encoders output pts
345  if ((pkt->pts == 0 || pkt->pts == AV_NOPTS_VALUE) && pkt->dts == AV_NOPTS_VALUE && !delay) {
346  pkt->dts =
347 // pkt->pts= st->cur_dts;
348  pkt->pts = st->pts.val;
349  }
350 
351  //calculate dts from pts
352  if (pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) {
353  st->pts_buffer[0] = pkt->pts;
354  for (i = 1; i < delay + 1 && st->pts_buffer[i] == AV_NOPTS_VALUE; i++)
355  st->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration;
356  for (i = 0; i<delay && st->pts_buffer[i] > st->pts_buffer[i + 1]; i++)
357  FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]);
358 
359  pkt->dts = st->pts_buffer[0];
360  }
361 
362  if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
363  ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
364  st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {
365  av_log(s, AV_LOG_ERROR,
366  "Application provided invalid, non monotonically increasing dts to muxer in stream %d: %" PRId64 " >= %" PRId64 "\n",
367  st->index, st->cur_dts, pkt->dts);
368  return AVERROR(EINVAL);
369  }
370  if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts) {
371  av_log(s, AV_LOG_ERROR, "pts < dts in stream %d\n", st->index);
372  return AVERROR(EINVAL);
373  }
374 
375  av_dlog(s, "av_write_frame: pts2:%"PRId64" dts2:%"PRId64"\n",
376  pkt->pts, pkt->dts);
377  st->cur_dts = pkt->dts;
378  st->pts.val = pkt->dts;
379 
380  /* update pts */
381  switch (st->codec->codec_type) {
382  case AVMEDIA_TYPE_AUDIO:
383  frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 1);
384 
385  /* HACK/FIXME, we skip the initial 0 size packets as they are most
386  * likely equal to the encoder delay, but it would be better if we
387  * had the real timestamps from the encoder */
388  if (frame_size >= 0 && (pkt->size || st->pts.num != st->pts.den >> 1 || st->pts.val)) {
389  frac_add(&st->pts, (int64_t)st->time_base.den * frame_size);
390  }
391  break;
392  case AVMEDIA_TYPE_VIDEO:
393  frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num);
394  break;
395  default:
396  break;
397  }
398  return 0;
399 }
400 
401 /*
402  * FIXME: this function should NEVER get undefined pts/dts beside when the
403  * AVFMT_NOTIMESTAMPS is set.
404  * Those additional safety checks should be dropped once the correct checks
405  * are set in the callers.
406  */
407 
409 {
410  int ret;
412  AVRational time_base = s->streams[pkt->stream_index]->time_base;
413  int64_t offset = 0;
414 
415  if (!s->offset && pkt->dts != AV_NOPTS_VALUE && pkt->dts < 0) {
416  s->offset = -pkt->dts;
417  s->offset_timebase = time_base;
418  }
419  if (s->offset)
420  offset = av_rescale_q(s->offset, s->offset_timebase, time_base);
421 
422  if (pkt->dts != AV_NOPTS_VALUE)
423  pkt->dts += offset;
424  if (pkt->pts != AV_NOPTS_VALUE)
425  pkt->pts += offset;
426  }
427  ret = s->oformat->write_packet(s, pkt);
428 
429  if (s->pb && ret >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
430  avio_flush(s->pb);
431 
432  return ret;
433 }
434 
436 {
437  if (!pkt)
438  return 0;
439 
440  if (pkt->stream_index < 0 || pkt->stream_index >= s->nb_streams) {
441  av_log(s, AV_LOG_ERROR, "Invalid packet stream index: %d\n",
442  pkt->stream_index);
443  return AVERROR(EINVAL);
444  }
445 
447  av_log(s, AV_LOG_ERROR, "Received a packet for an attachment stream.\n");
448  return AVERROR(EINVAL);
449  }
450 
451  return 0;
452 }
453 
455 {
456  int ret;
457 
458  ret = check_packet(s, pkt);
459  if (ret < 0)
460  return ret;
461 
462  if (!pkt) {
463  if (s->oformat->flags & AVFMT_ALLOW_FLUSH)
464  return s->oformat->write_packet(s, pkt);
465  return 1;
466  }
467 
468  ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt);
469 
470  if (ret < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
471  return ret;
472 
473  ret = write_packet(s, pkt);
474 
475  if (ret >= 0)
476  s->streams[pkt->stream_index]->nb_frames++;
477  return ret;
478 }
479 
481  int (*compare)(AVFormatContext *, AVPacket *, AVPacket *))
482 {
483  int ret;
484  AVPacketList **next_point, *this_pktl;
485 
486  this_pktl = av_mallocz(sizeof(AVPacketList));
487  if (!this_pktl)
488  return AVERROR(ENOMEM);
489  this_pktl->pkt = *pkt;
490 #if FF_API_DESTRUCT_PACKET
492  pkt->destruct = NULL; // do not free original but only the copy
494 #endif
495  pkt->buf = NULL;
496  pkt->side_data = NULL;
497  pkt->side_data_elems = 0;
498  // Duplicate the packet if it uses non-allocated memory
499  if ((ret = av_dup_packet(&this_pktl->pkt)) < 0) {
500  av_free(this_pktl);
501  return ret;
502  }
503 
505  next_point = &(s->streams[pkt->stream_index]->last_in_packet_buffer->next);
506  } else
507  next_point = &s->packet_buffer;
508 
509  if (*next_point) {
510  if (compare(s, &s->packet_buffer_end->pkt, pkt)) {
511  while (!compare(s, &(*next_point)->pkt, pkt))
512  next_point = &(*next_point)->next;
513  goto next_non_null;
514  } else {
515  next_point = &(s->packet_buffer_end->next);
516  }
517  }
518  assert(!*next_point);
519 
520  s->packet_buffer_end = this_pktl;
521 next_non_null:
522 
523  this_pktl->next = *next_point;
524 
526  *next_point = this_pktl;
527 
528  return 0;
529 }
530 
532  AVPacket *pkt)
533 {
534  AVStream *st = s->streams[pkt->stream_index];
535  AVStream *st2 = s->streams[next->stream_index];
536  int comp = av_compare_ts(next->dts, st2->time_base, pkt->dts,
537  st->time_base);
538 
539  if (comp == 0)
540  return pkt->stream_index < next->stream_index;
541  return comp > 0;
542 }
543 
545  AVPacket *pkt, int flush)
546 {
547  AVPacketList *pktl;
548  int stream_count = 0;
549  int i, ret;
550 
551  if (pkt) {
552  if ((ret = ff_interleave_add_packet(s, pkt, interleave_compare_dts)) < 0)
553  return ret;
554  }
555 
556  if (s->max_interleave_delta > 0 && s->packet_buffer && !flush) {
557  AVPacket *top_pkt = &s->packet_buffer->pkt;
558  int64_t delta_dts = INT64_MIN;
559  int64_t top_dts = av_rescale_q(top_pkt->dts,
560  s->streams[top_pkt->stream_index]->time_base,
562 
563  for (i = 0; i < s->nb_streams; i++) {
564  int64_t last_dts;
565  const AVPacketList *last = s->streams[i]->last_in_packet_buffer;
566 
567  if (!last)
568  continue;
569 
570  last_dts = av_rescale_q(last->pkt.dts,
571  s->streams[i]->time_base,
573  delta_dts = FFMAX(delta_dts, last_dts - top_dts);
574  stream_count++;
575  }
576 
577  if (delta_dts > s->max_interleave_delta) {
578  av_log(s, AV_LOG_DEBUG,
579  "Delay between the first packet and last packet in the "
580  "muxing queue is %"PRId64" > %"PRId64": forcing output\n",
581  delta_dts, s->max_interleave_delta);
582  flush = 1;
583  }
584  } else {
585  for (i = 0; i < s->nb_streams; i++)
586  stream_count += !!s->streams[i]->last_in_packet_buffer;
587  }
588 
589 
590  if (stream_count && (s->internal->nb_interleaved_streams == stream_count || flush)) {
591  pktl = s->packet_buffer;
592  *out = pktl->pkt;
593 
594  s->packet_buffer = pktl->next;
595  if (!s->packet_buffer)
596  s->packet_buffer_end = NULL;
597 
598  if (s->streams[out->stream_index]->last_in_packet_buffer == pktl)
600  av_freep(&pktl);
601  return 1;
602  } else {
603  av_init_packet(out);
604  return 0;
605  }
606 }
607 
618 {
619  if (s->oformat->interleave_packet) {
620  int ret = s->oformat->interleave_packet(s, out, in, flush);
621  if (in)
622  av_free_packet(in);
623  return ret;
624  } else
625  return ff_interleave_packet_per_dts(s, out, in, flush);
626 }
627 
629 {
630  int ret, flush = 0;
631 
632  ret = check_packet(s, pkt);
633  if (ret < 0)
634  goto fail;
635 
636  if (pkt) {
637  AVStream *st = s->streams[pkt->stream_index];
638 
639  //FIXME/XXX/HACK drop zero sized packets
640  if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size == 0) {
641  ret = 0;
642  goto fail;
643  }
644 
645  av_dlog(s, "av_interleaved_write_frame size:%d dts:%" PRId64 " pts:%" PRId64 "\n",
646  pkt->size, pkt->dts, pkt->pts);
647  if ((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
648  goto fail;
649 
650  if (pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
651  ret = AVERROR(EINVAL);
652  goto fail;
653  }
654  } else {
655  av_dlog(s, "av_interleaved_write_frame FLUSH\n");
656  flush = 1;
657  }
658 
659  for (;; ) {
660  AVPacket opkt;
661  int ret = interleave_packet(s, &opkt, pkt, flush);
662  if (pkt) {
663  memset(pkt, 0, sizeof(*pkt));
664  av_init_packet(pkt);
665  pkt = NULL;
666  }
667  if (ret <= 0) //FIXME cleanup needed for ret<0 ?
668  return ret;
669 
670  ret = write_packet(s, &opkt);
671  if (ret >= 0)
672  s->streams[opkt.stream_index]->nb_frames++;
673 
674  av_free_packet(&opkt);
675 
676  if (ret < 0)
677  return ret;
678  }
679 fail:
680  av_packet_unref(pkt);
681  return ret;
682 }
683 
685 {
686  int ret, i;
687 
688  for (;; ) {
689  AVPacket pkt;
690  ret = interleave_packet(s, &pkt, NULL, 1);
691  if (ret < 0) //FIXME cleanup needed for ret<0 ?
692  goto fail;
693  if (!ret)
694  break;
695 
696  ret = write_packet(s, &pkt);
697  if (ret >= 0)
698  s->streams[pkt.stream_index]->nb_frames++;
699 
700  av_free_packet(&pkt);
701 
702  if (ret < 0)
703  goto fail;
704  }
705 
706  if (s->oformat->write_trailer)
707  ret = s->oformat->write_trailer(s);
708 
709  if (!(s->oformat->flags & AVFMT_NOFILE))
710  avio_flush(s->pb);
711 
712 fail:
713  for (i = 0; i < s->nb_streams; i++) {
714  av_freep(&s->streams[i]->priv_data);
715  av_freep(&s->streams[i]->index_entries);
716  }
717  if (s->oformat->priv_class)
719  av_freep(&s->priv_data);
720  return ret;
721 }
722 
723 int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt,
724  AVFormatContext *src)
725 {
726  AVPacket local_pkt;
727 
728  local_pkt = *pkt;
729  local_pkt.stream_index = dst_stream;
730  if (pkt->pts != AV_NOPTS_VALUE)
731  local_pkt.pts = av_rescale_q(pkt->pts,
732  src->streams[pkt->stream_index]->time_base,
733  dst->streams[dst_stream]->time_base);
734  if (pkt->dts != AV_NOPTS_VALUE)
735  local_pkt.dts = av_rescale_q(pkt->dts,
736  src->streams[pkt->stream_index]->time_base,
737  dst->streams[dst_stream]->time_base);
738  return av_write_frame(dst, &local_pkt);
739 }
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:54
static int check_packet(AVFormatContext *s, AVPacket *pkt)
Definition: mux.c:435
enum AVCodecID id
Definition: internal.h:36
void av_free_packet(AVPacket *pkt)
Free a packet.
Definition: avpacket.c:242
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file ensuring correct interleaving.
Definition: mux.c:628
int avformat_write_header(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and write the stream header to an output media file.
Definition: mux.c:302
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file.
Definition: mux.c:454
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:129
int64_t pts_buffer[MAX_REORDER_DELAY+1]
Definition: avformat.h:825
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
Definition: avcodec.h:1302
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
Definition: opt.c:504
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:747
int num
numerator
Definition: rational.h:44
int index
stream index in AVFormatContext
Definition: avformat.h:684
int size
Definition: avcodec.h:974
int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
Interleave a packet per dts in an output media file.
Definition: mux.c:544
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: avformat.h:827
AVFormatInternal * internal
An opaque field for libavformat internal usage.
Definition: avformat.h:1176
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
Definition: avcodec.h:1422
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:55
void * priv_data
Definition: avformat.h:703
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
Put a string representing the codec tag codec_tag in buf.
Definition: utils.c:1715
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
int(* write_packet)(struct AVFormatContext *, AVPacket *pkt)
Write a packet.
Definition: avformat.h:488
int av_dup_packet(AVPacket *pkt)
Definition: avpacket.c:189
#define AVFMT_ALLOW_FLUSH
Format allows flushing.
Definition: avformat.h:416
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
Definition: avcodec.h:1816
#define AVFMT_TS_NONSTRICT
Format does not require strictly increasing timestamps, but they must still be monotonic.
Definition: avformat.h:417
int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux)
Get the number of samples of an audio frame.
Definition: utils.c:593
struct AVPacketList * packet_buffer
This buffer is only needed when packets were already buffered but not decoded, for example to get the...
Definition: avformat.h:1136
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avcodec.h:1173
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:198
Format I/O context.
Definition: avformat.h:871
int64_t cur_dts
Definition: avformat.h:800
internal metadata API header see avformat.h or the public API!
Public dictionary API.
static void frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
f = val + (num / den) + 0.5.
Definition: mux.c:66
int flags
can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, AVFMT_TS_NONSTRICT
Definition: avformat.h:456
AVOptions.
attribute_deprecated void(* destruct)(struct AVPacket *)
Definition: avcodec.h:998
AVPacket pkt
Definition: avformat.h:1180
int priv_data_size
size of private data so that it can be allocated in the wrapper
Definition: avformat.h:478
#define CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
Definition: avcodec.h:684
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_dlog(ac->avr,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:935
#define MAX_REORDER_DELAY
Definition: avformat.h:824
int64_t max_interleave_delta
Maximum buffering duration for interleaving.
Definition: avformat.h:1121
uint32_t tag
Definition: movenc.c:822
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
Definition: avcodec.h:685
static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush)
Interleave an AVPacket correctly so it can be muxed.
Definition: mux.c:617
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: avcodec.h:995
int64_t offset
Offset to remap timestamps to be non-negative.
Definition: avformat.h:1165
struct AVOutputFormat * oformat
The output container format.
Definition: avformat.h:890
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:122
static const uint8_t frame_size[4]
Definition: g723_1_data.h:47
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
Definition: dict.c:173
#define AVFMT_FLAG_FLUSH_PACKETS
Flush the AVIOContext every packet.
Definition: avformat.h:984
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: avcodec.h:105
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
int has_b_frames
Size of the frame reordering buffer in the decoder.
Definition: avcodec.h:1332
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1064
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:1938
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:186
static int validate_codec_tag(AVFormatContext *s, AVStream *st)
Definition: mux.c:104
AVRational offset_timebase
Timebase for the timestamp offset.
Definition: avformat.h:1170
#define AVERROR(e)
Definition: error.h:43
int(* write_header)(struct AVFormatContext *)
Definition: avformat.h:480
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=av_sample_fmt_is_planar(in_fmt);out_planar=av_sample_fmt_is_planar(out_fmt);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_dlog(ac->avr,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:144
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
Definition: dict.c:159
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
Definition: avcodec.h:956
int flags
CODEC_FLAG_*.
Definition: avcodec.h:1142
simple assert() macros that are a bit more flexible than ISO C assert().
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:148
int side_data_elems
Definition: avcodec.h:989
#define FFMAX(a, b)
Definition: common.h:55
The exact value of the fractional number is: 'val + num / den'.
Definition: avformat.h:376
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare 2 timestamps each in its own timebases.
Definition: mathematics.c:127
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:702
static int write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: mux.c:408
common internal API header
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:923
#define LIBAVFORMAT_IDENT
Definition: version.h:44
int void avio_flush(AVIOContext *s)
Definition: aviobuf.c:180
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:110
int width
picture width / height.
Definition: avcodec.h:1217
#define AVFMT_GLOBALHEADER
Format wants global header.
Definition: avformat.h:406
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
Definition: avcodec.h:1182
static int init_muxer(AVFormatContext *s, AVDictionary **options)
Definition: mux.c:138
Opaque data information usually sparse.
Definition: avutil.h:191
const AVClass * priv_class
AVClass for the private context.
Definition: avformat.h:465
Stream structure.
Definition: avformat.h:683
#define AVFMT_NOTIMESTAMPS
Format does not need / have any timestamps.
Definition: avformat.h:407
NULL
Definition: eval.c:55
enum AVMediaType codec_type
Definition: avcodec.h:1062
enum AVCodecID codec_id
Definition: avcodec.h:1065
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:240
int av_opt_set_dict(void *obj, AVDictionary **options)
Definition: opt.c:621
int sample_rate
samples per second
Definition: avcodec.h:1779
AVIOContext * pb
I/O context.
Definition: avformat.h:913
void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st, AVCodecParserContext *pc, AVPacket *pkt)
Return the frame duration in seconds.
Definition: utils.c:614
const struct AVCodecTag *const * codec_tag
List of supported codec_id-codec_tag pairs, ordered by "better choice first".
Definition: avformat.h:462
main external API structure.
Definition: avcodec.h:1054
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:345
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:1080
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:62
int nb_interleaved_streams
Number of streams relevant for interleaving.
Definition: internal.h:50
Describe the class of an AVClass context structure.
Definition: log.h:33
#define FF_COMPLIANCE_NORMAL
Definition: avcodec.h:2330
unsigned int avpriv_toupper4(unsigned int x)
Definition: utils.c:2229
rational number numerator/denominator
Definition: rational.h:43
struct AVPacketList * packet_buffer_end
Definition: avformat.h:1137
int(* interleave_packet)(struct AVFormatContext *, AVPacket *out, AVPacket *in, int flush)
Currently only used to set pixel format if not YUV420P.
Definition: avformat.h:493
misc parsing utilities
int64_t val
Definition: avformat.h:377
int64_t num
Definition: avformat.h:377
unsigned int tag
Definition: internal.h:37
int64_t den
Definition: avformat.h:377
const OptionDef options[]
Definition: avserver.c:4624
Main libavformat public API header.
int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, int(*compare)(AVFormatContext *, AVPacket *, AVPacket *))
Add packet to AVFormatContext->packet_buffer list, determining its interleaved position using compare...
Definition: mux.c:480
void av_opt_free(void *obj)
Free all string and binary options in obj.
Definition: opt.c:613
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:75
common internal api header.
struct AVPacketList * next
Definition: avformat.h:1181
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:400
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
Definition: alsdec.c:1792
#define AVFMT_NOSTREAMS
Format does not require any streams.
Definition: avformat.h:412
static int init_pts(AVFormatContext *s)
Definition: mux.c:271
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
Definition: avpacket.c:46
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:736
int den
denominator
Definition: rational.h:45
static void frac_add(AVFrac *f, int64_t incr)
Fractional addition to f: f = f + (incr / f->den).
Definition: mux.c:84
static int interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
Definition: mux.c:531
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:76
struct AVFrac pts
encoding: pts generation when outputting stream
Definition: avformat.h:708
int channels
number of audio channels
Definition: avcodec.h:1780
void * priv_data
Format private data.
Definition: avformat.h:899
struct AVPacket::@11 * side_data
Additional packet data that can be provided by the container.
#define AVFMT_NODIMENSIONS
Format does not need width/height.
Definition: avformat.h:411
static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
Definition: mux.c:322
int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, AVFormatContext *src)
Write a packet to another muxer than the one the user originally intended.
Definition: mux.c:723
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:972
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
Definition: mux.c:684
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
Definition: eamad.c:77
unbuffered private I/O API
#define FFSWAP(type, a, b)
Definition: common.h:60
int stream_index
Definition: avcodec.h:975
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:719
unsigned int av_codec_get_tag(const struct AVCodecTag *const *tags, enum AVCodecID id)
Get the codec tag for the given codec id id.
#define AVFMT_TS_NEGATIVE
Format allows muxing negative timestamps.
Definition: avformat.h:422
This structure stores compressed data.
Definition: avcodec.h:950
int(* write_trailer)(struct AVFormatContext *)
Definition: avformat.h:489
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:205
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
Definition: avcodec.h:2327
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:966
struct AVPacketList * last_in_packet_buffer
last packet in packet_buffer for this stream when muxing.
Definition: avformat.h:822
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:228