Commit cac0b715 authored by Eric Petit's avatar Eric Petit

macosx/vout*.m: factorized some more code, fixed GL video device selection

parent f046e3c3
......@@ -69,8 +69,58 @@
NSScreen * o_screen;
vlc_bool_t b_main_screen;
var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-opaqueness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
/* Setup the menuitem for the multiple displays. Read the vlc preference (macosx-vdev) for the primary display */
NSArray * o_screens = [NSScreen screens];
if( [o_screens count] > 0 && var_Type( p_real_vout, "video-device" ) == 0 )
{
int i = 1;
vlc_value_t val, val2, text;
NSScreen * o_screen;
var_Get( p_real_vout, "macosx-vdev", &val );
var_Create( p_real_vout, "video-device", VLC_VAR_INTEGER |
VLC_VAR_HASCHOICE );
text.psz_string = _("Video device");
var_Change( p_real_vout, "video-device", VLC_VAR_SETTEXT, &text, NULL );
NSEnumerator * o_enumerator = [o_screens objectEnumerator];
while( (o_screen = [o_enumerator nextObject]) != NULL )
{
char psz_temp[255];
NSRect s_rect = [o_screen frame];
snprintf( psz_temp, sizeof(psz_temp)/sizeof(psz_temp[0])-1,
"%s %d (%dx%d)", _("Screen"), i,
(int)s_rect.size.width, (int)s_rect.size.height );
text.psz_string = psz_temp;
val2.i_int = i;
var_Change( p_real_vout, "video-device",
VLC_VAR_ADDCHOICE, &val2, &text );
if( ( i - 1 ) == val.i_int )
{
var_Set( p_real_vout, "video-device", val2 );
}
i++;
}
var_AddCallback( p_real_vout, "video-device", vout_VarCallback,
NULL );
val2.b_bool = VLC_TRUE;
var_Set( p_real_vout, "intf-change", val2 );
}
/* Find out on which screen to open the window */
int i_device = var_GetInteger( p_vout, "video-device" );
int i_device = var_GetInteger( p_real_vout, "video-device" );
if( i_device < 0 )
{
/* No preference specified. Use the main screen */
......@@ -90,7 +140,7 @@
{
i_device--;
o_screen = [o_screens objectAtIndex: i_device];
var_SetInteger( p_vout, "macosx-vdev", i_device );
var_SetInteger( p_real_vout, "macosx-vdev", i_device );
b_main_screen = ( i_device == 0 );
}
}
......
/*****************************************************************************
* vout.m: MacOS X video output module
* voutgl.m: MacOS X OpenGL provider
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m 8351 2004-08-02 13:06:38Z hartman $
......@@ -60,7 +60,7 @@ struct vout_sys_t
VLCGLView * o_glview;
vlc_bool_t b_saved_frame;
NSRect s_frame;
vlc_bool_t * b_got_frame;
vlc_bool_t b_got_frame;
};
/*****************************************************************************
......@@ -77,7 +77,6 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this )
{
vout_thread_t * p_vout = (vout_thread_t *) p_this;
int i_timeout;
vlc_value_t val;
/* OpenGL interface disabled until
* - the green line is gone
......@@ -122,59 +121,8 @@ int E_(OpenVideoGL) ( vlc_object_t * p_this )
p_vout->pf_control= Control;
p_vout->pf_swap = Swap;
p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-opaqueness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
/* Setup the menuitem for the multiple displays. Read the vlc preference (macosx-vdev) for the primary display */
NSArray * o_screens = [NSScreen screens];
if( [o_screens count] > 0 && var_Type( p_vout, "video-device" ) == 0 )
{
int i = 1;
vlc_value_t val2, text;
NSScreen * o_screen;
var_Get( p_vout, "macosx-vdev", &val );
var_Create( p_vout, "video-device", VLC_VAR_INTEGER |
VLC_VAR_HASCHOICE );
text.psz_string = _("Video device");
var_Change( p_vout, "video-device", VLC_VAR_SETTEXT, &text, NULL );
NSEnumerator * o_enumerator = [o_screens objectEnumerator];
while( (o_screen = [o_enumerator nextObject]) != NULL )
{
char psz_temp[255];
NSRect s_rect = [o_screen frame];
snprintf( psz_temp, sizeof(psz_temp)/sizeof(psz_temp[0])-1,
"%s %d (%dx%d)", _("Screen"), i,
(int)s_rect.size.width, (int)s_rect.size.height );
text.psz_string = psz_temp;
val2.i_int = i;
var_Change( p_vout, "video-device",
VLC_VAR_ADDCHOICE, &val2, &text );
if( ( i - 1 ) == val.i_int )
{
var_Set( p_vout, "video-device", val2 );
}
i++;
}
var_AddCallback( p_vout, "video-device", vout_VarCallback,
NULL );
val2.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val2 );
}
/* Spawn window */
p_vout->p_sys->b_got_frame = VLC_FALSE;
p_vout->p_sys->o_window = [[VLCWindow alloc] initWithVout: p_vout
......
......@@ -106,7 +106,6 @@ static void QTFreePicture ( vout_thread_t *, picture_t * );
int E_(OpenVideoQT) ( vlc_object_t *p_this )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
OSErr err;
int i_timeout;
......@@ -145,11 +144,6 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-opaqueness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
p_vout->p_sys->b_altivec = p_vout->p_libvlc->i_cpu & CPU_CAPABILITY_ALTIVEC;
msg_Dbg( p_vout, "We do%s have Altivec", p_vout->p_sys->b_altivec ? "" : "n't" );
......@@ -210,51 +204,6 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
return VLC_EGENERIC;
}
/* Setup the menuitem for the multiple displays. Read the vlc preference (macosx-vdev) for the primary display */
NSArray * o_screens = [NSScreen screens];
if( [o_screens count] > 0 && var_Type( p_vout, "video-device" ) == 0 )
{
int i = 1;
vlc_value_t val2, text;
NSScreen * o_screen;
var_Get( p_vout, "macosx-vdev", &val );
var_Create( p_vout, "video-device", VLC_VAR_INTEGER |
VLC_VAR_HASCHOICE );
text.psz_string = _("Video device");
var_Change( p_vout, "video-device", VLC_VAR_SETTEXT, &text, NULL );
NSEnumerator * o_enumerator = [o_screens objectEnumerator];
while( (o_screen = [o_enumerator nextObject]) != NULL )
{
char psz_temp[255];
NSRect s_rect = [o_screen frame];
snprintf( psz_temp, sizeof(psz_temp)/sizeof(psz_temp[0])-1,
"%s %d (%dx%d)", _("Screen"), i,
(int)s_rect.size.width, (int)s_rect.size.height );
text.psz_string = psz_temp;
val2.i_int = i;
var_Change( p_vout, "video-device",
VLC_VAR_ADDCHOICE, &val2, &text );
if( ( i - 1 ) == val.i_int )
{
var_Set( p_vout, "video-device", val2 );
}
i++;
}
var_AddCallback( p_vout, "video-device", vout_VarCallback,
NULL );
val2.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val2 );
}
/* Spawn window */
p_vout->p_sys->o_window =
[[VLCWindow alloc] initWithVout: p_vout frame: nil];
......
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