From 4f48dc2f978d36ef9ba08bf828894fa578430fc7 Mon Sep 17 00:00:00 2001 From: Zolnai Tamás Date: Wed, 26 Mar 2014 18:46:52 +0100 Subject: Skeleton of OpenGL avmedia service for playing 3D models Change-Id: I3bf9e68e1a08ff3db065ec7f4e135119b7d1a4ef --- Repository.mk | 1 + avmedia/Library_avmediaogl.mk | 35 ++++++ avmedia/Module_avmedia.mk | 7 ++ avmedia/source/opengl/avmediaogl.component | 15 +++ avmedia/source/opengl/oglframegrabber.cxx | 60 ++++++++++ avmedia/source/opengl/oglframegrabber.hxx | 43 +++++++ avmedia/source/opengl/oglmanager.cxx | 60 ++++++++++ avmedia/source/opengl/oglmanager.hxx | 44 +++++++ avmedia/source/opengl/oglplayer.cxx | 159 +++++++++++++++++++++++++ avmedia/source/opengl/oglplayer.hxx | 62 ++++++++++ avmedia/source/opengl/ogluno.cxx | 47 ++++++++ avmedia/source/opengl/oglwindow.cxx | 179 +++++++++++++++++++++++++++++ avmedia/source/opengl/oglwindow.hxx | 70 +++++++++++ postprocess/Rdb_services.mk | 1 + 14 files changed, 783 insertions(+) create mode 100644 avmedia/Library_avmediaogl.mk create mode 100644 avmedia/source/opengl/avmediaogl.component create mode 100644 avmedia/source/opengl/oglframegrabber.cxx create mode 100644 avmedia/source/opengl/oglframegrabber.hxx create mode 100644 avmedia/source/opengl/oglmanager.cxx create mode 100644 avmedia/source/opengl/oglmanager.hxx create mode 100644 avmedia/source/opengl/oglplayer.cxx create mode 100644 avmedia/source/opengl/oglplayer.hxx create mode 100644 avmedia/source/opengl/ogluno.cxx create mode 100644 avmedia/source/opengl/oglwindow.cxx create mode 100644 avmedia/source/opengl/oglwindow.hxx diff --git a/Repository.mk b/Repository.mk index 9fd036e5a434..6c2bb6788594 100644 --- a/Repository.mk +++ b/Repository.mk @@ -498,6 +498,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \ $(if $(ENABLE_GSTREAMER),avmediagst) \ $(if $(ENABLE_GSTREAMER_0_10),avmediagst_0_10) \ $(if $(ENABLE_DIRECTX),avmediawin) \ + $(if $(ENABLE_OPENGL),avmediaogl) \ cached1 \ collator_data \ comphelper \ diff --git a/avmedia/Library_avmediaogl.mk b/avmedia/Library_avmediaogl.mk new file mode 100644 index 000000000000..78b4a8f9f2ae --- /dev/null +++ b/avmedia/Library_avmediaogl.mk @@ -0,0 +1,35 @@ +# -*- Mode: makefile; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,avmediaogl)) + +$(eval $(call gb_Library_set_componentfile,avmediaogl,avmedia/source/opengl/avmediaogl)) + +$(eval $(call gb_Library_use_sdk_api,avmediaogl)) + +$(eval $(call gb_Library_use_libraries,avmediaogl,\ + comphelper \ + cppu \ + cppuhelper \ + sal \ + salhelper \ + tl \ + vcl \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_Library_add_exception_objects,avmediaogl,\ + avmedia/source/opengl/oglframegrabber \ + avmedia/source/opengl/oglmanager \ + avmedia/source/opengl/oglplayer \ + avmedia/source/opengl/ogluno \ + avmedia/source/opengl/oglwindow \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/avmedia/Module_avmedia.mk b/avmedia/Module_avmedia.mk index 88ee2aadbf25..b1b6703c6c9f 100644 --- a/avmedia/Module_avmedia.mk +++ b/avmedia/Module_avmedia.mk @@ -51,4 +51,11 @@ $(eval $(call gb_Module_add_targets,avmedia,\ )) endif +ifeq ($(ENABLE_OPENGL),TRUE) +$(eval $(call gb_Module_add_targets,avmedia,\ + Library_avmediaogl \ +)) +endif + + # vim: set noet sw=4 ts=4: diff --git a/avmedia/source/opengl/avmediaogl.component b/avmedia/source/opengl/avmediaogl.component new file mode 100644 index 000000000000..f3cd138ea1d0 --- /dev/null +++ b/avmedia/source/opengl/avmediaogl.component @@ -0,0 +1,15 @@ + + + + + + + diff --git a/avmedia/source/opengl/oglframegrabber.cxx b/avmedia/source/opengl/oglframegrabber.cxx new file mode 100644 index 000000000000..2aeda9720b8e --- /dev/null +++ b/avmedia/source/opengl/oglframegrabber.cxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "oglframegrabber.hxx" + +#include +#include +#include + +using namespace com::sun::star; + +namespace avmedia { namespace ogl { + +OGLFrameGrabber::OGLFrameGrabber( const OUString& /*rUrl*/ ) + : FrameGrabber_BASE() +{ +} + +OGLFrameGrabber::~OGLFrameGrabber() +{ +} + +uno::Reference< css::graphic::XGraphic > SAL_CALL OGLFrameGrabber::grabFrame( double /*fMediaTime*/ ) + throw ( uno::RuntimeException, std::exception ) +{ + // TODO: Here we need a bitmap of the model at the point specified by fMediaTime + // See com::sun::star::media::XFrameGrabber + BitmapEx aBitmap; + return Graphic( aBitmap ).GetXGraphic(); +} + +OUString SAL_CALL OGLFrameGrabber::getImplementationName() throw ( uno::RuntimeException, std::exception ) +{ + return OUString("com.sun.star.comp.avmedia.FrameGrabber_OpenGL"); +} + +sal_Bool SAL_CALL OGLFrameGrabber::supportsService( const OUString& rServiceName ) + throw ( uno::RuntimeException, std::exception ) +{ + return cppu::supportsService(this, rServiceName); +} + +uno::Sequence< OUString > SAL_CALL OGLFrameGrabber::getSupportedServiceNames() + throw ( uno::RuntimeException, std::exception ) +{ + uno::Sequence< OUString > aRet(1); + aRet[0] = OUString("com.sun.star.media.FrameGrabber_OpenGL"); + return aRet; +} + +} // namespace ogl +} // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/opengl/oglframegrabber.hxx b/avmedia/source/opengl/oglframegrabber.hxx new file mode 100644 index 000000000000..fd3d9fb76b81 --- /dev/null +++ b/avmedia/source/opengl/oglframegrabber.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef OGL_FRAMEGRABBER_HXX +#define OGL_FRAMEGRABBER_HXX + +#include +#include +#include + +namespace avmedia { namespace ogl { + +typedef ::cppu::WeakImplHelper2< com::sun::star::media::XFrameGrabber, + com::sun::star::lang::XServiceInfo > FrameGrabber_BASE; + +class OGLFrameGrabber : public FrameGrabber_BASE +{ +public: + + OGLFrameGrabber( const OUString& rURL ); + virtual ~OGLFrameGrabber(); + + // XFrameGrabber + virtual com::sun::star::uno::Reference< com::sun::star::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; +}; + +} // namespace ogl +} // namespace avmedia + +#endif // OGL_FRAMEGRABBER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/opengl/oglmanager.cxx b/avmedia/source/opengl/oglmanager.cxx new file mode 100644 index 000000000000..d435e6033ad7 --- /dev/null +++ b/avmedia/source/opengl/oglmanager.cxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "oglmanager.hxx" +#include "oglframegrabber.hxx" +#include "oglplayer.hxx" + +#include + +using namespace com::sun::star; + +namespace avmedia { namespace ogl { + +OGLManager::OGLManager( const uno::Reference< lang::XMultiServiceFactory >& rMgr ) + : m_xMgr( rMgr ) +{ +} + +OGLManager::~OGLManager() +{ +} + +uno::Reference< media::XPlayer > SAL_CALL OGLManager::createPlayer( const OUString& rURL ) + throw (uno::RuntimeException, std::exception) +{ + // TODO: Here we need to construct our OpenGL player. + // See com::sun::star::media::XManager + OGLPlayer* pPlayer( new OGLPlayer( rURL ) ); + return uno::Reference< media::XPlayer >(pPlayer); +} + +OUString SAL_CALL OGLManager::getImplementationName() throw ( uno::RuntimeException, std::exception ) +{ + return OUString("com.sun.star.comp.avmedia.Manager_OpenGL"); +} + +sal_Bool SAL_CALL OGLManager::supportsService( const OUString& rServiceName ) + throw ( uno::RuntimeException, std::exception ) +{ + return cppu::supportsService(this, rServiceName); +} + +uno::Sequence< OUString > SAL_CALL OGLManager::getSupportedServiceNames() + throw ( uno::RuntimeException, std::exception ) +{ + ::uno::Sequence< OUString > aRet(1); + aRet[0] = OUString("com.sun.star.media.Manager_OpenGL"); + return aRet; +} + +} // namespace ogl +} // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/opengl/oglmanager.hxx b/avmedia/source/opengl/oglmanager.hxx new file mode 100644 index 000000000000..bbecfbcb0391 --- /dev/null +++ b/avmedia/source/opengl/oglmanager.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef OGL_MANAGER_HXX +#define OGL_MANAGER_HXX + +#include +#include +#include + +namespace avmedia { namespace ogl { + +class OGLManager : public ::cppu::WeakImplHelper2 < com::sun::star::media::XManager, + com::sun::star::lang::XServiceInfo > +{ +public: + + OGLManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rMgr ); + virtual ~OGLManager(); + + // XManager + virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > SAL_CALL createPlayer( const OUString& rURL ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; +private: + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xMgr; +}; + +} // namespace ogl +} // namespace avmedia + +#endif // OGL_MANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx new file mode 100644 index 000000000000..325579f3db81 --- /dev/null +++ b/avmedia/source/opengl/oglplayer.cxx @@ -0,0 +1,159 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "oglplayer.hxx" +#include "oglframegrabber.hxx" +#include "oglwindow.hxx" + +#include + +using namespace com::sun::star; + +namespace avmedia { namespace ogl { + +OGLPlayer::OGLPlayer( const OUString& rUrl) + : Player_BASE(m_aMutex) + , m_sUrl(rUrl) +{ +} + +OGLPlayer::~OGLPlayer() +{ +} + +void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Start playing of gltf model (see com::sun::star::media::XPlayer) +} + +void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Stop playing of gltf model (see com::sun::star::media::XPlayer) +} + +sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Check whether gltf model is played by now (see com::sun::star::media::XPlayer) + return false; +} + +double SAL_CALL OGLPlayer::getDuration() throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Get gltf's duration (see com::sun::star::media::XPlayer) + return 0.0; +} + +void SAL_CALL OGLPlayer::setMediaTime( double /*fTime*/ ) throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Set player to the specified point (see com::sun::star::media::XPlayer) +} + +double SAL_CALL OGLPlayer::getMediaTime() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Get player current time position (see com::sun::star::media::XPlayer) + return 0.0; +} + +double SAL_CALL OGLPlayer::getRate() throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Get the speed of stream reading (see com::sun::star::media::XPlayer) + return 1.0; +} + +void SAL_CALL OGLPlayer::setPlaybackLoop( sal_Bool /*bSet*/ ) throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Set the playes replay itself when it ends (see com::sun::star::media::XPlayer) +} + +sal_Bool SAL_CALL OGLPlayer::isPlaybackLoop() throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Check whether playing will restart after it ends (see com::sun::star::media::XPlayer) + return false; +} + +void SAL_CALL OGLPlayer::setVolumeDB( sal_Int16 /*nVolumDB*/ ) throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Set audio volume (see com::sun::star::media::XPlayer) +} + +sal_Int16 SAL_CALL OGLPlayer::getVolumeDB() throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Get audio volume (see com::sun::star::media::XPlayer) + return 0; +} + +void SAL_CALL OGLPlayer::setMute( sal_Bool /*bSet*/ ) throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Set volume to 0 (see com::sun::star::media::XPlayer) +} + +sal_Bool SAL_CALL OGLPlayer::isMute() throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + // TODO: Get whether volume is set to 0 by setMute (see com::sun::star::media::XPlayer) + return false; +} + +awt::Size SAL_CALL OGLPlayer::getPreferredPlayerWindowSize() throw ( uno::RuntimeException, std::exception ) +{ + return awt::Size( 480, 360 ); // TODO: It will be good for OpenGL too? +} + +uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& /*aArguments*/ ) + throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard( m_aMutex ); + OGLWindow* pWindow = new OGLWindow(*this); + return uno::Reference< media::XPlayerWindow >( pWindow ); +} + +uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber() + throw ( uno::RuntimeException, std::exception ) +{ + osl::MutexGuard aGuard(m_aMutex); + OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( m_sUrl ); + return uno::Reference< media::XFrameGrabber >( pFrameGrabber );; +} + +OUString SAL_CALL OGLPlayer::getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException, std::exception ) +{ + return OUString("com.sun.star.comp.avmedia.Player_OpenGL"); +} + +sal_Bool SAL_CALL OGLPlayer::supportsService( const OUString& rServiceName ) + throw ( ::com::sun::star::uno::RuntimeException, std::exception ) +{ + return cppu::supportsService(this, rServiceName); +} + +uno::Sequence< OUString > SAL_CALL OGLPlayer::getSupportedServiceNames() + throw ( com::sun::star::uno::RuntimeException, std::exception ) +{ + uno::Sequence< OUString > aRet(1); + aRet[0] = OUString("com.sun.star.media.Player_OpenGL"); + return aRet; +} + +} // namespace ogl +} // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/opengl/oglplayer.hxx b/avmedia/source/opengl/oglplayer.hxx new file mode 100644 index 000000000000..69101a6cc1d6 --- /dev/null +++ b/avmedia/source/opengl/oglplayer.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef OGL_PLAYER_HXX +#define OGL_PLAYER_HXX + +#include +#include +#include +#include + +namespace avmedia { namespace ogl { + +typedef ::cppu::WeakComponentImplHelper2< com::sun::star::media::XPlayer, + com::sun::star::lang::XServiceInfo > Player_BASE; + +class OGLPlayer : public cppu::BaseMutex, + public Player_BASE +{ +public: + + OGLPlayer( const OUString& rURL ); + virtual ~OGLPlayer(); + + // XPlayer + virtual void SAL_CALL start() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL stop() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL isPlaying() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual double SAL_CALL getDuration() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setMediaTime( double fTime ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual double SAL_CALL getMediaTime() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual double SAL_CALL getRate() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL isPlaybackLoop() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Int16 SAL_CALL getVolumeDB() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setMute( sal_Bool bSet ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL isMute() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual com::sun::star::awt::Size SAL_CALL getPreferredPlayerWindowSize() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + 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, std::exception) SAL_OVERRIDE; + virtual com::sun::star::uno::Reference< com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + OUString m_sUrl; +}; + +} // namespace ogl +} // namespace avmedia + +#endif // OGL_PLAYER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/opengl/ogluno.cxx b/avmedia/source/opengl/ogluno.cxx new file mode 100644 index 000000000000..f4ce756fb5f5 --- /dev/null +++ b/avmedia/source/opengl/ogluno.cxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "oglmanager.hxx" + +#include +#include +#include + +using namespace ::com::sun::star; + +static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact ) +{ + return uno::Reference< uno::XInterface >( *new ::avmedia::ogl::OGLManager( rxFact ) ); +} + +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmediaogl_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* ) +{ + uno::Reference< lang::XSingleServiceFactory > xFactory; + void* pRet = 0; + + if( rtl_str_compare( pImplName, "com.sun.star.comp.avmedia.Manager_OpenGL" ) == 0 ) + { + const OUString aServiceName( "com.sun.star.media.Manager_OpenGL" ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + OUString("com.sun.star.comp.avmedia.Manager_OpenGL" ), + create_MediaPlayer, uno::Sequence< OUString >( &aServiceName, 1 ) ) ); + } + + if( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx new file mode 100644 index 000000000000..ab524e4a3263 --- /dev/null +++ b/avmedia/source/opengl/oglwindow.cxx @@ -0,0 +1,179 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "oglwindow.hxx" +#include + +using namespace com::sun::star; + +namespace avmedia { namespace ogl { + +OGLWindow::OGLWindow( OGLPlayer& rPlayer ) + : m_rPlayer( rPlayer ) + , meZoomLevel( media::ZoomLevel_ORIGINAL ) +{ +} + +OGLWindow::~OGLWindow() +{ +} + +void SAL_CALL OGLWindow::update() throw (css::uno::RuntimeException, std::exception) +{ +} + +sal_Bool SAL_CALL OGLWindow::setZoomLevel( css::media::ZoomLevel eZoomLevel ) throw (css::uno::RuntimeException, std::exception) +{ + sal_Bool bRet = false; + + if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel && + media::ZoomLevel_NOT_AVAILABLE != eZoomLevel ) + { + if( eZoomLevel != meZoomLevel ) + { + meZoomLevel = eZoomLevel; + } + bRet = true; + } + // TODO: set zoom level, not just store this value + return bRet; +} + +css::media::ZoomLevel SAL_CALL OGLWindow::getZoomLevel() throw (css::uno::RuntimeException, std::exception) +{ + return meZoomLevel; +} + +void SAL_CALL OGLWindow::setPointerType( sal_Int32 ) throw (css::uno::RuntimeException, std::exception) +{ +} + +OUString SAL_CALL OGLWindow::getImplementationName() throw (css::uno::RuntimeException, std::exception) +{ + return OUString("com.sun.star.comp.avmedia.Window_OpenGL"); +} + +sal_Bool SAL_CALL OGLWindow::supportsService( const OUString& rServiceName ) throw (css::uno::RuntimeException, std::exception) +{ + return cppu::supportsService(this, rServiceName); +} + +uno::Sequence< OUString > SAL_CALL OGLWindow::getSupportedServiceNames() throw (css::uno::RuntimeException, std::exception) +{ + uno::Sequence< OUString > aRet(1); + aRet[0] = OUString("com.sun.star.media.Window_OpenGL"); + return aRet; +} + +void SAL_CALL OGLWindow::dispose() throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::addEventListener( const uno::Reference< lang::XEventListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::removeEventListener( const uno::Reference< lang::XEventListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::setPosSize( sal_Int32 /*X*/, sal_Int32 /*Y*/, sal_Int32 /*Width*/, sal_Int32 /*Height*/, sal_Int16 /* Flags */ ) + throw (uno::RuntimeException, std::exception) +{ + // TODO: store size +} + +awt::Rectangle SAL_CALL OGLWindow::getPosSize() + throw (uno::RuntimeException, std::exception) +{ + // TODO: get size + return awt::Rectangle(); +} + +void SAL_CALL OGLWindow::setVisible( sal_Bool ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::setEnable( sal_Bool ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::setFocus() + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::addWindowListener( const uno::Reference< awt::XWindowListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::removeWindowListener( const uno::Reference< awt::XWindowListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::addFocusListener( const uno::Reference< awt::XFocusListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::removeFocusListener( const uno::Reference< awt::XFocusListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::addKeyListener( const uno::Reference< awt::XKeyListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::removeKeyListener( const uno::Reference< awt::XKeyListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::addMouseListener( const uno::Reference< awt::XMouseListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::removeMouseListener( const uno::Reference< awt::XMouseListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::addPaintListener( const uno::Reference< awt::XPaintListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +void SAL_CALL OGLWindow::removePaintListener( const uno::Reference< awt::XPaintListener >& ) + throw (uno::RuntimeException, std::exception) +{ +} + +} // namespace ogl +} // namespace avmedia + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/opengl/oglwindow.hxx b/avmedia/source/opengl/oglwindow.hxx new file mode 100644 index 000000000000..d373dd1c8e5a --- /dev/null +++ b/avmedia/source/opengl/oglwindow.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef OGL_WINDOW_HXX +#define OGL_WINDOW_HXX + +#include "oglplayer.hxx" + +#include +#include +#include +#include + +namespace avmedia { namespace ogl { + +class OGLWindow : public ::cppu::WeakImplHelper2 < com::sun::star::media::XPlayerWindow, + com::sun::star::lang::XServiceInfo > +{ +public: + OGLWindow( OGLPlayer& rPlayer ); + virtual ~OGLWindow(); + + virtual void SAL_CALL update() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL setZoomLevel( com::sun::star::media::ZoomLevel ZoomLevel ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setPointerType( sal_Int32 SystemPointerType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL dispose() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + 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, std::exception) SAL_OVERRIDE; + virtual com::sun::star::awt::Rectangle SAL_CALL getPosSize() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setVisible( sal_Bool Visible ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setEnable( sal_Bool Enable ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setFocus() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addWindowListener( const com::sun::star::uno::Reference< com::sun::star::awt::XWindowListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeWindowListener( const com::sun::star::uno::Reference< com::sun::star::awt::XWindowListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addFocusListener( const com::sun::star::uno::Reference< com::sun::star::awt::XFocusListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeFocusListener( const com::sun::star::uno::Reference< com::sun::star::awt::XFocusListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addKeyListener( const com::sun::star::uno::Reference< com::sun::star::awt::XKeyListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeKeyListener( const com::sun::star::uno::Reference< com::sun::star::awt::XKeyListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addMouseListener( const com::sun::star::uno::Reference< com::sun::star::awt::XMouseListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeMouseListener( const com::sun::star::uno::Reference< com::sun::star::awt::XMouseListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addMouseMotionListener( const com::sun::star::uno::Reference< com::sun::star::awt::XMouseMotionListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeMouseMotionListener( const com::sun::star::uno::Reference< com::sun::star::awt::XMouseMotionListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addPaintListener( const com::sun::star::uno::Reference< com::sun::star::awt::XPaintListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removePaintListener( const com::sun::star::uno::Reference< com::sun::star::awt::XPaintListener >& xListener ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + OGLPlayer& m_rPlayer; + com::sun::star::media::ZoomLevel meZoomLevel; +}; + +} // namespace ogl +} // namespace avmedia + +#endif // OGL_WINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/postprocess/Rdb_services.mk b/postprocess/Rdb_services.mk index e6cd8b55b1c8..a7920aafb80a 100755 --- a/postprocess/Rdb_services.mk +++ b/postprocess/Rdb_services.mk @@ -215,6 +215,7 @@ $(eval $(call gb_Rdb_add_components,services,\ ) \ $(if $(ENABLE_OPENGL), \ slideshow/source/engine/OGLTrans/ogltrans \ + avmedia/source/opengl/avmediaogl \ ) \ $(if $(ENABLE_TDE), \ shell/source/backends/kdebe/tdebe1 \ -- cgit