Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

879 lines
32 KiB

  1. // MediaBarPlayer.h
  2. #pragma once
  3. #ifndef __MEDIABARPLAYER_H_
  4. #define __MEDIABARPLAYER_H_
  5. #include "exdisp.h"
  6. #ifdef SINKWMP
  7. #include "wmp\wmp_i.c"
  8. #include "wmp\wmp.h"
  9. #include "wmp\wmpids.h"
  10. #endif
  11. #define MEDIACOMPLETE -1
  12. #define MEDIA_TRACK_FINISHED -2
  13. #define TRACK_CHANGE -3
  14. ////////////////////////////////////////////////////////////////
  15. // IMediaBar
  16. // {3AE35551-8362-49fc-BC4F-F5715BF4291E}
  17. static const IID IID_IMediaBar =
  18. { 0x3ae35551, 0x8362, 0x49fc, { 0xbc, 0x4f, 0xf5, 0x71, 0x5b, 0xf4, 0x29, 0x1e } };
  19. interface IMediaBar : public IUnknown
  20. {
  21. public:
  22. STDMETHOD(Notify)(long lReason) = 0;
  23. STDMETHOD(OnMediaError)(int iErrCode) = 0;
  24. };
  25. HRESULT CMediaBarPlayer_CreateInstance(REFIID riid, void ** ppvObj);
  26. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  27. //
  28. // DANGER !!! DANGER !!! DANGER !!! DANGER !!! DANGER !!! DANGER !!! DANGER !!! DANGER !!! DANGER !!!
  29. //
  30. // ISSUE: dilipk: till I find a way to include mstime.h without compile errors, explicitly declaring the interfaces
  31. // This is DANGEROUS because changes in mstime.idl could break media bar
  32. //
  33. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  34. /////////////////////////////////////////////////////////////////////////////
  35. // fwd declarations (See end of file for definitions)
  36. interface IMediaBarPlayer;
  37. interface ITIMEElement;
  38. interface ITIMEBodyElement;
  39. interface ITIMEMediaElement;
  40. interface ITIMEState;
  41. interface ITIMEElementCollection;
  42. interface ITIMEActiveElementCollection;
  43. interface ITIMEPlayList;
  44. interface ITIMEPlayItem;
  45. interface ITIMEMediaNative;
  46. EXTERN_C const IID IID_ITIMEMediaElement2;
  47. typedef enum _TimeState
  48. {
  49. TS_Inactive = 0,
  50. TS_Active = 1,
  51. TS_Cueing = 2,
  52. TS_Seeking = 3,
  53. TS_Holding = 4
  54. } TimeState;
  55. ////////////////////////////////////////////////////////////////////////////
  56. // MediaBarPlayer
  57. // {f810fb9c-5587-47f1-a7cb-838cc4ca979f}
  58. DEFINE_GUID(CLSID_MediaBarPlayer, 0xf810fb9c, 0x5587, 0x47f1, 0xa7, 0xcb, 0x83, 0x8c, 0xc4, 0xca, 0x97, 0x9f);
  59. // {0c84b786-af32-47bc-a904-d8ebae3d5f96}
  60. static const IID IID_IMediaBarPlayer =
  61. { 0x0c84b786, 0xaf32, 0x47bc, { 0xa9, 0x04, 0xd8, 0xeb, 0xae, 0x3d, 0x5f, 0x96 } };
  62. typedef enum _ProgressType
  63. {
  64. PT_Download = 0,
  65. PT_Buffering = 1,
  66. PT_None = 2
  67. } ProgressType;
  68. typedef enum _TrackType
  69. {
  70. TT_Next = 0,
  71. TT_Prev = 1,
  72. TT_None = 2
  73. } TrackType;
  74. interface
  75. __declspec(uuid("0c84b786-af32-47bc-a904-d8ebae3d5f96"))
  76. IMediaBarPlayer : public IUnknown
  77. {
  78. public:
  79. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_url(
  80. /* [retval][out] */ BSTR __RPC_FAR *url) = 0;
  81. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_url(
  82. /* [in] */ BSTR url) = 0;
  83. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_player(
  84. /* [retval][out] */ BSTR __RPC_FAR *player) = 0;
  85. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_type(
  86. /* [in] */ BSTR url) = 0;
  87. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_volume(
  88. /* [retval][out] */ double __RPC_FAR *volume) = 0;
  89. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_volume(
  90. /* [in] */ double volume) = 0;
  91. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mute(
  92. /* [retval][out] */ BOOL __RPC_FAR *mute) = 0;
  93. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_mute(
  94. /* [in] */ BOOL mute) = 0;
  95. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mediaElement(
  96. /* [retval][out] */ ITIMEMediaElement __RPC_FAR *__RPC_FAR *ppMediaElement) = 0;
  97. virtual HRESULT STDMETHODCALLTYPE Init(
  98. HWND hWnd,
  99. IMediaBar __RPC_FAR *pMediaBar) = 0;
  100. virtual HRESULT STDMETHODCALLTYPE DeInit( void) = 0;
  101. virtual HRESULT STDMETHODCALLTYPE Play( void) = 0;
  102. virtual HRESULT STDMETHODCALLTYPE Stop( void) = 0;
  103. virtual HRESULT STDMETHODCALLTYPE Pause( void) = 0;
  104. virtual HRESULT STDMETHODCALLTYPE Resume( void) = 0;
  105. virtual HRESULT STDMETHODCALLTYPE Seek(
  106. double Progress) = 0;
  107. virtual HRESULT STDMETHODCALLTYPE Resize(
  108. LONG* height, LONG* width, BOOL fClampMaxSizeToNaturalSize = TRUE) = 0;
  109. virtual HRESULT STDMETHODCALLTYPE GetVideoHwnd(
  110. HWND * pHwnd) = 0;
  111. virtual double STDMETHODCALLTYPE GetTrackTime( void ) = 0;
  112. virtual double STDMETHODCALLTYPE GetTrackLength( void ) = 0;
  113. virtual double STDMETHODCALLTYPE GetTrackProgress( void ) = 0;
  114. virtual HRESULT STDMETHODCALLTYPE GetBufProgress( double * pdblProg, ProgressType * ppt) = 0;
  115. virtual VARIANT_BOOL STDMETHODCALLTYPE isMuted( void ) = 0;
  116. virtual VARIANT_BOOL STDMETHODCALLTYPE isPaused( void ) = 0;
  117. virtual VARIANT_BOOL STDMETHODCALLTYPE isStopped( void ) = 0;
  118. virtual HRESULT STDMETHODCALLTYPE Next( void ) = 0;
  119. virtual HRESULT STDMETHODCALLTYPE Prev( void ) = 0;
  120. virtual LONG_PTR STDMETHODCALLTYPE GetPlayListItemCount( void ) = 0;
  121. virtual LONG_PTR STDMETHODCALLTYPE GetPlayListItemIndex( void ) = 0;
  122. virtual HRESULT STDMETHODCALLTYPE SetActiveTrack( long lIndex) = 0;
  123. virtual BOOL STDMETHODCALLTYPE IsPausePossible() = 0;
  124. virtual BOOL STDMETHODCALLTYPE IsSeekPossible() = 0;
  125. virtual BOOL STDMETHODCALLTYPE IsStreaming() = 0;
  126. virtual BOOL STDMETHODCALLTYPE IsPlayList( void ) = 0;
  127. virtual BOOL STDMETHODCALLTYPE IsSkippable() = 0;
  128. };
  129. //////////////////////////////////////////////////////////////////////////////////////
  130. // ITIMEElement
  131. interface ITIMEElement : public IDispatch
  132. {
  133. public:
  134. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accelerate(
  135. /* [retval][out] */ VARIANT *__MIDL_0010) = 0;
  136. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_accelerate(
  137. /* [in] */ VARIANT __MIDL_0011) = 0;
  138. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_autoReverse(
  139. /* [retval][out] */ VARIANT *__MIDL_0012) = 0;
  140. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_autoReverse(
  141. /* [in] */ VARIANT __MIDL_0013) = 0;
  142. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_begin(
  143. /* [retval][out] */ VARIANT *time) = 0;
  144. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_begin(
  145. /* [in] */ VARIANT time) = 0;
  146. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_decelerate(
  147. /* [retval][out] */ VARIANT *__MIDL_0014) = 0;
  148. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_decelerate(
  149. /* [in] */ VARIANT __MIDL_0015) = 0;
  150. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_dur(
  151. /* [retval][out] */ VARIANT *time) = 0;
  152. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_dur(
  153. /* [in] */ VARIANT time) = 0;
  154. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_end(
  155. /* [retval][out] */ VARIANT *time) = 0;
  156. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_end(
  157. /* [in] */ VARIANT time) = 0;
  158. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_fill(
  159. /* [retval][out] */ BSTR *f) = 0;
  160. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_fill(
  161. /* [in] */ BSTR f) = 0;
  162. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mute(
  163. /* [retval][out] */ VARIANT *b) = 0;
  164. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_mute(
  165. /* [in] */ VARIANT b) = 0;
  166. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_repeatCount(
  167. /* [retval][out] */ VARIANT *c) = 0;
  168. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_repeatCount(
  169. /* [in] */ VARIANT c) = 0;
  170. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_repeatDur(
  171. /* [retval][out] */ VARIANT *time) = 0;
  172. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_repeatDur(
  173. /* [in] */ VARIANT time) = 0;
  174. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_restart(
  175. /* [retval][out] */ BSTR *__MIDL_0016) = 0;
  176. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_restart(
  177. /* [in] */ BSTR __MIDL_0017) = 0;
  178. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_speed(
  179. /* [retval][out] */ VARIANT *speed) = 0;
  180. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_speed(
  181. /* [in] */ VARIANT speed) = 0;
  182. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_syncBehavior(
  183. /* [retval][out] */ BSTR *sync) = 0;
  184. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_syncBehavior(
  185. /* [in] */ BSTR sync) = 0;
  186. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_syncTolerance(
  187. /* [retval][out] */ VARIANT *tol) = 0;
  188. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_syncTolerance(
  189. /* [in] */ VARIANT tol) = 0;
  190. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_syncMaster(
  191. /* [retval][out] */ VARIANT *b) = 0;
  192. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_syncMaster(
  193. /* [in] */ VARIANT b) = 0;
  194. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_timeAction(
  195. /* [retval][out] */ BSTR *time) = 0;
  196. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_timeAction(
  197. /* [in] */ BSTR time) = 0;
  198. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_timeContainer(
  199. /* [retval][out] */ BSTR *__MIDL_0018) = 0;
  200. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_volume(
  201. /* [retval][out] */ VARIANT *val) = 0;
  202. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_volume(
  203. /* [in] */ VARIANT val) = 0;
  204. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_currTimeState(
  205. /* [retval][out] */ ITIMEState **TimeState) = 0;
  206. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_timeAll(
  207. /* [retval][out] */ ITIMEElementCollection **allColl) = 0;
  208. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_timeChildren(
  209. /* [retval][out] */ ITIMEElementCollection **childColl) = 0;
  210. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_timeParent(
  211. /* [retval][out] */ ITIMEElement **parent) = 0;
  212. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_isPaused(
  213. /* [retval][out] */ VARIANT_BOOL *b) = 0;
  214. virtual /* [id] */ HRESULT STDMETHODCALLTYPE beginElement( void) = 0;
  215. virtual /* [id] */ HRESULT STDMETHODCALLTYPE beginElementAt(
  216. /* [in] */ double parentTime) = 0;
  217. virtual /* [id] */ HRESULT STDMETHODCALLTYPE endElement( void) = 0;
  218. virtual /* [id] */ HRESULT STDMETHODCALLTYPE endElementAt(
  219. /* [in] */ double parentTime) = 0;
  220. virtual /* [id] */ HRESULT STDMETHODCALLTYPE pauseElement( void) = 0;
  221. virtual /* [id] */ HRESULT STDMETHODCALLTYPE resetElement( void) = 0;
  222. virtual /* [id] */ HRESULT STDMETHODCALLTYPE resumeElement( void) = 0;
  223. virtual /* [id] */ HRESULT STDMETHODCALLTYPE seekActiveTime(
  224. /* [in] */ double activeTime) = 0;
  225. virtual /* [id] */ HRESULT STDMETHODCALLTYPE seekSegmentTime(
  226. /* [in] */ double segmentTime) = 0;
  227. virtual /* [id] */ HRESULT STDMETHODCALLTYPE seekTo(
  228. /* [in] */ LONG repeatCount,
  229. /* [in] */ double segmentTime) = 0;
  230. virtual /* [id] */ HRESULT STDMETHODCALLTYPE documentTimeToParentTime(
  231. /* [in] */ double documentTime,
  232. /* [retval][out] */ double *parentTime) = 0;
  233. virtual /* [id] */ HRESULT STDMETHODCALLTYPE parentTimeToDocumentTime(
  234. /* [in] */ double parentTime,
  235. /* [retval][out] */ double *documentTime) = 0;
  236. virtual /* [id] */ HRESULT STDMETHODCALLTYPE parentTimeToActiveTime(
  237. /* [in] */ double parentTime,
  238. /* [retval][out] */ double *activeTime) = 0;
  239. virtual /* [id] */ HRESULT STDMETHODCALLTYPE activeTimeToParentTime(
  240. /* [in] */ double activeTime,
  241. /* [retval][out] */ double *parentTime) = 0;
  242. virtual /* [id] */ HRESULT STDMETHODCALLTYPE activeTimeToSegmentTime(
  243. /* [in] */ double activeTime,
  244. /* [retval][out] */ double *segmentTime) = 0;
  245. virtual /* [id] */ HRESULT STDMETHODCALLTYPE segmentTimeToActiveTime(
  246. /* [in] */ double segmentTime,
  247. /* [retval][out] */ double *activeTime) = 0;
  248. virtual /* [id] */ HRESULT STDMETHODCALLTYPE segmentTimeToSimpleTime(
  249. /* [in] */ double segmentTime,
  250. /* [retval][out] */ double *simpleTime) = 0;
  251. virtual /* [id] */ HRESULT STDMETHODCALLTYPE simpleTimeToSegmentTime(
  252. /* [in] */ double simpleTime,
  253. /* [retval][out] */ double *segmentTime) = 0;
  254. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_endSync(
  255. /* [retval][out] */ BSTR *es) = 0;
  256. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_endSync(
  257. /* [in] */ BSTR es) = 0;
  258. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_activeElements(
  259. /* [retval][out] */ ITIMEActiveElementCollection **activeColl) = 0;
  260. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hasMedia(
  261. /* [out][retval] */ VARIANT_BOOL *flag) = 0;
  262. virtual /* [id] */ HRESULT STDMETHODCALLTYPE nextElement( void) = 0;
  263. virtual /* [id] */ HRESULT STDMETHODCALLTYPE prevElement( void) = 0;
  264. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_updateMode(
  265. /* [retval][out] */ BSTR *updateMode) = 0;
  266. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_updateMode(
  267. /* [in] */ BSTR updateMode) = 0;
  268. };
  269. //////////////////////////////////////////////////////////////////////////////////////
  270. // ITIMEMediaElement
  271. extern "C" const IID IID_ITIMEMediaElement;
  272. interface ITIMEMediaElement : public ITIMEElement
  273. {
  274. public:
  275. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_clipBegin(
  276. /* [retval][out] */ VARIANT *time) = 0;
  277. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_clipBegin(
  278. /* [in] */ VARIANT time) = 0;
  279. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_clipEnd(
  280. /* [retval][out] */ VARIANT *time) = 0;
  281. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_clipEnd(
  282. /* [in] */ VARIANT time) = 0;
  283. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_player(
  284. /* [retval][out] */ VARIANT *id) = 0;
  285. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_player(
  286. /* [in] */ VARIANT id) = 0;
  287. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_src(
  288. /* [retval][out] */ VARIANT *url) = 0;
  289. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_src(
  290. /* [in] */ VARIANT url) = 0;
  291. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_type(
  292. /* [retval][out] */ VARIANT *mimetype) = 0;
  293. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_type(
  294. /* [in] */ VARIANT mimetype) = 0;
  295. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_abstract(
  296. /* [retval][out] */ BSTR *abs) = 0;
  297. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_author(
  298. /* [retval][out] */ BSTR *auth) = 0;
  299. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_copyright(
  300. /* [retval][out] */ BSTR *cpyrght) = 0;
  301. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hasAudio(
  302. /* [out][retval] */ VARIANT_BOOL *b) = 0;
  303. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hasVisual(
  304. /* [out][retval] */ VARIANT_BOOL *b) = 0;
  305. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mediaDur(
  306. /* [retval][out] */ double *dur) = 0;
  307. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mediaHeight(
  308. /* [retval][out] */ long *height) = 0;
  309. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mediaWidth(
  310. /* [retval][out] */ long *width) = 0;
  311. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_playerObject(
  312. /* [retval][out] */ IDispatch **ppDisp) = 0;
  313. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_playList(
  314. /* [retval][out] */ ITIMEPlayList **pPlayList) = 0;
  315. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_rating(
  316. /* [retval][out] */ BSTR *rate) = 0;
  317. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_title(
  318. /* [retval][out] */ BSTR *name) = 0;
  319. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hasPlayList(
  320. /* [retval][out] */ VARIANT_BOOL *b) = 0;
  321. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_canPause(
  322. /* [out][retval] */ VARIANT_BOOL *b) = 0;
  323. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_canSeek(
  324. /* [out][retval] */ VARIANT_BOOL *b) = 0;
  325. };
  326. //////////////////////////////////////////////////////////////////////////////////////
  327. // ITIMEMediaElement2
  328. interface ITIMEMediaElement2 : public ITIMEMediaElement
  329. {
  330. public:
  331. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_earliestMediaTime(
  332. /* [retval][out] */ VARIANT *earliestMediaTime) = 0;
  333. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_latestMediaTime(
  334. /* [retval][out] */ VARIANT *latestMediaTime) = 0;
  335. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_minBufferedMediaDur(
  336. /* [retval][out] */ VARIANT *minBufferedMediaDur) = 0;
  337. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_minBufferedMediaDur(
  338. /* [in] */ VARIANT minBufferedMediaDur) = 0;
  339. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_downloadTotal(
  340. /* [retval][out] */ VARIANT *downloadTotal) = 0;
  341. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_downloadCurrent(
  342. /* [retval][out] */ VARIANT *downloadCurrent) = 0;
  343. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_isStreamed(
  344. /* [retval][out] */ VARIANT_BOOL *b) = 0;
  345. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_bufferingProgress(
  346. /* [retval][out] */ VARIANT *bufferingProgress) = 0;
  347. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hasDownloadProgress(
  348. /* [retval][out] */ VARIANT_BOOL *b) = 0;
  349. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_downloadProgress(
  350. /* [retval][out] */ VARIANT *downloadProgress) = 0;
  351. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mimeType(
  352. /* [retval][out] */ BSTR *mimeType) = 0;
  353. virtual /* [id] */ HRESULT STDMETHODCALLTYPE seekToFrame(
  354. /* [in] */ long frameNr) = 0;
  355. virtual /* [id] */ HRESULT STDMETHODCALLTYPE decodeMimeType(
  356. /* [in] */ TCHAR *header,
  357. /* [in] */ long headerSize,
  358. /* [out] */ BSTR *mimeType) = 0;
  359. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_currentFrame(
  360. /* [retval][out] */ long *currFrame) = 0;
  361. };
  362. //////////////////////////////////////////////////////////////////////////////////////
  363. // ITIMEState
  364. interface ITIMEState : public IDispatch
  365. {
  366. public:
  367. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_activeDur(
  368. /* [out][retval] */ double *dur) = 0;
  369. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_activeTime(
  370. /* [out][retval] */ double *time) = 0;
  371. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_isActive(
  372. /* [out][retval] */ VARIANT_BOOL *active) = 0;
  373. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_isOn(
  374. /* [out][retval] */ VARIANT_BOOL *on) = 0;
  375. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_isPaused(
  376. /* [out][retval] */ VARIANT_BOOL *paused) = 0;
  377. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_isMuted(
  378. /* [out][retval] */ VARIANT_BOOL *muted) = 0;
  379. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parentTimeBegin(
  380. /* [out][retval] */ double *time) = 0;
  381. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parentTimeEnd(
  382. /* [out][retval] */ double *time) = 0;
  383. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_progress(
  384. /* [out][retval] */ double *progress) = 0;
  385. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_repeatCount(
  386. /* [out][retval] */ LONG *count) = 0;
  387. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_segmentDur(
  388. /* [out][retval] */ double *dur) = 0;
  389. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_segmentTime(
  390. /* [out][retval] */ double *time) = 0;
  391. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_simpleDur(
  392. /* [out][retval] */ double *dur) = 0;
  393. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_simpleTime(
  394. /* [out][retval] */ double *time) = 0;
  395. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_speed(
  396. /* [out][retval] */ float *speed) = 0;
  397. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_state(
  398. /* [out][retval] */ TimeState *timeState) = 0;
  399. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_stateString(
  400. /* [out][retval] */ BSTR *state) = 0;
  401. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_volume(
  402. /* [out][retval] */ float *vol) = 0;
  403. };
  404. //////////////////////////////////////////////////////////////////////////////////////
  405. // ITIMEBodyElement
  406. extern "C" const IID IID_ITIMEBodyElement;
  407. interface ITIMEBodyElement : public ITIMEElement
  408. {
  409. public:
  410. };
  411. //////////////////////////////////////////////////////////////////////////////////////
  412. // ITIMEPlayList
  413. interface ITIMEPlayList : public IDispatch
  414. {
  415. public:
  416. virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE put_activeTrack(
  417. /* [in] */ VARIANT vTrack) = 0;
  418. virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_activeTrack(
  419. /* [retval][out] */ ITIMEPlayItem **pPlayItem) = 0;
  420. virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_dur(
  421. double *dur) = 0;
  422. virtual /* [id] */ HRESULT STDMETHODCALLTYPE item(
  423. /* [in][defaultvalue] */ VARIANT varIndex,
  424. /* [retval][out] */ ITIMEPlayItem **pPlayItem) = 0;
  425. virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_length(
  426. /* [retval][out] */ long *p) = 0;
  427. virtual /* [hidden][restricted][propget][id] */ HRESULT STDMETHODCALLTYPE get__newEnum(
  428. /* [retval][out] */ IUnknown **p) = 0;
  429. virtual /* [id] */ HRESULT STDMETHODCALLTYPE nextTrack( void) = 0;
  430. virtual /* [id] */ HRESULT STDMETHODCALLTYPE prevTrack( void) = 0;
  431. };
  432. //////////////////////////////////////////////////////////////////////////////////////
  433. // ITIMEPlayItem
  434. interface ITIMEPlayItem : public IDispatch
  435. {
  436. public:
  437. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_abstract(
  438. /* [retval][out] */ BSTR *abs) = 0;
  439. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_author(
  440. /* [retval][out] */ BSTR *auth) = 0;
  441. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_copyright(
  442. /* [retval][out] */ BSTR *cpyrght) = 0;
  443. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_dur(
  444. /* [retval][out] */ double *dur) = 0;
  445. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_index(
  446. /* [retval][out] */ long *index) = 0;
  447. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_rating(
  448. /* [retval][out] */ BSTR *rate) = 0;
  449. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_src(
  450. /* [retval][out] */ BSTR *src) = 0;
  451. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_title(
  452. /* [retval][out] */ BSTR *title) = 0;
  453. virtual /* [id] */ HRESULT STDMETHODCALLTYPE setActive( void) = 0;
  454. };
  455. //////////////////////////////////////////////////////////////////////////////////////
  456. // ITIMEMediaNative
  457. const GUID IID_ITIMEMediaNative = {0x3e3535c0,0x445b,0x4ef4,{0x8a,0x38,0x4d,0x37,0x9c,0xbc,0x98,0x28}};
  458. interface ITIMEMediaNative : public IUnknown
  459. {
  460. public:
  461. virtual /* [hidden][id] */ HRESULT STDMETHODCALLTYPE seekActiveTrack(
  462. /* [in] */ double dblSeekTime) = 0;
  463. virtual /* [hidden][id][propget] */ HRESULT STDMETHODCALLTYPE get_activeTrackTime(
  464. /* [retval][out] */ double *dblActiveTrackTime) = 0;
  465. };
  466. ////////////////////////////////////////////////////////////////
  467. // CMediaBarPlayer
  468. class
  469. __declspec(uuid("210e94fa-5e4e-4580-aecb-f01abbf73de6"))
  470. CMediaBarPlayer :
  471. public CComObjectRootEx<CComSingleThreadModel>,
  472. public IMediaBarPlayer,
  473. public IPropertyNotifySink,
  474. public CComCoClass<CMediaBarPlayer, &CLSID_MediaBarPlayer>,
  475. // public IDispatchImpl<_WMPOCXEvents, &DIID__WMPOCXEvents, (CONST)&LIBID_WMPOCX>,
  476. public IDispatchImpl<DWebBrowserEvents2, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw>
  477. {
  478. public:
  479. CMediaBarPlayer();
  480. virtual ~CMediaBarPlayer();
  481. BEGIN_COM_MAP(CMediaBarPlayer)
  482. COM_INTERFACE_ENTRY(IMediaBarPlayer)
  483. COM_INTERFACE_ENTRY(IPropertyNotifySink)
  484. COM_INTERFACE_ENTRY(IDispatch)
  485. COM_INTERFACE_ENTRY_IID(DIID_DWebBrowserEvents2, IDispatch)
  486. #ifdef SINKWMP
  487. COM_INTERFACE_ENTRY_IID(DIID__WMPOCXEvents, IDispatch)
  488. #endif
  489. END_COM_MAP();
  490. /*
  491. DECLARE_REGISTRY(CLSID_MediaBarPlayer,
  492. LIBID __T(".MediaBarPlayer.1"),
  493. LIBID __T(".MediaBarPlayer"),
  494. 0,
  495. THREADFLAGS_BOTH);
  496. */
  497. ////////////////////////////////////////////////////////////////
  498. // IMediaBarPlayer
  499. STDMETHOD(put_url)(BSTR bstrUrl);
  500. STDMETHOD(get_url)(BSTR * pbstrUrl);
  501. STDMETHOD(get_player)(BSTR * pbstrPlayer);
  502. STDMETHOD(put_type)(BSTR bstrType);
  503. STDMETHOD(put_volume)(double dblVolume);
  504. STDMETHOD(get_volume)(double * pdblVolume);
  505. STDMETHOD(put_mute)(BOOL bMute);
  506. STDMETHOD(get_mute)(BOOL * pbMute);
  507. STDMETHOD(get_mediaElement)(ITIMEMediaElement ** ppMediaElem);
  508. STDMETHOD(Init)(HWND hwnd, IMediaBar * pMediaBar);
  509. STDMETHOD(DeInit)();
  510. STDMETHOD(Play)();
  511. STDMETHOD(Stop)();
  512. STDMETHOD(Pause)();
  513. STDMETHOD(Resume)();
  514. STDMETHOD(Seek)(double dblProgress);
  515. STDMETHOD(Resize)(LONG* lHeight, LONG* lWidth, BOOL fClampMaxSizeToNaturalSize = TRUE);
  516. STDMETHOD(GetVideoHwnd)(HWND * pHwnd);
  517. double STDMETHODCALLTYPE GetTrackTime();
  518. double STDMETHODCALLTYPE GetTrackLength();
  519. double STDMETHODCALLTYPE GetTrackProgress( void ) ;
  520. STDMETHOD(GetBufProgress)(double * pdblProg, ProgressType * ppt);
  521. VARIANT_BOOL STDMETHODCALLTYPE isMuted();
  522. VARIANT_BOOL STDMETHODCALLTYPE isPaused();
  523. VARIANT_BOOL STDMETHODCALLTYPE isStopped();
  524. STDMETHOD(Next)();
  525. STDMETHOD(Prev)();
  526. LONG_PTR STDMETHODCALLTYPE GetPlayListItemCount( void );
  527. LONG_PTR STDMETHODCALLTYPE GetPlayListItemIndex( void );
  528. HRESULT STDMETHODCALLTYPE SetActiveTrack(long lIndex);
  529. BOOL STDMETHODCALLTYPE IsPausePossible() ;
  530. BOOL STDMETHODCALLTYPE IsSeekPossible() ;
  531. BOOL STDMETHODCALLTYPE IsStreaming() ;
  532. BOOL STDMETHODCALLTYPE IsPlayList( void );
  533. BOOL STDMETHODCALLTYPE IsSkippable();
  534. ////////////////////////////////////////////////////////////////
  535. // IDispatch
  536. STDMETHODIMP Invoke(
  537. /* [in] */ DISPID dispIdMember,
  538. /* [in] */ REFIID riid,
  539. /* [in] */ LCID lcid,
  540. /* [in] */ WORD wFlags,
  541. /* [out][in] */ DISPPARAMS *pDispParams,
  542. /* [out] */ VARIANT *pVarResult,
  543. /* [out] */ EXCEPINFO *pExcepInfo,
  544. /* [out] */ UINT *puArgErr);
  545. ////////////////////////////////////////////////////////////////
  546. // IPropertyNotifySink
  547. STDMETHOD(OnChanged)(DISPID dispid);
  548. STDMETHOD(OnRequestEdit)(DISPID dispid) { return S_OK; }
  549. private:
  550. // *** Methods ***
  551. enum INVOKETYPE {IT_GET, IT_PUT, IT_METHOD};
  552. STDMETHOD(_CreateHost)(HWND hWnd);
  553. STDMETHOD(_DestroyHost)();
  554. STDMETHOD(_GetDocumentDispatch)(IDispatch ** ppDocDisp);
  555. STDMETHOD(_GetElementDispatch)(LPWSTR pstrElem, IDispatchEx ** ppDispEx);
  556. STDMETHOD(_GetMediaElement)(ITIMEMediaElement ** ppMediaElem);
  557. STDMETHOD(_GetBodyElement)(ITIMEBodyElement ** ppBodyaElem);
  558. STDMETHOD(_InvokeDocument)(LPWSTR pstrElem, INVOKETYPE it, LPWSTR pstrName, VARIANT * pvarArg);
  559. STDMETHOD(_OnDocumentComplete)();
  560. STDMETHOD(_OnMediaComplete)();
  561. STDMETHOD(_OnTrackChange)();
  562. STDMETHOD(_OnEnd)();
  563. STDMETHOD(_OnMediaError)(int iErrCode);
  564. STDMETHOD(_InitEventSink)();
  565. STDMETHOD(_DeInitEventSink)();
  566. STDMETHOD(_AttachPlayerEvents)(BOOL fAttach);
  567. STDMETHOD(_HookPropNotifies)();
  568. STDMETHOD(_UnhookPropNotifies)();
  569. STDMETHOD(_Navigate)(BSTR bstrUrl);
  570. STDMETHOD(_SetTrack)(TrackType tt);
  571. // ISSUE: dilipk: optimize this to check only the last reference stored since that would validate all others
  572. bool IsReady() { return (NULL != _spMediaElem.p)
  573. && (NULL != _spMediaElem2.p)
  574. && (NULL != _spBrowser.p)
  575. && (NULL != _spBodyElem.p)
  576. && (NULL != _spPlayerHTMLElem2.p); }
  577. // *** Data ***
  578. CComPtr<IWebBrowser2> _spBrowser;
  579. CComPtr<ITIMEMediaElement> _spMediaElem;
  580. CComPtr<ITIMEMediaElement2> _spMediaElem2;
  581. CComPtr<ITIMEBodyElement> _spBodyElem;
  582. CComPtr<IHTMLElement2> _spPlayerHTMLElem2;
  583. IMediaBar * _pMediaBar;
  584. DWORD _dwDocumentEventConPtCookie;
  585. DWORD _dwCookiePropNotify;
  586. CComPtr<IConnectionPoint> _spDocConPt;
  587. CComPtr<IConnectionPoint> _spPropNotifyCP;
  588. CComBSTR _sbstrType;
  589. CComBSTR _sbstrUrl;
  590. HWND _hwnd;
  591. #ifdef SINKWMP
  592. CComPtr<IDispatch> _spWMP;
  593. CComPtr<IConnectionPoint> _spWMPCP;
  594. DWORD _dwWMPCookie;
  595. HRESULT InitWMPSink();
  596. #endif
  597. HRESULT GetProp(IDispatch* pDispatch, OLECHAR* pwzProp, VARIANT* pvarResult, DISPPARAMS* pParams = NULL);
  598. HRESULT CallMethod(IDispatch* pDispatch, OLECHAR* pwzMethod, VARIANT* pvarResult = NULL, VARIANT* pvarArgument1 = NULL);
  599. };
  600. #endif // __MEDIABARPLAYER_H_