Commit 5dcebef9 authored by Jon Lech Johansen's avatar Jon Lech Johansen

* MacOS X aout now uses AudioConverter for int->float

  * Various MacOS X intf improvements and bug fixes
parent 939b6ea1
......@@ -7773,7 +7773,7 @@ if test "${enable_macosx+set}" = set; then
if test x$enable_macosx = xyes
then
BUILTINS="${BUILTINS} macosx"
LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework Cocoa -framework AGL -framework QuickTime -lobjc"
LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework AudioToolbox -framework Cocoa -framework AGL -framework QuickTime -lobjc"
CFLAGS_MACOSX="${CFLAGS_MACOSX} -ObjC"
LIB="${LIB} -ObjC"
fi
......@@ -7813,7 +7813,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
#define $ac_tr_hdr 1
EOF
BUILTINS="${BUILTINS} macosx"
LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework Cocoa -framework AGL -framework QuickTime -lobjc"
LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework AudioToolbox -framework Cocoa -framework AGL -framework QuickTime -lobjc"
CFLAGS_MACOSX="${CFLAGS_MACOSX} -ObjC"
LIB="${LIB} -ObjC"
......
......@@ -1305,13 +1305,13 @@ AC_ARG_ENABLE(macosx,
[if test x$enable_macosx = xyes
then
BUILTINS="${BUILTINS} macosx"
LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework Cocoa -framework AGL -framework QuickTime -lobjc"
LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework AudioToolbox -framework Cocoa -framework AGL -framework QuickTime -lobjc"
CFLAGS_MACOSX="${CFLAGS_MACOSX} -ObjC"
LIB="${LIB} -ObjC"
fi],
[AC_CHECK_HEADERS(Cocoa/Cocoa.h,
BUILTINS="${BUILTINS} macosx"
LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework Cocoa -framework AGL -framework QuickTime -lobjc"
LIB_MACOSX="${LIB_MACOSX} -framework CoreAudio -framework AudioToolbox -framework Cocoa -framework AGL -framework QuickTime -lobjc"
CFLAGS_MACOSX="${CFLAGS_MACOSX} -ObjC"
LIB="${LIB} -ObjC"
)])
......
......@@ -33,7 +33,7 @@
LANGUAGE = ObjC;
OUTLETS = {o_table = id; };
SUPERCLASS = NSObject;
},
}
);
IBVersion = 1;
}
}
\ No newline at end of file
......@@ -18,6 +18,6 @@
<integer>21</integer>
</array>
<key>IBSystem Version</key>
<string>5P48</string>
<string>5Q45</string>
</dict>
</plist>
......@@ -77,6 +77,8 @@
F6799748020DCC2A01A80112,
F6799749020DCC2A01A80112,
F679974A020DCC2A01A80112,
F6EA76F5024171E201A80112,
F6EA76F6024171E201A80112,
);
isa = PBXGroup;
name = Files;
......@@ -366,6 +368,18 @@
path = plugins/macosx/vout_window.h;
refType = 4;
};
F6EA76F5024171E201A80112 = {
isa = PBXFileReference;
name = vout_vlc_wrapper.c;
path = plugins/macosx/vout_vlc_wrapper.c;
refType = 4;
};
F6EA76F6024171E201A80112 = {
isa = PBXFileReference;
name = vout_vlc_wrapper.h;
path = plugins/macosx/vout_vlc_wrapper.h;
refType = 4;
};
};
rootObject = F511306E0170620B01A80A1F;
}
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
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
This diff is collapsed.
......@@ -2,7 +2,7 @@
* 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 $
* $Id: intf_controller.c,v 1.4 2002/03/19 03:33:52 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -32,10 +32,6 @@
#include "macosx.h"
#include "intf_controller.h"
@interface Intf_Controller (Internal)
- (void)handlePortMessage:(NSPortMessage *)o_msg;
@end
@implementation Intf_Controller
/* Initialization & Event-Management */
......@@ -45,20 +41,17 @@
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];
o_intf = [[Intf_VLCWrapper instance] retain];
o_vout = [[Vout_VLCWrapper instance] retain];
f_slider = f_slider_old = 0.0;
o_slider_lock = [[NSLock alloc] init];
[[NSRunLoop currentRunLoop]
addPort: [o_vlc sendPort]
forMode: NSDefaultRunLoopMode];
[NSThread detachNewThreadSelector: @selector(manage)
toTarget: self withObject: nil];
}
......@@ -70,13 +63,31 @@
o_pool = [[NSAutoreleasePool alloc] init];
while( ![o_vlc manage] )
while( ![o_intf manage] )
{
[o_currenttime setStringValue: [o_vlc getTimeAsString]];
[o_timeslider setFloatValue: [o_vlc getTimeAsFloat]];
if( [o_intf playlistPlaying] )
{
[o_currenttime setStringValue: [o_intf getTimeAsString]];
if( f_slider == f_slider_old )
{
float f_updated = [o_intf getTimeAsFloat];
if( f_updated != f_slider )
{
if( [o_slider_lock tryLock] )
{
[o_timeslider setFloatValue: f_updated];
[o_slider_lock unlock];
}
}
}
else
{
[o_intf setTimeAsFloat: f_slider];
f_slider_old = f_slider;
}
if( [o_vlc playlistPlaying] )
{
UpdateSystemActivity( UsrActivity );
}
......@@ -95,6 +106,9 @@
[NSApp stop: nil];
[o_vout release];
[o_intf release];
/* send a dummy event to break out of the event loop */
pEvent = [NSEvent mouseEventWithType: NSLeftMouseDown
location: NSMakePoint( 1, 1 ) modifierFlags: 0
......@@ -120,36 +134,49 @@
while( ( o_file = (NSString *)[o_files nextObject] ) )
{
[o_vlc playlistAdd: o_file];
[o_intf playlistAdd: o_file];
}
[o_vlc playlistPlayCurrent];
[o_intf playlistPlayCurrent];
}
}
- (IBAction)pause:(id)sender
{
[o_vlc playlistPause];
[o_intf playlistPause];
}
- (IBAction)play:(id)sender
{
[o_vlc playlistPlayCurrent];
[o_intf playlistPlayCurrent];
}
- (IBAction)stop:(id)sender
{
[o_vlc playlistStop];
[o_intf playlistStop];
}
- (IBAction)timeslider_update:(id)slider
{
[o_vlc setTimeAsFloat: [o_timeslider floatValue]];
switch( [[NSApp currentEvent] type] )
{
case NSLeftMouseDown:
[o_slider_lock lock];
break;
case NSLeftMouseUp:
f_slider = [o_timeslider floatValue];
[o_slider_lock unlock];
break;
default:
break;
}
}
- (IBAction)speedslider_update:(id)slider
{
[o_vlc setSpeed: (intf_speed_t)[slider intValue]];
[o_intf setSpeed: (intf_speed_t)[slider intValue]];
}
- (IBAction)fullscreen_toggle:(id)sender
......@@ -159,31 +186,26 @@
- (IBAction)quit:(id)sender
{
[o_vlc quit];
}
@end
@implementation Intf_Controller (Internal)
- (void)handlePortMessage:(NSPortMessage *)o_msg
{
[o_vlc handlePortMessage: o_msg];
[o_intf quit];
}
@end
@implementation Intf_PlaylistDS
- (void)awakeFromNib
- (id)init
{
o_vlc = [Intf_VlcWrapper instance];
if( [super init] == nil )
return( nil );
o_playlist = nil;
return( self );
}
- (void)readPlaylist
{
o_playlist = [[o_vlc playlistAsArray] retain];
o_playlist = [[[Intf_VLCWrapper instance] playlistAsArray] retain];
}
- (int)numberOfRowsInTableView:(NSTableView*)o_table
......@@ -202,4 +224,3 @@
}
@end
......@@ -2,7 +2,7 @@
* 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 $
* $Id: intf_controller.h,v 1.4 2002/03/19 03:33:52 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
*
......@@ -22,16 +22,15 @@
*****************************************************************************/
#include "intf_vlc_wrapper.h"
#include "vout_vlc_wrapper.h"
@interface Intf_PlaylistDS : NSObject
{
Intf_VlcWrapper *o_vlc;
NSMutableArray *o_playlist;
IBOutlet NSTableView *o_table;
}
- (void)awakeFromNib;
- (void)readPlaylist;
- (int)numberOfRowsInTableView:(NSTableView *)o_table;
......@@ -42,7 +41,11 @@
@interface Intf_Controller : NSObject
{
Intf_VlcWrapper *o_vlc;
Intf_VLCWrapper *o_intf;
Vout_VLCWrapper *o_vout;
NSLock *o_slider_lock;
float f_slider, f_slider_old;
IBOutlet NSWindow *o_window;
IBOutlet NSButton *o_play;
......
......@@ -2,7 +2,7 @@
* intf_vlc_wrapper.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.c,v 1.8 2002/02/18 01:34:44 jlj Exp $
* $Id: intf_vlc_wrapper.c,v 1.9 2002/03/19 03:33:52 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -39,30 +39,36 @@
#include "macosx.h"
#include "intf_vlc_wrapper.h"
@implementation Intf_VlcWrapper
@implementation Intf_VLCWrapper
static Intf_VLCWrapper *o_intf = nil;
/* Initialization */
+ (Intf_VlcWrapper *)instance
- (id)init
{
static bool b_initialized = 0;
static Intf_VlcWrapper* o_vlc = nil;
if( !b_initialized )
if( [super init] == nil )
return( nil );
e_speed = SPEED_NORMAL;
return( self );
}
+ (Intf_VLCWrapper *)instance
{
if( o_intf == nil )
{
o_vlc = [[Intf_VlcWrapper alloc] init];
b_initialized = TRUE;
o_intf = [[[Intf_VLCWrapper alloc] init] autorelease];
}
return o_vlc;
return( o_intf );
}
- (Intf_VlcWrapper *)initWithDelegate:(id)_o_delegate
- (void)dealloc
{
e_speed = SPEED_NORMAL;
o_delegate = _o_delegate;
return self;
o_intf = nil;
[super dealloc];
}
- (bool)manage
......@@ -88,98 +94,6 @@
p_main->p_intf->b_die = 1;
}
/* Vout requests */
- (void)handlePortMessage:(NSPortMessage *)o_msg
{
NSData *o_req;
struct vout_req_s *p_req;
o_req = [[o_msg components] lastObject];
p_req = *((struct vout_req_s **)[o_req bytes]);
[p_req->o_lock lock];
if( p_req->i_type == VOUT_REQ_CREATE_WINDOW )
{
VLCView *o_view;
p_req->p_vout->p_sys->o_window = [VLCWindow alloc];
[p_req->p_vout->p_sys->o_window setVout: p_req->p_vout];
[p_req->p_vout->p_sys->o_window setReleasedWhenClosed: YES];
if( p_req->p_vout->b_fullscreen )
{
[p_req->p_vout->p_sys->o_window
initWithContentRect: [[NSScreen mainScreen] frame]
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer: NO screen: [NSScreen mainScreen]];
[p_req->p_vout->p_sys->o_window
setLevel: CGShieldingWindowLevel()];
}
else
{
unsigned int i_stylemask = NSTitledWindowMask |
NSMiniaturizableWindowMask |
NSResizableWindowMask;
[p_req->p_vout->p_sys->o_window
initWithContentRect: p_req->p_vout->p_sys->s_rect
styleMask: i_stylemask
backing: NSBackingStoreBuffered
defer: NO screen: [NSScreen mainScreen]];
if( !p_req->p_vout->p_sys->b_pos_saved )
{
[p_req->p_vout->p_sys->o_window center];
}
}
o_view = [[VLCView alloc] initWithVout: p_req->p_vout];
[p_req->p_vout->p_sys->o_window setContentView: o_view];
[o_view lockFocus];
p_req->p_vout->p_sys->p_qdport = [o_view qdPort];
[o_view unlockFocus];
[p_req->p_vout->p_sys->o_window setTitle: [NSString
stringWithCString: VOUT_TITLE]];
[p_req->p_vout->p_sys->o_window setAcceptsMouseMovedEvents: YES];
[p_req->p_vout->p_sys->o_window makeKeyAndOrderFront: nil];
p_req->i_result = 1;
}
else if( p_req->i_type == VOUT_REQ_DESTROY_WINDOW )
{
if( !p_req->p_vout->b_fullscreen )
{
NSRect s_rect;
s_rect = [[p_req->p_vout->p_sys->o_window contentView] frame];
p_req->p_vout->p_sys->s_rect.size = s_rect.size;
s_rect = [p_req->p_vout->p_sys->o_window frame];
p_req->p_vout->p_sys->s_rect.origin = s_rect.origin;
p_req->p_vout->p_sys->b_pos_saved = 1;
}
p_req->p_vout->p_sys->p_qdport = nil;
[p_req->p_vout->p_sys->o_window close];
p_req->p_vout->p_sys->o_window = nil;
p_req->i_result = 1;
}
[p_req->o_lock unlockWithCondition: 1];
}
- (NSPort *)sendPort
{
return( p_main->p_intf->p_sys->o_port );
}
/* Playback control */
- (void)setSpeed:(intf_speed_t)_e_speed
{
......@@ -206,12 +120,18 @@
- (float)getTimeAsFloat
{
if( p_input_bank->pp_input[0] == NULL )
float f_time = 0.0;
vlc_mutex_lock( &p_input_bank->lock );
if( p_input_bank->pp_input[0] != NULL )
{
return( 0.0 );
f_time = (float)p_area->i_tell / (float)p_area->i_size;
}
return( (float)p_area->i_tell / (float)p_area->i_size );
vlc_mutex_unlock( &p_input_bank->lock );
return( f_time );
}
- (void)setTimeAsFloat:(float)f_position
......@@ -400,7 +320,7 @@
- (bool)playlistPlaying
{
return( p_main->p_playlist->b_stopped );
return( !p_main->p_playlist->b_stopped );
}
@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.3 2002/02/18 01:34:44 jlj Exp $
* $Id: intf_vlc_wrapper.h,v 1.4 2002/03/19 03:33:52 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -29,26 +29,20 @@ typedef enum intf_speed_e
SPEED_FAST
} intf_speed_t;
/* Intf_VlcWrapper is a singleton class
/* Intf_VLCWrapper is a singleton class
(only one instance at any time) */
@interface Intf_VlcWrapper : NSObject
@interface Intf_VLCWrapper : NSObject
{
id o_delegate;
intf_speed_t e_speed;
}
/* Initialization */
+ (Intf_VlcWrapper *)instance;
- (Intf_VlcWrapper *)initWithDelegate:(id)o_delegate;
+ (Intf_VLCWrapper *)instance;
- (bool)manage;
- (void)quit;
/* Vout requests */
- (void)handlePortMessage:(NSPortMessage *)o_msg;
- (NSPort *)sendPort;
/* Playback control */
- (void)setSpeed:(intf_speed_t)e_speed;
- (NSString *)getTimeAsString;
......
......@@ -2,7 +2,7 @@
* vout_qdview.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_qdview.c,v 1.1 2002/02/18 01:34:44 jlj Exp $
* $Id: vout_qdview.c,v 1.2 2002/03/19 03:33:52 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -25,36 +25,30 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#import <Cocoa/Cocoa.h>
#include <videolan/vlc.h>
#include "video.h"
#include "video_output.h"
#include "macosx.h"
#import "vout_qdview.h"
/*****************************************************************************
* VLCView implementation
*****************************************************************************/
@implementation VLCView
- (id)initWithVout:(struct vout_thread_s *)_p_vout
- (id)initWithWrapper:(Vout_VLCWrapper *)_o_wrapper forVout:(void *)_p_vout
{
if( [super init] == nil )
return nil;
p_vout = _p_vout;
o_wrapper = _o_wrapper;
return self;
return( self );
}
- (void)drawRect:(NSRect)rect
{
[super drawRect: rect];
p_vout->i_changes |= VOUT_SIZE_CHANGE;
[o_wrapper voutDidResize: p_vout];
}
@end
......@@ -2,7 +2,7 @@
* vout_qdview.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_qdview.h,v 1.1 2002/02/18 01:34:44 jlj Exp $
* $Id: vout_qdview.h,v 1.2 2002/03/19 03:33:52 jlj Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -22,11 +22,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#import "vout_vlc_wrapper.h"
@interface VLCView : NSQuickDrawView
{
struct vout_thread_s *p_vout;
void *p_vout;
Vout_VLCWrapper *o_wrapper;
}
- (id)initWithVout:(struct vout_thread_s *)_p_vout;
- (id)initWithWrapper:(Vout_VLCWrapper *)_o_wrapper forVout:(void *)_p_vout;
@end
/*****************************************************************************
* vout_vlc_wrapper.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_vlc_wrapper.c,v 1.1 2002/03/19 03:33:52 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 <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#include <videolan/vlc.h>
#include "video.h"
#include "video_output.h"
#include "interface.h"
#include "macosx.h"
#include "vout_vlc_wrapper.h"
/*****************************************************************************
* Vout_VLCWrapper implementation
*****************************************************************************/
@implementation Vout_VLCWrapper
static Vout_VLCWrapper *o_vout = nil;
+ (Vout_VLCWrapper *)instance
{
if( o_vout == nil )
{
o_vout = [[[Vout_VLCWrapper alloc] init] autorelease];
[[Vout_VLCWrapper sendPort] setDelegate: o_vout];
[[NSRunLoop currentRunLoop]
addPort: [Vout_VLCWrapper sendPort]
forMode: NSDefaultRunLoopMode];
}
return( o_vout );
}
- (void)dealloc
{
o_vout = nil;
[super dealloc];
}
+ (NSPort *)sendPort
{
return( p_main->p_intf->p_sys->o_port );
}
- (void)voutDidResize:(void *)_p_vout
{
struct vout_thread_s *p_vout =
(struct vout_thread_s *)_p_vout;
p_vout->i_changes |= VOUT_SIZE_CHANGE;
}
- (void)mouseEvent:(unsigned int)ui_status forVout:(void *)_p_vout
{
struct vout_thread_s *p_vout =
(struct vout_thread_s *)_p_vout;
if( ui_status & MOUSE_MOVED )
p_vout->p_sys->b_mouse_moved = 1;
if( ui_status & MOUSE_NOT_MOVED )
p_vout->p_sys->b_mouse_moved = 0;
if( ui_status & MOUSE_LAST_MOVED )
p_vout->p_sys->i_time_mouse_last_moved = mdate();
if( ui_status & MOUSE_NOT_LAST_MOVED )
p_vout->p_sys->i_time_mouse_last_moved = 0;
}
- (BOOL)keyDown:(NSEvent *)o_event forVout:(void *)_p_vout
{
unichar key = 0;
struct vout_thread_s *p_vout =
(struct vout_thread_s *)_p_vout;
if( [[o_event characters] length] )
{
key = [[o_event characters] characterAtIndex: 0];
}
switch( key )
{
case 'f': case 'F':
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
break;
case 'q': case 'Q':
p_main->p_intf->b_die = 1;
break;
default:
return( NO );
break;
}
return( YES );
}
@end
@implementation Vout_VLCWrapper (Internal)
- (void)handlePortMessage:(NSPortMessage *)o_msg
{
NSData *o_req;
struct vout_req_s *p_req;
o_req = [[o_msg components] lastObject];
p_req = *((struct vout_req_s **)[o_req bytes]);
[p_req->o_lock lock];
if( p_req->i_type == VOUT_REQ_CREATE_WINDOW )
{
VLCView *o_view;
p_req->p_vout->p_sys->o_window = [VLCWindow alloc];
[p_req->p_vout->p_sys->o_window
setWrapper: self forVout: (void *)p_req->p_vout];
[p_req->p_vout->p_sys->o_window setReleasedWhenClosed: YES];
if( p_req->p_vout->b_fullscreen )
{
[p_req->p_vout->p_sys->o_window
initWithContentRect: [[NSScreen mainScreen] frame]
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer: NO screen: [NSScreen mainScreen]];
[p_req->p_vout->p_sys->o_window
setLevel: CGShieldingWindowLevel()];
}
else
{
unsigned int i_stylemask = NSTitledWindowMask |
NSMiniaturizableWindowMask |
NSResizableWindowMask;
[p_req->p_vout->p_sys->o_window
initWithContentRect: p_req->p_vout->p_sys->s_rect
styleMask: i_stylemask
backing: NSBackingStoreBuffered
defer: NO screen: [NSScreen mainScreen]];
if( !p_req->p_vout->p_sys->b_pos_saved )
{
[p_req->p_vout->p_sys->o_window center];
}
}
o_view = [[VLCView alloc]
initWithWrapper: self forVout: (void *)p_req->p_vout];
[p_req->p_vout->p_sys->o_window setContentView: o_view];
[o_view autorelease];
[o_view lockFocus];
p_req->p_vout->p_sys->p_qdport = [o_view qdPort];
[o_view unlockFocus];
[p_req->p_vout->p_sys->o_window setTitle: [NSString
stringWithCString: VOUT_TITLE]];
[p_req->p_vout->p_sys->o_window setAcceptsMouseMovedEvents: YES];
[p_req->p_vout->p_sys->o_window makeKeyAndOrderFront: nil];
p_req->i_result = 1;
}
else if( p_req->i_type == VOUT_REQ_DESTROY_WINDOW )
{
if( !p_req->p_vout->b_fullscreen )
{
NSRect s_rect;
s_rect = [[p_req->p_vout->p_sys->o_window contentView] frame];
p_req->p_vout->p_sys->s_rect.size = s_rect.size;
s_rect = [p_req->p_vout->p_sys->o_window frame];
p_req->p_vout->p_sys->s_rect.origin = s_rect.origin;
p_req->p_vout->p_sys->b_pos_saved = 1;
}
p_req->p_vout->p_sys->p_qdport = nil;
[p_req->p_vout->p_sys->o_window close];
p_req->p_vout->p_sys->o_window = nil;
p_req->i_result = 1;
}
[p_req->o_lock unlockWithCondition: 1];
}
@end
/*****************************************************************************
* vout_vlc_wrapper.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_vlc_wrapper.h,v 1.1 2002/03/19 03:33:52 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.
*****************************************************************************/
#define MOUSE_MOVED 0x00000001
#define MOUSE_NOT_MOVED 0x00000002
#define MOUSE_LAST_MOVED 0x00000004
#define MOUSE_NOT_LAST_MOVED 0x00000008
@interface Vout_VLCWrapper : NSObject
{
}
+ (Vout_VLCWrapper *)instance;
+ (NSPort *)sendPort;
- (void)voutDidResize:(void *)_p_vout;
- (void)mouseEvent:(unsigned int)ui_status forVout:(void *)_p_vout;
- (BOOL)keyDown:(NSEvent *)o_event forVout:(void *)_p_vout;
@end
@interface Vout_VLCWrapper (Internal)
- (void)handlePortMessage:(NSPortMessage *)o_msg;
@end
......@@ -2,7 +2,7 @@
* vout_window.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_window.c,v 1.1 2002/02/18 01:34:44 jlj Exp $
* $Id: vout_window.c,v 1.2 2002/03/19 03:33:52 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -24,27 +24,19 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
#import <Cocoa/Cocoa.h>
#include <videolan/vlc.h>
#include "video.h"
#include "video_output.h"
#include "interface.h"
#include "macosx.h"
#import "vout_window.h"
/*****************************************************************************
* VLCWindow implementation
*****************************************************************************/
@implementation VLCWindow
- (void)setVout:(struct vout_thread_s *)_p_vout
- (void)setWrapper:(Vout_VLCWrapper *)_o_wrapper forVout:(void *)_p_vout
{
p_vout = _p_vout;
o_wrapper = _o_wrapper;
}
- (BOOL)canBecomeKeyWindow
......@@ -55,45 +47,34 @@
- (void)becomeKeyWindow
{
[super becomeKeyWindow];
p_vout->p_sys->b_mouse_moved = 0;
p_vout->p_sys->i_time_mouse_last_moved = mdate();
[o_wrapper
mouseEvent: (MOUSE_NOT_MOVED | MOUSE_LAST_MOVED)
forVout: p_vout];
}
- (void)resignKeyWindow
{
[super resignKeyWindow];
p_vout->p_sys->b_mouse_moved = 1;
p_vout->p_sys->i_time_mouse_last_moved = 0;
[o_wrapper
mouseEvent: (MOUSE_MOVED | MOUSE_NOT_LAST_MOVED)
forVout: p_vout];
}
- (void)keyDown:(NSEvent *)theEvent
- (void)keyDown:(NSEvent *)o_event
{
unichar key = 0;
if( [[theEvent characters] length] )
if( [o_wrapper keyDown: o_event forVout: p_vout] == NO )
{
key = [[theEvent characters] characterAtIndex: 0];
}
switch( key )
{
case 'f': case 'F':
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
break;
case 'q': case 'Q':
p_main->p_intf->b_die = 1;
break;
default:
[super keyDown: theEvent];
break;
[super keyDown: o_event];
}
}
- (void)mouseMoved:(NSEvent *)theEvent
- (void)mouseMoved:(NSEvent *)o_event
{
p_vout->p_sys->i_time_mouse_last_moved = mdate();
[o_wrapper
mouseEvent: MOUSE_LAST_MOVED
forVout: p_vout];
}
@end
......@@ -2,7 +2,7 @@
* vout_window.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: vout_window.h,v 1.1 2002/02/18 01:34:44 jlj Exp $
* $Id: vout_window.h,v 1.2 2002/03/19 03:33:52 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -21,11 +21,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#import "vout_vlc_wrapper.h"
@interface VLCWindow : NSWindow
{
struct vout_thread_s *p_vout;
void *p_vout;
Vout_VLCWrapper *o_wrapper;
}
- (void)setVout:(struct vout_thread_s *)_p_vout;
- (void)setWrapper:(Vout_VLCWrapper *)_o_wrapper forVout:(void *)_p_vout;
@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