summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-22 21:00:24 +0200
committerwm4 <wm4@nowhere>2015-05-22 21:00:24 +0200
commitae46833836453b7fc64f2cff9cb69d6cfd73f947 (patch)
treeb7ecb83b01279fc427348025f158d9fa14d7bd25 /options
parenta7c831f36d17fae13ef441a8f56281557cccd401 (diff)
downloadmpv-ae46833836453b7fc64f2cff9cb69d6cfd73f947.tar.bz2
mpv-ae46833836453b7fc64f2cff9cb69d6cfd73f947.tar.xz
player: use an array for stream ID options and such
This makes the code slightly more generic.
Diffstat (limited to 'options')
-rw-r--r--options/options.c40
-rw-r--r--options/options.h13
2 files changed, 25 insertions, 28 deletions
diff --git a/options/options.c b/options/options.c
index 44d4beae30..b2bd5c2e95 100644
--- a/options/options.c
+++ b/options/options.c
@@ -194,18 +194,18 @@ const m_option_t mp_opts[] = {
OPT_CHOICE("index", index_mode, 0, ({"default", 1}, {"recreate", 0})),
// select audio/video/subtitle stream
- OPT_TRACKCHOICE("aid", audio_id),
- OPT_TRACKCHOICE("vid", video_id),
- OPT_TRACKCHOICE("sid", sub_id),
- OPT_TRACKCHOICE("secondary-sid", sub2_id),
- OPT_TRACKCHOICE("ff-aid", audio_id_ff),
- OPT_TRACKCHOICE("ff-vid", video_id_ff),
- OPT_TRACKCHOICE("ff-sid", sub_id_ff),
- OPT_FLAG_STORE("no-sub", sub_id, 0, -2),
- OPT_FLAG_STORE("no-video", video_id, 0, -2),
- OPT_FLAG_STORE("no-audio", audio_id, 0, -2),
- OPT_STRINGLIST("alang", audio_lang, 0),
- OPT_STRINGLIST("slang", sub_lang, 0),
+ OPT_TRACKCHOICE("aid", stream_id[0][STREAM_AUDIO]),
+ OPT_TRACKCHOICE("vid", stream_id[0][STREAM_VIDEO]),
+ OPT_TRACKCHOICE("sid", stream_id[0][STREAM_SUB]),
+ OPT_TRACKCHOICE("secondary-sid", stream_id[1][STREAM_SUB]),
+ OPT_TRACKCHOICE("ff-aid", stream_id_ff[STREAM_AUDIO]),
+ OPT_TRACKCHOICE("ff-vid", stream_id_ff[STREAM_VIDEO]),
+ OPT_TRACKCHOICE("ff-sid", stream_id_ff[STREAM_SUB]),
+ OPT_FLAG_STORE("no-sub", stream_id[0][STREAM_SUB], 0, -2),
+ OPT_FLAG_STORE("no-video", stream_id[0][STREAM_VIDEO], 0, -2),
+ OPT_FLAG_STORE("no-audio", stream_id[0][STREAM_AUDIO], 0, -2),
+ OPT_STRINGLIST("alang", stream_lang[STREAM_AUDIO], 0),
+ OPT_STRINGLIST("slang", stream_lang[STREAM_SUB], 0),
OPT_CHOICE("audio-display", audio_display, 0,
({"no", 0}, {"attachment", 1})),
@@ -730,13 +730,15 @@ const struct MPOpts mp_default_opts = {
.consolecontrols = 1,
.play_frames = -1,
.keep_open = 0,
- .audio_id = -1,
- .video_id = -1,
- .sub_id = -1,
- .audio_id_ff = -1,
- .video_id_ff = -1,
- .sub_id_ff = -1,
- .sub2_id = -2,
+ .stream_id = { { [STREAM_AUDIO] = -1,
+ [STREAM_VIDEO] = -1,
+ [STREAM_SUB] = -1, },
+ { [STREAM_AUDIO] = -2,
+ [STREAM_VIDEO] = -2,
+ [STREAM_SUB] = -2, }, },
+ .stream_id_ff = { [STREAM_AUDIO] = -1,
+ [STREAM_VIDEO] = -1,
+ [STREAM_SUB] = -1, },
.audio_display = 1,
.sub_visibility = 1,
.sub_pos = 100,
diff --git a/options/options.h b/options/options.h
index 374649888e..208431110e 100644
--- a/options/options.h
+++ b/options/options.h
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "m_option.h"
+#include "common/common.h"
typedef struct mp_vo_opts {
struct m_obj_settings *video_driver_list, *vo_defs;
@@ -170,15 +171,9 @@ typedef struct MPOpts {
int ignore_path_in_watch_later_config;
int pause;
int keep_open;
- int audio_id;
- int video_id;
- int sub_id;
- int sub2_id;
- int audio_id_ff;
- int video_id_ff;
- int sub_id_ff;
- char **audio_lang;
- char **sub_lang;
+ int stream_id[2][STREAM_TYPE_COUNT];
+ int stream_id_ff[STREAM_TYPE_COUNT];
+ char **stream_lang[STREAM_TYPE_COUNT];
int audio_display;
char **display_tags;
int sub_visibility;