diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-06 09:16:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-06 11:36:54 +0200 |
commit | 088b7f419f48f3390aac22587bbd92e9e027d5b1 (patch) | |
tree | 5ad204e898c7c74702c13e552b487e4bbc1d802d /avmedia/source/gstreamer | |
parent | 0a08f981a6de90f9b9b7b75dc79d5e9b8b6e2707 (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/source/gstreamer')
-rw-r--r-- | avmedia/source/gstreamer/avmediagstreamer.component | 5 | ||||
-rw-r--r-- | avmedia/source/gstreamer/gstmanager.cxx | 14 | ||||
-rw-r--r-- | avmedia/source/gstreamer/gstuno.cxx | 59 |
3 files changed, 12 insertions, 66 deletions
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: */ |