[Libreoffice-commits] core.git: avmedia/source

Minh Ngo nlminhtl at gmail.com
Sat Sep 14 12:38:37 PDT 2013


 avmedia/source/vlc/vlcplayer.cxx |   15 ++++++++++++---
 avmedia/source/vlc/vlcplayer.hxx |    3 +++
 avmedia/source/vlc/vlcwindow.cxx |   11 ++++++++++-
 avmedia/source/vlc/vlcwindow.hxx |    6 +++++-
 4 files changed, 30 insertions(+), 5 deletions(-)

New commits:
commit 6aea4aacae0027ad57398e3e3148af6ffe20fc29
Author: Minh Ngo <nlminhtl at gmail.com>
Date:   Sat Sep 14 22:36:59 2013 +0300

    Avmedia/VLC: Switching window ID when changing a screen mode.
    
    Change-Id: I9ce6951690773b7b16b352a75c7a741442dcec20

diff --git a/avmedia/source/vlc/vlcplayer.cxx b/avmedia/source/vlc/vlcplayer.cxx
index 77678c0..cdabc30b 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 be50c4c..bb37f8a 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 70320a9..aab1ea8 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 ef06576..1eb05c9 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);


More information about the Libreoffice-commits mailing list