bump product version to 6.3.0.0.beta1
[LibreOffice.git] / avmedia / source / vlc / vlcuno.cxx
blobd894c1c1cdd03c5d0107ad95e6358a2eaeea450c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
22 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
23 #include <comphelper/processfactory.hxx>
24 #include <officecfg/Office/Common.hxx>
25 #include <sal/log.hxx>
27 #include "vlccommon.hxx"
28 #include "vlcmanager.hxx"
30 using namespace ::com::sun::star;
32 #define IMPL_NAME "com.sun.star.comp.media.Manager_VLC"
33 #define SERVICE_NAME "com.sun.star.comp.avmedia.Manager_VLC"
35 static uno::Reference< uno::XInterface > create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& /*rxFact*/ )
37 SAL_INFO("avmedia", "create VLC Media player !");
39 // Experimental for now - code is neither elegant nor well tested.
40 uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
41 if (!xContext.is() || !officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
42 return nullptr;
44 static uno::Reference< uno::XInterface > manager( *new ::avmedia::vlc::Manager );
45 return manager;
48 extern "C" SAL_DLLPUBLIC_EXPORT void* avmediavlc_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
50 uno::Reference< lang::XSingleServiceFactory > xFactory;
51 void* pRet = nullptr;
53 // Experimental for now - code is neither elegant nor well tested.
54 uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
55 if (!xContext.is() || !officecfg::Office::Common::Misc::ExperimentalMode::get(xContext))
56 return nullptr;
58 SAL_INFO("avmedia", "Create VLC Media component: " << pImplName);
59 if( rtl_str_compare( pImplName, IMPL_NAME ) == 0 )
61 const OUString aServiceName( SERVICE_NAME );
62 xFactory.set( ::cppu::createSingleFactory(
63 static_cast< lang::XMultiServiceFactory* >( pServiceManager ),
64 IMPL_NAME, create_MediaPlayer, uno::Sequence< OUString >( &aServiceName, 1 ) ) );
67 if( xFactory.is() )
69 xFactory->acquire();
70 pRet = xFactory.get();
73 return pRet;
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */