Commit 774a42d0 authored by Eric Petit's avatar Eric Petit

macosx/* : added --macosx-opengl-effect, current possible values are

   "none" and "cube". Sorry, couldn't resist ;)
parent 5e53660a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* macosx.m: MacOS X module for vlc * macosx.m: MacOS X module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * Copyright (C) 2001-2003 VideoLAN
* $Id: macosx.m,v 1.19 2004/01/26 18:30:37 titer Exp $ * $Id: macosx.m,v 1.20 2004/02/09 13:28:31 titer Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Eugenio Jarosiewicz <ej0@cise.ufl.edu> * Eugenio Jarosiewicz <ej0@cise.ufl.edu>
...@@ -55,8 +55,16 @@ void E_(CloseVideo) ( vlc_object_t * ); ...@@ -55,8 +55,16 @@ void E_(CloseVideo) ( vlc_object_t * );
"0 is fully transparent.") "0 is fully transparent.")
#define OPENGL_TEXT N_("Use OpenGL") #define OPENGL_TEXT N_("Use OpenGL")
#define OPENGL_LONGTEXT N_( \ #define OPENGL_LONGTEXT N_("Use OpenGL instead of QuickTime to " \
"Use OpenGL instead of QuickTime to render the video on the screen." ) "render the video on the screen.")
#define OPENGL_EFFECT_TEXT N_("OpenGL effect")
#define OPENGL_EFFECT_LONGTEXT N_("Use 'None' to display the video " \
"without any fantasy, 'Cube' to let the video play on " \
"transparent faces of a rotating cube")
static char * effect_list[] = { "none", "cube" };
static char * effect_list_text[] = { N_("None"), N_("Cube") };
vlc_module_begin(); vlc_module_begin();
set_description( _("MacOS X interface, sound and video") ); set_description( _("MacOS X interface, sound and video") );
...@@ -71,5 +79,9 @@ vlc_module_begin(); ...@@ -71,5 +79,9 @@ vlc_module_begin();
OPAQUENESS_TEXT, OPAQUENESS_LONGTEXT, VLC_TRUE ); OPAQUENESS_TEXT, OPAQUENESS_LONGTEXT, VLC_TRUE );
add_bool( "macosx-opengl", 0, NULL, OPENGL_TEXT, add_bool( "macosx-opengl", 0, NULL, OPENGL_TEXT,
OPENGL_LONGTEXT, VLC_TRUE ); OPENGL_LONGTEXT, VLC_TRUE );
add_string( "macosx-opengl-effect", "none", NULL,
OPENGL_EFFECT_TEXT, OPENGL_EFFECT_LONGTEXT,
VLC_TRUE );
change_string_list( effect_list, effect_list_text, 0 );
vlc_module_end(); vlc_module_end();
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.h: MacOS X interface module * vout.h: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * Copyright (C) 2001-2003 VideoLAN
* $Id: vout.h,v 1.22 2004/02/03 13:00:27 titer Exp $ * $Id: vout.h,v 1.23 2004/02/09 13:28:32 titer Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org> * Florian G. Pflug <fgp@phlo.org>
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
@interface VLCGLView : NSOpenGLView @interface VLCGLView : NSOpenGLView
{ {
vout_thread_t * p_vout; vout_thread_t * p_vout;
int i_effect;
int b_init_done; int b_init_done;
unsigned long i_texture; unsigned long i_texture;
float f_x; float f_x;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout.m: MacOS X video output module * vout.m: MacOS X video output module
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.77 2004/02/03 13:00:27 titer Exp $ * $Id: vout.m,v 1.78 2004/02/09 13:28:32 titer Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org> * Florian G. Pflug <fgp@phlo.org>
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
#define QT_MAX_DIRECTBUFFERS 10 #define QT_MAX_DIRECTBUFFERS 10
#define VL_MAX_DISPLAYS 16 #define VL_MAX_DISPLAYS 16
#define OPENGL_EFFECT_NONE 1
#define OPENGL_EFFECT_CUBE 2
struct picture_sys_t struct picture_sys_t
{ {
void *p_info; void *p_info;
...@@ -1275,6 +1278,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1275,6 +1278,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
- (id) initWithFrame: (NSRect) frame vout: (vout_thread_t*) _p_vout - (id) initWithFrame: (NSRect) frame vout: (vout_thread_t*) _p_vout
{ {
char * psz_effect;
p_vout = _p_vout; p_vout = _p_vout;
NSOpenGLPixelFormatAttribute attribs[] = NSOpenGLPixelFormatAttribute attribs[] =
...@@ -1300,8 +1304,37 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1300,8 +1304,37 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
[[self openGLContext] makeCurrentContext]; [[self openGLContext] makeCurrentContext];
[[self openGLContext] update]; [[self openGLContext] update];
/* Black bacjground */
glClearColor( 0.0, 0.0, 0.0, 0.0 ); glClearColor( 0.0, 0.0, 0.0, 0.0 );
/* Check if the user asked for useless visual effects */
psz_effect = config_GetPsz( p_vout, "macosx-opengl-effect" );
if( !strcmp( psz_effect, "none" ) )
{
i_effect = OPENGL_EFFECT_NONE;
}
else if( !strcmp( psz_effect, "cube" ) )
{
i_effect = OPENGL_EFFECT_CUBE;
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 3.0, 20.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, - 5.0 );
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
glEnable( GL_BLEND );
glEnable( GL_POLYGON_SMOOTH );
glDisable( GL_DEPTH_TEST );
}
else
{
msg_Warn( p_vout, "no valid opengl effect provided, using "
"\"none\"" );
i_effect = OPENGL_EFFECT_NONE;
}
b_init_done = 0; b_init_done = 0;
return self; return self;
...@@ -1389,6 +1422,95 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1389,6 +1422,95 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
PP_OUTPUTPICTURE[0]->p_data ); PP_OUTPUTPICTURE[0]->p_data );
} }
- (void) drawQuad
{
glBegin( GL_QUADS );
/* Top left */
glTexCoord2f( 0.0, 0.0 );
glVertex3f( - 1.0, 1.0, 1.0 );
/* Bottom left */
glTexCoord2f( 0.0, (float) p_vout->output.i_height );
glVertex3f( - 1.0, - 1.0, 1.0 );
/* Bottom right */
glTexCoord2f( (float) p_vout->output.i_width,
(float) p_vout->output.i_height );
glVertex3f( 1.0, - 1.0, 1.0 );
/* Top right */
glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
glVertex3f( 1.0, 1.0, 1.0 );
glEnd();
}
- (void) drawCube
{
glBegin( GL_QUADS );
glTexCoord2f( 0.0, 0.0 );
glVertex3f( - 1.0, 1.0, 1.0 );
glTexCoord2f( 0.0, (float) p_vout->output.i_height );
glVertex3f( - 1.0, - 1.0, 1.0 );
glTexCoord2f( (float) p_vout->output.i_width,
(float) p_vout->output.i_height );
glVertex3f( 1.0, - 1.0, 1.0 );
glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
glVertex3f( 1.0, 1.0, 1.0 );
glEnd();
glBegin( GL_QUADS );
glTexCoord2f( 0.0, 0.0 );
glVertex3f( - 1.0, 1.0, - 1.0 );
glTexCoord2f( 0.0, (float) p_vout->output.i_height );
glVertex3f( - 1.0, - 1.0, - 1.0 );
glTexCoord2f( (float) p_vout->output.i_width,
(float) p_vout->output.i_height );
glVertex3f( - 1.0, - 1.0, 1.0 );
glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
glVertex3f( - 1.0, 1.0, 1.0 );
glEnd();
glBegin( GL_QUADS );
glTexCoord2f( 0.0, 0.0 );
glVertex3f( 1.0, 1.0, - 1.0 );
glTexCoord2f( 0.0, (float) p_vout->output.i_height );
glVertex3f( 1.0, - 1.0, - 1.0 );
glTexCoord2f( (float) p_vout->output.i_width,
(float) p_vout->output.i_height );
glVertex3f( - 1.0, - 1.0, - 1.0 );
glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
glVertex3f( - 1.0, 1.0, - 1.0 );
glEnd();
glBegin( GL_QUADS );
glTexCoord2f( 0.0, 0.0 );
glVertex3f( 1.0, 1.0, 1.0 );
glTexCoord2f( 0.0, (float) p_vout->output.i_height );
glVertex3f( 1.0, - 1.0, 1.0 );
glTexCoord2f( (float) p_vout->output.i_width,
(float) p_vout->output.i_height );
glVertex3f( 1.0, - 1.0, - 1.0 );
glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
glVertex3f( 1.0, 1.0, - 1.0 );
glEnd();
glBegin( GL_QUADS );
glTexCoord2f( 0.0, 0.0 );
glVertex3f( - 1.0, 1.0, - 1.0 );
glTexCoord2f( 0.0, (float) p_vout->output.i_height );
glVertex3f( - 1.0, 1.0, 1.0 );
glTexCoord2f( (float) p_vout->output.i_width,
(float) p_vout->output.i_height );
glVertex3f( 1.0, 1.0, 1.0 );
glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
glVertex3f( 1.0, 1.0, - 1.0 );
glEnd();
glBegin( GL_QUADS );
glTexCoord2f( 0.0, 0.0 );
glVertex3f( - 1.0, - 1.0, 1.0 );
glTexCoord2f( 0.0, (float) p_vout->output.i_height );
glVertex3f( - 1.0, - 1.0, - 1.0 );
glTexCoord2f( (float) p_vout->output.i_width,
(float) p_vout->output.i_height );
glVertex3f( 1.0, - 1.0, - 1.0 );
glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
glVertex3f( 1.0, - 1.0, 1.0 );
glEnd();
}
- (void) drawRect: (NSRect) rect - (void) drawRect: (NSRect) rect
{ {
[[self openGLContext] makeCurrentContext]; [[self openGLContext] makeCurrentContext];
...@@ -1409,23 +1531,17 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1409,23 +1531,17 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
return; return;
} }
/* Draw a quad with our texture on it */ /* Draw */
glBindTexture( GL_TEXTURE_RECTANGLE_EXT, i_texture ); glBindTexture( GL_TEXTURE_RECTANGLE_EXT, i_texture );
glBegin( GL_QUADS ); if( i_effect == OPENGL_EFFECT_CUBE )
/* Top left */ {
glTexCoord2f( 0.0, 0.0 ); glRotatef( 1.0, 0.5, 0.5, 1.0 );
glVertex2f( - f_x, f_y ); [self drawCube];
/* Bottom left */ }
glTexCoord2f( 0.0, (float) p_vout->output.i_height ); else
glVertex2f( - f_x, - f_y ); {
/* Bottom right */ [self drawQuad];
glTexCoord2f( (float) p_vout->output.i_width, }
(float) p_vout->output.i_height );
glVertex2f( f_x, - f_y );
/* Top right */
glTexCoord2f( (float) p_vout->output.i_width, 0.0 );
glVertex2f( f_x, f_y );
glEnd();
/* Wait for the job to be done */ /* Wait for the job to be done */
[[self openGLContext] flushBuffer]; [[self openGLContext] flushBuffer];
......
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