Commit 15622f88 authored by Jon Lech Johansen's avatar Jon Lech Johansen

* ./modules/gui/macosx: added macosx-adev and macosx-vdev config vars.

parent a1181096
......@@ -2,7 +2,7 @@
* aout.m: CoreAudio output plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: aout.m,v 1.20 2003/01/13 20:02:37 jlj Exp $
* $Id: aout.m,v 1.21 2003/01/15 00:49:49 jlj Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -173,10 +173,10 @@ static OSStatus IOCallback ( AudioDeviceID inDevice,
int E_(OpenAudio)( vlc_object_t * p_this )
{
OSStatus err;
vlc_value_t val;
UInt32 i, i_param_size;
struct aout_sys_t * p_sys;
aout_instance_t * p_aout = (aout_instance_t *)p_this;
vlc_value_t val;
/* Allocate structure */
p_sys = (struct aout_sys_t *)malloc( sizeof( struct aout_sys_t ) );
......@@ -198,6 +198,8 @@ int E_(OpenAudio)( vlc_object_t * p_this )
if( var_Type( p_aout, "audio-device" ) == 0 )
{
UInt32 i_option = config_GetInt( p_aout, "macosx-adev" );
var_Create( p_aout, "audio-device", VLC_VAR_STRING |
VLC_VAR_HASCHOICE );
......@@ -205,15 +207,21 @@ int E_(OpenAudio)( vlc_object_t * p_this )
{
val.psz_string = p_sys->p_options[i].sz_option;
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
if( i == i_option )
{
var_Set( p_aout, "audio-device", val );
}
}
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart,
NULL );
}
val.b_bool = VLC_TRUE;
var_Set( p_aout, "intf-change", val );
}
/* Get selected device */
/* Get requested device */
if( GetDevice( p_aout, &p_sys->devid ) )
{
msg_Err( p_aout, "GetDevice failed" );
......@@ -879,9 +887,8 @@ static void FreeStream( UInt32 i_dev, aout_instance_t *p_aout,
static int GetDevice( aout_instance_t *p_aout, AudioDeviceID *p_devid )
{
OSStatus err;
char *psz_tmp;
vlc_value_t val;
UInt32 i_option;
unsigned int i_option;
struct aout_dev_t * p_dev;
struct aout_option_t * p_option;
......@@ -893,16 +900,12 @@ static int GetDevice( aout_instance_t *p_aout, AudioDeviceID *p_devid )
return( VLC_ENOVAR );
}
psz_tmp = strchr( val.psz_string, ':' );
if( psz_tmp == NULL )
if( !sscanf( val.psz_string, "%d:", &i_option ) ||
p_sys->i_options <= i_option )
{
msg_Err( p_aout, "audio-device value missing seperator" );
free( (void *)val.psz_string );
return( VLC_EGENERIC );
i_option = 0;
}
*psz_tmp = '\0';
i_option = atol( val.psz_string );
free( (void *)val.psz_string );
p_option = &p_sys->p_options[i_option];
......@@ -925,6 +928,8 @@ static int GetDevice( aout_instance_t *p_aout, AudioDeviceID *p_devid )
msg_Dbg( p_aout, "getting device [%ld]", p_option->i_dev );
config_PutInt( p_aout, "macosx-adev", i_option );
*p_devid = p_dev->devid;
return( VLC_SUCCESS );
......
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.23 2003/01/13 17:11:14 ipkiss Exp $
* $Id: intf.m,v 1.24 2003/01/15 00:49:49 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -81,6 +81,8 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
config_SaveConfigFile( p_intf, MODULE_STRING );
[p_intf->p_sys->o_sendport release];
[p_intf->p_sys->o_pool release];
......
/*****************************************************************************
* macosx.m: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: macosx.m,v 1.1 2002/08/04 17:23:43 sam Exp $
* Copyright (C) 2001-2003 VideoLAN
* $Id: macosx.m,v 1.2 2003/01/15 00:49:49 jlj Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Eugenio Jarosiewicz <ej0@cise.ufl.edu>
......@@ -47,6 +47,9 @@ void E_(CloseVideo) ( vlc_object_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define ADEV_TEXT N_("audio device")
#define VDEV_TEXT N_("video device")
vlc_module_begin();
set_description( _("MacOS X interface, sound and video module") );
add_submodule();
......@@ -55,8 +58,12 @@ vlc_module_begin();
add_submodule();
set_capability( "video output", 100 );
set_callbacks( E_(OpenVideo), E_(CloseVideo) );
add_category_hint( N_("Video"), NULL );
add_integer( "macosx-vdev", 0, NULL, VDEV_TEXT, VDEV_TEXT );
add_submodule();
set_capability( "audio output", 100 );
set_callbacks( E_(OpenAudio), E_(CloseAudio) );
add_category_hint( N_("Audio"), NULL );
add_integer( "macosx-adev", 0, NULL, ADEV_TEXT, ADEV_TEXT );
vlc_module_end();
/*****************************************************************************
* vout.m: MacOS X video output plugin
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: vout.m,v 1.11 2003/01/05 16:23:57 massiot Exp $
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.12 2003/01/15 00:49:49 jlj Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
......@@ -177,19 +177,20 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
NSArray * o_screens = [NSScreen screens];
if ( [o_screens count] > 0 )
if( [o_screens count] > 0 && var_Type( p_vout, "video-device" ) == 0 )
{
int i = 1;
vlc_value_t val;
NSScreen * o_screen;
var_Destroy( p_vout, "video-device" );
var_Create( p_vout, "video-device",
VLC_VAR_STRING | VLC_VAR_HASCHOICE );
int i_option = config_GetInt( p_vout, "macosx-vdev" );
var_Create( p_vout, "video-device", VLC_VAR_STRING |
VLC_VAR_HASCHOICE );
NSEnumerator * o_enumerator = [o_screens objectEnumerator];
while ( (o_screen = [o_enumerator nextObject]) != NULL )
while( (o_screen = [o_enumerator nextObject]) != NULL )
{
char psz_temp[255];
NSRect s_rect = [o_screen frame];
......@@ -201,6 +202,11 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
val.psz_string = psz_temp;
var_Change( p_vout, "video-device", VLC_VAR_ADDCHOICE, &val );
if( ( i - 1 ) == i_option )
{
var_Set( p_vout, "video-device", val );
}
i++;
}
......@@ -1016,7 +1022,9 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
}
else
{
o_screen = [o_screens objectAtIndex: i_index - 1];
i_index--;
o_screen = [o_screens objectAtIndex: i_index];
config_PutInt( p_vout, "macosx-vdev", i_index );
}
free( val.psz_string );
......
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