diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h index 2b6430482d..7ae361f389 100644 --- a/include/vlc_opengl.h +++ b/include/vlc_opengl.h @@ -24,6 +24,8 @@ #ifndef VLC_GL_H #define VLC_GL_H 1 +#include + # ifdef __cplusplus extern "C" { # endif @@ -108,12 +110,13 @@ struct vlc_gl_t struct { /* off-screen */ vlc_fourcc_t offscreen_chroma_out; struct vlc_video_context *offscreen_vctx_out; - /* Flag to indicate if the OpenGL implementation produces upside-down - * pictures */ - bool offscreen_vflip; }; }; + /* Orientation that signals how the content should be generated by + * the client of the OpenGL provider. */ + video_orientation_t orientation; + /* Defined by the core for libvlc_opengl API loading. */ enum vlc_gl_api_type api_type; diff --git a/modules/video_filter/egl_pbuffer.c b/modules/video_filter/egl_pbuffer.c index 5dee1e82b0..9c9f5c4582 100644 --- a/modules/video_filter/egl_pbuffer.c +++ b/modules/video_filter/egl_pbuffer.c @@ -437,7 +437,7 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height, .close = Close, }; gl->ops = &gl_ops; - gl->offscreen_vflip = true; + gl->orientation = ORIENT_VFLIPPED; eglMakeCurrent(sys->display, sys->surface, sys->surface, sys->context); diff --git a/modules/video_filter/opengl.c b/modules/video_filter/opengl.c index 7065777481..f3ffa40228 100644 --- a/modules/video_filter/opengl.c +++ b/modules/video_filter/opengl.c @@ -248,7 +248,7 @@ static int Open( vlc_object_t *obj ) } free(glfilters_config); - if (sys->gl->offscreen_vflip) + if (sys->gl->orientation == ORIENT_VFLIPPED) { /* OpenGL renders upside-down, add a filter to get the pixels in the * normal orientation */ diff --git a/modules/video_output/apple/VLCCVOpenGLProvider.m b/modules/video_output/apple/VLCCVOpenGLProvider.m index bf4e06601f..27e202d7ca 100644 --- a/modules/video_output/apple/VLCCVOpenGLProvider.m +++ b/modules/video_output/apple/VLCCVOpenGLProvider.m @@ -355,7 +355,7 @@ static void FreeCVBuffer(picture_t *picture) .close = Close, }; gl->ops = &gl_ops; - gl->offscreen_vflip = true; + gl->orientation = ORIENT_VFLIPPED; gl->offscreen_vctx_out = _vctx_out; gl->offscreen_chroma_out = VLC_CODEC_CVPX_BGRA; diff --git a/src/video_output/opengl.c b/src/video_output/opengl.c index 963128a186..a85c8e8b9f 100644 --- a/src/video_output/opengl.c +++ b/src/video_output/opengl.c @@ -89,6 +89,7 @@ vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg, vlc_gl_t *gl = &glpriv->gl; gl->api_type = api_type; + gl->orientation = ORIENT_NORMAL; gl->surface = wnd; gl->device = NULL; @@ -144,9 +145,9 @@ vlc_gl_t *vlc_gl_CreateOffscreen(vlc_object_t *parent, vlc_gl_t *gl = &glpriv->gl; gl->api_type = api_type; + gl->orientation = ORIENT_NORMAL; gl->offscreen_chroma_out = VLC_CODEC_UNKNOWN; - gl->offscreen_vflip = false; gl->offscreen_vctx_out = NULL; gl->surface = NULL;