/wrt-plugins-common/src/modules/tizen/MMPlayer/MMPlayer.h
https://review.tizen.org/git/ · C Header · 138 lines · 62 code · 20 blank · 56 comment · 0 complexity · cfad46068a60ed9b79549048579c1856 MD5 · raw file
- /*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- #ifndef WRTDEVICEAPIS_MMPLAYER_MMPLAYER_H_
- #define WRTDEVICEAPIS_MMPLAYER_MMPLAYER_H_
- #include <mmf/mm.h>
- #include <mm_player.h>
- #include <dpl/shared_ptr.h>
- #include <dpl/mutex.h>
- #include <MMPlayer/IMMPlayer.h>
- #include <MMPlayer/MMPlayerFactory.h>
- #include <MMPlayer/EventOnStateChange.h>
- namespace WrtDeviceApis {
- namespace MMPlayer {
- /**
- * Event to send from callback when end of stream will be reported -> mm_player_stop should be executed
- */
- class EventOnEOS : public Commons::ListenerEvent<EventOnEOS>
- {
- };
- typedef DPL::SharedPtr<EventOnEOS> EventOnEOSPtr;
- typedef Commons::ListenerEventEmitter<EventOnEOS> EventOnEOSEmitter;
- typedef DPL::SharedPtr<EventOnEOSEmitter> EventOnEOSEmitterPtr;
- class MMPlayer :
- public Api::IMMPlayer,
- public Commons::EventListener<EventOnEOS>
- {
- friend class Api::MMPlayerFactory;
- public:
- typedef enum
- {
- STATE_OPENED,
- STATE_STOPPED,
- STATE_PLAYING,
- STATE_PAUSED,
- STATE_COMPLETED,
- STATE_UNDEFINED
- } MMPLAYER_STATES;
- private:
- MMHandleType m_player;
- MMPLAYER_STATES m_currentState;
- unsigned int m_repeatTimes;
- /**
- * MMPlayer constructor
- * \exception Commons::PlatformException when platform error occurs
- */
- explicit MMPlayer();
- public:
- /**
- * MMPlayer destructor
- */
- virtual ~MMPlayer();
- /**
- * Gets handler to platform player type
- */
- virtual MMHandleType getHandler() const;
- /**
- * @See Api::MMPlayer::IMMPlayer::setEmitter
- */
- virtual void setEmitter(
- const Api::EventOnStateChangeEmitterPtr& emitter);
- /**
- * @See Api::MMPlayer::IMMPlayer::getEmitter
- */
- Api::EventOnStateChangeEmitterPtr getEmitter();
- /**
- * @See Api::MMPlayer::IMMPlayer::clearEmitter
- */
- virtual void clearEmitter();
- /**
- * Gets player state
- */
- virtual MMPlayerStateType getState() const;
- /**
- * Used to recieve EventOnEOS
- */
- virtual void onAnswerReceived(const EventOnEOSPtr& event);
- virtual unsigned int getRepeatTimes() const;
- virtual void setRepeatTimes(unsigned int count);
- private:
- /**
- * Callback method called by platform when player state changes.
- * @param message Platform message
- * @param param Platform parameter
- * @param data User data.
- */
- static int onStateChange(int message,
- void* param,
- void* data);
- /**
- * Initialize player
- * @throw Commons::PlatformException when platform error occures
- */
- void init();
- /**
- * Finalize player
- */
- void finalize();
- DPL::Mutex m_emitterMtx;
- Api::EventOnStateChangeEmitterPtr m_onStateChangeEmitter;
- EventOnEOSEmitterPtr m_onEOSEmitter;
- };
- typedef DPL::SharedPtr<MMPlayer> MMPlayerPtr;
- }
- }
- #endif // WRTDEVICEAPIS_MMPLAYER_MMPLAYER_H_