[FFmpeg-devel] [PATCH] lavf/mov: fix parsing QuickTime meta after the first track
Rodger Combs
rodger.combs at gmail.com
Tue Nov 10 21:59:58 CET 2015
I'm not entirely sure why found_hdlr_mdta existed to begin with, so cc-ing
Tinglin Liu (who originally wrote the patch) and Derek Buitenhuis (who signed
off on it) hoping for some background. If these checks actually do have a
purpose, then the `type == MKTAG('m','d','t','a')` check should be moved
to before the `c->fc->nb_streams < 1` check instead of inside it.
---
libavformat/isom.h | 1 -
libavformat/mov.c | 10 +++-------
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/libavformat/isom.h b/libavformat/isom.h
index dba30a2..9364f5d 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -177,7 +177,6 @@ typedef struct MOVContext {
int64_t duration; ///< duration of the longest track
int found_moov; ///< 'moov' atom has been found
int found_mdat; ///< 'mdat' atom has been found
- int found_hdlr_mdta; ///< 'hdlr' atom with type 'mdta' has been found
char **meta_keys;
unsigned meta_keys_count;
DVDemuxContext *dv_demux;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 11c8358..8fa0189 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -369,7 +369,7 @@ retry:
av_log(c->fc, AV_LOG_ERROR, "Error parsing cover art.\n");
}
return ret;
- } else if (!key && c->found_hdlr_mdta && c->meta_keys) {
+ } else if (!key && c->meta_keys) {
uint32_t index = AV_RB32(&atom.type);
if (index < c->meta_keys_count) {
key = c->meta_keys[index];
@@ -628,12 +628,8 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_log(c->fc, AV_LOG_TRACE, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype);
av_log(c->fc, AV_LOG_TRACE, "stype= %.4s\n", (char*)&type);
- if (c->fc->nb_streams < 1) { // meta before first trak
- if (type == MKTAG('m','d','t','a')) {
- c->found_hdlr_mdta = 1;
- }
+ if (c->fc->nb_streams < 1) // meta before first trak
return 0;
- }
st = c->fc->streams[c->fc->nb_streams-1];
@@ -4145,7 +4141,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
// Supports parsing the QuickTime Metadata Keys.
// https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/Metadata/Metadata.html
- if (!parse && c->found_hdlr_mdta &&
+ if (!parse &&
atom.type == MKTAG('m','e','t','a') &&
a.type == MKTAG('k','e','y','s')) {
parse = mov_read_keys;
--
2.6.2
More information about the ffmpeg-devel
mailing list