Kaydet (Commit) 474bef8e authored tarafından Mark Hung's avatar Mark Hung

avmedia: set gstreamer gst_video_overlay size and position.

Have video fit to the media object size on the slide,
allow more complicated interactions.

---

This also backports the relevant part from commit
bbe1ede0
("tdf#124027: use ID of the embedded window and fix
 position of  overlay") namely to make translation
gtk3-specific, to fix a regression, as mentioned in
its commmit message:

> 2) the position of the embedded window for video overlay has already
> been translated relative to the top-left corner of the slide (see
> bugfix of tdf#42873 how) in gen, gtk and kde5 vclplugs. So let's limit
> translating it 2nd time only to gtk3 vclplug which for some reason
> behaves differently
> (regression from 18138417)

Reviewed-on: https://gerrit.libreoffice.org/67978
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
(cherry picked from commit 18138417)

Change-Id: Ice1fa4b521176ad7ed7f7d1d2b13e617e8282390
Reviewed-on: https://gerrit.libreoffice.org/73199
Tested-by: Jenkins
Reviewed-by: 's avatarMark Hung <marklh9@gmail.com>
üst baf57431
...@@ -513,7 +513,13 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) ...@@ -513,7 +513,13 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message )
mpXOverlay = GST_VIDEO_OVERLAY( GST_MESSAGE_SRC( message ) ); mpXOverlay = GST_VIDEO_OVERLAY( GST_MESSAGE_SRC( message ) );
g_object_ref( G_OBJECT ( mpXOverlay ) ); g_object_ref( G_OBJECT ( mpXOverlay ) );
if ( mnWindowID != 0 ) if ( mnWindowID != 0 )
{
gst_video_overlay_set_window_handle( mpXOverlay, mnWindowID ); 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; return GST_BUS_DROP;
} }
#ifndef AVMEDIA_GST_0_10 #ifndef AVMEDIA_GST_0_10
...@@ -928,7 +934,12 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co ...@@ -928,7 +934,12 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co
::osl::MutexGuard aGuard(m_aMutex); ::osl::MutexGuard aGuard(m_aMutex);
uno::Reference< ::media::XPlayerWindow > xRet; 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 ) if( mbFakeVideo )
preparePlaybin( maURL, nullptr ); preparePlaybin( maURL, nullptr );
...@@ -953,6 +964,19 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co ...@@ -953,6 +964,19 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co
OUString aToolkit = OUString::createFromAscii(pEnvData->pToolkit); OUString aToolkit = OUString::createFromAscii(pEnvData->pToolkit);
OUString aPlatform = OUString::createFromAscii(pEnvData->pPlatformName); OUString aPlatform = OUString::createFromAscii(pEnvData->pPlatformName);
// tdf#124027: the position of embedded window is identical w/ the position
// of media object in all other vclplugs (gtk, kde5, gen), in gtk3 w/o gtksink it
// needs to be translated
if (aToolkit == "gtk3")
{
if (pParentWindow)
{
Point aPoint = pParentWindow->GetPosPixel();
maArea.X = aPoint.getX();
maArea.Y = aPoint.getY();
}
}
GstElement *pVideosink = nullptr; GstElement *pVideosink = nullptr;
#if defined(ENABLE_GTKSINK) #if defined(ENABLE_GTKSINK)
pVideosink = (aToolkit == "gtk3") ? pVideosink = (aToolkit == "gtk3") ?
......
...@@ -102,6 +102,8 @@ private: ...@@ -102,6 +102,8 @@ private:
int mnWidth; int mnWidth;
int mnHeight; int mnHeight;
css::awt::Rectangle maArea; // Area of the player window.
guint mnWatchID; guint mnWatchID;
bool mbWatchID; bool mbWatchID;
......
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