Update ooo320-m1
[ooovba.git] / applied_patches / 0387-avmedia-source-gstreamer-gstuno.cxx.diff
blob6a6b25ed0f4d4b8d0c5c5da40770f1c24149834c
1 --- /dev/null 2006-08-13 17:52:05.000000000 +0200
2 +++ avmedia/source/gstreamer/gstuno.cxx 2006-08-22 11:38:56.000000000 +0200
3 @@ -0,0 +1,111 @@
4 +/*************************************************************************
5 + *
6 + * OpenOffice.org - a multi-platform office productivity suite
7 + *
8 + * $RCSfile$
9 + *
10 + * $Revision$
11 + *
12 + * last change: $Author$ $Date$
13 + *
14 + * The Contents of this file are made available subject to
15 + * the terms of GNU Lesser General Public License Version 2.1.
16 + *
17 + *
18 + * GNU Lesser General Public License Version 2.1
19 + * =============================================
20 + * Copyright 2005 by Sun Microsystems, Inc.
21 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
22 + *
23 + * This library is free software; you can redistribute it and/or
24 + * modify it under the terms of the GNU Lesser General Public
25 + * License version 2.1, as published by the Free Software Foundation.
26 + *
27 + * This library is distributed in the hope that it will be useful,
28 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 + * Lesser General Public License for more details.
31 + *
32 + * You should have received a copy of the GNU Lesser General Public
33 + * License along with this library; if not, write to the Free Software
34 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
35 + * MA 02111-1307 USA
36 + *
37 + ************************************************************************/
39 +#include "gstmanager.hxx"
41 +using namespace ::com::sun::star;
43 +// -------------------
44 +// - factory methods -
45 +// -------------------
47 +static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact )
49 + return uno::Reference< uno::XInterface >( *new ::avmedia::gstreamer::Manager( rxFact ) );
52 +// ------------------------------------------
53 +// - component_getImplementationEnvironment -
54 +// ------------------------------------------
56 +extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
58 + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
61 +// -----------------------
62 +// - component_writeInfo -
63 +// -----------------------
65 +extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
67 + sal_Bool bRet = sal_False;
69 + if( pRegistryKey )
70 + {
71 + try
72 + {
73 + uno::Reference< registry::XRegistryKey > xNewKey1(
74 + static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
75 + ::rtl::OUString::createFromAscii( "/com.sun.star.comp.media.Manager_GStreamer/UNO/SERVICES/com.sun.star.media.Manager_GStreamer" ) ) );
77 + bRet = sal_True;
78 + }
79 + catch( registry::InvalidRegistryException& )
80 + {
81 + OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
82 + }
83 + }
85 + return bRet;
88 +// ------------------------
89 +// - component_getFactory -
90 +// ------------------------
92 +extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
94 + uno::Reference< lang::XSingleServiceFactory > xFactory;
95 + void* pRet = 0;
97 + if( rtl_str_compare( pImplName, "com.sun.star.comp.media.Manager_GStreamer" ) == 0 )
98 + {
99 + const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_GStreamer" ) );
101 + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
102 + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
103 + ::rtl::OUString::createFromAscii( "com.sun.star.comp.media.Manager_GStreamer" ),
104 + create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
107 + if( xFactory.is() )
109 + xFactory->acquire();
110 + pRet = xFactory.get();
113 + return pRet;