Commit 3a361d2f authored by Christophe Massiot's avatar Christophe Massiot

Improvements of the OS X GUI.

parent a4fcb5e2
......@@ -3,7 +3,10 @@
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
ACTIONS = {
eject = id;
faster = id;
fullscreen = id;
mute = id;
next = id;
pause = id;
play = id;
......
......@@ -3,16 +3,25 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>729 10 500 426 0 0 1600 1178 </string>
<string>13 255 500 426 0 0 1152 746 </string>
<key>IBEditorPositions</key>
<dict>
<key>235</key>
<string>401 417 350 182 0 0 1152 746 </string>
<key>29</key>
<string>108 456 205 44 0 0 1600 1178 </string>
<string>804 409 205 44 0 0 1152 746 </string>
<key>445</key>
<string>347 561 370 117 0 0 1152 746 </string>
<key>460</key>
<string>120 456 104 66 0 0 1600 1178 </string>
<string>84 279 104 66 0 0 1152 746 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBOpenObjects</key>
<array>
<integer>29</integer>
<integer>21</integer>
</array>
<key>IBSystem Version</key>
<string>5Q125</string>
</dict>
......
......@@ -105,7 +105,7 @@
/* Duration between the time we receive the data packet, and the time we will
* mark it to be presented */
#define DEFAULT_PTS_DELAY (mtime_t)(.2*CLOCK_FREQ)
#define DEFAULT_PTS_DELAY (mtime_t)(.35*CLOCK_FREQ)
/*****************************************************************************
* Audio configuration
......@@ -134,7 +134,7 @@
* - short, in order to be able to play a new song very quickly (especially a
* song from the interface)
* - long, in order to perform the buffer calculations as few as possible */
#define AOUT_BUFFER_DURATION 100000
#define AOUT_BUFFER_DURATION 90000
/*****************************************************************************
* Video configuration
......
......@@ -2,7 +2,7 @@
* intf_controller.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_controller.c,v 1.6 2002/04/23 03:21:21 jlj Exp $
* $Id: intf_controller.c,v 1.7 2002/05/06 22:59:46 massiot Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -155,6 +155,32 @@
[o_intf playlistNext];
}
- (IBAction)mute:(id)sender
{
NSMenuItem * item = (NSMenuItem *)sender;
[o_intf mute];
if( p_main->p_intf->p_sys->b_mute )
{
[item setState:NSOnState];
}
else
{
[item setState:NSOffState];
}
}
- (IBAction)fullscreen:(id)sender
{
[o_intf fullscreen];
}
- (IBAction)eject:(id)sender
{
[o_intf eject];
}
- (IBAction)timesliderUpdate:(id)slider
{
switch( [[NSApp currentEvent] type] )
......
......@@ -2,7 +2,7 @@
* intf_controller.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_controller.h,v 1.5 2002/04/23 03:21:21 jlj Exp $
* $Id: intf_controller.h,v 1.6 2002/05/06 22:59:46 massiot Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
*
......@@ -73,6 +73,9 @@
- (IBAction)slower:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)mute:(id)sender;
- (IBAction)fullscreen:(id)fullscreen;
- (IBAction)eject:(id)sender;
- (IBAction)timesliderUpdate:(id)slider;
- (IBAction)quit:(id)sender;
......
......@@ -2,7 +2,7 @@
* intf_macosx.c: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_macosx.c,v 1.12 2002/04/16 23:00:54 massiot Exp $
* $Id: intf_macosx.c,v 1.13 2002/05/06 22:59:46 massiot Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
......@@ -67,6 +67,7 @@ static int intf_Open( intf_thread_t *p_intf )
p_intf->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
p_intf->p_sys->o_port = [[NSPort port] retain];
p_intf->p_sys->b_mute = 0;
[[NSApplication sharedApplication] autorelease];
[NSBundle loadNibNamed: @"MainMenu" owner: NSApp];
......
......@@ -2,7 +2,7 @@
* intf_open.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_open.h,v 1.1 2002/04/23 03:21:21 jlj Exp $
* $Id: intf_open.h,v 1.2 2002/05/06 22:59:46 massiot Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -26,6 +26,8 @@
*****************************************************************************/
#import <Cocoa/Cocoa.h>
NSArray *GetEjectableMediaOfClass( const char *psz_class );
/*****************************************************************************
* Intf_Open interface
*****************************************************************************/
......
......@@ -2,10 +2,11 @@
* intf_vlc_wrapper.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.c,v 1.10 2002/04/23 03:21:21 jlj Exp $
* $Id: intf_vlc_wrapper.c,v 1.11 2002/05/06 22:59:46 massiot Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -26,13 +27,19 @@
#include <sys/param.h> /* for MAXPATHLEN */
#include <string.h>
#include <IOKit/storage/IOCDMedia.h>
#include <IOKit/storage/IODVDMedia.h>
#include <videolan/vlc.h>
#include "interface.h"
#include "intf_playlist.h"
#include "intf_eject.h"
#include "video.h"
#include "video_output.h"
#include "audio_output.h"
#include "stream_control.h"
#include "input_ext-intf.h"
......@@ -79,6 +86,28 @@ static Intf_VLCWrapper *o_intf = nil;
return( 1 );
}
if( p_input_bank->pp_input[0] != NULL )
{
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
if( !p_input_bank->pp_input[0]->b_die )
{
/* New input or stream map change */
if( p_input_bank->pp_input[0]->stream.b_changed ||
p_main->p_intf->p_sys->i_part !=
p_input_bank->pp_input[0]->stream.p_selected_area->i_part )
{
[self setupMenus];
}
}
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
}
else
{
[self setupMenus];
}
return( 0 );
}
......@@ -195,6 +224,47 @@ static Intf_VLCWrapper *o_intf = nil;
}
}
- (void)mute
{
if( p_aout_bank->pp_aout[0] == NULL ) return;
if( p_main->p_intf->p_sys->b_mute )
{
p_aout_bank->pp_aout[0]->i_volume =
p_main->p_intf->p_sys->i_saved_volume;
}
else
{
p_main->p_intf->p_sys->i_saved_volume =
p_aout_bank->pp_aout[0]->i_volume;
p_aout_bank->pp_aout[0]->i_volume = 0;
}
p_main->p_intf->p_sys->b_mute = !p_main->p_intf->p_sys->b_mute;
}
- (void)fullscreen
{
if( p_vout_bank->pp_vout[0] != NULL )
{
p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE;
}
}
- (void)eject
{
/* FIXME : this will only eject the first drive found */
NSArray * o_devices = GetEjectableMediaOfClass(kIODVDMediaClass);
const char * psz_device;
if ( o_devices == nil )
{
o_devices = GetEjectableMediaOfClass(kIOCDMediaClass);
}
psz_device = [[o_devices objectAtIndex:0] cString];
intf_Eject( psz_device );
}
/* playback info */
#define p_area p_input_bank->pp_input[0]->stream.p_selected_area
......@@ -418,4 +488,25 @@ static Intf_VLCWrapper *o_intf = nil;
config_PutIntVariable( "channel_port", i_port );
}
- (void)setupMenus
{
#if 0
NSMenu * o_main_menu = [NSApp mainMenu];
NSMenuItem * o_program_item = [o_main_menu itemWithTitle:@"Program"];
if( p_input_bank->pp_input[0] == NULL )
{
NSMenu * o_program = [o_program_item submenu];
[o_program_item setEnabled:0];
[o_program removeItemAtIndex:0];
}
else
{
NSMenu * o_program = [o_program_item submenu];
[o_program_item setEnabled:1];
[o_program removeItemAtIndex:0];
}
#endif
}
@end
......@@ -2,7 +2,7 @@
* intf_vlc_wrapper.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.h,v 1.5 2002/04/23 03:21:21 jlj Exp $
* $Id: intf_vlc_wrapper.h,v 1.6 2002/05/06 22:59:46 massiot Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -45,6 +45,9 @@
- (void)playSlower;
- (void)playFaster;
- (void)mute;
- (void)fullscreen;
- (void)eject;
/* playback info */
- (NSString *)getTimeAsString;
......@@ -67,5 +70,6 @@
- (void)openDisc:(NSString*)o_type device:(NSString*)o_device title:(int)i_title chapter:(int)i_chapter;
- (void)openNet:(NSString*)o_protocol addr:(NSString*)o_addr port:(int)i_port baddr:(NSString*)o_baddr;
- (void)openNetChannel:(NSString*)o_addr port:(int)i_port;
- (void)setupMenus;
@end
......@@ -2,7 +2,7 @@
* macosx.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: macosx.h,v 1.7 2002/04/25 23:07:23 massiot Exp $
* $Id: macosx.h,v 1.8 2002/05/06 22:59:46 massiot Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Eugenio Jarosiewicz <ej0@cise.ufl.edu>
......@@ -37,6 +37,11 @@ typedef struct intf_sys_s
{
NSPort *o_port;
NSAutoreleasePool *o_pool;
boolean_t b_mute;
int i_saved_volume;
int i_part;
} intf_sys_t;
/*****************************************************************************
......@@ -52,7 +57,7 @@ typedef struct vout_sys_s
boolean_t b_mouse_moved;
boolean_t b_mouse_pointer_visible;
mtime_t i_time_mouse_last_moved;
CodecType i_codec;
CGrafPtr p_qdport;
ImageSequence i_seq;
......
......@@ -2,10 +2,11 @@
* intf_eject.c: CD/DVD-ROM ejection handling functions
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: intf_eject.c,v 1.9 2002/04/04 22:08:05 massiot Exp $
* $Id: intf_eject.c,v 1.10 2002/05/06 22:59:46 massiot Exp $
*
* Author: Julien Blache <jb@technologeek.org> for the Linux part
* with code taken from the Linux "eject" command
* Jon Lech Johanson <jon-vl@nanocrew.net> for Darwin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -81,7 +82,6 @@ static int EjectSCSI ( int i_fd );
*****************************************************************************/
int intf_Eject( const char *psz_device )
{
int i_fd;
int i_ret;
#ifdef SYS_DARWIN
......@@ -99,7 +99,7 @@ int intf_Eject( const char *psz_device )
if( ( psz_disk = (char *)strstr( psz_device, "disk" ) ) != NULL &&
strlen( psz_disk ) > 4 )
{
#define EJECT_CMD "disktool -e %s 0"
#define EJECT_CMD "/usr/sbin/disktool -e %s 0"
snprintf( sz_cmd, sizeof(sz_cmd), EJECT_CMD, psz_disk );
#undef EJECT_CMD
......@@ -127,7 +127,9 @@ int intf_Eject( const char *psz_device )
return 1;
#endif
#else /* SYS_DARWIN */
int i_fd;
/* This code could be extended to support CD/DVD-ROM chargers */
......@@ -164,6 +166,7 @@ int intf_Eject( const char *psz_device )
close( i_fd );
return i_ret;
#endif
}
/* The following functions are local */
......
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