The Extensible Metadata Platform tag can contain various kind of data which are not strictly related to the video file, such as history of edits and saves from the project file. So display XMP metadata only when the user explicitly requires it.
Based on a patch by Marek Fort <[email protected]>. --- libavformat/isom.h | 2 ++ libavformat/mov.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/libavformat/isom.h b/libavformat/isom.h index 0bc912a..be6cc21 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -141,6 +141,7 @@ typedef struct MOVStreamContext { } MOVStreamContext; typedef struct MOVContext { + const AVClass *class; /* Class for private options. */ AVFormatContext *fc; int time_scale; int64_t duration; ///< duration of the longest track @@ -155,6 +156,7 @@ typedef struct MOVContext { int itunes_metadata; ///< metadata are itunes style int chapter_track; int64_t next_root_atom; ///< offset of the next root atom + int show_xmp; } MOVContext; int ff_mp4_read_descr_len(AVIOContext *pb); diff --git a/libavformat/mov.c b/libavformat/mov.c index 34e3def..c34d076 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -37,6 +37,7 @@ #include "libavutil/time_internal.h" #include "libavutil/avstring.h" #include "libavutil/dict.h" +#include "libavutil/opt.h" #include "libavcodec/ac3tab.h" #include "avformat.h" #include "internal.h" @@ -278,6 +279,9 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) return mov_metadata_raw(c, pb, atom.size, "premiere_version"); case MKTAG( '@', 'P', 'R', 'Q'): return mov_metadata_raw(c, pb, atom.size, "quicktime_version"); + case MKTAG( 'X', 'M', 'P', '_'): + if (c->show_xmp) + return mov_metadata_raw(c, pb, atom.size, "xmp"); break; case MKTAG( 'a', 'A', 'R', 'T'): key = "album_artist"; break; case MKTAG( 'c', 'p', 'r', 't'): key = "copyright"; break; case MKTAG( 'd', 'e', 's', 'c'): key = "description"; break; @@ -3435,9 +3439,25 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti return 0; } +#define OFFSET(x) offsetof(MOVContext, x) +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM +static const AVOption mov_options[] = { + { "show_xmp", "List all XMP metadata found", OFFSET(show_xmp), + AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = FLAGS }, + { NULL }, +}; + +static const AVClass mov_class = { + .class_name = "mov,mp4,m4a,3gp,3g2,mj2", + .item_name = av_default_item_name, + .option = mov_options, + .version = LIBAVUTIL_VERSION_INT, +}; + AVInputFormat ff_mov_demuxer = { .name = "mov,mp4,m4a,3gp,3g2,mj2", .long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"), + .priv_class = &mov_class, .priv_data_size = sizeof(MOVContext), .extensions = "mov,mp4,m4a,3gp,3g2,mj2", .read_probe = mov_probe, -- 1.9.3 (Apple Git-50) _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
