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.

412 lines
12 KiB

  1. //------------------------------------------------------------------------------
  2. // File: MediaObj.idl
  3. //
  4. // Desc: Define the interfaces for DirectX Media Objects. This file will
  5. // be processed by the MIDL tool to produce mediaobj.h and proxy-stub
  6. // code.
  7. //
  8. // Copyright (c) 1999 - 2000, Microsoft Corporation. All rights reserved.
  9. //------------------------------------------------------------------------------
  10. import "unknwn.idl";
  11. import "objidl.idl";
  12. // DMO_MEDIA_TYPE structure
  13. cpp_quote("#ifdef __strmif_h__")
  14. cpp_quote("typedef AM_MEDIA_TYPE DMO_MEDIA_TYPE;")
  15. cpp_quote("#else")
  16. typedef struct _DMOMediaType {
  17. GUID majortype;
  18. GUID subtype;
  19. BOOL bFixedSizeSamples;
  20. BOOL bTemporalCompression;
  21. ULONG lSampleSize;
  22. GUID formattype;
  23. IUnknown *pUnk;
  24. ULONG cbFormat;
  25. [size_is(cbFormat)] BYTE * pbFormat;
  26. } DMO_MEDIA_TYPE;
  27. typedef LONGLONG REFERENCE_TIME;
  28. cpp_quote("#endif")
  29. // Per-buffer flags that apply to input buffers
  30. enum _DMO_INPUT_DATA_BUFFER_FLAGS {
  31. DMO_INPUT_DATA_BUFFERF_SYNCPOINT = 0x00000001,
  32. DMO_INPUT_DATA_BUFFERF_TIME = 0x00000002,
  33. DMO_INPUT_DATA_BUFFERF_TIMELENGTH = 0x00000004
  34. };
  35. // Per-buffer flags that apply to output buffers.
  36. enum _DMO_OUTPUT_DATA_BUFFER_FLAGS {
  37. DMO_OUTPUT_DATA_BUFFERF_SYNCPOINT = 0x00000001,
  38. DMO_OUTPUT_DATA_BUFFERF_TIME = 0x00000002,
  39. DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH = 0x00000004,
  40. //
  41. // This flag means the object could have generated more data for this
  42. // output stream, even with no additional input from any input stream,
  43. // but the output buffer did not have sufficient room.
  44. //
  45. DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE = 0x01000000
  46. };
  47. // Flags returned by GetInputStatus()
  48. enum _DMO_INPUT_STATUS_FLAGS {
  49. //
  50. // ACCEPT_DATA indicates that the input stream is ready to accept
  51. // new data via ProcessInput().
  52. //
  53. DMO_INPUT_STATUSF_ACCEPT_DATA = 0x00000001
  54. };
  55. // Flags returned by GetInputStreamInfo()
  56. enum _DMO_INPUT_STREAM_INFO_FLAGS {
  57. DMO_INPUT_STREAMF_WHOLE_SAMPLES = 0x00000001,
  58. DMO_INPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER = 0x00000002,
  59. DMO_INPUT_STREAMF_FIXED_SAMPLE_SIZE = 0x00000004,
  60. DMO_INPUT_STREAMF_HOLDS_BUFFERS = 0x00000008
  61. };
  62. // Flags returned by GetOutputStreamInfo()
  63. enum _DMO_OUTPUT_STREAM_INFO_FLAGS {
  64. DMO_OUTPUT_STREAMF_WHOLE_SAMPLES = 0x00000001,
  65. DMO_OUTPUT_STREAMF_SINGLE_SAMPLE_PER_BUFFER = 0x00000002,
  66. DMO_OUTPUT_STREAMF_FIXED_SAMPLE_SIZE = 0x00000004,
  67. DMO_OUTPUT_STREAMF_DISCARDABLE = 0x00000008,
  68. DMO_OUTPUT_STREAMF_OPTIONAL = 0x00000010
  69. };
  70. // SetType flags
  71. enum _DMO_SET_TYPE_FLAGS {
  72. DMO_SET_TYPEF_TEST_ONLY = 0x00000001,// check but don't set
  73. DMO_SET_TYPEF_CLEAR = 0x00000002 // unset
  74. };
  75. // Process Output Flags
  76. enum _DMO_PROCESS_OUTPUT_FLAGS {
  77. DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER = 0x00000001 // Discard
  78. };
  79. // Buffer wrapper interface
  80. [
  81. object,
  82. uuid(59eff8b9-938c-4a26-82f2-95cb84cdc837)
  83. ]
  84. interface IMediaBuffer : IUnknown
  85. {
  86. HRESULT SetLength(
  87. DWORD cbLength
  88. );
  89. HRESULT GetMaxLength(
  90. [out] DWORD *pcbMaxLength
  91. );
  92. HRESULT GetBufferAndLength(
  93. [out] BYTE **ppBuffer, // not filled if NULL
  94. [out] DWORD *pcbLength // not filled if NULL
  95. );
  96. }
  97. //
  98. // Output buffer info structure: one of these must be passed in for each
  99. // output stream with every ProcessOutput() call
  100. // All [out] fields should be
  101. // assumed undefined if ProcessOutput() failed
  102. //
  103. typedef struct _DMO_OUTPUT_DATA_BUFFER {
  104. IMediaBuffer *pBuffer; // [in] can be NULL
  105. // ProcessOutput() must set any appropriate flags and zero out the rest.
  106. DWORD dwStatus; // [out] DMO_OUTPUT_DATA_BUFFERF_XXX (INCOMPLETE, etc.)
  107. //
  108. // Each of these is valid if the corresponding flag is set in dwStatus
  109. //
  110. REFERENCE_TIME rtTimestamp; // [out]
  111. REFERENCE_TIME rtTimelength; // [out]
  112. } DMO_OUTPUT_DATA_BUFFER, *PDMO_OUTPUT_DATA_BUFFER;
  113. // Interface supported by media objects
  114. [
  115. object,
  116. uuid(d8ad0f58-5494-4102-97c5-ec798e59bcf4)
  117. ]
  118. interface IMediaObject : IUnknown
  119. {
  120. //
  121. // Stream enumeration
  122. //
  123. HRESULT GetStreamCount(
  124. [out] DWORD *pcInputStreams,
  125. [out] DWORD *pcOutputStreams
  126. );
  127. HRESULT GetInputStreamInfo(
  128. DWORD dwInputStreamIndex, // 0-based
  129. [out] DWORD *pdwFlags // HOLDS_BUFFERS
  130. );
  131. HRESULT GetOutputStreamInfo(
  132. DWORD dwOutputStreamIndex, // 0-based
  133. [out] DWORD *pdwFlags // Media object sets to 0
  134. );
  135. //
  136. // Mediatypes
  137. //
  138. //
  139. // GetType - iterate through media types supported by a stream.
  140. // Returns S_FALSE if the type index is out of range ("no more types").
  141. //
  142. HRESULT GetInputType(
  143. DWORD dwInputStreamIndex,
  144. DWORD dwTypeIndex, // 0-based
  145. [out] DMO_MEDIA_TYPE *pmt
  146. );
  147. HRESULT GetOutputType(
  148. DWORD dwOutputStreamIndex,
  149. DWORD dwTypeIndex, // 0-based
  150. [out] DMO_MEDIA_TYPE *pmt
  151. );
  152. //
  153. // SetType - tell the object the type of data it will work with.
  154. //
  155. HRESULT SetInputType(
  156. DWORD dwInputStreamIndex,
  157. [in] const DMO_MEDIA_TYPE *pmt,
  158. DWORD dwFlags // test only
  159. );
  160. HRESULT SetOutputType(
  161. DWORD dwOutputStreamIndex,
  162. [in] const DMO_MEDIA_TYPE *pmt,
  163. DWORD dwFlags // test only
  164. );
  165. //
  166. // GetCurrentType - get the last mediatype supplied via SetType.
  167. // Returns S_FALSE if SetType has not been called.
  168. //
  169. HRESULT GetInputCurrentType(
  170. DWORD dwInputStreamIndex,
  171. [out] DMO_MEDIA_TYPE *pmt
  172. );
  173. HRESULT GetOutputCurrentType(
  174. DWORD dwOutputStreamIndex,
  175. [out] DMO_MEDIA_TYPE *pmt
  176. );
  177. //
  178. // SizeInfo
  179. //
  180. //
  181. // GetSizeInfo - Get buffer size requirementes of a stream.
  182. //
  183. // If buffer size depends on the media type used, the object should
  184. // base its response on the most recent media type set for this stream.
  185. // If no mediatype has been set, the object may return an error.
  186. //
  187. HRESULT GetInputSizeInfo(
  188. DWORD dwInputStreamIndex,
  189. [out] DWORD *pcbSize, // size of input 'quantum'
  190. [out] DWORD *pcbMaxLookahead, // max total bytes held
  191. [out] DWORD *pcbAlignment // buffer alignment requirement
  192. );
  193. HRESULT GetOutputSizeInfo(
  194. DWORD dwOutputStreamIndex,
  195. [out] DWORD *pcbSize, // size of output 'quantum'
  196. [out] DWORD *pcbAlignment // buffer alignment requirement
  197. );
  198. //
  199. // Latency methods
  200. //
  201. HRESULT GetInputMaxLatency(
  202. DWORD dwInputStreamIndex,
  203. [out] REFERENCE_TIME *prtMaxLatency
  204. );
  205. HRESULT SetInputMaxLatency(
  206. DWORD dwInputStreamIndex,
  207. REFERENCE_TIME rtMaxLatency
  208. );
  209. //
  210. // Streaming / state methods
  211. //
  212. //
  213. // Flush() - discard any buffered data.
  214. //
  215. HRESULT Flush();
  216. //
  217. // Send a discontinuity to an input stream. The object will not
  218. // accept any more data on this input stream until the discontinuity
  219. // has been completely processed, which may involve multiple
  220. // ProcessOutput() calls.
  221. //
  222. HRESULT Discontinuity(DWORD dwInputStreamIndex);
  223. //
  224. // If a streaming object needs to perform any time consuming
  225. // initialization before it can stream data, it should do it inside
  226. // AllocateStreamingResources() rather than during the first process
  227. // call.
  228. //
  229. // This method is NOT guaranteed to be called before streaming
  230. // starts. If it is not called, the object should perform any
  231. // required initialization during a process call.
  232. //
  233. HRESULT AllocateStreamingResources();
  234. // Free anything allocated in AllocateStreamingResources().
  235. HRESULT FreeStreamingResources();
  236. // GetInputStatus - the only flag defined right now is ACCEPT_DATA.
  237. HRESULT GetInputStatus(
  238. DWORD dwInputStreamIndex,
  239. [out] DWORD *dwFlags // ACCEPT_DATA
  240. );
  241. //
  242. // Pass one new buffer to an input stream
  243. //
  244. HRESULT ProcessInput(
  245. DWORD dwInputStreamIndex,
  246. IMediaBuffer *pBuffer, // must not be NULL
  247. DWORD dwFlags, // DMO_INPUT_DATA_BUFFERF_XXX (syncpoint, etc.)
  248. REFERENCE_TIME rtTimestamp, // valid if flag set
  249. REFERENCE_TIME rtTimelength // valid if flag set
  250. );
  251. //
  252. // ProcessOutput() - generate output for current input buffers
  253. //
  254. // Output stream specific status information is returned in the
  255. // dwStatus member of each buffer wrapper structure.
  256. //
  257. HRESULT ProcessOutput(
  258. DWORD dwFlags, // DMO_PROCESS_OUTPUT_FLAGS
  259. DWORD cOutputBufferCount, // # returned by GetStreamCount()
  260. [in,out,size_is(cOutputBufferCount)]
  261. DMO_OUTPUT_DATA_BUFFER *pOutputBuffers, // one per stream
  262. [out] DWORD *pdwStatus // TBD, must be set to 0
  263. );
  264. // Locking - lock if bLock is TRUE, otherwise unlock
  265. HRESULT Lock(LONG bLock);
  266. };
  267. //
  268. // Interface returned by the DMO enumeration API
  269. //
  270. [
  271. object,
  272. uuid(2c3cd98a-2bfa-4a53-9c27-5249ba64ba0f)
  273. ]
  274. interface IEnumDMO : IUnknown {
  275. HRESULT Next(
  276. DWORD cItemsToFetch,
  277. [out, size_is(cItemsToFetch), length_is(*pcItemsFetched)] CLSID *pCLSID,
  278. [out, size_is(cItemsToFetch), length_is(*pcItemsFetched), string] WCHAR **Names,
  279. [out] DWORD *pcItemsFetched
  280. );
  281. HRESULT Skip(
  282. DWORD cItemsToSkip
  283. );
  284. HRESULT Reset(void);
  285. HRESULT Clone(
  286. [out] IEnumDMO **ppEnum
  287. );
  288. }
  289. // Flags for IMediaObjectInPlace::Process
  290. enum _DMO_INPLACE_PROCESS_FLAGS {
  291. DMO_INPLACE_NORMAL = 0x00000000,
  292. DMO_INPLACE_ZERO = 0x00000001
  293. };
  294. [
  295. object,
  296. uuid(651b9ad0-0fc7-4aa9-9538-d89931010741)
  297. ]
  298. interface IMediaObjectInPlace : IUnknown {
  299. // Proces - Given a buffer of size ulSize, put the output
  300. // of the DMO into the same buffer.
  301. HRESULT Process(
  302. [in] ULONG ulSize,
  303. [in,out,size_is(ulSize)] BYTE* pData,
  304. [in] REFERENCE_TIME refTimeStart,
  305. [in] DWORD dwFlags
  306. );
  307. // Create a copy of the In-Place Media Object. This allows
  308. // for very fast initialization of a number of In-Place objects
  309. // in a known state.
  310. HRESULT Clone(
  311. [out] IMediaObjectInPlace **ppMediaObject
  312. );
  313. // GetLatency - Returns a REFERENCE_TIME value
  314. // (1 tick = 100ns) which corresponds to the latency time
  315. // processing this effect will add to the graph. This assumes
  316. // the effect cost per buffer is a constant.
  317. HRESULT GetLatency(
  318. [out] REFERENCE_TIME *pLatencyTime
  319. );
  320. }
  321. // Quality control status flags
  322. enum _DMO_QUALITY_STATUS_FLAGS {
  323. DMO_QUALITY_STATUS_ENABLED = 0x00000001
  324. };
  325. [
  326. object,
  327. uuid(65abea96-cf36-453f-af8a-705e98f16260)
  328. ]
  329. interface IDMOQualityControl : IUnknown {
  330. HRESULT SetNow(
  331. [in] REFERENCE_TIME rtNow
  332. );
  333. HRESULT SetStatus(
  334. [in] DWORD dwFlags
  335. );
  336. HRESULT GetStatus(
  337. [out] DWORD *pdwFlags
  338. );
  339. }
  340. // Flags for IVideoOutputOptimizations
  341. enum _DMO_VIDEO_OUTPUT_STREAM_FLAGS {
  342. DMO_VOSF_NEEDS_PREVIOUS_SAMPLE = 0x00000001
  343. };
  344. [
  345. object,
  346. uuid(be8f4f4e-5b16-4d29-b350-7f6b5d9298ac)
  347. ]
  348. interface IDMOVideoOutputOptimizations : IUnknown {
  349. HRESULT QueryOperationModePreferences (
  350. ULONG ulOutputStreamIndex,
  351. DWORD *pdwRequestedCapabilities
  352. );
  353. HRESULT SetOperationMode (
  354. ULONG ulOutputStreamIndex,
  355. DWORD dwEnabledFeatures
  356. );
  357. HRESULT GetCurrentOperationMode (
  358. ULONG ulOutputStreamIndex,
  359. DWORD *pdwEnabledFeatures
  360. );
  361. HRESULT GetCurrentSampleRequirements (
  362. ULONG ulOutputStreamIndex,
  363. DWORD *pdwRequestedFeatures
  364. );
  365. }