summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-04-28 15:42:32 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-04-28 17:26:35 +0200
commit0a1746e942224851b584f5902d7b1e0ca496fdab (patch)
treee97c7ff5bfad9ef414926361536ced7c20e98a86 /avmedia
parent4ee7708bc261d49f4a08d617fedf337f86de1000 (diff)
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
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/opengl/oglplayer.cxx5
-rw-r--r--avmedia/source/opengl/oglplayer.hxx1
-rw-r--r--avmedia/source/opengl/oglwindow.cxx9
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx9
4 files changed, 16 insertions, 8 deletions
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 3200f16bdd15..a0a27b01328e 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 1f1efce2440d..6d7077ac8283 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 04c00e0bfaad..b67456250e46 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 87d61cb3e736..46900ede13e9 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() )