summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMinh Ngo <nlminhtl@gmail.com>2013-09-14 22:36:59 +0300
committerMinh Ngo <nlminhtl@gmail.com>2013-09-14 22:36:59 +0300
commit6aea4aacae0027ad57398e3e3148af6ffe20fc29 (patch)
tree89c400175f12f929ca53e637842411adbef71502 /avmedia
parent6a9d3e7f57278bb0ab2f72d71000c76506f29394 (diff)
Avmedia/VLC: Switching window ID when changing a screen mode.
Change-Id: I9ce6951690773b7b16b352a75c7a741442dcec20
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/vlc/vlcplayer.cxx15
-rw-r--r--avmedia/source/vlc/vlcplayer.hxx3
-rw-r--r--avmedia/source/vlc/vlcwindow.cxx11
-rw-r--r--avmedia/source/vlc/vlcwindow.hxx6
4 files changed, 30 insertions, 5 deletions
diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index 77678c06ab9c..cdabc30b5eeb 100644
--- a/avmedia/source/vlc/vlcplayer.cxx
+++ b/avmedia/source/vlc/vlcplayer.cxx
@@ -32,6 +32,7 @@ VLCPlayer::VLCPlayer( const rtl::OUString& url,
, mEventManager( mPlayer, mEventHandler )
, mUrl( url )
, mPlaybackLoop( false )
+ , mPrevWinID( 0 )
{
mPlayer.setMouseHandling( false );
}
@@ -169,17 +170,25 @@ namespace
}
}
+void SAL_CALL VLCPlayer::setWindowID( const intptr_t windowID )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ mPrevWinID = windowID;
+ mPlayer.stop();
+ mPlayer.setWindow( windowID );
+}
+
uno::Reference< css::media::XPlayerWindow > SAL_CALL VLCPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& aArguments )
throw ( ::com::sun::star::uno::RuntimeException )
{
- ::osl::MutexGuard aGuard(m_aMutex);
- VLCWindow * const window = new VLCWindow;
+ ::osl::MutexGuard aGuard( m_aMutex );
const intptr_t winID = GetWindowID( aArguments );
+ VLCWindow * const window = new VLCWindow( *this, mPrevWinID );
if ( winID != -1 )
{
- mPlayer.setWindow( winID );
+ setWindowID( winID );
}
return uno::Reference< css::media::XPlayerWindow >( window );
diff --git a/avmedia/source/vlc/vlcplayer.hxx b/avmedia/source/vlc/vlcplayer.hxx
index be50c4c8dc1f..bb37f8ae5215 100644
--- a/avmedia/source/vlc/vlcplayer.hxx
+++ b/avmedia/source/vlc/vlcplayer.hxx
@@ -51,11 +51,14 @@ class VLCPlayer : public ::cppu::BaseMutex,
const rtl::OUString mUrl;
bool mPlaybackLoop;
::com::sun::star::uno::Reference< css::media::XFrameGrabber > mrFrameGrabber;
+ intptr_t mPrevWinID;
public:
VLCPlayer( const rtl::OUString& url,
wrapper::Instance& instance,
wrapper::EventHandler& eh );
+ void SAL_CALL setWindowID( const intptr_t windowID );
+
void SAL_CALL start() throw ( ::com::sun::star::uno::RuntimeException );
void SAL_CALL stop() throw ( ::com::sun::star::uno::RuntimeException );
::sal_Bool SAL_CALL isPlaying() throw ( ::com::sun::star::uno::RuntimeException );
diff --git a/avmedia/source/vlc/vlcwindow.cxx b/avmedia/source/vlc/vlcwindow.cxx
index 70320a96d184..aab1ea8c5e48 100644
--- a/avmedia/source/vlc/vlcwindow.cxx
+++ b/avmedia/source/vlc/vlcwindow.cxx
@@ -1,5 +1,6 @@
#include <iostream>
#include "vlcwindow.hxx"
+#include "vlcplayer.hxx"
using namespace ::com::sun::star;
@@ -12,10 +13,18 @@ namespace
const ::rtl::OUString AVMEDIA_VLC_WINDOW_SERVICENAME = "com.sun.star.media.Window_VLC";
}
-VLCWindow::VLCWindow()
+VLCWindow::VLCWindow( VLCPlayer& player, const intptr_t prevWinID )
+ : mPlayer( player )
+ , mPrevWinID( prevWinID )
+ , meZoomLevel( media::ZoomLevel_ORIGINAL )
{
}
+VLCWindow::~VLCWindow()
+{
+ mPlayer.setWindowID( mPrevWinID );
+}
+
void SAL_CALL VLCWindow::update() throw (css::uno::RuntimeException)
{
}
diff --git a/avmedia/source/vlc/vlcwindow.hxx b/avmedia/source/vlc/vlcwindow.hxx
index ef06576dcbef..1eb05c9f4871 100644
--- a/avmedia/source/vlc/vlcwindow.hxx
+++ b/avmedia/source/vlc/vlcwindow.hxx
@@ -23,13 +23,17 @@
namespace avmedia {
namespace vlc {
+class VLCPlayer;
class VLCWindow : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow,
::com::sun::star::lang::XServiceInfo >
{
+ VLCPlayer& mPlayer;
+ const intptr_t mPrevWinID;
::com::sun::star::media::ZoomLevel meZoomLevel;
public:
- VLCWindow();
+ VLCWindow( VLCPlayer& player, const intptr_t prevWinID );
+ virtual ~VLCWindow();
void SAL_CALL update() throw (css::uno::RuntimeException);
::sal_Bool SAL_CALL setZoomLevel( css::media::ZoomLevel ZoomLevel ) throw (css::uno::RuntimeException);