*
* 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.
*****************************************************************************/
/*****************************************************************************
#include <vlc/vlc.h>
#include <vlc/vout.h>
-#ifdef SYS_DARWIN
+#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
* 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" };
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 );
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
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');
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;
}
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 ) )
{
return;
}
-#ifdef SYS_DARWIN
+#ifdef __APPLE__
int i_new_index;
i_new_index = ( p_sys->i_index + 1 ) & 1;
/* 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 +
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,