summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-05-16 10:59:13 +0300
committerTor Lillqvist <tml@collabora.com>2014-05-16 12:43:03 +0300
commit7822b5535cccc68e5b454d04a66a6b4f27675ec6 (patch)
tree00b0d6aa828a845484c0b3251a9cfd796d26a73f /avmedia
parent97d50c425f83f05bb395956e1f855db00b979f27 (diff)
Make the MacAVF code build also as 32-bit
When compiling 32-bit OS X code, the code will use the "legacy Objective-C runtime", which means that instance variables of an Objective-C class must be declared in the @interface block, not in the @implementation. CGRect and NSRect are not the same for 32-bit code. Also, use boost::unordered_map. Change-Id: Icc56ff298203565a7568714b0e9f42c7c6b89737
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/Module_avmedia.mk3
-rw-r--r--avmedia/source/macavf/macavfcommon.hxx14
-rw-r--r--avmedia/source/macavf/player.mm16
-rw-r--r--avmedia/source/macavf/window.mm6
4 files changed, 19 insertions, 20 deletions
diff --git a/avmedia/Module_avmedia.mk b/avmedia/Module_avmedia.mk
index 06bbef7a1bd1..bd0382d13770 100644
--- a/avmedia/Module_avmedia.mk
+++ b/avmedia/Module_avmedia.mk
@@ -44,15 +44,12 @@ endif
endif
ifeq ($(OS),MACOSX)
-ifeq ($(CPUNAME),X86_64)
-# The macavf code is a bit x86_64 dependent...
ifneq (1060,$(MACOSX_SDK_VERSION))
$(eval $(call gb_Module_add_targets,avmedia,\
Library_avmediaMacAVF \
))
endif
endif
-endif
ifneq ($(ENABLE_DIRECTX),)
$(eval $(call gb_Module_add_targets,avmedia,\
diff --git a/avmedia/source/macavf/macavfcommon.hxx b/avmedia/source/macavf/macavfcommon.hxx
index 7082724ac27e..618a5667509f 100644
--- a/avmedia/source/macavf/macavfcommon.hxx
+++ b/avmedia/source/macavf/macavfcommon.hxx
@@ -20,12 +20,13 @@
#ifndef INCLUDED_AVMEDIA_SOURCE_MACAVF_MACAVFCOMMON_HXX
#define INCLUDED_AVMEDIA_SOURCE_MACAVF_MACAVFCOMMON_HXX
-#ifdef MACOSX
#include <premac.h>
#import <Cocoa/Cocoa.h>
#import <AVFoundation/AVFoundation.h>
#include <postmac.h>
-#endif
+
+#include <boost/unordered_map.hpp>
+
#include <osl/mutex.hxx>
#include <rtl/ustring.hxx>
#include <tools/debug.hxx>
@@ -64,7 +65,16 @@
// MacAVObserver handles the notifications used in the AVFoundation framework
+namespace avmedia { namespace macavf {
+class MacAVObserverHandler;
+} }
+
+typedef boost::unordered_map<NSObject*,avmedia::macavf::MacAVObserverHandler*> HandlersForObject;
+
@interface MacAVObserverObject : NSObject
+{
+ HandlersForObject maHandlersForObject;
+}
- (void)observeValueForKeyPath:(NSString*)pKeyPath ofObject:(id)pObject change:(NSDictionary*)pChangeDict context:(void*)pContext;
- (void)onNotification:(NSNotification*)pNotification;
@end
diff --git a/avmedia/source/macavf/player.mm b/avmedia/source/macavf/player.mm
index 6c348e0ef4be..14f8a073336a 100644
--- a/avmedia/source/macavf/player.mm
+++ b/avmedia/source/macavf/player.mm
@@ -25,18 +25,8 @@
using namespace ::com::sun::star;
-#ifdef _LIBCPP_VERSION
-#include <unordered_map>
-typedef std::unordered_map<NSObject*,avmedia::macavf::MacAVObserverHandler*> HandlersForObject;
-#else
-#include <ext/hash_map>
-typedef std::hash_map<NSObject*,avmedia::macavf::MacAVObserverHandler*> HandlersForObject;
-#endif
-
@implementation MacAVObserverObject
-{
- HandlersForObject maHandlersForObject;
-}
+
- (void)observeValueForKeyPath:(NSString*)pKeyPath ofObject:(id)pObject change:(NSDictionary*)pChangeDict context:(void*)pContext
{
(void) pObject;
@@ -387,7 +377,7 @@ awt::Size SAL_CALL Player::getPreferredPlayerWindowSize()
NSArray* pVideoTracks = [pMovie tracksWithMediaType:AVMediaTypeVideo];
if ([pVideoTracks count] > 0)
{
- AVAssetTrack* pFirstVideoTrack =(AVAssetTrack*)pVideoTracks[0];
+ AVAssetTrack* pFirstVideoTrack = (AVAssetTrack*) [pVideoTracks objectAtIndex:0];
const CGSize aPrefSize = [pFirstVideoTrack naturalSize];
aSize = awt::Size( aPrefSize.width, aPrefSize.height );
}
@@ -405,7 +395,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co
OSL_TRACE( "Player::createPlayerWindow %dx%d argsLength: %d", aSize.Width, aSize.Height, aArguments.getLength() );
// get the parent view
- sal_IntPtr nNSViewPtr = NULL;
+ sal_IntPtr nNSViewPtr = 0;
aArguments[0] >>= nNSViewPtr;
NSView* pParentView = reinterpret_cast<NSView*>(nNSViewPtr);
diff --git a/avmedia/source/macavf/window.mm b/avmedia/source/macavf/window.mm
index af54f0cad40a..ea1132bedba9 100644
--- a/avmedia/source/macavf/window.mm
+++ b/avmedia/source/macavf/window.mm
@@ -60,7 +60,8 @@ Window::Window( const uno::Reference< lang::XMultiServiceFactory >& i_rxMgr, Pla
[pAVPlayer pause];
mpPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:pAVPlayer];
[mpPlayerLayer retain];
- [mpPlayerLayer setFrame:[mpView frame]];
+ NSRect viewFrame = [mpView frame];
+ [mpPlayerLayer setFrame:CGRectMake(viewFrame.origin.x, viewFrame.origin.y, viewFrame.size.width, viewFrame.size.height)];
[mpPlayerLayer setHidden:YES];
[mpPlayerLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill];
[mpPlayerLayer addObserver:getObserver() forKeyPath:@"readyForDisplay" options:0 context:this];
@@ -142,7 +143,8 @@ void SAL_CALL Window::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal
aRect.size.height = Height;
[mpView setFrameSize: aRect.size];
- [mpPlayerLayer setFrame: [mpView frame]];
+ NSRect viewFrame = [mpView frame];
+ [mpPlayerLayer setFrame:CGRectMake(viewFrame.origin.x, viewFrame.origin.y, viewFrame.size.width, viewFrame.size.height)];
}
// ------------------------------------------------------------------------------