diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-13 13:35:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-15 20:17:23 +0200 |
commit | 1b54e6b12bcf3090266ea632e52e8f8fe946397b (patch) | |
tree | 0ee53af61d5048ea670979d7e0d6caf17cd11eb8 | |
parent | 8091fe3071db996110c2732f2446701a6d7544bc (diff) | |
download | ffmpeg-1b54e6b12bcf3090266ea632e52e8f8fe946397b.tar.gz |
avformat/mov: auodetect "use_mfra_for"
Reviewed-by: Mika Raento <mikie@iki.fi>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/isom.h | 1 | ||||
-rw-r--r-- | libavformat/mov.c | 29 |
2 files changed, 28 insertions, 2 deletions
diff --git a/libavformat/isom.h b/libavformat/isom.h index 343cdd3717..52da1a3217 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -254,6 +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_AUTO -1 #define FF_MOV_FLAG_MFRA_DTS 1 #define FF_MOV_FLAG_MFRA_PTS 2 diff --git a/libavformat/mov.c b/libavformat/mov.c index 7393cb7c6f..69a61fb993 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3270,6 +3270,28 @@ static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +static int mov_read_free(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ + int ret; + uint8_t content[16]; + + if (atom.size < 8) + return 0; + + ret = avio_read(pb, content, FFMIN(sizeof(content), atom.size)); + if (ret < 0) + return ret; + + if ( !c->found_moov + && !c->found_mdat + && !memcmp(content, "Anevia\x1A\x1A", 8) + && c->use_mfra_for == FF_MOV_FLAG_MFRA_AUTO) { + c->use_mfra_for = FF_MOV_FLAG_MFRA_PTS; + } + + return 0; +} + static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('A','C','L','R'), mov_read_avid }, { MKTAG('A','P','R','G'), mov_read_avid }, @@ -3338,6 +3360,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('h','v','c','C'), mov_read_glbl }, { MKTAG('u','u','i','d'), mov_read_uuid }, { MKTAG('C','i','n', 0x8e), mov_read_targa_y216 }, +{ MKTAG('f','r','e','e'), mov_read_free }, { MKTAG('-','-','-','-'), mov_read_custom }, { 0, NULL } }; @@ -4144,9 +4167,11 @@ static const AVOption options[] = { 0, 1, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM}, {"use_mfra_for", "use mfra for fragment timestamps", - offsetof(MOVContext, use_mfra_for), FF_OPT_TYPE_INT, {.i64 = 0}, - 0, FF_MOV_FLAG_MFRA_PTS, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM, + offsetof(MOVContext, use_mfra_for), FF_OPT_TYPE_INT, {.i64 = FF_MOV_FLAG_MFRA_AUTO}, + -1, FF_MOV_FLAG_MFRA_PTS, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM, "use_mfra_for"}, + {"auto", "auto", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_MFRA_AUTO}, 0, 0, + AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM, "use_mfra_for" }, {"dts", "dts", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_MFRA_DTS}, 0, 0, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM, "use_mfra_for" }, {"pts", "pts", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_MFRA_PTS}, 0, 0, |