summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-06 09:16:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-06 11:36:54 +0200
commit088b7f419f48f3390aac22587bbd92e9e027d5b1 (patch)
tree5ad204e898c7c74702c13e552b487e4bbc1d802d /avmedia
parent0a08f981a6de90f9b9b7b75dc79d5e9b8b6e2707 (diff)
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@collabora.co.uk>
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/Library_avmediagst.mk1
-rw-r--r--avmedia/Library_avmediavlc.mk1
-rw-r--r--avmedia/source/gstreamer/avmediagstreamer.component5
-rw-r--r--avmedia/source/gstreamer/gstmanager.cxx14
-rw-r--r--avmedia/source/gstreamer/gstuno.cxx59
-rw-r--r--avmedia/source/vlc/avmediavlc.component5
-rw-r--r--avmedia/source/vlc/vlcmanager.cxx22
-rw-r--r--avmedia/source/vlc/vlcuno.cxx76
8 files changed, 32 insertions, 151 deletions
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: */