Quoting Vittorio Giovara (2014-11-26 16:43:37)
> 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),

I don't really like the name 'show'. The option controls _exporting_
the metadata, whether it will be 'shown' in any sense of that word
depends on the caller.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to