summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-07-15 12:22:49 +0200
committerwm4 <wm4@nowhere>2015-07-15 12:22:49 +0200
commit423a1a0f6c83419cb34f08a59ed46169e10c20da (patch)
treeb31cc5c5b26298e24d3eeda37abc3966f4d8755f
parent27708eee81eebe8b59f24aa5117efdcc8b4e2674 (diff)
downloadmpv-423a1a0f6c83419cb34f08a59ed46169e10c20da.tar.bz2
mpv-423a1a0f6c83419cb34f08a59ed46169e10c20da.tar.xz
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().
-rw-r--r--video/out/gl_video.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 3dc066628b..e1d9c0e7a1 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -109,7 +109,6 @@ struct texplane {
struct video_image {
struct texplane planes[4];
bool image_flipped;
- bool needs_upload;
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 check_gl_features(struct gl_video *p);
static bool init_format(int fmt, struct gl_video *init);
-static void gl_video_upload_image(struct gl_video *p);
-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);
#define GLSL(x) gl_sc_add(p->sc, #x "\n");
#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
static void pass_render_frame(struct gl_video *p, struct mp_image *img)
{
- if (img) {
- gl_video_set_image(p, img);
- gl_video_upload_image(p);
- }
+ if (img)
+ gl_video_upload_image(p, img);
p->use_linear = p->opts.linear_scaling || p->opts.sigmoid_upscaling;
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;
}
-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);
-
+ GL *gl = p->gl;
struct video_image *vimg = &p->image;
- talloc_free(vimg->mpi);
- vimg->mpi = mp_image_new_ref(mpi);
- vimg->needs_upload = true;
- if (!vimg->mpi)
+ mpi = mp_image_new_ref(mpi);
+ if (!mpi)
abort();
+ talloc_free(vimg->mpi);
+ vimg->mpi = mpi;
p->osd_pts = mpi->pts;
-}
-
-static void gl_video_upload_image(struct gl_video *p)
-{
- GL *gl = p->gl;
-
- struct video_image *vimg = &p->image;
- struct mp_image *mpi = vimg->mpi;
+ p->frames_uploaded++;
- if (p->hwdec_active || !mpi || !vimg->needs_upload)
+ if (p->hwdec_active)
return;
- vimg->needs_upload = false;
- p->frames_uploaded++;
-
assert(mpi->num_planes == p->plane_count);
mp_image_t mpi2 = *mpi;