Commit 30a5f368 authored by Jon Lech Johansen's avatar Jon Lech Johansen

* Added Open disc and network panels.

  * Some changes to the control layout.
parent 1521d766
......@@ -3,31 +3,67 @@
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
ACTIONS = {
fullscreen_toggle = id;
openFile = id;
faster = id;
next = id;
pause = id;
play = id;
prev = id;
quit = id;
speedslider_update = id;
slower = id;
stop = id;
timeslider_update = id;
timesliderUpdate = id;
};
CLASS = Intf_Controller;
LANGUAGE = ObjC;
OUTLETS = {
o_currenttime = id;
o_menu_fullscreen = id;
o_pause = id;
o_play = id;
o_playlistds = id;
o_stepf = id;
o_stepr = id;
o_stop = id;
o_time = id;
o_timeslider = id;
o_window = id;
};
SUPERCLASS = NSObject;
},
{
ACTIONS = {
openDisc = id;
openDiscTypeChanged = id;
openFile = id;
openNet = id;
openNetBroadcast = id;
openNetChannel = id;
panelCancel = id;
panelOk = id;
};
CLASS = Intf_Open;
LANGUAGE = ObjC;
OUTLETS = {
o_disc_chapter = id;
o_disc_device = id;
o_disc_panel = id;
o_disc_title = id;
o_disc_type = id;
o_net_channel_addr = id;
o_net_channel_checkbox = id;
o_net_channel_port = id;
o_net_channel_port_label = id;
o_net_channel_pstepper = id;
o_net_panel = id;
o_net_protocol = id;
o_net_server_addr = id;
o_net_server_addr_label = id;
o_net_server_baddr = id;
o_net_server_bcheckbox = id;
o_net_server_port = id;
o_net_server_port_label = id;
o_net_server_pstepper = id;
};
SUPERCLASS = NSObject;
},
{
CLASS = Intf_PlaylistDS;
LANGUAGE = ObjC;
......
......@@ -3,21 +3,17 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>120 494 428 240 0 0 1600 1178 </string>
<string>729 10 500 426 0 0 1600 1178 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>73 282 257 44 0 0 1152 746 </string>
<string>108 456 205 44 0 0 1600 1178 </string>
<key>460</key>
<string>120 456 104 66 0 0 1600 1178 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
</array>
<key>IBSystem Version</key>
<string>5Q45</string>
<string>5Q125</string>
</dict>
</plist>
......@@ -79,6 +79,8 @@
F679974A020DCC2A01A80112,
F6EA76F5024171E201A80112,
F6EA76F6024171E201A80112,
F66B34EC0271A5AF01A80112,
F66B34ED0271A5AF01A80112,
);
isa = PBXGroup;
name = Files;
......@@ -338,6 +340,18 @@
//F62
//F63
//F64
F66B34EC0271A5AF01A80112 = {
isa = PBXFileReference;
name = intf_open.c;
path = plugins/macosx/intf_open.c;
refType = 4;
};
F66B34ED0271A5AF01A80112 = {
isa = PBXFileReference;
name = intf_open.h;
path = plugins/macosx/intf_open.h;
refType = 4;
};
F6799746020DCC2A01A80112 = {
isa = PBXFileReference;
name = intf_macosx.c;
......
macosx_SOURCES = macosx.c aout_macosx.c vout_macosx.c vout_window.c vout_qdview.c vout_vlc_wrapper.c intf_macosx.c intf_controller.c intf_vlc_wrapper.c
macosx_SOURCES = macosx.c aout_macosx.c vout_macosx.c vout_window.c vout_qdview.c vout_vlc_wrapper.c intf_macosx.c intf_controller.c intf_vlc_wrapper.c intf_open.c
......@@ -2,7 +2,7 @@
* intf_controller.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_controller.c,v 1.5 2002/04/16 23:00:54 massiot Exp $
* $Id: intf_controller.c,v 1.6 2002/04/23 03:21:21 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -67,7 +67,7 @@
{
if( [o_intf playlistPlaying] )
{
[o_currenttime setStringValue: [o_intf getTimeAsString]];
[o_time setStringValue: [o_intf getTimeAsString]];
if( f_slider == f_slider_old )
{
......@@ -120,27 +120,6 @@
/* Functions attached to user interface */
- (IBAction)openFile:(id)sender
{
NSOpenPanel *o_panel = [NSOpenPanel openPanel];
[o_panel setAllowsMultipleSelection: YES];
if( [o_panel runModalForDirectory: NSHomeDirectory()
file: nil types: nil] == NSOKButton )
{
NSString *o_file;
NSEnumerator *o_files = [[o_panel filenames] objectEnumerator];
while( ( o_file = (NSString *)[o_files nextObject] ) )
{
[o_intf playlistAdd: o_file];
}
[o_intf playlistPlayCurrent];
}
}
- (IBAction)pause:(id)sender
{
[o_intf playlistPause];
......@@ -148,7 +127,7 @@
- (IBAction)play:(id)sender
{
[o_intf playlistPlayCurrent];
[o_intf playlistPlay];
}
- (IBAction)stop:(id)sender
......@@ -156,7 +135,27 @@
[o_intf playlistStop];
}
- (IBAction)timeslider_update:(id)slider
- (IBAction)faster:(id)sender
{
[o_intf playFaster];
}
- (IBAction)slower:(id)sender
{
[o_intf playSlower];
}
- (IBAction)prev:(id)sender
{
[o_intf playlistPrev];
}
- (IBAction)next:(id)sender
{
[o_intf playlistNext];
}
- (IBAction)timesliderUpdate:(id)slider
{
switch( [[NSApp currentEvent] type] )
{
......@@ -174,16 +173,6 @@
}
}
- (IBAction)speedslider_update:(id)slider
{
[o_intf setSpeed: (intf_speed_t)[slider intValue]];
}
- (IBAction)fullscreen_toggle:(id)sender
{
}
- (IBAction)quit:(id)sender
{
[o_intf quit];
......
......@@ -2,7 +2,7 @@
* intf_controller.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_controller.h,v 1.4 2002/03/19 03:33:52 jlj Exp $
* $Id: intf_controller.h,v 1.5 2002/04/23 03:21:21 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
*
......@@ -54,8 +54,7 @@
IBOutlet NSButton *o_stepr;
IBOutlet NSButton *o_stepf;
IBOutlet NSSlider *o_timeslider;
IBOutlet NSTextField *o_currenttime;
IBOutlet NSMenuItem *o_menu_fs;
IBOutlet NSTextField *o_time;
IBOutlet Intf_PlaylistDS *o_playlistds;
}
......@@ -67,13 +66,14 @@
- (void)terminate;
/* Functions atteched to user interface */
- (IBAction)openFile:(id)sender;
- (IBAction)pause:(id)sender;
- (IBAction)play:(id)sender;
- (IBAction)stop:(id)sender;
- (IBAction)timeslider_update:(id)slider;
- (IBAction)speedslider_update:(id)slider;
- (IBAction)fullscreen_toggle:(id)sender;
- (IBAction)faster:(id)sender;
- (IBAction)slower:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)timesliderUpdate:(id)slider;
- (IBAction)quit:(id)sender;
@end
/*****************************************************************************
* intf_open.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_open.c,v 1.1 2002/04/23 03:21:21 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <paths.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/IOBSD.h>
#include <IOKit/storage/IOMedia.h>
#include <IOKit/storage/IOCDMedia.h>
#include <IOKit/storage/IODVDMedia.h>
#import "intf_open.h"
#import "intf_vlc_wrapper.h"
/*****************************************************************************
* GetEjectableMediaOfClass
*****************************************************************************/
NSArray *GetEjectableMediaOfClass( const char *psz_class )
{
io_object_t next_media;
mach_port_t master_port;
kern_return_t kern_result;
NSArray *o_devices = nil;
NSMutableArray *p_list = nil;
io_iterator_t media_iterator;
CFMutableDictionaryRef classes_to_match;
kern_result = IOMasterPort( MACH_PORT_NULL, &master_port );
if( kern_result != KERN_SUCCESS )
{
return( nil );
}
classes_to_match = IOServiceMatching( psz_class );
if( classes_to_match == NULL )
{
return( nil );
}
CFDictionarySetValue( classes_to_match, CFSTR( kIOMediaEjectable ),
kCFBooleanTrue );
kern_result = IOServiceGetMatchingServices( master_port, classes_to_match,
&media_iterator );
if( kern_result != KERN_SUCCESS )
{
return( nil );
}
p_list = [NSMutableArray arrayWithCapacity: 1];
next_media = IOIteratorNext( media_iterator );
if( next_media != NULL )
{
char psz_buf[0x32];
size_t dev_path_length;
CFTypeRef str_bsd_path;
do
{
str_bsd_path = IORegistryEntryCreateCFProperty( next_media,
CFSTR( kIOBSDName ),
kCFAllocatorDefault,
0 );
if( str_bsd_path == NULL )
{
IOObjectRelease( next_media );
continue;
}
snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' );
dev_path_length = strlen( psz_buf );
if( CFStringGetCString( str_bsd_path,
(char*)&psz_buf + dev_path_length,
sizeof(psz_buf) - dev_path_length,
kCFStringEncodingASCII ) )
{
[p_list addObject: [NSString stringWithCString: psz_buf]];
}
CFRelease( str_bsd_path );
IOObjectRelease( next_media );
} while( ( next_media = IOIteratorNext( media_iterator ) ) != NULL );
}
IOObjectRelease( media_iterator );
o_devices = [NSArray arrayWithArray: p_list];
return( o_devices );
}
/*****************************************************************************
* Intf_Open implementation
*****************************************************************************/
@implementation Intf_Open
static Intf_Open *o_open = nil;
- (id)init
{
if( o_open == nil )
{
o_open = [super init];
}
return( o_open );
}
+ (Intf_Open *)instance
{
return( o_open );
}
- (void)awakeFromNib
{
[o_net_channel_pstepper setEnabled: FALSE];
[o_net_server_addr addItemWithObjectValue: @"vls"];
[o_net_server_addr selectItemAtIndex: 0];
[o_net_server_baddr setStringValue: @"138.195.143.255"];
[o_net_server_port setIntValue: 1234];
[o_net_server_pstepper setIntValue: [o_net_server_port intValue]];
[o_net_channel_addr setStringValue: @"138.195.143.120"];
[o_net_channel_port setIntValue: 6010];
[o_net_channel_pstepper setIntValue: [o_net_channel_port intValue]];
}
- (IBAction)openDisc:(id)sender
{
int i_result;
[self openDiscTypeChanged: nil];
[o_disc_panel makeKeyAndOrderFront: self];
i_result = [NSApp runModalForWindow: o_disc_panel];
[o_disc_panel close];
if( i_result )
{
NSString *o_type = [[o_disc_type selectedCell] title];
NSString *o_device = [o_disc_device stringValue];
int i_title = [o_disc_title intValue];
int i_chapter = [o_disc_chapter intValue];
[[Intf_VLCWrapper instance] openDisc: [o_type lowercaseString]
device: o_device title: i_title chapter: i_chapter];
}
}
- (IBAction)openDiscTypeChanged:(id)sender
{
NSString *o_type;
NSArray *o_devices;
const char *psz_class = NULL;
[o_disc_device removeAllItems];
o_type = [[o_disc_type selectedCell] title];
if( [o_type isEqualToString: @"DVD"] )
{
psz_class = kIODVDMediaClass;
}
else
{
psz_class = kIOCDMediaClass;
}
o_devices = GetEjectableMediaOfClass( psz_class );
if( o_devices != nil )
{
int i_devices = [o_devices count];
if( i_devices )
{
int i;
for( i = 0; i < i_devices; i++ )
{
[o_disc_device
addItemWithObjectValue: [o_devices objectAtIndex: i]];
}
[o_disc_device selectItemAtIndex: 0];
}
else
{
[o_disc_device setStringValue:
[NSString stringWithFormat: @"No %@s found", o_type]];
}
}
}
- (IBAction)openFile:(id)sender
{
NSOpenPanel *o_panel = [NSOpenPanel openPanel];
[o_panel setAllowsMultipleSelection: YES];
if( [o_panel runModalForDirectory: NSHomeDirectory()
file: nil types: nil] == NSOKButton )
{
[[Intf_VLCWrapper instance] openFiles: [o_panel filenames]];
}
}
- (IBAction)openNet:(id)sender
{
int i_result;
[o_net_panel makeKeyAndOrderFront: self];
i_result = [NSApp runModalForWindow: o_net_panel];
[o_net_panel close];
if( i_result )
{
BOOL b_channel;
BOOL b_broadcast;
NSString *o_protocol;
o_protocol = [[o_net_protocol selectedCell] title];
b_channel = [o_net_channel_checkbox state] == NSOnState;
b_broadcast = [o_net_server_bcheckbox state] == NSOnState;
if( [o_protocol isEqualToString: @"TS"] )
{
o_protocol = @"udpstream";
}
else if( [o_protocol isEqualToString: @"RTP"] )
{
o_protocol = @"rtp";
}
if( b_channel )
{
NSString *o_channel_addr = [o_net_channel_addr stringValue];
int i_channel_port = [o_net_channel_port intValue];
[[Intf_VLCWrapper instance]
openNetChannel: o_channel_addr port: i_channel_port];
}
else
{
NSString *o_addr = [o_net_server_addr stringValue];
int i_port = [o_net_server_port intValue];
if( b_broadcast )
{
NSString *o_baddr = [o_net_server_baddr stringValue];
[[Intf_VLCWrapper instance]
openNet: o_protocol addr: o_addr
port: i_port baddr: o_baddr];
}
else
{
[[Intf_VLCWrapper instance]
openNet: o_protocol addr: o_addr
port: i_port baddr: nil];
}
}
}
}
- (IBAction)openNetBroadcast:(id)sender
{
BOOL b_broadcast;
b_broadcast = [o_net_server_bcheckbox state] == NSOnState;
[o_net_server_baddr setEnabled: b_broadcast];
}
- (IBAction)openNetChannel:(id)sender
{
BOOL b_channel;
BOOL b_broadcast;
NSColor *o_color;
b_channel = [o_net_channel_checkbox state] == NSOnState;
b_broadcast = [o_net_server_bcheckbox state] == NSOnState;
o_color = b_channel ? [NSColor controlTextColor] :
[NSColor disabledControlTextColor];
[o_net_channel_addr setEnabled: b_channel];
[o_net_channel_port setEnabled: b_channel];
[o_net_channel_port_label setTextColor: o_color];
[o_net_channel_pstepper setEnabled: b_channel];
o_color = !b_channel ? [NSColor controlTextColor] :
[NSColor disabledControlTextColor];
[o_net_server_addr setEnabled: !b_channel];
[o_net_server_addr_label setTextColor: o_color];
[o_net_server_port setEnabled: !b_channel];
[o_net_server_port_label setTextColor: o_color];
[o_net_server_pstepper setEnabled: !b_channel];
[o_net_server_bcheckbox setEnabled: !b_channel];
[o_net_server_baddr setEnabled: b_broadcast && !b_channel];
}
- (IBAction)panelCancel:(id)sender
{
[NSApp stopModalWithCode: 0];
}
- (IBAction)panelOk:(id)sender
{
[NSApp stopModalWithCode: 1];
}
@end
/*****************************************************************************
* 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 $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#import <Cocoa/Cocoa.h>
/*****************************************************************************
* Intf_Open interface
*****************************************************************************/
@interface Intf_Open : NSObject
{
IBOutlet id o_disc_panel;
IBOutlet id o_disc_type;
IBOutlet id o_disc_title;
IBOutlet id o_disc_chapter;
IBOutlet id o_disc_device;
IBOutlet id o_net_panel;
IBOutlet id o_net_protocol;
IBOutlet id o_net_channel_addr;