[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - 4 commits - avmedia/source slideshow/source

Jan Holesovsky kendy at collabora.com
Wed May 28 07:51:48 PDT 2014


 avmedia/source/opengl/oglplayer.cxx               |    7 ++++--
 avmedia/source/opengl/oglplayer.hxx               |    2 -
 slideshow/source/engine/shapes/viewmediashape.cxx |   24 +++++++++++-----------
 3 files changed, 18 insertions(+), 15 deletions(-)

New commits:
commit 7e0342ee186fd26aa2ab3266166b1a338bf78fe2
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed May 28 16:43:08 2014 +0200

    First stop the timer, then the animation.
    
    Change-Id: Icd5f9f4b8e1c48176fdb73c954e1c4b7d0811516

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index f9185cb..cd148e0 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -153,8 +153,8 @@ void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception )
 void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception )
 {
     osl::MutexGuard aGuard(m_aMutex);
-    gltf_animation_stop(m_pHandle);
     m_aTimer.Stop();
+    gltf_animation_stop(m_pHandle);
 }
 
 sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception )
commit bbf652d565704cda1c289f31360f8ddb419b1bd8
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed May 28 16:40:12 2014 +0200

    slideshow: Don't assume anything about the duration.
    
    Let the player decide what to do when the duration is zero, and start()/stop() was called.
    
    Change-Id: I17027349e8d61f7b114e193a769402c04a64f3f3

diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index fea3271..0913329 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -128,7 +128,7 @@ namespace slideshow
             if( !mxPlayer.is() )
                 implInitialize( maBounds );
 
-            if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
+            if (mxPlayer.is())
                 mxPlayer->start();
 
             return true;
@@ -170,7 +170,7 @@ namespace slideshow
 
         void ViewMediaShape::pauseMedia()
         {
-            if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
+            if (mxPlayer.is())
                 mxPlayer->stop();
         }
 
@@ -178,7 +178,7 @@ namespace slideshow
 
         void ViewMediaShape::setMediaTime(double fTime)
         {
-            if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
+            if (mxPlayer.is())
                 mxPlayer->setMediaTime(fTime);
         }
 
commit 38c0a9c2d386003ffb2a857c65c8f4aef3e0af82
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed May 28 16:23:23 2014 +0200

    [not for master] Don't generate previews for gltf.
    
    They are needed as fallback though; so a better solution is needed for master.
    
    Change-Id: Ic35ec4de83bac6d73e1f745d88947915adc5130a

diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index f91be0b..fea3271 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -194,17 +194,17 @@ namespace slideshow
             if( !pCanvas )
                 return false;
 
-            if( !mpMediaWindow.get() && !mxPlayerWindow.is() )
+            OUString sURL;
+            OUString sMimeType;
+            uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
+            if (xPropSet.is())
             {
-                OUString sURL;
-                OUString sMimeType;
-                uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
-                if (xPropSet.is())
-                {
-                    xPropSet->getPropertyValue("PrivateTempFileURL") >>= sURL;
-                    xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType;
-                }
+                xPropSet->getPropertyValue("PrivateTempFileURL") >>= sURL;
+                xPropSet->getPropertyValue("MediaMimeType") >>= sMimeType;
+            }
 
+            if (sMimeType != "application/vnd.gltf+json" && !mpMediaWindow.get() && !mxPlayerWindow.is())
+            {
                 const Graphic aGraphic(avmedia::MediaWindow::grabFrame(sURL,"",sMimeType));
                 const BitmapEx aBmp = aGraphic.GetBitmapEx();
 
commit 65f5c6b5c30cbf9dc2fe4b4b007ec5046049b4f1
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed May 28 15:38:22 2014 +0200

    Use AutoTimer instead of Timer, and add some more locking.
    
    Change-Id: I83a99e333a6c62bf7779e3fbbcc3e5af38bb2ca5

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 53356ca..f9185cb 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -33,6 +33,7 @@ OGLPlayer::OGLPlayer()
 
 OGLPlayer::~OGLPlayer()
 {
+    osl::MutexGuard aGuard(m_aMutex);
     for (size_t i = 0; i < m_pHandle->size; ++i)
     {
         if (m_pHandle->files[i].type != GLTF_JSON)
@@ -71,6 +72,8 @@ static bool lcl_LoadFile(glTFFile* io_pFile, const OUString& rURL)
 
 bool OGLPlayer::create( const OUString& rURL )
 {
+    osl::MutexGuard aGuard(m_aMutex);
+
     m_sURL = rURL;
 
     // Load *.json file and init renderer
@@ -311,8 +314,8 @@ IMPL_LINK(OGLPlayer,TimerHandler,Timer*,pTimer)
 {
     if (pTimer == &m_aTimer)
     {
+        osl::MutexGuard aGuard(m_aMutex);
         m_pOGLWindow->update();
-        m_aTimer.Start();
     }
 
     return 0;
diff --git a/avmedia/source/opengl/oglplayer.hxx b/avmedia/source/opengl/oglplayer.hxx
index 69f010b..e7da91e 100644
--- a/avmedia/source/opengl/oglplayer.hxx
+++ b/avmedia/source/opengl/oglplayer.hxx
@@ -63,7 +63,7 @@ private:
     OUString m_sURL;
     glTFHandle* m_pHandle;
     OpenGLContext m_aContext;
-    Timer m_aTimer;
+    AutoTimer m_aTimer;
     OGLWindow* m_pOGLWindow;
 };
 


More information about the Libreoffice-commits mailing list