Browse Source

opengl: expose orientation instead of vflip

Like in the D3D11 implementation, any OpenGL implementation and
especially those coming from the user might ask a specific rendering
orientation to remove the need to rotate the image after it has been
done by the renderer.

In particular, the libvlc output callback allows any orientation to be
supplied by the user, but was currently ignored in release and was
asserting in debug because it didn't support that.

This commit changes the definition and usage of the opengl (offscreen)
providers to expose a format instead. It is now also exposed for
on-screen implementations also.
pull/162/head
Alexandre Janniaux 3 years ago
committed by Steve Lhomme
parent
commit
a64afdae2c
  1. 9
      include/vlc_opengl.h
  2. 2
      modules/video_filter/egl_pbuffer.c
  3. 2
      modules/video_filter/opengl.c
  4. 2
      modules/video_output/apple/VLCCVOpenGLProvider.m
  5. 3
      src/video_output/opengl.c

9
include/vlc_opengl.h

@ -24,6 +24,8 @@
#ifndef VLC_GL_H
#define VLC_GL_H 1
#include <vlc_es.h>
# 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;

2
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);

2
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 */

2
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;

3
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;

Loading…
Cancel
Save