Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Barsnick <barsnick@gmx.net>2019-09-12 12:23:04 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2019-09-21 00:26:34 +0300
commitd214f216110f3af9be3b6af2ed5ca285ffe3bda3 (patch)
treea09637b0ed3af1a9433a1477620be3140510ce89
parente6018fda14d7cfe2c890fb336c9264c4ea0b6c5c (diff)
avformat/hashenc: rearrange options definition
Only the frame* muxers support the format_version option. Use macros to ease the proliferation of identical options to coming muxers as well. Signed-off-by: Moritz Barsnick <barsnick@gmx.net> Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/hashenc.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index 06fc085d18..210bfdea0e 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -36,18 +36,37 @@ struct HashContext {
#define OFFSET(x) offsetof(struct HashContext, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM
-#if CONFIG_HASH_MUXER || CONFIG_FRAMEHASH_MUXER
+#define HASH_OPT(defaulttype) \
+ { "hash", "set hash to use", OFFSET(hash_name), AV_OPT_TYPE_STRING, {.str = defaulttype}, 0, 0, ENC }
+#define FORMAT_VERSION_OPT \
+ { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 2}, 1, 2, ENC }
+
+#if CONFIG_HASH_MUXER
static const AVOption hash_options[] = {
- { "hash", "set hash to use", OFFSET(hash_name), AV_OPT_TYPE_STRING, {.str = "sha256"}, 0, 0, ENC },
- { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 2}, 1, 2, ENC },
+ HASH_OPT("sha256"),
+ { NULL },
+};
+#endif
+
+#if CONFIG_FRAMEHASH_MUXER
+static const AVOption framehash_options[] = {
+ HASH_OPT("sha256"),
+ FORMAT_VERSION_OPT,
{ NULL },
};
#endif
-#if CONFIG_MD5_MUXER || CONFIG_FRAMEMD5_MUXER
+#if CONFIG_MD5_MUXER
static const AVOption md5_options[] = {
- { "hash", "set hash to use", OFFSET(hash_name), AV_OPT_TYPE_STRING, {.str = "md5"}, 0, 0, ENC },
- { "format_version", "file format version", OFFSET(format_version), AV_OPT_TYPE_INT, {.i64 = 2}, 1, 2, ENC },
+ HASH_OPT("md5"),
+ { NULL },
+};
+#endif
+
+#if CONFIG_FRAMEMD5_MUXER
+static const AVOption framemd5_options[] = {
+ HASH_OPT("md5"),
+ FORMAT_VERSION_OPT,
{ NULL },
};
#endif
@@ -219,7 +238,7 @@ static int framehash_write_trailer(struct AVFormatContext *s)
static const AVClass framehash_class = {
.class_name = "frame hash muxer",
.item_name = av_default_item_name,
- .option = hash_options,
+ .option = framehash_options,
.version = LIBAVUTIL_VERSION_INT,
};
@@ -242,7 +261,7 @@ AVOutputFormat ff_framehash_muxer = {
static const AVClass framemd5_class = {
.class_name = "frame MD5 muxer",
.item_name = av_default_item_name,
- .option = md5_options,
+ .option = framemd5_options,
.version = LIBAVUTIL_VERSION_INT,
};