mirror of
https://github.com/mpv-player/mpv
synced 2025-04-07 01:53:06 +00:00
vo_opengl: simplify
After recent changes, there is no reason why gl_video_set_image() should exist anymore. So merge it back into gl_video_upload_image().
This commit is contained in:
parent
27708eee81
commit
423a1a0f6c
@ -109,7 +109,6 @@ struct texplane {
|
|||||||
struct video_image {
|
struct video_image {
|
||||||
struct texplane planes[4];
|
struct texplane planes[4];
|
||||||
bool image_flipped;
|
bool image_flipped;
|
||||||
bool needs_upload;
|
|
||||||
struct mp_image *mpi; // original input image
|
struct mp_image *mpi; // original input image
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -484,8 +483,7 @@ static void uninit_rendering(struct gl_video *p);
|
|||||||
static void uninit_scaler(struct gl_video *p, struct scaler *scaler);
|
static void uninit_scaler(struct gl_video *p, struct scaler *scaler);
|
||||||
static void check_gl_features(struct gl_video *p);
|
static void check_gl_features(struct gl_video *p);
|
||||||
static bool init_format(int fmt, struct gl_video *init);
|
static bool init_format(int fmt, struct gl_video *init);
|
||||||
static void gl_video_upload_image(struct gl_video *p);
|
static void gl_video_upload_image(struct gl_video *p, struct mp_image *mpi);
|
||||||
static void gl_video_set_image(struct gl_video *p, struct mp_image *mpi);
|
|
||||||
|
|
||||||
#define GLSL(x) gl_sc_add(p->sc, #x "\n");
|
#define GLSL(x) gl_sc_add(p->sc, #x "\n");
|
||||||
#define GLSLF(...) gl_sc_addf(p->sc, __VA_ARGS__)
|
#define GLSLF(...) gl_sc_addf(p->sc, __VA_ARGS__)
|
||||||
@ -1984,10 +1982,8 @@ static void pass_draw_osd(struct gl_video *p, int draw_flags, double pts,
|
|||||||
// upscaling
|
// upscaling
|
||||||
static void pass_render_frame(struct gl_video *p, struct mp_image *img)
|
static void pass_render_frame(struct gl_video *p, struct mp_image *img)
|
||||||
{
|
{
|
||||||
if (img) {
|
if (img)
|
||||||
gl_video_set_image(p, img);
|
gl_video_upload_image(p, img);
|
||||||
gl_video_upload_image(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
p->use_linear = p->opts.linear_scaling || p->opts.sigmoid_upscaling;
|
p->use_linear = p->opts.linear_scaling || p->opts.sigmoid_upscaling;
|
||||||
p->use_indirect = false; // set to true as needed by pass_*
|
p->use_indirect = false; // set to true as needed by pass_*
|
||||||
@ -2327,34 +2323,23 @@ static bool get_image(struct gl_video *p, struct mp_image *mpi)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl_video_set_image(struct gl_video *p, struct mp_image *mpi)
|
static void gl_video_upload_image(struct gl_video *p, struct mp_image *mpi)
|
||||||
{
|
|
||||||
assert(mpi);
|
|
||||||
|
|
||||||
struct video_image *vimg = &p->image;
|
|
||||||
talloc_free(vimg->mpi);
|
|
||||||
vimg->mpi = mp_image_new_ref(mpi);
|
|
||||||
vimg->needs_upload = true;
|
|
||||||
|
|
||||||
if (!vimg->mpi)
|
|
||||||
abort();
|
|
||||||
|
|
||||||
p->osd_pts = mpi->pts;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gl_video_upload_image(struct gl_video *p)
|
|
||||||
{
|
{
|
||||||
GL *gl = p->gl;
|
GL *gl = p->gl;
|
||||||
|
|
||||||
struct video_image *vimg = &p->image;
|
struct video_image *vimg = &p->image;
|
||||||
struct mp_image *mpi = vimg->mpi;
|
|
||||||
|
|
||||||
if (p->hwdec_active || !mpi || !vimg->needs_upload)
|
mpi = mp_image_new_ref(mpi);
|
||||||
return;
|
if (!mpi)
|
||||||
|
abort();
|
||||||
|
|
||||||
vimg->needs_upload = false;
|
talloc_free(vimg->mpi);
|
||||||
|
vimg->mpi = mpi;
|
||||||
|
p->osd_pts = mpi->pts;
|
||||||
p->frames_uploaded++;
|
p->frames_uploaded++;
|
||||||
|
|
||||||
|
if (p->hwdec_active)
|
||||||
|
return;
|
||||||
|
|
||||||
assert(mpi->num_planes == p->plane_count);
|
assert(mpi->num_planes == p->plane_count);
|
||||||
|
|
||||||
mp_image_t mpi2 = *mpi;
|
mp_image_t mpi2 = *mpi;
|
||||||
|
Loading…
Reference in New Issue
Block a user