[vlc-devel] [PATCH 1/3] vout: fail if the display module can't handle the projection_mode
Thomas Guillem
thomas at gllm.fr
Wed Nov 16 17:59:33 CET 2016
---
include/vlc_vout_display.h | 19 +++++++++++++++++++
modules/codec/omxil/vout.c | 3 +++
modules/hw/mmal/vout.c | 2 +-
modules/hw/vdpau/display.c | 4 ++++
modules/video_output/aa.c | 3 +++
modules/video_output/android/android_window.c | 2 +-
modules/video_output/caca.c | 2 +-
modules/video_output/caopengllayer.m | 3 +++
modules/video_output/decklink.cpp | 3 +++
modules/video_output/directfb.c | 2 +-
modules/video_output/evas.c | 2 +-
modules/video_output/fb.c | 2 +-
modules/video_output/flaschen.c | 3 +++
modules/video_output/kva.c | 3 +++
modules/video_output/sdl.c | 2 +-
modules/video_output/win32/direct2d.c | 3 +++
modules/video_output/win32/direct3d11.c | 3 +++
modules/video_output/win32/direct3d9.c | 3 +++
modules/video_output/win32/directdraw.c | 3 +++
modules/video_output/win32/wingdi.c | 3 +++
modules/video_output/xcb/x11.c | 4 ++++
modules/video_output/xcb/xvideo.c | 3 +++
22 files changed, 70 insertions(+), 7 deletions(-)
diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index 04a265a..9092261 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -424,6 +424,25 @@ static inline bool vout_display_IsWindowed(vout_display_t *vd)
}
/**
+ * Helper function that can be used by vout display modules that doesn't handle
+ * a non flat vd->fmt.projection_mode.
+ *
+ * If the current module is forced, this function will return true and the
+ * projection will be forced to PROJECTION_MODE_RECTANGULAR.
+ *
+ * \return false if the module should fail
+ */
+static inline bool vout_display_FlatSource(vout_display_t *vd)
+{
+ if (vd->obj.force)
+ {
+ vd->fmt.projection_mode = PROJECTION_MODE_RECTANGULAR;
+ return true;
+ } else
+ return vd->fmt.projection_mode == PROJECTION_MODE_RECTANGULAR;
+}
+
+/**
* Computes the default display size given the source and
* the display configuration.
*
diff --git a/modules/codec/omxil/vout.c b/modules/codec/omxil/vout.c
index 4e923ad..3f61e4c 100644
--- a/modules/codec/omxil/vout.c
+++ b/modules/codec/omxil/vout.c
@@ -151,6 +151,9 @@ static int Open(vlc_object_t *p_this)
picture_t** pictures = NULL;
OMX_PARAM_PORTDEFINITIONTYPE *def;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
static OMX_CALLBACKTYPE callbacks =
{ OmxEventHandler, OmxEmptyBufferDone, OmxFillBufferDone };
diff --git a/modules/hw/mmal/vout.c b/modules/hw/mmal/vout.c
index 8c7bc1f..7a04a43 100644
--- a/modules/hw/mmal/vout.c
+++ b/modules/hw/mmal/vout.c
@@ -185,7 +185,7 @@ static int Open(vlc_object_t *object)
int ret = VLC_SUCCESS;
unsigned i;
- if (vout_display_IsWindowed(vd))
+ if (!vout_display_FlatSource(vd) || vout_display_IsWindowed(vd))
return VLC_EGENERIC;
sys = calloc(1, sizeof(struct vout_display_sys_t));
diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index b1d17a8..f16966b 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -426,6 +426,10 @@ static int Open(vlc_object_t *obj)
return VLC_EGENERIC;
vout_display_t *vd = (vout_display_t *)obj;
+
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
vout_display_sys_t *sys = malloc(sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
diff --git a/modules/video_output/aa.c b/modules/video_output/aa.c
index 26f7575..22baaa7 100644
--- a/modules/video_output/aa.c
+++ b/modules/video_output/aa.c
@@ -90,6 +90,9 @@ static int Open(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
#ifndef _WIN32
if (!vlc_xlib_init (object))
return VLC_EGENERIC;
diff --git a/modules/video_output/android/android_window.c b/modules/video_output/android/android_window.c
index 03e51ef..2b6836d 100644
--- a/modules/video_output/android/android_window.c
+++ b/modules/video_output/android/android_window.c
@@ -656,7 +656,7 @@ static int Open(vlc_object_t *p_this)
vout_display_sys_t *sys;
video_format_t sub_fmt;
- if (vout_display_IsWindowed(vd))
+ if (!vout_display_FlatSource(vd) || vout_display_IsWindowed(vd))
return VLC_EGENERIC;
/* Allocate structure */
diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c
index c082ef3..febeb78 100644
--- a/modules/video_output/caca.c
+++ b/modules/video_output/caca.c
@@ -88,7 +88,7 @@ static int Open(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
- if (vout_display_IsWindowed(vd))
+ if (!vout_display_FlatSource(vd) || vout_display_IsWindowed(vd))
return VLC_EGENERIC;
#if !defined(__APPLE__) && !defined(_WIN32)
# ifndef X_DISPLAY_MISSING
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index 1be3ee6..ec16d98 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -117,6 +117,9 @@ static int Open (vlc_object_t *p_this)
vout_display_t *vd = (vout_display_t *)p_this;
vout_display_sys_t *sys;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
/* Allocate structure */
vd->sys = sys = calloc(1, sizeof(vout_display_sys_t));
if (sys == NULL)
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index eb98bc7..57c8290 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -910,6 +910,9 @@ static int OpenVideo(vlc_object_t *p_this)
vout_display_sys_t *sys;
struct decklink_sys_t *decklink_sys;
+ if (vout_display_IsWindowed(vd))
+ return VLC_EGENERIC;
+
vd->sys = sys = (vout_display_sys_t*)malloc(sizeof(*sys));
if (!sys)
return VLC_ENOMEM;
diff --git a/modules/video_output/directfb.c b/modules/video_output/directfb.c
index 26fa047..5632ab9 100644
--- a/modules/video_output/directfb.c
+++ b/modules/video_output/directfb.c
@@ -76,7 +76,7 @@ static int Open(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
- if (vout_display_IsWindowed(vd))
+ if (!vout_display_FlatSource(vd) || vout_display_IsWindowed(vd))
return VLC_EGENERIC;
vd->sys = sys = calloc(1, sizeof(*sys));
diff --git a/modules/video_output/evas.c b/modules/video_output/evas.c
index b38c6b5..1653aa2 100644
--- a/modules/video_output/evas.c
+++ b/modules/video_output/evas.c
@@ -856,7 +856,7 @@ Open( vlc_object_t *p_this )
vout_display_sys_t *sys;
Evas_Object *p_evas;
- if( vout_display_IsWindowed( vd ) )
+ if( !vout_display_FlatSource( vd ) || vout_display_IsWindowed( vd ) )
return VLC_EGENERIC;
p_evas = var_InheritAddress( p_this, "drawable-evasobject" );
diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index cf6c2a7..5c93fd7 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -176,7 +176,7 @@ static int Open(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
- if (vout_display_IsWindowed(vd))
+ if (!vout_display_FlatSource(vd) || vout_display_IsWindowed(vd))
return VLC_EGENERIC;
/* Allocate instance and initialize some members */
diff --git a/modules/video_output/flaschen.c b/modules/video_output/flaschen.c
index 2eeffab..f45e384 100644
--- a/modules/video_output/flaschen.c
+++ b/modules/video_output/flaschen.c
@@ -91,6 +91,9 @@ static int Open(vlc_object_t *object)
int fd;
unsigned port = 1337;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
vd->sys = sys = calloc(1, sizeof(*sys));
if (!sys)
return VLC_ENOMEM;
diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index eb9aed4..9880c1c 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -323,6 +323,9 @@ static int Open ( vlc_object_t *object )
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
+ if( vout_display_IsWindowed( vd ) )
+ return VLC_EGENERIC;
+
vd->sys = sys = calloc( 1, sizeof( *sys ));
if( !sys )
return VLC_ENOMEM;
diff --git a/modules/video_output/sdl.c b/modules/video_output/sdl.c
index 44992b7..7e81c50 100644
--- a/modules/video_output/sdl.c
+++ b/modules/video_output/sdl.c
@@ -121,7 +121,7 @@ static int Open(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
- if (vout_display_IsWindowed(vd))
+ if (!vout_display_FlatSource(vd) || vout_display_IsWindowed(vd))
return VLC_EGENERIC;
#if !defined(_WIN32) && !defined(__OS2__)
if (!vlc_xlib_init (object))
diff --git a/modules/video_output/win32/direct2d.c b/modules/video_output/win32/direct2d.c
index 0e489b8..4698f6a 100644
--- a/modules/video_output/win32/direct2d.c
+++ b/modules/video_output/win32/direct2d.c
@@ -83,6 +83,9 @@ static int Open(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
vd->sys = sys = calloc(1, sizeof(*sys));
if (!sys)
return VLC_ENOMEM;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 23703b9..bbeccfa 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -487,6 +487,9 @@ static int Open(vlc_object_t *object)
{
vout_display_t *vd = (vout_display_t *)object;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
#if !VLC_WINSTORE_APP
int ret = OpenHwnd(vd);
#else
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 6800e9a..b2af589 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -173,6 +173,9 @@ static int Open(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
OSVERSIONINFO winVer;
winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if(GetVersionEx(&winVer) && winVer.dwMajorVersion < 6 && !object->obj.force)
diff --git a/modules/video_output/win32/directdraw.c b/modules/video_output/win32/directdraw.c
index c2f5eea..4999da8 100644
--- a/modules/video_output/win32/directdraw.c
+++ b/modules/video_output/win32/directdraw.c
@@ -166,6 +166,9 @@ static int Open(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
/* Allocate structure */
vd->sys = sys = calloc(1, sizeof(*sys));
if (!sys)
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index ea4b237..5f78292 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -72,6 +72,9 @@ static int Open(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
vd->sys = sys = calloc(1, sizeof(*sys));
if (!sys)
return VLC_ENOMEM;
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 7117881..bdf8af8 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -105,6 +105,10 @@ static const xcb_depth_t *FindDepth (const xcb_screen_t *scr,
static int Open (vlc_object_t *obj)
{
vout_display_t *vd = (vout_display_t *)obj;
+
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
vout_display_sys_t *sys = malloc (sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index dde4f33..4024ca0 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -355,6 +355,9 @@ static int Open (vlc_object_t *obj)
vout_display_t *vd = (vout_display_t *)obj;
vout_display_sys_t *p_sys;
+ if (!vout_display_FlatSource(vd))
+ return VLC_EGENERIC;
+
{ /* NOTE: Reject hardware surface formats. Blending would break. */
const vlc_chroma_description_t *chroma =
vlc_fourcc_GetChromaDescription(vd->source.i_chroma);
--
2.9.3
More information about the vlc-devel
mailing list