00001 // 00002 // CascadeMPEGPlayer.h - header file for class CascadeMPEGPlayer 00003 // 00004 // Copyright (c) 2003, Roku, LLC. All rights reserved. 00005 // 00008 00009 #ifndef _ROKU_INCLUDE_CASCADE_AV_CASCADEMPEGPLAYER_H 00010 #define _ROKU_INCLUDE_CASCADE_AV_CASCADEMPEGPLAYER_H 00011 00012 #include <cascade/app/CascadeAppMessageSink.h> 00013 #include <cascade/av/CascadeMPEGPlayerMessage.h> 00014 #include <cascade/av/CascadeMPEGFile.h> 00015 00026 00027 class CascadeMPEGPlayer : public CascadeAppMessageSink 00028 { 00029 public: 00030 CascadeMPEGPlayer(); 00034 virtual ~CascadeMPEGPlayer(); 00038 public: 00039 virtual bool OpenSession(u8 nPriority); 00040 // Call OpenSession() to open an mpeg playback session. 00041 // 00042 // nPriority is the priority of the session. 00043 // Only one session system-wide can be opened at a time. 00044 // If a session of higher priority is opened, any session 00045 // of lower priority is automatically aborted. 00046 // 1 is the highest priority; 255 is the lowest priority 00047 // 0 is reserved. 00048 00049 virtual bool CloseSession(); 00050 // CloseSession() closes a previously opened session. 00051 00052 virtual u32 QueueFile(CascadeMPEGFile & mpegFile, u32 nPlayCount); 00053 // QueueFile() queues a file for playback which will play nPlayCount 00054 // times before stopping. if nPlayCount is zero, the file will loop 00055 // indefinitely or until another file is queued (see below). 00056 // 00057 // NOTE: As soon as another file is queued it starts playing 00058 // whenever this file has reached its end (i.e. nPlayCount is treated 00059 // as if it is 1 whenever a subsequent file is queued). 00060 // 00061 // QueueFile() returns a file reference number which is used 00062 // in file status virtual member functions below 00063 00064 virtual bool Pause(); 00065 // Pause() pauses playback of the currently playing file. 00066 00067 virtual bool Resume(); 00068 // Resume() resumes playback of the currently playing file. 00069 00070 protected: 00071 typedef CascadeMPEGPlayerMessage::EndReason EndReason; 00072 00073 virtual void OnSessionAbort(); 00074 // OnSessionAbort() is called if your open session has been aborted 00075 // because someone else has opened a higher priority session. 00076 00077 virtual void OnPlaybackBegin(u32 nFileRef); 00078 // OnPlaybackBegin() is called when playback of a previously queued file starts 00079 00080 virtual void OnPlaybackEnd(u32 nFileRef, EndReason reason); 00081 // OnPlaybackEnd() is called when playback of a previously queued file ends (the end 00082 // of playback is reached) 00083 00084 virtual void OnPlaybackLoop(u32 nFileRef); 00085 // OnPlaybackLoop() is called when playback of a previously queued file loops 00086 00087 protected: 00088 CascadeMPEGPlayerMessage * SendMessage(const CascadeMPEGPlayerMessage & message); 00089 00090 private: 00091 virtual bool OnWormholeMessage(const CascadeMessage & message); 00092 00093 private: 00094 u32 m_nSessionID; 00095 }; 00096 00097 #endif // #ifndef _ROKU_INCLUDE_CASCADE_AV_CASCADEMPEGPLAYER_H 00098 00100 // LOG 00102 // 23-Oct-03 dwoodward created 00103 // 28-Oct-03 dwoodward added EndReason, OnPlaybackLoop 00104 // 08-Nov-03 dwoodward QueueFile now takes a CascadeMPEGFile not a CascadeFile