summaryrefslogtreecommitdiff
path: root/libavutil/opt.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-25 17:10:09 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-08 01:34:28 +0100
commita8e0d51bb8141bbe64d4e22aec72742199208192 (patch)
treec595a019f9cd97d7b978b86cf18bc19649be26f6 /libavutil/opt.h
parent419ade4b6193c6eb626cda01b21e7091f42b2cc2 (diff)
opt: Add support to query ranges
Reviewed-by: Stefano Sabatini <stefasab@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/opt.h')
-rw-r--r--libavutil/opt.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h
index bf84a9bc57..baf1b8233f 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -293,6 +293,25 @@ typedef struct AVOption {
const char *unit;
} AVOption;
+/**
+ * A single allowed range of values, or a single allowed value.
+ */
+typedef struct AVOptionRange {
+ const char *str;
+ double value_min, value_max; ///< For string ranges this represents the min/max length, for dimensions this represents the min/max pixel count
+ double component_min, component_max; ///< For string this represents the unicode range for chars, 0-127 limits to ASCII
+ int is_range; ///< if set to 1 the struct encodes a range, if set to 0 a single value
+} AVOptionRange;
+
+/**
+ * List of AVOptionRange structs
+ */
+typedef struct AVOptionRanges {
+ AVOptionRange **range;
+ int nb_ranges;
+} AVOptionRanges;
+
+
#if FF_API_FIND_OPT
/**
* Look for an option in obj. Look only for the options which
@@ -672,6 +691,41 @@ int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AV
* or written to.
*/
void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name);
+
+/**
+ * Free an AVOptionRanges struct and set it to NULL.
+ */
+void av_opt_freep_ranges(AVOptionRanges **ranges);
+
+/**
+ * Get a list of allowed ranges for the given option.
+ *
+ * The returned list may depend on other fields in obj like for example profile.
+ *
+ * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
+ * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
+ *
+ * The result must be freed with av_opt_freep_ranges.
+ *
+ * @return >= 0 on success, a negative errro code otherwise
+ */
+int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags);
+
+/**
+ * Get a default list of allowed ranges for the given option.
+ *
+ * This list is constructed without using the AVClass.query_ranges() callback
+ * and can be used as fallback from within the callback.
+ *
+ * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored
+ * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance
+ *
+ * The result must be freed with av_opt_free_ranges.
+ *
+ * @return >= 0 on success, a negative errro code otherwise
+ */
+int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags);
+
/**
* @}
*/