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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Feb 19 08:55:13 UTC 2019


 avmedia/source/gstreamer/gstplayer.cxx |   21 ++++++++++++++++++++-
 avmedia/source/gstreamer/gstplayer.hxx |    2 ++
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 18138417485aeba6c52d935c616dba829b24ffd8
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Mon Feb 18 21:51:57 2019 +0800
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Feb 19 09:54:48 2019 +0100

    avmedia: set gstreamer gst_video_overlay size and position.
    
    Have video fit to the media object size on the slide,
    allow more complicated interactions.
    
    Change-Id: Ice1fa4b521176ad7ed7f7d1d2b13e617e8282390
    Reviewed-on: https://gerrit.libreoffice.org/67978
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
index a81c386cc3c3..581e40dd8d37 100644
--- a/avmedia/source/gstreamer/gstplayer.cxx
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -487,7 +487,13 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message )
             mpXOverlay = GST_VIDEO_OVERLAY( GST_MESSAGE_SRC( message ) );
             g_object_ref( G_OBJECT ( mpXOverlay ) );
             if ( mnWindowID != 0 )
+            {
                 gst_video_overlay_set_window_handle( mpXOverlay, mnWindowID );
+
+                if (maArea.Width > 0 && maArea.Height > 0)
+                    gst_video_overlay_set_render_rectangle(mpXOverlay, maArea.X, maArea.Y, maArea.Width, maArea.Height);
+            }
+
             return GST_BUS_DROP;
         }
     }
@@ -894,7 +900,12 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co
     ::osl::MutexGuard aGuard(m_aMutex);
 
     uno::Reference< ::media::XPlayerWindow >    xRet;
-    awt::Size                                   aSize( getPreferredPlayerWindowSize() );
+    awt::Size                                   aSize;
+
+    if (rArguments.getLength() > 1 && (rArguments[1] >>= maArea))
+        aSize = awt::Size(maArea.Width, maArea.Height);
+    else
+        aSize = getPreferredPlayerWindowSize();
 
     if( mbFakeVideo )
         preparePlaybin( maURL, nullptr );
@@ -912,6 +923,14 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co
             sal_IntPtr pIntPtr = 0;
             rArguments[ 2 ] >>= pIntPtr;
             SystemChildWindow *pParentWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr );
+
+            if (pParentWindow)
+            {
+                Point aPoint = pParentWindow->GetPosPixel();
+                maArea.X = aPoint.getX();
+                maArea.Y = aPoint.getY();
+            }
+
             const SystemEnvData* pEnvData = pParentWindow ? pParentWindow->GetSystemData() : nullptr;
             OSL_ASSERT(pEnvData);
             if (pEnvData)
diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx
index 1af1ae8eb9bf..b39521025da3 100644
--- a/avmedia/source/gstreamer/gstplayer.hxx
+++ b/avmedia/source/gstreamer/gstplayer.hxx
@@ -101,6 +101,8 @@ private:
     int                     mnWidth;
     int                     mnHeight;
 
+    css::awt::Rectangle     maArea;     // Area of the player window.
+
     guint                   mnWatchID;
     bool                    mbWatchID;
 


More information about the Libreoffice-commits mailing list