mirror of https://github.com/mpv-player/mpv
sub: add flag if sub_bitmap should be rendered in video color space
This commit is contained in:
parent
c8f1c822dc
commit
d6981a4cac
|
@ -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++) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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_.
|
||||
|
|
Loading…
Reference in New Issue