Kaydet (Commit) df291210 authored tarafından Herbert Dürr's avatar Herbert Dürr

#i124875# support Mac AV-Foundation API for multimedia content

üst a6c044e2
......@@ -7,5 +7,6 @@ av avmedia\source\framework nmake - all av_framework NULL
av avmedia\source\win nmake - all av_win NULL
av avmedia\source\java nmake - all av_java NULL
av avmedia\source\quicktime nmake - all av_quicktime NULL
av avmedia\source\macavf nmake - all av_macavf NULL
av avmedia\source\gstreamer nmake - all av_gstreamer NULL
av avmedia\util nmake - all av_util av_viewer av_framework av_win av_java av_quicktime av_gstreamer NULL
......@@ -19,5 +19,7 @@ mkdir: %_DEST%\inc%_EXT%\avmedia
..\%__SRC%\misc\avmedia.component %_DEST%\xml%_EXT%\avmedia.component
..\%__SRC%\misc\avmedia.jar.component %_DEST%\xml%_EXT%\avmedia.jar.component
..\%__SRC%\misc\avmediaQuickTime.component %_DEST%\xml%_EXT%\avmediaQuickTime.component
..\%__SRC%\misc\avmediaMacAVF.component %_DEST%\xml%_EXT%\avmediaMacAVF.component
..\%__SRC%\misc\avmediagst.component %_DEST%\xml%_EXT%\avmediagst.component
..\%__SRC%\misc\avmediawin.component %_DEST%\xml%_EXT%\avmediawin.component
......@@ -39,7 +39,7 @@ class ResMgr;
#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime"
#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False
#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 ""
#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "com.sun.star.comp.avmedia.Manager_MacAVF"
#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_False
#else
......
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
***********************************************************-->
<component loader="com.sun.star.loader.SharedLibrary"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.avmedia.Manager_MacAVF">
<service name="com.sun.star.media.Manager_MacAVF"/>
</implementation>
</component>
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#include "framegrabber.hxx"
#include "player.hxx"
#include <tools/stream.hxx>
#include <vcl/graph.hxx>
#include <vcl/cvtgrf.hxx>
#include <unotools/localfilehelper.hxx>
using namespace ::com::sun::star;
namespace avmedia { namespace macavf {
// ----------------
// - FrameGrabber -
// ----------------
FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& /*rxMgr*/ )
: mpImageGen( NULL )
{}
// ------------------------------------------------------------------------------
FrameGrabber::~FrameGrabber()
{
if( mpImageGen )
CFRelease( mpImageGen );
}
// ------------------------------------------------------------------------------
bool FrameGrabber::create( const ::rtl::OUString& rURL )
{
// TODO: use AVPlayer's movie directly instead of loading it here?
NSString* pNSStr = [NSString stringWithCharacters:rURL.getStr() length:rURL.getLength()];
NSURL* pNSURL = [NSURL URLWithString: [pNSStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
AVAsset* pMovie = [AVURLAsset URLAssetWithURL:pNSURL options:nil];
if( !pMovie )
{
OSL_TRACE( "AVGrabber::create() cannot load url=\"%s\"", [pNSStr UTF8String] );
return false;
}
if( [[pMovie tracksWithMediaType:AVMediaTypeVideo] count] == 0)
{
OSL_TRACE( "AVGrabber::create() found no video in url=\"%s\"", [pNSStr UTF8String] );
return false;
}
mpImageGen = [AVAssetImageGenerator assetImageGeneratorWithAsset:pMovie];
CFRetain( mpImageGen );
return true;
}
// ------------------------------------------------------------------------------
uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMediaTime )
throw (uno::RuntimeException)
{
uno::Reference< graphic::XGraphic > xRet;
if( !mpImageGen )
return xRet;
OSL_TRACE( "AVPlayer::grabFrame( %.3fsec)", fMediaTime );
// get the requested image from the movie
CGImage* pCGImage = [mpImageGen copyCGImageAtTime:CMTimeMakeWithSeconds(fMediaTime,1000) actualTime:NULL error:NULL];
// convert the image to a TIFF-formatted byte-array
CFMutableDataRef pCFData = CFDataCreateMutable( kCFAllocatorDefault, 0 );
CGImageDestination* pCGImgDest = CGImageDestinationCreateWithData( pCFData, kUTTypeTIFF, 1, 0 );
CGImageDestinationAddImage( pCGImgDest, pCGImage, NULL );
CGImageDestinationFinalize( pCGImgDest );
CFRelease( pCGImgDest );
const long nBitmapLen = CFDataGetLength( pCFData );
void* pBitmapBytes = (void*)CFDataGetBytePtr( pCFData );
// convert the image into the return-value type which is a graphic::XGraphic
SvMemoryStream aMemStm( pBitmapBytes, nBitmapLen, STREAM_READ | STREAM_WRITE );
Graphic aGraphic;
if( GraphicConverter::Import( aMemStm, aGraphic, CVT_TIF ) == ERRCODE_NONE )
xRet = aGraphic.GetXGraphic();
// clean up resources
CFRelease( pCFData );
return xRet;
}
// ------------------------------------------------------------------------------
::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( )
throw (uno::RuntimeException)
{
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_MACAVF_FRAMEGRABBER_IMPLEMENTATIONNAME ) );
}
// ------------------------------------------------------------------------------
sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName )
throw (uno::RuntimeException)
{
return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_MACAVF_FRAMEGRABBER_SERVICENAME ) );
}
// ------------------------------------------------------------------------------
uno::Sequence< ::rtl::OUString > SAL_CALL FrameGrabber::getSupportedServiceNames( )
throw (uno::RuntimeException)
{
uno::Sequence< ::rtl::OUString > aRet(1);
aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_MACAVF_FRAMEGRABBER_SERVICENAME ) );
return aRet;
}
} // namespace macavf
} // namespace avmedia
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _FRAMEGRABBER_HXX
#define _FRAMEGRABBER_HXX
#include "macavfcommon.hxx"
#include "com/sun/star/media/XFrameGrabber.hdl"
namespace avmedia { namespace macavf {
// ----------------
// - FrameGrabber -
// ----------------
class FrameGrabber : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber,
::com::sun::star::lang::XServiceInfo >
{
public:
explicit FrameGrabber( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
virtual ~FrameGrabber();
bool create( const ::rtl::OUString& rURL );
// XFrameGrabber
virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
AVAssetImageGenerator* mpImageGen;
};
} // namespace macavf
} // namespace avmedia
#endif // _FRAMEGRABBER_HXX
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef MACAVF_COMMON_HXX
#define MACAVF_COMMON_HXX
#ifdef MACOSX
#include <premac.h>
#import <Cocoa/Cocoa.h>
#import <AVFoundation/AVFoundation.h>
#include <postmac.h>
#endif
#include <osl/mutex.hxx>
#include <rtl/ustring.hxx>
#include <tools/debug.hxx>
#include <tools/stream.hxx>
#include <tools/string.hxx>
#include <tools/urlobj.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/factory.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/awt/MouseButton.hpp>
#include <com/sun/star/media/XManager.hpp>
#define AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_MacAVF"
#define AVMEDIA_MACAVF_MANAGER_SERVICENAME "com.sun.star.media.Manager_MacAVF"
#define AVMEDIA_MACAVF_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_MacAVF"
#define AVMEDIA_MACAVF_PLAYER_SERVICENAME "com.sun.star.media.Player_MacAVF"
#define AVMEDIA_MACAVF_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_MacAVF"
#define AVMEDIA_MACAVF_WINDOW_SERVICENAME "com.sun.star.media.Window_MacAVF"
#define AVMEDIA_MACAVF_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_MacAVF"
#define AVMEDIA_MACAVF_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_MacAVF"
// MacAVObserver handles the notifications used in the AVFoundation framework
@interface MacAVObserverObject : NSObject
- (void)observeValueForKeyPath:(NSString*)pKeyPath ofObject:(id)pObject change:(NSDictionary*)pChangeDict context:(void*)pContext;
- (void)onNotification:(NSNotification*)pNotification;
@end
namespace avmedia { namespace macavf {
class MacAVObserverHandler
{
private:
static MacAVObserverObject* mpMacAVObserverObject;
public:
MacAVObserverObject* getObserver( void ) const;
virtual bool handleObservation( NSString* pKeyPath ) = 0;
};
}}
#endif // MACAVF_COMMON_HXX
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#include "macavfcommon.hxx"
#include "manager.hxx"
using namespace ::com::sun::star;
// -------------------
// - factory methods -
// -------------------
static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact )
{
return uno::Reference< uno::XInterface >( *new ::avmedia::macavf::Manager( rxFact ) );
}
// ------------------------------------------
// - component_getImplementationEnvironment -
// ------------------------------------------
extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
// ------------------------
// - component_getFactory -
// ------------------------
extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
{
uno::Reference< lang::XSingleServiceFactory > xFactory;
void* pRet = 0;
if( rtl_str_compare( pImplName, AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ) == 0 )
{
const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_MACAVF_MANAGER_SERVICENAME ) );
xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
::rtl::OUString::createFromAscii( AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ),
create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
}
if( xFactory.is() )
{
xFactory->acquire();
pRet = xFactory.get();
}
return pRet;
}
#**************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#**************************************************************
PRJ=..$/..
PRJNAME=avmedia
TARGET=avmediaMacAVF
.IF "$(GUIBASE)" != "aqua"
dummy:
@echo " Nothing to build for GUIBASE=$(GUIBASE)"
.ELSE
# --- Settings ----------------------------------
.INCLUDE : settings.mk
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
CDEFS+= -DVERBOSE
.ENDIF
# --- Files ----------------------------------
CFLAGSCXX+=$(OBJCXXFLAGS)
SLOFILES= \
$(SLO)$/macavfuno.obj \
$(SLO)$/framegrabber.obj \
$(SLO)$/manager.obj \
$(SLO)$/window.obj \
$(SLO)$/player.obj
EXCEPTIONSFILES= \
$(SLO)$/framegrabber.obj \
$(SLO)$/macavfuno.obj
SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
SHL1STDLIBS= \
$(CPPULIB) \
$(SALLIB) \
$(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(TOOLSLIB) \
$(VCLLIB)
SHL1STDLIBS+= \
-framework Cocoa \
-framework AVFoundation \
-framework CoreMedia
# build DLL
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1IMPLIB=i$(TARGET)
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
SHL1VERSIONMAP=$(SOLARENV)/src/component.map
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
.ENDIF
ALLTAR : $(MISC)/avmediaMacAVF.component
$(MISC)/avmediaMacAVF.component .ERRREMOVE : \
$(SOLARENV)/bin/createcomponent.xslt avmediaMacAVF.component
$(XSLTPROC) --nonet --stringparam uri \
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
$(SOLARENV)/bin/createcomponent.xslt avmediaMacAVF.component
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#include "manager.hxx"
#include "player.hxx"
#include <tools/urlobj.hxx>
using namespace ::com::sun::star;
namespace avmedia { namespace macavf {
// ----------------
// - Manager -
// ----------------
Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
mxMgr( rxMgr )
{
OSL_TRACE( "Constructing avmedia::macavf::Manager" );
}
// ------------------------------------------------------------------------------
Manager::~Manager()
{}
// ------------------------------------------------------------------------------
uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL )
throw (uno::RuntimeException)
{
Player* pPlayer( new Player( mxMgr ) );
uno::Reference< media::XPlayer > xRet( pPlayer );
INetURLObject aURL( rURL );
OSL_TRACE( "avmediamacavf: Manager::createPlayer" );
if( !pPlayer->create( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
xRet = uno::Reference< media::XPlayer >();
return xRet;
}
// ------------------------------------------------------------------------------
::rtl::OUString SAL_CALL Manager::getImplementationName( )
throw (uno::RuntimeException)
{
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ) );
}
// ------------------------------------------------------------------------------
sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName )
throw (uno::RuntimeException)
{
return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_MACAVF_MANAGER_SERVICENAME ) );
}
// ------------------------------------------------------------------------------
uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames( )
throw (uno::RuntimeException)
{
uno::Sequence< ::rtl::OUString > aRet(1);
aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_MACAVF_MANAGER_SERVICENAME ) );
return aRet;
}
} // namespace macavf
} // namespace avmedia
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _MANAGER_HXX
#define _MANAGER_HXX
#include "macavfcommon.hxx"
#include "com/sun/star/media/XManager.hdl"
// -----------
// - Manager -
// -----------
namespace avmedia { namespace macavf {
class Manager : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XManager,
::com::sun::star::lang::XServiceInfo >
{
public:
Manager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
~Manager();
// XManager
virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > SAL_CALL createPlayer( const ::rtl::OUString& aURL ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
};
} // namespace macavf
} // namespace avmedia
#endif // _MANAGER_HXX
This diff is collapsed.
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _PLAYER_HXX
#define _PLAYER_HXX
#include <osl/conditn.h>
#include "macavfcommon.hxx"
#include "com/sun/star/media/XPlayer.hdl"
namespace avmedia { namespace macavf {
/*
// ----------
// - Player -
// ----------
*/
class Player
: public MacAVObserverHandler
, public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer,
::com::sun::star::lang::XServiceInfo >
{
public:
explicit Player( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
virtual ~Player();
bool create( const ::rtl::OUString& rURL );
// XPlayer
virtual void SAL_CALL start() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL stop() throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL isPlaying() throw (::com::sun::star::uno::RuntimeException);
virtual double SAL_CALL getDuration() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setMediaTime( double fTime ) throw (::com::sun::star::uno::RuntimeException);
virtual double SAL_CALL getMediaTime() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setStopTime( double fTime ) throw (::com::sun::star::uno::RuntimeException);
virtual double SAL_CALL getStopTime() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setRate( double fRate ) throw (::com::sun::star::uno::RuntimeException);
virtual double SAL_CALL getRate() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL isPlaybackLoop() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setMute( sal_Bool bSet ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL isMute() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Int16 SAL_CALL getVolumeDB() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::awt::Size SAL_CALL getPreferredPlayerWindowSize( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > SAL_CALL createPlayerWindow( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber( ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
AVAsset* getMovie();
AVPlayer* getAVPlayer() const { return mpPlayer; }
virtual bool handleObservation( NSString* pKeyPath );
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
::rtl::OUString maURL;
AVPlayer* mpPlayer;
float mfUnmutedVolume;
double mfStopTime;
bool mbMuted;
bool mbLooping;
};
} // namespace macavf
} // namespace avmedia
#endif // _PLAYER_HXX
This diff is collapsed.
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _WINDOW_HXX
#define _WINDOW_HXX
#include "macavfcommon.hxx"
#include <cppuhelper/interfacecontainer.h>
#include "com/sun/star/media/XPlayerWindow.hdl"
// ---------------
// - MyMediaView -
// ---------------
@interface MyMediaView : NSView
@property (nonatomic, readonly, strong) AVPlayer* player;
@property (nonatomic, readonly, strong) AVPlayerLayer* playerLayer;
@property (nonatomic, retain) NSURL* videoURL;
- (void) play;
@end
namespace avmedia { namespace macavf {
// ---------------
// - Window -
// ---------------
class Player;
class Window
: public MacAVObserverHandler
, public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow,
::com::sun::star::lang::XServiceInfo >
{
public:
Window( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rxMgr,
Player& i_rPlayer,
NSView* i_pParentView
);
virtual ~Window();
bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
void processGraphEvent();
void updatePointer();
// XPlayerWindow
virtual void SAL_CALL update( ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL setZoomLevel( ::com::sun::star::media::ZoomLevel ZoomLevel ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setPointerType( sal_Int32 nPointerType ) throw (::com::sun::star::uno::RuntimeException);
// XWindow
virtual void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setVisible( sal_Bool Visible ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setEnable( sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setFocus( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
// XComponent
virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
virtual bool handleObservation( NSString* pKeyPath );
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
::osl::Mutex maMutex;
::cppu::OMultiTypeInterfaceContainerHelper maListeners;
::com::sun::star::media::ZoomLevel meZoomLevel;
Player& mrPlayer;
int mnPointerType;
NSView* mpView; // parent-view == movie-view
AVPlayerLayer* mpPlayerLayer;
void ImplLayoutVideoWindow();
};
} // namespace macavf
} // namespace avmedia
#endif // _WINDOW_HXX
......@@ -615,6 +615,14 @@ File gid_File_Lib_avmediaQuickTime
Name = LIBNAME(avmediaQuickTime);
Dir = SCP2_OOO_BIN_DIR;
End
File gid_File_Lib_avmediaMacAVF
TXT_FILE_BODY;
Styles = (PACKED);
Name = LIBNAME(avmediaMacAVF);
Dir = SCP2_OOO_BIN_DIR;
End
#endif // MACOSX
#ifdef OS2
......
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