Commit 89be0ac8 authored by Jon Lech Johansen's avatar Jon Lech Johansen

* MacOS X vout improvements

  * MacOS X intf now returns, allowing vlc to terminate properly
  * Added a new make target: package-macosx
parent de32203b
......@@ -458,6 +458,25 @@ package-beos:
# Clean up
rm -Rf tmp
package-macosx:
# Check that tmp isn't in the way
@if test -e tmp; then \
echo "Error: please remove ./tmp, it is in the way"; false; \
else \
echo "OK."; mkdir tmp; \
fi
# Copy relevant files
cp -R vlc.app tmp/
cp AUTHORS COPYING ChangeLog ChangeLog.libdvdcss \
README README.libdvdcss FAQ TODO tmp/
# Create disk image
./macosx-dmg 0 "vlc-${VLC_QUICKVERSION}" tmp/*
# Clean up
rm -Rf tmp
libdvdcss-snapshot: snapshot-common
# Remove vlc sources and icons, doc, debian directory...
rm -Rf tmp/vlc/src tmp/vlc/share tmp/vlc/plugins tmp/vlc/doc
......
......@@ -7,7 +7,9 @@
openFile = id;
pause = id;
play = id;
quit = id;
speedslider_update = id;
stop = id;
timeslider_update = id;
};
CLASS = Intf_Controller;
......@@ -22,6 +24,7 @@
o_stepr = id;
o_stop = id;
o_timeslider = id;
o_window = id;
};
SUPERCLASS = NSObject;
},
......@@ -31,7 +34,6 @@
OUTLETS = {o_table = id; };
SUPERCLASS = NSObject;
},
{CLASS = VlcQuickDrawView; LANGUAGE = ObjC; SUPERCLASS = NSQuickDrawView; }
);
IBVersion = 1;
}
\ No newline at end of file
}
......@@ -3,14 +3,21 @@
<plist version="0.9">
<dict>
<key>IBDocumentLocation</key>
<string>87 157 428 240 0 0 1280 938 </string>
<string>120 494 428 240 0 0 1600 1178 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>110 456 257 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>219.0</string>
<key>IBMainMenuLocation</key>
<string>288 493 104 66 0 0 1280 938 </string>
<string>248.0</string>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
</array>
<key>IBSystem Version</key>
<string>5L14</string>
<key>IBUserGuides</key>
<dict/>
<string>5P48</string>
</dict>
</plist>
......@@ -67,14 +67,16 @@
F512122B0170635601A80A1F,
F512122C0170635601A80A1F,
F512122D0170635601A80A1F,
F512122F0170635601A80A1F,
F51212300170635601A80A1F,
F51212310170635601A80A1F,
F51212320170635601A80A1F,
F510A6CC01738ED001A80A1F,
F510A6CD01738ED001A80A1F,
F53A3B49018DECF201A80A1F,
F53A3B4A018DECF201A80A1F,
F6799746020DCC2A01A80112,
F6799747020DCC2A01A80112,
F6799748020DCC2A01A80112,
F6799749020DCC2A01A80112,
F679974A020DCC2A01A80112,
);
isa = PBXGroup;
name = Files;
......@@ -113,12 +115,6 @@
path = plugins/macosx/intf_controller.h;
refType = 4;
};
F512122F0170635601A80A1F = {
isa = PBXFileReference;
name = intf_main.c;
path = plugins/macosx/intf_main.c;
refType = 4;
};
F51212300170635601A80A1F = {
isa = PBXFileReference;
name = macosx.c;
......@@ -330,16 +326,44 @@
settings = {
};
};
F53A3B49018DECF201A80A1F = {
//F50
//F51
//F52
//F53
//F54
//F60
//F61
//F62
//F63
//F64
F6799746020DCC2A01A80112 = {
isa = PBXFileReference;
name = intf_macosx.c;
path = plugins/macosx/intf_macosx.c;
refType = 4;
};
F6799747020DCC2A01A80112 = {
isa = PBXFileReference;
name = vout_qdview.c;
path = plugins/macosx/vout_qdview.c;
refType = 4;
};
F6799748020DCC2A01A80112 = {
isa = PBXFileReference;
name = vout_qdview.h;
path = plugins/macosx/vout_qdview.h;
refType = 4;
};
F6799749020DCC2A01A80112 = {
isa = PBXFileReference;
name = intf_qdview.h;
path = plugins/macosx/intf_qdview.h;
name = vout_window.c;
path = plugins/macosx/vout_window.c;
refType = 4;
};
F53A3B4A018DECF201A80A1F = {
F679974A020DCC2A01A80112 = {
isa = PBXFileReference;
name = intf_qdview.c;
path = plugins/macosx/intf_qdview.c;
name = vout_window.h;
path = plugins/macosx/vout_window.h;
refType = 4;
};
};
......
#!/bin/sh
#
# Posted to the projectbuilder-users list by Mike Ferris
# Modified for vlc by Jon Lech Johansen
#
set -e
# Requires at least three args
if [ $# -lt 3 ] ; then
echo "usage: $0 size name file ..." 1>&2
exit 1
fi
# Grab size and name
imgSize=$1
shift
imgName=$1
shift
if [ $((${imgSize} < 5)) != 0 ] ; then
imgSize=5;
fi
# Create the image and format it
rm -f "${imgName}.dmg"
echo; echo "Creating ${imgSize} MB disk image named ${imgName}"
hdiutil create "${imgName}.dmg" -megabytes "${imgSize}" -layout NONE -quiet
dev=`hdid -nomount "${imgName}.dmg" | grep '/dev/disk[0-9]*' | cut -d " " -f 1`
/sbin/newfs_hfs -w -v "${imgName}" -b 4096 "${dev}" > /dev/null
hdiutil eject "${dev}" -quiet
# Mount the image and copy stuff
dev=`hdid "${imgName}.dmg" | grep '/dev/disk[0-9]*' | cut -d " " -f 1`
echo "Copying contents to ${imgName}:"
while [ $# -gt 0 ] ; do
echo " ${1}"
/Developer/Tools/CpMac -r "${1}" "/Volumes/${imgName}"
shift
done
hdiutil eject "${dev}" -quiet
# Compress the image
echo "Compressing ${imgName} disk image"
mv "${imgName}.dmg" "${imgName}.orig.dmg"
hdiutil convert "${imgName}.orig.dmg" -format UDZO -o "${imgName}" -quiet
rm "${imgName}.orig.dmg"
# Done
echo; echo "Disk image creation completed:"
ls -la "${imgName}.dmg"; echo
macosx_SOURCES = macosx.c intf_main.c intf_controller.c aout_macosx.c vout_macosx.c intf_vlc_wrapper.c intf_qdview.c
macosx_SOURCES = macosx.c aout_macosx.c vout_macosx.c vout_window.c vout_qdview.c intf_macosx.c intf_controller.c intf_vlc_wrapper.c
/*****************************************************************************
* intf_controller.c : MacOS X plugin for vlc
* intf_controller.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $$
* $Id: intf_controller.c,v 1.3 2002/02/18 01:34:44 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* 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
......@@ -21,184 +22,184 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* Remark:
I need to subclass NSQuickDrawView, and post a notification when its display
method is called. This is necessary because GetPortBound and similar functions
return the actual on-screen size of the QDPort, which isn't updated immidiately
after calling e.g. setFrame
*/
#import <ApplicationServices/ApplicationServices.h>
#include <QuickTime/QuickTime.h>
#include <ApplicationServices/ApplicationServices.h>
#import "intf_controller.h"
#import "intf_vlc_wrapper.h"
#include <videolan/vlc.h>
#include "interface.h"
#include "intf_playlist.h"
#include "macosx.h"
#include "intf_controller.h"
@interface Intf_Controller (Internal)
- (void)handlePortMessage:(NSPortMessage *)o_msg;
@end
@implementation Intf_Controller
//Initialization & Event-Management
- (void) awakeFromNib {
o_vlc = [Intf_VlcWrapper instance] ;
b_window_is_fullscreen = FALSE ;
[NSTimer scheduledTimerWithTimeInterval: 0.5
target: self
selector: @selector(manage:)
userInfo: nil
repeats:TRUE
] ;
[o_vlc initWithDelegate:self] ;
}
- (void) manage:(NSTimer *)timer {
if ([o_vlc manage])
[NSApp terminate: self] ;
[o_currenttime setStringValue: [o_vlc getTimeAsString]] ;
[o_timeslider setFloatValue: [o_vlc getTimeAsFloat]] ;
}
/* Initialization & Event-Management */
- (void)awakeFromNib
{
NSString *pTitle = [NSString
stringWithCString: VOUT_TITLE " (Cocoa)"];
o_vlc = [Intf_VlcWrapper instance];
[o_vlc initWithDelegate: self];
[o_window setTitle: pTitle];
}
- (void)applicationDidFinishLaunching:(NSNotification *)o_notification
{
[[o_vlc sendPort] setDelegate: self];
[[NSRunLoop currentRunLoop]
addPort: [o_vlc sendPort]
forMode: NSDefaultRunLoopMode];
- (void)applicationDidBecomeActive:(NSNotification*)aNotification {
if (b_window_is_fullscreen) {
[o_window orderFront:self] ;
[o_vlc playlistPlayCurrent] ;
[NSThread detachNewThreadSelector: @selector(manage)
toTarget: self withObject: nil];
}
- (void)manage
{
NSDate *sleepDate;
NSAutoreleasePool *o_pool;
o_pool = [[NSAutoreleasePool alloc] init];
while( ![o_vlc manage] )
{
[o_currenttime setStringValue: [o_vlc getTimeAsString]];
[o_timeslider setFloatValue: [o_vlc getTimeAsFloat]];
if( [o_vlc playlistPlaying] )
{
UpdateSystemActivity( UsrActivity );
}
sleepDate = [NSDate dateWithTimeIntervalSinceNow: 0.1];
[NSThread sleepUntilDate: sleepDate];
}
[self terminate];
[o_pool release];
}
- (void)terminate
{
NSEvent *pEvent;
[NSApp stop: nil];
/* send a dummy event to break out of the event loop */
pEvent = [NSEvent mouseEventWithType: NSLeftMouseDown
location: NSMakePoint( 1, 1 ) modifierFlags: 0
timestamp: 1 windowNumber: [[NSApp mainWindow] windowNumber]
context: [NSGraphicsContext currentContext] eventNumber: 1
clickCount: 1 pressure: 0.0];
[NSApp postEvent: pEvent atStart: YES];
}
/* Functions attached to user interface */
- (IBAction)openFile:(id)sender
{
NSOpenPanel *o_panel = [NSOpenPanel openPanel];
- (void)applicationDidResignActive:(NSNotification*)aNotification {
if (b_window_is_fullscreen) {
[o_vlc playlistPause] ;
[o_window orderOut:self] ;
[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_vlc playlistAdd: o_file];
}
}
//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) {
NSEnumerator* o_files = [[o_panel filenames] objectEnumerator] ;
NSString* o_file ;
while ((o_file = (NSString*)[o_files nextObject])) {
[o_vlc playlistAdd:o_file] ;
}
}
[o_vlc playlistPlayCurrent] ;
}
- (IBAction) pause:(id)sender {
[o_vlc playlistPause] ;
}
- (IBAction) play:(id)sender {
[o_vlc playlistPlayCurrent] ;
}
- (IBAction) timeslider_update:(id)slider {
[o_vlc setTimeAsFloat: [o_timeslider floatValue]] ;
[o_vlc playlistPlayCurrent];
}
}
- (IBAction) speedslider_update:(id)slider {
[o_vlc setSpeed: (intf_speed_t) [slider intValue]] ;
}
- (IBAction)pause:(id)sender
{
[o_vlc playlistPause];
}
- (IBAction)play:(id)sender
{
[o_vlc playlistPlayCurrent];
}
- (IBAction)stop:(id)sender
{
[o_vlc playlistStop];
}
- (IBAction)timeslider_update:(id)slider
{
[o_vlc setTimeAsFloat: [o_timeslider floatValue]];
}
- (IBAction)speedslider_update:(id)slider
{
[o_vlc setSpeed: (intf_speed_t)[slider intValue]];
}
- (IBAction) fullscreen_toggle:(id)sender {
[self requestQDPortFullscreen:!b_window_is_fullscreen] ;
}
- (IBAction)fullscreen_toggle:(id)sender
{
}
- (IBAction)quit:(id)sender
{
[o_vlc quit];
}
@end
@implementation Intf_Controller (Internal)
- (void)handlePortMessage:(NSPortMessage *)o_msg
{
[o_vlc handlePortMessage: o_msg];
}
//Callbacks - we are the delegate for the VlcWrapper
- (void) requestQDPortFullscreen:(bool)b_fullscreen {
NSRect s_rect ;
VlcQuickDrawView *o_qdview ;
s_rect.origin.x = s_rect.origin.y = 0 ;
[self releaseQDPort] ;
o_window = [NSWindow alloc] ;
if (b_fullscreen) {
[o_window
initWithContentRect: [[NSScreen mainScreen] frame]
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer:NO screen:[NSScreen mainScreen]
] ;
[o_window setLevel:CGShieldingWindowLevel()] ;
b_window_is_fullscreen = TRUE ;
}
else {
s_rect.size = [o_vlc videoSize] ;
[o_window
initWithContentRect: s_rect
styleMask: (NSTitledWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)
backing: NSBackingStoreBuffered
defer:NO screen:[NSScreen mainScreen]
] ;
[o_window setAspectRatio:[o_vlc videoSize]] ;
[o_window center] ;
[o_window setDelegate:self] ;
b_window_is_fullscreen = FALSE ;
}
o_qdview = [[VlcQuickDrawView alloc] init] ;
[o_qdview setPostsFrameChangedNotifications:YES] ;
[[NSNotificationCenter defaultCenter]
addObserver: o_vlc
selector: @selector(sizeChangeQDPort)
name: VlcQuickDrawViewDidResize
object: o_qdview
] ;
[o_window setContentView:o_qdview] ;
[o_window orderFront:self] ;
[o_vlc setQDPort:[o_qdview qdPort]] ;
[o_menu_fullscreen setState:(b_window_is_fullscreen ? NSOnState : NSOffState)] ;
}
- (void) releaseQDPort {
[[NSNotificationCenter defaultCenter]
removeObserver: nil
name: nil
object: [o_window contentView]
] ;
[o_vlc setQDPort:nil] ;
if (o_window) {
[o_window close] ;
o_window = nil ;
}
}
- (void) resizeQDPortFullscreen:(bool)b_fullscreen {
if (b_window_is_fullscreen != b_fullscreen) {
[self requestQDPortFullscreen:b_fullscreen] ;
}
else if (!b_window_is_fullscreen && !b_fullscreen) {
[o_window setAspectRatio:[o_vlc videoSize]] ;
}
}
@end
@implementation Intf_PlaylistDS
- (void ) awakeFromNib {
o_vlc = [Intf_VlcWrapper instance] ;
o_playlist = nil ;
}
- (void)awakeFromNib
{
o_vlc = [Intf_VlcWrapper instance];
o_playlist = nil;
}
- (void) readPlaylist {
o_playlist = [[o_vlc playlistAsArray] retain] ;
}
- (void)readPlaylist
{
o_playlist = [[o_vlc playlistAsArray] retain];
}
- (int) numberOfRowsInTableView:(NSTableView*)o_table {
[self readPlaylist] ;
return [o_playlist count] ;
}
- (int)numberOfRowsInTableView:(NSTableView*)o_table
{
[self readPlaylist];
return( [o_playlist count] );
}
- (id) tableView:(NSTableView*)o_table objectValueForTableColumn:(NSTableColumn*)o_column row:(int)i_row {
return [o_playlist objectAtIndex:i_row] ;
}
- (id)tableView:(NSTableView *)o_table objectValueForTableColumn:(NSTableColumn*)o_column row:(int)i_row
{
return( [o_playlist objectAtIndex: i_row] );
}
- (void)tableView:(NSTableView *)aTableView setObjectValue:anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex {
}
- (void)tableView:(NSTableView *)o_table setObjectValue:o_value forTableColumn:(NSTableColumn *)o_column row:(int)i_index
{
}
@end
/*****************************************************************************
* intf_controller.h : MacOS X plugin for vlc
* intf_controller.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $$
* $Id: intf_controller.h,v 1.3 2002/02/18 01:34:44 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
*
......@@ -21,54 +21,56 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "intf_vlc_wrapper.h"
#import "intf_qdview.h"
#include "intf_vlc_wrapper.h"
@interface Intf_PlaylistDS : NSObject {
Intf_VlcWrapper* o_vlc ;
NSMutableArray* o_playlist ;
@interface Intf_PlaylistDS : NSObject
{
Intf_VlcWrapper *o_vlc;
NSMutableArray *o_playlist;
IBOutlet NSTableView *o_table ;
IBOutlet NSTableView *o_table;
}
- (void ) awakeFromNib ;
- (void) readPlaylist ;
- (void)awakeFromNib;
- (void)readPlaylist;
- (int)numberOfRowsInTableView:(NSTableView *)o_table;
- (id)tableView:(NSTableView *)o_table objectValueForTableColumn:(NSTableColumn *)o_column row:(int)i_row;
- (void)tableView:(NSTableView *)o_table setObjectValue:o_value forTableColumn:(NSTableColumn *)o_column row:(int)i_index;
- (int) numberOfRowsInTableView:(NSTableView*)o_table ;
- (id) tableView:(NSTableView*)o_table objectValueForTableColumn:(NSTableColumn*)o_column row:(int)i_row ;
- (void)tableView:(NSTableView *)aTableView setObjectValue:anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex ;
@end
@interface Intf_Controller : NSObject <VlcWrapper_Delegate> {
Intf_VlcWrapper* o_vlc ;
@interface Intf_Controller : NSObject
{
Intf_VlcWrapper *o_vlc;
IBOutlet NSWindow *o_window;
IBOutlet NSButton *o_play;
IBOutlet NSButton *o_pause;
IBOutlet NSButton *o_stop;
IBOutlet NSButton *o_stepr;
IBOutlet NSButton *o_stepf;
IBOutlet NSSlider *o_timeslider;
IBOutlet NSTextField *o_currenttime;