summaryrefslogtreecommitdiff
path: root/libavformat/isom.h
diff options
context:
space:
mode:
authorMika Raento <mikie@iki.fi>2014-10-11 18:43:48 +0300
committerMichael Niedermayer <michaelni@gmx.at>2014-10-13 12:20:55 +0200
commita59808dd57f81d1cfaa76e2624a66825e63324ea (patch)
treeb77abe8d5a992b4fcd40f9c05756e98153d37f9a /libavformat/isom.h
parentb8c50becc8cf9c73e236d3857e0f0faff539a95f (diff)
downloadffmpeg-a59808dd57f81d1cfaa76e2624a66825e63324ea.tar.gz
mov.c: allow reading fragment start dts/pts from fragmented mp4
This introduces a new option to the mov demuxer: -use_mfra_for (pts|dts). When it's given and moofs and a MFRA are present, the MFRA's TFRAs are read for fragment start times. Unfortunately some programs that produce fragmented mp4s use the TFRA time field for dts and some for pts. There is no realistic way to detect which is the case, hence the responsibility is punted onto the user. This also means that no behavioural change is enabled by default - you must pass either dts or pts for anything to happen. Without this change, timestamps for some discontinuous fragmented mp4 are wrong, and cause audio/video desync and are not usable for generating HLS. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/isom.h')
-rw-r--r--libavformat/isom.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 979e967d14..343cdd3717 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -78,6 +78,7 @@ typedef struct MOVFragment {
unsigned duration;
unsigned size;
unsigned flags;
+ int64_t time;
} MOVFragment;
typedef struct MOVTrackExt {
@@ -93,6 +94,18 @@ typedef struct MOVSbgp {
unsigned int index;
} MOVSbgp;
+typedef struct MOVFragmentIndexItem {
+ int64_t moof_offset;
+ int64_t time;
+} MOVFragmentIndexItem;
+
+typedef struct MOVFragmentIndex {
+ unsigned track_id;
+ unsigned item_count;
+ unsigned current_item;
+ MOVFragmentIndexItem *items;
+} MOVFragmentIndex;
+
typedef struct MOVStreamContext {
AVIOContext *pb;
int pb_is_copied;
@@ -171,6 +184,10 @@ typedef struct MOVContext {
int *bitrates; ///< bitrates read before streams creation
int bitrates_count;
int moov_retry;
+ int use_mfra_for;
+ int has_looked_for_mfra;
+ MOVFragmentIndex** fragment_index_data;
+ unsigned fragment_index_count;
} MOVContext;
int ff_mp4_read_descr_len(AVIOContext *pb);
@@ -237,4 +254,7 @@ enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries);
void ff_mov_write_chan(AVIOContext *pb, int64_t channel_layout);
+#define FF_MOV_FLAG_MFRA_DTS 1
+#define FF_MOV_FLAG_MFRA_PTS 2
+
#endif /* AVFORMAT_ISOM_H */