From 11f5713e3bbeea8449a97ecb979936e02660321e Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 24 Jan 2018 01:32:56 +0100 Subject: options: add an option type for byte sizes And use it for 2 demuxer options. It could be used for more options later. (Though the --cache options can not use this, because they use KB as base unit.) --- options/m_option.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'options/m_option.h') diff --git a/options/m_option.h b/options/m_option.h index 405b59da0a..8c8ae855d1 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -41,6 +41,7 @@ extern const m_option_type_t m_option_type_flag; extern const m_option_type_t m_option_type_dummy_flag; extern const m_option_type_t m_option_type_int; extern const m_option_type_t m_option_type_int64; +extern const m_option_type_t m_option_type_byte_size; extern const m_option_type_t m_option_type_intpair; extern const m_option_type_t m_option_type_float; extern const m_option_type_t m_option_type_double; @@ -371,6 +372,7 @@ struct m_option { const char *deprecation_message; }; +char *format_file_size(int64_t size); // The option has a minimum set in \ref m_option::min. #define M_OPT_MIN (1 << 0) @@ -670,6 +672,9 @@ extern const char m_option_path_separator; #define OPT_COLOR(...) \ OPT_GENERAL(struct m_color, __VA_ARGS__, .type = &m_option_type_color) +#define OPT_BYTE_SIZE(...) \ + OPT_RANGE_(int64_t, __VA_ARGS__, .type = &m_option_type_byte_size) + #define OPT_GEOMETRY(...) \ OPT_GENERAL(struct m_geometry, __VA_ARGS__, .type = &m_option_type_geometry) -- cgit v1.2.3