merge the formfield patch from ooo-build
[ooovba.git] / avmedia / source / gstreamer / gstuno.cxx
blobe39d02339d02876992884f3ea03e46dd5e563b47
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile$
7 * $Revision$
9 * last change: $Author$ $Date$
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA
34 ************************************************************************/
36 #include "gstmanager.hxx"
38 using namespace ::com::sun::star;
40 // -------------------
41 // - factory methods -
42 // -------------------
44 static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact )
46 return uno::Reference< uno::XInterface >( *new ::avmedia::gstreamer::Manager( rxFact ) );
49 // ------------------------------------------
50 // - component_getImplementationEnvironment -
51 // ------------------------------------------
53 extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
55 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
58 // -----------------------
59 // - component_writeInfo -
60 // -----------------------
62 extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
64 sal_Bool bRet = sal_False;
66 if( pRegistryKey )
68 try
70 uno::Reference< registry::XRegistryKey > xNewKey1(
71 static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
72 ::rtl::OUString::createFromAscii( "/com.sun.star.comp.media.Manager_GStreamer/UNO/SERVICES/com.sun.star.media.Manager_GStreamer" ) ) );
74 bRet = sal_True;
76 catch( registry::InvalidRegistryException& )
78 OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
82 return bRet;
85 // ------------------------
86 // - component_getFactory -
87 // ------------------------
89 extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
91 uno::Reference< lang::XSingleServiceFactory > xFactory;
92 void* pRet = 0;
94 if( rtl_str_compare( pImplName, "com.sun.star.comp.media.Manager_GStreamer" ) == 0 )
96 const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_GStreamer" ) );
98 xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
99 reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
100 ::rtl::OUString::createFromAscii( "com.sun.star.comp.media.Manager_GStreamer" ),
101 create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
104 if( xFactory.is() )
106 xFactory->acquire();
107 pRet = xFactory.get();
110 return pRet;