home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / amstream.idl < prev    next >
Text File  |  1998-04-25  |  9KB  |  321 lines

  1. import "unknwn.idl";
  2. import "mmstream.idl";
  3. import "strmif.idl";
  4.  
  5. cpp_quote("#include <ddraw.h>")
  6. cpp_quote("#include <mmstream.h>")
  7. cpp_quote("#include <ddstream.h>")
  8. cpp_quote("#include <austream.h>")
  9.  
  10.  
  11.  
  12. interface IAMMultiMediaStream;
  13. interface IAMMediaStream;
  14. interface IMediaStreamFilter;
  15. interface IDirectDraw;
  16. interface IDirectDrawSurface;
  17. interface IAMMediaTypeStream;
  18. interface IAMMediaTypeSample;
  19.  
  20. //  Flags definitions for Initialize
  21. enum {
  22.     AMMSF_NOGRAPHTHREAD      = 0x00000001
  23. };
  24.  
  25. //  Flags definitions for AddMediaStream
  26. enum {
  27.     //  Don't add a stream - create a default renderer instead
  28.     //  for the supplied purpose id
  29.     AMMSF_ADDDEFAULTRENDERER = 0x00000001,
  30.     AMMSF_CREATEPEER         = 0x00000002
  31. };
  32.  
  33. //  Flag definitions for OpenFile and OpenMoniker
  34. enum {
  35.     AMMSF_RENDERTYPEMASK     = 0x00000003,
  36.     AMMSF_RENDERTOEXISTING   = 0x00000000,
  37.     AMMSF_RENDERALLSTREAMS   = 0x00000001,
  38.     AMMSF_NORENDER           = 0x00000002,
  39.  
  40.     AMMSF_NOCLOCK            = 0x00000004,
  41.     AMMSF_RUN                = 0x00000008
  42. };
  43.  
  44.  
  45. typedef [v1_enum] enum {
  46.     Disabled = 0,
  47.     ReadData = 1,
  48.     RenderData = 2
  49. } OUTPUT_STATE;
  50.  
  51.  
  52. [
  53. object,
  54. uuid(7DB01C96-C0C3-11d0-8FF1-00C04FD9189D),
  55. dual,
  56. helpstring("IDirectShowStream Interface"),
  57. pointer_default(unique)
  58. ]
  59. interface IDirectShowStream : IDispatch
  60. {
  61.     [propget, id(1), helpstring("property FileName")] HRESULT FileName([out, retval] BSTR *pVal);
  62.     [propput, id(1), helpstring("property FileName")] HRESULT FileName([in] BSTR newVal);
  63.     [propget, id(2), helpstring("property Video")] HRESULT Video([out, retval] OUTPUT_STATE *pVal);
  64.     [propput, id(2), helpstring("propetry Video")] HRESULT Video([in] OUTPUT_STATE newVal);
  65.     [propget, id(3), helpstring("property Audio")] HRESULT Audio([out, retval] OUTPUT_STATE *pVal);
  66.     [propput, id(3), helpstring("propetry Audio")] HRESULT Audio([in] OUTPUT_STATE newVal);
  67. };
  68.  
  69.  
  70. // IAMMultiMediaStream interface
  71. [
  72. object,
  73. uuid(BEBE595C-9A6F-11d0-8FDE-00C04FD9189D),
  74. pointer_default(unique)
  75. ]
  76. interface IAMMultiMediaStream : IMultiMediaStream
  77. {
  78.     HRESULT Initialize(
  79.         [in] STREAM_TYPE StreamType,
  80.                 [in] DWORD dwFlags,
  81.         [in] [optional] IGraphBuilder *pFilterGraph);
  82.  
  83.         HRESULT GetFilterGraph(
  84.                 [out] IGraphBuilder **ppGraphBuilder);
  85.  
  86.     HRESULT GetFilter(
  87.         [out] IMediaStreamFilter **ppFilter);
  88.  
  89.     HRESULT AddMediaStream(
  90.         [in] [optional] IUnknown *pStreamObject,
  91.         [in] [optional] const MSPID *PurposeId,
  92.         [in] DWORD dwFlags,
  93.         [out] [optional] IMediaStream **ppNewStream);
  94.  
  95.     HRESULT OpenFile(
  96.         [in] LPCWSTR pszFileName,
  97.         [in] DWORD dwFlags);
  98.  
  99.     HRESULT OpenMoniker(
  100.                 [in] IBindCtx *pCtx,
  101.         [in] IMoniker *pMoniker,
  102.         [in] DWORD dwFlags);
  103.  
  104.     HRESULT Render(
  105.         [in] DWORD dwFlags);
  106. }
  107.  
  108.  
  109. // IAMMediaStream interface
  110. [
  111. object,
  112. uuid(BEBE595D-9A6F-11d0-8FDE-00C04FD9189D),
  113. pointer_default(unique)
  114. ]
  115. interface IAMMediaStream : IMediaStream
  116. {
  117.     HRESULT Initialize(
  118.                 [in] [optional] IUnknown *pSourceObject,
  119.                 [in] DWORD dwFlags,
  120.         [in] REFMSPID PurposeId,
  121.         [in] const STREAM_TYPE StreamType);
  122.  
  123.     HRESULT SetState(
  124.         [in] FILTER_STATE State);
  125.  
  126.     HRESULT JoinAMMultiMediaStream(
  127.         [in] IAMMultiMediaStream *pAMMultiMediaStream);
  128.  
  129.     HRESULT JoinFilter(
  130.         [in] IMediaStreamFilter *pMediaStreamFilter);
  131.  
  132.     HRESULT JoinFilterGraph(
  133.         [in] IFilterGraph *pFilterGraph);
  134. };
  135.  
  136.  
  137.  
  138.  
  139. // IMediaStreamFilter interface
  140. [
  141. object,
  142. local,
  143. uuid(BEBE595E-9A6F-11d0-8FDE-00C04FD9189D),
  144. pointer_default(unique)
  145. ]
  146. interface IMediaStreamFilter : IBaseFilter
  147. {
  148.     HRESULT AddMediaStream(
  149.         [in] IAMMediaStream *pAMMediaStream);
  150.  
  151.     HRESULT GetMediaStream(
  152.         [in] REFMSPID idPurpose,
  153.         [out] IMediaStream **ppMediaStream);
  154.  
  155.     HRESULT EnumMediaStreams(
  156.         [in] long Index,
  157.         [out] IMediaStream **ppMediaStream);
  158.  
  159.         HRESULT SupportSeeking(
  160.         [in] BOOL bRenderer);
  161.  
  162.     HRESULT ReferenceTimeToStreamTime(
  163.         [in] [out] REFERENCE_TIME *pTime);
  164.  
  165.     HRESULT GetCurrentStreamTime(
  166.         [out] REFERENCE_TIME *pCurrentStreamTime);
  167.  
  168.     HRESULT WaitUntil(
  169.         [in]  REFERENCE_TIME WaitStreamTime);
  170.  
  171.     HRESULT Flush(
  172.                 [in] BOOL bCancelEOS);
  173.  
  174.         HRESULT EndOfStream();
  175. };
  176.  
  177.  
  178.  
  179. [
  180. object,
  181. local,
  182. uuid(AB6B4AFC-F6E4-11d0-900D-00C04FD9189D),
  183. pointer_default(unique)
  184. ]
  185. interface IDirectDrawMediaSampleAllocator : IUnknown
  186. {
  187.         HRESULT GetDirectDraw(IDirectDraw **ppDirectDraw);
  188. };
  189.  
  190.  
  191. [
  192. object,
  193. local,
  194. uuid(AB6B4AFE-F6E4-11d0-900D-00C04FD9189D),
  195. pointer_default(unique)
  196. ]
  197. interface IDirectDrawMediaSample : IUnknown
  198. {
  199.         HRESULT GetSurfaceAndReleaseLock(
  200.                 [out] IDirectDrawSurface **ppDirectDrawSurface,
  201.                 [out] RECT * pRect);
  202.         HRESULT LockMediaSamplePointer(void);
  203. };
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211. [
  212. object,
  213. local,
  214. uuid(AB6B4AFA-F6E4-11d0-900D-00C04FD9189D),
  215. pointer_default(unique)
  216. ]
  217.  
  218. interface IAMMediaTypeStream : IMediaStream
  219. {
  220.         HRESULT GetFormat(
  221.                 [out]   AM_MEDIA_TYPE * pMediaType,
  222.                 [in]    DWORD dwFlags);
  223.  
  224.         HRESULT SetFormat(
  225.                 [in]    AM_MEDIA_TYPE * pMediaType,
  226.                 [in]    DWORD dwFlags);
  227.  
  228.         HRESULT CreateSample(
  229.                 [in]            long lSampleSize,
  230.                 [in] [optional] BYTE * pbBuffer,
  231.                 [in]            DWORD dwFlags,
  232.                 [in] [optional] IUnknown *pUnkOuter,
  233.                 [out]           IAMMediaTypeSample ** ppAMMediaTypeSample);
  234.  
  235.         HRESULT GetStreamAllocatorRequirements(
  236.                 [out] ALLOCATOR_PROPERTIES *pProps);
  237.  
  238.         HRESULT SetStreamAllocatorRequirements(
  239.                 [in]  ALLOCATOR_PROPERTIES *pProps);
  240. };
  241.  
  242.  
  243. [
  244. object,
  245. local,
  246. uuid(AB6B4AFB-F6E4-11d0-900D-00C04FD9189D),
  247. pointer_default(unique)
  248. ]
  249. interface IAMMediaTypeSample : IStreamSample
  250. {
  251.     //
  252.     //  Unique methods for IAMMediaTypeSample
  253.     //
  254.     HRESULT SetPointer([in] BYTE *pBuffer, [in] long lSize);
  255.  
  256.     //
  257.     //  Mirror of IMediaSample
  258.     //
  259.     HRESULT GetPointer([out] BYTE ** ppBuffer);
  260.     long GetSize(void);
  261.     HRESULT GetTime([out] REFERENCE_TIME * pTimeStart, [out] REFERENCE_TIME * pTimeEnd);
  262.     HRESULT SetTime([in] REFERENCE_TIME * pTimeStart, [in] REFERENCE_TIME * pTimeEnd);
  263.     HRESULT IsSyncPoint(void);
  264.     HRESULT SetSyncPoint(BOOL bIsSyncPoint);
  265.     HRESULT IsPreroll(void);
  266.     HRESULT SetPreroll(BOOL bIsPreroll);
  267.     long GetActualDataLength(void);
  268.     HRESULT SetActualDataLength(long);
  269.     HRESULT GetMediaType(AM_MEDIA_TYPE **ppMediaType);
  270.     HRESULT SetMediaType(AM_MEDIA_TYPE *pMediaType);
  271.     HRESULT IsDiscontinuity(void);
  272.     HRESULT SetDiscontinuity(BOOL bDiscontinuity);
  273.     HRESULT GetMediaTime([out] LONGLONG * pTimeStart, [out] LONGLONG * pTimeEnd);
  274.     HRESULT SetMediaTime([in] LONGLONG * pTimeStart, [in] LONGLONG * pTimeEnd);
  275. };
  276.  
  277.  
  278. [
  279.     uuid(4E6CDE29-C0C4-11d0-8FF1-00C04FD9189D),
  280.     version(1.0),
  281.     helpstring("DirectShowStream 1.0 Type Library")
  282. ]
  283.  
  284. library DirectShowStreamLib
  285. {
  286.     importlib("stdole32.tlb");
  287.     importlib("stdole2.tlb");
  288.  
  289.     [
  290.         uuid(49c47ce5-9ba4-11d0-8212-00c04fc32c45),
  291.         helpstring("DirectShow Multi Media Stream")
  292.     ]
  293.     coclass AMMultiMediaStream
  294.     {
  295.         [default] dispinterface IDirectShowStream;
  296.     };
  297. };
  298.  
  299.  
  300.  
  301. //
  302. //  The MIDL compiler wants to produce a CLSID for everything defined in
  303. //  our type library, but it also wants to generate huge, fat proxy code
  304. //  so we use DEFINE_GUID for all other classes.  It has another interesting
  305. //  bug in that it defines CLSID_AMMultiMediaStream within a #ifdef __cplusplus
  306. //  block, so we need to define it outside of that scope.
  307. //
  308.  
  309. cpp_quote("#ifndef __cplusplus")
  310. cpp_quote("EXTERN_C const CLSID CLSID_AMMultiMediaStream;")
  311. cpp_quote("#endif")
  312.  
  313. cpp_quote("DEFINE_GUID(CLSID_AMDirectDrawStream, /* 49c47ce4-9ba4-11d0-8212-00c04fc32c45 */")
  314. cpp_quote("0x49c47ce4, 0x9ba4, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);")
  315. cpp_quote("DEFINE_GUID(CLSID_AMAudioStream, /* 8496e040-af4c-11d0-8212-00c04fc32c45 */")
  316. cpp_quote("0x8496e040, 0xaf4c, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);")
  317. cpp_quote("DEFINE_GUID(CLSID_AMAudioData, /* f2468580-af8a-11d0-8212-00c04fc32c45 */")
  318. cpp_quote("0xf2468580, 0xaf8a, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);")
  319. cpp_quote("DEFINE_GUID(CLSID_AMMediaTypeStream, /* CF0F2F7C-F7BF-11d0-900D-00C04FD9189D */")
  320. cpp_quote("0xcf0f2f7c, 0xf7bf, 0x11d0, 0x90, 0xd, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);")
  321.