summaryrefslogtreecommitdiffstats
path: root/options/options.h
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-12-13 15:36:58 -0600
committerDudemanguy <random342@airmail.cc>2023-12-16 15:25:32 +0000
commitb0f31a76376cae73506e3969dff805de8a18b198 (patch)
treee3771b0debf9d881539ca6889262ddb982ad4921 /options/options.h
parentace2d6506f20dfc6a30d0bbb6cfb959f2144bfc9 (diff)
downloadmpv-b0f31a76376cae73506e3969dff805de8a18b198.tar.bz2
mpv-b0f31a76376cae73506e3969dff805de8a18b198.tar.xz
player: refactor secondary subtitle options and properties
Over the years, we've accumulated several secondary subtitle related options and properties, but the implementation was not really consistent and it wasn't clear what the right process for adding more should be. So to make things nicer, let's refactor all of the subtitle options with secondary variants (sub-delay, sub-pos, and sub-visibility) and split them off to a new, separate struct. All of the underlying values are stored in an array instead for simplicity. Additionally, the implementation of some secondary-sub-* properties were slightly changed so there would be less redundancy.
Diffstat (limited to 'options/options.h')
-rw-r--r--options/options.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/options/options.h b/options/options.h
index c0ffd2c325..86344c52f6 100644
--- a/options/options.h
+++ b/options/options.h
@@ -82,11 +82,6 @@ typedef struct mp_vo_opts {
// Subtitle options needed by the subtitle decoders/renderers.
struct mp_subtitle_opts {
- bool sub_visibility;
- bool sec_sub_visibility;
- float sub_pos;
- float sec_sub_pos;
- float sub_delay[2];
float sub_fps;
float sub_speed;
bool sub_forced_events_only;
@@ -121,6 +116,13 @@ struct mp_subtitle_opts {
bool sub_past_video_end;
};
+// Options for both primary and secondary subs.
+struct mp_subtitle_shared_opts {
+ float sub_delay[2];
+ float sub_pos[2];
+ bool sub_visibility[2];
+};
+
struct mp_sub_filter_opts {
bool sub_filter_SDH;
bool sub_filter_SDH_harder;
@@ -199,6 +201,7 @@ typedef struct MPOpts {
bool cursor_autohide_fs;
struct mp_subtitle_opts *subs_rend;
+ struct mp_subtitle_shared_opts *subs_shared;
struct mp_sub_filter_opts *subs_filt;
struct mp_osd_render_opts *osd_rend;
@@ -398,6 +401,7 @@ extern const struct m_sub_options vo_sub_opts;
extern const struct m_sub_options cuda_conf;
extern const struct m_sub_options dvd_conf;
extern const struct m_sub_options mp_subtitle_sub_opts;
+extern const struct m_sub_options mp_subtitle_shared_sub_opts;
extern const struct m_sub_options mp_sub_filter_opts;
extern const struct m_sub_options mp_osd_render_sub_opts;
extern const struct m_sub_options filter_conf;