@@ -165,6 +165,7 @@ static void update_lut(struct priv *p, struct user_lut *lut);
165165
166166struct gl_next_opts {
167167 bool delayed_peak ;
168+ int subs_hdr_peak ;
168169 int border_background ;
169170 float corner_rounding ;
170171 bool inter_preserve ;
@@ -186,6 +187,8 @@ const struct m_opt_choice_alternatives lut_types[] = {
186187#define OPT_BASE_STRUCT struct gl_next_opts
187188const struct m_sub_options gl_next_conf = {
188189 .opts = (const struct m_option []) {
190+ {"subs-hdr-peak" , OPT_CHOICE (subs_hdr_peak , {"sdr" , 0 }, {"video" , -1 }),
191+ M_RANGE (100 , 10000 )},
189192 {"allow-delayed-peak-detect" , OPT_BOOL (delayed_peak )},
190193 {"border-background" , OPT_CHOICE (border_background ,
191194 {"none" , BACKGROUND_NONE },
@@ -206,6 +209,7 @@ const struct m_sub_options gl_next_conf = {
206209 .defaults = & (struct gl_next_opts ) {
207210 .border_background = BACKGROUND_COLOR ,
208211 .inter_preserve = true,
212+ .subs_hdr_peak = 0 ,
209213 },
210214 .size = sizeof (struct gl_next_opts ),
211215 .change_flags = UPDATE_VIDEO ,
@@ -368,14 +372,29 @@ static void update_overlays(struct vo *vo, struct mp_osd_res res,
368372 // Seems like HDR subtitles are targeting SDR white
369373 if (pl_color_transfer_is_hdr (ol -> color .transfer )) {
370374 ol -> color .hdr = (struct pl_hdr_metadata ) {
371- .max_luma = PL_COLOR_SDR_WHITE ,
375+ int subs_hdr_peak = p -> next_opts -> subs_hdr_peak ;
376+ if (subs_hdr_peak == 0 ) {
377+ .max_luma = PL_COLOR_SDR_WHITE ;
378+ } else if (subs_hdr_peak != -1 ) {
379+ .max_luma = subs_hdr_peak ;
380+ }
372381 };
373382 }
374383 }
375384 break ;
376385 case SUBBITMAP_LIBASS :
377386 if (src && item -> video_color_space && !pl_color_space_is_hdr (& src -> params .color ))
378387 ol -> color = src -> params .color ;
388+ if (pl_color_transfer_is_hdr (ol -> color .transfer )) {
389+ ol -> color .hdr = (struct pl_hdr_metadata ) {
390+ int subs_hdr_peak = p -> next_opts -> subs_hdr_peak ;
391+ if (subs_hdr_peak == 0 ) {
392+ .max_luma = PL_COLOR_SDR_WHITE ;
393+ } else if (subs_hdr_peak != -1 ) {
394+ .max_luma = subs_hdr_peak ;
395+ }
396+ };
397+ }
379398 ol -> mode = PL_OVERLAY_MONOCHROME ;
380399 ol -> repr .alpha = PL_ALPHA_INDEPENDENT ;
381400 break ;
0 commit comments