Commit 4eb03cdc authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove old GLX plugin

parent 439eed0f
......@@ -3642,27 +3642,6 @@ dnl Check for DPMS
])
])
dnl
dnl GLX module
dnl (enabled by default except on win32)
dnl
AC_ARG_ENABLE(glx,
[ --enable-glx X11 OpenGL (GLX) support (default enabled)],, [
enable_glx="$enable_x11"
])
AS_IF([test "${enable_glx}" != "no"], [
AC_CHECK_HEADERS(X11/Xlib.h GL/glu.h GL/glx.h)
AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
[[#if !defined(HAVE_X11_XLIB_H) || !defined(HAVE_GL_GLU_H) || !defined(HAVE_GL_GLX_H)
choke me
#endif]]),
[
VLC_ADD_PLUGIN([glx])
VLC_ADD_LIBS([glx],[${X_LIBS} ${X_PRE_LIBS} -lX11 -lXext -lGL -lGLU])
VLC_ADD_CPPFLAGS([glx],[${X_CFLAGS}])
],[AC_MSG_ERROR([Please install GL development package. Alternatively you can also configure with --disable-glx.])])
])
dnl End of Xlib tests
CPPFLAGS="${CPPFLAGS_save}"
......@@ -5338,7 +5317,6 @@ AC_CONFIG_FILES([
modules/video_output/Makefile
modules/video_output/msw/Makefile
modules/video_output/qte/Makefile
modules/video_output/x11/Makefile
modules/visualization/Makefile
modules/visualization/visual/Makefile
])
......
SUBDIRS = msw qte x11
SUBDIRS = msw qte
# Automake forgets to add a proper tag to libtool with Objective-C files.
# Moreocer Libtool should default tag to CC when none is specified but
# obviously does not. Here is a fix for that.
......
SOURCES_glx = \
glx.c \
xcommon.c \
xcommon.h \
$(NULL)
/*****************************************************************************
* glx.c: GLX OpenGL provider
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <errno.h> /* ENOMEM */
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_interface.h>
#include <vlc_vout.h>
#include <X11/Xlib.h>
#include <X11/Xmd.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#ifdef DPMSINFO_IN_DPMS_H
# include <X11/extensions/dpms.h>
#endif
#include <GL/glx.h>
#include "xcommon.h"
/* RV16 */
//#define VLCGL_RGB_FORMAT GL_RGB
//#define VLCGL_RGB_TYPE GL_UNSIGNED_SHORT_5_6_5
/* RV24 */
//#define VLCGL_RGB_FORMAT GL_RGB
//#define VLCGL_RGB_TYPE GL_UNSIGNED_BYTE
/* RV32 */
#define VLCGL_RGB_FORMAT GL_RGBA
#define VLCGL_RGB_TYPE GL_UNSIGNED_BYTE
/*****************************************************************************
* OpenGL provider interface
*****************************************************************************/
static int CreateOpenGL ( vlc_object_t * );
static void DestroyOpenGL( vlc_object_t * );
static int InitOpenGL ( vout_thread_t * );
static void SwapBuffers ( vout_thread_t * );
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int InitGLX12 ( vout_thread_t * );
static int InitGLX13 ( vout_thread_t * );
static void SwitchContext( vout_thread_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define DISPLAY_TEXT N_("X11 display")
#define DISPLAY_LONGTEXT N_( \
"X11 hardware display to use. By default VLC will " \
"use the value of the DISPLAY environment variable.")
vlc_module_begin ()
set_shortname( "OpenGL(GLX)" )
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_VOUT )
set_description( N_("OpenGL(GLX) provider") )
set_capability( "opengl provider", 50 )
set_callbacks( CreateOpenGL, DestroyOpenGL )
add_string( "glx-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT, true )
add_obsolete_integer( "glx-adaptor" ) /* Deprecated since 1.0.4 */
#ifdef HAVE_SYS_SHM_H
add_obsolete_bool( "glx-shm" ) /* Deprecated since 1.0.4 */
#endif
vlc_module_end ()
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
extern int Activate ( vlc_object_t * );
extern void Deactivate ( vlc_object_t * );
/*****************************************************************************
* CreateOpenGL: initialize an OpenGL provider
*****************************************************************************/
static int CreateOpenGL( vlc_object_t *p_this )
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
if( Activate( p_this ) != VLC_SUCCESS )
{
return VLC_EGENERIC;
}
/* Set the function pointer */
p_vout->pf_init = InitOpenGL;
p_vout->pf_swap = SwapBuffers;
return VLC_SUCCESS;
}
/*****************************************************************************
* DestroyOpenGL: destroys an OpenGL provider
*****************************************************************************/
static void DestroyOpenGL( vlc_object_t *p_this )
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_sys_t *p_sys = p_vout->p_sys;
glXDestroyContext( p_sys->p_display, p_sys->gwctx );
if( p_sys->b_glx13 )
{
glXDestroyWindow( p_sys->p_display, p_sys->gwnd );
}
Deactivate( p_this );
}
/*****************************************************************************
* InitOpenGL: initializes OpenGL provider
*****************************************************************************/
static int InitOpenGL( vout_thread_t *p_vout )
{
/* Initialize GLX */
if( !p_vout->p_sys->b_glx13 )
{
if( InitGLX12( p_vout ) != VLC_SUCCESS )
{
return VLC_EGENERIC;
}
}
else
{
if( InitGLX13( p_vout ) != VLC_SUCCESS )
{
return VLC_EGENERIC;
}
}
/* Set the OpenGL context _for the current thread_ */
SwitchContext( p_vout );
return VLC_SUCCESS;
}
int InitGLX12( vout_thread_t *p_vout )
{
vout_sys_t *p_sys = p_vout->p_sys;
XVisualInfo *p_vi;
int p_attr[] = { GLX_RGBA, GLX_RED_SIZE, 5, GLX_GREEN_SIZE, 5,
GLX_BLUE_SIZE, 5, GLX_DOUBLEBUFFER, 0 };
p_vi = glXChooseVisual( p_sys->p_display,
DefaultScreen( p_sys->p_display), p_attr );
if(! p_vi )
{
msg_Err( p_vout, "Cannot get GLX 1.2 visual" );
return VLC_EGENERIC;
}
/* Create an OpenGL context */
p_sys->gwctx = glXCreateContext( p_sys->p_display, p_vi, 0, True );
XFree( p_vi );
if( !p_sys->gwctx )
{
msg_Err( p_vout, "Cannot create OpenGL context");
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
int InitGLX13( vout_thread_t *p_vout )
{
vout_sys_t *p_sys = p_vout->p_sys;
int i_nb, ret = VLC_EGENERIC;
GLXFBConfig *p_fbconfs = NULL, fbconf = NULL;
XWindowAttributes att;
static const int p_attr[] = {
GLX_RED_SIZE, 5, GLX_GREEN_SIZE, 5, GLX_BLUE_SIZE, 5,
GLX_DOUBLEBUFFER, True, GLX_X_RENDERABLE, True,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
None,
};
/* Get the FB configuration */
p_fbconfs = glXChooseFBConfig( p_sys->p_display, p_sys->i_screen, p_attr, &i_nb );
if( p_fbconfs == NULL )
{
msg_Err( p_vout, "Cannot get FB configurations");
return VLC_EGENERIC;
}
/* We should really create the window _after_ the frame buffer
* configuration was chosen, instead of selecting the frame buffer from
* the window. That requires reworking xcommon.c though.
* -- Courmisch */
XGetWindowAttributes( p_sys->p_display, p_sys->window.video_window, &att );
for( int i = 0; i < i_nb && !fbconf; i++ )
{
XVisualInfo *p_vi;
/* Get the X11 visual */
p_vi = glXGetVisualFromFBConfig( p_sys->p_display, p_fbconfs[i] );
if( !p_vi )
continue; /* OoM? */
if( p_vi->visualid == att.visual->visualid )
fbconf = p_fbconfs[i];
XFree( p_vi );
}
if( !fbconf )
{
msg_Err( p_vout, "Cannot find matching frame buffer" );
goto out;
}
/* Create the GLX window */
p_sys->gwnd = glXCreateWindow( p_sys->p_display, fbconf,
p_sys->window.video_window, NULL );
if( p_sys->gwnd == None )
{
msg_Err( p_vout, "Cannot create GLX window" );
goto out;
}
/* Create an OpenGL context */
p_sys->gwctx = glXCreateNewContext( p_sys->p_display, fbconf,
GLX_RGBA_TYPE, NULL, True );
if( !p_sys->gwctx )
msg_Err( p_vout, "Cannot create OpenGL context");
else
ret = VLC_SUCCESS;
out:
XFree( p_fbconfs );
return ret;
}
/*****************************************************************************
* SwapBuffers: swap front/back buffers
*****************************************************************************/
static void SwapBuffers( vout_thread_t *p_vout )
{
vout_sys_t *p_sys = p_vout->p_sys;
unsigned int i_width, i_height, i_x, i_y;
vout_PlacePicture( p_vout, p_vout->p_sys->window.i_width,
p_vout->p_sys->window.i_height,
&i_x, &i_y, &i_width, &i_height );
glViewport( 0, 0, (GLint)i_width, (GLint)i_height );
if( p_sys->b_glx13 )
{
glXSwapBuffers( p_sys->p_display, p_sys->gwnd );
}
else
{
glXSwapBuffers( p_sys->p_display, p_sys->window.video_window );
}
}
void SwitchContext( vout_thread_t *p_vout )
{
vout_sys_t *p_sys = p_vout->p_sys;
/* Change the current OpenGL context */
if( p_sys->b_glx13 )
{
glXMakeContextCurrent( p_sys->p_display, p_sys->gwnd,
p_sys->gwnd, p_sys->gwctx );
}
else
{
glXMakeCurrent( p_sys->p_display, p_sys->window.video_window,
p_sys->gwctx );
}
}
This diff is collapsed.
/*****************************************************************************
* xcommon.h: Defines common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 the VideoLAN team
* $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
* David Kennedy <dkennedy@tinytoad.com>
* Gildas Bazin <gbazin@netcourrier.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Defines
*****************************************************************************/
struct vout_window_t;
/*****************************************************************************
* x11_window_t: X11 window descriptor
*****************************************************************************
* This structure contains all the data necessary to describe an X11 window.
*****************************************************************************/
typedef struct x11_window_t
{
struct vout_window_t*owner_window; /* owner window (if any) */
Window base_window; /* base window */
Window video_window; /* sub-window for displaying video */
GC gc; /* graphic context instance handler */
unsigned int i_width; /* window width */
unsigned int i_height; /* window height */
int i_x; /* window x coordinate */
int i_y; /* window y coordinate */
Atom wm_protocols;
Atom wm_delete_window;
} x11_window_t;
/*****************************************************************************
* vout_sys_t: video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the X11 and XVideo specific properties of an output thread.
*****************************************************************************/
struct vout_sys_t
{
/* Internal settings and properties */
Display * p_display; /* display pointer */
int i_screen; /* screen number */
/* Our window */
x11_window_t window;
/* Screen saver properties */
int i_ss_timeout; /* timeout */
int i_ss_interval; /* interval between changes */
int i_ss_blanking; /* blanking mode */
int i_ss_exposure; /* exposure mode */
#ifdef DPMSINFO_IN_DPMS_H
BOOL b_ss_dpms; /* DPMS mode */
#endif
/* Mouse pointer properties */
bool b_mouse_pointer_visible;
mtime_t i_time_mouse_last_moved; /* used to auto-hide pointer*/
mtime_t i_mouse_hide_timeout; /* after time hide cursor */
Cursor blank_cursor; /* the hidden cursor */
mtime_t i_time_button_last_pressed; /* to track dbl-clicks */
Pixmap cursor_pixmap;
#ifdef MODULE_NAME_IS_glx
/* GLX properties */
int b_glx13;
GLXContext gwctx;
GLXWindow gwnd;
#endif
};
/*****************************************************************************
* mwmhints_t: window manager hints
*****************************************************************************
* Fullscreen needs to be able to hide the wm decorations so we provide
* this structure to make it easier.
*****************************************************************************/
#define MWM_HINTS_DECORATIONS (1L << 1)
#define PROP_MWM_HINTS_ELEMENTS 5
typedef struct mwmhints_t
{
unsigned long flags;
unsigned long functions;
unsigned long decorations;
signed long input_mode;
unsigned long status;
} mwmhints_t;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment