Kaydet (Commit) 9f71d4e4 authored tarafından Minh Ngo's avatar Minh Ngo

Creating one single Player manager.

Change-Id: I2a56f38a0b28c828f365a24d744aea385436c2b5
üst 7c7d898b
......@@ -20,9 +20,12 @@ using namespace ::com::sun::star;
namespace avmedia {
namespace vlc {
const ::rtl::OUString AVMEDIA_VLC_GRABBER_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.VLCFrameGrabber_VLC";
const ::rtl::OUString AVMEDIA_VLC_GRABBER_SERVICENAME = "com.sun.star.media.VLCFrameGrabber_VLC";
const int MSEC_IN_SEC = 1000;
namespace
{
const ::rtl::OUString AVMEDIA_VLC_GRABBER_IMPLEMENTATIONNAME = "com.sun.star.comp.avmedia.VLCFrameGrabber_VLC";
const ::rtl::OUString AVMEDIA_VLC_GRABBER_SERVICENAME = "com.sun.star.media.VLCFrameGrabber_VLC";
const int MSEC_IN_SEC = 1000;
}
VLCFrameGrabber::VLCFrameGrabber( VLC::Player& player, VLC::EventHandler& eh, const rtl::OUString& url )
: FrameGrabber_BASE()
......@@ -30,9 +33,11 @@ VLCFrameGrabber::VLCFrameGrabber( VLC::Player& player, VLC::EventHandler& eh, co
, mUrl( url )
, mEventHandler( eh )
{
std::cout << "URL: " << url << std::endl;
}
::uno::Reference< css::graphic::XGraphic > SAL_CALL VLCFrameGrabber::grabFrame( double fMediaTime ) throw ( ::com::sun::star::uno::RuntimeException )
::uno::Reference< css::graphic::XGraphic > SAL_CALL VLCFrameGrabber::grabFrame( double fMediaTime )
throw ( ::com::sun::star::uno::RuntimeException )
{
osl::Condition condition;
......@@ -90,12 +95,14 @@ VLCFrameGrabber::VLCFrameGrabber( VLC::Player& player, VLC::EventHandler& eh, co
return AVMEDIA_VLC_GRABBER_IMPLEMENTATIONNAME;
}
::sal_Bool SAL_CALL VLCFrameGrabber::supportsService( const ::rtl::OUString& serviceName ) throw ( ::com::sun::star::uno::RuntimeException )
::sal_Bool SAL_CALL VLCFrameGrabber::supportsService( const ::rtl::OUString& serviceName )
throw ( ::com::sun::star::uno::RuntimeException )
{
return AVMEDIA_VLC_GRABBER_SERVICENAME == serviceName;
}
::uno::Sequence< ::rtl::OUString > SAL_CALL VLCFrameGrabber::getSupportedServiceNames() throw ( ::com::sun::star::uno::RuntimeException )
::uno::Sequence< ::rtl::OUString > SAL_CALL VLCFrameGrabber::getSupportedServiceNames()
throw ( ::com::sun::star::uno::RuntimeException )
{
::uno::Sequence< OUString > aRet(1);
aRet[0] = AVMEDIA_VLC_GRABBER_SERVICENAME;
......
......@@ -71,7 +71,17 @@ uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const rtl::OUSt
if ( !m_is_vlc_found )
return uno::Reference< media::XPlayer >();
VLCPlayer* pPlayer( new VLCPlayer( rURL,
if ( !rURL.isEmpty() )
{
if (mURL == rURL)
return mPlayer;
mURL = rURL;
}
else
return mPlayer;
VLCPlayer* pPlayer( new VLCPlayer( mURL,
*mInstance,
mEventHandler /*, mxMgr */ ) );
mPlayer = uno::Reference< media::XPlayer >( pPlayer );
......
......@@ -45,7 +45,7 @@ public:
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mPlayer;
rtl::OUString mURL;
bool m_is_vlc_found;
};
......
......@@ -28,8 +28,8 @@ using namespace ::com::sun::star;
static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact )
{
fprintf (stderr, "create VLC Media player !\n");
(void) rxFact;
return uno::Reference< uno::XInterface >(*new ::avmedia::vlc::Manager( rxFact ) );
static uno::Reference< uno::XInterface > manager( *new ::avmedia::vlc::Manager( rxFact ) );
return manager;
}
extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmediavlc_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
......
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