]> git.sesse.net Git - vlc/blobdiff - modules/video_output/opengl.c
* all: added a new skin text variable "$S" to get the audio sample rate
[vlc] / modules / video_output / opengl.c
index ac91d2acc66c9f9998197ae7e176c403d0d1816a..d45f7c454dc5f8028a14cec4b5d0883fcb7f5196 100644 (file)
@@ -20,7 +20,7 @@
  *
  * 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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -33,7 +33,7 @@
 #include <vlc/vlc.h>
 #include <vlc/vout.h>
 
-#ifdef SYS_DARWIN
+#ifdef __APPLE__
 #include <OpenGL/gl.h>
 #include <OpenGL/glext.h>
 
@@ -116,12 +116,12 @@ static int SendEvents( vlc_object_t *, char const *,
  * Module descriptor
  *****************************************************************************/
 #define SPEED_TEXT N_( "OpenGL cube rotation speed" )
-#define SPEED_LONGTEXT N_( "If the OpenGL cube effect is enabled, this " \
-                           "controls its rotation speed." )
+#define SPEED_LONGTEXT N_( "Rotation speed of the OpenGL cube effect, if " \
+        "enabled." )
 
-#define EFFECT_TEXT N_("Select effect")
+#define EFFECT_TEXT N_("Effect")
 #define EFFECT_LONGTEXT N_( \
-    "Allows you to select different visual effects.")
+    "Several visual OpenGL effects are available." )
 
 static char *ppsz_effects[] = {
         "none", "cube", "transparent-cube" };
@@ -133,7 +133,7 @@ vlc_module_begin();
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VOUT );
     set_description( _("OpenGL video output") );
-#ifdef SYS_DARWIN
+#ifdef __APPLE__
     set_capability( "video output", 200 );
 #else
     set_capability( "video output", 20 );
@@ -187,7 +187,7 @@ static int CreateVout( vlc_object_t *p_this )
     var_Create( p_vout, "opengl-effect", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
 
     p_sys->i_index = 0;
-#ifdef SYS_DARWIN
+#ifdef __APPLE__
     p_sys->i_tex_width  = p_vout->fmt_in.i_width;
     p_sys->i_tex_height = p_vout->fmt_in.i_height;
 #else
@@ -268,10 +268,15 @@ static int Init( vout_thread_t *p_vout )
 
     p_sys->p_vout->pf_init( p_sys->p_vout );
 
-#if defined( SYS_DARWIN ) || (VLCGL_FORMAT == YCBCR_MESA)
+/* TODO: We use YCbCr on Mac which is Y422, but on OSX it seems to == YUY2. Verify */
+#if ( defined( WORDS_BIGENDIAN ) && VLCGL_FORMAT == GL_YCBCR_422_APPLE ) || (VLCGL_FORMAT == YCBCR_MESA)
     p_vout->output.i_chroma = VLC_FOURCC('Y','U','Y','2');
     i_pixel_pitch = 2;
 
+#elif (VLCGL_FORMAT == GL_YCBCR_422_APPLE)
+    p_vout->output.i_chroma = VLC_FOURCC('U','Y','V','Y');
+    i_pixel_pitch = 2;
+
 #elif VLCGL_FORMAT == GL_RGB
 #   if VLCGL_TYPE == GL_UNSIGNED_BYTE
     p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4');
@@ -309,14 +314,14 @@ static int Init( vout_thread_t *p_vout )
         malloc( p_sys->i_tex_width * p_sys->i_tex_height * i_pixel_pitch );
     if( !p_sys->pp_buffer[0] )
     {
-        msg_Err( p_vout, "Out of memory" );
+        msg_Err( p_vout, "out of memory" );
         return -1;
     }
     p_sys->pp_buffer[1] =
         malloc( p_sys->i_tex_width * p_sys->i_tex_height * i_pixel_pitch );
     if( !p_sys->pp_buffer[1] )
     {
-        msg_Err( p_vout, "Out of memory" );
+        msg_Err( p_vout, "out of memory" );
         return -1;
     }
 
@@ -478,7 +483,7 @@ static int Manage( vout_thread_t *p_vout )
     i_ret = p_sys->p_vout->pf_manage( p_sys->p_vout );
     p_vout->i_changes = p_sys->p_vout->i_changes;
 
-#ifdef SYS_DARWIN
+#ifdef __APPLE__
     if( p_sys->p_vout->pf_lock &&
         p_sys->p_vout->pf_lock( p_sys->p_vout ) )
     {
@@ -558,7 +563,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
         return;
     }
 
-#ifdef SYS_DARWIN
+#ifdef __APPLE__
     int i_new_index;
     i_new_index = ( p_sys->i_index + 1 ) & 1;
 
@@ -608,7 +613,7 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
 
     /* glTexCoord works differently with GL_TEXTURE_2D and
        GL_TEXTURE_RECTANGLE_EXT */
-#ifdef SYS_DARWIN
+#ifdef __APPLE__
     f_x = (float)p_vout->fmt_out.i_x_offset;
     f_y = (float)p_vout->fmt_out.i_y_offset;
     f_width = (float)p_vout->fmt_out.i_x_offset +
@@ -737,24 +742,24 @@ static int InitTextures( vout_thread_t *p_vout )
     for( i_index = 0; i_index < 2; i_index++ )
     {
         glBindTexture( VLCGL_TARGET, p_sys->p_textures[i_index] );
-    
+
         /* Set the texture parameters */
         glTexParameterf( VLCGL_TARGET, GL_TEXTURE_PRIORITY, 1.0 );
-    
+
         glTexParameteri( VLCGL_TARGET, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
         glTexParameteri( VLCGL_TARGET, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
-        
+
         glTexParameteri( VLCGL_TARGET, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
         glTexParameteri( VLCGL_TARGET, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
 
         glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
 
-#ifdef SYS_DARWIN
+#ifdef __APPLE__
         /* Tell the driver not to make a copy of the texture but to use
            our buffer */
         glEnable( GL_UNPACK_CLIENT_STORAGE_APPLE );
         glPixelStorei( GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE );
-    
+
 #if 0
         /* Use VRAM texturing */
         glTexParameteri( VLCGL_TARGET, GL_TEXTURE_STORAGE_HINT_APPLE,