diff options
Diffstat (limited to 'avmedia/source/xine')
-rw-r--r-- | avmedia/source/xine/exports.dxp | 3 | ||||
-rw-r--r-- | avmedia/source/xine/makefile.mk | 64 | ||||
-rw-r--r-- | avmedia/source/xine/manager.cxx | 91 | ||||
-rw-r--r-- | avmedia/source/xine/manager.hxx | 66 | ||||
-rw-r--r-- | avmedia/source/xine/player.cxx | 262 | ||||
-rw-r--r-- | avmedia/source/xine/player.hxx | 84 | ||||
-rw-r--r-- | avmedia/source/xine/window.cxx | 571 | ||||
-rw-r--r-- | avmedia/source/xine/window.hxx | 114 | ||||
-rw-r--r-- | avmedia/source/xine/xinecommon.hxx | 65 | ||||
-rw-r--r-- | avmedia/source/xine/xineuno.cxx | 77 |
10 files changed, 1397 insertions, 0 deletions
diff --git a/avmedia/source/xine/exports.dxp b/avmedia/source/xine/exports.dxp new file mode 100644 index 000000000000..926e49f5f1a5 --- /dev/null +++ b/avmedia/source/xine/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_getFactory + diff --git a/avmedia/source/xine/makefile.mk b/avmedia/source/xine/makefile.mk new file mode 100644 index 000000000000..3ba341c0d32b --- /dev/null +++ b/avmedia/source/xine/makefile.mk @@ -0,0 +1,64 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=avmediaxine +TARGET=avmediaxine + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk + +.IF "$(verbose)"!="" || "$(VERBOSE)"!="" +CDEFS+= -DVERBOSE +.ENDIF + +# --- Files ---------------------------------- + +.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" + +SLOFILES= \ + $(SLO)$/xineuno.obj \ + $(SLO)$/manager.obj \ + $(SLO)$/window.obj \ + $(SLO)$/player.obj + +EXCEPTIONSFILES= \ + $(SLO)$/xineuno.obj + +SHL1TARGET=$(TARGET) +SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) +SHL1IMPLIB=i$(TARGET) +SHL1LIBS=$(SLB)$/$(TARGET).lib +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +.INCLUDE : target.mk diff --git a/avmedia/source/xine/manager.cxx b/avmedia/source/xine/manager.cxx new file mode 100644 index 000000000000..8fa1f27129b9 --- /dev/null +++ b/avmedia/source/xine/manager.cxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "manager.hxx" +#include "player.hxx" + +using namespace ::com::sun::star; + +namespace avmedia { namespace xine { +// ---------------- +// - Manager - +// ---------------- + +Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : + mxMgr( rxMgr ) +{ +} + +// ------------------------------------------------------------------------------ + +Manager::~Manager() +{ +} + +// ------------------------------------------------------------------------------ + +uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& aURL ) + throw (uno::RuntimeException) +{ + Player* pPlayer( new Player ); + uno::Reference< media::XPlayer > xRet( pPlayer ); + + if( !pPlayer->create( aURL ) ) + xRet = uno::Reference< media::XPlayer >(); + + return xRet; +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL Manager::getImplementationName( ) + throw (uno::RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_XINE_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_XINE_MANAGER_SERVICENAME ) ); + + return aRet; +} + +} // namespace xine +} // namespace avmedia diff --git a/avmedia/source/xine/manager.hxx b/avmedia/source/xine/manager.hxx new file mode 100644 index 000000000000..b8faf2774f73 --- /dev/null +++ b/avmedia/source/xine/manager.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _MANAGER_HXX +#define _MANAGER_HXX + +#include "xinecommon.hxx" + +#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_ +#include "com/sun/star/media/XManager.hdl" +#endif + +// ----------- +// - Manager - +// ----------- + +namespace avmedia { namespace xine { + +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 xine +} // namespace avmedia + +#endif // _MANAGER_HXX diff --git a/avmedia/source/xine/player.cxx b/avmedia/source/xine/player.cxx new file mode 100644 index 000000000000..e343bf2c0dcf --- /dev/null +++ b/avmedia/source/xine/player.cxx @@ -0,0 +1,262 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "player.hxx" +#include "window.hxx" + +using namespace ::com::sun::star; + +namespace avmedia { namespace xine { + +// ---------------- +// - Player - +// ---------------- + +Player::Player() +{ +} + +// ------------------------------------------------------------------------------ + +Player::~Player() +{ +} + +// ------------------------------------------------------------------------------ + +bool Player::create( const ::rtl::OUString& /* rURL */ ) +{ + bool bRet = false; + + + return bRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::start( ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::stop( ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Player::isPlaying() + throw (uno::RuntimeException) +{ + bool bRet = false; + + return bRet; +} + +// ------------------------------------------------------------------------------ + +double SAL_CALL Player::getDuration( ) + throw (uno::RuntimeException) +{ + double fRet = 0.0; + + return fRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setMediaTime( double /* fTime */ ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +double SAL_CALL Player::getMediaTime( ) + throw (uno::RuntimeException) +{ + double fRet = 0.0; + + return fRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setStopTime( double /* fTime */ ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +double SAL_CALL Player::getStopTime( ) + throw (uno::RuntimeException) +{ + double fRet = 0.0; + + return fRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setRate( double /* fRate */ ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +double SAL_CALL Player::getRate( ) + throw (uno::RuntimeException) +{ + double fRet = 0.0; + + return fRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setPlaybackLoop( sal_Bool /* bSet */ ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Player::isPlaybackLoop( ) + throw (uno::RuntimeException) +{ + bool bRet = false; + + return bRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setMute( sal_Bool /* bSet */ ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Player::isMute( ) + throw (uno::RuntimeException) +{ + bool bRet = false; + + return bRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Player::setVolumeDB( sal_Int16 /* nVolumeDB */ ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +sal_Int16 SAL_CALL Player::getVolumeDB( ) + throw (uno::RuntimeException) +{ + sal_Int16 nRet = 0; + + return nRet; +} + +// ------------------------------------------------------------------------------ + +awt::Size SAL_CALL Player::getPreferredPlayerWindowSize( ) + throw (uno::RuntimeException) +{ + awt::Size aSize( 0, 0 ); + + 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() ); + + if( aSize.Width > 0 && aSize.Height > 0 ) + { + ::avmedia::xine::Window* pWindow = new ::avmedia::xine::Window( *this ); + + xRet = pWindow; + + 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) +{ + return NULL; +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL Player::getImplementationName( ) + throw (uno::RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_XINE_PLAYER_IMPLEMENTATIONNAME ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_XINE_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_XINE_PLAYER_SERVICENAME ) ); + + return aRet; +} + +} // namespace xine +} // namespace avmedia diff --git a/avmedia/source/xine/player.hxx b/avmedia/source/xine/player.hxx new file mode 100644 index 000000000000..b1e18613fbeb --- /dev/null +++ b/avmedia/source/xine/player.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PLAYER_HXX +#define _PLAYER_HXX + +#include "xinecommon.hxx" + +#ifndef _COM_SUN_STAR_MEDIA_XPLAYER_HDL_ +#include "com/sun/star/media/XPlayer.hdl" +#endif + +namespace avmedia { namespace xine { + +// ---------- +// - Player - +// ---------- + +class Player : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer, + ::com::sun::star::lang::XServiceInfo > +{ +public: + + Player(); + ~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); + +private: +}; + +} // namespace xine +} // namespace avmedia + +#endif // _PLAYER_HXX diff --git a/avmedia/source/xine/window.cxx b/avmedia/source/xine/window.cxx new file mode 100644 index 000000000000..fb4f428c65fd --- /dev/null +++ b/avmedia/source/xine/window.cxx @@ -0,0 +1,571 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/awt/SystemPointer.hdl> + +#include "window.hxx" +#include "player.hxx" + +using namespace ::com::sun::star; + +namespace avmedia { namespace xine { + +// ----------- +// - 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; +} + +// ----------- +// - WndProc - +// ----------- + +/* +LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 ) +{ + Window* pWindow = (Window*) ::GetWindowLong( hWnd, 0 ); + bool bProcessed = true; + + if( pWindow ) + { + switch( nMsg ) + { + case( WM_SETCURSOR ): + pWindow->updatePointer(); + break; + + case( WM_GRAPHNOTIFY ): + pWindow->processGraphEvent(); + break; + + case( WM_MOUSEMOVE ): + case( WM_LBUTTONDOWN ): + case( WM_MBUTTONDOWN ): + case( WM_RBUTTONDOWN ): + case( WM_LBUTTONUP ): + case( WM_MBUTTONUP ): + case( WM_RBUTTONUP ): + { + awt::MouseEvent aUNOEvt; + POINT aWinPoint; + + if( !::GetCursorPos( &aWinPoint ) || !::ScreenToClient( hWnd, &aWinPoint ) ) + { + aWinPoint.x = GET_X_LPARAM( nPar2 ); + aWinPoint.y = GET_Y_LPARAM( nPar2 ); + } + aUNOEvt.Modifiers = 0; + aUNOEvt.Buttons = 0; + aUNOEvt.X = aWinPoint.x; + aUNOEvt.Y = aWinPoint.y; + aUNOEvt.PopupTrigger = false; + + // Modifiers + if( nPar1 & MK_SHIFT ) + aUNOEvt.Modifiers |= awt::KeyModifier::SHIFT; + + if( nPar1 & MK_CONTROL ) + aUNOEvt.Modifiers |= awt::KeyModifier::MOD1; + + // Buttons + if( WM_LBUTTONDOWN == nMsg || WM_LBUTTONUP == nMsg ) + aUNOEvt.Buttons |= awt::MouseButton::LEFT; + + if( WM_MBUTTONDOWN == nMsg || WM_MBUTTONUP == nMsg ) + aUNOEvt.Buttons |= awt::MouseButton::MIDDLE; + + if( WM_RBUTTONDOWN == nMsg || WM_RBUTTONUP == nMsg ) + aUNOEvt.Buttons |= awt::MouseButton::RIGHT; + + // event type + if( WM_LBUTTONDOWN == nMsg || + WM_MBUTTONDOWN == nMsg || + WM_RBUTTONDOWN == nMsg ) + { + aUNOEvt.ClickCount = 1; + pWindow->fireMousePressedEvent( aUNOEvt ); + } + else if( WM_LBUTTONUP == nMsg || + WM_MBUTTONUP == nMsg || + WM_RBUTTONUP == nMsg ) + { + aUNOEvt.ClickCount = 1; + pWindow->fireMouseReleasedEvent( aUNOEvt ); + } + else if( WM_MOUSEMOVE == nMsg ) + { + aUNOEvt.ClickCount = 0; + pWindow->fireMouseMovedEvent( aUNOEvt ); + pWindow->updatePointer(); + } + } + break; + + case( WM_SETFOCUS ): + { + const awt::FocusEvent aUNOEvt; + pWindow->fireSetFocusEvent( aUNOEvt ); + } + break; + + default: + bProcessed = false; + break; + } + } + else + bProcessed = false; + + return( bProcessed ? 0 : DefWindowProc( hWnd, nMsg, nPar1, nPar2 ) ); +} +*/ + +// --------------- +// - Window - +// --------------- + +Window::Window( Player& rPlayer ) : + mrPlayer( rPlayer ), + maListeners( maMutex ), + meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ), + mnPointerType( awt::SystemPointer::ARROW ) +{ + ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() ); +} + +// ------------------------------------------------------------------------------ + +Window::~Window() +{ +} + +// ------------------------------------------------------------------------------ + +void Window::implLayoutVideoWindow() +{ + if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) + { + awt::Size aPrefSize( mrPlayer.getPreferredPlayerWindowSize() ); + awt::Rectangle aRect = getPosSize(); + int nW = aRect.Width, nH = aRect.Height; + int nVideoW = nW, nVideoH = nH; + int nX = 0, nY = 0, nWidth = 0, nHeight = 0; + bool bDone = false, bZoom = false; + + if( media::ZoomLevel_ORIGINAL == meZoomLevel ) + { + bZoom = true; + } + else if( media::ZoomLevel_ZOOM_1_TO_4 == meZoomLevel ) + { + aPrefSize.Width >>= 2; + aPrefSize.Height >>= 2; + bZoom = true; + } + else if( media::ZoomLevel_ZOOM_1_TO_2 == meZoomLevel ) + { + aPrefSize.Width >>= 1; + aPrefSize.Height >>= 1; + bZoom = true; + } + else if( media::ZoomLevel_ZOOM_2_TO_1 == meZoomLevel ) + { + aPrefSize.Width <<= 1; + aPrefSize.Height <<= 1; + bZoom = true; + } + else if( media::ZoomLevel_ZOOM_4_TO_1 == meZoomLevel ) + { + aPrefSize.Width <<= 2; + aPrefSize.Height <<= 2; + bZoom = true; + } + else if( media::ZoomLevel_FIT_TO_WINDOW == meZoomLevel ) + { + nWidth = nVideoW; + nHeight = nVideoH; + bDone = true; + } + + if( bZoom ) + { + if( ( aPrefSize.Width <= nVideoW ) && ( aPrefSize.Height <= nVideoH ) ) + { + nX = ( nVideoW - aPrefSize.Width ) >> 1; + nY = ( nVideoH - aPrefSize.Height ) >> 1; + nWidth = aPrefSize.Width; + nHeight = aPrefSize.Height; + bDone = true; + } + } + + if( !bDone ) + { + if( aPrefSize.Width > 0 && aPrefSize.Height > 0 && nVideoW > 0 && nVideoH > 0 ) + { + double fPrefWH = (double) aPrefSize.Width / aPrefSize.Height; + + if( fPrefWH < ( (double) nVideoW / nVideoH ) ) + nVideoW = (int)( nVideoH * fPrefWH ); + else + nVideoH = (int)( nVideoW / fPrefWH ); + + nX = ( nW - nVideoW ) >> 1; + nY = ( nH - nVideoH ) >> 1; + nWidth = nVideoW; + nHeight = nVideoH; + } + else + nX = nY = nWidth = nHeight = 0; + } + + /* + IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() ); + + if( pVideoWindow ) + pVideoWindow->SetWindowPosition( nX, nY, nWidth, nHeight ); + */ + } +} + +// ------------------------------------------------------------------------------ + +bool Window::create( const uno::Sequence< uno::Any >& /*rArguments*/ ) +{ + bool bRet = false; + + return bRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::update( ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel ) + throw (uno::RuntimeException) +{ + 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; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setPosSize( sal_Int32 /*X*/, sal_Int32 /*Y*/, sal_Int32 /*Width*/, sal_Int32 /*Height*/, sal_Int16 /*Flags*/ ) + throw (uno::RuntimeException) +{ + implLayoutVideoWindow(); +} + +// ------------------------------------------------------------------------------ + +awt::Rectangle SAL_CALL Window::getPosSize() + throw (uno::RuntimeException) +{ + awt::Rectangle aRet; + + return aRet; +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setVisible( sal_Bool /* bVisible */ ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setEnable( sal_Bool /* bEnable */ ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setFocus( ) + throw (uno::RuntimeException) +{ +} + +// ------------------------------------------------------------------------------ + +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 ); +} + +// ------------------------------------------------------------------------------ + +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 ); +} + +// ------------------------------------------------------------------------------ + +void Window::fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XMouseListener >*) 0 ) ); + + if( pContainer ) + { + ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + + while( aIter.hasMoreElements() ) + uno::Reference< awt::XMouseListener >( aIter.next(), uno::UNO_QUERY )->mousePressed( rEvt ); + } +} + +// ----------------------------------------------------------------------------- + +void Window::fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XMouseListener >*) 0 ) ); + + if( pContainer ) + { + ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + + while( aIter.hasMoreElements() ) + uno::Reference< awt::XMouseListener >( aIter.next(), uno::UNO_QUERY )->mouseReleased( rEvt ); + } +} + +// ----------------------------------------------------------------------------- + +void Window::fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XMouseMotionListener >*) 0 ) ); + + if( pContainer ) + { + ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + + while( aIter.hasMoreElements() ) + uno::Reference< awt::XMouseMotionListener >( aIter.next(), uno::UNO_QUERY )->mouseMoved( rEvt ); + } +} + +// ----------------------------------------------------------------------------- + +void Window::fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt ) +{ + ::cppu::OInterfaceContainerHelper* pContainer = maListeners.getContainer( getCppuType( (uno::Reference< awt::XFocusListener >*) 0 ) ); + + if( pContainer ) + { + ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); + + while( aIter.hasMoreElements() ) + uno::Reference< awt::XFocusListener >( aIter.next(), uno::UNO_QUERY )->focusGained( rEvt ); + } +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL Window::getImplementationName( ) + throw (uno::RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_XINE_WINDOW_IMPLEMENTATIONNAME ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_XINE_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_XINE_WINDOW_SERVICENAME ) ); + + return aRet; +} + +} // namespace xine +} // namespace avmedia diff --git a/avmedia/source/xine/window.hxx b/avmedia/source/xine/window.hxx new file mode 100644 index 000000000000..014d349acfac --- /dev/null +++ b/avmedia/source/xine/window.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _WINDOW_HXX +#define _WINDOW_HXX + +#include "xinecommon.hxx" +#include <cppuhelper/interfacecontainer.h> + +#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_ +#include "com/sun/star/media/XPlayerWindow.hdl" +#endif + +namespace avmedia { namespace xine { + +// --------------- +// - Window - +// --------------- + +class Player; + +class Window : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow, + ::com::sun::star::lang::XServiceInfo > +{ +public: + + Window( Player& rPlayer ); + ~Window(); + + bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ); + + // 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); + +public: + + void fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); + void fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); + void fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt ); + void fireKeyPressedEvent( const ::com::sun::star::awt::KeyEvent& rEvt ); + void fireKeyReleasedEvent( const ::com::sun::star::awt::KeyEvent& rEvt ); + void fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt ); + +private: + + ::osl::Mutex maMutex; + Player& mrPlayer; + ::cppu::OMultiTypeInterfaceContainerHelper maListeners; + ::com::sun::star::media::ZoomLevel meZoomLevel; + sal_Int32 mnPointerType; + + void implLayoutVideoWindow(); +}; + +} // namespace xine +} // namespace avmedia + +#endif // _WINDOW_HXX diff --git a/avmedia/source/xine/xinecommon.hxx b/avmedia/source/xine/xinecommon.hxx new file mode 100644 index 000000000000..fe80a75370b6 --- /dev/null +++ b/avmedia/source/xine/xinecommon.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _XINECOMMON_HXX +#define _XINECOMMON_HXX + +#include <osl/mutex.hxx> +#ifndef __RTL_USTRING_ +#include <rtl/ustring.hxx> +#endif +#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_XINE_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_Xine" +#define AVMEDIA_XINE_MANAGER_SERVICENAME "com.sun.star.media.Manager_Xine" + +#define AVMEDIA_XINE_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_Xine" +#define AVMEDIA_XINE_PLAYER_SERVICENAME "com.sun.star.media.Player_Xine" + +#define AVMEDIA_XINE_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_Xine" +#define AVMEDIA_XINE_WINDOW_SERVICENAME "com.sun.star.media.Window_Xine" + +#endif // _XINECOMMOM_HXX diff --git a/avmedia/source/xine/xineuno.cxx b/avmedia/source/xine/xineuno.cxx new file mode 100644 index 000000000000..2efe57b2472c --- /dev/null +++ b/avmedia/source/xine/xineuno.cxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "xinecommon.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::xine::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_XINE_MANAGER_IMPLEMENTATIONNAME ) == 0 ) + { + const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_XINE_MANAGER_SERVICENAME ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + ::rtl::OUString::createFromAscii( AVMEDIA_XINE_MANAGER_IMPLEMENTATIONNAME ), + create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); + } + + if( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; +} |