Kaydet (Commit) 6a9d3e7f authored tarafından Minh Ngo's avatar Minh Ngo

Avmedia/VLC component code refactoring.

Change-Id: Ibba5874e63356069d1af725d98980910dbaf8eb1
üst b3e0c808
...@@ -35,7 +35,7 @@ namespace ...@@ -35,7 +35,7 @@ namespace
}; };
} }
VLCFrameGrabber::VLCFrameGrabber( VLC::EventHandler& eh, const rtl::OUString& url ) VLCFrameGrabber::VLCFrameGrabber( wrapper::EventHandler& eh, const rtl::OUString& url )
: FrameGrabber_BASE() : FrameGrabber_BASE()
, mInstance( sizeof( VLC_ARGS ) / sizeof( VLC_ARGS[0] ), VLC_ARGS ) , mInstance( sizeof( VLC_ARGS ) / sizeof( VLC_ARGS[0] ), VLC_ARGS )
, mMedia( url, mInstance ) , mMedia( url, mInstance )
...@@ -51,7 +51,7 @@ VLCFrameGrabber::VLCFrameGrabber( VLC::EventHandler& eh, const rtl::OUString& ur ...@@ -51,7 +51,7 @@ VLCFrameGrabber::VLCFrameGrabber( VLC::EventHandler& eh, const rtl::OUString& ur
const rtl::OUString& fileName = utl::TempFile::CreateTempName(); const rtl::OUString& fileName = utl::TempFile::CreateTempName();
{ {
VLC::EventManager manager( mPlayer, mEventHandler ); wrapper::EventManager manager( mPlayer, mEventHandler );
manager.onPaused(boost::bind(&osl::Condition::set, &condition)); manager.onPaused(boost::bind(&osl::Condition::set, &condition));
if ( !mPlayer.play() ) if ( !mPlayer.play() )
......
...@@ -26,11 +26,6 @@ ...@@ -26,11 +26,6 @@
#include "vlccommon.hxx" #include "vlccommon.hxx"
#include "wrapper/Wrapper.hxx" #include "wrapper/Wrapper.hxx"
namespace VLC
{
class EventHandler;
}
namespace avmedia { namespace avmedia {
namespace vlc { namespace vlc {
...@@ -39,18 +34,22 @@ typedef ::cppu::WeakImplHelper2< ::com::sun::star::media::XFrameGrabber, ...@@ -39,18 +34,22 @@ typedef ::cppu::WeakImplHelper2< ::com::sun::star::media::XFrameGrabber,
class VLCFrameGrabber : public FrameGrabber_BASE class VLCFrameGrabber : public FrameGrabber_BASE
{ {
VLC::Instance mInstance; wrapper::Instance mInstance;
VLC::Media mMedia; wrapper::Media mMedia;
VLC::Player mPlayer; wrapper::Player mPlayer;
VLC::EventHandler& mEventHandler; wrapper::EventHandler& mEventHandler;
public: public:
VLCFrameGrabber( VLC::EventHandler& eh, const rtl::OUString& url ); VLCFrameGrabber( wrapper::EventHandler& eh, const rtl::OUString& url );
::com::sun::star::uno::Reference< css::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) throw ( ::com::sun::star::uno::RuntimeException ); ::com::sun::star::uno::Reference< css::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime )
throw ( ::com::sun::star::uno::RuntimeException );
::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); ::rtl::OUString SAL_CALL getImplementationName()
::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& serviceName ) throw ( ::com::sun::star::uno::RuntimeException ); throw ( ::com::sun::star::uno::RuntimeException );
::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw ( ::com::sun::star::uno::RuntimeException ); ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& serviceName )
throw ( ::com::sun::star::uno::RuntimeException );
::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw ( ::com::sun::star::uno::RuntimeException );
}; };
} }
......
...@@ -37,7 +37,7 @@ Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) ...@@ -37,7 +37,7 @@ Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr )
: mEventHandler() : mEventHandler()
, mxMgr( rxMgr ) , mxMgr( rxMgr )
{ {
using namespace VLC; using namespace wrapper;
static bool success = Instance::LoadSymbols() && EventManager::LoadSymbols() static bool success = Instance::LoadSymbols() && EventManager::LoadSymbols()
&& Media::LoadSymbols() && Player::LoadSymbols() && Media::LoadSymbols() && Player::LoadSymbols()
&& Common::LoadSymbols(); && Common::LoadSymbols();
......
...@@ -30,8 +30,8 @@ namespace vlc { ...@@ -30,8 +30,8 @@ namespace vlc {
class Manager : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XManager, class Manager : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XManager,
::com::sun::star::lang::XServiceInfo > ::com::sun::star::lang::XServiceInfo >
{ {
boost::scoped_ptr<VLC::Instance> mInstance; boost::scoped_ptr<wrapper::Instance> mInstance;
VLC::EventHandler mEventHandler; wrapper::EventHandler mEventHandler;
public: public:
Manager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr ); Manager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
~Manager(); ~Manager();
......
...@@ -22,8 +22,8 @@ namespace ...@@ -22,8 +22,8 @@ namespace
} }
VLCPlayer::VLCPlayer( const rtl::OUString& url, VLCPlayer::VLCPlayer( const rtl::OUString& url,
VLC::Instance& instance, wrapper::Instance& instance,
VLC::EventHandler& eh ) wrapper::EventHandler& eh )
: VLC_Base( m_aMutex ) : VLC_Base( m_aMutex )
, mInstance( instance ) , mInstance( instance )
, mEventHandler( eh ) , mEventHandler( eh )
......
...@@ -42,19 +42,19 @@ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::media::XPlayer, ...@@ -42,19 +42,19 @@ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::media::XPlayer,
class VLCPlayer : public ::cppu::BaseMutex, class VLCPlayer : public ::cppu::BaseMutex,
public VLC_Base public VLC_Base
{ {
VLC::Instance& mInstance; wrapper::Instance& mInstance;
VLC::EventHandler& mEventHandler; wrapper::EventHandler& mEventHandler;
VLC::Media mMedia; wrapper::Media mMedia;
VLC::Player mPlayer; wrapper::Player mPlayer;
VLC::EventManager mEventManager; wrapper::EventManager mEventManager;
const rtl::OUString mUrl; const rtl::OUString mUrl;
bool mPlaybackLoop; bool mPlaybackLoop;
::com::sun::star::uno::Reference< css::media::XFrameGrabber > mrFrameGrabber; ::com::sun::star::uno::Reference< css::media::XFrameGrabber > mrFrameGrabber;
public: public:
VLCPlayer( const rtl::OUString& url, VLCPlayer( const rtl::OUString& url,
VLC::Instance& instance, wrapper::Instance& instance,
VLC::EventHandler& eh ); wrapper::EventHandler& eh );
void SAL_CALL start() throw ( ::com::sun::star::uno::RuntimeException ); void SAL_CALL start() throw ( ::com::sun::star::uno::RuntimeException );
void SAL_CALL stop() throw ( ::com::sun::star::uno::RuntimeException ); void SAL_CALL stop() throw ( ::com::sun::star::uno::RuntimeException );
......
...@@ -6,8 +6,11 @@ using namespace ::com::sun::star; ...@@ -6,8 +6,11 @@ using namespace ::com::sun::star;
namespace avmedia { namespace avmedia {
namespace vlc { namespace vlc {
const ::rtl::OUString AVMEDIA_VLC_WINDOW_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.Window_VLC"; namespace
const ::rtl::OUString AVMEDIA_VLC_WINDOW_SERVICENAME = "com.sun.star.media.Window_VLC"; {
const ::rtl::OUString AVMEDIA_VLC_WINDOW_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.Window_VLC";
const ::rtl::OUString AVMEDIA_VLC_WINDOW_SERVICENAME = "com.sun.star.media.Window_VLC";
}
VLCWindow::VLCWindow() VLCWindow::VLCWindow()
{ {
......
...@@ -9,13 +9,17 @@ ...@@ -9,13 +9,17 @@
#include "Common.hxx" #include "Common.hxx"
#include "SymbolLoader.hxx" #include "SymbolLoader.hxx"
namespace VLC
{
namespace namespace
{ {
const char* (*libvlc_get_version)(void); const char* ( *libvlc_get_version ) (void);
} }
namespace avmedia
{
namespace vlc
{
namespace wrapper
{
bool Common::LoadSymbols() bool Common::LoadSymbols()
{ {
ApiMap VLC_COMMON_API[] = ApiMap VLC_COMMON_API[] =
...@@ -30,4 +34,6 @@ const char* Common::Version() ...@@ -30,4 +34,6 @@ const char* Common::Version()
{ {
return libvlc_get_version(); return libvlc_get_version();
} }
}
}
} }
\ No newline at end of file
...@@ -10,7 +10,11 @@ ...@@ -10,7 +10,11 @@
#ifndef _WRAPPER_COMMON_HXX #ifndef _WRAPPER_COMMON_HXX
#define _WRAPPER_COMMON_HXX #define _WRAPPER_COMMON_HXX
namespace VLC namespace avmedia
{
namespace vlc
{
namespace wrapper
{ {
class Common class Common
{ {
...@@ -19,6 +23,8 @@ namespace VLC ...@@ -19,6 +23,8 @@ namespace VLC
static const char* Version(); static const char* Version();
}; };
} }
}
}
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
#include "EventHandler.hxx" #include "EventHandler.hxx"
namespace VLC namespace avmedia
{
namespace vlc
{
namespace wrapper
{ {
EventHandler::EventHandler() EventHandler::EventHandler()
: ::osl::Thread() : ::osl::Thread()
...@@ -35,7 +39,8 @@ void EventHandler::run() ...@@ -35,7 +39,8 @@ void EventHandler::run()
callback(); callback();
} while ( true ); } while ( true );
} }
}
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
...@@ -10,12 +10,17 @@ ...@@ -10,12 +10,17 @@
#ifndef _WRAPPER_EVENT_HANDLER_HXX #ifndef _WRAPPER_EVENT_HANDLER_HXX
#define _WRAPPER_EVENT_HANDLER_HXX #define _WRAPPER_EVENT_HANDLER_HXX
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#include <salhelper/thread.hxx> #include <salhelper/thread.hxx>
#include "ThreadsafeQueue.hxx" #include "ThreadsafeQueue.hxx"
namespace VLC namespace avmedia
{ {
class EventHandler : public ::osl::Thread namespace vlc
{
namespace wrapper
{
class EventHandler : public ::osl::Thread, boost::noncopyable
{ {
public: public:
EventHandler(); EventHandler();
...@@ -26,9 +31,11 @@ namespace VLC ...@@ -26,9 +31,11 @@ namespace VLC
public: public:
typedef boost::function< void() > TCallback; typedef boost::function< void() > TCallback;
avmedia::vlc::ThreadsafeQueue< TCallback > mCallbackQueue; ThreadsafeQueue< TCallback > mCallbackQueue;
}; };
} }
}
}
#endif // _WRAPPER_EVENT_HANDLER_HXX #endif // _WRAPPER_EVENT_HANDLER_HXX
......
...@@ -12,25 +12,28 @@ ...@@ -12,25 +12,28 @@
#include "EventHandler.hxx" #include "EventHandler.hxx"
#include "Types.hxx" #include "Types.hxx"
namespace VLC namespace
{ {
namespace libvlc_event_manager_t* ( *libvlc_media_player_event_manager ) ( libvlc_media_player_t *p_mi );
{ int ( *libvlc_event_attach ) ( libvlc_event_manager_t *p_event_manager,
libvlc_event_manager_t* ( *libvlc_media_player_event_manager ) ( libvlc_media_player_t *p_mi ); libvlc_event_type_t i_event_type,
int ( *libvlc_event_attach ) ( libvlc_event_manager_t *p_event_manager, libvlc_callback_t f_callback,
libvlc_event_type_t i_event_type, void *user_data );
libvlc_callback_t f_callback, void ( *libvlc_event_detach ) ( libvlc_event_manager_t *p_event_manager,
void *user_data ); libvlc_event_type_t i_event_type,
void ( *libvlc_event_detach ) ( libvlc_event_manager_t *p_event_manager, libvlc_callback_t f_callback,
libvlc_event_type_t i_event_type, void *p_user_data );
libvlc_callback_t f_callback, }
void *p_user_data );
}
namespace avmedia
{
namespace vlc
{
namespace wrapper
{
void EventManager::Handler( const libvlc_event_t *event, void *pData ) void EventManager::Handler( const libvlc_event_t *event, void *pData )
{ {
EventManager *instance = static_cast<EventManager*>( pData ); EventManager *instance = static_cast<EventManager*>( pData );
std::cout << "HANDLER" << std::endl;
switch ( event->type ) switch ( event->type )
{ {
case libvlc_MediaPlayerPaused: case libvlc_MediaPlayerPaused:
...@@ -54,7 +57,7 @@ bool EventManager::LoadSymbols() ...@@ -54,7 +57,7 @@ bool EventManager::LoadSymbols()
return InitApiMap( VLC_EVENT_MANAGER_API ); return InitApiMap( VLC_EVENT_MANAGER_API );
} }
EventManager::EventManager( VLC::Player& player, VLC::EventHandler& eh ) EventManager::EventManager( Player& player, EventHandler& eh )
: mEventHandler( eh ) : mEventHandler( eh )
, mManager( libvlc_media_player_event_manager( player ) ) , mManager( libvlc_media_player_event_manager( player ) )
{ {
...@@ -80,7 +83,8 @@ void EventManager::onEndReached( const Callback& callback ) ...@@ -80,7 +83,8 @@ void EventManager::onEndReached( const Callback& callback )
mOnEndReached = callback; mOnEndReached = callback;
registerSignal( libvlc_MediaPlayerEndReached, callback ); registerSignal( libvlc_MediaPlayerEndReached, callback );
} }
}
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -11,30 +11,33 @@ ...@@ -11,30 +11,33 @@
#define _WRAPPER_EVENT_MANAGER_HXX #define _WRAPPER_EVENT_MANAGER_HXX
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/shared_ptr.hpp> #include <boost/noncopyable.hpp>
#include "Player.hxx" #include "Player.hxx"
struct libvlc_event_manager_t; struct libvlc_event_manager_t;
struct libvlc_event_t; struct libvlc_event_t;
namespace VLC namespace avmedia
{
namespace vlc
{
namespace wrapper
{ {
class EventHandler; class EventHandler;
class EventManager class EventManager : boost::noncopyable
{ {
public: public:
static bool LoadSymbols(); static bool LoadSymbols();
typedef boost::function<void()> Callback; typedef boost::function<void()> Callback;
EventManager( VLC::Player& player, VLC::EventHandler& eh ); EventManager( Player& player, EventHandler& eh );
void onPaused( const Callback& callback = Callback() ); void onPaused( const Callback& callback = Callback() );
void onEndReached( const Callback& callback = Callback() ); void onEndReached( const Callback& callback = Callback() );
private: private:
VLC::EventHandler& mEventHandler; EventHandler& mEventHandler;
typedef boost::function< void() > TCallback; typedef boost::function< void() > TCallback;
libvlc_event_manager_t *mManager; libvlc_event_manager_t *mManager;
TCallback mOnPaused; TCallback mOnPaused;
...@@ -45,6 +48,8 @@ namespace VLC ...@@ -45,6 +48,8 @@ namespace VLC
static void Handler( const libvlc_event_t *event, void *pData ); static void Handler( const libvlc_event_t *event, void *pData );
}; };
} }
}
}
#endif #endif
......
...@@ -10,15 +10,19 @@ ...@@ -10,15 +10,19 @@
#include "Instance.hxx" #include "Instance.hxx"
#include "SymbolLoader.hxx" #include "SymbolLoader.hxx"
namespace VLC namespace
{ {
namespace libvlc_instance_t* ( *libvlc_new ) ( int argc, const char * const *argv );
{ void ( *libvlc_release ) ( libvlc_instance_t *p_instance );
libvlc_instance_t* ( *libvlc_new ) ( int argc, const char * const *argv ); void ( *libvlc_retain ) ( libvlc_instance_t *p_instance );
void ( *libvlc_release ) ( libvlc_instance_t *p_instance ); }
void ( *libvlc_retain ) ( libvlc_instance_t *p_instance );
}
namespace avmedia
{
namespace vlc
{
namespace wrapper
{
bool Instance::LoadSymbols() bool Instance::LoadSymbols()
{ {
ApiMap VLC_INSTANCE_API[] = ApiMap VLC_INSTANCE_API[] =
...@@ -38,7 +42,7 @@ namespace VLC ...@@ -38,7 +42,7 @@ namespace VLC
Instance::Instance( const Instance& other ) Instance::Instance( const Instance& other )
{ {
operator=(other); operator=( other );
} }
const Instance& Instance::operator=( const Instance& other ) const Instance& Instance::operator=( const Instance& other )
...@@ -53,7 +57,8 @@ namespace VLC ...@@ -53,7 +57,8 @@ namespace VLC
{ {
libvlc_release( mInstance ); libvlc_release( mInstance );
} }
}
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -12,7 +12,11 @@ ...@@ -12,7 +12,11 @@
struct libvlc_instance_t; struct libvlc_instance_t;
namespace VLC namespace avmedia
{
namespace vlc
{
namespace wrapper
{ {
class Instance class Instance
{ {
...@@ -32,6 +36,8 @@ namespace VLC ...@@ -32,6 +36,8 @@ namespace VLC
libvlc_instance_t *mInstance; libvlc_instance_t *mInstance;
}; };
} }
}
}
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -14,23 +14,28 @@ ...@@ -14,23 +14,28 @@
#include "Types.hxx" #include "Types.hxx"
struct libvlc_instance_t; struct libvlc_instance_t;
namespace VLC
namespace avmedia
{ {
namespace namespace vlc
{ {
libvlc_media_t* ( *libvlc_media_new_path ) ( libvlc_instance_t *p_instance, const char *path ); namespace wrapper
void ( *libvlc_media_release ) ( libvlc_media_t *p_md ); {
void ( *libvlc_media_retain ) ( libvlc_media_t *p_md ); namespace
libvlc_time_t ( *libvlc_media_get_duration ) ( libvlc_media_t *p_md ); {
libvlc_media_t* ( *libvlc_media_new_path ) ( libvlc_instance_t *p_instance, const char *path );
void ( *libvlc_media_release ) ( libvlc_media_t *p_md );
void ( *libvlc_media_retain ) ( libvlc_media_t *p_md );
libvlc_time_t ( *libvlc_media_get_duration ) ( libvlc_media_t *p_md );
libvlc_media_t* InitMedia( const rtl::OUString& url, VLC::Instance& instance ) libvlc_media_t* InitMedia( const rtl::OUString& url, Instance& instance )
{ {
rtl::OString dest; rtl::OString dest;
url.convertToString(&dest, RTL_TEXTENCODING_UTF8, 0); url.convertToString(&dest, RTL_TEXTENCODING_UTF8, 0);
return libvlc_media_new_path(instance, dest.getStr()); return libvlc_media_new_path(instance, dest.getStr());
}
} }
}
bool Media::LoadSymbols() bool Media::LoadSymbols()
{ {
...@@ -52,7 +57,7 @@ Media::Media( const rtl::OUString& url, Instance& instance ) ...@@ -52,7 +57,7 @@ Media::Media( const rtl::OUString& url, Instance& instance )
Media::Media( const Media& other ) Media::Media( const Media& other )
{ {
operator=(other); operator=( other );
} }
const Media& Media::operator=( const Media& other ) const Media& Media::operator=( const Media& other )
...@@ -77,7 +82,8 @@ Media::~Media() ...@@ -77,7 +82,8 @@ Media::~Media()
{ {
libvlc_media_release( mMedia ); libvlc_media_release( mMedia );
} }
}
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -14,7 +14,11 @@ struct libvlc_media_t; ...@@ -14,7 +14,11 @@ struct libvlc_media_t;
namespace rtl { class OUString; } namespace rtl { class OUString; }
namespace VLC namespace avmedia
{
namespace vlc
{
namespace wrapper
{ {
class Instance; class Instance;
class Media class Media
...@@ -38,6 +42,8 @@ namespace VLC ...@@ -38,6 +42,8 @@ namespace VLC
libvlc_media_t *mMedia; libvlc_media_t *mMedia;
}; };
} }
}
}
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -14,40 +14,47 @@ ...@@ -14,40 +14,47 @@
#include "SymbolLoader.hxx" #include "SymbolLoader.hxx"
struct libvlc_media_t; struct libvlc_media_t;
namespace VLC
namespace
{ {
namespace void ( *libvlc_media_player_retain ) ( libvlc_media_player_t *p_mi );
{ libvlc_media_player_t * ( *libvlc_media_player_new_from_media ) ( libvlc_media_t *p_md );
void ( *libvlc_media_player_retain ) ( libvlc_media_player_t *p_mi ); void ( *libvlc_media_player_release ) ( libvlc_media_player_t *p_mi );
libvlc_media_player_t * ( *libvlc_media_player_new_from_media ) ( libvlc_media_t *p_md ); int ( *libvlc_media_player_play ) ( libvlc_media_player_t *p_mi );
void ( *libvlc_media_player_release ) ( libvlc_media_player_t *p_mi ); void ( *libvlc_media_player_pause ) ( libvlc_media_player_t *p_mi );
int ( *libvlc_media_player_play ) ( libvlc_media_player_t *p_mi ); int ( *libvlc_media_player_is_playing ) ( libvlc_media_player_t *p_mi );
void ( *libvlc_media_player_pause ) ( libvlc_media_player_t *p_mi ); void ( *libvlc_media_player_stop ) ( libvlc_media_player_t *p_mi );
int ( *libvlc_media_player_is_playing ) ( libvlc_media_player_t *p_mi ); void ( *libvlc_media_player_set_time ) ( libvlc_media_player_t *p_mi, libvlc_time_t i_time );
void ( *libvlc_media_player_stop ) ( libvlc_media_player_t *p_mi ); libvlc_time_t ( *libvlc_media_player_get_time ) ( libvlc_media_player_t *p_mi );
void ( *libvlc_media_player_set_time ) ( libvlc_media_player_t *p_mi, libvlc_time_t i_time ); float ( *libvlc_media_player_get_rate )( libvlc_media_player_t *p_mi );
libvlc_time_t ( *libvlc_media_player_get_time ) ( libvlc_media_player_t *p_mi ); int ( *libvlc_audio_set_volume ) ( libvlc_media_player_t *p_mi, int i_volume );
float ( *libvlc_media_player_get_rate )( libvlc_media_player_t *p_mi ); int ( *libvlc_audio_get_volume ) ( libvlc_media_player_t *p_mi );
int ( *libvlc_audio_set_volume ) ( libvlc_media_player_t *p_mi, int i_volume ); int ( *libvlc_audio_get_mute ) ( libvlc_media_player_t *p_mi );
int ( *libvlc_audio_get_volume ) ( libvlc_media_player_t *p_mi ); void ( *libvlc_audio_set_mute ) ( libvlc_media_player_t *p_mi, int status );
int ( *libvlc_audio_get_mute ) ( libvlc_media_player_t *p_mi ); int ( *libvlc_video_take_snapshot ) ( libvlc_media_player_t *p_mi,
void ( *libvlc_audio_set_mute ) ( libvlc_media_player_t *p_mi, int status ); unsigned num,
int ( *libvlc_video_take_snapshot ) ( libvlc_media_player_t *p_mi, unsigned num, const char *psz_filepath,
const char *psz_filepath, unsigned int i_width, unsigned int i_width,
unsigned int i_height ); unsigned int i_height );
#if defined UNX #if defined UNX
void ( *libvlc_media_player_set_xwindow ) ( libvlc_media_player_t *p_mi, uint32_t drawable ); void ( *libvlc_media_player_set_xwindow ) ( libvlc_media_player_t *p_mi, uint32_t drawable );
#elif defined MACOSX #elif defined MACOSX
void ( *libvlc_media_player_set_nsobject ) ( libvlc_media_player_t *p_mi, void *drawable ); void ( *libvlc_media_player_set_nsobject ) ( libvlc_media_player_t *p_mi, void *drawable );
#elif defined WNT #elif defined WNT
void ( *libvlc_media_player_set_hwnd ) ( libvlc_media_player_t *p_mi, void *drawable ); void ( *libvlc_media_player_set_hwnd ) ( libvlc_media_player_t *p_mi, void *drawable );
#else #else
#error unknown OS #error unknown OS
#endif #endif
unsigned ( *libvlc_media_player_has_vout ) ( libvlc_media_player_t *p_mi ); unsigned ( *libvlc_media_player_has_vout ) ( libvlc_media_player_t *p_mi );
void ( *libvlc_video_set_mouse_input ) ( libvlc_media_player_t *p_mi, unsigned on); void ( *libvlc_video_set_mouse_input ) ( libvlc_media_player_t *p_mi, unsigned on);
} }
namespace avmedia
{
namespace vlc
{
namespace wrapper
{
bool Player::LoadSymbols() bool Player::LoadSymbols()
{ {
ApiMap VLC_PLAYER_API[] = ApiMap VLC_PLAYER_API[] =
...@@ -190,5 +197,7 @@ namespace VLC ...@@ -190,5 +197,7 @@ namespace VLC
return libvlc_media_player_has_vout( mPlayer ); return libvlc_media_player_has_vout( mPlayer );
} }
} }
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -20,7 +20,11 @@ namespace rtl ...@@ -20,7 +20,11 @@ namespace rtl
class OUString; class OUString;
} }
namespace VLC namespace avmedia
{
namespace vlc
{
namespace wrapper
{ {
class Media; class Media;
class Player class Player
...@@ -63,6 +67,8 @@ namespace VLC ...@@ -63,6 +67,8 @@ namespace VLC
libvlc_media_player_t *mPlayer; libvlc_media_player_t *mPlayer;
}; };
} }
}
}
#endif #endif
......
...@@ -19,6 +19,12 @@ ...@@ -19,6 +19,12 @@
#define SYM_MAP(a) { #a, (SymbolFunc *)&a } #define SYM_MAP(a) { #a, (SymbolFunc *)&a }
namespace avmedia
{
namespace vlc
{
namespace wrapper
{
typedef void (*SymbolFunc) (void); typedef void (*SymbolFunc) (void);
struct ApiMap struct ApiMap
...@@ -70,7 +76,7 @@ namespace ...@@ -70,7 +76,7 @@ namespace
( aModule, OUString::createFromAscii( pMap[ i ].symName ).pData ); ( aModule, OUString::createFromAscii( pMap[ i ].symName ).pData );
if ( !aMethod ) if ( !aMethod )
{ {
std::cerr << "Cannot load method " << pMap[ i ].symName << std::endl; SAL_WARN("avmedia", "Cannot load method " << pMap[ i ].symName);
*pMap[ i ].refValue = NULL; *pMap[ i ].refValue = NULL;
return false; return false;
} }
...@@ -82,8 +88,6 @@ namespace ...@@ -82,8 +88,6 @@ namespace
} }
} }
namespace VLC
{
template<size_t N> template<size_t N>
bool InitApiMap( const ApiMap ( &pMap )[N] ) bool InitApiMap( const ApiMap ( &pMap )[N] )
{ {
...@@ -98,7 +102,7 @@ namespace VLC ...@@ -98,7 +102,7 @@ namespace VLC
if( aModule == NULL) if( aModule == NULL)
{ {
std::cerr << "Cannot load libvlc" << std::endl; SAL_WARN("avmedia", "Cannot load libvlc");
return false; return false;
} }
...@@ -112,6 +116,8 @@ namespace VLC ...@@ -112,6 +116,8 @@ namespace VLC
return false; return false;
} }
} }
}
}
#endif #endif
......
...@@ -24,9 +24,12 @@ ...@@ -24,9 +24,12 @@
#include <osl/conditn.hxx> #include <osl/conditn.hxx>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
namespace avmedia { namespace avmedia
namespace vlc { {
namespace vlc
{
namespace wrapper
{
template<class T> template<class T>
class ThreadsafeQueue : boost::noncopyable class ThreadsafeQueue : boost::noncopyable
{ {
...@@ -70,7 +73,7 @@ void ThreadsafeQueue<T>::pop( T& data ) ...@@ -70,7 +73,7 @@ void ThreadsafeQueue<T>::pop( T& data )
data = mQueue.front(); data = mQueue.front();
mQueue.pop(); mQueue.pop();
} }
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment