Move them to a suboption so the suboption prefix can be used.
Unified · Split
| @@ -390,17 +390,8 @@ const struct m_sub_options mp_subtitle_shared_sub_opts = { · 389 unmodified lines | ||
| 390 | 390 | |
| 391 | 391 | const struct m_sub_options mp_osd_render_sub_opts = { |
| 392 | 392 | .opts = (const struct m_option[]){ |
| 393 | − {"osd-bar-align-x", OPT_FLOAT(osd_bar_align_x), M_RANGE(-1.0, +1.0)}, | |
| 394 | − {"osd-bar-align-y", OPT_FLOAT(osd_bar_align_y), M_RANGE(-1.0, +1.0)}, | |
| 395 | − {"osd-bar-w", OPT_FLOAT(osd_bar_w), M_RANGE(1, 100)}, | |
| 396 | − {"osd-bar-h", OPT_FLOAT(osd_bar_h), M_RANGE(0.1, 50)}, | |
| 397 | − {"osd-bar-outline-size", OPT_FLOAT(osd_bar_outline_size), M_RANGE(0, 1000.0)}, | |
| 398 | − {"osd-bar-border-size", OPT_ALIAS("osd-bar-outline-size")}, | |
| 399 | − {"osd-bar-marker-scale", OPT_FLOAT(osd_bar_marker_scale), M_RANGE(0, 100.0)}, | |
| 400 | − {"osd-bar-marker-min-size", OPT_FLOAT(osd_bar_marker_min_size), M_RANGE(0, 1000.0)}, | |
| 401 | − {"osd-bar-marker-style", OPT_CHOICE(osd_bar_marker_style, | |
| 402 | − {"none", 0}, {"triangle", 1}, {"line", 2})}, | |
| 403 | 393 | {"osd", OPT_SUBSTRUCT(osd_style, osd_style_conf)}, |
| 394 | + {"osd-bar", OPT_SUBSTRUCT(osd_bar_style, osd_bar_style_conf)}, | |
| 404 | 395 | {"osd-scale", OPT_FLOAT(osd_scale), M_RANGE(0, 100)}, |
| 405 | 396 | {"osd-scale-by-window", OPT_BOOL(osd_scale_by_window)}, |
| 406 | 397 | {"force-rgba-osd-rendering", OPT_BOOL(force_rgba_osd)}, |
| @@ -408,13 +399,6 @@ const struct m_sub_options mp_osd_render_sub_opts = { · 1 unmodified line | ||
| 408 | 399 | }, |
| 409 | 400 | .size = sizeof(OPT_BASE_STRUCT), |
| 410 | 401 | .defaults = &(OPT_BASE_STRUCT){ |
| 411 | − .osd_bar_align_y = 0.5, | |
| 412 | − .osd_bar_w = 75.0, | |
| 413 | − .osd_bar_h = 3.125, | |
| 414 | − .osd_bar_outline_size = 0.5, | |
| 415 | − .osd_bar_marker_scale = 1.3, | |
| 416 | − .osd_bar_marker_min_size = 1.6, | |
| 417 | − .osd_bar_marker_style = 1, | |
| 418 | 402 | .osd_scale = 1, |
| 419 | 403 | .osd_scale_by_window = true, |
| 420 | 404 | }, |
| @@ -135,17 +135,10 @@ struct mp_subtitle_shared_opts { · 134 unmodified lines | ||
| 135 | 135 | }; |
| 136 | 136 | |
| 137 | 137 | struct mp_osd_render_opts { |
| 138 | − float osd_bar_align_x; | |
| 139 | − float osd_bar_align_y; | |
| 140 | − float osd_bar_w; | |
| 141 | − float osd_bar_h; | |
| 142 | − float osd_bar_outline_size; | |
| 143 | − float osd_bar_marker_scale; | |
| 144 | − float osd_bar_marker_min_size; | |
| 145 | − int osd_bar_marker_style; | |
| 146 | 138 | float osd_scale; |
| 147 | 139 | bool osd_scale_by_window; |
| 148 | 140 | struct osd_style_opts *osd_style; |
| 141 | + struct osd_bar_style_opts *osd_bar_style; | |
| 149 | 142 | bool force_rgba_osd; |
| 150 | 143 | }; |
| 151 | 144 | |
| @@ -116,6 +116,37 @@ const struct m_sub_options sub_style_conf = { · 115 unmodified lines | ||
| 116 | 116 | .change_flags = UPDATE_OSD, |
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | +#undef OPT_BASE_STRUCT | |
| 120 | +#define OPT_BASE_STRUCT struct osd_bar_style_opts | |
| 121 | +static const m_option_t bar_style_opts[] = { | |
| 122 | + {"align-x", OPT_FLOAT(align_x), M_RANGE(-1.0, +1.0)}, | |
| 123 | + {"align-y", OPT_FLOAT(align_y), M_RANGE(-1.0, +1.0)}, | |
| 124 | + {"w", OPT_FLOAT(w), M_RANGE(1, 100)}, | |
| 125 | + {"h", OPT_FLOAT(h), M_RANGE(0.1, 50)}, | |
| 126 | + {"outline-size", OPT_FLOAT(outline_size), M_RANGE(0, 1000.0)}, | |
| 127 | + {"border-size", OPT_ALIAS("osd-bar-outline-size")}, | |
| 128 | + {"marker-scale", OPT_FLOAT(marker_scale), M_RANGE(0, 100.0)}, | |
| 129 | + {"marker-min-size", OPT_FLOAT(marker_min_size), M_RANGE(0, 1000.0)}, | |
| 130 | + {"marker-style", OPT_CHOICE(marker_style, | |
| 131 | + {"none", 0}, {"triangle", 1}, {"line", 2})}, | |
| 132 | + {0} | |
| 133 | +}; | |
| 134 | + | |
| 135 | +const struct m_sub_options osd_bar_style_conf = { | |
| 136 | + .opts = bar_style_opts, | |
| 137 | + .size = sizeof(struct osd_bar_style_opts), | |
| 138 | + .defaults = &(const struct osd_bar_style_opts){ | |
| 139 | + .align_y = 0.5, | |
| 140 | + .w = 75.0, | |
| 141 | + .h = 3.125, | |
| 142 | + .outline_size = 0.5, | |
| 143 | + .marker_scale = 1.3, | |
| 144 | + .marker_min_size = 1.6, | |
| 145 | + .marker_style = 1, | |
| 146 | + }, | |
| 147 | + .change_flags = UPDATE_OSD, | |
| 148 | +}; | |
| 149 | + | |
| 119 | 150 | bool osd_res_equals(struct mp_osd_res a, struct mp_osd_res b) |
| 120 | 151 | { |
| 121 | 152 | return a.w == b.w && a.h == b.h && a.ml == b.ml && a.mt == b.mt |
| @@ -163,8 +163,20 @@ struct osd_style_opts { · 162 unmodified lines | ||
| 163 | 163 | char *fonts_dir; |
| 164 | 164 | }; |
| 165 | 165 | |
| 166 | +struct osd_bar_style_opts { | |
| 167 | + float align_x; | |
| 168 | + float align_y; | |
| 169 | + float w; | |
| 170 | + float h; | |
| 171 | + float outline_size; | |
| 172 | + float marker_scale; | |
| 173 | + float marker_min_size; | |
| 174 | + int marker_style; | |
| 175 | +}; | |
| 176 | + | |
| 166 | 177 | extern const struct m_sub_options osd_style_conf; |
| 167 | 178 | extern const struct m_sub_options sub_style_conf; |
| 179 | +extern const struct m_sub_options osd_bar_style_conf; | |
| 168 | 180 | |
| 169 | 181 | struct osd_state; |
| 170 | 182 | struct osd_object; |
| @@ -380,10 +380,10 @@ static void get_osd_bar_box(struct osd_state *osd, struct osd_object *obj, · 379 unmodified lines | ||
| 380 | 380 | // and each bar ass event gets its own opaque box - breaking the bar. |
| 381 | 381 | style->BorderStyle = 1; // outline |
| 382 | 382 | |
| 383 | − *o_w = track->PlayResX * (opts->osd_bar_w / 100.0); | |
| 384 | − *o_h = track->PlayResY * (opts->osd_bar_h / 100.0); | |
| 383 | + *o_w = track->PlayResX * (opts->osd_bar_style->w / 100.0); | |
| 384 | + *o_h = track->PlayResY * (opts->osd_bar_style->h / 100.0); | |
| 385 | 385 | |
| 386 | − style->Outline = opts->osd_bar_outline_size; | |
| 386 | + style->Outline = opts->osd_bar_style->outline_size; | |
| 387 | 387 | // Rendering with shadow is broken (because there's more than one shape) |
| 388 | 388 | style->Shadow = 0; |
| 389 | 389 | style->Blur = 0; |
| @@ -392,8 +392,8 @@ static void get_osd_bar_box(struct osd_state *osd, struct osd_object *obj, · 2 unmodified lines | ||
| 392 | 392 | |
| 393 | 393 | *o_border = style->Outline; |
| 394 | 394 | |
| 395 | − *o_x = get_align(opts->osd_bar_align_x, track->PlayResX, *o_w, *o_border); | |
| 396 | − *o_y = get_align(opts->osd_bar_align_y, track->PlayResY, *o_h, *o_border); | |
| 395 | + *o_x = get_align(opts->osd_bar_style->align_x, track->PlayResX, *o_w, *o_border); | |
| 396 | + *o_y = get_align(opts->osd_bar_style->align_y, track->PlayResY, *o_h, *o_border); | |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | static void update_progbar(struct osd_state *osd, struct osd_object *obj) |
| @@ -470,13 +470,13 @@ static void update_progbar(struct osd_state *osd, struct osd_object *obj) · 70 unmodified lines | ||
| 470 | 470 | ass_draw_rect_ccw(d, 0, 0, width, height); |
| 471 | 471 | |
| 472 | 472 | // chapter marks |
| 473 | − if (osd->opts->osd_bar_marker_style) { | |
| 473 | + if (osd->opts->osd_bar_style->marker_style) { | |
| 474 | 474 | for (int n = 0; n < obj->progbar_state.num_stops; n++) { |
| 475 | 475 | float s = obj->progbar_state.stops[n] * width; |
| 476 | − float size = MPMAX(border * osd->opts->osd_bar_marker_scale, | |
| 477 | − osd->opts->osd_bar_marker_min_size); | |
| 476 | + float size = MPMAX(border * osd->opts->osd_bar_style->marker_scale, | |
| 477 | + osd->opts->osd_bar_style->marker_min_size); | |
| 478 | 478 | |
| 479 | − if (osd->opts->osd_bar_marker_style == 2 && | |
| 479 | + if (osd->opts->osd_bar_style->marker_style == 2 && | |
| 480 | 480 | s > size / 2 && s < width - size / 2) |
| 481 | 481 | { // line |
| 482 | 482 | ass_draw_rect_cw(d, s - size / 2, 0, s + size / 2, height); |