/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <errno.h> /* ENOMEM */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include <errno.h> /* ENOMEM */
+
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout.h>
N_("None"), N_("Cube"), N_("Transparent Cube") };
#endif
-vlc_module_begin();
- set_shortname( "OpenGL" );
- set_category( CAT_VIDEO );
- set_subcategory( SUBCAT_VIDEO_VOUT );
- set_description( N_("OpenGL video output") );
+vlc_module_begin ()
+ set_shortname( "OpenGL" )
+ set_category( CAT_VIDEO )
+ set_subcategory( SUBCAT_VIDEO_VOUT )
+ set_description( N_("OpenGL video output") )
#ifdef __APPLE__
- set_capability( "video output", 200 );
+ set_capability( "video output", 200 )
#else
- set_capability( "video output", 20 );
+ set_capability( "video output", 20 )
#endif
- add_shortcut( "opengl" );
+ add_shortcut( "opengl" )
add_float( "opengl-cube-speed", 2.0, NULL, SPEED_TEXT,
SPEED_LONGTEXT, true );
#ifdef OPENGL_MORE_EFFECT
/* Allow opengl provider plugin selection */
add_string( "opengl-provider", "default", NULL, PROVIDER_TEXT,
PROVIDER_LONGTEXT, true );
- set_callbacks( CreateVout, DestroyVout );
+ set_callbacks( CreateVout, DestroyVout )
add_string( "opengl-effect", "none", NULL, EFFECT_TEXT,
EFFECT_LONGTEXT, false );
change_string_list( ppsz_effects, ppsz_effects_text, 0 );
-vlc_module_end();
+vlc_module_end ()
/*****************************************************************************
* vout_sys_t: video output method descriptor
/* Get window */
p_sys->p_vout =
- (vout_thread_t *)vlc_object_create( p_this, VLC_OBJECT_OPENGL );
+ (vout_thread_t *)vlc_object_create( p_this, sizeof( vout_thread_t ) );
if( p_sys->p_vout == NULL )
{
- msg_Err( p_vout, "out of memory" );
+ free( p_sys );
return VLC_ENOMEM;
}
vlc_object_attach( p_sys->p_vout, p_this );
psz ? psz : "default" );
p_sys->p_vout->p_module =
- module_Need( p_sys->p_vout, "opengl provider", psz, 0 );
+ module_need( p_sys->p_vout, "opengl provider", psz, false );
free( psz );
if( p_sys->p_vout->p_module == NULL )
{
else
{
#ifdef OPENGL_MORE_EFFECT
- p_sys->i_effect = 3;
- while (( strcmp( val.psz_string, ppsz_effects[p_sys->i_effect]) ) && (pow(2,p_sys->i_effect) < INIFILE))
+ long i, size = sizeof(ppsz_effects)/sizeof(*ppsz_effects);
+ p_sys->i_effect = OPENGL_EFFECT_NONE;
+
+ for(i = 3; i < size; i++)
{
- p_sys->i_effect ++;
+ if(!strcmp( val.psz_string, ppsz_effects[i]))
+ {
+ p_sys->i_effect = 1 << i;
+ break;
+ }
}
- if (pow(2,p_sys->i_effect) < INIFILE)
- p_sys->i_effect = pow(2,p_sys->i_effect);
- else if ( strcmp( val.psz_string, ppsz_effects[p_sys->i_effect]))
+
+ if( p_sys->i_effect == OPENGL_EFFECT_NONE )
{
msg_Warn( p_vout, "no valid opengl effect provided, using "
"\"none\"" );
- p_sys->i_effect = OPENGL_EFFECT_NONE;
}
#else
msg_Warn( p_vout, "no valid opengl effect provided, using "
vout_thread_t *p_vout = (vout_thread_t *)p_this;
vout_sys_t *p_sys = p_vout->p_sys;
- module_Unneed( p_sys->p_vout, p_sys->p_vout->p_module );
- vlc_object_detach( p_sys->p_vout );
+ module_unneed( p_sys->p_vout, p_sys->p_vout->p_module );
vlc_object_release( p_sys->p_vout );
free( p_sys );