1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-25 04:38:01 +00:00

gl_osd: mp_msg conversion

This commit is contained in:
wm4 2013-09-12 01:33:33 +02:00
parent 3a9c5ef687
commit 1061f43a2f
5 changed files with 11 additions and 10 deletions

View File

@ -45,13 +45,14 @@ static const struct osd_fmt_entry osd_to_gl_legacy_formats[SUBBITMAP_COUNT] = {
[SUBBITMAP_RGBA] = {GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE},
};
struct mpgl_osd *mpgl_osd_init(GL *gl, bool legacy)
struct mpgl_osd *mpgl_osd_init(GL *gl, struct mp_log *log, bool legacy)
{
GLint max_texture_size;
gl->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
struct mpgl_osd *ctx = talloc_ptrtype(NULL, ctx);
*ctx = (struct mpgl_osd) {
.log = log,
.gl = gl,
.fmt_table = legacy ? osd_to_gl_legacy_formats : osd_to_gl3_formats,
.scratch = talloc_zero_size(ctx, 1),
@ -121,8 +122,8 @@ static bool upload_pbo(struct mpgl_osd *ctx, struct mpgl_osd_part *osd,
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
if (!success) {
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Error: can't upload subtitles! "
"Remove the 'pbo' suboption.\n");
MP_FATAL(ctx, "Error: can't upload subtitles! "
"Remove the 'pbo' suboption.\n");
}
return success;
@ -157,9 +158,8 @@ static bool upload_osd(struct mpgl_osd *ctx, struct mpgl_osd_part *osd,
osd->packer->padding = ctx->scaled || imgs->scaled;
int r = packer_pack_from_subbitmaps(osd->packer, imgs);
if (r < 0) {
mp_msg(MSGT_VO, MSGL_ERR, "[gl] OSD bitmaps do not fit on "
"a surface with the maximum supported size %dx%d.\n",
osd->packer->w_max, osd->packer->h_max);
MP_ERR(ctx, "OSD bitmaps do not fit on a surface with the maximum "
"supported size %dx%d.\n", osd->packer->w_max, osd->packer->h_max);
return false;
}

View File

@ -20,6 +20,7 @@ struct mpgl_osd_part {
};
struct mpgl_osd {
struct mp_log *log;
GL *gl;
bool use_pbo;
bool scaled;
@ -29,7 +30,7 @@ struct mpgl_osd {
void *scratch;
};
struct mpgl_osd *mpgl_osd_init(GL *gl, bool legacy);
struct mpgl_osd *mpgl_osd_init(GL *gl, struct mp_log *log, bool legacy);
void mpgl_osd_destroy(struct mpgl_osd *ctx);
void mpgl_osd_set_gl_state(struct mpgl_osd *ctx, struct mpgl_osd_part *p);

View File

@ -1083,7 +1083,7 @@ static void recreate_osd(struct gl_video *p)
{
if (p->osd)
mpgl_osd_destroy(p->osd);
p->osd = mpgl_osd_init(p->gl, false);
p->osd = mpgl_osd_init(p->gl, p->log, false);
p->osd->use_pbo = p->opts.pbo;
}

View File

@ -130,7 +130,7 @@ static int init_gl(struct vo *vo, uint32_t d_width, uint32_t d_height)
gl->TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (!p->osd)
p->osd = mpgl_osd_init(gl, true);
p->osd = mpgl_osd_init(gl, vo->log, true);
resize(vo);

View File

@ -1693,7 +1693,7 @@ static int initGl(struct vo *vo, uint32_t d_width, uint32_t d_height)
}
if (gl->BindTexture) {
p->osd = mpgl_osd_init(gl, true);
p->osd = mpgl_osd_init(gl, vo->log, true);
p->osd->scaled = p->scaled_osd;
}