summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Ngo <nlminhtl@gmail.com>2013-06-21 09:19:51 +0300
committerMinh Ngo <nlminhtl@gmail.com>2013-06-21 09:19:51 +0300
commit88398a5c5e427410164538abb0b7f9c172aec518 (patch)
tree1a27c49aa06f1a19086b16c697889b7970b3bbc9
parent6b2d4bececb1fd588076b6a2e573f539f3242b58 (diff)
Media player/VLC instance initializing.
+ implementing some methods in vlcplayer Change-Id: I9b9ca9ecd56f85b73fb7e79fcab5fc2968bd20fb
-rw-r--r--avmedia/source/vlc/vlcplayer.cxx20
-rw-r--r--avmedia/source/vlc/vlcplayer.hxx10
2 files changed, 25 insertions, 5 deletions
diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index e977de41d98f..c48b1f3d3c44 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 f82bd597fc01..ee1ebbab1316 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();