summaryrefslogtreecommitdiffstats
path: root/sub/osd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-16 20:03:56 +0100
committerwm4 <wm4@nowhere>2015-02-16 20:03:56 +0100
commit4c283d5f8dbfdd220015c9c4d661ec9b5a2ba6f7 (patch)
tree40b8db1c7f464c69f7a25f1120ff126abe58d607 /sub/osd.c
parent31ac0574ad910ee9256ad5d5b89c7a7d3b88761f (diff)
downloadmpv-4c283d5f8dbfdd220015c9c4d661ec9b5a2ba6f7.tar.bz2
mpv-4c283d5f8dbfdd220015c9c4d661ec9b5a2ba6f7.tar.xz
osd: make it possible to have different subtitle vs. OSD defaults
Until now, they used exactly the same defaults for the styling options. The defaults were shared, so it was impossible to have different defaults. Change this. This requires duplicating the full default struct, even for settings that are the same. The list of options is still shared, though.
Diffstat (limited to 'sub/osd.c')
-rw-r--r--sub/osd.c68
1 files changed, 42 insertions, 26 deletions
diff --git a/sub/osd.c b/sub/osd.c
index 1a9e7f5d23..02fbfadbfc 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -41,37 +41,53 @@
#include "video/mp_image.h"
#include "video/mp_image_pool.h"
-static const struct osd_style_opts osd_style_opts_def = {
- .font = "sans-serif",
- .font_size = 55,
- .color = {255, 255, 255, 255},
- .border_color = {0, 0, 0, 255},
- .shadow_color = {240, 240, 240, 128},
- .border_size = 3,
- .shadow_offset = 0,
- .margin_x = 25,
- .margin_y = 22,
+#define OPT_BASE_STRUCT struct osd_style_opts
+static const m_option_t style_opts[] = {
+ OPT_STRING("font", font, 0),
+ OPT_FLOATRANGE("font-size", font_size, 0, 1, 9000),
+ OPT_COLOR("color", color, 0),
+ OPT_COLOR("border-color", border_color, 0),
+ OPT_COLOR("shadow-color", shadow_color, 0),
+ OPT_COLOR("back-color", back_color, 0),
+ OPT_FLOATRANGE("border-size", border_size, 0, 0, 10),
+ OPT_FLOATRANGE("shadow-offset", shadow_offset, 0, 0, 10),
+ OPT_FLOATRANGE("spacing", spacing, 0, -10, 10),
+ OPT_INTRANGE("margin-x", margin_x, 0, 0, 300),
+ OPT_INTRANGE("margin-y", margin_y, 0, 0, 600),
+ OPT_FLOATRANGE("blur", blur, 0, 0, 20),
+ {0}
};
-#define OPT_BASE_STRUCT struct osd_style_opts
const struct m_sub_options osd_style_conf = {
- .opts = (const m_option_t[]) {
- OPT_STRING("font", font, 0),
- OPT_FLOATRANGE("font-size", font_size, 0, 1, 9000),
- OPT_COLOR("color", color, 0),
- OPT_COLOR("border-color", border_color, 0),
- OPT_COLOR("shadow-color", shadow_color, 0),
- OPT_COLOR("back-color", back_color, 0),
- OPT_FLOATRANGE("border-size", border_size, 0, 0, 10),
- OPT_FLOATRANGE("shadow-offset", shadow_offset, 0, 0, 10),
- OPT_FLOATRANGE("spacing", spacing, 0, -10, 10),
- OPT_INTRANGE("margin-x", margin_x, 0, 0, 300),
- OPT_INTRANGE("margin-y", margin_y, 0, 0, 600),
- OPT_FLOATRANGE("blur", blur, 0, 0, 20),
- {0}
+ .opts = style_opts,
+ .size = sizeof(struct osd_style_opts),
+ .defaults = &(const struct osd_style_opts){
+ .font = "sans-serif",
+ .font_size = 55,
+ .color = {255, 255, 255, 255},
+ .border_color = {0, 0, 0, 255},
+ .shadow_color = {240, 240, 240, 128},
+ .border_size = 3,
+ .shadow_offset = 0,
+ .margin_x = 25,
+ .margin_y = 22,
},
+};
+
+const struct m_sub_options sub_style_conf = {
+ .opts = style_opts,
.size = sizeof(struct osd_style_opts),
- .defaults = &osd_style_opts_def,
+ .defaults = &(const struct osd_style_opts){
+ .font = "sans-serif",
+ .font_size = 55,
+ .color = {255, 255, 255, 255},
+ .border_color = {0, 0, 0, 255},
+ .shadow_color = {240, 240, 240, 128},
+ .border_size = 3,
+ .shadow_offset = 0,
+ .margin_x = 25,
+ .margin_y = 22,
+ },
};
static bool osd_res_equals(struct mp_osd_res a, struct mp_osd_res b)