[Libreoffice-commits] core.git: avmedia/Library_avmediagst.mk avmedia/Library_avmediavlc.mk avmedia/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 6 09:37:38 UTC 2020
avmedia/Library_avmediagst.mk | 1
avmedia/Library_avmediavlc.mk | 1
avmedia/source/gstreamer/avmediagstreamer.component | 5 -
avmedia/source/gstreamer/gstmanager.cxx | 14 ++-
avmedia/source/gstreamer/gstuno.cxx | 59 ---------------
avmedia/source/vlc/avmediavlc.component | 5 -
avmedia/source/vlc/vlcmanager.cxx | 22 ++++-
avmedia/source/vlc/vlcuno.cxx | 76 --------------------
8 files changed, 32 insertions(+), 151 deletions(-)
New commits:
commit 088b7f419f48f3390aac22587bbd92e9e027d5b1
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 6 09:16:18 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 6 11:36:54 2020 +0200
avmedia: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: Ibe3557a8d3be7c9af21a2b07e70252432ff12e0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98186
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/avmedia/Library_avmediagst.mk b/avmedia/Library_avmediagst.mk
index 7ed6cc451a24..699d0197b50e 100644
--- a/avmedia/Library_avmediagst.mk
+++ b/avmedia/Library_avmediagst.mk
@@ -38,7 +38,6 @@ $(eval $(call gb_Library_use_libraries,avmediagst,\
$(eval $(call gb_Library_add_exception_objects,avmediagst,\
avmedia/source/gstreamer/gstmanager \
avmedia/source/gstreamer/gstplayer \
- avmedia/source/gstreamer/gstuno \
avmedia/source/gstreamer/gstwindow \
avmedia/source/gstreamer/gstframegrabber \
))
diff --git a/avmedia/Library_avmediavlc.mk b/avmedia/Library_avmediavlc.mk
index 3db43315e67e..21640f91bbc7 100644
--- a/avmedia/Library_avmediavlc.mk
+++ b/avmedia/Library_avmediavlc.mk
@@ -42,7 +42,6 @@ $(eval $(call gb_Library_use_libraries,avmediavlc,\
$(eval $(call gb_Library_add_exception_objects,avmediavlc,\
avmedia/source/vlc/vlcmanager \
avmedia/source/vlc/vlcplayer \
- avmedia/source/vlc/vlcuno \
avmedia/source/vlc/vlcwindow \
avmedia/source/vlc/vlcframegrabber \
avmedia/source/vlc/wrapper/Instance \
diff --git a/avmedia/source/gstreamer/avmediagstreamer.component b/avmedia/source/gstreamer/avmediagstreamer.component
index 252ac899075f..cdc308d8bc27 100644
--- a/avmedia/source/gstreamer/avmediagstreamer.component
+++ b/avmedia/source/gstreamer/avmediagstreamer.component
@@ -8,8 +8,9 @@
*
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="avmediagst" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.media.Manager_GStreamer">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.media.Manager_GStreamer"
+ constructor="com_sun_star_comp_media_Manager_GStreamer_get_implementation">
<service name="com.sun.star.comp.avmedia.Manager_GStreamer"/>
</implementation>
</component>
diff --git a/avmedia/source/gstreamer/gstmanager.cxx b/avmedia/source/gstreamer/gstmanager.cxx
index 2b107e5c2dc5..bc7c917dc99d 100644
--- a/avmedia/source/gstreamer/gstmanager.cxx
+++ b/avmedia/source/gstreamer/gstmanager.cxx
@@ -24,9 +24,6 @@
#include <tools/urlobj.hxx>
-#define AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_GStreamer"
-#define AVMEDIA_GST_MANAGER_SERVICENAME "com.sun.star.media.Manager"
-
using namespace ::com::sun::star;
namespace avmedia::gstreamer {
@@ -53,7 +50,7 @@ uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const OUString&
OUString SAL_CALL Manager::getImplementationName( )
{
- return AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME;
+ return "com.sun.star.comp.avmedia.Manager_GStreamer";
}
sal_Bool SAL_CALL Manager::supportsService( const OUString& ServiceName )
@@ -63,9 +60,16 @@ sal_Bool SAL_CALL Manager::supportsService( const OUString& ServiceName )
uno::Sequence< OUString > SAL_CALL Manager::getSupportedServiceNames( )
{
- return { AVMEDIA_GST_MANAGER_SERVICENAME };
+ return { "com.sun.star.media.Manager" };
}
} // namespace
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_comp_media_Manager_GStreamer_get_implementation(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new avmedia::gstreamer::Manager());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx
deleted file mode 100644
index 2ca447d385fb..000000000000
--- a/avmedia/source/gstreamer/gstuno.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <mediamisc.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include "gstmanager.hxx"
-
-using namespace ::com::sun::star;
-
-
-// - factory methods -
-
-
-#define IMPL_NAME "com.sun.star.comp.media.Manager_GStreamer"
-#define SERVICE_NAME AVMEDIA_MANAGER_SERVICE_NAME // "com.sun.star.comp.avmedia.Manager_GStreamer"
-
-static uno::Reference< uno::XInterface > create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& )
-{
- return uno::Reference< uno::XInterface >( *new ::avmedia::gstreamer::Manager );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* avmediagst_component_getFactory( const char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
-{
- uno::Reference< lang::XSingleServiceFactory > xFactory;
- void* pRet = nullptr;
-
- if( rtl_str_compare( pImplName, IMPL_NAME ) == 0 )
- {
- xFactory.set( ::cppu::createSingleFactory(
- static_cast< lang::XMultiServiceFactory* >( pServiceManager ),
- IMPL_NAME, create_MediaPlayer, uno::Sequence< OUString > { SERVICE_NAME } ) );
- }
-
- if( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/vlc/avmediavlc.component b/avmedia/source/vlc/avmediavlc.component
index cbdba1d03578..595c3e8ef325 100644
--- a/avmedia/source/vlc/avmediavlc.component
+++ b/avmedia/source/vlc/avmediavlc.component
@@ -8,8 +8,9 @@
*
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="avmediavlc" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.media.Manager_VLC">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.media.Manager_VLC"
+ constructor="com_sun_star_comp_media_Manager_VLC_get_implementation">
<service name="com.sun.star.comp.avmedia.Manager_VLC"/>
</implementation>
</component>
diff --git a/avmedia/source/vlc/vlcmanager.cxx b/avmedia/source/vlc/vlcmanager.cxx
index 60c02b259fb0..bb916013ef4f 100644
--- a/avmedia/source/vlc/vlcmanager.cxx
+++ b/avmedia/source/vlc/vlcmanager.cxx
@@ -19,6 +19,7 @@
#include <wrapper/Media.hxx>
#include <wrapper/Player.hxx>
#include <wrapper/Common.hxx>
+#include <officecfg/Office/Common.hxx>
using namespace ::com::sun::star;
@@ -26,9 +27,6 @@ namespace avmedia::vlc {
namespace
{
- const OUString VLC_IMPLEMENTATION_NAME = "com.sun.star.comp.avmedia.Manager_VLC";
- const OUString VLC_SERVICENAME = "com.sun.star.media.Manager_VLC";
-
const char * const VLC_ARGS[] = {
"--demux",
"ffmpeg",
@@ -106,7 +104,7 @@ uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const OUString&
OUString SAL_CALL Manager::getImplementationName()
{
- return VLC_IMPLEMENTATION_NAME;
+ return "com.sun.star.comp.avmedia.Manager_VLC";
}
sal_Bool SAL_CALL Manager::supportsService( const OUString& serviceName )
@@ -116,9 +114,23 @@ sal_Bool SAL_CALL Manager::supportsService( const OUString& serviceName )
uno::Sequence< OUString > SAL_CALL Manager::getSupportedServiceNames()
{
- return { VLC_SERVICENAME };
+ return { "com.sun.star.media.Manager_VLC" };
}
} // end namespace
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_comp_media_Manager_VLC_get_implementation(
+ css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
+{
+ // Experimental for now - code is neither elegant nor well tested.
+ if (!officecfg::Office::Common::Misc::ExperimentalMode::get(context))
+ return nullptr;
+ static uno::Reference< uno::XInterface > manager( *new ::avmedia::vlc::Manager );
+ manager->acquire();
+ return manager.get();
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/vlc/vlcuno.cxx b/avmedia/source/vlc/vlcuno.cxx
deleted file mode 100644
index dba992eb9290..000000000000
--- a/avmedia/source/vlc/vlcuno.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/config.h>
-
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <comphelper/processfactory.hxx>
-#include <officecfg/Office/Common.hxx>
-#include <sal/log.hxx>
-
-#include "vlccommon.hxx"
-#include "vlcmanager.hxx"
-
-using namespace ::com::sun::star;
-
-#define IMPL_NAME "com.sun.star.comp.media.Manager_VLC"
-#define SERVICE_NAME "com.sun.star.comp.avmedia.Manager_VLC"
-
-static uno::Reference< uno::XInterface > create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& /*rxFact*/ )
-{
- SAL_INFO("avmedia", "create VLC Media player !");
-
- // Experimental for now - code is neither elegant nor well tested.
- uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
- if (!xContext.is() || !officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
- return nullptr;
-
- static uno::Reference< uno::XInterface > manager( *new ::avmedia::vlc::Manager );
- return manager;
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* avmediavlc_component_getFactory( const char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
-{
- uno::Reference< lang::XSingleServiceFactory > xFactory;
- void* pRet = nullptr;
-
- // Experimental for now - code is neither elegant nor well tested.
- uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
- if (!xContext.is() || !officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
- return nullptr;
-
- SAL_INFO("avmedia", "Create VLC Media component: " << pImplName);
- if( rtl_str_compare( pImplName, IMPL_NAME ) == 0 )
- {
- const OUString aServiceName( SERVICE_NAME );
- xFactory.set( ::cppu::createSingleFactory(
- static_cast< lang::XMultiServiceFactory* >( pServiceManager ),
- IMPL_NAME, create_MediaPlayer, uno::Sequence< OUString >( &aServiceName, 1 ) ) );
- }
-
- if( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list