2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef WRTDEVICEAPIS_MMPLAYER_MMPLAYER_H_
17 #define WRTDEVICEAPIS_MMPLAYER_MMPLAYER_H_
20 #include <mm_player.h>
21 #include <dpl/shared_ptr.h>
22 #include <dpl/mutex.h>
23 #include <MMPlayer/IMMPlayer.h>
24 #include <MMPlayer/MMPlayerFactory.h>
25 #include <MMPlayer/EventOnStateChange.h>
27 namespace WrtDeviceApis {
30 * Event to send from callback when end of stream will be reported -> mm_player_stop should be executed
32 class EventOnEOS : public Commons::ListenerEvent<EventOnEOS>
36 typedef DPL::SharedPtr<EventOnEOS> EventOnEOSPtr;
37 typedef Commons::ListenerEventEmitter<EventOnEOS> EventOnEOSEmitter;
38 typedef DPL::SharedPtr<EventOnEOSEmitter> EventOnEOSEmitterPtr;
41 public Api::IMMPlayer,
42 public Commons::EventListener<EventOnEOS>
44 friend class Api::MMPlayerFactory;
58 MMHandleType m_player;
59 MMPLAYER_STATES m_currentState;
60 unsigned int m_repeatTimes;
63 * MMPlayer constructor
64 * \exception Commons::PlatformException when platform error occurs
75 * Gets handler to platform player type
77 virtual MMHandleType getHandler() const;
80 * @See Api::MMPlayer::IMMPlayer::setEmitter
82 virtual void setEmitter(
83 const Api::EventOnStateChangeEmitterPtr& emitter);
85 * @See Api::MMPlayer::IMMPlayer::getEmitter
87 Api::EventOnStateChangeEmitterPtr getEmitter();
89 * @See Api::MMPlayer::IMMPlayer::clearEmitter
91 virtual void clearEmitter();
96 virtual MMPlayerStateType getState() const;
99 * Used to recieve EventOnEOS
101 virtual void onAnswerReceived(const EventOnEOSPtr& event);
103 virtual unsigned int getRepeatTimes() const;
105 virtual void setRepeatTimes(unsigned int count);
109 * Callback method called by platform when player state changes.
110 * @param message Platform message
111 * @param param Platform parameter
112 * @param data User data.
114 static int onStateChange(int message,
120 * @throw Commons::PlatformException when platform error occures
128 DPL::Mutex m_emitterMtx;
129 Api::EventOnStateChangeEmitterPtr m_onStateChangeEmitter;
130 EventOnEOSEmitterPtr m_onEOSEmitter;
133 typedef DPL::SharedPtr<MMPlayer> MMPlayerPtr;
138 #endif // WRTDEVICEAPIS_MMPLAYER_MMPLAYER_H_