[FFmpeg-devel] [PATCH 1/2] lavf/mov: fix parsing QuickTime meta after the first track
Rodger Combs
rodger.combs at gmail.com
Sat Sep 10 04:06:39 EEST 2016
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 2246fed..6b6f678 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -198,7 +198,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
int trak_index; ///< Index of the current 'trak'
char **meta_keys;
unsigned meta_keys_count;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6e80b93..54530e3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -381,7 +381,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];
@@ -694,12 +694,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->trak_index < 0) { // meta not inside a 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];
@@ -4505,7 +4501,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.10.0
More information about the ffmpeg-devel
mailing list