From 8b02c98a757570900264fb65df01c3954c74d745 Mon Sep 17 00:00:00 2001 From: Minh Ngo Date: Wed, 10 Jul 2013 08:52:41 +0300 Subject: Fixing get/set time methods (correctly converts ms into sec). Change-Id: I64c7ddb5336a7ea255500c21ee1550eb32cbf27b --- 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(-) diff --git a/avmedia/source/vlc/vlcframegrabber.cxx b/avmedia/source/vlc/vlcframegrabber.cxx index 4cf986642236..5cf76ec94088 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 0e88d5dca198..cb77e41c06c4 100644 --- a/avmedia/source/vlc/vlcframegrabber.hxx +++ b/avmedia/source/vlc/vlcframegrabber.hxx @@ -21,6 +21,7 @@ #define _VLCFRAMEGRABBER_HXX #include "vlccommon.hxx" +#include #include #include @@ -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 efb23baacd8f..3c8453ba3086 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& 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( 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( libvlc_media_player_get_time( mPlayer.get() ) ) / MS_IN_SEC; } double SAL_CALL VLCPlayer::getRate() -- cgit v1.2.3