Commit 4994baa7 authored by Cyril Deguet's avatar Cyril Deguet

* all: created a new module type "opengl provider", which provides a

   simple interface to create and use OpenGL windows
 * modules/video_output/x11/glx.c: the GLX vout now implements the
  "opengl provider" interface
 * modules/visualization/galaktos/*: no more dependency on GLX: we use
   the generic opengl provider interface instead.
parent 42d17b9d
......@@ -340,6 +340,10 @@ typedef int (*httpd_file_callback_t)( httpd_file_sys_t*, httpd_file_t *, uint8_t
typedef struct httpd_redirect_t httpd_redirect_t;
typedef struct httpd_stream_t httpd_stream_t;
/* opengl */
typedef struct opengl_t opengl_t;
typedef struct opengl_sys_t opengl_sys_t;
/* divers */
typedef struct vlc_meta_t vlc_meta_t;
......
......@@ -52,6 +52,7 @@
#define VLC_OBJECT_DEMUX (-18)
#define VLC_OBJECT_ACCESS (-19)
#define VLC_OBJECT_STREAM (-20)
#define VLC_OBJECT_OPENGL (-21)
#define VLC_OBJECT_GENERIC (-666)
......
/*****************************************************************************
* plugin.h:
* vlc_opengl.h: OpenGL provider interface
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id$
*
* Authors: Cyril Deguet <asmax@videolan.org>
* Authors: Cyril Deguet <asmax@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
......@@ -21,33 +21,28 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef _GALAKTOS_GLX_H_
#define _GALAKTOS_GLX_H_
#ifndef _VLC_OPENGL_H
#define _VLC_OPENGL_H 1
#include "plugin.h"
int galaktos_glx_init( galaktos_thread_t *p_thread );
void galaktos_glx_done( galaktos_thread_t *p_thread );
int galaktos_glx_handle_events( galaktos_thread_t *p_thread );
void galaktos_glx_activate_pbuffer( galaktos_thread_t *p_thread );
void galaktos_glx_activate_window( galaktos_thread_t *p_thread );
void galaktos_glx_swap( galaktos_thread_t *p_thread );
/*****************************************************************************
* 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
struct opengl_t
{
uint32_t flags;
uint32_t functions;
uint32_t decorations;
int32_t input_mode;
uint32_t status;
} mwmhints_t;
VLC_COMMON_MEMBERS
int i_width; /* window width */
int i_height; /* window height */
int b_fullscreen; /* fullscreen flag */
opengl_sys_t *p_sys; /* private data */
/* Create an OpenGL window of the requested size (if possible) */
int ( *pf_init )( opengl_t *, int i_width, int i_height );
/* Swap front/back buffers */
void ( *pf_swap )( opengl_t * );
/* Handle window events */
int ( *pf_handle_events )( opengl_t * );
};
#endif
This diff is collapsed.
SOURCES_galaktos = plugin.c \
plugin.h \
glx.c \
glx.h \
main.c \
main.h \
preset.c \
......
This diff is collapsed.
......@@ -22,7 +22,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#include "glx.h"
#include "plugin.h"
#include "vlc_opengl.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <unistd.h>
......@@ -269,10 +270,10 @@ int galaktos_update( galaktos_thread_t *p_thread )
glFinish();
glFlush();
// printf("Flush %d\n",(SDL_GetTicks()-timestart));
galaktos_glx_swap( p_thread );
(p_thread->p_opengl->pf_swap)( p_thread->p_opengl );
/* Process X11 events */
if( galaktos_glx_handle_events( p_thread ) == 1 )
/* Process events */
if( (p_thread->p_opengl->pf_handle_events)( p_thread->p_opengl ) )
{
return 1;
}
......
......@@ -29,7 +29,6 @@
*****************************************************************************/
#include "plugin.h"
#include "glx.h"
#include "main.h"
#include "PCM.h"
#include "video_init.h"
......@@ -38,6 +37,7 @@
#include <vlc/input.h>
#include <vlc/vout.h>
#include "aout_internal.h"
#include "vlc_opengl.h"
/*****************************************************************************
* Module descriptor
......@@ -78,7 +78,7 @@ static int Open( vlc_object_t *p_this )
{
aout_filter_t *p_filter = (aout_filter_t *)p_this;
aout_filter_sys_t *p_sys;
galaktos_thread_t *p_thread;
galaktos_thread_t *p_thread;
vlc_value_t width, height;
if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' )
......@@ -104,6 +104,25 @@ static int Open( vlc_object_t *p_this )
vlc_object_create( p_filter, sizeof( galaktos_thread_t ) );
vlc_object_attach( p_thread, p_this );
/* Get on OpenGL provider */
p_thread->p_opengl =
(opengl_t *)vlc_object_create( p_this, VLC_OBJECT_OPENGL );
if( p_thread->p_opengl == NULL )
{
msg_Err( p_filter, "out of memory" );
return VLC_ENOMEM;
}
p_thread->p_module =
module_Need( p_thread->p_opengl, "opengl provider", NULL, 0 );
if( p_thread->p_module == NULL )
{
msg_Err( p_filter, "No OpenGL provider found" );
vlc_object_destroy( p_thread->p_opengl );
p_thread->p_opengl = NULL;
return VLC_ENOOBJ;
}
/*
var_Create( p_thread, "galaktos-width", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Get( p_thread, "galaktos-width", &width );
......@@ -116,7 +135,6 @@ static int Open( vlc_object_t *p_this )
p_thread->i_width = 600;
p_thread->i_height = 600;
p_thread->b_fullscreen = 0;
galaktos_glx_init( p_thread );
galaktos_init( p_thread );
p_thread->i_channels = aout_FormatNbChannels( &p_filter->input );
......@@ -203,7 +221,10 @@ static void Thread( vlc_object_t *p_this )
int timestart=0;
int mspf=0;
galaktos_glx_activate_window( p_thread );
/* Initialize the opengl provider */
(p_thread->p_opengl->pf_init)(p_thread->p_opengl, p_thread->i_width,
p_thread->i_height);
setup_opengl( p_thread->i_width, p_thread->i_height );
CreateRenderTarget(512, &RenderTargetTextureID, NULL);
......@@ -235,8 +256,6 @@ static void Thread( vlc_object_t *p_this )
// printf("Limiter %d\n",(mdate()/1000-timestart));
timestart=mdate()/1000;
}
galaktos_glx_done( p_thread );
}
/*****************************************************************************
......@@ -254,6 +273,10 @@ static void Close( vlc_object_t *p_this )
vlc_thread_join( p_sys->p_thread );
/* Free the openGL provider */
module_Unneed( p_sys->p_thread->p_opengl, p_sys->p_thread->p_module );
vlc_object_destroy( p_sys->p_thread->p_opengl );
/* Free data */
vlc_object_detach( p_sys->p_thread );
......
......@@ -35,6 +35,10 @@ typedef struct
char *psz_title;
/* OpenGL provider */
opengl_t *p_opengl;
module_t *p_module;
/* Window properties */
int i_width;
int i_height;
......
......@@ -48,6 +48,8 @@
#include "vlc_interface.h"
#include "vlc_codec.h"
#include "vlc_opengl.h"
#include "vlc_httpd.h"
#include "vlc_vlm.h"
/*****************************************************************************
......@@ -169,6 +171,10 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
i_size = sizeof( vlm_t );
psz_type = "vlm dameon";
break;
case VLC_OBJECT_OPENGL:
i_size = sizeof( opengl_t );
psz_type = "opengl provider";
break;
case VLC_OBJECT_ANNOUNCE:
i_size = sizeof( announce_handler_t );
psz_type = "announce handler";
......
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