Unified · Split
| @@ -186,6 +186,8 @@ struct priv { · 185 unmodified lines | |||
| 186 | bool target_hint; | 186 | bool target_hint; |
| 187 | 187 | ||
| 188 | float corner_rounding; | 188 | float corner_rounding; |
| 189 | |||
| 190 | struct pl_hdr_metadata last_hdr_metadata; | ||
| 189 | }; | 191 | }; |
| 190 | 192 | ||
| 191 | static void update_render_options(struct vo *vo); | 193 | static void update_render_options(struct vo *vo); |
| @@ -1081,6 +1083,23 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame) · 889 unmodified lines | |||
| 1081 | goto done; | 1083 | goto done; |
| 1082 | } | 1084 | } |
| 1083 | 1085 | ||
| 1086 | const struct pl_frame *cur_frame = NULL; | ||
| 1087 | for (int i = 0; i < mix.num_frames; i++) { | ||
| 1088 | if (mix.timestamps[i] > 0.0f) | ||
| 1089 | break; | ||
| 1090 | cur_frame = mix.frames[i]; | ||
| 1091 | } | ||
| 1092 | |||
| 1093 | if (cur_frame) { | ||
| 1094 | p->last_hdr_metadata = cur_frame->color.hdr; | ||
| 1095 | #if PL_API_VER >= 314 | ||
| 1096 | // Augment metadata with peak detection max_pq_y / avg_pq_y | ||
| 1097 | pl_renderer_get_hdr_metadata(p->rr, &p->last_hdr_metadata); | ||
| 1098 | #endif | ||
| 1099 | } else { | ||
| 1100 | p->last_hdr_metadata = (struct pl_hdr_metadata){0}; | ||
| 1101 | } | ||
| 1102 | |||
| 1084 | p->is_interpolated = mix.num_frames > 1; | 1103 | p->is_interpolated = mix.num_frames > 1; |
| 1085 | valid = true; | 1104 | valid = true; |
| 1086 | // fall through | 1105 | // fall through |
| @@ -1417,6 +1436,21 @@ static int control(struct vo *vo, uint32_t request, void *data) · 330 unmodified lines | |||
| 1417 | return true; | 1436 | return true; |
| 1418 | } | 1437 | } |
| 1419 | 1438 | ||
| 1439 | case VOCTRL_HDR_METADATA: { | ||
| 1440 | struct mp_hdr_metadata *hdr = data; | ||
| 1441 | hdr->min_luma = p->last_hdr_metadata.min_luma; | ||
| 1442 | hdr->max_luma = p->last_hdr_metadata.max_luma; | ||
| 1443 | hdr->max_cll = p->last_hdr_metadata.max_cll; | ||
| 1444 | hdr->max_fall = p->last_hdr_metadata.max_fall; | ||
| 1445 | hdr->scene_max[0] = p->last_hdr_metadata.scene_max[0]; | ||
| 1446 | hdr->scene_max[1] = p->last_hdr_metadata.scene_max[1]; | ||
| 1447 | hdr->scene_max[2] = p->last_hdr_metadata.scene_max[2]; | ||
| 1448 | hdr->scene_avg = p->last_hdr_metadata.scene_avg; | ||
| 1449 | hdr->max_pq_y = p->last_hdr_metadata.max_pq_y; | ||
| 1450 | hdr->avg_pq_y = p->last_hdr_metadata.avg_pq_y; | ||
| 1451 | return true; | ||
| 1452 | } | ||
| 1453 | |||
| 1420 | case VOCTRL_SCREENSHOT: | 1454 | case VOCTRL_SCREENSHOT: |
| 1421 | video_screenshot(vo, data); | 1455 | video_screenshot(vo, data); |
| 1422 | return true; | 1456 | return true; |