[Libreoffice-commits] core.git: 3 commits - avmedia/source external/collada2gltf

Zolnai Tamás tamas.zolnai at collabora.com
Fri May 16 13:13:45 PDT 2014


 avmedia/source/opengl/oglplayer.cxx                 |   24 +++++++++++++++++---
 avmedia/source/opengl/oglplayer.hxx                 |    7 +++++
 external/collada2gltf/StaticLibrary_collada2gltf.mk |    6 +++++
 3 files changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 73212108571d2ef4a7073193ea37b2f6cba4537b
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri May 16 22:08:23 2014 +0200

    OGLPlayer: fix playing of animation in edit mode
    
    gltf_animation_set_time doesn't work but stops the animation.
    
    Change-Id: Ia17724c36e2007451e24f97e04a09240359ad969

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 5c3ede6..ff056e3 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -138,8 +138,9 @@ double SAL_CALL OGLPlayer::getDuration() throw ( uno::RuntimeException, std::exc
 
 void SAL_CALL OGLPlayer::setMediaTime( double fTime ) throw ( uno::RuntimeException, std::exception )
 {
+    // TODO: doesn't work, but cause problem in playing
     osl::MutexGuard aGuard(m_aMutex);
-    gltf_animation_set_time(m_pHandle, fTime);
+    //gltf_animation_set_time(m_pHandle, fTime);
 }
 
 double SAL_CALL OGLPlayer::getMediaTime() throw ( ::com::sun::star::uno::RuntimeException, std::exception )
commit 4c19fd176d964c4ff0b3998b52e268e899350254
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri May 16 21:45:39 2014 +0200

    Collada2gltf: add -lrt to fix compilation problems
    
    Change-Id: I1c0c9459cb716512dc726ee96fb811d03084aa62

diff --git a/external/collada2gltf/StaticLibrary_collada2gltf.mk b/external/collada2gltf/StaticLibrary_collada2gltf.mk
index 0097f3f..dac8caf 100644
--- a/external/collada2gltf/StaticLibrary_collada2gltf.mk
+++ b/external/collada2gltf/StaticLibrary_collada2gltf.mk
@@ -30,6 +30,12 @@ $(eval $(call gb_StaticLibrary_add_defs,collada2gltf,\
 
 endif
 
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_add_libs,collada2gltf,\
+	-lrt \
+))
+endif
+
 $(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,collada2gltf,cpp))
 
 $(eval $(call gb_StaticLibrary_set_include,collada2gltf,\
commit ba9357b82ec5551d562f572074b064ccd6c808f0
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri May 16 22:07:16 2014 +0200

    OGLPlayer: set a timer which call redrawing to show animation
    
    Change-Id: I7c98ba61be0510e9f86cb80fda73d18f7f7957cf

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 217fd88..5c3ede6 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -103,6 +103,10 @@ bool OGLPlayer::create( const OUString& rURL )
             }
         }
     }
+
+    // Set timer
+    m_aTimer.SetTimeout(10);
+    m_aTimer.SetTimeoutHdl(LINK(this,OGLPlayer,TimerHandler));
     return true;
 }
 
@@ -110,12 +114,14 @@ void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception )
 {
     osl::MutexGuard aGuard(m_aMutex);
     gltf_animation_start(m_pHandle);
+    m_aTimer.Start();
 }
 
 void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception )
 {
     osl::MutexGuard aGuard(m_aMutex);
     gltf_animation_stop(m_pHandle);
+    m_aTimer.Stop();
 }
 
 sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception )
@@ -212,8 +218,8 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c
     m_pHandle->viewport.width = aSize.Width();
     m_pHandle->viewport.height = aSize.Height();
     gltf_renderer_set_content(m_pHandle);
-    OGLWindow* pWindow = new OGLWindow(m_pHandle, &m_aContext, pChildWindow);
-    return uno::Reference< media::XPlayerWindow >( pWindow );
+    m_pOGLWindow = new OGLWindow(m_pHandle, &m_aContext, pChildWindow);
+    return uno::Reference< media::XPlayerWindow >( m_pOGLWindow );
 }
 
 uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
@@ -256,6 +262,17 @@ uno::Sequence< OUString > SAL_CALL OGLPlayer::getSupportedServiceNames()
     return aRet;
 }
 
+IMPL_LINK(OGLPlayer,TimerHandler,Timer*,pTimer)
+{
+    if (pTimer == &m_aTimer)
+    {
+        m_pOGLWindow->update();
+        m_aTimer.Start();
+    }
+
+    return 0;
+}
+
 } // namespace ogl
 } // namespace avmedia
 
diff --git a/avmedia/source/opengl/oglplayer.hxx b/avmedia/source/opengl/oglplayer.hxx
index 86e8a6e..69f010b 100644
--- a/avmedia/source/opengl/oglplayer.hxx
+++ b/avmedia/source/opengl/oglplayer.hxx
@@ -16,9 +16,12 @@
 #include <com/sun/star/media/XPlayer.hpp>
 #include <libgltf.h>
 #include <vcl/opengl/OpenGLContext.hxx>
+#include <vcl/timer.hxx>
 
 namespace avmedia { namespace ogl {
 
+class OGLWindow;
+
 typedef ::cppu::WeakComponentImplHelper2< com::sun::star::media::XPlayer,
                                           com::sun::star::lang::XServiceInfo > Player_BASE;
 
@@ -55,9 +58,13 @@ public:
     virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 private:
+    DECL_LINK( TimerHandler, Timer* );
+
     OUString m_sURL;
     glTFHandle* m_pHandle;
     OpenGLContext m_aContext;
+    Timer m_aTimer;
+    OGLWindow* m_pOGLWindow;
 };
 
 } // namespace ogl


More information about the Libreoffice-commits mailing list