Index: avmedia/prj/build.lst =================================================================== RCS file: /cvs/graphics/avmedia/prj/build.lst,v retrieving revision 1.3 diff -u -r1.3 build.lst --- avmedia/prj/build.lst 2 Dec 2004 18:30:02 -0000 1.3 +++ avmedia/prj/build.lst 4 Oct 2007 00:47:02 -0000 @@ -7,4 +7,5 @@ av avmedia\source\win nmake - all av_win NULL av avmedia\source\java nmake - all av_java NULL av avmedia\source\xine nmake - all av_xine NULL -av avmedia\util nmake - all av_util av_viewer av_framework av_win av_java av_xine NULL +av avmedia\source\quicktime nmake - all av_quicktime NULL +av avmedia\util nmake - all av_util av_viewer av_framework av_win av_java av_quicktime av_xine NULL Index: avmedia/source/inc/mediamisc.hxx =================================================================== RCS file: /cvs/graphics/avmedia/source/inc/mediamisc.hxx,v retrieving revision 1.3 diff -u -r1.3 mediamisc.hxx --- avmedia/source/inc/mediamisc.hxx 26 Apr 2007 09:49:09 -0000 1.3 +++ avmedia/source/inc/mediamisc.hxx 4 Oct 2007 00:47:02 -0000 @@ -37,12 +37,15 @@ #define AVMEDIA_RESID( nId ) ResId( nId, * ::avmedia::GetResMgr() ) -#ifdef WNT +#ifdef WNT #define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_DirectX" #else +#ifdef QUARTZ +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime" +#else #define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_Java" #endif - +#endif namespace avmedia { Index: avmedia/source/quicktime/avmediaQuickTime.map =================================================================== RCS file: avmedia/source/quicktime/avmediaQuickTime.map diff -N avmedia/source/quicktime/avmediaQuickTime.map --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/avmediaQuickTime.map 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,8 @@ +LEXPS_1_0 { + global: + component_getFactory; + component_getImplementationEnvironment; + component_writeInfo; + local: + *; +}; Index: avmedia/source/quicktime/framegrabber.cxx =================================================================== RCS file: avmedia/source/quicktime/framegrabber.cxx diff -N avmedia/source/quicktime/framegrabber.cxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/framegrabber.cxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,235 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: framegrabber.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/22 09:18:06 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "framegrabber.hxx" +#include "player.hxx" + +#include +#include +#include + +#define AVMEDIA_QUICKTIME_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_Quicktime" +#define AVMEDIA_QUICKTIME_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_Quicktime" + +using namespace ::com::sun::star; + +namespace avmedia { namespace quicktime { + +// ---------------- +// - FrameGrabber - +// ---------------- + +FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : + mxMgr( rxMgr ) +{ + ; +} + +// ------------------------------------------------------------------------------ + +FrameGrabber::~FrameGrabber() +{ + ; +} + +// ------------------------------------------------------------------------------ + +IMediaDet* FrameGrabber::implCreateMediaDet( const ::rtl::OUString& rURL ) const +{ + IMediaDet* pDet = NULL; + + if( SUCCEEDED( CoCreateInstance( CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER, IID_IMediaDet, (void**) &pDet ) ) ) + { + String aLocalStr; + + if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( rURL, aLocalStr ) && aLocalStr.Len() ) + { + if( !SUCCEEDED( pDet->put_Filename( ::SysAllocString( aLocalStr.GetBuffer() ) ) ) ) + { + pDet->Release(); + pDet = NULL; + } + } + } + + return pDet; +} + +// ------------------------------------------------------------------------------ + +bool FrameGrabber::create( const ::rtl::OUString& rURL ) +{ + // just check if a MediaDet interface can be created with the given URL + IMediaDet* pDet = implCreateMediaDet( rURL ); + + if( pDet ) + { + maURL = rURL; + pDet->Release(); + pDet = NULL; + } + else + maURL = ::rtl::OUString(); + + return( maURL.getLength() > 0 ); +} + +// ------------------------------------------------------------------------------ + +uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMediaTime ) + throw (uno::RuntimeException) +{ + uno::Reference< graphic::XGraphic > xRet; + IMediaDet* pDet = implCreateMediaDet( maURL ); + + if( pDet ) + { + double fLength; + long nStreamCount; + bool bFound = false; + + if( SUCCEEDED( pDet->get_OutputStreams( &nStreamCount ) ) ) + { + for( long n = 0; ( n < nStreamCount ) && !bFound; ++n ) + { + GUID aMajorType; + + if( SUCCEEDED( pDet->put_CurrentStream( n ) ) && + SUCCEEDED( pDet->get_StreamType( &aMajorType ) ) && + ( aMajorType == MEDIATYPE_Video ) ) + { + bFound = true; + } + } + } + + if( bFound && + ( S_OK == pDet->get_StreamLength( &fLength ) ) && + ( fLength > 0.0 ) && ( fMediaTime >= 0.0 ) && ( fMediaTime <= fLength ) ) + { + AM_MEDIA_TYPE aMediaType; + long nWidth = 0, nHeight = 0, nSize = 0; + + if( SUCCEEDED( pDet->get_StreamMediaType( &aMediaType ) ) ) + { + if( ( aMediaType.formattype == FORMAT_VideoInfo ) && + ( aMediaType.cbFormat >= sizeof( VIDEOINFOHEADER ) ) ) + { + VIDEOINFOHEADER* pVih = reinterpret_cast< VIDEOINFOHEADER* >( aMediaType.pbFormat ); + + nWidth = pVih->bmiHeader.biWidth; + nHeight = pVih->bmiHeader.biHeight; + + if( nHeight < 0 ) + nHeight *= -1; + } + + if( aMediaType.cbFormat != 0 ) + { + ::CoTaskMemFree( (PVOID) aMediaType.pbFormat ); + aMediaType.cbFormat = 0; + aMediaType.pbFormat = NULL; + } + + if( aMediaType.pUnk != NULL ) + { + aMediaType.pUnk->Release(); + aMediaType.pUnk = NULL; + } + } + + if( ( nWidth > 0 ) && ( nHeight > 0 ) && + SUCCEEDED( pDet->GetBitmapBits( 0, &nSize, NULL, nWidth, nHeight ) ) && + ( nSize > 0 ) ) + { + char* pBuffer = new char[ nSize ]; + + try + { + if( SUCCEEDED( pDet->GetBitmapBits( fMediaTime, NULL, pBuffer, nWidth, nHeight ) ) ) + { + SvMemoryStream aMemStm( pBuffer, nSize, STREAM_READ | STREAM_WRITE ); + Bitmap aBmp; + + if( aBmp.Read( aMemStm, false ) && !aBmp.IsEmpty() ) + { + const Graphic aGraphic( aBmp ); + xRet = aGraphic.GetXGraphic(); + } + } + } + catch( ... ) + { + } + + delete [] pBuffer; + } + } + + pDet->Release(); + } + + return xRet; +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( ) + throw (uno::RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_QUICKTIME_FRAMEGRABBER_IMPLEMENTATIONNAME ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_QUICKTIME_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_QUICKTIME_FRAMEGRABBER_SERVICENAME ) ); + + return aRet; +} + +} // namespace quicktime +} // namespace avmedia Index: avmedia/source/quicktime/framegrabber.hxx =================================================================== RCS file: avmedia/source/quicktime/framegrabber.hxx diff -N avmedia/source/quicktime/framegrabber.hxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/framegrabber.hxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,78 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: framegrabber.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/22 09:18:06 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _FRAMEGRABBER_HXX +#define _FRAMEGRABBER_HXX + +#include "quicktimecommon.hxx" + +#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_ +#include "com/sun/star/media/XFrameGrabber.hdl" +#endif + +namespace avmedia { namespace quicktime { + +// ---------------- +// - FrameGrabber - +// ---------------- + +class FrameGrabber : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber, + ::com::sun::star::lang::XServiceInfo > +{ +public: + + FrameGrabber( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr ); + ~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; + ::rtl::OUString maURL; +}; + +} // namespace quicktime +} // namespace avmedia + +#endif // _FRAMEGRABBER_HXX Index: avmedia/source/quicktime/makefile.mk =================================================================== RCS file: avmedia/source/quicktime/makefile.mk diff -N avmedia/source/quicktime/makefile.mk --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/makefile.mk 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,91 @@ +#************************************************************************* +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: mox $ $Date: 2006/09/19 10:47:25 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=avmedia +TARGET=avmediaQuickTime + +.IF "$(GUIBASE)"=="aqua" + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk + +.IF "$(verbose)"!="" || "$(VERBOSE)"!="" +CDEFS+= -DVERBOSE +.ENDIF + +# --- Files ---------------------------------- + +CFLAGSCXX += -x objective-c++ -fobjc-exceptions + +SLOFILES= \ + $(SLO)$/quicktimeuno.obj \ + $(SLO)$/manager.obj \ + $(SLO)$/window.obj \ + $(SLO)$/player.obj + +EXCEPTIONSFILES= \ + $(SLO)$/quicktimeuno.obj + +SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX) + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(SALLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(TOOLSLIB) + +SHL1STDLIBS+= \ + -framework Cocoa \ + -framework QTKit \ + -framework QuickTime + +# build DLL +SHL1LIBS=$(SLB)$/$(TARGET).lib +SHL1IMPLIB=i$(TARGET) +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +SHL1VERSIONMAP= $(TARGET).map + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +.ELSE +dummy: + @echo " Nothing to build for GUIBASE=$(GUIBASE)" +.ENDIF Index: avmedia/source/quicktime/manager.cxx =================================================================== RCS file: avmedia/source/quicktime/manager.cxx diff -N avmedia/source/quicktime/manager.cxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/manager.cxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,107 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: manager.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/19 10:47:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "manager.hxx" +#include "player.hxx" + +#ifndef _URLOBJ_HXX //autogen wg. INetURLObject +#include +#endif + +using namespace ::com::sun::star; + +namespace avmedia { namespace quicktime { +// ---------------- +// - Manager - +// ---------------- + +Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : + mxMgr( rxMgr ) +{ + OSL_TRACE( "avmediaquicktime: Manager::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( "avmediaquicktime: 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_QUICKTIME_MANAGER_IMPLEMENTATIONNAME ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_QUICKTIME_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_QUICKTIME_MANAGER_SERVICENAME ) ); + + return aRet; +} + +} // namespace quicktime +} // namespace avmedia Index: avmedia/source/quicktime/manager.hxx =================================================================== RCS file: avmedia/source/quicktime/manager.hxx diff -N avmedia/source/quicktime/manager.hxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/manager.hxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,74 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: manager.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/19 10:47:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _MANAGER_HXX +#define _MANAGER_HXX + +#include "quicktimecommon.hxx" + +#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_ +#include "com/sun/star/media/XManager.hdl" +#endif + +// ----------- +// - Manager - +// ----------- + +namespace avmedia { namespace quicktime { + +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 quicktime +} // namespace avmedia + +#endif // _MANAGER_HXX Index: avmedia/source/quicktime/player.cxx =================================================================== RCS file: avmedia/source/quicktime/player.cxx diff -N avmedia/source/quicktime/player.cxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/player.cxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,452 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: player.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/19 10:47:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include + +#include "player.hxx" +//#include "framegrabber.hxx" +#include "window.hxx" + +// Quicktime 7+ in Mac OS X 10.4 +#define QT701 0x07010000 + +// Quicktime 6.4+ in Mac OS X 10.3 +#define QT64 0x06400000 + +using namespace ::com::sun::star; + +namespace avmedia { namespace quicktime { + +// ---------------- +// - Player - +// ---------------- + +Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : + mxMgr( rxMgr ), + mpMovieView( nil ), + mpMovie( nil ), + /* GST + mbFakeVideo (sal_False ), + */ + mnUnmutedVolume( 0 ), + mbMuted( false ), + mbLooping( false ), + mbInitialized( false ), + mnWindowID( 0 ), + mnDuration( 0 ), + mnWidth( 0 ), + mnHeight( 0 ), + mnVersion( 0 ), + maSizeCondition( osl_createCondition() ) +{ + OSErr result; + + NSApplicationLoad(); + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + // check the version of QuickTime installed + result = Gestalt(gestaltQuickTime,&mnVersion); + if ((result == noErr) && (mnVersion >= QT701)) + { + // we have version 7.01 or later, initialize + mpMovie = [QTMovie movie]; + [mpMovie retain]; + mbInitialized = true; + } + [pool release]; +} + +// ------------------------------------------------------------------------------ + +Player::~Player() +{ + if( mbInitialized ) + { + if( mpMovieView ) + { + [mpMovieView setMovie:nil]; + [mpMovieView release]; + mpMovieView = nil; + } + + if( mpMovie ) + { + [mpMovie release]; + mpMovie = nil; + } + + } +} + + +// ------------------------------------------------------------------------------ + +bool Player::create( const ::rtl::OUString& rURL ) +{ + bool bRet = false; + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + NSURL* aURL = [NSURL URLWithString:[[NSString alloc] initWithCharacters: rURL.getStr() length: rURL.getLength()] ]; + + // create the Movie + + if( mbInitialized ) + { + + mpMovie = [mpMovie initWithURL:aURL error:nil]; + + bRet = true; + } + + [pool release]; + + return bRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::start( ) + throw (uno::RuntimeException) +{ + OSL_TRACE ("Player::start"); + + if ( mbInitialized && mpMovie ) + { + [mpMovie play]; + //HIMovieViewPlay ( mpMovieView ); + //XXX error checking?? (OSStatus) + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::stop( ) + throw (uno::RuntimeException) +{ + if ( mpMovie ) + { + [mpMovie stop]; + //HIMovieViewPause ( mpMovieView ); + //XXX error checking?? (OSStatus) + } +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Player::isPlaying() + throw (uno::RuntimeException) +{ + bool bRet = false; + long * flags = 0; + + if ( mbInitialized && mpMovieView ) + { + if (mnVersion >= 0x07010000) { + MCGetControllerInfo ( [mpMovie quickTimeMovieController] , flags ); + if (flags) + { + bRet = *flags & mcInfoIsPlaying; + } + } + } + return bRet; +} + +// ------------------------------------------------------------------------------ + +double SAL_CALL Player::getDuration( ) + throw (uno::RuntimeException) +{ + // slideshow checks for non-zero duration, so cheat here + double duration = 0.01; + + + if ( mpMovie ) // && mnDuration > 0 ) { + { + QTTime structDuration = [mpMovie duration] ; + duration = (double)structDuration.timeValue / (double)structDuration.timeScale; + // values: double = TimeValue / TimeScale = xxx / long + + //OSL_TRACE( "gst duration: %ld units, duration: %lf s", GetMovieDuration ( mpMovie ), duration ); + } + + return duration; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setMediaTime( double fTime ) + throw (uno::RuntimeException) +{ + if ( mpMovie ) + { + [mpMovie setCurrentTime: QTMakeTimeWithTimeInterval(fTime)]; + + //OSL_TRACE( "seek to: %ld units, original: %lf s", position, fTime ); + } +} + +// ------------------------------------------------------------------------------ + +double SAL_CALL Player::getMediaTime( ) + throw (uno::RuntimeException) +{ + double position = 0.0; + + if ( mpMovie ) + { + QTTime structDuration = [mpMovie currentTime] ; + position = (double)structDuration.timeValue / (double)structDuration.timeScale; + } + + return position; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setStopTime( double fTime ) + throw (uno::RuntimeException) +{ + // TODO implement +} + +// ------------------------------------------------------------------------------ + +double SAL_CALL Player::getStopTime( ) + throw (uno::RuntimeException) +{ + double fRet = 0.0; + + // TODO implement + + return fRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setRate( double fRate ) + throw (uno::RuntimeException) +{ + // Quicktime: 0 = stop, 1 = normal speed, 2 = double speed, -1 = normal speed backwards + if ( mpMovie ) + { + [mpMovie setRate: fRate]; + } +} + +// ------------------------------------------------------------------------------ + +double SAL_CALL Player::getRate( ) + throw (uno::RuntimeException) +{ + // Quicktime: 0 = stop, 1 = normal speed, 2 = double speed, -1 = normal speed backwards + double rate = 1.0; + + if ( mpMovie ) + { + rate = (double) [mpMovie rate]; + } + + return rate; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet ) + throw (uno::RuntimeException) +{ + // TODO implement +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Player::isPlaybackLoop( ) + throw (uno::RuntimeException) +{ + bool bRet = false; + + // TODO implement + + return bRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setMute( sal_Bool bSet ) + throw (uno::RuntimeException) +{ + OSL_TRACE( "set mute: %d muted: %d unmuted volume: %lf", bSet, mbMuted, mnUnmutedVolume ); + + // change the volume to 0 or the unmuted volume + if( mpMovie && mbMuted != bSet ) + { + [mpMovie setMuted: bSet ]; + mbMuted = bSet; + } + +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Player::isMute( ) + throw (uno::RuntimeException) +{ + return mbMuted; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) + throw (uno::RuntimeException) +{ + mnUnmutedVolume = pow( 10.0, nVolumeDB / 20.0 ); + + OSL_TRACE( "set volume: %d gst volume: %f", nVolumeDB, mnUnmutedVolume ); + + // change volume + if( !mbMuted && mpMovie ) + { + [mpMovie setVolume: mnUnmutedVolume ]; + } +} + +// ------------------------------------------------------------------------------ + +sal_Int16 SAL_CALL Player::getVolumeDB( ) + throw (uno::RuntimeException) +{ + sal_Int16 nVolumeDB = 0.0; + + if( mpMovie ) + { + float volume = 0.0; + + volume = [mpMovie volume]; + + nVolumeDB = (sal_Int16) ( 20.0*log10 ( volume ) ); //XX (long) volume ?? + + //OSL_TRACE( "get volume: %d gst volume: %f", nVolumeDB, volume ); + } + + return nVolumeDB; +} + +// ------------------------------------------------------------------------------ + +awt::Size SAL_CALL Player::getPreferredPlayerWindowSize( ) + throw (uno::RuntimeException) +{ + awt::Size aSize( 200, 100 ); + + // XXX TODO implement + + return aSize; +} + +// ------------------------------------------------------------------------------ + +uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments ) + throw (uno::RuntimeException) +{ + uno::Reference< ::media::XPlayerWindow > xRet; + awt::Size aSize( getPreferredPlayerWindowSize() ); + + OSL_TRACE( "Player::createPlayerWindow %d %d length: %d", aSize.Width, aSize.Height, aArguments.getLength() ); + + if( aSize.Width > 0 && aSize.Height > 0 ) + { + ::avmedia::quicktime::Window* pWindow = new ::avmedia::quicktime::Window( mxMgr, *this ); + + xRet = pWindow; + + if( aArguments.getLength() > 2 ) { + aArguments[ 2 ] >>= mnWindowID; + OSL_TRACE( "window ID: %ld", mnWindowID ); + } + + if( !pWindow->create( aArguments ) ) + xRet = uno::Reference< ::media::XPlayerWindow >(); + } + + return xRet; +} + +// ------------------------------------------------------------------------------ + +uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber( ) + throw (::com::sun::star::uno::RuntimeException) +{ + uno::Reference< media::XFrameGrabber > xRet; + + // if( maURL.getLength() > 0 ) + // { + // FrameGrabber* pGrabber = new FrameGrabber( mxMgr ); + // + // xRet = pGrabber; + // + // if( !pGrabber->create( maURL ) ) + // xRet.clear(); + // } + + return xRet; +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL Player::getImplementationName( ) + throw (uno::RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_QUICKTIME_PLAYER_IMPLEMENTATIONNAME ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_QUICKTIME_PLAYER_SERVICENAME ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > SAL_CALL Player::getSupportedServiceNames( ) + throw (uno::RuntimeException) +{ + uno::Sequence< ::rtl::OUString > aRet(1); + aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_QUICKTIME_PLAYER_SERVICENAME ) ); + + return aRet; +} + +} // namespace quicktime +} // namespace avmedia Index: avmedia/source/quicktime/player.hxx =================================================================== RCS file: avmedia/source/quicktime/player.hxx diff -N avmedia/source/quicktime/player.hxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/player.hxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,118 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: player.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/19 10:47:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _PLAYER_HXX +#define _PLAYER_HXX + +#include +#include "quicktimecommon.hxx" + +#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HDL_ +#include "com/sun/star/media/XPlayer.hdl" +#endif + +namespace avmedia { namespace quicktime { + +/* +// ---------- +// - Player - +// ---------- +*/ + +class Player : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer, + ::com::sun::star::lang::XServiceInfo > +{ +public: + + Player( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr ); + ~Player(); + + bool create( const ::rtl::OUString& rURL ); + +// void processMessage( GstMessage *message ); + + // 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); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; + + ::rtl::OUString maURL; + + QTMovieView *mpMovieView; // the view containing the movie object, output target and controller + QTMovie *mpMovie; // the Movie object + /* GST + sal_Bool mbFakeVideo; + */ + short mnUnmutedVolume; + sal_Bool mbMuted; + sal_Bool mbLooping; + sal_Bool mbInitialized; + + long mnWindowID; + long mnDuration; + int mnWidth; + int mnHeight; + + long mnVersion; + oslCondition maSizeCondition; +}; + +} // namespace quicktime +} // namespace avmedia + +#endif // _PLAYER_HXX Index: avmedia/source/quicktime/quicktimecommon.hxx =================================================================== RCS file: avmedia/source/quicktime/quicktimecommon.hxx diff -N avmedia/source/quicktime/quicktimecommon.hxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/quicktimecommon.hxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,101 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: quicktimecommon.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/19 10:47:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _QUICKTIMECOMMON_HXX +#define _QUICKTIMECOMMON_HXX + +#ifdef MACOSX +#include +#import +#import +#import +#include +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include +#endif +#ifndef __RTL_USTRING_ +#include +#endif +#ifndef _DEBUG_HXX +#include +#endif +#ifndef _STREAM_HXX +#include +#endif +#ifndef _STRING_HXX +#include +#endif +#ifndef _URLOBJ_HXX +#include +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include +#endif +#ifndef _CPPUHELPER_IMPLBASE2_HXX_ +#include +#endif +#ifndef _CPPUHELPER_WEAK_HXX_ +#include +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AVMEDIA_QUICKTIME_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_QuickTime" +#define AVMEDIA_QUICKTIME_MANAGER_SERVICENAME "com.sun.star.media.Manager_QuickTime" + +#define AVMEDIA_QUICKTIME_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_QuickTime" +#define AVMEDIA_QUICKTIME_PLAYER_SERVICENAME "com.sun.star.media.Player_QuickTime" + +#define AVMEDIA_QUICKTIME_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_QuickTime" +#define AVMEDIA_QUICKTIME_WINDOW_SERVICENAME "com.sun.star.media.Window_QuickTime" + +#define WM_GRAPHNOTIFY (WM_USER + 567) + +#endif // _QUICKTIMECOMMOM_HXX Index: avmedia/source/quicktime/quicktimeuno.cxx =================================================================== RCS file: avmedia/source/quicktime/quicktimeuno.cxx diff -N avmedia/source/quicktime/quicktimeuno.cxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/quicktimeuno.cxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,114 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: quicktimeuno.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/19 10:47:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "quicktimecommon.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::quicktime::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_writeInfo - +// ----------------------- + +extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) +{ + sal_Bool bRet = sal_False; + + if( pRegistryKey ) + { + try + { + uno::Reference< registry::XRegistryKey > xNewKey1( + static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( + ::rtl::OUString::createFromAscii( + "/" AVMEDIA_QUICKTIME_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/" + AVMEDIA_QUICKTIME_MANAGER_SERVICENAME ) ) ); + + bRet = sal_True; + } + catch( registry::InvalidRegistryException& ) + { + OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + } + } + + return bRet; +} + +// ------------------------ +// - 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_QUICKTIME_MANAGER_IMPLEMENTATIONNAME ) == 0 ) + { + const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_QUICKTIME_MANAGER_SERVICENAME ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + ::rtl::OUString::createFromAscii( AVMEDIA_QUICKTIME_MANAGER_IMPLEMENTATIONNAME ), + create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); + } + + if( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; +} Index: avmedia/source/quicktime/window.cxx =================================================================== RCS file: avmedia/source/quicktime/window.cxx diff -N avmedia/source/quicktime/window.cxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/window.cxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,367 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: window.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/23 09:18:06 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include + +#include "window.hxx" +#include "player.hxx" + +using namespace ::com::sun::star; + +namespace avmedia { namespace quicktime { + +// ----------- +// - statics - +// ----------- + +static ::osl::Mutex& ImplGetOwnStaticMutex() +{ + static ::osl::Mutex* pMutex = NULL; + + if( pMutex == NULL ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + + if( pMutex == NULL ) + { + static ::osl::Mutex aMutex; + pMutex = &aMutex; + } + } + + return *pMutex; +} + +// --------------- +// - Window - +// --------------- + +// ------------------------------------------------------------------------------ + +Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Player& rPlayer ) : + mxMgr( rxMgr ), + maListeners( maMutex ), + meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ), + mrPlayer( rPlayer ), + mnPointerType( awt::SystemPointer::ARROW ) +{ + ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() ); + +} + +// ------------------------------------------------------------------------------ + +Window::~Window() +{ +} + +bool Window::create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) +{ + ; +} + +// XPlayerWindow +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::update( ) + throw (uno::RuntimeException) +{ + //::RedrawWindow( (HWND) mnFrameWnd, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel ) + throw (uno::RuntimeException) +{ + sal_Bool bRet = false; + + if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel && + media::ZoomLevel_NOT_AVAILABLE != eZoomLevel ) + { + if( eZoomLevel != meZoomLevel ) + { + meZoomLevel = eZoomLevel; + //ImplLayoutVideoWindow(); + } + + bRet = true; + } + + return bRet; +} + +// ------------------------------------------------------------------------------ + +media::ZoomLevel SAL_CALL Window::getZoomLevel( ) + throw (uno::RuntimeException) +{ + return meZoomLevel; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setPointerType( sal_Int32 nPointerType ) + throw (uno::RuntimeException) +{ + mnPointerType = nPointerType; +} + +// XWindow +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) + throw (uno::RuntimeException) +{ +// if( mnFrameWnd ) +// { +// ::SetWindowPos( (HWND) mnFrameWnd, HWND_TOP, X, Y, Width, Height, 0 ); +// ImplLayoutVideoWindow(); +// } +} + +// ------------------------------------------------------------------------------ + +awt::Rectangle SAL_CALL Window::getPosSize() + throw (uno::RuntimeException) +{ + awt::Rectangle aRet; + + aRet.X = aRet.Y = 0; + aRet.Width = 320; + aRet.Height = 240; + +// if( mnFrameWnd ) +// { +// ::RECT aWndRect; +// long nX = 0, nY = 0, nWidth = 0, nHeight = 0; + +// if( ::GetClientRect( (HWND) mnFrameWnd, &aWndRect ) ) +// { +// aRet.X = aWndRect.left; +// aRet.Y = aWndRect.top; +// aRet.Width = aWndRect.right - aWndRect.left + 1; +// aRet.Height = aWndRect.bottom - aWndRect.top + 1; +// } +// } + + return aRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setVisible( sal_Bool bVisible ) + throw (uno::RuntimeException) +{ +// if( mnFrameWnd ) +// { +// IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() ); + +// if( pVideoWindow ) +// pVideoWindow->put_Visible( bVisible ? OATRUE : OAFALSE ); + +// ::ShowWindow( (HWND) mnFrameWnd, bVisible ? SW_SHOW : SW_HIDE ); +// } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setEnable( sal_Bool bEnable ) + throw (uno::RuntimeException) +{ +// if( mnFrameWnd ) +// ::EnableWindow( (HWND) mnFrameWnd, bEnable ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setFocus( ) + throw (uno::RuntimeException) +{ +// if( mnFrameWnd ) +// ::SetFocus( (HWND) mnFrameWnd ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + + +// XComponent +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::dispose( ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw (uno::RuntimeException) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// XServiceInfo +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL Window::getImplementationName( ) + throw (uno::RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_QUICKTIME_WINDOW_IMPLEMENTATIONNAME ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_QUICKTIME_WINDOW_SERVICENAME ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames( ) + throw (uno::RuntimeException) +{ + uno::Sequence< ::rtl::OUString > aRet(1); + aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_QUICKTIME_WINDOW_SERVICENAME ) ); + + return aRet; +} + +} // namespace quicktime +} // namespace avmedia Index: avmedia/source/quicktime/window.hxx =================================================================== RCS file: avmedia/source/quicktime/window.hxx diff -N avmedia/source/quicktime/window.hxx --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ avmedia/source/quicktime/window.hxx 4 Oct 2007 00:47:02 -0000 @@ -0,0 +1,118 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: window.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: mox $ $Date: 2006/09/19 10:47:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _WINDOW_HXX +#define _WINDOW_HXX + +#include "quicktimecommon.hxx" +#include + +#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_ +#include "com/sun/star/media/XPlayerWindow.hdl" +#endif + +namespace avmedia { namespace quicktime { + +// --------------- +// - Window - +// --------------- + +class Player; + +class Window : 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 >& rxMgr, + Player& rPlayer ); + ~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); + +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; + + void ImplLayoutVideoWindow(); +}; + +} // namespace quicktime +} // namespace avmedia + +#endif // _WINDOW_HXX Index: avmedia/source/viewer/mediawindow.cxx =================================================================== RCS file: /cvs/graphics/avmedia/source/viewer/mediawindow.cxx,v retrieving revision 1.7 diff -u -r1.7 mediawindow.cxx --- avmedia/source/viewer/mediawindow.cxx 27 Jun 2007 22:24:05 -0000 1.7 +++ avmedia/source/viewer/mediawindow.cxx 4 Oct 2007 00:47:03 -0000 @@ -484,6 +484,8 @@ { try { + fprintf(stderr, "-->%s uno reference \n\n",AVMEDIA_MANAGER_SERVICE_NAME); + uno::Reference< ::com::sun::star::media::XManager > xManager( xFactory->createInstance( ::rtl::OUString::createFromAscii( AVMEDIA_MANAGER_SERVICE_NAME ) ), uno::UNO_QUERY ); Index: avmedia/source/xine/makefile.mk =================================================================== RCS file: /cvs/graphics/avmedia/source/xine/makefile.mk,v retrieving revision 1.3 diff -u -r1.3 makefile.mk --- avmedia/source/xine/makefile.mk 7 Sep 2005 19:47:25 -0000 1.3 +++ avmedia/source/xine/makefile.mk 4 Oct 2007 00:47:03 -0000 @@ -47,7 +47,7 @@ # --- Files ---------------------------------- -.IF "$(GUI)" == "UNX" +.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" SLOFILES= \ $(SLO)$/xineuno.obj \ Index: scp2/source/ooo/file_library_ooo.scp =================================================================== RCS file: /cvs/installation/scp2/source/ooo/file_library_ooo.scp,v retrieving revision 1.260 diff -u -r1.260 file_library_ooo.scp --- scp2/source/ooo/file_library_ooo.scp 27 Sep 2007 13:10:19 -0000 1.260 +++ scp2/source/ooo/file_library_ooo.scp 4 Oct 2007 00:47:03 -0000 @@ -931,6 +931,14 @@ Name = LIBNAME(MacOSXSpell); Dir = gid_Dir_Program; End + +File gid_File_Lib_avmediaQuickTime + TXT_FILE_BODY; + Styles = (PACKED,PATCH,UNO_COMPONENT); + RegistryID = gid_Starregistry_Services_Rdb; + Name = LIBNAME(avmediaQuickTime); + Dir = gid_Dir_Program; +End #endif #endif