summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-04-28 16:32:33 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-04-28 17:26:35 +0200
commit1736e5d91c76a824ffcb052c5e769444d3a0ed5e (patch)
treee7e89f3e6bc816bfe3e150e2e4d367ebb033fbfd
parent0a1746e942224851b584f5902d7b1e0ca496fdab (diff)
Slideshow: display OpenGL window also during slideshow
Use vcl based player window initialization. Change-Id: If5c2198fa891e1d3ad218c8b7e1495161c0d6c25
-rw-r--r--avmedia/source/framework/modeltools.cxx6
-rw-r--r--avmedia/source/opengl/oglplayer.cxx6
-rw-r--r--avmedia/source/opengl/oglwindow.cxx2
-rw-r--r--include/avmedia/modeltools.hxx2
-rw-r--r--slideshow/Library_slideshow.mk9
-rw-r--r--slideshow/source/engine/shapes/viewmediashape.cxx37
-rw-r--r--slideshow/source/engine/shapes/viewmediashape.hxx5
7 files changed, 51 insertions, 16 deletions
diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index 506a36c1d443..c625fbae88be 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 a0a27b01328e..5c8bbeae9b59 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 b67456250e46..a1b4a409cf87 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 db9fc139f3f5..3de866dd7f52 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 ccd3e9964a9d..d5af9a160c2a 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 22fa24e4523b..bbf1703de43a 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 d149ec17aba3..4a373445aac9 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 );