[Libreoffice-commits] core.git: avmedia/Library_avmediawin.mk avmedia/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 8 18:27:39 UTC 2020


 avmedia/Library_avmediawin.mk           |    1 
 avmedia/source/win/avmediawin.component |    3 +
 avmedia/source/win/framegrabber.cxx     |    3 -
 avmedia/source/win/framegrabber.hxx     |    5 --
 avmedia/source/win/manager.cxx          |   18 +++++----
 avmedia/source/win/manager.hxx          |    5 --
 avmedia/source/win/player.cxx           |    7 +--
 avmedia/source/win/player.hxx           |    4 --
 avmedia/source/win/window.cxx           |    3 -
 avmedia/source/win/window.hxx           |    5 --
 avmedia/source/win/winuno.cxx           |   59 --------------------------------
 11 files changed, 21 insertions(+), 92 deletions(-)

New commits:
commit 8876a037a657ec61d29c2951ae910a2e56e16840
Author:     Noel Grandin <noel at peralex.com>
AuthorDate: Wed Jul 8 16:02:42 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 8 20:26:46 2020 +0200

    avmedia/win: create instances with uno constructors
    
    See tdf#74608 for motivation
    
    Change-Id: I3a4afa5e583ad5b6339d4cf0036e1dc562274864
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98379
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/avmedia/Library_avmediawin.mk b/avmedia/Library_avmediawin.mk
index 09453d6c77ba..320ba2b36073 100644
--- a/avmedia/Library_avmediawin.mk
+++ b/avmedia/Library_avmediawin.mk
@@ -42,7 +42,6 @@ $(eval $(call gb_Library_add_exception_objects,avmediawin,\
 	avmedia/source/win/manager \
 	avmedia/source/win/player \
 	avmedia/source/win/window \
-	avmedia/source/win/winuno \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/avmedia/source/win/avmediawin.component b/avmedia/source/win/avmediawin.component
index 3874439f4fc0..00a25c0c6dca 100644
--- a/avmedia/source/win/avmediawin.component
+++ b/avmedia/source/win/avmediawin.component
@@ -19,7 +19,8 @@
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     prefix="avmediawin" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.avmedia.Manager_DirectX">
+  <implementation name="com.sun.star.comp.avmedia.Manager_DirectX"
+    constructor="avmedia_Manager_DirectX_get_implementation">
     <service name="com.sun.star.media.Manager_DirectX"/>
   </implementation>
 </component>
diff --git a/avmedia/source/win/framegrabber.cxx b/avmedia/source/win/framegrabber.cxx
index 21b5dede6866..3b03c68e4e67 100644
--- a/avmedia/source/win/framegrabber.cxx
+++ b/avmedia/source/win/framegrabber.cxx
@@ -47,8 +47,7 @@ using namespace ::com::sun::star;
 namespace avmedia::win {
 
 
-FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
-    mxMgr( rxMgr )
+FrameGrabber::FrameGrabber()
 {
     ::CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED );
 }
diff --git a/avmedia/source/win/framegrabber.hxx b/avmedia/source/win/framegrabber.hxx
index aa5b8945e878..fb4fda35905d 100644
--- a/avmedia/source/win/framegrabber.hxx
+++ b/avmedia/source/win/framegrabber.hxx
@@ -31,8 +31,7 @@ class FrameGrabber : public ::cppu::WeakImplHelper< css::media::XFrameGrabber,
                                                     css::lang::XServiceInfo >
 {
 public:
-
-    explicit FrameGrabber( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMgr );
+    explicit FrameGrabber();
     ~FrameGrabber() override;
 
     bool    create( const OUString& rURL );
@@ -46,8 +45,6 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
 
 private:
-
-    css::uno::Reference< css::lang::XMultiServiceFactory >    mxMgr;
     OUString                                                  maURL;
 };
 
diff --git a/avmedia/source/win/manager.cxx b/avmedia/source/win/manager.cxx
index 3615850a7cf3..731effd5f80f 100644
--- a/avmedia/source/win/manager.cxx
+++ b/avmedia/source/win/manager.cxx
@@ -23,15 +23,11 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <tools/urlobj.hxx>
 
-#define AVMEDIA_WIN_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_DirectX"
-#define AVMEDIA_WIN_MANAGER_SERVICENAME "com.sun.star.media.Manager"
-
 using namespace ::com::sun::star;
 
 namespace avmedia::win {
 
-Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
-    mxMgr( rxMgr )
+Manager::Manager()
 {
 }
 
@@ -43,7 +39,7 @@ Manager::~Manager()
 
 uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const OUString& rURL )
 {
-    Player*                             pPlayer( new Player( mxMgr ) );
+    Player*                             pPlayer( new Player() );
     uno::Reference< media::XPlayer >    xRet( pPlayer );
     const INetURLObject                 aURL( rURL );
 
@@ -56,7 +52,7 @@ uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const OUString&
 
 OUString SAL_CALL Manager::getImplementationName(  )
 {
-    return AVMEDIA_WIN_MANAGER_IMPLEMENTATIONNAME;
+    return "com.sun.star.comp.avmedia.Manager_DirectX";
 }
 
 
@@ -68,10 +64,16 @@ sal_Bool SAL_CALL Manager::supportsService( const OUString& ServiceName )
 
 uno::Sequence< OUString > SAL_CALL Manager::getSupportedServiceNames(  )
 {
-    return { AVMEDIA_WIN_MANAGER_SERVICENAME };
+    return { "com.sun.star.media.Manager" };
 }
 
 } // namespace avmedia::win
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+avmedia_Manager_DirectX_get_implementation(
+    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
+{
+    return cppu::acquire(new avmedia::win::Manager());
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/win/manager.hxx b/avmedia/source/win/manager.hxx
index 77d1ce6ef815..8742103c4652 100644
--- a/avmedia/source/win/manager.hxx
+++ b/avmedia/source/win/manager.hxx
@@ -31,7 +31,7 @@ class Manager : public ::cppu::WeakImplHelper< css::media::XManager,
 {
 public:
 
-    explicit Manager( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMgr );
+    explicit Manager();
     ~Manager() override;
 
     // XManager
@@ -41,9 +41,6 @@ public:
     virtual OUString SAL_CALL getImplementationName(  ) override;
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) override;
-private:
-
-    css::uno::Reference< css::lang::XMultiServiceFactory > mxMgr;
 };
 
 } // namespace avmedia::win
diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx
index 8e08d9e53b90..b3e621cbc56d 100644
--- a/avmedia/source/win/player.cxx
+++ b/avmedia/source/win/player.cxx
@@ -61,9 +61,8 @@ static LRESULT CALLBACK MediaPlayerWndProc_2( HWND hWnd,UINT nMsg, WPARAM nPar1,
 }
 
 
-Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+Player::Player() :
     Player_BASE(m_aMutex),
-    mxMgr( rxMgr ),
     mpGB( nullptr ),
     mpOMF( nullptr ),
     mpMC( nullptr ),
@@ -410,7 +409,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co
 
     if( mpVW && aSize.Width > 0 && aSize.Height > 0 )
     {
-        ::avmedia::win::Window* pWindow = new ::avmedia::win::Window( mxMgr, *this );
+        ::avmedia::win::Window* pWindow = new ::avmedia::win::Window( *this );
 
         xRet = pWindow;
 
@@ -428,7 +427,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber(  )
 
     if( !maURL.isEmpty() )
     {
-        FrameGrabber* pGrabber = new FrameGrabber( mxMgr );
+        FrameGrabber* pGrabber = new FrameGrabber();
 
         xRet = pGrabber;
 
diff --git a/avmedia/source/win/player.hxx b/avmedia/source/win/player.hxx
index 3708513688f7..ed34981e96ae 100644
--- a/avmedia/source/win/player.hxx
+++ b/avmedia/source/win/player.hxx
@@ -54,7 +54,7 @@ class Player : public cppu::BaseMutex,
 {
 public:
 
-    explicit Player( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMgr );
+    explicit Player();
     ~Player() override;
 
     bool                create( const OUString& rURL );
@@ -91,8 +91,6 @@ public:
 
 private:
 
-    css::uno::Reference< css::lang::XMultiServiceFactory > mxMgr;
-
     OUString                maURL;
     IGraphBuilder*          mpGB;
     IBaseFilter*            mpOMF;
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx
index 995ddd92cba4..ad770dc691a2 100644
--- a/avmedia/source/win/window.cxx
+++ b/avmedia/source/win/window.cxx
@@ -97,8 +97,7 @@ static WNDCLASSW* lcl_getWndClass()
     return s_pWndClass;
 }
 
-Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Player& rPlayer ) :
-    mxMgr( rxMgr ),
+Window::Window( Player& rPlayer ) :
     maListeners( maMutex ),
     meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ),
     mrPlayer( rPlayer ),
diff --git a/avmedia/source/win/window.hxx b/avmedia/source/win/window.hxx
index a947c1717091..c13bd8b62ea4 100644
--- a/avmedia/source/win/window.hxx
+++ b/avmedia/source/win/window.hxx
@@ -41,8 +41,7 @@ class Window : public ::cppu::WeakImplHelper< css::media::XPlayerWindow,
 {
 public:
 
-            Window( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMgr,
-                    Player& rPlayer );
+            Window( Player& rPlayer );
             ~Window() override;
 
     bool    create( const css::uno::Sequence< css::uno::Any >& aArguments );
@@ -96,8 +95,6 @@ public:
 
 private:
 
-    css::uno::Reference< css::lang::XMultiServiceFactory > mxMgr;
-
     ::osl::Mutex                                maMutex;
     ::cppu::OMultiTypeInterfaceContainerHelper  maListeners;
     css::media::ZoomLevel                       meZoomLevel;
diff --git a/avmedia/source/win/winuno.cxx b/avmedia/source/win/winuno.cxx
deleted file mode 100644
index 90b1f3e405d9..000000000000
--- a/avmedia/source/win/winuno.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 "wincommon.hxx"
-#include "manager.hxx"
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace ::com::sun::star;
-
-
-// - factory methods -
-
-
-static uno::Reference< uno::XInterface > create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact )
-{
-    return uno::Reference< uno::XInterface >( *new ::avmedia::win::Manager( rxFact ) );
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* avmediawin_component_getFactory( const char* pImplName, void* pServiceManager, void* )
-{
-    uno::Reference< lang::XSingleServiceFactory > xFactory;
-    void*                                   pRet = nullptr;
-
-    if( rtl_str_compare( pImplName, "com.sun.star.comp.avmedia.Manager_DirectX" ) == 0 )
-    {
-        const OUString aServiceName( "com.sun.star.media.Manager_DirectX" );
-
-        xFactory.set( ::cppu::createSingleFactory(
-                        static_cast< lang::XMultiServiceFactory* >( pServiceManager ),
-                        "com.sun.star.comp.avmedia.Manager_DirectX",
-                        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