summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_osd.c13
-rw-r--r--video/out/vo_direct3d.c15
-rw-r--r--video/out/vo_sdl.c80
-rw-r--r--video/out/vo_vaapi.c6
-rw-r--r--video/out/vo_vdpau.c14
-rw-r--r--video/out/vo_wayland.c6
6 files changed, 59 insertions, 75 deletions
diff --git a/video/out/gl_osd.c b/video/out/gl_osd.c
index 74074915a2..88a7e938fb 100644
--- a/video/out/gl_osd.c
+++ b/video/out/gl_osd.c
@@ -68,7 +68,7 @@ static const struct gl_vao_entry vertex_vao[] = {
struct mpgl_osd_part {
enum sub_bitmap_format format;
- int bitmap_id, bitmap_pos_id;
+ int change_id;
GLuint texture;
int w, h;
GLuint buffer;
@@ -278,14 +278,11 @@ static void gen_osd_cb(void *pctx, struct sub_bitmaps *imgs)
struct mpgl_osd_part *osd = ctx->parts[imgs->render_index];
- if (imgs->bitmap_pos_id != osd->bitmap_pos_id) {
- if (imgs->bitmap_id != osd->bitmap_id) {
- if (!upload_osd(ctx, osd, imgs))
- osd->packer->count = 0;
- }
+ if (imgs->change_id != osd->change_id) {
+ if (!upload_osd(ctx, osd, imgs))
+ osd->packer->count = 0;
- osd->bitmap_id = imgs->bitmap_id;
- osd->bitmap_pos_id = imgs->bitmap_pos_id;
+ osd->change_id = imgs->change_id;
}
osd->num_subparts = osd->packer->count;
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index 1977d64a11..b6e40e75ec 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -103,7 +103,7 @@ struct texplane {
struct osdpart {
enum sub_bitmap_format format;
- int bitmap_id, bitmap_pos_id;
+ int change_id;
struct d3dtex texture;
int num_vertices;
vertex_osd *vertices;
@@ -453,7 +453,7 @@ static void destroy_d3d_surfaces(d3d_priv *priv)
for (int n = 0; n < MAX_OSD_PARTS; n++) {
struct osdpart *osd = priv->osd[n];
d3dtex_release(priv, &osd->texture);
- osd->bitmap_id = osd->bitmap_pos_id = -1;
+ osd->change_id = -1;
}
if (priv->d3d_backbuf)
@@ -1618,14 +1618,11 @@ static struct osdpart *generate_osd(d3d_priv *priv, struct sub_bitmaps *imgs)
struct osdpart *osd = priv->osd[imgs->render_index];
- if (imgs->bitmap_pos_id != osd->bitmap_pos_id) {
- if (imgs->bitmap_id != osd->bitmap_id) {
- if (!upload_osd(priv, osd, imgs))
- osd->packer->count = 0;
- }
+ if (imgs->change_id != osd->change_id) {
+ if (!upload_osd(priv, osd, imgs))
+ osd->packer->count = 0;
- osd->bitmap_id = imgs->bitmap_id;
- osd->bitmap_pos_id = imgs->bitmap_pos_id;
+ osd->change_id = imgs->change_id;
osd->num_vertices = 0;
}
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index 8bde820b38..c2cc711d2f 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -177,8 +177,7 @@ struct priv {
struct mp_osd_res osd_res;
struct formatmap_entry osd_format;
struct osd_bitmap_surface {
- int bitmap_id;
- int bitmap_pos_id;
+ int change_id;
struct osd_target {
SDL_Rect source;
SDL_Rect dest;
@@ -702,7 +701,7 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs)
if (imgs->format == SUBBITMAP_EMPTY || imgs->num_parts == 0)
return;
- if (imgs->bitmap_pos_id == sfc->bitmap_pos_id)
+ if (imgs->change_id == sfc->change_id)
return;
if (imgs->num_parts > sfc->targets_size) {
@@ -725,49 +724,46 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs)
bmp->x, bmp->y, bmp->dw, bmp->dh
};
- if (imgs->bitmap_id != sfc->bitmap_id || !target->tex) {
- // tex: alpha blended texture
- if (target->tex) {
- SDL_DestroyTexture(target->tex);
- target->tex = NULL;
- }
- if (!target->tex)
- target->tex = SDL_CreateTexture(vc->renderer,
- vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING,
- bmp->w, bmp->h);
- if (!target->tex) {
- MP_ERR(vo, "Could not create texture\n");
- }
- if (target->tex) {
- SDL_SetTextureBlendMode(target->tex,
- SDL_BLENDMODE_BLEND);
- SDL_SetTextureColorMod(target->tex, 0, 0, 0);
- subbitmap_to_texture(vo, target->tex, bmp, 0); // RGBA -> 000A
- }
+ // tex: alpha blended texture
+ if (target->tex) {
+ SDL_DestroyTexture(target->tex);
+ target->tex = NULL;
+ }
+ if (!target->tex)
+ target->tex = SDL_CreateTexture(vc->renderer,
+ vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING,
+ bmp->w, bmp->h);
+ if (!target->tex) {
+ MP_ERR(vo, "Could not create texture\n");
+ }
+ if (target->tex) {
+ SDL_SetTextureBlendMode(target->tex,
+ SDL_BLENDMODE_BLEND);
+ SDL_SetTextureColorMod(target->tex, 0, 0, 0);
+ subbitmap_to_texture(vo, target->tex, bmp, 0); // RGBA -> 000A
+ }
- // tex2: added texture
- if (target->tex2) {
- SDL_DestroyTexture(target->tex2);
- target->tex2 = NULL;
- }
- if (!target->tex2)
- target->tex2 = SDL_CreateTexture(vc->renderer,
- vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING,
- bmp->w, bmp->h);
- if (!target->tex2) {
- MP_ERR(vo, "Could not create texture\n");
- }
- if (target->tex2) {
- SDL_SetTextureBlendMode(target->tex2,
- SDL_BLENDMODE_ADD);
- subbitmap_to_texture(vo, target->tex2, bmp,
- 0xFF000000); // RGBA -> RGB1
- }
+ // tex2: added texture
+ if (target->tex2) {
+ SDL_DestroyTexture(target->tex2);
+ target->tex2 = NULL;
+ }
+ if (!target->tex2)
+ target->tex2 = SDL_CreateTexture(vc->renderer,
+ vc->osd_format.sdl, SDL_TEXTUREACCESS_STREAMING,
+ bmp->w, bmp->h);
+ if (!target->tex2) {
+ MP_ERR(vo, "Could not create texture\n");
+ }
+ if (target->tex2) {
+ SDL_SetTextureBlendMode(target->tex2,
+ SDL_BLENDMODE_ADD);
+ subbitmap_to_texture(vo, target->tex2, bmp,
+ 0xFF000000); // RGBA -> RGB1
}
}
- sfc->bitmap_id = imgs->bitmap_id;
- sfc->bitmap_pos_id = imgs->bitmap_pos_id;
+ sfc->change_id = imgs->change_id;
}
static void draw_osd_part(struct vo *vo, int index)
diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c
index 8d0102be77..31479ff41b 100644
--- a/video/out/vo_vaapi.c
+++ b/video/out/vo_vaapi.c
@@ -57,7 +57,7 @@ struct vaapi_subpic {
struct vaapi_osd_part {
bool active;
- int bitmap_pos_id;
+ int change_id;
struct vaapi_osd_image image;
struct vaapi_subpic subpic;
struct osd_conv_cache *conv_cache;
@@ -345,8 +345,8 @@ static void draw_osd_cb(void *pctx, struct sub_bitmaps *imgs)
struct priv *p = pctx;
struct vaapi_osd_part *part = &p->osd_parts[imgs->render_index];
- if (imgs->bitmap_pos_id != part->bitmap_pos_id) {
- part->bitmap_pos_id = imgs->bitmap_pos_id;
+ if (imgs->change_id != part->change_id) {
+ part->change_id = imgs->change_id;
osd_scale_rgba(part->conv_cache, imgs);
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 89bbb142a3..995b579ba6 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -136,8 +136,7 @@ struct vdpctx {
} *targets;
int targets_size;
int render_count;
- int bitmap_id;
- int bitmap_pos_id;
+ int change_id;
} osd_surfaces[MAX_OSD_PARTS];
// Video equalizer
@@ -388,7 +387,7 @@ static void mark_vdpau_objects_uninitialized(struct vo *vo)
for (int i = 0; i < MAX_OSD_PARTS; i++) {
struct osd_bitmap_surface *sfc = &vc->osd_surfaces[i];
talloc_free(sfc->packer);
- sfc->bitmap_id = sfc->bitmap_pos_id = 0;
+ sfc->change_id = 0;
*sfc = (struct osd_bitmap_surface){
.surface = VDP_INVALID_HANDLE,
};
@@ -512,7 +511,7 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs)
struct osd_bitmap_surface *sfc = &vc->osd_surfaces[imgs->render_index];
bool need_upload = false;
- if (imgs->bitmap_pos_id == sfc->bitmap_pos_id)
+ if (imgs->change_id == sfc->change_id)
return; // Nothing changed and we still have the old data
sfc->render_count = 0;
@@ -520,9 +519,6 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs)
if (imgs->format == SUBBITMAP_EMPTY || imgs->num_parts == 0)
return;
- if (imgs->bitmap_id == sfc->bitmap_id)
- goto osd_skip_upload;
-
need_upload = true;
VdpRGBAFormat format;
int format_size;
@@ -574,7 +570,6 @@ static void generate_osd_part(struct vo *vo, struct sub_bitmaps *imgs)
sfc->packer->used_height});
}
-osd_skip_upload:
if (sfc->surface == VDP_INVALID_HANDLE)
return;
if (sfc->packer->count > sfc->targets_size) {
@@ -610,8 +605,7 @@ osd_skip_upload:
sfc->render_count++;
}
- sfc->bitmap_id = imgs->bitmap_id;
- sfc->bitmap_pos_id = imgs->bitmap_pos_id;
+ sfc->change_id = imgs->change_id;
}
static void draw_osd_cb(void *ctx, struct sub_bitmaps *imgs)
diff --git a/video/out/vo_wayland.c b/video/out/vo_wayland.c
index 9da24ddf3e..c179bbe179 100644
--- a/video/out/vo_wayland.c
+++ b/video/out/vo_wayland.c
@@ -134,7 +134,7 @@ struct priv {
struct wl_subsurface *osd_subsurfaces[MAX_OSD_PARTS];
shm_buffer_t *osd_buffers[MAX_OSD_PARTS];
// this id tells us if the subtitle part has changed or not
- int bitmap_pos_id[MAX_OSD_PARTS];
+ int change_id[MAX_OSD_PARTS];
int64_t recent_flip_time; // last frame event
@@ -455,8 +455,8 @@ static void draw_osd_cb(void *ctx, struct sub_bitmaps *imgs)
struct wl_surface *s = p->osd_surfaces[id];
- if (imgs->bitmap_pos_id != p->bitmap_pos_id[id]) {
- p->bitmap_pos_id[id] = imgs->bitmap_pos_id;
+ if (imgs->change_id != p->change_id[id]) {
+ p->change_id[id] = imgs->change_id;
struct mp_rect bb;
if (!mp_sub_bitmaps_bb(imgs, &bb))