Kaydet (Commit) 7822b553 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

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
üst 97d50c42
......@@ -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,\
......
......@@ -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
......
......@@ -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);
......
......@@ -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)];
}
// ------------------------------------------------------------------------------
......
......@@ -122,9 +122,7 @@ $(eval $(call gb_Rdb_add_components,services,\
writerperfect/source/writer/wpftwriter \
$(if $(filter MACOSX,$(OS)), \
$(if $(filter 1060,$(MACOSX_SDK_VERSION)),, \
$(if $(filter X86_64,$(CPUNAME)), \
$(call gb_Helper_optional,AVMEDIA,avmedia/source/macavf/avmediaMacAVF) \
) \
$(call gb_Helper_optional,AVMEDIA,avmedia/source/macavf/avmediaMacAVF) \
) \
$(if $(filter TRUE,$(ENABLE_MACOSX_SANDBOX)),, \
$(call gb_Helper_optional,AVMEDIA,avmedia/source/quicktime/avmediaQuickTime) \
......
......@@ -108,13 +108,11 @@ File gid_File_Lib_avmediaQuickTime
End
#if MAXOSX_SDK_VERSION >= 1070
#ifdef X86_64
File gid_File_Lib_avmediaMacAVF
PACKED_LIB_FILE_BODY;
Name = LIBNAME(avmediaMacAVF);
End
#endif
#endif
#endif
......
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