Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : */
9 :
10 : #include "oglplayer.hxx"
11 : #include "oglframegrabber.hxx"
12 : #include "oglwindow.hxx"
13 :
14 : #include <cppuhelper/supportsservice.hxx>
15 :
16 : using namespace com::sun::star;
17 :
18 : namespace avmedia { namespace ogl {
19 :
20 0 : OGLPlayer::OGLPlayer( const OUString& rUrl)
21 : : Player_BASE(m_aMutex)
22 0 : , m_sUrl(rUrl)
23 : {
24 0 : }
25 :
26 0 : OGLPlayer::~OGLPlayer()
27 : {
28 0 : }
29 :
30 0 : void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception )
31 : {
32 0 : osl::MutexGuard aGuard(m_aMutex);
33 : // TODO: Start playing of gltf model (see com::sun::star::media::XPlayer)
34 0 : }
35 :
36 0 : void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception )
37 : {
38 0 : osl::MutexGuard aGuard(m_aMutex);
39 : // TODO: Stop playing of gltf model (see com::sun::star::media::XPlayer)
40 0 : }
41 :
42 0 : sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception )
43 : {
44 0 : osl::MutexGuard aGuard(m_aMutex);
45 : // TODO: Check whether gltf model is played by now (see com::sun::star::media::XPlayer)
46 0 : return false;
47 : }
48 :
49 0 : double SAL_CALL OGLPlayer::getDuration() throw ( uno::RuntimeException, std::exception )
50 : {
51 0 : osl::MutexGuard aGuard(m_aMutex);
52 : // TODO: Get gltf's duration (see com::sun::star::media::XPlayer)
53 0 : return 0.0;
54 : }
55 :
56 0 : void SAL_CALL OGLPlayer::setMediaTime( double /*fTime*/ ) throw ( uno::RuntimeException, std::exception )
57 : {
58 0 : osl::MutexGuard aGuard(m_aMutex);
59 : // TODO: Set player to the specified point (see com::sun::star::media::XPlayer)
60 0 : }
61 :
62 0 : double SAL_CALL OGLPlayer::getMediaTime() throw ( ::com::sun::star::uno::RuntimeException, std::exception )
63 : {
64 0 : osl::MutexGuard aGuard(m_aMutex);
65 : // TODO: Get player current time position (see com::sun::star::media::XPlayer)
66 0 : return 0.0;
67 : }
68 :
69 0 : double SAL_CALL OGLPlayer::getRate() throw ( uno::RuntimeException, std::exception )
70 : {
71 0 : osl::MutexGuard aGuard(m_aMutex);
72 : // TODO: Get the speed of stream reading (see com::sun::star::media::XPlayer)
73 0 : return 1.0;
74 : }
75 :
76 0 : void SAL_CALL OGLPlayer::setPlaybackLoop( sal_Bool /*bSet*/ ) throw ( uno::RuntimeException, std::exception )
77 : {
78 0 : osl::MutexGuard aGuard(m_aMutex);
79 : // TODO: Set the playes replay itself when it ends (see com::sun::star::media::XPlayer)
80 0 : }
81 :
82 0 : sal_Bool SAL_CALL OGLPlayer::isPlaybackLoop() throw ( uno::RuntimeException, std::exception )
83 : {
84 0 : osl::MutexGuard aGuard(m_aMutex);
85 : // TODO: Check whether playing will restart after it ends (see com::sun::star::media::XPlayer)
86 0 : return false;
87 : }
88 :
89 0 : void SAL_CALL OGLPlayer::setVolumeDB( sal_Int16 /*nVolumDB*/ ) throw ( uno::RuntimeException, std::exception )
90 : {
91 0 : osl::MutexGuard aGuard(m_aMutex);
92 : // TODO: Set audio volume (see com::sun::star::media::XPlayer)
93 0 : }
94 :
95 0 : sal_Int16 SAL_CALL OGLPlayer::getVolumeDB() throw ( uno::RuntimeException, std::exception )
96 : {
97 0 : osl::MutexGuard aGuard(m_aMutex);
98 : // TODO: Get audio volume (see com::sun::star::media::XPlayer)
99 0 : return 0;
100 : }
101 :
102 0 : void SAL_CALL OGLPlayer::setMute( sal_Bool /*bSet*/ ) throw ( uno::RuntimeException, std::exception )
103 : {
104 0 : osl::MutexGuard aGuard(m_aMutex);
105 : // TODO: Set volume to 0 (see com::sun::star::media::XPlayer)
106 0 : }
107 :
108 0 : sal_Bool SAL_CALL OGLPlayer::isMute() throw ( uno::RuntimeException, std::exception )
109 : {
110 0 : osl::MutexGuard aGuard(m_aMutex);
111 : // TODO: Get whether volume is set to 0 by setMute (see com::sun::star::media::XPlayer)
112 0 : return false;
113 : }
114 :
115 0 : awt::Size SAL_CALL OGLPlayer::getPreferredPlayerWindowSize() throw ( uno::RuntimeException, std::exception )
116 : {
117 0 : return awt::Size( 480, 360 ); // TODO: It will be good for OpenGL too?
118 : }
119 :
120 0 : uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& /*aArguments*/ )
121 : throw ( uno::RuntimeException, std::exception )
122 : {
123 0 : osl::MutexGuard aGuard( m_aMutex );
124 0 : OGLWindow* pWindow = new OGLWindow(*this);
125 0 : return uno::Reference< media::XPlayerWindow >( pWindow );
126 : }
127 :
128 0 : uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
129 : throw ( uno::RuntimeException, std::exception )
130 : {
131 0 : osl::MutexGuard aGuard(m_aMutex);
132 0 : OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( m_sUrl );
133 0 : return uno::Reference< media::XFrameGrabber >( pFrameGrabber );;
134 : }
135 :
136 0 : OUString SAL_CALL OGLPlayer::getImplementationName()
137 : throw ( ::com::sun::star::uno::RuntimeException, std::exception )
138 : {
139 0 : return OUString("com.sun.star.comp.avmedia.Player_OpenGL");
140 : }
141 :
142 0 : sal_Bool SAL_CALL OGLPlayer::supportsService( const OUString& rServiceName )
143 : throw ( uno::RuntimeException, std::exception )
144 : {
145 0 : return cppu::supportsService(this, rServiceName);
146 : }
147 :
148 0 : uno::Sequence< OUString > SAL_CALL OGLPlayer::getSupportedServiceNames()
149 : throw ( uno::RuntimeException, std::exception )
150 : {
151 0 : uno::Sequence< OUString > aRet(1);
152 0 : aRet[0] = OUString("com.sun.star.media.Player_OpenGL");
153 0 : return aRet;
154 : }
155 :
156 : } // namespace ogl
157 : } // namespace avmedia
158 :
159 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|