avformat/mov: add option to use tfdt for fragment timestamps.

pull/362/head
Gyan Doshi 4 years ago
parent 127c40c9ca
commit 071930de72
  1. 6
      doc/demuxers.texi
  2. 1
      libavformat/isom.h
  3. 4
      libavformat/mov.c

@ -665,6 +665,12 @@ Set mfra timestamps as PTS
Don't use mfra box to set timestamps Don't use mfra box to set timestamps
@end table @end table
@item use_tfdt
For fragmented input, set fragment's starting timestamp to @code{baseMediaDecodeTime} from the @code{tfdt} box.
Default is disabled, which will preferentially use the @code{earliest_presentation_time} from the @code{sidx} box.
In either case, the timestamp from the @code{mfra} box will be used if it's available and @code{use_mfra_for} is
set to pts or dts.
@item export_all @item export_all
Export unrecognized boxes within the @var{udta} box as metadata entries. The first four Export unrecognized boxes within the @var{udta} box as metadata entries. The first four
characters of the box type are set as the key. Default is false. characters of the box type are set as the key. Default is false.

@ -277,6 +277,7 @@ typedef struct MOVContext {
int moov_retry; int moov_retry;
int use_mfra_for; int use_mfra_for;
int has_looked_for_mfra; int has_looked_for_mfra;
int use_tfdt;
MOVFragmentIndex frag_index; MOVFragmentIndex frag_index;
int atom_depth; int atom_depth;
unsigned int aax_mode; ///< 'aax' file has been detected unsigned int aax_mode; ///< 'aax' file has been detected

@ -4803,7 +4803,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
dts = frag_stream_info->first_tfra_pts; dts = frag_stream_info->first_tfra_pts;
av_log(c->fc, AV_LOG_DEBUG, "found mfra time %"PRId64 av_log(c->fc, AV_LOG_DEBUG, "found mfra time %"PRId64
", using it for dts\n", pts); ", using it for dts\n", pts);
} else if (frag_stream_info->sidx_pts != AV_NOPTS_VALUE) { } else if (frag_stream_info->sidx_pts != AV_NOPTS_VALUE && !c->use_tfdt) {
// FIXME: sidx earliest_presentation_time is *PTS*, s.b. // FIXME: sidx earliest_presentation_time is *PTS*, s.b.
// pts = frag_stream_info->sidx_pts; // pts = frag_stream_info->sidx_pts;
dts = frag_stream_info->sidx_pts - sc->time_offset; dts = frag_stream_info->sidx_pts - sc->time_offset;
@ -8169,6 +8169,8 @@ static const AVOption mov_options[] = {
FLAGS, "use_mfra_for" }, FLAGS, "use_mfra_for" },
{"pts", "pts", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_MFRA_PTS}, 0, 0, {"pts", "pts", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_MFRA_PTS}, 0, 0,
FLAGS, "use_mfra_for" }, FLAGS, "use_mfra_for" },
{"use_tfdt", "use tfdt for fragment timestamps", OFFSET(use_tfdt), AV_OPT_TYPE_BOOL, {.i64 = 0},
0, 1, FLAGS},
{ "export_all", "Export unrecognized metadata entries", OFFSET(export_all), { "export_all", "Export unrecognized metadata entries", OFFSET(export_all),
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = FLAGS }, AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = FLAGS },
{ "export_xmp", "Export full XMP metadata", OFFSET(export_xmp), { "export_xmp", "Export full XMP metadata", OFFSET(export_xmp),

Loading…
Cancel
Save