Commit ec518727 authored by Christophe Massiot's avatar Christophe Massiot

* configure.ac.in: Disabled -Wtraditional as it produces much more bogus

  warnings than real ones.
* audio output: New intf-change variable to know when audio-channels
  and audio-device have changed.
* video output: New intf-change variable and vout_VarCallback, to know
  when video-device has changed (OS X port).
* modules/gui/macosx/*: Menus for audio channels, implemented volume
  management, added a menu for screen selection.
parent 9e4b72d5
......@@ -467,11 +467,6 @@ AC_CACHE_CHECK([if \$CC accepts -Wall],
[CFLAGS="-Wall ${CFLAGS_save}"
AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])
AC_CACHE_CHECK([if \$CC accepts -Wtraditional],
[ac_cv_c_Wtraditional],
[CFLAGS="-Wtraditional ${CFLAGS_save}"
AC_TRY_COMPILE([],,ac_cv_c_Wtraditional=yes, ac_cv_c_Wtraditional=no)])
AC_CACHE_CHECK([if \$CC accepts -Wconversion],
[ac_cv_c_Wconversion],
[CFLAGS="-Wconversion ${CFLAGS_save}"
......@@ -503,12 +498,6 @@ if test "x${ac_cv_c_Wall}" != "xno"; then
OBJCFLAGS_save="-Wall ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
fi
if test "x${ac_cv_c_Wtraditional}" != "xno"; then
CFLAGS_save="-Wtraditional ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
CXXFLAGS_save="-Wtraditional ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
OBJCFLAGS_save="-Wtraditional ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
fi
if test "x${ac_cv_c_Wunreachable_code}" != "xno"; then
CFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
CXXFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
......
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = VLCApplication; LANGUAGE = ObjC; SUPERCLASS = NSApplication; },
{
ACTIONS = {
deinterlace = id;
......@@ -19,6 +20,7 @@
toggleProgram = id;
toggleSubtitle = id;
toggleTitle = id;
toggleVar = id;
volumeDown = id;
volumeUp = id;
};
......@@ -28,10 +30,11 @@
SUPERCLASS = NSObject;
},
{
ACTIONS = {clearRecentItems = id; viewPreferences = id; };
ACTIONS = {clearRecentItems = id; openRecentItem = id; viewPreferences = id; };
CLASS = VLCMain;
LANGUAGE = ObjC;
OUTLETS = {
asystm = id;
"o_controls" = id;
"o_dmi_pause" = id;
"o_dmi_play" = id;
......@@ -39,6 +42,7 @@
"o_messages" = id;
"o_mi_about" = id;
"o_mi_bring_atf" = id;
"o_mi_channels" = id;
"o_mi_chapter" = id;
"o_mi_clear" = id;
"o_mi_copy" = id;
......@@ -67,6 +71,7 @@
"o_mi_previous" = id;
"o_mi_program" = id;
"o_mi_quit" = id;
"o_mi_screen" = id;
"o_mi_select_all" = id;
"o_mi_show_all" = id;
"o_mi_slower" = id;
......@@ -83,6 +88,7 @@
"o_mu_view" = id;
"o_mu_window" = id;
"o_playlist" = id;
"o_prefs" = id;
"o_window" = id;
};
SUPERCLASS = NSObject;
......
......@@ -3,22 +3,22 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>98 729 428 434 0 0 1600 1178 </string>
<string>61 306 428 434 0 0 1152 746 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>642 1081 308 44 0 0 1600 1178 </string>
<string>281 485 308 44 0 0 1152 746 </string>
<key>303</key>
<string>93 566 72 114 0 0 1600 1178 </string>
</dict>
<key>IBFramework Version</key>
<string>283.0</string>
<string>286.0</string>
<key>IBOpenObjects</key>
<array>
<integer>636</integer>
<integer>29</integer>
<integer>636</integer>
</array>
<key>IBSystem Version</key>
<string>6D52</string>
<string>6F21</string>
</dict>
</plist>
......@@ -2,7 +2,7 @@
* aout_internal.h : internal defines for audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: aout_internal.h,v 1.35 2002/12/06 10:10:40 sam Exp $
* $Id: aout_internal.h,v 1.36 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -200,6 +200,8 @@ typedef struct aout_output_t
/* Current volume for the output - it's just a placeholder, the plug-in
* may or may not use it. */
audio_volume_t i_volume;
/* Saved volume for aout_VolumeMute(). */
audio_volume_t i_saved_volume;
} aout_output_t;
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* audio_output.h : audio output interface
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.73 2002/12/06 10:10:40 sam Exp $
* $Id: audio_output.h,v 1.74 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -179,6 +179,7 @@ VLC_EXPORT( int, aout_VolumeSet, ( aout_instance_t *, audio_volume_t ) );
VLC_EXPORT( int, aout_VolumeInfos, ( aout_instance_t *, audio_volume_t * ) );
VLC_EXPORT( int, aout_VolumeUp, ( aout_instance_t *, int, audio_volume_t * ) );
VLC_EXPORT( int, aout_VolumeDown, ( aout_instance_t *, int, audio_volume_t * ) );
VLC_EXPORT( int, aout_VolumeMute, ( aout_instance_t *, audio_volume_t * ) );
VLC_EXPORT( int, aout_Restart, ( aout_instance_t * p_aout ) );
VLC_EXPORT( void, aout_FindAndRestart, ( vlc_object_t * p_this ) );
VLC_EXPORT( int, aout_ChannelsRestart, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) );
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously opened video output thread.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_output.h,v 1.88 2002/11/28 17:34:59 sam Exp $
* $Id: video_output.h,v 1.89 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -146,6 +146,7 @@ VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *, vout_thread_
#define vout_Create(a,b,c,d,e) __vout_Create(VLC_OBJECT(a),b,c,d,e)
VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *, unsigned int, unsigned int, uint32_t, unsigned int ) );
VLC_EXPORT( void, vout_Destroy, ( vout_thread_t * ) );
VLC_EXPORT( int, vout_VarCallback, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) );
VLC_EXPORT( int, vout_ChromaCmp, ( uint32_t, uint32_t ) );
......
......@@ -2,7 +2,7 @@
* oss.c : OSS /dev/dsp module for vlc
*****************************************************************************
* Copyright (C) 2000-2002 VideoLAN
* $Id: oss.c,v 1.36 2002/12/07 15:25:26 gbazin Exp $
* $Id: oss.c,v 1.37 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -205,6 +205,9 @@ static void Probe( aout_instance_t * p_aout )
val.psz_string = N_("Mono");
var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val );
}
val.b_bool = VLC_TRUE;
var_Set( p_aout, "intf-change", val );
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* sdl.c : SDL audio output plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2002 VideoLAN
* $Id: sdl.c,v 1.16 2002/12/07 15:25:26 gbazin Exp $
* $Id: sdl.c,v 1.17 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -202,6 +202,9 @@ static int Open ( vlc_object_t *p_this )
var_AddCallback( p_aout, "audio-device", aout_ChannelsRestart,
NULL );
val.b_bool = VLC_TRUE;
var_Set( p_aout, "intf-change", val );
}
p_aout->output.output.i_rate = obtained.freq;
......
......@@ -2,7 +2,7 @@
* rc.c : remote control stdin/stdout plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: rc.c,v 1.15 2002/12/07 15:25:26 gbazin Exp $
* $Id: rc.c,v 1.16 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
*
......@@ -737,7 +737,7 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t val;
int i, i_vals;
vlc_value_t * p_vals;
char * psz_value;
const char * psz_value;
if ( var_Get( (vlc_object_t *)p_aout, psz_variable, &val ) < 0 )
{
......
......@@ -2,7 +2,7 @@
* controls.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: controls.m,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id: controls.m,v 1.2 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -66,6 +66,7 @@
- (IBAction)toggleTitle:(id)sender;
- (IBAction)toggleChapter:(id)sender;
- (IBAction)toggleLanguage:(id)sender;
- (IBAction)toggleVar:(id)sender;
@end
......@@ -209,24 +210,47 @@
- (IBAction)volumeUp:(id)sender
{
/*
intf_thread_t * p_intf = [NSApp getIntf];
*/
aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
/* TODO, kAudioDevicePropertyVolumeScalar */
if ( p_aout != NULL )
{
aout_VolumeUp( p_aout, 1, NULL );
vlc_object_release( (vlc_object_t *)p_aout );
}
}
- (IBAction)volumeDown:(id)sender
{
/*
intf_thread_t * p_intf = [NSApp getIntf];
*/
aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
/* TODO, kAudioDevicePropertyVolumeScalar */
if ( p_aout != NULL )
{
aout_VolumeDown( p_aout, 1, NULL );
vlc_object_release( (vlc_object_t *)p_aout );
}
}
- (IBAction)mute:(id)sender
{
#if 0
intf_thread_t * p_intf = [NSApp getIntf];
aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout != NULL )
{
aout_VolumeMute( p_aout, NULL );
vlc_object_release( (vlc_object_t *)p_aout );
}
NSMenuItem * o_mi = (NSMenuItem *)sender;
p_intf->p_sys->b_mute = !p_intf->p_sys->b_mute;
[o_mi setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
#else
OSStatus err;
AudioDeviceID device;
UInt32 ui_param_size;
......@@ -256,6 +280,7 @@
msg_Err( p_intf, "AudioDeviceSetProperty failed (%d)", err );
return;
}
#endif
}
- (IBAction)fullscreen:(id)sender
......@@ -381,6 +406,27 @@
#undef p_input
}
- (IBAction)toggleVar:(id)sender
{
NSMenuItem * o_mi = (NSMenuItem *)sender;
intf_thread_t * p_intf = [NSApp getIntf];
if( [o_mi state] == NSOffState )
{
const char * psz_variable = (const char *)[o_mi tag];
char * psz_value = [[o_mi title] cString];
vlc_object_t * p_object = (vlc_object_t *)
[[o_mi representedObject] pointerValue];
vlc_value_t val;
val.psz_string = psz_value;
if ( var_Set( p_object, psz_variable, val ) < 0 )
{
msg_Warn( p_object, "cannot set variable (%s)", psz_value );
}
}
}
@end
@implementation VLCControls (NSMenuValidation)
......
......@@ -2,7 +2,7 @@
* intf.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.h,v 1.3 2002/11/05 03:57:16 jlj Exp $
* $Id: intf.h,v 1.4 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -66,6 +66,8 @@ struct intf_sys_t
vlc_bool_t b_title_update;
vlc_bool_t b_audio_update;
vlc_bool_t b_spu_update;
vlc_bool_t b_aout_update;
vlc_bool_t b_vout_update;
/* The input thread */
input_thread_t * p_input;
......@@ -132,7 +134,9 @@ struct intf_sys_t
IBOutlet id o_mi_vol_up;
IBOutlet id o_mi_vol_down;
IBOutlet id o_mi_mute;
IBOutlet id o_mi_channels;
IBOutlet id o_mi_fullscreen;
IBOutlet id o_mi_screen;
IBOutlet id o_mi_deinterlace;
IBOutlet id o_mi_program;
IBOutlet id o_mi_title;
......@@ -162,6 +166,10 @@ struct intf_sys_t
es:(es_descriptor_t *)p_es
category:(int)i_cat
selector:(SEL)pf_callback;
- (void)setupVarMenu:(NSMenuItem *)o_mi
target:(vlc_object_t *)p_object
var:(const char *)psz_var
selector:(SEL)pf_callback;
- (IBAction)clearRecentItems:(id)sender;
- (void)openRecentItem:(id)sender;
......
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.m,v 1.6 2002/12/04 20:51:23 jlj Exp $
* $Id: intf.m,v 1.7 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -221,10 +221,12 @@ static void Run( intf_thread_t *p_intf )
[o_mi_previous setTitle: _NS("Prev")];
[o_mi_next setTitle: _NS("Next")];
[o_mi_loop setTitle: _NS("Loop")];
[o_mi_vol_up setTitle: _NS("Volume Up")];
[o_mi_vol_down setTitle: _NS("Volume Down")];
[o_mi_vol_up setTitle: _NS("Louder")];
[o_mi_vol_down setTitle: _NS("Softer")];
[o_mi_mute setTitle: _NS("Mute")];
[o_mi_channels setTitle: _NS("Channels")];
[o_mi_fullscreen setTitle: _NS("Fullscreen")];
[o_mi_screen setTitle: _NS("Screen")];
[o_mi_deinterlace setTitle: _NS("Deinterlace")];
[o_mi_program setTitle: _NS("Program")];
[o_mi_title setTitle: _NS("Title")];
......@@ -298,9 +300,14 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->p_input = NULL;
}
if( p_intf->p_sys->p_input )
if( p_intf->p_sys->p_input != NULL )
{
input_thread_t *p_input = p_intf->p_sys->p_input;
vlc_bool_t b_need_menus = 0;
input_thread_t * p_input = p_intf->p_sys->p_input;
aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
vout_thread_t * p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
vlc_mutex_lock( &p_input->stream.stream_lock );
......@@ -310,7 +317,7 @@ static void Run( intf_thread_t *p_intf )
if( p_input->stream.b_changed )
{
[self manageMode];
[self setupMenus];
b_need_menus = 1;
p_intf->p_sys->b_playing = 1;
}
......@@ -318,10 +325,37 @@ static void Run( intf_thread_t *p_intf )
p_input->stream.p_selected_area->i_part )
{
p_intf->p_sys->b_chapter_update = 1;
[self setupMenus];
b_need_menus = 1;
}
}
if ( p_aout != NULL )
{
vlc_value_t val;
if ( var_Get( (vlc_object_t *)p_aout, "intf-change", &val )
>= 0 && val.b_bool )
{
p_intf->p_sys->b_aout_update = 1;
b_need_menus = 1;
}
vlc_object_release( (vlc_object_t *)p_aout );
}
if ( p_vout != NULL )
{
vlc_value_t val;
if ( var_Get( (vlc_object_t *)p_vout, "intf-change", &val )
>= 0 && val.b_bool )
{
p_intf->p_sys->b_vout_update = 1;
b_need_menus = 1;
}
vlc_object_release( (vlc_object_t *)p_vout );
}
if ( b_need_menus )
[self setupMenus];
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
else if( p_intf->p_sys->b_playing && !p_intf->b_die )
......@@ -464,7 +498,7 @@ static void Run( intf_thread_t *p_intf )
vlc_bool_t b_control = 0;
intf_thread_t * p_intf = [NSApp getIntf];
if( p_intf->p_sys->p_input )
if( p_intf->p_sys->p_input != NULL )
{
/* control buttons for free pace streams */
b_control = p_intf->p_sys->p_input->stream.b_pace_control;
......@@ -488,6 +522,8 @@ static void Run( intf_thread_t *p_intf )
[o_mi_chapter setEnabled: FALSE];
[o_mi_language setEnabled: FALSE];
[o_mi_subtitle setEnabled: FALSE];
[o_mi_channels setEnabled: FALSE];
[o_mi_screen setEnabled: FALSE];
}
}
......@@ -680,6 +716,48 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->b_spu_update = 0;
}
if ( p_intf->p_sys->b_aout_update )
{
aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout != NULL )
{
vlc_value_t val;
val.b_bool = 0;
var_Set( (vlc_object_t *)p_aout, "intf-change", val );
[self setupVarMenu: o_mi_channels target: (vlc_object_t *)p_aout
var: "audio-channels" selector: @selector(toggleVar:)];
vlc_object_release( (vlc_object_t *)p_aout );
}
p_intf->p_sys->b_aout_update = 0;
}
if ( p_intf->p_sys->b_vout_update )
{
vout_thread_t * p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if ( p_vout != NULL )
{
vlc_value_t val;
val.b_bool = 0;
var_Set( (vlc_object_t *)p_vout, "intf-change", val );
[self setupVarMenu: o_mi_screen target: (vlc_object_t *)p_vout
var: "video-device" selector: @selector(toggleVar:)];
vlc_object_release( (vlc_object_t *)p_vout );
}
p_intf->p_sys->b_vout_update = 0;
}
vlc_mutex_lock( &p_input->stream.stream_lock );
#undef p_input
......@@ -701,6 +779,11 @@ static void Run( intf_thread_t *p_intf )
[o_menu removeItemAtIndex: 0];
}
/* make sensitive : we can't change it after we build the menu, and
* before, we don't yet how many items we will have. So make it
* always sensitive. --Meuuh */
[o_mi setEnabled: TRUE];
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
#define ES p_intf->p_sys->p_input->stream.pp_es[i]
......@@ -745,10 +828,68 @@ static void Run( intf_thread_t *p_intf )
#undef ES
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
- (void)setupVarMenu:(NSMenuItem *)o_mi
target:(vlc_object_t *)p_object
var:(const char *)psz_variable
selector:(SEL)pf_callback
{
int i, i_nb_items;
NSMenu * o_menu = [o_mi submenu];
vlc_value_t val;
int i_vals;
vlc_value_t * p_vals;
char * psz_value;
/* remove previous items */
i_nb_items = [o_menu numberOfItems];
for( i = 0; i < i_nb_items; i++ )
{
[o_menu removeItemAtIndex: 0];
}
if ( var_Get( p_object, psz_variable, &val ) < 0 )
{
return;
}
psz_value = val.psz_string;
if ( var_Change( p_object, psz_variable,
VLC_VAR_GETLIST, &val ) < 0 )
{
free( psz_value );
return;
}
i_vals = ((vlc_value_t *)val.p_address)[0].i_int;
p_vals = &((vlc_value_t *)val.p_address)[1]; /* Starts at index 1 */
/* make (un)sensitive */
[o_mi setEnabled:
[o_menu numberOfItems] ? TRUE : FALSE];
[o_mi setEnabled: (i_vals > 0)];
for ( i = 0; i < i_vals; i++ )
{
NSMenuItem * o_lmi;
NSString * o_title;
o_title = [NSString stringWithCString: p_vals[i].psz_string];
o_lmi = [o_menu addItemWithTitle: o_title
action: pf_callback keyEquivalent: @""];
/* FIXME: this isn't 64-bit clean ! */
[o_lmi setTag: (int)psz_variable];
[o_lmi setRepresentedObject:
[NSValue valueWithPointer: p_object]];
[o_lmi setTarget: o_controls];
if ( !strcmp( psz_value, p_vals[i].psz_string ) )
[o_lmi setState: NSOnState];
}
var_Change( p_object, psz_variable, VLC_VAR_FREELIST,
&val );
free( psz_value );
}
- (IBAction)clearRecentItems:(id)sender
......@@ -856,6 +997,26 @@ static void Run( intf_thread_t *p_intf )
if( p_req->i_type == VOUT_REQ_CREATE_WINDOW )
{
VLCView * o_view;
NSScreen * p_screen;
NSMenu * o_menu = [o_mi_screen submenu];
int i, i_nb_items = [o_menu numberOfItems];
for( i = 0; i < i_nb_items; i++ )
{
if ( [[o_menu itemAtIndex:i] state] ) break;
}
NSArray * p_screens = [NSScreen screens];
if ( i == i_nb_items || [p_screens count] < i )
{
/* This shouldn't happen. */
p_screen = [NSScreen mainScreen];
}
else
{
p_screen = [p_screens objectAtIndex: i];
}
p_req->p_vout->p_sys->o_window = [VLCWindow alloc];
[p_req->p_vout->p_sys->o_window setVout: p_req->p_vout];
......@@ -864,10 +1025,10 @@ static void Run( intf_thread_t *p_intf )
if( p_req->p_vout->b_fullscreen )
{
[p_req->p_vout->p_sys->o_window
initWithContentRect: [[NSScreen mainScreen] frame]
initWithContentRect: [p_screen frame]
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer: NO screen: [NSScreen mainScreen]];
defer: NO screen: p_screen];
[p_req->p_vout->p_sys->o_window
setLevel: NSModalPanelWindowLevel];
......@@ -882,7 +1043,7 @@ static void Run( intf_thread_t *p_intf )
initWithContentRect: p_req->p_vout->p_sys->s_rect
styleMask: i_stylemask
backing: NSBackingStoreBuffered
defer: NO screen: [NSScreen mainScreen]];
defer: NO screen: p_screen];
if( !p_req->p_vout->p_sys->b_pos_saved )
{
......
......@@ -2,7 +2,7 @@
* vout.m: MacOS X video output plugin
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: vout.m,v 1.5 2002/12/04 20:51:23 jlj Exp $
* $Id: vout.m,v 1.6 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
......@@ -173,6 +173,33 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
return( 1 );
}
NSArray * p_screens = [NSScreen screens];
if ( [p_screens count] > 0 )
{
vlc_value_t val;
var_Destroy( p_vout, "video-device" );
var_Create( p_vout, "video-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
NSEnumerator * p_enumerator = [p_screens objectEnumerator];
NSScreen * p_screen;
int i = 1;
while ( (p_screen = [p_enumerator nextObject]) != NULL )
{
NSRect p_rect = [p_screen frame];
char psz_temp[255];
snprintf(psz_temp, sizeof(psz_temp), "%s %d (%dx%d)",
_("Screen"), i, (int)p_rect.size.width,
(int)p_rect.size.height);
val.psz_string = psz_temp;
var_Change( p_vout, "video-device", VLC_VAR_ADDCHOICE, &val );
i++;
}
var_AddCallback( p_vout, "video-device", vout_VarCallback,
NULL );
val.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val );
}
if( CoCreateWindow( p_vout ) )
{
msg_Err( p_vout, "unable to create window" );
......@@ -736,39 +763,29 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
switch( key )
{
#if 0
case (unichar)0xf700: /* up-arrow */
{
aout_thread_t * p_aout = vlc_object_find( p_vout, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_aout != NULL )
aout_instance_t * p_aout = vlc_object_find( p_vout, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout != NULL )
{
if( p_aout->i_volume + VOLUME_STEP <= VOLUME_MAX )
{
p_aout->i_volume += VOLUME_STEP;
}
vlc_object_release( p_aout );
}
aout_VolumeUp( p_aout, 1, NULL );
vlc_object_release( (vlc_object_t *)p_aout );
}
}
break;
case (unichar)0xf701: /* down-arrow */
{
aout_thread_t * p_aout = vlc_object_find( p_vout, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_aout != NULL )
aout_instance_t * p_aout = vlc_object_find( p_vout, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout != NULL )
{
if( p_aout->i_volume - VOLUME_STEP >= VOLUME_MIN )
{
p_aout->i_volume -= VOLUME_STEP;
}
vlc_object_release( p_aout );
aout_VolumeDown( p_aout, 1, NULL );
vlc_object_release( (vlc_object_t *)p_aout );
}
}
break;
#endif
case 'f': case 'F':
[self toggleFullscreen];
......
......@@ -2,7 +2,7 @@
* common.c : audio output management of common data structures
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: common.c,v 1.10 2002/12/06 10:10:39 sam Exp $
* $Id: common.c,v 1.11 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -43,6 +43,7 @@
aout_instance_t * __aout_New( vlc_object_t * p_parent )
{
aout_instance_t * p_aout;
vlc_value_t val;
/* Allocate descriptor. */
p_aout = vlc_object_create( p_parent, VLC_OBJECT_AOUT );
......@@ -60,14 +61,11 @@ aout_instance_t * __aout_New( vlc_object_t * p_parent )
p_aout->mixer.b_error = 1;
p_aout->output.b_starving = 1;
vlc_object_attach( p_aout, p_parent->p_vlc );
var_Create( p_aout, "intf-change", VLC_VAR_BOOL );
val.b_bool = VLC_TRUE;
var_Set( p_aout, "intf-change", val );
var_Create( p_aout, "physical-channels", VLC_VAR_INTEGER );
var_AddCallback( p_aout, "physical-channels", aout_ChannelsRestart,
NULL );
var_Create( p_aout, "original-channels", VLC_VAR_INTEGER );
var_AddCallback( p_aout, "original-channels", aout_ChannelsRestart,
NULL );
vlc_object_attach( p_aout, p_parent->p_vlc );
return p_aout;
}
......@@ -77,7 +75,7 @@ aout_instance_t * __aout_New( vlc_object_t * p_parent )
*****************************************************************************/
void aout_Delete( aout_instance_t * p_aout )
{
var_Destroy( p_aout, "channels" );
var_Destroy( p_aout, "intf-change" );
vlc_mutex_destroy( &p_aout->input_fifos_lock );
vlc_mutex_destroy( &p_aout->mixer_lock );
......
......@@ -2,7 +2,7 @@
* intf.c : audio output API towards the interface modules
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.c,v 1.9 2002/12/06 10:10:39 sam Exp $
* $Id: intf.c,v 1.10 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -205,6 +205,51 @@ int aout_VolumeDown( aout_instance_t * p_aout, int i_nb_steps,
return i_result;
}
/*****************************************************************************
* aout_VolumeMute : Mute/un-mute the output volume
*****************************************************************************
* If pi_volume != NULL, *pi_volume will contain the volume at the end of the
* function (muted => 0).
*****************************************************************************/
int aout_VolumeMute( aout_instance_t * p_aout, audio_volume_t * pi_volume )
{
int i_result;
audio_volume_t i_volume;
vlc_mutex_lock( &p_aout->mixer_lock );
if ( p_aout->mixer.b_error )
{
/* The output module is destroyed. */
vlc_mutex_unlock( &p_aout->mixer_lock );
msg_Err( p_aout, "VolumeUp called without output module" );
return -1;
}
if ( p_aout->output.pf_volume_get( p_aout, &i_volume ) )
{
vlc_mutex_unlock( &p_aout->mixer_lock );
return -1;
}
if ( i_volume == 0 )
{
i_volume = p_aout->output.i_saved_volume;
}
else
{
p_aout->output.i_saved_volume = i_volume;
i_volume = 0;
}
i_result = p_aout->output.pf_volume_set( p_aout, i_volume );
vlc_mutex_unlock( &p_aout->mixer_lock );
if ( pi_volume != NULL ) *pi_volume = i_volume;
return i_result;
}
/*
* The next functions are not supposed to be called by the interface, but
* are placeholders for software-only scaling.
......
......@@ -2,7 +2,7 @@
* output.c : internal management of output streams for the audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: output.c,v 1.26 2002/12/07 15:25:27 gbazin Exp $
* $Id: output.c,v 1.27 2002/12/07 23:50:30 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -43,6 +43,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
/* Retrieve user defaults. */
char * psz_name = config_GetPsz( p_aout, "aout" );
int i_rate = config_GetInt( p_aout, "aout-rate" );
vlc_value_t val;
memcpy( &p_aout->output.output, p_format, sizeof(audio_sample_format_t) );
if ( i_rate != -1 )
......@@ -66,7 +67,6 @@ int aout_OutputNew( aout_instance_t * p_aout,
(VLC_VAR_STRING | VLC_VAR_HASCHOICE) )
{
/* The user may have selected a different channels configuration. */
vlc_value_t val;
var_Get( p_aout, "audio-channels", &val );
if ( !strcmp( val.psz_string, N_("Both") ) )
......@@ -92,7 +92,6 @@ int aout_OutputNew( aout_instance_t * p_aout,
else if ( p_aout->output.output.i_physical_channels == AOUT_CHAN_CENTER )
{
/* Mono - create the audio-channels variable. */
vlc_value_t val;
var_Create( p_aout, "audio-channels", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
if ( p_aout->output.output.i_original_channels & AOUT_CHAN_DUALMONO )
{
......@@ -117,7 +116,6 @@ int aout_OutputNew( aout_instance_t * p_aout,
(AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) )
{
/* Stereo - create the audio-channels variable. */
vlc_value_t val;
var_Create( p_aout, "audio-channels", VLC_VAR_STRING | VLC_VAR_HASCHOICE );
val.psz_string = N_("Both");
var_Change( p_aout, "audio-channels", VLC_VAR_ADDCHOICE, &val );
......@@ -134,6 +132,8 @@ int aout_OutputNew( aout_instance_t * p_aout,
var_AddCallback( p_aout, "audio-channels", aout_ChannelsRestart,
NULL );
}
val.b_bool = VLC_TRUE;
var_Set( p_aout, "intf-change", val );
aout_FormatPrepare( &p_aout->output.output );
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.202 2002/11/28 17:35:00 sam Exp $
* $Id: video_output.c,v 1.203 2002/12/07 23:50:31 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -138,6 +138,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
vout_thread_t * p_vout; /* thread descriptor */
int i_index; /* loop variable */
char * psz_plugin;
vlc_value_t val;
/* Allocate descriptor */
p_vout = vlc_object_create( p_parent, VLC_OBJECT_VOUT );
......@@ -147,6 +148,10 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
return NULL;
}
var_Create( p_vout, "intf-change", VLC_VAR_BOOL );
val.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val );
/* If the parent is not a VOUT object, that means we are at the start of
* the video output pipe */
if( p_parent->i_object_type != VLC_OBJECT_VOUT )
......@@ -333,6 +338,8 @@ void vout_Destroy( vout_thread_t *p_vout )
p_vout->b_die = VLC_TRUE;
vlc_thread_join( p_vout );
var_Destroy( p_vout, "intf-change" );
/* Free structure */
vlc_object_destroy( p_vout );
}
......@@ -1040,3 +1047,17 @@ static void InitWindowSize( vout_thread_t *p_vout, int *pi_width,
#undef FP_FACTOR
}
/*****************************************************************************
* vout_VarCallback: generic callback for intf variables
*****************************************************************************/
int vout_VarCallback( vlc_object_t * p_this, const char * psz_variable,
vlc_value_t old_value, vlc_value_t new_value,
void * unused )
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
val.b_bool = 1;
var_Set( p_vout, "intf-change", val );
return 0;
}
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