[Libreoffice-commits] core.git: Branch 'feature/vlc' - avmedia/source

Minh Ngo nlminhtl at gmail.com
Tue Jul 9 22:53:48 PDT 2013


 avmedia/source/vlc/vlcframegrabber.cxx |    1 +
 avmedia/source/vlc/vlcframegrabber.hxx |    3 ++-
 avmedia/source/vlc/vlcplayer.cxx       |    8 +++++---
 3 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 8b02c98a757570900264fb65df01c3954c74d745
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Wed Jul 10 08:52:41 2013 +0300

    Fixing get/set time methods (correctly converts ms into sec).
    
    Change-Id: I64c7ddb5336a7ea255500c21ee1550eb32cbf27b

diff --git a/avmedia/source/vlc/vlcframegrabber.cxx b/avmedia/source/vlc/vlcframegrabber.cxx
index 4cf9866..5cf76ec 100644
--- a/avmedia/source/vlc/vlcframegrabber.cxx
+++ b/avmedia/source/vlc/vlcframegrabber.cxx
@@ -10,6 +10,7 @@ const ::rtl::OUString AVMEDIA_VLC_GRABBER_IMPLEMENTATIONNAME = "com.sun.star.com
 const ::rtl::OUString AVMEDIA_VLC_GRABBER_SERVICENAME = "com.sun.star.media.VLCFrameGrabber_VLC";
 
 SAL_CALL VLCFrameGrabber::VLCFrameGrabber()
+    : FrameGrabber_BASE()
 {
 }
 
diff --git a/avmedia/source/vlc/vlcframegrabber.hxx b/avmedia/source/vlc/vlcframegrabber.hxx
index 0e88d5d..cb77e41 100644
--- a/avmedia/source/vlc/vlcframegrabber.hxx
+++ b/avmedia/source/vlc/vlcframegrabber.hxx
@@ -21,6 +21,7 @@
 #define _VLCFRAMEGRABBER_HXX
 
 #include "vlccommon.hxx"
+#include <boost/noncopyable.hpp>
 #include <com/sun/star/media/XFrameGrabber.hpp>
 #include <cppuhelper/implbase2.hxx>
 
@@ -30,7 +31,7 @@ namespace vlc {
 typedef ::cppu::WeakImplHelper2< ::com::sun::star::media::XFrameGrabber,
                                  ::com::sun::star::lang::XServiceInfo > FrameGrabber_BASE;
 
-class VLCFrameGrabber : public FrameGrabber_BASE
+class VLCFrameGrabber : public FrameGrabber_BASE, boost::noncopyable
 {
 public:
     SAL_CALL VLCFrameGrabber();
diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index efb23ba..3c8453b 100644
--- a/avmedia/source/vlc/vlcplayer.cxx
+++ b/avmedia/source/vlc/vlcplayer.cxx
@@ -18,6 +18,8 @@ const char * const VLC_ARGS[] = {
     "--quiet"
 };
 
+const int MS_IN_SEC = 1000; // Millisec in sec
+
 namespace
 {
     libvlc_media_t* initMedia( const rtl::OUString& url, boost::shared_ptr<libvlc_instance_t>& instance )
@@ -58,19 +60,19 @@ void SAL_CALL VLCPlayer::stop()
 double SAL_CALL VLCPlayer::getDuration()
 {
     ::osl::MutexGuard aGuard(m_aMutex);
-    return libvlc_media_get_duration( mMedia.get() );
+    return static_cast<double>( libvlc_media_get_duration( mMedia.get() ) ) / MS_IN_SEC;
 }
 
 void SAL_CALL VLCPlayer::setMediaTime( double fTime )
 {
     ::osl::MutexGuard aGuard(m_aMutex);
-    libvlc_media_player_set_time( mPlayer.get(), fTime );
+    libvlc_media_player_set_time( mPlayer.get(), fTime * MS_IN_SEC );
 }
 
 double SAL_CALL VLCPlayer::getMediaTime()
 {
     ::osl::MutexGuard aGuard(m_aMutex);
-    return libvlc_media_player_get_time( mPlayer.get() );
+    return static_cast<double>( libvlc_media_player_get_time( mPlayer.get() ) ) / MS_IN_SEC;
 }
 
 double SAL_CALL VLCPlayer::getRate()


More information about the Libreoffice-commits mailing list