diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2024-02-27 02:12:46 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-03-02 15:57:02 +0000 |
commit | d6981a4cac43629fe95115f20d0009941482cc13 (patch) | |
tree | cc19d71c85568a817687ffd8b2f35b42a1aec976 | |
parent | c8f1c822dcbe720f90e672ed9c084a1af3af7e97 (diff) | |
download | mpv-d6981a4cac43629fe95115f20d0009941482cc13.tar.bz2 mpv-d6981a4cac43629fe95115f20d0009941482cc13.tar.xz |
sub: add flag if sub_bitmap should be rendered in video color space
-rw-r--r-- | sub/ass_mp.c | 3 | ||||
-rw-r--r-- | sub/ass_mp.h | 2 | ||||
-rw-r--r-- | sub/osd.h | 2 | ||||
-rw-r--r-- | sub/osd_libass.c | 2 | ||||
-rw-r--r-- | sub/sd_ass.c | 2 |
5 files changed, 7 insertions, 4 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c index 634681f2ec..3e9f83313f 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -341,7 +341,7 @@ static bool pack_rgba(struct mp_ass_packer *p, struct sub_bitmaps *res) // repacks all images). preferred_osd_format can be set to a desired // sub_bitmap_format. Currently, only SUBBITMAP_LIBASS is supported. void mp_ass_packer_pack(struct mp_ass_packer *p, ASS_Image **image_lists, - int num_image_lists, bool image_lists_changed, + int num_image_lists, bool image_lists_changed, bool video_color_space, int preferred_osd_format, struct sub_bitmaps *out) { int format = preferred_osd_format == SUBBITMAP_BGRA ? SUBBITMAP_BGRA @@ -361,6 +361,7 @@ void mp_ass_packer_pack(struct mp_ass_packer *p, ASS_Image **image_lists, .change_id = image_lists_changed, .format = SUBBITMAP_LIBASS, .parts = p->cached_parts, + .video_color_space = video_color_space, }; for (int n = 0; n < num_image_lists; n++) { diff --git a/sub/ass_mp.h b/sub/ass_mp.h index dc83e31ed6..b4e16d6650 100644 --- a/sub/ass_mp.h +++ b/sub/ass_mp.h @@ -57,7 +57,7 @@ struct sub_bitmaps; struct mp_ass_packer; struct mp_ass_packer *mp_ass_packer_alloc(void *ta_parent); void mp_ass_packer_pack(struct mp_ass_packer *p, ASS_Image **image_lists, - int num_image_lists, bool changed, + int num_image_lists, bool changed, bool video_color_space, int preferred_osd_format, struct sub_bitmaps *out); void mp_ass_get_bb(ASS_Image *image_list, ASS_Track *track, struct mp_osd_res *res, double *out_rc); @@ -74,6 +74,8 @@ struct sub_bitmaps { int packed_w, packed_h; int change_id; // Incremented on each change (0 is never used) + + bool video_color_space; // True if the bitmap is in video color space }; struct sub_bitmap_list { diff --git a/sub/osd_libass.c b/sub/osd_libass.c index f8d78fdfcc..16d94b3cbf 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -678,7 +678,7 @@ struct sub_bitmaps *osd_object_get_bitmaps(struct osd_state *osd, struct sub_bitmaps out_imgs = {0}; mp_ass_packer_pack(obj->ass_packer, obj->ass_imgs, obj->num_externals + 1, - obj->changed, format, &out_imgs); + obj->changed, false, format, &out_imgs); obj->changed = false; diff --git a/sub/sd_ass.c b/sub/sd_ass.c index f1ab23bb55..6fa4d1bb52 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -688,7 +688,7 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res dim, int changed; ASS_Image *imgs = ass_render_frame(renderer, track, ts, &changed); - mp_ass_packer_pack(ctx->packer, &imgs, 1, changed, format, res); + mp_ass_packer_pack(ctx->packer, &imgs, 1, changed, !converted, format, res); done: // mangle_colors() modifies the color field, so copy the thing _before_. |