Kaydet (Commit) 1736e5d9 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

Slideshow: display OpenGL window also during slideshow

Use vcl based player window initialization.

Change-Id: If5c2198fa891e1d3ad218c8b7e1495161c0d6c25
üst 0a1746e9
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <avmedia/modeltools.hxx> #include <avmedia/modeltools.hxx>
#include <avmedia/mediaitem.hxx> #include <avmedia/mediaitem.hxx>
#include "mediamisc.hxx"
#include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/XTransactedObject.hpp>
...@@ -193,6 +194,11 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel, ...@@ -193,6 +194,11 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
return false; return false;
} }
bool IsModel(const OUString& rMimeType)
{
return rMimeType == AVMEDIA_MIMETYPE_JSON;
}
} // namespace avemdia } // namespace avemdia
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -192,6 +192,12 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c ...@@ -192,6 +192,12 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c
rArguments[ 2 ] >>= pIntPtr; rArguments[ 2 ] >>= pIntPtr;
SystemChildWindow *pChildWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr ); SystemChildWindow *pChildWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr );
m_aContext.init(pChildWindow); 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); OGLWindow* pWindow = new OGLWindow(m_pHandle, &m_aContext);
return uno::Reference< media::XPlayerWindow >( pWindow ); return uno::Reference< media::XPlayerWindow >( pWindow );
......
...@@ -119,6 +119,8 @@ awt::Rectangle SAL_CALL OGLWindow::getPosSize() ...@@ -119,6 +119,8 @@ awt::Rectangle SAL_CALL OGLWindow::getPosSize()
void SAL_CALL OGLWindow::setVisible( sal_Bool bSet ) void SAL_CALL OGLWindow::setVisible( sal_Bool bSet )
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
if( bSet && !m_bVisible )
update();
m_bVisible = bSet; m_bVisible = bSet;
} }
......
...@@ -17,6 +17,8 @@ bool AVMEDIA_DLLPUBLIC Embed3DModel( ...@@ -17,6 +17,8 @@ bool AVMEDIA_DLLPUBLIC Embed3DModel(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& xModel, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& xModel,
const OUString& rSourceURL, OUString& o_rEmbeddedURL); const OUString& rSourceURL, OUString& o_rEmbeddedURL);
bool AVMEDIA_DLLPUBLIC IsModel(const OUString& rMimeType);
} // namespace avemdia } // namespace avemdia
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -27,7 +27,11 @@ endif ...@@ -27,7 +27,11 @@ endif
$(eval $(call gb_Library_set_precompiled_header,slideshow,$(SRCDIR)/slideshow/inc/pch/precompiled_slideshow)) $(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)) $(eval $(call gb_Library_use_sdk_api,slideshow))
...@@ -44,7 +48,8 @@ $(eval $(call gb_Library_use_libraries,slideshow,\ ...@@ -44,7 +48,8 @@ $(eval $(call gb_Library_use_libraries,slideshow,\
tl \ tl \
utl \ utl \
vcl \ vcl \
$(gb_UWINAPI) \ vclopengl \
$(gb_UWINAPI) \
)) ))
$(eval $(call gb_Library_set_componentfile,slideshow,slideshow/util/slideshow)) $(eval $(call gb_Library_set_componentfile,slideshow,slideshow/util/slideshow))
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <vcl/canvastools.hxx> #include <vcl/canvastools.hxx>
#include <vcl/syschild.hxx> #include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <vcl/graph.hxx> #include <vcl/graph.hxx>
...@@ -45,6 +46,9 @@ ...@@ -45,6 +46,9 @@
#include <cppcanvas/vclfactory.hxx> #include <cppcanvas/vclfactory.hxx>
#include <cppcanvas/basegfxfactory.hxx> #include <cppcanvas/basegfxfactory.hxx>
#include <avmedia/mediawindow.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/XManager.hpp>
#include <com/sun/star/media/XPlayer.hpp> #include <com/sun/star/media/XPlayer.hpp>
...@@ -302,25 +306,26 @@ namespace slideshow ...@@ -302,25 +306,26 @@ namespace slideshow
if( xCanvas.is() ) if( xCanvas.is() )
{ {
uno::Reference< beans::XPropertySet > xPropSet; uno::Reference< beans::XPropertySet > xPropSet;
OUString aURL;
try try
{ {
xPropSet.set( mxShape, uno::UNO_QUERY ); xPropSet.set( mxShape, uno::UNO_QUERY );
OUString sMimeType;
// create Player // create Player
if (xPropSet.is()) if (xPropSet.is())
{ {
OUString aURL;
xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType;
if ((xPropSet->getPropertyValue( if ((xPropSet->getPropertyValue(
OUString( "PrivateTempFileURL")) >>= aURL) OUString( "PrivateTempFileURL")) >>= aURL)
&& !aURL.isEmpty()) && !aURL.isEmpty())
{ {
implInitializeMediaPlayer( aURL ); implInitializeMediaPlayer( aURL, sMimeType );
} }
else if (xPropSet->getPropertyValue( else if (xPropSet->getPropertyValue(
OUString( "MediaURL")) >>= aURL) OUString( "MediaURL")) >>= aURL)
{ {
implInitializeMediaPlayer( aURL ); implInitializeMediaPlayer( aURL, sMimeType );
} }
} }
...@@ -334,9 +339,10 @@ namespace slideshow ...@@ -334,9 +339,10 @@ namespace slideshow
aDeviceParams[ 0 ] >>= aImplName; aDeviceParams[ 0 ] >>= aImplName;
if( aImplName.endsWithIgnoreAsciiCase( "VCL" ) || 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") || else if( aImplName.endsWithIgnoreAsciiCase("DX") ||
aImplName.endsWithIgnoreAsciiCase("DX9") ) aImplName.endsWithIgnoreAsciiCase("DX9") )
...@@ -406,7 +412,7 @@ namespace slideshow ...@@ -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 #if !HAVE_FEATURE_AVMEDIA
(void) rMediaURL; (void) rMediaURL;
...@@ -417,7 +423,7 @@ namespace slideshow ...@@ -417,7 +423,7 @@ namespace slideshow
{ {
if( !rMediaURL.isEmpty() ) if( !rMediaURL.isEmpty() )
{ {
mxPlayer.set( avmedia::MediaWindow::createPlayer( rMediaURL, ""/*TODO!*/ ), mxPlayer.set( avmedia::MediaWindow::createPlayer( rMediaURL, ""/*TODO!*/, &rMimeType ),
uno::UNO_QUERY ); uno::UNO_QUERY );
} }
} }
...@@ -438,7 +444,8 @@ namespace slideshow ...@@ -438,7 +444,8 @@ namespace slideshow
bool ViewMediaShape::implInitializeVCLBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds, 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" ); OSL_TRACE( "ViewMediaShape::implInitializeVCLBasedPlayerWindow" );
if( !mpMediaWindow.get() && !rBounds.isEmpty() ) if( !mpMediaWindow.get() && !rBounds.isEmpty() )
...@@ -467,9 +474,15 @@ namespace slideshow ...@@ -467,9 +474,15 @@ namespace slideshow
rRangePix.getMinY(), rRangePix.getMinY(),
rRangePix.getMaxX() - rRangePix.getMinX(), rRangePix.getMaxX() - rRangePix.getMinX(),
rRangePix.getMaxY() - rRangePix.getMinY() ); rRangePix.getMaxY() - rRangePix.getMinY() );
if( avmedia::IsModel(rMimeType) )
mpMediaWindow.reset( new {
SystemChildWindow( pWindow, WB_CLIPCHILDREN ) ); 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->SetBackground( Color( COL_BLACK ) );
mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ), mpMediaWindow->SetPosSizePixel( Point( aAWTRect.X, aAWTRect.Y ),
Size( aAWTRect.Width, aAWTRect.Height ) ); Size( aAWTRect.Width, aAWTRect.Height ) );
......
...@@ -140,9 +140,10 @@ namespace slideshow ...@@ -140,9 +140,10 @@ namespace slideshow
bool implInitialize( const ::basegfx::B2DRectangle& rBounds ); bool implInitialize( const ::basegfx::B2DRectangle& rBounds );
void implSetMediaProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxProps ); 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, 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, bool implInitializeDXBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rDXDeviceParams ); const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rDXDeviceParams );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment