chxavplayerstate.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:3k
- /************************************************************************
- * chxavplayerstate.h
- * ------------------
- *
- * Synopsis:
- * CHXAvPlayerState is helper class for CHXAvPlayer. It maintains player
- * state info and dispatches event notifications to observers. Observers
- * can use this to query for current player state info.
- *
- *
- * Target:
- * Symbian OS
- *
- *
- * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- ************************************************************************/
- #ifndef CHXAVPLAYERSTATE_H__
- #define CHXAVPLAYERSTATE_H__
- #include "unkimp.h"
- #include "hxstring.h"
- #include "ihxpckts.h"
- #include "hxurl.h"
- #include "hxfiles.h"
- //#include "chxavcallback.h"
- #include "chxavplayerstatedispatch.h"
-
- // class CHXAvPlayerState
- class CHXAvPlayerState
- {
- public:
- // main player states
- enum State
- {
- Stopped,
- Initiating,
- Connecting,
- Playing,
- Seeking,
- Paused
- };
- // buffering sub-state applies while playing, seeking, paused
- enum BufferState
- {
- NotBuffering,
- BufferLoad,
- BufferSeek,
- BufferPlain
- };
- public:
- CHXAvPlayerState();
- virtual ~CHXAvPlayerState();
- void ConstructL();
- public:
- State GetState() const;
- BufferState GetBufferingState() const;
- UINT16 GetLastBufferPercent() const;
- void RemoveObserver(IHXSymPlayerStateObserver *observer);
- void AddObserver(IHXSymPlayerStateObserver *observer);
- private:
- friend class CHXAvPlayer;
- // called by CHXAvPlayer
- void OnPlayInitiate(const char *url);
- void OnNetConnect();
- void OnLoadSession(IHXRequest *request);
- void OnResume();
- void OnStop();
- void OnPause();
- void OnBuffering(ULONG32 type, UINT16 percent);
- void OnBeginSeek();
- void OnNewPos(ULONG32 time);
- void OnVolume(unsigned int percentVol);
- void OnMute(bool bMute);
- void OnError(HX_RESULT code);
- void OnAdvancePlaylist();
- private:
- // implementation
- void ChangeState(State destState);
- void ChangeBufferState(BufferState destState);
- CHXAvPlayerStateDispatch* m_pDispatch;
- State m_state;
- BufferState m_bufferState;
- UINT16 m_lastBufferPercent;
- ULONG32 m_lastTime;
- //CHXAvCallback m_cbConnectStateTransition;
- };
- inline
- CHXAvPlayerState::State CHXAvPlayerState::GetState() const { return m_state; }
- inline
- CHXAvPlayerState::BufferState CHXAvPlayerState::GetBufferingState() const { return m_bufferState; }
- inline
- UINT16 CHXAvPlayerState::GetLastBufferPercent() const { return m_lastBufferPercent; }
- #endif // CHXAVPLAYERSTATE_H__