mirror of
https://github.com/mpv-player/mpv
synced 2025-01-11 09:29:29 +00:00
video/out: use new mp_msg stuff for vo.c and vo_opengl
The first step; also serves as example.
This commit is contained in:
parent
88d79fc00d
commit
03bef3adfd
@ -2345,7 +2345,7 @@ int reinit_video_chain(struct MPContext *mpctx)
|
||||
double ar = -1.0;
|
||||
//================== Init VIDEO (codec & libvo) ==========================
|
||||
if (!opts->fixed_vo || !(mpctx->initialized_flags & INITIALIZED_VO)) {
|
||||
mpctx->video_out = init_best_video_out(&opts->vo, mpctx->input,
|
||||
mpctx->video_out = init_best_video_out(mpctx->global, mpctx->input,
|
||||
mpctx->encode_lavc_ctx);
|
||||
if (!mpctx->video_out) {
|
||||
mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "Error opening/initializing "
|
||||
|
@ -984,7 +984,7 @@ bool mpgl_is_thread_safe(MPGLContext *ctx)
|
||||
return !!ctx->set_current;
|
||||
}
|
||||
|
||||
void mp_log_source(int mod, int lev, const char *src)
|
||||
void mp_log_source(struct mp_log *log, int lev, const char *src)
|
||||
{
|
||||
int line = 1;
|
||||
if (!src)
|
||||
@ -994,7 +994,7 @@ void mp_log_source(int mod, int lev, const char *src)
|
||||
const char *next = end + 1;
|
||||
if (!end)
|
||||
next = end = src + strlen(src);
|
||||
mp_msg(mod, lev, "[%3d] %.*s\n", line, (int)(end - src), src);
|
||||
mp_msg_log(log, lev, "[%3d] %.*s\n", line, (int)(end - src), src);
|
||||
line++;
|
||||
src = next;
|
||||
}
|
||||
|
@ -170,8 +170,8 @@ void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *),
|
||||
const char *ext2);
|
||||
|
||||
// print a multi line string with line numbers (e.g. for shader sources)
|
||||
// mod, lev: module and log level, as in mp_msg()
|
||||
void mp_log_source(int mod, int lev, const char *src);
|
||||
// log, lev: module and log level, as in mp_msg()
|
||||
void mp_log_source(struct mp_log *log, int lev, const char *src);
|
||||
|
||||
//function pointers loaded from the OpenGL library
|
||||
struct GL {
|
||||
|
@ -138,6 +138,7 @@ struct fbotex {
|
||||
struct gl_video {
|
||||
GL *gl;
|
||||
|
||||
struct mp_log *log;
|
||||
struct gl_video_opts opts;
|
||||
bool gl_debug;
|
||||
|
||||
@ -443,7 +444,7 @@ static bool fbotex_init(struct gl_video *p, struct fbotex *fbo, int w, int h,
|
||||
|
||||
tex_size(p, w, h, &fbo->tex_w, &fbo->tex_h);
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_V, "[gl] Create FBO: %dx%d\n", fbo->tex_w, fbo->tex_h);
|
||||
MP_VERBOSE(p, "Create FBO: %dx%d\n", fbo->tex_w, fbo->tex_h);
|
||||
|
||||
gl->GenFramebuffers(1, &fbo->fbo);
|
||||
gl->GenTextures(1, &fbo->texture);
|
||||
@ -457,8 +458,7 @@ static bool fbotex_init(struct gl_video *p, struct fbotex *fbo, int w, int h,
|
||||
GL_TEXTURE_2D, fbo->texture, 0);
|
||||
|
||||
if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "[gl] Error: framebuffer completeness "
|
||||
"check failed!\n");
|
||||
MP_ERR(p, "Error: framebuffer completeness check failed!\n");
|
||||
res = false;
|
||||
}
|
||||
|
||||
@ -629,9 +629,11 @@ static char *t_concat(void *talloc_ctx, const char *s1, const char *s2)
|
||||
return talloc_asprintf(talloc_ctx, "%s%s", s1, s2);
|
||||
}
|
||||
|
||||
static GLuint create_shader(GL *gl, GLenum type, const char *header,
|
||||
static GLuint create_shader(struct gl_video *p, GLenum type, const char *header,
|
||||
const char *source)
|
||||
{
|
||||
GL *gl = p->gl;
|
||||
|
||||
void *tmp = talloc_new(NULL);
|
||||
const char *full_source = t_concat(tmp, header, source);
|
||||
|
||||
@ -645,15 +647,15 @@ static GLuint create_shader(GL *gl, GLenum type, const char *header,
|
||||
|
||||
int pri = status ? (log_length > 1 ? MSGL_V : MSGL_DBG2) : MSGL_ERR;
|
||||
const char *typestr = type == GL_VERTEX_SHADER ? "vertex" : "fragment";
|
||||
if (mp_msg_test(MSGT_VO, pri)) {
|
||||
mp_msg(MSGT_VO, pri, "[gl] %s shader source:\n", typestr);
|
||||
mp_log_source(MSGT_VO, pri, full_source);
|
||||
if (mp_msg_test_log(p->log, pri)) {
|
||||
MP_MSG(p, pri, "%s shader source:\n", typestr);
|
||||
mp_log_source(p->log, pri, full_source);
|
||||
}
|
||||
if (log_length > 1) {
|
||||
GLchar *log = talloc_zero_size(tmp, log_length + 1);
|
||||
gl->GetShaderInfoLog(shader, log_length, NULL, log);
|
||||
mp_msg(MSGT_VO, pri, "[gl] %s shader compile log (status=%d):\n%s\n",
|
||||
typestr, status, log);
|
||||
GLchar *logstr = talloc_zero_size(tmp, log_length + 1);
|
||||
gl->GetShaderInfoLog(shader, log_length, NULL, logstr);
|
||||
MP_MSG(p, pri, "%s shader compile log (status=%d):\n%s\n",
|
||||
typestr, status, logstr);
|
||||
}
|
||||
|
||||
talloc_free(tmp);
|
||||
@ -661,16 +663,18 @@ static GLuint create_shader(GL *gl, GLenum type, const char *header,
|
||||
return shader;
|
||||
}
|
||||
|
||||
static void prog_create_shader(GL *gl, GLuint program, GLenum type,
|
||||
const char *header, const char *source)
|
||||
static void prog_create_shader(struct gl_video *p, GLuint program, GLenum type,
|
||||
const char *header, const char *source)
|
||||
{
|
||||
GLuint shader = create_shader(gl, type, header, source);
|
||||
GL *gl = p->gl;
|
||||
GLuint shader = create_shader(p, type, header, source);
|
||||
gl->AttachShader(program, shader);
|
||||
gl->DeleteShader(shader);
|
||||
}
|
||||
|
||||
static void link_shader(GL *gl, GLuint program)
|
||||
static void link_shader(struct gl_video *p, GLuint program)
|
||||
{
|
||||
GL *gl = p->gl;
|
||||
gl->LinkProgram(program);
|
||||
GLint status;
|
||||
gl->GetProgramiv(program, GL_LINK_STATUS, &status);
|
||||
@ -678,12 +682,11 @@ static void link_shader(GL *gl, GLuint program)
|
||||
gl->GetProgramiv(program, GL_INFO_LOG_LENGTH, &log_length);
|
||||
|
||||
int pri = status ? (log_length > 1 ? MSGL_V : MSGL_DBG2) : MSGL_ERR;
|
||||
if (mp_msg_test(MSGT_VO, pri)) {
|
||||
GLchar *log = talloc_zero_size(NULL, log_length + 1);
|
||||
gl->GetProgramInfoLog(program, log_length, NULL, log);
|
||||
mp_msg(MSGT_VO, pri, "[gl] shader link log (status=%d): %s\n",
|
||||
status, log);
|
||||
talloc_free(log);
|
||||
if (mp_msg_test_log(p->log, pri)) {
|
||||
GLchar *logstr = talloc_zero_size(NULL, log_length + 1);
|
||||
gl->GetProgramInfoLog(program, log_length, NULL, logstr);
|
||||
MP_MSG(p, pri, "shader link log (status=%d): %s\n", status, logstr);
|
||||
talloc_free(logstr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,18 +699,20 @@ static void bind_attrib_locs(GL *gl, GLuint program)
|
||||
|
||||
#define PRELUDE_END "// -- prelude end\n"
|
||||
|
||||
static GLuint create_program(GL *gl, const char *name, const char *header,
|
||||
const char *vertex, const char *frag)
|
||||
static GLuint create_program(struct gl_video *p, const char *name,
|
||||
const char *header, const char *vertex,
|
||||
const char *frag)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_V, "[gl] compiling shader program '%s', header:\n", name);
|
||||
GL *gl = p->gl;
|
||||
MP_VERBOSE(p, "compiling shader program '%s', header:\n", name);
|
||||
const char *real_header = strstr(header, PRELUDE_END);
|
||||
real_header = real_header ? real_header + strlen(PRELUDE_END) : header;
|
||||
mp_log_source(MSGT_VO, MSGL_V, real_header);
|
||||
mp_log_source(p->log, MSGL_V, real_header);
|
||||
GLuint prog = gl->CreateProgram();
|
||||
prog_create_shader(gl, prog, GL_VERTEX_SHADER, header, vertex);
|
||||
prog_create_shader(gl, prog, GL_FRAGMENT_SHADER, header, frag);
|
||||
prog_create_shader(p, prog, GL_VERTEX_SHADER, header, vertex);
|
||||
prog_create_shader(p, prog, GL_FRAGMENT_SHADER, header, frag);
|
||||
bind_attrib_locs(gl, prog);
|
||||
link_shader(gl, prog);
|
||||
link_shader(p, prog);
|
||||
return prog;
|
||||
}
|
||||
|
||||
@ -786,7 +791,7 @@ static void compile_shaders(struct gl_video *p)
|
||||
if (name) {
|
||||
char *s_osd = get_section(tmp, src, name);
|
||||
p->osd_programs[n] =
|
||||
create_program(gl, name, header_osd, vertex_shader, s_osd);
|
||||
create_program(p, name, header_osd, vertex_shader, s_osd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -883,7 +888,7 @@ static void compile_shaders(struct gl_video *p)
|
||||
shader_def_opt(&header_conv, "FIXED_SCALE", true);
|
||||
header_conv = t_concat(tmp, header, header_conv);
|
||||
p->indirect_program =
|
||||
create_program(gl, "indirect", header_conv, vertex_shader, s_video);
|
||||
create_program(p, "indirect", header_conv, vertex_shader, s_video);
|
||||
} else if (header_sep) {
|
||||
header_sep = t_concat(tmp, header_sep, header_conv);
|
||||
} else {
|
||||
@ -893,12 +898,12 @@ static void compile_shaders(struct gl_video *p)
|
||||
if (header_sep) {
|
||||
header_sep = t_concat(tmp, header, header_sep);
|
||||
p->scale_sep_program =
|
||||
create_program(gl, "scale_sep", header_sep, vertex_shader, s_video);
|
||||
create_program(p, "scale_sep", header_sep, vertex_shader, s_video);
|
||||
}
|
||||
|
||||
header_final = t_concat(tmp, header, header_final);
|
||||
p->final_program =
|
||||
create_program(gl, "final", header_final, vertex_shader, s_video);
|
||||
create_program(p, "final", header_final, vertex_shader, s_video);
|
||||
|
||||
debug_check_gl(p, "shader compilation");
|
||||
|
||||
@ -1017,7 +1022,7 @@ static void init_dither(struct gl_video *p)
|
||||
if (p->opts.dither_depth < 0 || p->opts.dither_algo < 0)
|
||||
return;
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_V, "[gl] Dither to %d.\n", dst_depth);
|
||||
MP_VERBOSE(p, "Dither to %d.\n", dst_depth);
|
||||
|
||||
int tex_size;
|
||||
void *tex_data;
|
||||
@ -1098,7 +1103,7 @@ static const char *expected_scaler(struct gl_video *p, int unit)
|
||||
|
||||
static void reinit_rendering(struct gl_video *p)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_V, "[gl] Reinit rendering.\n");
|
||||
MP_VERBOSE(p, "Reinit rendering.\n");
|
||||
|
||||
debug_check_gl(p, "before scaler initialization");
|
||||
|
||||
@ -1213,8 +1218,8 @@ static void init_video(struct gl_video *p)
|
||||
tex_size(p, plane->w, plane->h,
|
||||
&plane->tex_w, &plane->tex_h);
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_V, "[gl] Texture for plane %d: %dx%d\n",
|
||||
n, plane->tex_w, plane->tex_h);
|
||||
MP_VERBOSE(p, "Texture for plane %d: %dx%d\n",
|
||||
n, plane->tex_w, plane->tex_h);
|
||||
|
||||
gl->ActiveTexture(GL_TEXTURE0 + n);
|
||||
gl->GenTextures(1, &plane->gl_texture);
|
||||
@ -1451,8 +1456,8 @@ static void check_resize(struct gl_video *p)
|
||||
init_scaler(p, &p->scalers[1]);
|
||||
}
|
||||
if (too_small) {
|
||||
mp_msg(MSGT_VO, MSGL_WARN, "[gl] Can't downscale that much, window "
|
||||
"output may look suboptimal.\n");
|
||||
MP_WARN(p, "Can't downscale that much, window "
|
||||
"output may look suboptimal.\n");
|
||||
}
|
||||
|
||||
update_window_sized_objects(p);
|
||||
@ -1534,8 +1539,8 @@ void gl_video_upload_image(struct gl_video *p, struct mp_image *mpi)
|
||||
if (pbo) {
|
||||
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, plane->gl_buffer);
|
||||
if (!gl->UnmapBuffer(GL_PIXEL_UNPACK_BUFFER))
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Video PBO upload failed. "
|
||||
"Remove the 'pbo' suboption.\n");
|
||||
MP_FATAL(p, "Video PBO upload failed. "
|
||||
"Remove the 'pbo' suboption.\n");
|
||||
plane->buffer_ptr = NULL;
|
||||
plane_ptr = NULL; // PBO offset 0
|
||||
}
|
||||
@ -1663,7 +1668,7 @@ static bool test_fbo(struct gl_video *p, GLenum format)
|
||||
gl->ClearColor(val, 0.0f, 0.0f, 1.0f);
|
||||
gl->Clear(GL_COLOR_BUFFER_BIT);
|
||||
gl->ReadPixels(0, 0, 1, 1, GL_RED, GL_FLOAT, &pixel);
|
||||
mp_msg(MSGT_VO, MSGL_V, " %s: %a\n", val_names[i], val - pixel);
|
||||
MP_VERBOSE(p, " %s: %a\n", val_names[i], val - pixel);
|
||||
}
|
||||
gl->BindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glCheckError(gl, "after FBO read");
|
||||
@ -1691,7 +1696,7 @@ static void check_gl_features(struct gl_video *p)
|
||||
int n_disabled = 0;
|
||||
|
||||
if (have_fbo) {
|
||||
mp_msg(MSGT_VO, MSGL_V, "Testing user-set FBO format\n");
|
||||
MP_VERBOSE(p, "Testing user-set FBO format\n");
|
||||
have_fbo = test_fbo(p, p->opts.fbo_format);
|
||||
}
|
||||
|
||||
@ -1700,7 +1705,7 @@ static void check_gl_features(struct gl_video *p)
|
||||
p->use_lut_3d)
|
||||
{
|
||||
// doesn't disalbe anything; it's just for the log
|
||||
mp_msg(MSGT_VO, MSGL_V, "Testing GL_R16 FBO (dithering/LUT)\n");
|
||||
MP_VERBOSE(p, "Testing GL_R16 FBO (dithering/LUT)\n");
|
||||
test_fbo(p, GL_R16);
|
||||
}
|
||||
|
||||
@ -1739,14 +1744,14 @@ static void check_gl_features(struct gl_video *p)
|
||||
}
|
||||
|
||||
if (n_disabled) {
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "[gl] Some OpenGL extensions not detected, "
|
||||
MP_ERR(p, "Some OpenGL extensions not detected, "
|
||||
"disabling: ");
|
||||
for (int n = 0; n < n_disabled; n++) {
|
||||
if (n)
|
||||
mp_msg(MSGT_VO, MSGL_ERR, ", ");
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "%s", disabled[n]);
|
||||
MP_ERR(p, ", ");
|
||||
MP_ERR(p, "%s", disabled[n]);
|
||||
}
|
||||
mp_msg(MSGT_VO, MSGL_ERR, ".\n");
|
||||
MP_ERR(p, ".\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1964,15 +1969,16 @@ void gl_video_config(struct gl_video *p, struct mp_image_params *params)
|
||||
|
||||
void gl_video_set_output_depth(struct gl_video *p, int r, int g, int b)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_V, "[gl] Display depth: R=%d, G=%d, B=%d\n", r, g, b);
|
||||
MP_VERBOSE(p, "Display depth: R=%d, G=%d, B=%d\n", r, g, b);
|
||||
p->depth_g = g;
|
||||
}
|
||||
|
||||
struct gl_video *gl_video_init(GL *gl)
|
||||
struct gl_video *gl_video_init(GL *gl, struct mp_log *log)
|
||||
{
|
||||
struct gl_video *p = talloc_ptrtype(NULL, p);
|
||||
*p = (struct gl_video) {
|
||||
.gl = gl,
|
||||
.log = log,
|
||||
.opts = gl_video_opts_def,
|
||||
.gl_debug = true,
|
||||
.colorspace = MP_CSP_DETAILS_DEFAULTS,
|
||||
@ -2046,7 +2052,7 @@ bool gl_video_set_equalizer(struct gl_video *p, const char *name, int val)
|
||||
{
|
||||
if (mp_csp_equalizer_set(&p->video_eq, name, val) >= 0) {
|
||||
if (!p->opts.gamma && p->video_eq.values[MP_CSP_EQ_GAMMA] != 0) {
|
||||
mp_msg(MSGT_VO, MSGL_V, "[gl] Auto-enabling gamma.\n");
|
||||
MP_VERBOSE(p, "Auto-enabling gamma.\n");
|
||||
p->opts.gamma = true;
|
||||
compile_shaders(p);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ extern const struct m_sub_options gl_video_conf;
|
||||
|
||||
struct gl_video;
|
||||
|
||||
struct gl_video *gl_video_init(GL *gl);
|
||||
struct gl_video *gl_video_init(GL *gl, struct mp_log *log);
|
||||
void gl_video_uninit(struct gl_video *p);
|
||||
void gl_video_set_options(struct gl_video *p, struct gl_video_opts *opts);
|
||||
void gl_video_config(struct gl_video *p, struct mp_image_params *params);
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "core/input/input.h"
|
||||
#include "core/m_config.h"
|
||||
#include "core/mp_msg.h"
|
||||
#include "core/mpv_global.h"
|
||||
#include "video/mp_image.h"
|
||||
#include "video/vfcap.h"
|
||||
#include "sub/sub.h"
|
||||
@ -134,20 +135,24 @@ const struct m_obj_list vo_obj_list = {
|
||||
.allow_trailer = true,
|
||||
};
|
||||
|
||||
static struct vo *vo_create(struct mp_vo_opts *opts,
|
||||
static struct vo *vo_create(struct mpv_global *global,
|
||||
struct input_ctx *input_ctx,
|
||||
struct encode_lavc_context *encode_lavc_ctx,
|
||||
char *name, char **args)
|
||||
{
|
||||
struct mp_log *log = mp_log_new(NULL, global->log, "vo");
|
||||
struct m_obj_desc desc;
|
||||
if (!m_obj_list_find(&desc, &vo_obj_list, bstr0(name))) {
|
||||
mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Video output %s not found!\n", name);
|
||||
mp_tmsg_log(log, MSGL_ERR, "Video output %s not found!\n", name);
|
||||
talloc_free(log);
|
||||
return NULL;
|
||||
};
|
||||
struct vo *vo = talloc_ptrtype(NULL, vo);
|
||||
*vo = (struct vo) {
|
||||
.vo_log = { .log = talloc_steal(vo, log) },
|
||||
.log = mp_log_new(vo, log, name),
|
||||
.driver = desc.p,
|
||||
.opts = opts,
|
||||
.opts = &global->opts->vo,
|
||||
.encode_lavc_ctx = encode_lavc_ctx,
|
||||
.input_ctx = input_ctx,
|
||||
.event_fd = -1,
|
||||
@ -289,18 +294,18 @@ void vo_destroy(struct vo *vo)
|
||||
talloc_free(vo);
|
||||
}
|
||||
|
||||
struct vo *init_best_video_out(struct mp_vo_opts *opts,
|
||||
struct vo *init_best_video_out(struct mpv_global *global,
|
||||
struct input_ctx *input_ctx,
|
||||
struct encode_lavc_context *encode_lavc_ctx)
|
||||
{
|
||||
struct m_obj_settings *vo_list = opts->video_driver_list;
|
||||
struct m_obj_settings *vo_list = global->opts->vo.video_driver_list;
|
||||
// first try the preferred drivers, with their optional subdevice param:
|
||||
if (vo_list && vo_list[0].name) {
|
||||
for (int n = 0; vo_list[n].name; n++) {
|
||||
// Something like "-vo name," allows fallback to autoprobing.
|
||||
if (strlen(vo_list[n].name) == 0)
|
||||
goto autoprobe;
|
||||
struct vo *vo = vo_create(opts, input_ctx, encode_lavc_ctx,
|
||||
struct vo *vo = vo_create(global, input_ctx, encode_lavc_ctx,
|
||||
vo_list[n].name, vo_list[n].attribs);
|
||||
if (vo)
|
||||
return vo;
|
||||
@ -310,7 +315,7 @@ struct vo *init_best_video_out(struct mp_vo_opts *opts,
|
||||
autoprobe:
|
||||
// now try the rest...
|
||||
for (int i = 0; video_out_drivers[i]; i++) {
|
||||
struct vo *vo = vo_create(opts, input_ctx, encode_lavc_ctx,
|
||||
struct vo *vo = vo_create(global, input_ctx, encode_lavc_ctx,
|
||||
(char *)video_out_drivers[i]->info->short_name, NULL);
|
||||
if (vo)
|
||||
return vo;
|
||||
@ -444,24 +449,22 @@ int lookup_keymap_table(const struct mp_keymap *map, int key) {
|
||||
static void print_video_rect(struct vo *vo, struct mp_rect src,
|
||||
struct mp_rect dst, struct mp_osd_res osd)
|
||||
{
|
||||
int lv = MSGL_V;
|
||||
|
||||
int sw = src.x1 - src.x0, sh = src.y1 - src.y0;
|
||||
int dw = dst.x1 - dst.x0, dh = dst.y1 - dst.y0;
|
||||
|
||||
mp_msg(MSGT_VO, lv, "[vo] Window size: %dx%d\n",
|
||||
vo->dwidth, vo->dheight);
|
||||
mp_msg(MSGT_VO, lv, "[vo] Video source: %dx%d (%dx%d)\n",
|
||||
vo->aspdat.orgw, vo->aspdat.orgh,
|
||||
vo->aspdat.prew, vo->aspdat.preh);
|
||||
mp_msg(MSGT_VO, lv, "[vo] Video display: (%d, %d) %dx%d -> (%d, %d) %dx%d\n",
|
||||
src.x0, src.y0, sw, sh, dst.x0, dst.y0, dw, dh);
|
||||
mp_msg(MSGT_VO, lv, "[vo] Video scale: %f/%f\n",
|
||||
(double)dw / sw, (double)dh / sh);
|
||||
mp_msg(MSGT_VO, lv, "[vo] OSD borders: l=%d t=%d r=%d b=%d\n",
|
||||
osd.ml, osd.mt, osd.mr, osd.mb);
|
||||
mp_msg(MSGT_VO, lv, "[vo] Video borders: l=%d t=%d r=%d b=%d\n",
|
||||
dst.x0, dst.y0, vo->dwidth - dst.x1, vo->dheight - dst.y1);
|
||||
MP_VERBOSE(&vo->vo_log, "Window size: %dx%d\n",
|
||||
vo->dwidth, vo->dheight);
|
||||
MP_VERBOSE(&vo->vo_log, "Video source: %dx%d (%dx%d)\n",
|
||||
vo->aspdat.orgw, vo->aspdat.orgh,
|
||||
vo->aspdat.prew, vo->aspdat.preh);
|
||||
MP_VERBOSE(&vo->vo_log, "Video display: (%d, %d) %dx%d -> (%d, %d) %dx%d\n",
|
||||
src.x0, src.y0, sw, sh, dst.x0, dst.y0, dw, dh);
|
||||
MP_VERBOSE(&vo->vo_log, "Video scale: %f/%f\n",
|
||||
(double)dw / sw, (double)dh / sh);
|
||||
MP_VERBOSE(&vo->vo_log, "OSD borders: l=%d t=%d r=%d b=%d\n",
|
||||
osd.ml, osd.mt, osd.mr, osd.mb);
|
||||
MP_VERBOSE(&vo->vo_log, "Video borders: l=%d t=%d r=%d b=%d\n",
|
||||
dst.x0, dst.y0, vo->dwidth - dst.x1, vo->dheight - dst.y1);
|
||||
}
|
||||
|
||||
// Clamp [start, end) to range [0, size) with various fallbacks.
|
||||
|
@ -232,8 +232,12 @@ struct vo_driver {
|
||||
};
|
||||
|
||||
struct vo {
|
||||
int config_ok; // Last config call was successful?
|
||||
int config_count; // Total number of successful config calls
|
||||
struct {
|
||||
struct mp_log *log; // Using "[vo]" as prefix
|
||||
} vo_log;
|
||||
struct mp_log *log; // Using e.g. "[vo/vdpau]" as prefix
|
||||
int config_ok; // Last config call was successful?
|
||||
int config_count; // Total number of successful config calls
|
||||
|
||||
bool untimed; // non-interactive, don't do sleep calls in playloop
|
||||
|
||||
@ -281,7 +285,8 @@ struct vo {
|
||||
char *window_title;
|
||||
};
|
||||
|
||||
struct vo *init_best_video_out(struct mp_vo_opts *opts,
|
||||
struct mpv_global;
|
||||
struct vo *init_best_video_out(struct mpv_global *global,
|
||||
struct input_ctx *input_ctx,
|
||||
struct encode_lavc_context *encode_lavc_ctx);
|
||||
int vo_reconfig(struct vo *vo, struct mp_image_params *p, int flags);
|
||||
|
@ -75,7 +75,7 @@ static void resize(struct gl_priv *p)
|
||||
{
|
||||
struct vo *vo = p->vo;
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n", vo->dwidth, vo->dheight);
|
||||
MP_VERBOSE(vo, "Resize: %dx%d\n", vo->dwidth, vo->dheight);
|
||||
|
||||
struct mp_rect wnd = {0, 0, vo->dwidth, vo->dheight};
|
||||
struct mp_rect src, dst;
|
||||
@ -319,7 +319,7 @@ static int preinit(struct vo *vo)
|
||||
if (p->gl->SwapInterval)
|
||||
p->gl->SwapInterval(p->swap_interval);
|
||||
|
||||
p->renderer = gl_video_init(p->gl);
|
||||
p->renderer = gl_video_init(p->gl, vo->log);
|
||||
gl_video_set_output_depth(p->renderer, p->glctx->depth_r, p->glctx->depth_g,
|
||||
p->glctx->depth_b);
|
||||
gl_video_set_options(p->renderer, p->renderer_opts);
|
||||
|
Loading…
Reference in New Issue
Block a user