asf: do not export XMP metadata by default

Similarly to what has been done for MOV, display XMP metadata only when
users explicitly require it.

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.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This commit is contained in:
Vittorio Giovara 2015-03-02 18:04:03 +00:00
parent 994d8f3095
commit 0af3b65880
2 changed files with 8 additions and 2 deletions

View File

@ -80,10 +80,12 @@ typedef struct ASFContext {
ASFStream *asf_st; ///< currently decoded stream ASFStream *asf_st; ///< currently decoded stream
int no_resync_search; int no_resync_search;
int export_xmp;
} ASFContext; } ASFContext;
static const AVOption options[] = { static const AVOption options[] = {
{ "no_resync_search", "Don't try to resynchronize by looking for a certain optional start code", offsetof(ASFContext, no_resync_search), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { "no_resync_search", "Don't try to resynchronize by looking for a certain optional start code", offsetof(ASFContext, no_resync_search), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ "export_xmp", "Export full XMP metadata", offsetof(ASFContext, export_xmp), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ NULL }, { NULL },
}; };
@ -281,12 +283,16 @@ static void get_id3_tag(AVFormatContext *s, int len)
static void get_tag(AVFormatContext *s, const char *key, int type, int len, int type2_size) static void get_tag(AVFormatContext *s, const char *key, int type, int len, int type2_size)
{ {
char *value; ASFContext *asf = s->priv_data;
char *value = NULL;
int64_t off = avio_tell(s->pb); int64_t off = avio_tell(s->pb);
if ((unsigned)len >= (UINT_MAX - 1) / 2) if ((unsigned)len >= (UINT_MAX - 1) / 2)
return; return;
if (!asf->export_xmp && !strncmp(key, "xmp", 3))
goto finish;
value = av_malloc(2 * len + 1); value = av_malloc(2 * len + 1);
if (!value) if (!value)
goto finish; goto finish;

View File

@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 56 #define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 16 #define LIBAVFORMAT_VERSION_MINOR 16
#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_MICRO 1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \ LIBAVFORMAT_VERSION_MINOR, \