On Sat, 29 Nov 2014, Vittorio Giovara wrote:
--- As suggested by Martin. Vittoriolibavformat/isom.h | 2 ++ libavformat/mov.c | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index 0bc912a..7e60d8c 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 export_all; } MOVContext; int ff_mp4_read_descr_len(AVIOContext *pb); diff --git a/libavformat/mov.c b/libavformat/mov.c index 0f55052..3fe626a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -27,8 +27,6 @@ #include <limits.h> #include <stdint.h> -//#define MOV_EXPORT_ALL_METADATA - #include "libavutil/attributes.h" #include "libavutil/channel_layout.h" #include "libavutil/intreadwrite.h" @@ -37,6 +35,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" @@ -253,9 +252,7 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len) static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) { -#ifdef MOV_EXPORT_ALL_METADATA char tmp_key[5]; -#endif char str[1024], key2[32], language[4] = {0}; const char *key = NULL; uint16_t langcode = 0; @@ -329,12 +326,10 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) } else str_size = atom.size; -#ifdef MOV_EXPORT_ALL_METADATA - if (!key) { + if (c->export_all && !key) { snprintf(tmp_key, 5, "%.4s", (char*)&atom.type); key = tmp_key; } -#endif if (!key) return 0; @@ -3420,9 +3415,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[] = { + { "export_all", "List all metadata found", OFFSET(export_all),
Except the option description sounds a bit weird - insert Anton's comment from the previous round here. It doesn't list anything, it just exports them.
What about "Export unrecognized metadata entries" or something like that? // Martin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
