summaryrefslogtreecommitdiff
path: root/libavcodec/internal.h
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2018-12-02 21:36:24 +0100
committerMartin Vignali <martin.vignali@gmail.com>2018-12-04 15:17:21 +0100
commite53901ba5ec3284b8d5882df47cbd8d888279220 (patch)
treeed13959abca4c509f2dd8f7b9767f772c077bea4 /libavcodec/internal.h
parentaae7e009b3a91031c4f71141450431384f4b0380 (diff)
avcodec/utils : add ff_int_from_list_or_default func
to check valid value, or return default_value
Diffstat (limited to 'libavcodec/internal.h')
-rw-r--r--libavcodec/internal.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 0c2133f092..f2e6f00ace 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -404,6 +404,18 @@ int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len,
*/
int64_t ff_guess_coded_bitrate(AVCodecContext *avctx);
+/**
+ * Check if a value is in the list. If not, return the default value
+ *
+ * @param ctx Context for the log msg
+ * @param val_name Name of the checked value, for log msg
+ * @param array_valid_values Array of valid int, ended with INT_MAX
+ * @param default_value Value return if checked value is not in the array
+ * @return Value or default_value.
+ */
+int ff_int_from_list_or_default(void *ctx, const char * val_name, int val,
+ const int * array_valid_values, int default_value);
+
#if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avcodec)
# define av_export_avcodec __declspec(dllimport)
#else