summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
Diffstat (limited to 'demux')
-rw-r--r--demux/cache.c7
-rw-r--r--demux/demux.c57
-rw-r--r--demux/demux_cue.c2
-rw-r--r--demux/demux_lavf.c47
-rw-r--r--demux/demux_libarchive.c2
-rw-r--r--demux/demux_mkv.c18
-rw-r--r--demux/demux_raw.c56
7 files changed, 96 insertions, 93 deletions
diff --git a/demux/cache.c b/demux/cache.c
index 4404c870de..f48598807c 100644
--- a/demux/cache.c
+++ b/demux/cache.c
@@ -40,9 +40,10 @@ struct demux_cache_opts {
const struct m_sub_options demux_cache_conf = {
.opts = (const struct m_option[]){
- OPT_STRING("cache-dir", cache_dir, M_OPT_FILE),
- OPT_CHOICE("cache-unlink-files", unlink_files, 0,
- ({"immediate", 2}, {"whendone", 1}, {"no", 0})),
+ {"cache-dir", OPT_STRING(cache_dir), .flags = M_OPT_FILE},
+ {"cache-unlink-files", OPT_CHOICE(unlink_files,
+ {"immediate", 2}, {"whendone", 1}, {"no", 0}),
+ },
{0}
},
.size = sizeof(struct demux_cache_opts),
diff --git a/demux/demux.c b/demux/demux.c
index 82641cb6af..f5ced47887 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -112,35 +112,38 @@ static bool get_demux_sub_opts(int index, const struct m_sub_options **sub);
const struct m_sub_options demux_conf = {
.opts = (const struct m_option[]){
- OPT_CHOICE("cache", enable_cache, 0,
- ({"no", 0}, {"auto", -1}, {"yes", 1})),
- OPT_FLAG("cache-on-disk", disk_cache, 0),
- OPT_DOUBLE("demuxer-readahead-secs", min_secs, 0,
- .min = 0, .max = DBL_MAX),
+ {"cache", OPT_CHOICE(enable_cache,
+ {"no", 0}, {"auto", -1}, {"yes", 1})},
+ {"cache-on-disk", OPT_FLAG(disk_cache)},
+ {"demuxer-readahead-secs", OPT_DOUBLE(min_secs), M_RANGE(0, DBL_MAX)},
// (The MAX_BYTES sizes may not be accurate because the max field is
// of double type.)
- OPT_BYTE_SIZE("demuxer-max-bytes", max_bytes, 0, 0, MAX_BYTES),
- OPT_BYTE_SIZE("demuxer-max-back-bytes", max_bytes_bw, 0, 0, MAX_BYTES),
- OPT_FLAG("demuxer-donate-buffer", donate_fw, 0),
- OPT_FLAG("force-seekable", force_seekable, 0),
- OPT_DOUBLE("cache-secs", min_secs_cache, 0, .min = 0, .max = DBL_MAX,
- .deprecation_message = "will use unlimited time"),
- OPT_FLAG("access-references", access_references, 0),
- OPT_CHOICE("demuxer-seekable-cache", seekable_cache, 0,
- ({"auto", -1}, {"no", 0}, {"yes", 1})),
- OPT_FLAG("sub-create-cc-track", create_ccs, 0),
- OPT_STRING("stream-record", record_file, 0),
- OPT_CHOICE_OR_INT("video-backward-overlap", video_back_preroll, 0, 0,
- 1024, ({"auto", -1})),
- OPT_CHOICE_OR_INT("audio-backward-overlap", audio_back_preroll, 0, 0,
- 1024, ({"auto", -1})),
- OPT_INTRANGE("video-backward-batch", back_batch[STREAM_VIDEO], 0, 0, 1024),
- OPT_INTRANGE("audio-backward-batch", back_batch[STREAM_AUDIO], 0, 0, 1024),
- OPT_DOUBLE("demuxer-backward-playback-step", back_seek_size, 0,
- .min = 0, .max = DBL_MAX),
- OPT_STRING("metadata-codepage", meta_cp, 0),
- OPT_FLAG("demuxer-force-retry-on-eof", force_retry_eof, 0,
- .deprecation_message = "temporary debug option, no replacement"),
+ {"demuxer-max-bytes", OPT_BYTE_SIZE(max_bytes),
+ M_RANGE(0, MAX_BYTES)},
+ {"demuxer-max-back-bytes", OPT_BYTE_SIZE(max_bytes_bw),
+ M_RANGE(0, MAX_BYTES)},
+ {"demuxer-donate-buffer", OPT_FLAG(donate_fw)},
+ {"force-seekable", OPT_FLAG(force_seekable)},
+ {"cache-secs", OPT_DOUBLE(min_secs_cache), M_RANGE(0, DBL_MAX),
+ .deprecation_message = "will use unlimited time"},
+ {"access-references", OPT_FLAG(access_references)},
+ {"demuxer-seekable-cache", OPT_CHOICE(seekable_cache,
+ {"auto", -1}, {"no", 0}, {"yes", 1})},
+ {"sub-create-cc-track", OPT_FLAG(create_ccs)},
+ {"stream-record", OPT_STRING(record_file)},
+ {"video-backward-overlap", OPT_CHOICE(video_back_preroll, {"auto", -1}),
+ M_RANGE(0, 1024)},
+ {"audio-backward-overlap", OPT_CHOICE(audio_back_preroll, {"auto", -1}),
+ M_RANGE(0, 1024)},
+ {"video-backward-batch", OPT_INT(back_batch[STREAM_VIDEO]),
+ M_RANGE(0, 1024)},
+ {"audio-backward-batch", OPT_INT(back_batch[STREAM_AUDIO]),
+ M_RANGE(0, 1024)},
+ {"demuxer-backward-playback-step", OPT_DOUBLE(back_seek_size),
+ M_RANGE(0, DBL_MAX)},
+ {"metadata-codepage", OPT_STRING(meta_cp)},
+ {"demuxer-force-retry-on-eof", OPT_FLAG(force_retry_eof),
+ .deprecation_message = "temporary debug option, no replacement"},
{0}
},
.size = sizeof(struct demux_opts),
diff --git a/demux/demux_cue.c b/demux/demux_cue.c
index edd1a97d1b..b7b425af03 100644
--- a/demux/demux_cue.c
+++ b/demux/demux_cue.c
@@ -49,7 +49,7 @@ struct demux_cue_opts {
const struct m_sub_options demux_cue_conf = {
.opts = (const m_option_t[]) {
- OPT_STRING("codepage", cue_cp, 0),
+ {"codepage", OPT_STRING(cue_cp)},
{0}
},
.size = sizeof(struct demux_cue_opts),
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 212f954090..50b9e044e4 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -84,30 +84,29 @@ struct demux_lavf_opts {
const struct m_sub_options demux_lavf_conf = {
.opts = (const m_option_t[]) {
- OPT_INTRANGE("demuxer-lavf-probesize", probesize, 0, 32, INT_MAX),
- OPT_CHOICE("demuxer-lavf-probe-info", probeinfo, 0,
- ({"no", 0}, {"yes", 1}, {"auto", -1}, {"nostreams", -2})),
- OPT_STRING("demuxer-lavf-format", format, 0),
- OPT_FLOATRANGE("demuxer-lavf-analyzeduration", analyzeduration, 0,
- 0, 3600),
- OPT_INTRANGE("demuxer-lavf-buffersize", buffersize, 0, 1,
- 10 * 1024 * 1024, OPTDEF_INT(BIO_BUFFER_SIZE)),
- OPT_FLAG("demuxer-lavf-allow-mimetype", allow_mimetype, 0),
- OPT_INTRANGE("demuxer-lavf-probescore", probescore, 0,
- 1, AVPROBE_SCORE_MAX),
- OPT_FLAG("demuxer-lavf-hacks", hacks, 0),
- OPT_KEYVALUELIST("demuxer-lavf-o", avopts, 0),
- OPT_STRING("sub-codepage", sub_cp, 0),
- OPT_CHOICE("rtsp-transport", rtsp_transport, 0,
- ({"lavf", 0},
- {"udp", 1},
- {"tcp", 2},
- {"http", 3},
- {"udp_multicast", 4}
- )),
- OPT_CHOICE("demuxer-lavf-linearize-timestamps", linearize_ts, 0,
- ({"no", 0}, {"auto", -1}, {"yes", 1})),
- OPT_FLAG("demuxer-lavf-propagate-opts", propagate_opts, 0),
+ {"demuxer-lavf-probesize", OPT_INT(probesize), M_RANGE(32, INT_MAX)},
+ {"demuxer-lavf-probe-info", OPT_CHOICE(probeinfo,
+ {"no", 0}, {"yes", 1}, {"auto", -1}, {"nostreams", -2})},
+ {"demuxer-lavf-format", OPT_STRING(format)},
+ {"demuxer-lavf-analyzeduration", OPT_FLOAT(analyzeduration),
+ M_RANGE(0, 3600)},
+ {"demuxer-lavf-buffersize", OPT_INT(buffersize),
+ M_RANGE(1, 10 * 1024 * 1024), OPTDEF_INT(BIO_BUFFER_SIZE)},
+ {"demuxer-lavf-allow-mimetype", OPT_FLAG(allow_mimetype)},
+ {"demuxer-lavf-probescore", OPT_INT(probescore),
+ M_RANGE(1, AVPROBE_SCORE_MAX)},
+ {"demuxer-lavf-hacks", OPT_FLAG(hacks)},
+ {"demuxer-lavf-o", OPT_KEYVALUELIST(avopts)},
+ {"sub-codepage", OPT_STRING(sub_cp)},
+ {"rtsp-transport", OPT_CHOICE(rtsp_transport,
+ {"lavf", 0},
+ {"udp", 1},
+ {"tcp", 2},
+ {"http", 3},
+ {"udp_multicast", 4})},
+ {"demuxer-lavf-linearize-timestamps", OPT_CHOICE(linearize_ts,
+ {"no", 0}, {"auto", -1}, {"yes", 1})},
+ {"demuxer-lavf-propagate-opts", OPT_FLAG(propagate_opts)},
{0}
},
.size = sizeof(struct demux_lavf_opts),
diff --git a/demux/demux_libarchive.c b/demux/demux_libarchive.c
index 4be5193b22..dc8d201b19 100644
--- a/demux/demux_libarchive.c
+++ b/demux/demux_libarchive.c
@@ -112,7 +112,7 @@ const struct demuxer_desc demuxer_desc_libarchive = {
.open = open_file,
.options = &(const struct m_sub_options){
.opts = (const struct m_option[]) {
- OPT_FLAG("rar-list-all-volumes", rar_list_all_volumes, 0),
+ {"rar-list-all-volumes", OPT_FLAG(rar_list_all_volumes)},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index f16f537bd3..64cab29c03 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -229,15 +229,15 @@ struct demux_mkv_opts {
const struct m_sub_options demux_mkv_conf = {
.opts = (const m_option_t[]) {
- OPT_CHOICE("subtitle-preroll", subtitle_preroll, 0,
- ({"no", 0}, {"yes", 1}, {"index", 2})),
- OPT_DOUBLE("subtitle-preroll-secs", subtitle_preroll_secs, 0,
- .min = 0, .max = DBL_MAX),
- OPT_DOUBLE("subtitle-preroll-secs-index", subtitle_preroll_secs_index, 0,
- .min = 0, .max = DBL_MAX),
- OPT_CHOICE("probe-video-duration", probe_duration, 0,
- ({"no", 0}, {"yes", 1}, {"full", 2})),
- OPT_FLAG("probe-start-time", probe_start_time, 0),
+ {"subtitle-preroll", OPT_CHOICE(subtitle_preroll,
+ {"no", 0}, {"yes", 1}, {"index", 2})},
+ {"subtitle-preroll-secs", OPT_DOUBLE(subtitle_preroll_secs),
+ M_RANGE(0, DBL_MAX)},
+ {"subtitle-preroll-secs-index", OPT_DOUBLE(subtitle_preroll_secs_index),
+ M_RANGE(0, DBL_MAX)},
+ {"probe-video-duration", OPT_CHOICE(probe_duration,
+ {"no", 0}, {"yes", 1}, {"full", 2})},
+ {"probe-start-time", OPT_FLAG(probe_start_time)},
{0}
},
.size = sizeof(struct demux_mkv_opts),
diff --git a/demux/demux_raw.c b/demux/demux_raw.c
index de657feb8c..e606a24c9f 100644
--- a/demux/demux_raw.c
+++ b/demux/demux_raw.c
@@ -54,27 +54,27 @@ struct demux_rawaudio_opts {
#define OPT_BASE_STRUCT struct demux_rawaudio_opts
const struct m_sub_options demux_rawaudio_conf = {
.opts = (const m_option_t[]) {
- OPT_CHANNELS("channels", channels, 0, .min = 1),
- OPT_INTRANGE("rate", samplerate, 0, 1000, 8 * 48000),
- OPT_CHOICE("format", aformat, 0,
- ({"u8", PCM(0, 0, 8, 0)},
- {"s8", PCM(1, 0, 8, 0)},
- {"u16le", PCM(0, 0, 16, 0)}, {"u16be", PCM(0, 0, 16, 1)},
- {"s16le", PCM(1, 0, 16, 0)}, {"s16be", PCM(1, 0, 16, 1)},
- {"u24le", PCM(0, 0, 24, 0)}, {"u24be", PCM(0, 0, 24, 1)},
- {"s24le", PCM(1, 0, 24, 0)}, {"s24be", PCM(1, 0, 24, 1)},
- {"u32le", PCM(0, 0, 32, 0)}, {"u32be", PCM(0, 0, 32, 1)},
- {"s32le", PCM(1, 0, 32, 0)}, {"s32be", PCM(1, 0, 32, 1)},
- {"floatle", PCM(0, 1, 32, 0)}, {"floatbe", PCM(0, 1, 32, 1)},
- {"doublele",PCM(0, 1, 64, 0)}, {"doublebe", PCM(0, 1, 64, 1)},
- {"u16", PCM(0, 0, 16, NE)},
- {"s16", PCM(1, 0, 16, NE)},
- {"u24", PCM(0, 0, 24, NE)},
- {"s24", PCM(1, 0, 24, NE)},
- {"u32", PCM(0, 0, 32, NE)},
- {"s32", PCM(1, 0, 32, NE)},
- {"float", PCM(0, 1, 32, NE)},
- {"double", PCM(0, 1, 64, NE)})),
+ {"channels", OPT_CHANNELS(channels), .min = 1},
+ {"rate", OPT_INT(samplerate), M_RANGE(1000, 8 * 48000)},
+ {"format", OPT_CHOICE(aformat,
+ {"u8", PCM(0, 0, 8, 0)},
+ {"s8", PCM(1, 0, 8, 0)},
+ {"u16le", PCM(0, 0, 16, 0)}, {"u16be", PCM(0, 0, 16, 1)},
+ {"s16le", PCM(1, 0, 16, 0)}, {"s16be", PCM(1, 0, 16, 1)},
+ {"u24le", PCM(0, 0, 24, 0)}, {"u24be", PCM(0, 0, 24, 1)},
+ {"s24le", PCM(1, 0, 24, 0)}, {"s24be", PCM(1, 0, 24, 1)},
+ {"u32le", PCM(0, 0, 32, 0)}, {"u32be", PCM(0, 0, 32, 1)},
+ {"s32le", PCM(1, 0, 32, 0)}, {"s32be", PCM(1, 0, 32, 1)},
+ {"floatle", PCM(0, 1, 32, 0)}, {"floatbe", PCM(0, 1, 32, 1)},
+ {"doublele",PCM(0, 1, 64, 0)}, {"doublebe", PCM(0, 1, 64, 1)},
+ {"u16", PCM(0, 0, 16, NE)},
+ {"s16", PCM(1, 0, 16, NE)},
+ {"u24", PCM(0, 0, 24, NE)},
+ {"s24", PCM(1, 0, 24, NE)},
+ {"u32", PCM(0, 0, 32, NE)},
+ {"s32", PCM(1, 0, 32, NE)},
+ {"float", PCM(0, 1, 32, NE)},
+ {"double", PCM(0, 1, 64, NE)})},
{0}
},
.size = sizeof(struct demux_rawaudio_opts),
@@ -107,13 +107,13 @@ struct demux_rawvideo_opts {
#define OPT_BASE_STRUCT struct demux_rawvideo_opts
const struct m_sub_options demux_rawvideo_conf = {
.opts = (const m_option_t[]) {
- OPT_INTRANGE("w", width, 0, 1, 8192),
- OPT_INTRANGE("h", height, 0, 1, 8192),
- OPT_GENERAL(int, "format", vformat, 0, .type = &m_option_type_fourcc),
- OPT_IMAGEFORMAT("mp-format", mp_format, 0),
- OPT_STRING("codec", codec, 0),
- OPT_FLOATRANGE("fps", fps, 0, 0.001, 1000),
- OPT_INTRANGE("size", imgsize, 0, 1, 8192 * 8192 * 4),
+ {"w", OPT_INT(width), M_RANGE(1, 8192)},
+ {"h", OPT_INT(height), M_RANGE(1, 8192)},
+ {"format", OPT_FOURCC(vformat)},
+ {"mp-format", OPT_IMAGEFORMAT(mp_format)},
+ {"codec", OPT_STRING(codec)},
+ {"fps", OPT_FLOAT(fps), M_RANGE(0.001, 1000)},
+ {"size", OPT_INT(imgsize), M_RANGE(1, 8192 * 8192 * 4)},
{0}
},
.size = sizeof(struct demux_rawvideo_opts),