Leaked source code of windows server 2003
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.

690 lines
30 KiB

  1. /*************************************************************************/
  2. /* Copyright (C) 1999 Microsoft Corporation */
  3. /* File: msdvd.h */
  4. /* Description: Declaration of CMSWebDVD */
  5. /* Author: David Janecek */
  6. /*************************************************************************/
  7. #ifndef __MSWEBDVD_H_
  8. #define __MSWEBDVD_H_
  9. #include "resource.h" // main symbols
  10. #include <atlctl.h>
  11. #include <streams.h>
  12. #include <dvdevcod.h>
  13. #include "MSWebDVD.h"
  14. #include "MSWebDVDCP.h"
  15. #include "MSDVDAdm.h"
  16. #include "ThunkProc.h" // for template for MSDVD timer
  17. #include "MSLCID.h"
  18. #include "mediahndlr.h"
  19. //
  20. // Special user message used by the app for event notification
  21. //
  22. #define WM_DVDPLAY_EVENT (WM_USER+101)
  23. #define NO_STOP (-1)
  24. #define RECTWIDTH(lpRect) ((lpRect)->right - (lpRect)->left)
  25. #define RECTHEIGHT(lpRect) ((lpRect)->bottom - (lpRect)->top)
  26. #define UNDEFINED_COLORKEY_COLOR 0xff000000
  27. #define MAGENTA_COLOR_KEY 0x00ff00ff
  28. #define DEFAULT_COLOR_KEY 0x00100010
  29. #define DEFAULT_BACK_COLOR 0x00100010
  30. #define OCR_ARROW_DEFAULT 100
  31. /////////////////////////////////////////////////////////////////////////////////
  32. // copied from vpinfo.h which is a private header
  33. #if defined(CCHDEVICENAME)
  34. #define AMCCHDEVICENAME CCHDEVICENAME
  35. #else
  36. #define AMCCHDEVICENAME 32
  37. #endif
  38. #define AMCCHDEVICEDESCRIPTION 256
  39. #define AMDDRAWMONITORINFO_PRIMARY_MONITOR 0x0001
  40. typedef struct {
  41. GUID* lpGUID; // is NULL if the default DDraw device
  42. GUID GUID; // otherwise points to this GUID
  43. } AMDDRAWGUID;
  44. typedef struct {
  45. AMDDRAWGUID guid;
  46. RECT rcMonitor;
  47. HMONITOR hMon;
  48. DWORD dwFlags;
  49. char szDevice[AMCCHDEVICENAME];
  50. char szDescription[AMCCHDEVICEDESCRIPTION];
  51. DDCAPS_DX3 ddHWCaps;
  52. } AMDDRAWMONITORINFO;
  53. DECLARE_INTERFACE_(IAMSpecifyDDrawConnectionDevice, IUnknown)
  54. {
  55. // Use this method on a Multi-Monitor system to specify to the overlay
  56. // mixer filter which Direct Draw driver should be used when connecting
  57. // to an upstream decoder filter.
  58. //
  59. STDMETHOD (SetDDrawGUID)(THIS_
  60. /* [in] */ const AMDDRAWGUID *lpGUID
  61. ) PURE;
  62. // Use this method to determine the direct draw object that will be used when
  63. // connecting the overlay mixer filter to an upstream decoder filter.
  64. //
  65. STDMETHOD (GetDDrawGUID)(THIS_
  66. /* [out] */ AMDDRAWGUID *lpGUID
  67. ) PURE;
  68. // Use this method on a multi-monitor system to specify to the
  69. // overlay mixer filter the default Direct Draw device to use when
  70. // connecting to an upstream filter. The default direct draw device
  71. // can be overriden for a particular connection by SetDDrawGUID method
  72. // described above.
  73. //
  74. STDMETHOD (SetDefaultDDrawGUID)(THIS_
  75. /* [in] */ const AMDDRAWGUID *lpGUID
  76. ) PURE;
  77. // Use this method on a multi-monitor system to determine which
  78. // is the default direct draw device the overlay mixer filter
  79. // will use when connecting to an upstream filter.
  80. //
  81. STDMETHOD (GetDefaultDDrawGUID)(THIS_
  82. /* [out] */ AMDDRAWGUID *lpGUID
  83. ) PURE;
  84. // Use this method to get a list of Direct Draw device GUIDs and thier
  85. // associated monitor information that the overlay mixer can use when
  86. // connecting to an upstream decoder filter.
  87. //
  88. // The method allocates and returns an array of AMDDRAWMONITORINFO
  89. // structures, the caller of function is responsible for freeing this
  90. // memory when it is no longer needed via CoTaskMemFree.
  91. //
  92. STDMETHOD (GetDDrawGUIDs)(THIS_
  93. /* [out] */ LPDWORD lpdwNumDevices,
  94. /* [out] */ AMDDRAWMONITORINFO** lplpInfo
  95. ) PURE;
  96. };
  97. typedef struct {
  98. long lHeight; // in pels
  99. long lWidth; // in pels
  100. long lBitsPerPel; // Usually 16 but could be 12 for the YV12 format
  101. long lAspectX; // X aspect ratio
  102. long lAspectY; // Y aspect ratio
  103. long lStride; // stride in bytes
  104. DWORD dwFourCC; // YUV type code ie. 'YUY2', 'YV12' etc
  105. DWORD dwFlags; // Flag used to further describe the image
  106. DWORD dwImageSize; // Size of the bImage array in bytes, which follows this
  107. // data structure
  108. // BYTE bImage[dwImageSize];
  109. } YUV_IMAGE;
  110. #define DM_BOTTOMUP_IMAGE 0x00001
  111. #define DM_TOPDOWN_IMAGE 0x00002
  112. #define DM_FIELD_IMAGE 0x00004
  113. #define DM_FRAME_IMAGE 0x00008
  114. DECLARE_INTERFACE_(IDDrawNonExclModeVideo , IDDrawExclModeVideo )
  115. {
  116. //
  117. // Call this function to capture the current image being displayed
  118. // by the overlay mixer. It is not always possible to capture the
  119. // current frame, for example MoComp may be in use. Applications
  120. // should always call IsImageCaptureSupported (see below) before
  121. // calling this function.
  122. //
  123. STDMETHOD (GetCurrentImage)(THIS_
  124. /* [out] */ YUV_IMAGE** lplpImage
  125. ) PURE;
  126. STDMETHOD (IsImageCaptureSupported)(THIS_
  127. ) PURE;
  128. //
  129. // On a multi-monitor system, applications call this function when they
  130. // detect that the playback rectangle has moved to a different monitor.
  131. // This call has no effect on a single monitor system.
  132. //
  133. STDMETHOD (ChangeMonitor)(THIS_
  134. /* [in] */ HMONITOR hMonitor,
  135. /* [in] */ LPDIRECTDRAW pDDrawObject,
  136. /* [in] */ LPDIRECTDRAWSURFACE pDDrawSurface
  137. ) PURE;
  138. //
  139. // When an application receives a WM_DISPLAYCHANGE message it should
  140. // call this function to allow the OVMixer to recreate DDraw surfaces
  141. // suitable for the new display mode. The application itself must re-create
  142. // the new DDraw object and primary surface passed in the call.
  143. //
  144. STDMETHOD (DisplayModeChanged)(THIS_
  145. /* [in] */ HMONITOR hMonitor,
  146. /* [in] */ LPDIRECTDRAW pDDrawObject,
  147. /* [in] */ LPDIRECTDRAWSURFACE pDDrawSurface
  148. ) PURE;
  149. //
  150. // Applications should continually check that the primary surface passed
  151. // to the OVMixer does not become "lost", ie. the user entered a Dos box or
  152. // pressed Alt-Ctrl-Del. When "surface loss" is detected the application should
  153. // call this function so that the OVMixer can restore the surfaces used for
  154. // video playback.
  155. //
  156. STDMETHOD (RestoreSurfaces)(THIS_
  157. ) PURE;
  158. };
  159. ////////////////////////////////////////////////////////////////////////////////////
  160. /*************************************************************************/
  161. /* Local Defines to sort of abstract the implementation and make the */
  162. /* changes bit more convinient. */
  163. /*************************************************************************/
  164. #define INITIALIZE_GRAPH_IF_NEEDS_TO_BE \
  165. { \
  166. hr = RenderGraphIfNeeded(); \
  167. if(FAILED(hr)){ \
  168. \
  169. throw(hr); \
  170. }/* end of if statement */ \
  171. }
  172. #define RETRY_IF_IN_FPDOM(func) \
  173. { \
  174. hr = (func); \
  175. if((VFW_E_DVD_INVALIDDOMAIN == hr || \
  176. VFW_E_DVD_OPERATION_INHIBITED == hr)){ \
  177. if(SUCCEEDED(PassFP_DOM())){ \
  178. \
  179. hr = (func); \
  180. }/* end of if statement */ \
  181. }/* end of if statement */ \
  182. if(FAILED(hr)){ \
  183. RestoreGraphState(); \
  184. }/* end of if statement */ \
  185. }
  186. #define INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY \
  187. { \
  188. hr = Play(); /* put in the play mode*/ \
  189. \
  190. if(FAILED(hr)){ \
  191. \
  192. throw(hr); \
  193. }/* end of if statement */ \
  194. }
  195. class CDDrawDVD;
  196. class COverlayCallback;
  197. /////////////////////////////////////////////////////////////////////////////
  198. // CMSWebDVD
  199. class ATL_NO_VTABLE CMSWebDVD :
  200. public CComObjectRootEx<CComSingleThreadModel>,
  201. public CStockPropImpl<CMSWebDVD, IMSWebDVD, &IID_IMSWebDVD, &LIBID_MSWEBDVDLib>,
  202. public IPropertyNotifySinkCP<CMSWebDVD>,
  203. public CComControl<CMSWebDVD>,
  204. public IPersistStreamInitImpl<CMSWebDVD>,
  205. public IOleControlImpl<CMSWebDVD>,
  206. public IOleObjectImpl<CMSWebDVD>,
  207. public IOleInPlaceActiveObjectImpl<CMSWebDVD>,
  208. public IViewObjectExImpl<CMSWebDVD>,
  209. public IOleInPlaceObjectWindowlessImpl<CMSWebDVD>,
  210. public IPersistStorageImpl<CMSWebDVD>,
  211. public ISpecifyPropertyPagesImpl<CMSWebDVD>,
  212. public IDataObjectImpl<CMSWebDVD>,
  213. public IProvideClassInfo2Impl<&CLSID_MSWebDVD, &DIID__IMSWebDVD, &LIBID_MSWEBDVDLib>,
  214. public CComCoClass<CMSWebDVD, &CLSID_MSWebDVD>,
  215. public IObjectSafety,
  216. public ISupportErrorInfo,
  217. public IPersistPropertyBagImpl<CMSWebDVD>,
  218. public CProxy_IMSWebDVD< CMSWebDVD >,
  219. #ifdef _WMP
  220. public IWMPUIPluginImpl<CMSWebDVD>,
  221. public IWMPUIPluginEventsImpl,
  222. #endif
  223. public IConnectionPointContainerImpl<CMSWebDVD>,
  224. public IObjectWithSiteImplSec<CMSWebDVD>,
  225. public CMSDVDTimer<CMSWebDVD>
  226. {
  227. public:
  228. CMSWebDVD();
  229. virtual ~CMSWebDVD();
  230. //DECLARE_CLASSFACTORY_SINGLETON(CMSWebDVD)
  231. DECLARE_REGISTRY_RESOURCEID(IDR_MSWEBDVD)
  232. DECLARE_PROTECT_FINAL_CONSTRUCT()
  233. BEGIN_COM_MAP(CMSWebDVD)
  234. COM_INTERFACE_ENTRY(IMSWebDVD)
  235. COM_INTERFACE_ENTRY(IDispatch)
  236. COM_INTERFACE_ENTRY(IViewObjectEx)
  237. COM_INTERFACE_ENTRY(IViewObject2)
  238. COM_INTERFACE_ENTRY(IViewObject)
  239. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  240. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  241. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  242. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  243. COM_INTERFACE_ENTRY(IOleControl)
  244. COM_INTERFACE_ENTRY(IOleObject)
  245. COM_INTERFACE_ENTRY(IPersistStreamInit)
  246. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  247. COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
  248. COM_INTERFACE_ENTRY(IPersistStorage)
  249. COM_INTERFACE_ENTRY(IDataObject)
  250. COM_INTERFACE_ENTRY(IProvideClassInfo)
  251. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  252. COM_INTERFACE_ENTRY_IMPL(IPersistPropertyBag)
  253. COM_INTERFACE_ENTRY(IObjectSafety)
  254. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  255. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  256. COM_INTERFACE_ENTRY(IObjectWithSite)
  257. END_COM_MAP()
  258. BEGIN_PROP_MAP(CMSWebDVD)
  259. PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  260. PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  261. PROP_ENTRY("DisableAutoMouseProcessing", 70, CLSID_NULL)
  262. PROP_ENTRY("BackColor", DISPID_BACKCOLOR, CLSID_StockColorPage)
  263. PROP_ENTRY("EnableResetOnStop", 66, CLSID_NULL)
  264. PROP_ENTRY("ColorKey", 58, CLSID_NULL)
  265. PROP_ENTRY("WindowlessActivation", 69, CLSID_NULL)
  266. #if 0
  267. PROP_ENTRY("ToolTip", 92, CLSID_NULL)
  268. PROP_ENTRY("ToolTipMaxWidth", 95, CLSID_NULL)
  269. #endif
  270. END_PROP_MAP()
  271. BEGIN_CONNECTION_POINT_MAP(CMSWebDVD)
  272. CONNECTION_POINT_ENTRY(DIID__IMSWebDVD)
  273. CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
  274. END_CONNECTION_POINT_MAP()
  275. BEGIN_MSG_MAP(CMSWebDVD)
  276. MESSAGE_HANDLER(WM_CREATE, OnCreate); // works only in windowed case
  277. MESSAGE_HANDLER(WM_DESTROY,OnDestroy);// works only in windowed case
  278. MESSAGE_HANDLER(WM_SIZE, OnSize);
  279. MESSAGE_HANDLER(WM_SIZING, OnSize);
  280. MESSAGE_HANDLER(WM_ERASEBKGND, OnErase)
  281. MESSAGE_HANDLER(WM_DVDPLAY_EVENT, OnDVDEvent);
  282. MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseToolTip)
  283. MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
  284. MESSAGE_HANDLER(WM_LBUTTONDOWN, OnButtonDown)
  285. MESSAGE_HANDLER(WM_LBUTTONUP, OnButtonUp)
  286. MESSAGE_HANDLER(WM_DISPLAYCHANGE, OnDispChange);
  287. MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor);
  288. CHAIN_MSG_MAP(CComControl<CMSWebDVD>)
  289. DEFAULT_REFLECTION_HANDLER()
  290. END_MSG_MAP()
  291. // Handler prototypes:
  292. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  293. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  294. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  295. // ISupportsErrorInfo
  296. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  297. // IViewObjectEx
  298. DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
  299. // IMSWebDVD
  300. public:
  301. STDMETHOD(get_FullScreenMode)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  302. STDMETHOD(put_FullScreenMode)(/*[in]*/ VARIANT_BOOL newVal);
  303. STDMETHOD(PlayChaptersAutoStop)(LONG lTitle, LONG lstrChapter, LONG lChapterCount);
  304. STDMETHOD(GetNumberOfChapters)(long lTitle, /*[out, retval]*/ long *pVal);
  305. STDMETHOD(get_TitlesAvailable)(/*[out, retval]*/ long* pVal);
  306. STDMETHOD(Render)(/*[in]*/ long lRender = 0);
  307. STDMETHOD(Stop)();
  308. STDMETHOD(Pause)();
  309. STDMETHOD(Play)();
  310. STDMETHOD(PlayTitle)(LONG lTitle);
  311. STDMETHOD(PlayChapterInTitle)(LONG lTitle, LONG lChapter);
  312. STDMETHOD(PlayChapter)(LONG lChapter);
  313. STDMETHOD(GetSubpictureLanguage)(LONG lStream, BSTR* strLanguage);
  314. STDMETHOD(PlayAtTime)(BSTR strTime);
  315. STDMETHOD(PlayAtTimeInTitle)(long lTitle, BSTR strTime);
  316. STDMETHOD(PlayPeriodInTitleAutoStop)(long lTitle, BSTR strStartTime, BSTR strEndTime);
  317. STDMETHOD(ReplayChapter)();
  318. STDMETHOD(PlayPrevChapter)();
  319. STDMETHOD(PlayNextChapter)();
  320. STDMETHOD(PlayForwards)(double dSpeed, VARIANT_BOOL fDoNotReset);
  321. STDMETHOD(PlayBackwards)(double dSpeed, VARIANT_BOOL fDoNotReset);
  322. STDMETHOD(StillOff)();
  323. STDMETHOD(GetAudioLanguage)(LONG lStream, VARIANT_BOOL fFormat, BSTR* strAudioLang);
  324. STDMETHOD(ReturnFromSubmenu)();
  325. STDMETHOD(SelectAndActivateButton)(long lButton);
  326. STDMETHOD(ActivateButton)();
  327. STDMETHOD(SelectRightButton)();
  328. STDMETHOD(SelectLeftButton)();
  329. STDMETHOD(SelectLowerButton)();
  330. STDMETHOD(SelectUpperButton)();
  331. STDMETHOD(get_PlayState)(/*[out, retval]*/ DVDFilterState *pVal);
  332. STDMETHOD(ShowMenu)(DVDMenuIDConstants MenuID);
  333. STDMETHOD(Resume)();
  334. STDMETHOD(get_CurrentSubpictureStream)(/*[out, retval]*/ long *pVal);
  335. STDMETHOD(put_CurrentSubpictureStream)(/*[in]*/ long newVal);
  336. STDMETHOD(get_VolumesAvailable)(/*[out, retval]*/ long *pVal);
  337. STDMETHOD(get_CurrentVolume)(/*[out, retval]*/ long *pVal);
  338. STDMETHOD(get_CurrentDiscSide)(/*[out, retval]*/ long *pVal);
  339. STDMETHOD(get_CurrentDomain)(/*[out, retval]*/ long *pVal);
  340. STDMETHOD(get_DVDDirectory)(/*[out, retval]*/ BSTR *pVal);
  341. STDMETHOD(put_DVDDirectory)(/*[in]*/ BSTR newVal);
  342. STDMETHOD(get_CurrentTime)(/*[out, retval]*/ BSTR *pVal);
  343. STDMETHOD(get_FramesPerSecond)(/*[out, retval]*/ long *pVal);
  344. STDMETHOD(get_CurrentChapter)(/*[out, retval]*/ long *pVal);
  345. STDMETHOD(get_CurrentTitle)(/*[out, retval]*/ long *pVal);
  346. STDMETHOD(get_ColorKey)(/*[out, retval]*/ long *pVal);
  347. STDMETHOD(put_ColorKey)(/*[in]*/ long newVal);
  348. STDMETHOD(get_CurrentAudioStream)(/*[out, retval]*/ long *pVal);
  349. STDMETHOD(put_CurrentAudioStream)(/*[in]*/ long newVal);
  350. STDMETHOD(get_AudioStreamsAvailable)(/*[out, retval]*/ long *pVal);
  351. STDMETHOD(get_AnglesAvailable)(/*[out, retval]*/ long *pVal);
  352. STDMETHOD(get_CurrentAngle)(/*[out, retval]*/ long *pVal);
  353. STDMETHOD(put_CurrentAngle)(/*[in]*/ long newVal);
  354. STDMETHOD(get_CCActive)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  355. STDMETHOD(put_CCActive)(/*[in]*/ VARIANT_BOOL newVal);
  356. STDMETHOD(get_ButtonsAvailable)(/*[out, retval]*/ long *pVal);
  357. STDMETHOD(get_CurrentButton)(/*[out, retval]*/ long *pVal);
  358. STDMETHOD(get_CurrentCCService)(/*[out, retval]*/ long *pVal);
  359. STDMETHOD(put_CurrentCCService)(/*[in]*/ long newVal);
  360. STDMETHOD(get_TotalTitleTime)(/*[out, retval]*/ BSTR *pVal);
  361. STDMETHOD(get_SubpictureStreamsAvailable)(/*[out, retval]*/ long *pVal);
  362. STDMETHOD(get_SubpictureOn)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  363. STDMETHOD(put_SubpictureOn)(/*[in]*/ VARIANT_BOOL newVal);
  364. STDMETHOD(UOPValid)(long lUOP, VARIANT_BOOL* pfValid);
  365. STDMETHOD(get_Balance)(/*[out, retval]*/ long *pVal);
  366. STDMETHOD(put_Balance)(/*[in]*/ long newVal);
  367. STDMETHOD(get_Volume)(/*[out, retval]*/ long *pVal);
  368. STDMETHOD(put_Volume)(/*[in]*/ long newVal);
  369. STDMETHOD(get_Mute)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  370. STDMETHOD(put_Mute)(/*[in]*/ VARIANT_BOOL newVal);
  371. STDMETHOD(get_DVDUniqueID)(/*[out, retval]*/ BSTR *pVal);
  372. STDMETHOD(GetSPRM)(long lIndex, short *psSPRM);
  373. STDMETHOD(GetGPRM)(long lIndex, short *psSPRM);
  374. STDMETHOD(get_EnableResetOnStop)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  375. STDMETHOD(put_EnableResetOnStop)(/*[in]*/ VARIANT_BOOL newVal);
  376. STDMETHOD(get_BackColor)(VARIANT* pclrBackColor);
  377. STDMETHOD(put_BackColor)(VARIANT clrBackColor);
  378. STDMETHOD(get_ReadyState)(/*[out, retval]*/ LONG *pVal);
  379. STDMETHOD(ActivateAtPosition)(long xPos, long yPos);
  380. STDMETHOD(SelectAtPosition)(long xPos, long yPos);
  381. STDMETHOD(get_DisableAutoMouseProcessing)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  382. STDMETHOD(put_DisableAutoMouseProcessing)(/*[in]*/ VARIANT_BOOL newVal);
  383. STDMETHOD(get_WindowlessActivation)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  384. STDMETHOD(put_WindowlessActivation)(/*[in]*/ VARIANT_BOOL newVal);
  385. STDMETHOD(GetButtonRect)(long lButton, IDVDRect** pRect);
  386. STDMETHOD(GetButtonAtPosition)(long xPos, long yPos, long* plButton);
  387. STDMETHOD(AcceptParentalLevelChange)(VARIANT_BOOL fAccept, BSTR strUserName, BSTR strPassword);
  388. STDMETHOD(NotifyParentalLevelChange)(/*[in]*/ VARIANT_BOOL newVal);
  389. STDMETHOD(SelectParentalCountry)(long lCountry, BSTR strUserName, BSTR strPassword);
  390. STDMETHOD(SelectParentalLevel)(long lParentalLevel, BSTR strUserName, BSTR strPassword);
  391. STDMETHOD(GetTitleParentalLevels)(long lTitle, long* plParentalLevels);
  392. STDMETHOD(GetPlayerParentalCountry)(long* plCountryCode);
  393. STDMETHOD(GetPlayerParentalLevel)(long* plParentalLevel);
  394. STDMETHOD(SetClipVideoRect)(IDVDRect* pRect);
  395. STDMETHOD(GetVideoSize)(IDVDRect** ppRect);
  396. STDMETHOD(GetClipVideoRect)(IDVDRect** ppRect);
  397. STDMETHOD(SetDVDScreenInMouseCoordinates)(IDVDRect* pRect);
  398. STDMETHOD(GetDVDScreenInMouseCoordinates)(IDVDRect** ppRect);
  399. #if 1
  400. STDMETHOD(get_ToolTip)(/*[out, retval]*/ BSTR *pVal);
  401. STDMETHOD(put_ToolTip)(/*[in]*/ BSTR newVal);
  402. STDMETHOD(get_ToolTipMaxWidth)(/*[out, retval]*/ long *pVal);
  403. STDMETHOD(put_ToolTipMaxWidth)(/*[in]*/ long newVal);
  404. STDMETHOD(GetDelayTime)(/*[in]*/ long delayType, /*[out, retval]*/ VARIANT *pVal);
  405. STDMETHOD(SetDelayTime)(/*[in]*/ long delayType, /*[in]*/ VARIANT newVal);
  406. #endif
  407. HRESULT ProcessEvents();
  408. STDMETHOD(Eject)();
  409. STDMETHOD(SetGPRM)(long lIndex, short sValue);
  410. STDMETHOD(GetDVDTextStringType)(long lLangIndex, long lStringIndex, DVDTextStringType* pType);
  411. STDMETHOD(GetDVDTextString)(long lLangIndex, long lStringIndex, BSTR* pstrText);
  412. STDMETHOD(GetDVDTextNumberOfStrings)(long lLangIndex, long* plNumOfStrings);
  413. STDMETHOD(GetDVDTextNumberOfLanguages)(long* plNumOfLangs);
  414. STDMETHOD(GetDVDTextLanguageLCID)(/*[in]*/ long lLangIndex, /*[out, retval]*/ long* lcid);
  415. STDMETHOD(RegionChange)();
  416. STDMETHOD(Zoom)(long x, long y, double zoomRatio);
  417. STDMETHOD(get_CursorType)(/*[out, retval]*/ DVDCursorType *pVal);
  418. STDMETHOD(put_CursorType)(/*[in]*/ DVDCursorType newVal);
  419. STDMETHOD(get_DVDAdm)(/*[out, retval]*/ IDispatch* *pVal);
  420. STDMETHOD(DeleteBookmark)();
  421. STDMETHOD(RestoreBookmark)();
  422. STDMETHOD(SaveBookmark)();
  423. STDMETHOD(Capture)();
  424. STDMETHOD(SelectDefaultAudioLanguage)(long lang, long ext);
  425. STDMETHOD(SelectDefaultSubpictureLanguage)(long lang, DVDSPExt ext);
  426. STDMETHOD(get_PreferredSubpictureStream)(/*[out, retval]*/ long *pVal);
  427. STDMETHOD(CanStep)(VARIANT_BOOL fBackwards, VARIANT_BOOL *pfCan);
  428. STDMETHOD(Step)(long lStep);
  429. STDMETHOD(get_DefaultMenuLanguage)(long* lang);
  430. STDMETHOD(put_DefaultMenuLanguage)(long lang);
  431. STDMETHOD(get_DefaultSubpictureLanguage)(long* lang);
  432. STDMETHOD(get_DefaultAudioLanguage)(long *lang);
  433. STDMETHOD(get_DefaultSubpictureLanguageExt)(DVDSPExt* ext);
  434. STDMETHOD(get_DefaultAudioLanguageExt)(long *ext);
  435. STDMETHOD(get_KaraokeAudioPresentationMode)(/*[out, retval]*/ long *pVal);
  436. STDMETHOD(put_KaraokeAudioPresentationMode)(/*[in]*/ long newVal);
  437. STDMETHOD(GetKaraokeChannelContent)(long lStream, long lChan, long* lContent);
  438. STDMETHOD(GetKaraokeChannelAssignment)(long lStream, long *lChannelAssignment);
  439. STDMETHOD(get_AspectRatio)(/*[out, retval]*/ double *pVal);
  440. STDMETHOD(put_ShowCursor)(VARIANT_BOOL fShow);
  441. STDMETHOD(get_ShowCursor)(VARIANT_BOOL* pfShow);
  442. STDMETHOD(GetLangFromLangID)(/*[in]*/ long langID, /*[out, retval]*/ BSTR* lang);
  443. STDMETHOD(DVDTimeCode2bstr)(/*[in]*/ long timeCode, /*[out, retval]*/ BSTR *pTimeStr);
  444. STDMETHOD(IsSubpictureStreamEnabled)(/*[in]*/ long lstream, /*[out, retval]*/ VARIANT_BOOL *fEnabled);
  445. STDMETHOD(IsAudioStreamEnabled)(/*[in]*/ long lstream, /*[out, retval]*/ VARIANT_BOOL *fEnabled);
  446. STDMETHOD(SetObjectRects)(LPCRECT prcPos,LPCRECT prcClip);
  447. //ISafety
  448. STDMETHOD(GetInterfaceSafetyOptions)( REFIID riid,
  449. DWORD *pdwSupportedOptions,
  450. DWORD *pdwEnabledOptions );
  451. STDMETHOD(SetInterfaceSafetyOptions)( REFIID riid,
  452. DWORD dwOptionSetMask,
  453. DWORD dwEnabledOptions );
  454. STDMETHOD(SetClientSite)(IOleClientSite *pClientSite);
  455. // local helper functions
  456. public:
  457. HRESULT AdjustDestRC();
  458. HRESULT OnDraw(ATL_DRAWINFO& di);
  459. #ifdef _WMP
  460. HRESULT InPlaceActivate(LONG iVerb, const RECT* /*prcPosRect*/);
  461. #endif
  462. HRESULT OnPostVerbInPlaceActivate();
  463. HRESULT TimerProc(); // needs to be called from a timer proc
  464. static CWndClassInfo& GetWndClassInfo(){
  465. static HBRUSH hbr= ::CreateSolidBrush(RGB(0,0,0));
  466. /**********************************
  467. #define OCR_ARROW_DEFAULT 100
  468. // need special cursor, we we do not have color key around it
  469. static HCURSOR hcr = (HCURSOR) ::LoadImage((HINSTANCE) NULL,
  470. MAKEINTRESOURCE(OCR_ARROW_DEFAULT),
  471. IMAGE_CURSOR,0,0,0);
  472. *********************/
  473. static CWndClassInfo wc = {{ sizeof(WNDCLASSEX), 0, StartWindowProc,
  474. 0, 0, NULL, NULL, NULL, /* NULL */ hbr,
  475. NULL, TEXT("MSMFVideoClass"), NULL },
  476. NULL, NULL, MAKEINTRESOURCE(OCR_ARROW_DEFAULT), TRUE, 0, _T("") };
  477. return wc;
  478. }/* end of function GetWndClassInfo */
  479. private:
  480. VOID Init();
  481. VOID Cleanup();
  482. HRESULT SetDDrawExcl();
  483. LRESULT OnDVDEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  484. LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  485. LRESULT OnDispChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  486. LRESULT OnErase(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  487. LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  488. LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  489. LRESULT OnMouseToolTip(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  490. LRESULT OnButtonDown(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  491. LRESULT OnButtonUp(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  492. LRESULT OnMouseMove(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  493. LRESULT OnSetCursor(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  494. HRESULT SetReadyState(LONG lReadyState);
  495. static HRESULT DVDTime2bstr(const DVD_HMSF_TIMECODE *pulTime, BSTR *pbstrTime);
  496. static HRESULT Bstr2DVDTime(DVD_HMSF_TIMECODE *pulTime, const BSTR *pbstrTime);
  497. HRESULT SetColorKey(COLORREF clr);
  498. HRESULT GetColorKey(COLORREF* pClr);
  499. HRESULT TraverseForInterface(REFIID iid, LPVOID* ppvObject);
  500. HRESULT SetupAudio(); // fills in the audio interface
  501. HRESULT SetupDDraw();
  502. HRESULT SetupEventNotifySink(); // sets up IMediaEventSink
  503. HRESULT RenderGraphIfNeeded();
  504. HRESULT PassFP_DOM();
  505. HRESULT getCDDriveLetter(TCHAR* lpDrive);
  506. DWORD OpenCdRom(TCHAR chDrive, LPDWORD lpdwErrCode);
  507. HRESULT CloseCdRom(DWORD DevHandle);
  508. HRESULT EjectCdRom(DWORD DevHandle);
  509. HRESULT UnEjectCdRom(DWORD DevHandle);
  510. HRESULT HandleError(HRESULT hr);
  511. HRESULT SelectParentalLevel(long lParentalLevel);
  512. HRESULT SelectParentalCountry(long lCountry);
  513. HRESULT TransformToWndwls(POINT& pt);
  514. HRESULT getDVDDriveLetter(TCHAR* lpDrive);
  515. HRESULT GetMostOuterWindow(HWND* phwndParent);
  516. HRESULT RestoreDefaultSettings();
  517. HRESULT GetParentHWND(HWND* pWnd);
  518. HRESULT GetUsableWindow(HWND* pWnd);
  519. HRESULT GetClientRectInScreen(RECT* prc);
  520. HRESULT OnResize(); //helper function that we need to marshal
  521. HRESULT RestoreGraphState();
  522. HRESULT AppendString(TCHAR* strDest, INT strID, LONG dwLen);
  523. HRESULT InvalidateRgn(bool fErase = false);
  524. // monitor support
  525. HRESULT RefreshDDrawGuids();
  526. HRESULT DDrawGuidFromHMonitor(HMONITOR hMon, AMDDRAWGUID* lpGUID);
  527. bool IsWindowOnWrongMonitor(HMONITOR* lphMon);
  528. HRESULT RestoreSurfaces();
  529. HRESULT ChangeMonitor(HMONITOR hMon, const AMDDRAWGUID* lpguid);
  530. HRESULT DisplayChange(HMONITOR hMon, const AMDDRAWGUID* lpguid);
  531. HRESULT UpdateCurrentMonitor(const AMDDRAWGUID* lpguid);
  532. HRESULT HandleMultiMonMove();
  533. HRESULT HandleMultiMonPaint(HDC hdc);
  534. HRESULT get_IntVolume(LONG* plVolume);
  535. HRESULT put_IntVolume(long lVolume);
  536. HRESULT CanStepBackwards();
  537. // member variables
  538. private:
  539. LONG m_lChapter, m_lTitle;
  540. LONG m_lChapterCount; // count of the chapters to play
  541. CComPtr<IDvdGraphBuilder> m_pDvdGB; // IDvdGraphBuilder interface
  542. CComPtr<IGraphBuilder> m_pGB; // IGraphBuilder interface
  543. CComPtr<IMediaControl> m_pMC; // IMediaControl interface
  544. CComPtr<IMediaEventEx> m_pME ; // IMediaEventEx interface
  545. CComPtr<IDvdControl2> m_pDvdCtl2; // New DVD Control
  546. CComPtr<IDvdInfo2> m_pDvdInfo2; // New DVD Info Interface
  547. CComPtr<IBasicAudio> m_pAudio; // Audio interface
  548. CComPtr<IMediaEventSink> m_pMediaSink;
  549. BOOL m_bUseColorKey; // flag to see if we are using color key
  550. COLORREF m_clrColorKey; // color key
  551. BOOL m_bMute; // mute flag
  552. LONG m_lLastVolume; // used to preserve the last volume for mute
  553. BOOL m_fEnableResetOnStop; // disable or enable the restart of the seek
  554. CComPtr<IVideoFrameStep> m_pVideoFrameStep;
  555. CComPtr<IDDrawNonExclModeVideo> m_pDDEX; // The new interface that can capture
  556. //IDDrawExclModeVideo *m_pDDEX; // IDDrawExclModeVideo interface
  557. bool m_fUseDDrawDirect; // flag to switch between a ddraw mode and none ddraw mode
  558. bool m_fInitialized; // flag to see if we are initialize
  559. HANDLE m_hFPDOMEvent; // handle to the FP_DOM event which gets signaled when we get out of FP_DOM
  560. bool m_fDisableAutoMouseProcessing; // Disable the automatic mouse processing
  561. bool m_bEjected; // whether disc is ejected right now
  562. bool m_fStillOn; // flag to see if we have a still
  563. bool m_fResetSpeed;
  564. CComPtr<IMSDVDAdm> m_pDvdAdmin;
  565. DVDCursorType m_nCursorType;
  566. RECT *m_pClipRect;
  567. RECT m_ClipRectDown;
  568. BOOL m_bMouseDown;
  569. POINT m_ClipCenter;
  570. POINT m_LastMouse;
  571. POINT m_LastMouseDown;
  572. HCURSOR m_hCursor;
  573. double m_dZoomRatio;
  574. DWORD m_dwAspectX;
  575. DWORD m_dwAspectY;
  576. DWORD m_dwVideoWidth;
  577. DWORD m_dwVideoHeight;
  578. DWORD m_dwOvMaxStretch;
  579. HWND m_hWndOuter;
  580. RECT m_rcOldPos;
  581. RECT m_rcPosAspectRatioAjusted;
  582. UINT_PTR m_hTimerId;
  583. DVDFilterState m_DVDFilterState;
  584. MSLangID m_LangID;
  585. long m_lKaraokeAudioPresentationMode;
  586. DWORD_PTR m_dwTTReshowDelay;
  587. DWORD_PTR m_dwTTAutopopDelay;
  588. DWORD_PTR m_dwTTInitalDelay;
  589. // monitor support
  590. CDDrawDVD* m_pDDrawDVD;
  591. DWORD m_dwNumDevices;
  592. AMDDRAWMONITORINFO* m_lpInfo;
  593. AMDDRAWMONITORINFO* m_lpCurMonitor;
  594. BOOL m_MonitorWarn;
  595. bool m_fStepComplete;
  596. BOOL m_bFireUpdateOverlay;
  597. // ejection/insert handling
  598. // This MUST be in the same thread as the disk reader or we'll
  599. // end up with some nasty race conditions (ejection notification
  600. // will happen after a read instead of before)
  601. CMediaHandler m_mediaHandler;
  602. BOOL m_bFireNoSubpictureStream;
  603. #if 1
  604. HWND m_hWndTip; // Tooltip window
  605. LONG m_nTTMaxWidth; // Max tooltip width
  606. CComBSTR m_bstrToolTip; // Tooltip string
  607. BOOL m_bTTCreated; // Has tooltip been created yet
  608. HRESULT CreateToolTip();
  609. #endif
  610. bool m_fBackWardsFlagInitialized;
  611. bool m_fCanStepBackwards;
  612. // stock properties have to be public due to ATL implementation
  613. public:
  614. LONG m_nReadyState; // ready state change stock property
  615. OLE_COLOR m_clrBackColor; // stock property implemeted in the CStockPropImpl
  616. void SetDiscEjected(bool bEjected) {m_bEjected = bEjected;};
  617. HRESULT UpdateOverlay();
  618. };
  619. // error code
  620. #define E_FORMAT_NOT_SUPPORTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF2)
  621. #endif //__MSWEBDVD_H_
  622. /*************************************************************************/
  623. /* End of file: msdvd.h */
  624. /*************************************************************************/