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

Minh Ngo nlminhtl at gmail.com
Thu Jun 20 23:24:00 PDT 2013


 avmedia/source/vlc/vlcplayer.cxx |   20 ++++++++++++++++++--
 avmedia/source/vlc/vlcplayer.hxx |   10 +++++++---
 2 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 88398a5c5e427410164538abb0b7f9c172aec518
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Fri Jun 21 09:19:51 2013 +0300

    Media player/VLC instance initializing.
    
    + implementing some methods in vlcplayer
    
    Change-Id: I9b9ca9ecd56f85b73fb7e79fcab5fc2968bd20fb

diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index e977de4..c48b1f3 100644
--- a/avmedia/source/vlc/vlcplayer.cxx
+++ b/avmedia/source/vlc/vlcplayer.cxx
@@ -5,17 +5,33 @@ using namespace ::com::sun::star;
 namespace avmedia {
 namespace vlc {
 
+const char * const VLC_ARGS[] = {
+    "-I",
+    "dummy",
+    "--ignore-config",
+    "--verbose=-1",
+    "--quiet"
+};
+
+VLCPlayer::VLCPlayer()
+    : mInstance( libvlc_new( sizeof( VLC_ARGS ) / sizeof( VLC_ARGS[0] ), VLC_ARGS ), libvlc_release )
+    , mPlayer( libvlc_media_player_new(mInstance.get()), libvlc_media_player_release )
+{
+}
+
 void SAL_CALL VLCPlayer::start()
 {
+    libvlc_media_player_play( mPlayer.get() );
 }
 
 void SAL_CALL VLCPlayer::stop()
 {
+    libvlc_media_player_stop( mPlayer.get() );
 }
 
 ::sal_Bool SAL_CALL VLCPlayer::isPlaying()
 {
-    return false;
+    return (libvlc_media_player_is_playing( mPlayer.get() ) == 1);
 }
 
 double SAL_CALL VLCPlayer::getDuration()
@@ -34,7 +50,7 @@ double SAL_CALL VLCPlayer::getMediaTime()
 
 double SAL_CALL VLCPlayer::getRate()
 {
-    return 0.f;
+    return libvlc_media_player_get_rate( mPlayer.get() );
 }
 
 void SAL_CALL VLCPlayer::setPlaybackLoop( ::sal_Bool bSet )
diff --git a/avmedia/source/vlc/vlcplayer.hxx b/avmedia/source/vlc/vlcplayer.hxx
index f82bd59..ee1ebba 100644
--- a/avmedia/source/vlc/vlcplayer.hxx
+++ b/avmedia/source/vlc/vlcplayer.hxx
@@ -20,10 +20,10 @@
 #ifndef _VLCPLAYER_HXX
 #define _VLCPLAYER_HXX
 
-#include "vlccommon.hxx"
-
-#include "com/sun/star/media/XPlayer.hpp"
+#include <vlc/vlc.h>
+#include <com/sun/star/media/XPlayer.hpp>
 #include <cppuhelper/basemutex.hxx>
+#include "vlccommon.hxx"
 
 namespace avmedia {
 namespace vlc {
@@ -34,7 +34,11 @@ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::media::XPlayer,
 class VLCPlayer : public ::cppu::BaseMutex,
                   public VLC_Base
 {
+    boost::shared_ptr<libvlc_instance_t> mInstance;
+    boost::shared_ptr<libvlc_media_player_t> mPlayer;
 public:
+    VLCPlayer();
+
     void SAL_CALL start();
     void SAL_CALL stop();
     ::sal_Bool SAL_CALL isPlaying();


More information about the Libreoffice-commits mailing list