xref: /trunk/main/avmedia/source/win/manager.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include "manager.hxx"
29 #include "player.hxx"
30 
31 #include <tools/urlobj.hxx>
32 
33 #define AVMEDIA_WIN_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_DirectX"
34 #define AVMEDIA_WIN_MANAGER_SERVICENAME "com.sun.star.media.Manager"
35 
36 using namespace ::com::sun::star;
37 
38 namespace avmedia { namespace win {
39 // ----------------
40 // - Manager -
41 // ----------------
42 
43 Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
44     mxMgr( rxMgr )
45 {
46 }
47 
48 // ------------------------------------------------------------------------------
49 
50 Manager::~Manager()
51 {
52 }
53 
54 // ------------------------------------------------------------------------------
55 
56 uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL )
57     throw (uno::RuntimeException)
58 {
59     Player*                             pPlayer( new Player( mxMgr ) );
60     uno::Reference< media::XPlayer >    xRet( pPlayer );
61     const INetURLObject                 aURL( rURL );
62 
63     if( !pPlayer->create( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) )  )
64         xRet = uno::Reference< media::XPlayer >();
65 
66     return xRet;
67 }
68 
69 // ------------------------------------------------------------------------------
70 
71 ::rtl::OUString SAL_CALL Manager::getImplementationName(  )
72     throw (uno::RuntimeException)
73 {
74     return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_WIN_MANAGER_IMPLEMENTATIONNAME ) );
75 }
76 
77 // ------------------------------------------------------------------------------
78 
79 sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName )
80     throw (uno::RuntimeException)
81 {
82     return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_WIN_MANAGER_SERVICENAME ) );
83 }
84 
85 // ------------------------------------------------------------------------------
86 
87 uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames(  )
88     throw (uno::RuntimeException)
89 {
90     uno::Sequence< ::rtl::OUString > aRet(1);
91     aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_WIN_MANAGER_SERVICENAME ) );
92 
93     return aRet;
94 }
95 
96 } // namespace win
97 } // namespace avmedia
98