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,43 +120,42 @@
/* Functions attached to user interface */
- (IBAction)openFile:(id)sender
- (IBAction)pause:(id)sender
{
NSOpenPanel *o_panel = [NSOpenPanel openPanel];
[o_panel setAllowsMultipleSelection: YES];
[o_intf playlistPause];
}
if( [o_panel runModalForDirectory: NSHomeDirectory()
file: nil types: nil] == NSOKButton )
{
NSString *o_file;
NSEnumerator *o_files = [[o_panel filenames] objectEnumerator];
- (IBAction)play:(id)sender
{
[o_intf playlistPlay];
}
while( ( o_file = (NSString *)[o_files nextObject] ) )
{
[o_intf playlistAdd: o_file];
}
- (IBAction)stop:(id)sender
{
[o_intf playlistStop];
}
[o_intf playlistPlayCurrent];
}
- (IBAction)faster:(id)sender
{
[o_intf playFaster];
}
- (IBAction)pause:(id)sender
- (IBAction)slower:(id)sender
{
[o_intf playlistPause];
[o_intf playSlower];
}
- (IBAction)play:(id)sender
- (IBAction)prev:(id)sender
{
[o_intf playlistPlayCurrent];
[o_intf playlistPrev];
}
- (IBAction)stop:(id)sender
- (IBAction)next:(id)sender
{
[o_intf playlistStop];
[o_intf playlistNext];
}
- (IBAction)timeslider_update:(id)slider
- (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;
IBOutlet id o_net_channel_checkbox;
IBOutlet id o_net_channel_port;
IBOutlet id o_net_channel_port_label;
IBOutlet id o_net_channel_pstepper;
IBOutlet id o_net_server_addr;
IBOutlet id o_net_server_addr_label;
IBOutlet id o_net_server_baddr;
IBOutlet id o_net_server_bcheckbox;
IBOutlet id o_net_server_port;
IBOutlet id o_net_server_port_label;
IBOutlet id o_net_server_pstepper;
}
- (id)init;
+ (Intf_Open *)instance;
- (void)awakeFromNib;
- (IBAction)openDisc:(id)sender;
- (IBAction)openDiscTypeChanged:(id)sender;
- (IBAction)openFile:(id)sender;
- (IBAction)openNet:(id)sender;
- (IBAction)openNetBroadcast:(id)sender;
- (IBAction)openNetChannel:(id)sender;
- (IBAction)panelCancel:(id)sender;
- (IBAction)panelOk:(id)sender;
@end
......@@ -2,7 +2,7 @@
* intf_vlc_wrapper.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.c,v 1.9 2002/03/19 03:33:52 jlj Exp $
* $Id: intf_vlc_wrapper.c,v 1.10 2002/04/23 03:21:21 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -37,24 +37,17 @@
#include "input_ext-intf.h"
#include "macosx.h"
#include "intf_open.h"
#include "intf_vlc_wrapper.h"
#include "netutils.h"
@implementation Intf_VLCWrapper
static Intf_VLCWrapper *o_intf = nil;
/* Initialization */
- (id)init
{
if( [super init] == nil )
return( nil );
e_speed = SPEED_NORMAL;
return( self );
}
+ (Intf_VLCWrapper *)instance
{
if( o_intf == nil )
......@@ -94,13 +87,116 @@ static Intf_VLCWrapper *o_intf = nil;
p_main->p_intf->b_die = 1;
}
/* Playback control */
- (void)setSpeed:(intf_speed_t)_e_speed
/* playlist control */
- (bool)playlistPlay
{
e_speed = _e_speed;
[self playlistPlayCurrent];
if( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
p_main->p_playlist->b_stopped = 0;
}
else
{
vlc_mutex_lock( &p_main->p_playlist->change_lock );
if( p_main->p_playlist->b_stopped )
{
if( p_main->p_playlist->i_size )
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
intf_PlaylistJumpto( p_main->p_playlist,
p_main->p_playlist->i_index );
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
[[Intf_Open instance] openFile: nil];
}
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
return( TRUE );
}
- (void)playlistPause
{
if ( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PAUSE );
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
- (void)playlistStop
{
if( p_input_bank->pp_input[0] != NULL )
{
/* end playing item */
p_input_bank->pp_input[0]->b_eof = 1;
/* update playlist */
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->i_index--;
p_main->p_playlist->b_stopped = 1;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
- (void)playlistNext
{
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
}
- (void)playlistPrev
{
if( p_input_bank->pp_input[0] != NULL )
{
/* FIXME: temporary hack */
intf_PlaylistPrev( p_main->p_playlist );
intf_PlaylistPrev( p_main->p_playlist );
p_input_bank->pp_input[0]->b_eof = 1;
}
}
- (void)playSlower
{
if( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_SLOWER );
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
- (void)playFaster
{
if( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_FASTER );
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
/* playback info */
#define p_area p_input_bank->pp_input[0]->stream.p_selected_area
- (NSString *)getTimeAsString
......@@ -148,7 +244,10 @@ static Intf_VLCWrapper *o_intf = nil;
#undef p_area
/* Playlist control */
- (bool)playlistPlaying
{
return( !p_main->p_playlist->b_stopped );
}
- (NSArray *)playlistAsArray
{
......@@ -169,6 +268,7 @@ static Intf_VLCWrapper *o_intf = nil;
return( [NSArray arrayWithArray: p_list] );
}
/*
- (int)playlistLength
{
return( p_main->p_playlist->i_size );
......@@ -191,136 +291,131 @@ static Intf_VLCWrapper *o_intf = nil;
return( o_item );
}
- (bool)playlistPlayCurrent
- (void)playlistPlayItem:(int)i_item
{
if( p_input_bank->pp_input[0] != NULL )
{
switch (e_speed)
{
case SPEED_SLOW:
input_SetStatus( p_input_bank->pp_input[0],
INPUT_STATUS_SLOWER );
break;
case SPEED_NORMAL:
input_SetStatus( p_input_bank->pp_input[0],
INPUT_STATUS_PLAY );
break;
case SPEED_FAST:
input_SetStatus( p_input_bank->pp_input[0],
INPUT_STATUS_FASTER );
break;
}
[self playlistStop];
p_main->p_playlist->b_stopped = 0;
}
else if( p_main->p_playlist->b_stopped )
{
if( p_main->p_playlist->i_size )
{
intf_PlaylistJumpto( p_main->p_playlist,
p_main->p_playlist->i_index );
}
else
vlc_mutex_lock( &p_main->p_playlist->change_lock );
if( i_item<p_main->p_playlist->i_size )
{
return FALSE;
}
p_main->p_playlist->i_index--;
}
return TRUE;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
[self playlistPlayCurrent];
}
- (void)playlistPause
- (void)playlistAdd:(NSString *)o_filename
{
if ( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PAUSE );
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
[o_filename lossyCString] );
}
- (void)playlistStop
- (void)clearPlaylist
{
if( p_input_bank->pp_input[0] != NULL )
{
/* end playing item */
p_input_bank->pp_input[0]->b_eof = 1;
int i;
/* update playlist */
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->i_index--;
p_main->p_playlist->b_stopped = 1;
for( i = 0; i < p_main->p_playlist->i_size; i++ )
{
intf_PlaylistDelete( p_main->p_playlist, i );
}
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
*/
/* open file/disc/network */
- (void)playlistPlayNext
- (void)openFiles:(NSArray*)o_files
{
[self playlistStop];
NSString *o_file;
int i_end = p_main->p_playlist->i_size;
NSEnumerator *o_enum = [o_files objectEnumerator];
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->i_index++;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
while( ( o_file = (NSString *)[o_enum nextObject] ) )
{
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
[o_file lossyCString] );
}
[self playlistPlayCurrent];
/* end current item, select first added item */
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
}
- (void)playlistPlayPrev
- (void)openDisc:(NSString*)o_type device:(NSString*)o_device title:(int)i_title chapter:(int)i_chapter
{
[self playlistStop];
NSString *o_source;
int i_end = p_main->p_playlist->i_size;
vlc_mutex_lock( &p_main->p_playlist->change_lock );
p_main->p_playlist->i_index--;
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
o_source = [NSString stringWithFormat: @"%@:%@@%d,%d",
o_type, o_device, i_title, i_chapter];
[self playlistPlayCurrent];
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
[o_source lossyCString] );
/* stop current item, select added item */
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
}
- (void)playlistPlayItem:(int)i_item
- (void)openNet:(NSString*)o_protocol addr:(NSString*)o_addr port:(int)i_port baddr:(NSString*)o_baddr
{
[self playlistStop];
NSString *o_source;
int i_end = p_main->p_playlist->i_size;
vlc_mutex_lock( &p_main->p_playlist->change_lock );
if( i_item<p_main->p_playlist->i_size )
if( p_input_bank->pp_input[0] != NULL )
{
p_main->p_playlist->i_index--;
p_input_bank->pp_input[0]->b_eof = 1;
}
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
config_PutIntVariable( "network_channel", 0 );
[self playlistPlayCurrent];
}
if( o_baddr != nil )
{
o_source = [NSString stringWithFormat: @"%@://%@@:%i/%@",
o_protocol, o_addr, i_port, o_baddr];
}
else
{
o_source = [NSString stringWithFormat: @"%@://%@@:%i",
o_protocol, o_addr, i_port];
}
- (void)playlistAdd:(NSString *)o_filename
{
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
[o_filename lossyCString] );
[o_source lossyCString] );
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
}
- (void)clearPlaylist
- (void)openNetChannel:(NSString*)o_addr port:(int)i_port
{
int i;
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
vlc_mutex_lock( &p_main->p_playlist->change_lock );
config_PutIntVariable( "network_channel", 1 );
for( i = 0; i < p_main->p_playlist->i_size; i++ )
if( p_main->p_channel == NULL )
{
intf_PlaylistDelete( p_main->p_playlist, i );
network_ChannelCreate();
}
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
- (bool)playlistPlaying
{
return( !p_main->p_playlist->b_stopped );
config_PutPszVariable( "channel_server", (char*)[o_addr lossyCString] );
config_PutIntVariable( "channel_port", i_port );
}
@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.4 2002/03/19 03:33:52 jlj Exp $
* $Id: intf_vlc_wrapper.h,v 1.5 2002/04/23 03:21:21 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -22,45 +22,50 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
typedef enum intf_speed_e
{
SPEED_SLOW = 0,
SPEED_NORMAL,
SPEED_FAST
} intf_speed_t;
/* Intf_VLCWrapper is a singleton class
(only one instance at any time) */
@interface Intf_VLCWrapper : NSObject
{
intf_speed_t e_speed;
}
/* Initialization */
/* initialization */
+ (Intf_VLCWrapper *)instance;
- (bool)manage;
- (void)quit;
/* Playback control */
- (void)setSpeed:(intf_speed_t)e_speed;
/* playback control */
- (bool)playlistPlay;
- (void)playlistPause;
- (void)playlistStop;
- (void)playlistNext;
- (void)playlistPrev;
- (void)playSlower;
- (void)playFaster;
/* playback info */
- (NSString *)getTimeAsString;
- (float)getTimeAsFloat;
- (void)setTimeAsFloat:(float)i_offset;
/* Playlist control */
- (bool)playlistPlaying;
- (NSArray *)playlistAsArray;
/*
- (int)playlistLength;
- (NSString *)playlistItem:(int)i_pos;
- (bool)playlistPlayCurrent;
- (void)playlistPause;
- (void)playlistStop;
- (void)playlistPlayNext;
- (void)playlistPlayPrev;
- (void)playlistPlayItem:(int)i_item;
- (void)playlistAdd:(NSString *)o_filename;
- (void)clearPlaylist;
- (bool)playlistPlaying;
*/
/* open file/disc/network */
- (void)openFiles:(NSArray*)o_files;
- (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;
@end
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