summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Ngo <nlminhtl@gmail.com>2013-07-06 21:11:07 +0300
committerMinh Ngo <nlminhtl@gmail.com>2013-07-06 21:11:07 +0300
commit58b339e0bb2d6edba984cbf5bb6d5b34a4594223 (patch)
treecc755eb81136f9f1f0c41ba8e27ad6dbc3b4dbb9
parent68263030320c99297a24c0362a226fd1bb6e30c1 (diff)
Setting url into the player class
Change-Id: I7175b3ac9a818c6ae0ac0fdbea70b0416df34446
-rw-r--r--avmedia/source/vlc/vlcmanager.cxx2
-rw-r--r--avmedia/source/vlc/vlcplayer.cxx13
-rw-r--r--avmedia/source/vlc/vlcplayer.hxx9
3 files changed, 18 insertions, 6 deletions
diff --git a/avmedia/source/vlc/vlcmanager.cxx b/avmedia/source/vlc/vlcmanager.cxx
index 18681def03c0..1ded627034d7 100644
--- a/avmedia/source/vlc/vlcmanager.cxx
+++ b/avmedia/source/vlc/vlcmanager.cxx
@@ -20,7 +20,7 @@ Manager::~Manager()
uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const rtl::OUString& rURL )
throw (uno::RuntimeException)
{
- VLCPlayer* pPlayer( new VLCPlayer( /* mxMgr */ ) );
+ VLCPlayer* pPlayer( new VLCPlayer( rURL/*, mxMgr */ ) );
uno::Reference< media::XPlayer > xRet( pPlayer );
return xRet;
diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index fb1ad0135d1e..12133c1b45ff 100644
--- a/avmedia/source/vlc/vlcplayer.cxx
+++ b/avmedia/source/vlc/vlcplayer.cxx
@@ -18,10 +18,21 @@ const char * const VLC_ARGS[] = {
"--quiet"
};
-VLCPlayer::VLCPlayer()
+namespace
+{
+ libvlc_media_t* initMedia( const rtl::OUString& url, boost::scoped_ptr<libvlc_instance_t>& instance)
+ {
+ rtl::OString dest;
+ url.convertToString(&dest, RTL_TEXTENCODING_UTF8, 0);
+ return libvlc_media_new_path(instance.get(), dest.getStr());
+ }
+}
+
+VLCPlayer::VLCPlayer( const rtl::OUString& url )
: VLC_Base(m_aMutex)
, 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 )
+ , mMedia( initMedia( url, mInstance), libvlc_media_release )
{
}
diff --git a/avmedia/source/vlc/vlcplayer.hxx b/avmedia/source/vlc/vlcplayer.hxx
index d1e551154f93..c56959415521 100644
--- a/avmedia/source/vlc/vlcplayer.hxx
+++ b/avmedia/source/vlc/vlcplayer.hxx
@@ -22,7 +22,7 @@
#include "vlccommon.hxx"
#include <vlc/vlc.h>
-#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
#include <cppuhelper/compbase2.hxx>
#include <com/sun/star/media/XPlayer.hpp>
#include <cppuhelper/basemutex.hxx>
@@ -37,10 +37,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;
+ boost::scoped_ptr<libvlc_instance_t> mInstance;
+ boost::scoped_ptr<libvlc_media_player_t> mPlayer;
+ boost::scoped_ptr<libvlc_media_t> mMedia;
public:
- VLCPlayer();
+ VLCPlayer( const rtl::OUString& url );
void SAL_CALL start();
void SAL_CALL stop();