options: move mp_sub_filter_opts to sd_ass.c

Also use sub-filter common prefix.
This commit is contained in:
nanahi 2024-10-26 09:32:20 -04:00 committed by Kacper Michajłow
parent f3b56c846d
commit e056ad374f
4 changed files with 37 additions and 36 deletions

View File

@ -101,6 +101,8 @@ extern const struct m_sub_options wingl_conf;
extern const struct m_sub_options vaapi_conf; extern const struct m_sub_options vaapi_conf;
extern const struct m_sub_options egl_conf; extern const struct m_sub_options egl_conf;
extern const struct m_sub_options mp_sub_filter_opts;
static const struct m_sub_options screenshot_conf = { static const struct m_sub_options screenshot_conf = {
.opts = image_writer_opts, .opts = image_writer_opts,
.size = sizeof(struct image_writer_opts), .size = sizeof(struct image_writer_opts),
@ -275,29 +277,6 @@ const struct m_sub_options vo_sub_opts = {
}, },
}; };
#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct mp_sub_filter_opts
const struct m_sub_options mp_sub_filter_opts = {
.opts = (const struct m_option[]){
{"sub-filter-sdh", OPT_BOOL(sub_filter_SDH)},
{"sub-filter-sdh-harder", OPT_BOOL(sub_filter_SDH_harder)},
{"sub-filter-sdh-enclosures", OPT_STRING(sub_filter_SDH_enclosures)},
{"sub-filter-regex-enable", OPT_BOOL(rf_enable)},
{"sub-filter-regex-plain", OPT_BOOL(rf_plain)},
{"sub-filter-regex", OPT_STRINGLIST(rf_items)},
{"sub-filter-jsre", OPT_STRINGLIST(jsre_items)},
{"sub-filter-regex-warn", OPT_BOOL(rf_warn)},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
.defaults = &(OPT_BASE_STRUCT){
.sub_filter_SDH_enclosures = "([\uFF08",
.rf_enable = true,
},
.change_flags = UPDATE_SUB_FILT,
};
#undef OPT_BASE_STRUCT #undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct mp_subtitle_opts #define OPT_BASE_STRUCT struct mp_subtitle_opts
@ -747,7 +726,7 @@ static const m_option_t mp_opts[] = {
{"", OPT_SUBSTRUCT(subs_rend, mp_subtitle_sub_opts)}, {"", OPT_SUBSTRUCT(subs_rend, mp_subtitle_sub_opts)},
{"", OPT_SUBSTRUCT(subs_shared, mp_subtitle_shared_sub_opts)}, {"", OPT_SUBSTRUCT(subs_shared, mp_subtitle_shared_sub_opts)},
{"", OPT_SUBSTRUCT(subs_filt, mp_sub_filter_opts)}, {"sub-filter", OPT_SUBSTRUCT(subs_filt, mp_sub_filter_opts)},
{"", OPT_SUBSTRUCT(osd_rend, mp_osd_render_sub_opts)}, {"", OPT_SUBSTRUCT(osd_rend, mp_osd_render_sub_opts)},
{"osd-bar", OPT_BOOL(osd_bar_visible), .flags = UPDATE_OSD}, {"osd-bar", OPT_BOOL(osd_bar_visible), .flags = UPDATE_OSD},

View File

@ -134,17 +134,6 @@ struct mp_subtitle_shared_opts {
int ass_style_override[2]; int ass_style_override[2];
}; };
struct mp_sub_filter_opts {
bool sub_filter_SDH;
bool sub_filter_SDH_harder;
char *sub_filter_SDH_enclosures;
bool rf_enable;
bool rf_plain;
char **rf_items;
char **jsre_items;
bool rf_warn;
};
struct mp_osd_render_opts { struct mp_osd_render_opts {
float osd_bar_align_x; float osd_bar_align_x;
float osd_bar_align_y; float osd_bar_align_y;
@ -424,7 +413,6 @@ extern const struct m_sub_options cuda_conf;
extern const struct m_sub_options dvd_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_sub_opts;
extern const struct m_sub_options mp_subtitle_shared_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 mp_osd_render_sub_opts;
extern const struct m_sub_options filter_conf; extern const struct m_sub_options filter_conf;
extern const struct m_sub_options resample_conf; extern const struct m_sub_options resample_conf;

View File

@ -67,6 +67,17 @@ bool lavc_conv_is_styled(struct lavc_conv *priv);
void lavc_conv_reset(struct lavc_conv *priv); void lavc_conv_reset(struct lavc_conv *priv);
void lavc_conv_uninit(struct lavc_conv *priv); void lavc_conv_uninit(struct lavc_conv *priv);
struct mp_sub_filter_opts {
bool sub_filter_SDH;
bool sub_filter_SDH_harder;
char *sub_filter_SDH_enclosures;
bool rf_enable;
bool rf_plain;
char **rf_items;
char **jsre_items;
bool rf_warn;
};
struct sd_filter { struct sd_filter {
struct mpv_global *global; struct mpv_global *global;
struct mp_log *log; struct mp_log *log;

View File

@ -67,6 +67,29 @@ struct seen_packet {
double pts; double pts;
}; };
#undef OPT_BASE_STRUCT
#define OPT_BASE_STRUCT struct mp_sub_filter_opts
const struct m_sub_options mp_sub_filter_opts = {
.opts = (const struct m_option[]){
{"sdh", OPT_BOOL(sub_filter_SDH)},
{"sdh-harder", OPT_BOOL(sub_filter_SDH_harder)},
{"sdh-enclosures", OPT_STRING(sub_filter_SDH_enclosures)},
{"regex-enable", OPT_BOOL(rf_enable)},
{"regex-plain", OPT_BOOL(rf_plain)},
{"regex", OPT_STRINGLIST(rf_items)},
{"jsre", OPT_STRINGLIST(jsre_items)},
{"regex-warn", OPT_BOOL(rf_warn)},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
.defaults = &(OPT_BASE_STRUCT){
.sub_filter_SDH_enclosures = "([\uFF08",
.rf_enable = true,
},
.change_flags = UPDATE_SUB_FILT,
};
static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts); static void mangle_colors(struct sd *sd, struct sub_bitmaps *parts);
static void fill_plaintext(struct sd *sd, double pts); static void fill_plaintext(struct sd *sd, double pts);