summaryrefslogtreecommitdiff
path: root/slideshow
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-08-26 10:24:39 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-08-26 11:48:41 +0200
commit916848d877a788d02e2e7c980872314839101798 (patch)
tree41b59d5cd2429765fe4d5d53ecd306a2a0f8003d /slideshow
parent2a7a576d19b9c212fd6f906f5e275fdf2266608e (diff)
tdf#149971 avmedia: implement video crop support in the gsteamer backend
If a media shape had cropping defined, we already took that into account when presenting a preview for it, but not during video playback. The reason for this is that the preview may be set by a file importer (e.g. PPTX) explicitly, in which case the preview is a bitmap we get without any video processing. As a start, implement video crop for the gstreamer backend (used on Linux), and also pass in the media item (containing crop and other properties) both during the edit view (MediaWindowImpl) and presenting (ViewMediaShape). We pass in the whole media item, so in case later other filters (e.g. black-and-white) are wanted, we have all that info in the backends already. Other backends (avmediaMacAVF and avmediawin) are untouched so far. svx/qa/unit/data/video-snapshot.pptx is modified to have a yellow border when cropping is unimplemented, which is now not visible with the gtreamer backend, matching PowerPoint behavior. PPTX export was working out of the box already. Change-Id: If26b7a4391bcffe9cbddd9933e1bab69be52924e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138867 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/shapes/viewmediashape.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index f9257c3a5448..4c5b9f51f8f6 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -37,6 +37,8 @@
#include <canvas/canvastools.hxx>
#include <cppcanvas/canvas.hxx>
#include <avmedia/mediawindow.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdomedia.hxx>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -442,10 +444,20 @@ namespace slideshow::internal
aAWTRect.X = aAWTRect.Y = 0;
+ SdrObject* pObj = SdrObject::getSdrObjectFromXShape(mxShape);
+ auto pMediaObj = dynamic_cast<SdrMediaObj*>(pObj);
+ const avmedia::MediaItem* pMediaItem = nullptr;
+ if (pMediaObj)
+ {
+ pMediaItem = &pMediaObj->getMediaProperties();
+ }
+
uno::Sequence< uno::Any > aArgs{
uno::Any(nParentWindowHandle),
uno::Any(aAWTRect),
- uno::Any(reinterpret_cast< sal_IntPtr >( mpMediaWindow.get() ))
+ uno::Any(reinterpret_cast< sal_IntPtr >( mpMediaWindow.get() )),
+ // Media item contains media properties, e.g. cropping.
+ uno::Any(reinterpret_cast< sal_IntPtr >( pMediaItem ))
};
mxPlayerWindow.set( mxPlayer->createPlayerWindow( aArgs ) );