avmedia/source/framework/modeltools.cxx | 6 +++ avmedia/source/opengl/oglplayer.cxx | 11 +++++- avmedia/source/opengl/oglplayer.hxx | 1 avmedia/source/opengl/oglwindow.cxx | 16 +++++---- avmedia/source/viewer/mediawindow_impl.cxx | 9 +++-- include/avmedia/modeltools.hxx | 2 + include/vcl/opengl/OpenGLContext.hxx | 1 slideshow/Library_slideshow.mk | 9 ++++- slideshow/source/engine/shapes/viewmediashape.cxx | 37 ++++++++++++++-------- slideshow/source/engine/shapes/viewmediashape.hxx | 5 +- vcl/source/opengl/OpenGLContext.cxx | 31 ++++++++++++++++++ 11 files changed, 102 insertions(+), 26 deletions(-)
New commits: commit 1736e5d91c76a824ffcb052c5e769444d3a0ed5e Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Mon Apr 28 16:32:33 2014 +0200 Slideshow: display OpenGL window also during slideshow Use vcl based player window initialization. Change-Id: If5c2198fa891e1d3ad218c8b7e1495161c0d6c25 diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx index 506a36c..c625fba 100644 --- a/avmedia/source/framework/modeltools.cxx +++ b/avmedia/source/framework/modeltools.cxx @@ -9,6 +9,7 @@ #include <avmedia/modeltools.hxx> #include <avmedia/mediaitem.hxx> +#include "mediamisc.hxx" #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> @@ -193,6 +194,11 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel, return false; } +bool IsModel(const OUString& rMimeType) +{ + return rMimeType == AVMEDIA_MIMETYPE_JSON; +} + } // namespace avemdia /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx index a0a27b0..5c8bbea 100644 --- a/avmedia/source/opengl/oglplayer.cxx +++ b/avmedia/source/opengl/oglplayer.cxx @@ -192,6 +192,12 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c rArguments[ 2 ] >>= pIntPtr; SystemChildWindow *pChildWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr ); m_aContext.init(pChildWindow); + Size aSize = pChildWindow->GetSizePixel(); + m_aContext.setWinSize(aSize); + m_pHandle->viewport.x = 0; + m_pHandle->viewport.y = 0; + m_pHandle->viewport.width = aSize.Width(); + m_pHandle->viewport.height = aSize.Height(); } OGLWindow* pWindow = new OGLWindow(m_pHandle, &m_aContext); return uno::Reference< media::XPlayerWindow >( pWindow ); diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx index b674562..a1b4a40 100644 --- a/avmedia/source/opengl/oglwindow.cxx +++ b/avmedia/source/opengl/oglwindow.cxx @@ -119,6 +119,8 @@ awt::Rectangle SAL_CALL OGLWindow::getPosSize() void SAL_CALL OGLWindow::setVisible( sal_Bool bSet ) throw (uno::RuntimeException, std::exception) { + if( bSet && !m_bVisible ) + update(); m_bVisible = bSet; } diff --git a/include/avmedia/modeltools.hxx b/include/avmedia/modeltools.hxx index db9fc13..3de866d 100644 --- a/include/avmedia/modeltools.hxx +++ b/include/avmedia/modeltools.hxx @@ -17,6 +17,8 @@ bool AVMEDIA_DLLPUBLIC Embed3DModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& xModel, const OUString& rSourceURL, OUString& o_rEmbeddedURL); +bool AVMEDIA_DLLPUBLIC IsModel(const OUString& rMimeType); + } // namespace avemdia /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk index ccd3e99..d5af9a1 100644 --- a/slideshow/Library_slideshow.mk +++ b/slideshow/Library_slideshow.mk @@ -27,7 +27,11 @@ endif $(eval $(call gb_Library_set_precompiled_header,slideshow,$(SRCDIR)/slideshow/inc/pch/precompiled_slideshow)) -$(eval $(call gb_Library_use_external,slideshow,boost_headers)) +$(eval $(call gb_Library_use_externals,slideshow,\ + boost_headers \ + glew \ + mesa_headers \ +)) $(eval $(call gb_Library_use_sdk_api,slideshow)) @@ -44,7 +48,8 @@ $(eval $(call gb_Library_use_libraries,slideshow,\ tl \ utl \ vcl \ - $(gb_UWINAPI) \ + vclopengl \ + $(gb_UWINAPI) \ )) $(eval $(call gb_Library_set_componentfile,slideshow,slideshow/util/slideshow)) diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index 22fa24e..bbf1703 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -30,6 +30,7 @@ #include <vcl/canvastools.hxx> #include <vcl/syschild.hxx> +#include <vcl/sysdata.hxx> #include <vcl/window.hxx> #include <vcl/graph.hxx> @@ -45,6 +46,9 @@ #include <cppcanvas/vclfactory.hxx> #include <cppcanvas/basegfxfactory.hxx> #include <avmedia/mediawindow.hxx> +#include <avmedia/modeltools.hxx> + +#include <vcl/opengl/OpenGLContext.hxx> #include <com/sun/star/media/XManager.hpp> #include <com/sun/star/media/XPlayer.hpp> @@ -302,25 +306,26 @@ namespace slideshow if( xCanvas.is() ) { uno::Reference< beans::XPropertySet > xPropSet; - OUString aURL; - try { xPropSet.set( mxShape, uno::UNO_QUERY ); + OUString sMimeType; // create Player if (xPropSet.is()) { + OUString aURL; + xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType; if ((xPropSet->getPropertyValue( OUString( "PrivateTempFileURL")) >>= aURL) && !aURL.isEmpty()) { - implInitializeMediaPlayer( aURL ); + implInitializeMediaPlayer( aURL, sMimeType ); } else if (xPropSet->getPropertyValue( OUString( "MediaURL")) >>= aURL) { - implInitializeMediaPlayer( aURL ); + implInitializeMediaPlayer( aURL, sMimeType ); } } @@ -334,9 +339,10 @@ namespace slideshow aDeviceParams[ 0 ] >>= aImplName; if( aImplName.endsWithIgnoreAsciiCase( "VCL" ) || - aImplName.endsWithIgnoreAsciiCase( "Cairo" ) ) + aImplName.endsWithIgnoreAsciiCase( "Cairo" ) || + avmedia::IsModel(sMimeType)) { - implInitializeVCLBasedPlayerWindow( rBounds, aDeviceParams ); + implInitializeVCLBasedPlayerWindow( rBounds, aDeviceParams, sMimeType ); } else if( aImplName.endsWithIgnoreAsciiCase("DX") || aImplName.endsWithIgnoreAsciiCase("DX9") ) @@ -406,7 +412,7 @@ namespace slideshow - void ViewMediaShape::implInitializeMediaPlayer( const OUString& rMediaURL ) + void ViewMediaShape::implInitializeMediaPlayer( const OUString& rMediaURL, const OUString& rMimeType ) { #if !HAVE_FEATURE_AVMEDIA (void) rMediaURL; @@ -417,7 +423,7 @@ namespace slideshow { if( !rMediaURL.isEmpty() ) { - mxPlayer.set( avmedia::MediaWindow::createPlayer( rMediaURL, ""/*TODO!*/ ), + mxPlayer.set( avmedia::MediaWindow::createPlayer( rMediaURL, ""/*TODO!*/, &rMimeType ), uno::UNO_QUERY ); } } @@ -438,7 +444,8 @@ namespace slideshow bool ViewMediaShape::implInitializeVCLBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds, - const uno::Sequence< uno::Any >& rVCLDeviceParams) + const uno::Sequence< uno::Any >& rVCLDeviceParams, + const OUString& rMimeType ) { OSL_TRACE( "ViewMediaShape::implInitializeVCLBasedPlayerWindow" ); if( !mpMediaWindow.get() && !rBounds.isEmpty() ) @@ -467,9 +474,15 @@ namespace slideshow rRangePix.getMinY(), rRangePix.getMaxX() - rRangePix.getMinX(), rRangePix.getMaxY() - rRangePix.getMinY() ); - - mpMediaWindow.reset( new - SystemChildWindow( pWindow, WB_CLIPCHILDREN ) ); + if( avmedia::IsModel(rMimeType) ) + { + SystemWindowData aWinData = OpenGLContext::generateWinData(pWindow); + mpMediaWindow.reset(new SystemChildWindow(pWindow, 0, &aWinData)); + } + else + { + mpMediaWindow.reset( new SystemChildWindow( pWindow, WB_CLIPCHILDREN ) ); + } mpMediaWindow->SetBackground( Color( COL_BLACK ) ); mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ), Size( aAWTRect.Width, aAWTRect.Height ) ); diff --git a/slideshow/source/engine/shapes/viewmediashape.hxx b/slideshow/source/engine/shapes/viewmediashape.hxx index d149ec1..4a37344 100644 --- a/slideshow/source/engine/shapes/viewmediashape.hxx +++ b/slideshow/source/engine/shapes/viewmediashape.hxx @@ -140,9 +140,10 @@ namespace slideshow bool implInitialize( const ::basegfx::B2DRectangle& rBounds ); void implSetMediaProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxProps ); - void implInitializeMediaPlayer( const OUString& rMediaURL ); + void implInitializeMediaPlayer( const OUString& rMediaURL, const OUString& rMimeType ); bool implInitializeVCLBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds, - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams ); + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams, + const OUString& rMimeType ); bool implInitializeDXBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rDXDeviceParams ); commit 0a1746e942224851b584f5902d7b1e0ca496fdab Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Mon Apr 28 15:42:32 2014 +0200 avmedia: make OpenGL window render model when play button is pushed. Redraw player window (call update) when Paint() is called on its parent. Use a temp variable to save playing state. Change-Id: I3d9b716c7f77587d98e4c06dca6d43a7dc8e32dd diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx index 3200f16..a0a27b0 100644 --- a/avmedia/source/opengl/oglplayer.cxx +++ b/avmedia/source/opengl/oglplayer.cxx @@ -24,6 +24,7 @@ namespace avmedia { namespace ogl { OGLPlayer::OGLPlayer() : Player_BASE(m_aMutex) + , m_bIsPlayingTmp(false) { } @@ -100,18 +101,20 @@ void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); gltf_animation_start(m_pHandle); + m_bIsPlayingTmp = true; } void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); gltf_animation_stop(m_pHandle); + m_bIsPlayingTmp = false; } sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception ) { osl::MutexGuard aGuard(m_aMutex); - return (sal_Bool)gltf_animation_is_playing(m_pHandle); + return m_bIsPlayingTmp; //(sal_Bool)gltf_animation_is_playing(m_pHandle) } double SAL_CALL OGLPlayer::getDuration() throw ( uno::RuntimeException, std::exception ) diff --git a/avmedia/source/opengl/oglplayer.hxx b/avmedia/source/opengl/oglplayer.hxx index 1f1efce..6d7077a 100644 --- a/avmedia/source/opengl/oglplayer.hxx +++ b/avmedia/source/opengl/oglplayer.hxx @@ -58,6 +58,7 @@ private: OUString m_sURL; glTFHandle* m_pHandle; OpenGLContext m_aContext; + bool m_bIsPlayingTmp; // Temporarly while libgltf does not implement the corresponding methods }; } // namespace ogl diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx index 04c00e0..b674562 100644 --- a/avmedia/source/opengl/oglwindow.cxx +++ b/avmedia/source/opengl/oglwindow.cxx @@ -28,6 +28,10 @@ OGLWindow::~OGLWindow() void SAL_CALL OGLWindow::update() throw (css::uno::RuntimeException, std::exception) { + m_pContext->makeCurrent(); + gltf_renderer_set_content(m_pHandle); + gltf_renderer(m_pHandle); + m_pContext->swapBuffers(); } sal_Bool SAL_CALL OGLWindow::setZoomLevel( css::media::ZoomLevel eZoomLevel ) throw (css::uno::RuntimeException, std::exception) @@ -100,10 +104,7 @@ void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidt m_pHandle->viewport.height = nHeight; if( m_bVisible ) { - m_pContext->makeCurrent(); - gltf_renderer_set_content(m_pHandle); - gltf_renderer(m_pHandle); - m_pContext->swapBuffers(); + update(); } } } diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 87d61cb..46900ed 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -563,8 +563,6 @@ void MediaWindowImpl::onURLChanged() void MediaWindowImpl::setPosSize( const Rectangle& rRect ) { SetPosSizePixel( rRect.TopLeft(), rRect.GetSize() ); - if( mxPlayerWindow.is() ) - mxPlayerWindow->setPosSize( 0, 0, rRect.GetSize().Width(), rRect.GetSize().Height(), 0 ); } @@ -610,9 +608,11 @@ void MediaWindowImpl::Resize() aPlayerWindowSize.Height() = ( nControlY - ( nOffset << 1 ) ); mpMediaWindowControl->SetPosSizePixel( Point( nOffset, nControlY ), Size( aCurSize.Width() - ( nOffset << 1 ), nControlHeight ) ); } - if( mpChildWindow ) mpChildWindow->SetPosSizePixel( Point( 0, 0 ), aPlayerWindowSize ); + + if( mxPlayerWindow.is() ) + mxPlayerWindow->setPosSize( 0, 0, aPlayerWindowSize.Width(), aPlayerWindowSize.Height(), 0 ); } @@ -648,6 +648,9 @@ void MediaWindowImpl::StateChanged( StateChangedType eType ) void MediaWindowImpl::Paint( const Rectangle& ) { + if( mxPlayerWindow.is() ) + mxPlayerWindow->update(); + BitmapEx* pLogo = NULL; if( !mxPlayer.is() ) commit 4ee7708bc261d49f4a08d617fedf337f86de1000 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Mon Apr 28 12:01:37 2014 +0200 OpenGLContext: destroy context Change-Id: Ia779045d93361a4ca4bfe5027958a04fdebd2ca1 diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 5d1d4a0..477fd62 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -27,6 +27,26 @@ OpenGLContext::OpenGLContext(): OpenGLContext::~OpenGLContext() { +#if defined( WNT ) + if (m_aGLWin.hRC) + { + wglMakeCurrent( m_aGLWin.hDC, 0 ); + wglDeleteContext( m_aGLWin.hRC ); + ReleaseDC( m_aGLWin.hWnd, m_aGLWin.hDC ); + } +#elif defined( MACOSX ) || defined( IOS ) || defined( ANDROID ) + // nothing +#elif defined( UNX ) + if(m_aGLWin.ctx) + { + glXMakeCurrent(m_aGLWin.dpy, None, NULL); + if( glGetError() != GL_NO_ERROR ) + { + SAL_WARN("vcl.opengl", "glError: " << (char *)gluErrorString(glGetError())); + } + glXDestroyContext(m_aGLWin.dpy, m_aGLWin.ctx); + } +#endif } #if defined( _WIN32 ) commit 9996785392b777fc029dbc19bbd0af51d8906b88 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Mon Apr 28 10:24:40 2014 +0200 OGLWindow: set pos and size values even it is invisible Change-Id: I10392d744bbfe3c4d3f44ff9ca53ff12a2c41c45 diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx index 4eaf8ee..04c00e0 100644 --- a/avmedia/source/opengl/oglwindow.cxx +++ b/avmedia/source/opengl/oglwindow.cxx @@ -90,9 +90,6 @@ void SAL_CALL OGLWindow::removeEventListener( const uno::Reference< lang::XEvent void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 /*nFlags*/ ) throw (uno::RuntimeException, std::exception) { - if( !m_bVisible ) - return; - if( m_pHandle->viewport.x != nX || m_pHandle->viewport.x != nY || m_pHandle->viewport.width != nWidth || m_pHandle->viewport.height != nHeight ) { @@ -101,10 +98,13 @@ void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidt m_pHandle->viewport.y = nY; m_pHandle->viewport.width = nWidth; m_pHandle->viewport.height = nHeight; - m_pContext->makeCurrent(); - gltf_renderer_set_content(m_pHandle); - gltf_renderer(m_pHandle); - m_pContext->swapBuffers(); + if( m_bVisible ) + { + m_pContext->makeCurrent(); + gltf_renderer_set_content(m_pHandle); + gltf_renderer(m_pHandle); + m_pContext->swapBuffers(); + } } } commit 039c9efa6d007f5512895c0be742e7926c4ac7b2 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Mon Apr 28 09:57:29 2014 +0200 Introduce OpenGLContext::MakeCurrent for switching between contexts Change-Id: I00b06d1330241c4df3b07dc6e0019c49fd7aa521 diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx index 6d4788a..4eaf8ee 100644 --- a/avmedia/source/opengl/oglwindow.cxx +++ b/avmedia/source/opengl/oglwindow.cxx @@ -101,6 +101,7 @@ void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidt m_pHandle->viewport.y = nY; m_pHandle->viewport.width = nWidth; m_pHandle->viewport.height = nHeight; + m_pContext->makeCurrent(); gltf_renderer_set_content(m_pHandle); gltf_renderer(m_pHandle); m_pContext->swapBuffers(); diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 9d22ae6..9efe3d8 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -149,6 +149,7 @@ public: bool init(Window* pParent = 0); bool init(SystemChildWindow* pChildWindow); + void makeCurrent(); void swapBuffers(); void setWinSize(const Size& rSize); diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 07b38d2..5d1d4a0 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -726,6 +726,17 @@ SystemWindowData OpenGLContext::generateWinData(Window* pParent) #endif +void OpenGLContext::makeCurrent() +{ +#if defined( WNT ) + wglMakeCurrent(m_aGLWin.hDC,m_aGLWin.hRC); +#elif defined( MACOSX ) || defined( IOS ) || defined( ANDROID ) + // nothing +#elif defined( UNX ) + glXMakeCurrent( m_aGLWin.dpy, m_aGLWin.win, m_aGLWin.ctx ); +#endif +} + void OpenGLContext::swapBuffers() { #if defined( WNT )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits