diff options
-rw-r--r-- | options/options.c | 2 | ||||
-rw-r--r-- | sub/osd.c | 68 | ||||
-rw-r--r-- | sub/osd.h | 1 |
3 files changed, 44 insertions, 27 deletions
diff --git a/options/options.c b/options/options.c index a0674b6185..bba1f28a00 100644 --- a/options/options.c +++ b/options/options.c @@ -360,7 +360,7 @@ const m_option_t mp_opts[] = { OPT_FLOATRANGE("osd-bar-h", osd_bar_h, 0, 0.1, 50), OPT_SUBSTRUCT("osd", osd_style, osd_style_conf, 0), OPT_FLAG("use-text-osd", use_text_osd, CONF_GLOBAL), - OPT_SUBSTRUCT("sub-text", sub_text_style, osd_style_conf, 0), + OPT_SUBSTRUCT("sub-text", sub_text_style, sub_style_conf, 0), OPT_FLAG("sub-clear-on-seek", sub_clear_on_seek, 0), //---------------------- libao/libvo options ------------------------ @@ -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) @@ -137,6 +137,7 @@ struct osd_style_opts { }; extern const struct m_sub_options osd_style_conf; +extern const struct m_sub_options sub_style_conf; struct osd_state; struct osd_object; |