Commit 3122f7af authored by Eric Petit's avatar Eric Petit

+ macosx/vout* : cosmetic

parent eafdc23a
...@@ -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.18 2004/01/26 18:30:37 titer Exp $ * $Id: vout.h,v 1.19 2004/01/28 21:31:15 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>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
int i_init_done; int i_init_done;
int i_textures_loaded; int i_textures_loaded;
int i_index; int i_index;
unsigned long pi_textures[3]; unsigned long i_texture;
} }
@end @end
......
...@@ -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.73 2004/01/28 14:36:53 titer Exp $ * $Id: vout.m,v 1.74 2004/01/28 21:31:15 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>
...@@ -1282,7 +1282,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1282,7 +1282,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
if( !fmt ) if( !fmt )
{ {
fprintf( stderr, "Cannot create NSOpenGLPixelFormat\n" ); fprintf( stderr, "Cannot create NSOpenGLPixelFormat\n" );
return self; return nil;
} }
self = [super initWithFrame:frame pixelFormat: fmt]; self = [super initWithFrame:frame pixelFormat: fmt];
...@@ -1333,67 +1333,69 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -1333,67 +1333,69 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
if( !i_textures_loaded ) if( !i_textures_loaded )
{ {
glGenTextures( 3, pi_textures ); glGenTextures( 1, &i_texture );
glEnable( GL_TEXTURE_RECTANGLE_EXT );
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, i_texture);
glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA,
p_vout->output.i_width, p_vout->output.i_height, 0,
GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE,
PP_OUTPUTPICTURE[i_index]->p_data );
/* Turn on AGP transferts */
glTexParameterf( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_PRIORITY, 0.0 );
/* Use AGP texturing */
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_CACHED_APPLE );
/* Tell the driver not to make a copy of the texture but to use
our buffer */
glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE );
/* Linear interpolation */
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_MAG_FILTER, GL_LINEAR );
/* I have no idea what this exactly does, but it seems to be
necessary for scaling */
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
i_textures_loaded = 1; i_textures_loaded = 1;
} }
else else
{ {
glDisable( GL_TEXTURE_2D ); /* glTexSubImage2D is supposed to be faster than glTexImage2D,
glEnable( GL_TEXTURE_RECTANGLE_EXT ); so we use it starting from the second frame */
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, pi_textures[i_index]); glBindTexture(GL_TEXTURE_RECTANGLE_EXT, i_texture);
glTexSubImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0,
/* Map our buffer to the texture */ p_vout->output.i_width, p_vout->output.i_height,
glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA,
p_vout->output.i_width, p_vout->output.i_height, 0,
GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE,
PP_OUTPUTPICTURE[i_index]->p_data ); PP_OUTPUTPICTURE[i_index]->p_data );
} }
glDisable( GL_TEXTURE_2D ); /* Draw a quad with our texture on it. Quad size is set in order
glEnable( GL_TEXTURE_RECTANGLE_EXT ); to preserve the aspect ratio */
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, pi_textures[i_index] );
/* Turn on AGP transferts */
glTexParameterf( GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_PRIORITY, 0.0 );
/* Use AGP texturing */
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_CACHED_APPLE );
/* Tell the driver not to make a copy of the texture but to use out
buffer */
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
/* Linear interpolation */
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_MAG_FILTER, GL_LINEAR );
/* I have no idea what this exactly does, but it seems to be
necessary for scaling */
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_RECTANGLE_EXT,
GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
/* Draw a quad with our texture on it */
NSRect bounds = [self bounds]; NSRect bounds = [self bounds];
float f_x, f_y; float f_x, f_y;
if( bounds.size.height * p_vout->i_window_width < if( bounds.size.height * p_vout->output.i_aspect <
bounds.size.width * p_vout->i_window_height ) bounds.size.width * VOUT_ASPECT_FACTOR )
{ {
f_x = bounds.size.height * p_vout->i_window_width / f_x = bounds.size.height * p_vout->output.i_aspect /
bounds.size.width / p_vout->i_window_height; VOUT_ASPECT_FACTOR / bounds.size.width;
f_y = 1.0; f_y = 1.0;
} }
else else
{ {
f_x = 1.0; f_x = 1.0;
f_y = bounds.size.width * p_vout->i_window_height / f_y = bounds.size.width * VOUT_ASPECT_FACTOR /
bounds.size.height / p_vout->i_window_width; p_vout->output.i_aspect / bounds.size.height;
} }
glBegin( GL_QUADS ); glBegin( GL_QUADS );
......
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