summaryrefslogtreecommitdiffstats
path: root/avmedia/source/viewer/mediawindow_impl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'avmedia/source/viewer/mediawindow_impl.cxx')
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx35
1 files changed, 17 insertions, 18 deletions
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 1ff4c46bd65a..82ca1b92821c 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -29,7 +29,8 @@
#include <sal/log.hxx>
#include <comphelper/processfactory.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <comphelper/scopeguard.hxx>
#include <tools/urlobj.hxx>
#include <unotools/securityoptions.hxx>
#include <vcl/bitmapex.hxx>
@@ -37,6 +38,7 @@
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
#include <vcl/ptrstyle.hxx>
+#include <vcl/svapp.hxx>
#include <com/sun/star/awt/SystemPointer.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -166,7 +168,7 @@ void MediaWindowImpl::dispose()
Control::dispose();
}
-uno::Reference<media::XPlayer> MediaWindowImpl::createPlayer(const OUString& rURL, const OUString& rReferer, const OUString* pMimeType)
+uno::Reference<media::XPlayer> MediaWindowImpl::createPlayer(const OUString& rURL, const OUString& rReferer, const OUString*)
{
uno::Reference<media::XPlayer> xPlayer;
@@ -178,22 +180,14 @@ uno::Reference<media::XPlayer> MediaWindowImpl::createPlayer(const OUString& rUR
return xPlayer;
}
- if (!pMimeType || *pMimeType == AVMEDIA_MIMETYPE_COMMON)
+ // currently there isn't anything else, throw any mime type to the media players
+ //if (!pMimeType || *pMimeType == AVMEDIA_MIMETYPE_COMMON)
{
uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext());
-
- static std::u16string_view aServiceManagers[] =
- {
- u"" AVMEDIA_MANAGER_SERVICE_PREFERRED,
- u"" AVMEDIA_MANAGER_SERVICE_NAME,
- };
-
- for (const auto& rServiceName : aServiceManagers)
- {
- xPlayer = createPlayer(rURL, OUString(rServiceName), xContext);
- if (xPlayer)
- break;
- }
+ if (Application::GetToolkitName() == "gtk4")
+ xPlayer = createPlayer(rURL, "com.sun.star.comp.avmedia.Manager_Gtk", xContext);
+ else
+ xPlayer = createPlayer(rURL, AVMEDIA_MANAGER_SERVICE_NAME, xContext);
}
return xPlayer;
@@ -306,6 +300,9 @@ void MediaWindowImpl::updateMediaItem( MediaItem& rItem ) const
void MediaWindowImpl::executeMediaItem( const MediaItem& rItem )
{
+ mpItem = &rItem;
+ comphelper::ScopeGuard g([this] { this->mpItem = nullptr; });
+
const AVMediaSetMask nMaskSet = rItem.getMaskSet();
// set URL first
@@ -401,7 +398,7 @@ void MediaWindowImpl::stopPlayingInternal(bool bStop)
void MediaWindowImpl::onURLChanged()
{
- if (m_sMimeType == AVMEDIA_MIMETYPE_COMMON)
+ //if (m_sMimeType == AVMEDIA_MIMETYPE_COMMON)
{
mpChildWindow.disposeAndClear();
mpChildWindow.reset(VclPtr<MediaChildWindow>::Create(this));
@@ -426,7 +423,9 @@ void MediaWindowImpl::onURLChanged()
uno::Sequence<uno::Any> aArgs{
uno::Any(nParentWindowHandle),
uno::Any(awt::Rectangle(aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height())),
- uno::Any(reinterpret_cast<sal_IntPtr>(mpChildWindow.get()))
+ uno::Any(reinterpret_cast<sal_IntPtr>(mpChildWindow.get())),
+ // Media item contains media properties, e.g. cropping.
+ uno::Any(reinterpret_cast<sal_IntPtr>(mpItem))
};
try