merge the formfield patch from ooo-build
[ooovba.git] / avmedia / source / gstreamer / gstmanager.cxx
blob5b6cb15f83e23b35bab53fd2549850041d0645d9
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"
37 #include "gstplayer.hxx"
39 #include <tools/urlobj.hxx>
41 #define AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_GStreamer"
42 #define AVMEDIA_GST_MANAGER_SERVICENAME "com.sun.star.media.Manager"
44 #if DEBUG
45 #define DBG OSL_TRACE
46 #else
47 #define DBG(...)
48 #endif
50 using namespace ::com::sun::star;
52 namespace avmedia { namespace gstreamer {
53 // ----------------
54 // - Manager -
55 // ----------------
57 Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
58 mxMgr( rxMgr )
60 DBG( "avmediagst: Manager::Manager" );
63 // ------------------------------------------------------------------------------
65 Manager::~Manager()
69 // ------------------------------------------------------------------------------
71 uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL )
72 throw (uno::RuntimeException)
74 Player* pPlayer( new Player( mxMgr ) );
75 uno::Reference< media::XPlayer > xRet( pPlayer );
76 const INetURLObject aURL( rURL );
78 DBG( "avmediagst: Manager::createPlayer" );
80 if( !pPlayer->create( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
81 xRet = uno::Reference< media::XPlayer >();
83 return xRet;
86 // ------------------------------------------------------------------------------
88 ::rtl::OUString SAL_CALL Manager::getImplementationName( )
89 throw (uno::RuntimeException)
91 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME ) );
94 // ------------------------------------------------------------------------------
96 sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName )
97 throw (uno::RuntimeException)
99 return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_MANAGER_SERVICENAME ) );
102 // ------------------------------------------------------------------------------
104 uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames( )
105 throw (uno::RuntimeException)
107 uno::Sequence< ::rtl::OUString > aRet(1);
108 aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_MANAGER_SERVICENAME ) );
110 return aRet;
113 } // namespace gstreamer
114 } // namespace avmedia