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.

1284 lines
50 KiB

  1. //------------------------------------------------------------------------------
  2. // File: AXCore.idl
  3. //
  4. // Desc: Core streaming interfaces. Other ActiveMovie-only interfaces
  5. // are in AXExtend.idl.
  6. //
  7. // Copyright (c) 1992 - 2000, Microsoft Corporation. All rights reserved.
  8. //------------------------------------------------------------------------------
  9. // include unknwn.idl and objidl.idl first
  10. #define CHARS_IN_GUID 39 // 128 bits, plus { - } punctuation and terminal null
  11. // chars NOT BYTES in the standard representation
  12. // e.g. {D3588AB0-0781-11ce-B03A-0020AF0BA770} + null
  13. cpp_quote("#define CHARS_IN_GUID 39")
  14. //=====================================================================
  15. //=====================================================================
  16. // media types & formats
  17. //=====================================================================
  18. //=====================================================================
  19. // there is a high-level media type (audio, compressed video,
  20. // mpeg video, midi). Within each type, there is a subtype (cinepak, pcm)
  21. // and a length+untyped data block defining the format in a
  22. // type-specific manner. EG for video/cinepak, the data block would be
  23. // a bitmapinfo.
  24. // the contents of the format block is defined by the formattype GUID
  25. // for example FORMAT_VideoInfo, FORMAT_WaveFormatEx. In the future this
  26. // may be a pointer to an object supporting property style interfaces
  27. // in which case the GUID may be something like FORMAT_IUnknown. When
  28. // you are passed a media type you should check the format type, if
  29. // it isn't a type you recognise then don't touch the format block
  30. typedef struct _AMMediaType {
  31. GUID majortype;
  32. GUID subtype;
  33. BOOL bFixedSizeSamples;
  34. BOOL bTemporalCompression;
  35. ULONG lSampleSize;
  36. GUID formattype;
  37. IUnknown *pUnk;
  38. ULONG cbFormat;
  39. [size_is(cbFormat)] BYTE * pbFormat;
  40. } AM_MEDIA_TYPE;
  41. //=====================================================================
  42. //=====================================================================
  43. // pin information
  44. //=====================================================================
  45. //=====================================================================
  46. // is this an input or output pin
  47. typedef enum _PinDirection {
  48. PINDIR_INPUT,
  49. PINDIR_OUTPUT
  50. } PIN_DIRECTION;
  51. // other types that need defining
  52. #define MAX_PIN_NAME 128
  53. cpp_quote("#define MAX_PIN_NAME 128")
  54. cpp_quote("#define MAX_FILTER_NAME 128")
  55. #define MAX_FILTER_NAME 128
  56. //=====================================================================
  57. //=====================================================================
  58. // time information
  59. //
  60. // This represents a time (either reference or stream) in 100ns units
  61. // The class library contains a CRefTime helper class
  62. // that supports simple comparison and arithmetic operations
  63. //=====================================================================
  64. //=====================================================================
  65. typedef LONGLONG REFERENCE_TIME;
  66. typedef double REFTIME;
  67. // Win32 HANDLEs have to be cast to these as the MIDL compiler doesn't
  68. // like the HANDLE type or in fact anything remotely associated with
  69. // them. If this ever gets ported to a MAC environment then these will
  70. // have to become an alertable synchronisation object that it supports
  71. typedef DWORD_PTR HSEMAPHORE;
  72. typedef DWORD_PTR HEVENT;
  73. //=====================================================================
  74. //=====================================================================
  75. // Allocator properties
  76. //
  77. // Used to describe the actual properties of an allocator,
  78. // and used to request properties from an allocator or from an upstream
  79. // filter that could create an allocator. See IMemAllocator and
  80. // IMemInputPin.
  81. //=====================================================================
  82. //=====================================================================
  83. typedef struct _AllocatorProperties {
  84. long cBuffers; // count of buffers at this allocator
  85. long cbBuffer; // size of each buffer, excluding any prefix
  86. // alignment of the buffer - buffer start will be aligned on a multiple of
  87. // this amount
  88. long cbAlign;
  89. // prefix amount. Each buffer is immediately preceeded by cbPrefix bytes.
  90. // note that GetPointer points to the beginning of the buffer proper.
  91. // the prefix is aligned, i.e. (GetPointer() - cbPrefix) is aligned on cbAlign.
  92. long cbPrefix;
  93. } ALLOCATOR_PROPERTIES;
  94. // forward declarations (in alphabetical order - we were getting duplicates)
  95. interface IAMovieSetup;
  96. interface IEnumFilters;
  97. interface IEnumMediaTypes;
  98. interface IEnumPins;
  99. interface IBaseFilter;
  100. interface IFilterGraph;
  101. interface IMediaFilter;
  102. interface IMediaSample;
  103. interface IMemAllocator;
  104. interface IMemAllocatorCallbackTemp;
  105. interface IMemAllocatorNotifyCallbackTemp;
  106. interface IMemInputPin;
  107. interface IPin;
  108. interface IReferenceClock;
  109. //=====================================================================
  110. //=====================================================================
  111. // Defines IPin interface
  112. //
  113. // interface representing a single, unidirection connection point on a
  114. // filter. A Pin will connect to exactly one other pin on another filter.
  115. // This interface represents the interface other objects can call on
  116. // this pin. The interface between the filter and the pin is private to
  117. // the implementation of a specific filter.
  118. //
  119. // During the connection process, one pin will be instructed to take
  120. // the lead: the connect interface on this pin will be calling, passing
  121. // the IPin* for the other pin. This connecting pin will call the
  122. // ReceiveConnection member function on the other pin, as well as presumably
  123. // other format-enumeration and queryinterface calls to establish whether
  124. // the connection is possible.
  125. //=====================================================================
  126. //=====================================================================
  127. [
  128. object,
  129. uuid(56a86891-0ad4-11ce-b03a-0020af0ba770),
  130. pointer_default(unique)
  131. ]
  132. interface IPin : IUnknown {
  133. // initiate a connection to another pin. calls ReceiveConnection on the
  134. // other pin. Verifies that the connection is possible and may reject
  135. // it.
  136. // The mediatype parameter is optional. If it is not null, the pin must
  137. // connect using that media type if possible. The subtype and/or format
  138. // type can be GUID_NULL, meaning that the pin can fill them in as desired.
  139. // This allows an application to partially specify the media type to be
  140. // used for the connection, insisting on eg YUV 422 but leaving details
  141. // (such as the image size) to be negotiated between the pins.
  142. HRESULT Connect(
  143. [in] IPin * pReceivePin, // connect yourself to this pin
  144. [in] const AM_MEDIA_TYPE * pmt // (optional) connect using this type
  145. );
  146. // called by a connecting pin to make a connection
  147. HRESULT ReceiveConnection(
  148. [in] IPin * pConnector,
  149. [in] const AM_MEDIA_TYPE *pmt // this is the media type we will exchange
  150. );
  151. // break a connection - no params since there is only one connection
  152. // possible on this pin
  153. HRESULT Disconnect(void);
  154. // Find the pin this pin is connected to (if any)
  155. // The pointer returned is AddRef()d
  156. // Fails if the pin is not connected
  157. HRESULT ConnectedTo(
  158. [out] IPin **pPin
  159. );
  160. // Return the media type of a connection if the pin is connected
  161. HRESULT ConnectionMediaType(
  162. [out] AM_MEDIA_TYPE *pmt
  163. );
  164. // get information about the pin itself
  165. typedef struct _PinInfo {
  166. IBaseFilter *pFilter; // the filter this pin is on
  167. PIN_DIRECTION dir; // am I an input or output pin?
  168. WCHAR achName[MAX_PIN_NAME]; // the name of this pin within this filter
  169. } PIN_INFO;
  170. HRESULT QueryPinInfo(
  171. [out] PIN_INFO * pInfo
  172. );
  173. // We often want to know the direction. Rather than use the
  174. // relatively expensive QueryPinInfo, use this
  175. HRESULT QueryDirection(
  176. [out] PIN_DIRECTION *pPinDir
  177. );
  178. // Get an identifier for the pin (allows connections to be saved).
  179. // The storage will be allocated by the filter using CoTaskMemAlloc
  180. // The caller should free it using CoTaskMemFree
  181. HRESULT QueryId(
  182. [out] LPWSTR * Id
  183. );
  184. // will the pin accept the format type, S_OK yes, S_FALSE no
  185. HRESULT QueryAccept(
  186. [in] const AM_MEDIA_TYPE *pmt
  187. );
  188. // return an enumerator for this pin's preferred media types
  189. HRESULT EnumMediaTypes(
  190. [out] IEnumMediaTypes **ppEnum
  191. );
  192. // return an array of IPin* - the pins that this pin internally connects to
  193. // All pins put in the array must be AddReffed (but no others)
  194. // Errors: "Can't say" - FAIL; not enough slots - return S_FALSE
  195. // Default: return E_NOTIMPL
  196. // The filter graph will interpret E_NOTIMPL as any input pin connects to
  197. // all visible output pins and vise versa.
  198. // apPin can be NULL if nPin==0 (not otherwise).
  199. HRESULT QueryInternalConnections(
  200. [out] IPin* *apPin, // array of IPin*
  201. [in, out] ULONG *nPin // on input, the number of slots
  202. // on output the number of pins
  203. );
  204. // notify the pin that no more data is expected until a new run
  205. // command is issued. End of stream should be queued and delivered after
  206. // all queued data is delivered. Pass through if there is no queued data.
  207. // Flush should flush any queued EOS.
  208. // returns S_OK unless there is some error.
  209. // input pins only: output pins will normally return E_UNEXPECTED.
  210. HRESULT EndOfStream(void);
  211. // Flush
  212. // Enter flush state: do the following steps (in order)
  213. // -- prevent any more Receives succeeding (set a flushing flag)
  214. // -- discard any queued data
  215. // -- free anyone blocked on Receive in your filter
  216. // -- pass BeginFlush to any downstream pins
  217. HRESULT BeginFlush(void);
  218. // End flush state: do the following steps in order
  219. // -- ensure no more data will be pushed by your filter
  220. // (sync with thread if you have one, stop it pushing and
  221. // discard any queued data)
  222. // -- re-enable Receive (clear internal flushing flag)
  223. // -- pass EndFlush to any downstream pins
  224. HRESULT EndFlush(void);
  225. // informational: all data arriving after this call is part of a segment
  226. // from StartTime to StopTime, played at rate. This allows filters that
  227. // process buffers containing more than one sample to clip the rendering
  228. // to within the start and stop times.
  229. //
  230. // A source pin will call a destination pin on this method after completing
  231. // delivery of any previous data, and before any Receive calls for the
  232. // new data
  233. HRESULT NewSegment(
  234. [in] REFERENCE_TIME tStart,
  235. [in] REFERENCE_TIME tStop,
  236. [in] double dRate);
  237. }
  238. typedef IPin *PPIN;
  239. //=====================================================================
  240. //=====================================================================
  241. // Defines IEnumPins interface
  242. //
  243. // interface returned from IBaseFilter::EnumPins(). based on IEnumXXXX
  244. //=====================================================================
  245. //=====================================================================
  246. [
  247. object,
  248. uuid(56a86892-0ad4-11ce-b03a-0020af0ba770),
  249. pointer_default(unique)
  250. ]
  251. interface IEnumPins : IUnknown {
  252. HRESULT Next(
  253. [in] ULONG cPins, // place this many pins...
  254. [out, size_is(cPins)] IPin ** ppPins, // ...in this array
  255. [out] ULONG * pcFetched // actual count passed
  256. );
  257. HRESULT Skip(
  258. [in] ULONG cPins);
  259. HRESULT Reset(void);
  260. HRESULT Clone(
  261. [out] IEnumPins **ppEnum
  262. );
  263. }
  264. typedef IEnumPins *PENUMPINS;
  265. //=====================================================================
  266. //=====================================================================
  267. // Defines IEnumMediaTypes interface
  268. //
  269. // Enumerates the preferred formats for a pin
  270. //=====================================================================
  271. //=====================================================================
  272. [
  273. object,
  274. uuid(89c31040-846b-11ce-97d3-00aa0055595a),
  275. pointer_default(unique)
  276. ]
  277. interface IEnumMediaTypes : IUnknown {
  278. // to call this member function pass in the address of a pointer to a
  279. // media type. The interface will allocate the necessary AM_MEDIA_TYPE
  280. // structures and initialise them with the variable format block
  281. HRESULT Next(
  282. [in] ULONG cMediaTypes, // place this many types...
  283. [out, size_is(cMediaTypes)]
  284. AM_MEDIA_TYPE ** ppMediaTypes, // ...in this array
  285. [out] ULONG * pcFetched // actual count passed
  286. );
  287. HRESULT Skip(
  288. [in] ULONG cMediaTypes);
  289. HRESULT Reset(void);
  290. HRESULT Clone(
  291. [out] IEnumMediaTypes **ppEnum
  292. );
  293. }
  294. typedef IEnumMediaTypes *PENUMMEDIATYPES;
  295. //========================================================================
  296. //========================================================================
  297. // Defines IFilterGraph interface
  298. //
  299. // abstraction representing a graph of filters
  300. // This allows filters to be joined into a graph and operated as a unit.
  301. //========================================================================
  302. //========================================================================
  303. [
  304. object,
  305. uuid(56a8689f-0ad4-11ce-b03a-0020af0ba770),
  306. pointer_default(unique)
  307. ]
  308. interface IFilterGraph : IUnknown {
  309. //==========================================================================
  310. // Low level filter functions
  311. //==========================================================================
  312. // Add a filter to the graph and name it with *pName.
  313. // If the name is not unique, The request will fail.
  314. // The Filter graph will call the JoinFilterGraph
  315. // member function of the filter to inform it.
  316. // This must be called before attempting Connect, ConnectDirect or Render
  317. // for pins of the filter.
  318. HRESULT AddFilter
  319. ( [in] IBaseFilter * pFilter,
  320. [in, string] LPCWSTR pName
  321. );
  322. // Remove a filter from the graph. The filter graph implementation
  323. // will inform the filter that it is being removed.
  324. HRESULT RemoveFilter
  325. ( [in] IBaseFilter * pFilter
  326. );
  327. // Set *ppEnum to be an enumerator for all filters in the graph.
  328. HRESULT EnumFilters
  329. ( [out] IEnumFilters **ppEnum
  330. );
  331. // Set *ppFilter to be the filter which was added with the name *pName
  332. // Will fail and set *ppFilter to NULL if the name is not in this graph.
  333. HRESULT FindFilterByName
  334. ( [in, string] LPCWSTR pName,
  335. [out] IBaseFilter ** ppFilter
  336. );
  337. //==========================================================================
  338. // Low level connection functions
  339. //==========================================================================
  340. // Connect these two pins directly (i.e. without intervening filters)
  341. // the media type is optional, and may be partially specified (that is
  342. // the subtype and/or format type may be GUID_NULL). See IPin::Connect
  343. // for details of the media type parameter.
  344. HRESULT ConnectDirect
  345. ( [in] IPin * ppinOut, // the output pin
  346. [in] IPin * ppinIn, // the input pin
  347. [in, unique] const AM_MEDIA_TYPE* pmt // optional mediatype
  348. );
  349. // Break the connection that this pin has and reconnect it to the
  350. // same other pin.
  351. HRESULT Reconnect
  352. ( [in] IPin * ppin // the pin to disconnect and reconnect
  353. );
  354. // Disconnect this pin, if connected. Successful no-op if not connected.
  355. HRESULT Disconnect
  356. ( [in] IPin * ppin
  357. );
  358. //==========================================================================
  359. // intelligent connectivity - now in IGraphBuilder, axextend.idl
  360. //==========================================================================
  361. //==========================================================================
  362. // Whole graph functions
  363. //==========================================================================
  364. // Once a graph is built, it can behave as a (composite) filter.
  365. // To control this filter, QueryInterface for IMediaFilter.
  366. // The filtergraph will by default ensure that the graph has a sync source
  367. // when it is made to Run. SetSyncSource(NULL) will prevent that and allow
  368. // all the filters to run unsynchronised until further notice.
  369. // SetDefaultSyncSource will set the default sync source (the same as would
  370. // have been set by default on the first call to Run).
  371. HRESULT SetDefaultSyncSource(void);
  372. }
  373. typedef IFilterGraph *PFILTERGRAPH;
  374. //==========================================================================
  375. //==========================================================================
  376. // Defines IEnumFilters interface
  377. //
  378. // enumerator interface returned from IFilterGraph::EnumFilters().
  379. // based on IEnum pseudo-template
  380. //==========================================================================
  381. //==========================================================================
  382. [
  383. object,
  384. uuid(56a86893-0ad4-11ce-b03a-0020af0ba770),
  385. pointer_default(unique)
  386. ]
  387. interface IEnumFilters : IUnknown {
  388. HRESULT Next
  389. ( [in] ULONG cFilters, // place this many filters...
  390. [out] IBaseFilter ** ppFilter, // ...in this array of IBaseFilter*
  391. [out] ULONG * pcFetched // actual count passed returned here
  392. );
  393. HRESULT Skip
  394. ( [in] ULONG cFilters
  395. );
  396. HRESULT Reset(void);
  397. HRESULT Clone
  398. ( [out] IEnumFilters **ppEnum
  399. );
  400. }
  401. typedef IEnumFilters *PENUMFILTERS;
  402. //=====================================================================
  403. //=====================================================================
  404. // Defines IMediaFilter interface
  405. //
  406. // multimedia components that provide time-based data will expose this.
  407. // this interface abstracts an object that processes time-based data streams
  408. // and represents a multimedia device (possibly implemented in software).
  409. // it controls the active/running state of the object and its synchronization
  410. // to other objects in the system.
  411. //
  412. // derived from IPersist so that all filter-type objects in a graph
  413. // can have their class id serialised.
  414. //=====================================================================
  415. //=====================================================================
  416. [
  417. object,
  418. uuid(56a86899-0ad4-11ce-b03a-0020af0ba770),
  419. pointer_default(unique)
  420. ]
  421. interface IMediaFilter : IPersist {
  422. // tell the filter to transition to the new state. The state transition
  423. // may not be instantaneous (external mechanical activity may be involved,
  424. // for example). The state functions may return before the state
  425. // transition has completed
  426. // these functions will return S_OK if the transition is complete, S_FALSE if
  427. // the transition is not complete but no error has occurred, or some error value
  428. // if the transition failed.
  429. HRESULT Stop(void);
  430. HRESULT Pause(void);
  431. // in order to synchronise independent streams, you must pass a time
  432. // value with the Run command. This is the difference between stream
  433. // time and reference time. That is, it is the amount to be added to
  434. // the IMediaSample timestamp to get the time at which that sample
  435. // should be rendered according to the reference clock.
  436. // If we are starting at the beginning of the stream, it will thus be
  437. // simply the time at which the first sample should appear. If we are
  438. // restarting from Paused mode in midstream, then it will be the total
  439. // time we have been paused added to the initial start time.
  440. // the filtergraph will provide this information to its filters. If you
  441. // are an app calling the filtergraph, it's ok to pass a start time of
  442. // 0, in which case the filter graph will calculate a soon-as-possible
  443. // time. FilterGraphs will accept 0 meaning ASAP; most filters will not.
  444. HRESULT Run(REFERENCE_TIME tStart);
  445. // possible states that the filter could be in
  446. typedef enum _FilterState {
  447. State_Stopped, // not in use
  448. State_Paused, // holding resources, ready to go
  449. State_Running // actively processing media stream
  450. } FILTER_STATE;
  451. // find out what state the filter is in.
  452. // If timeout is 0, will return immediately - if a state transition is
  453. // not complete, it will return the state being transitioned into, and
  454. // the return code will be VFW_S_STATE_INTERMEDIATE. if no state
  455. // transition is in progress the state will be returned and the return
  456. // code will be S_OK.
  457. //
  458. // If timeout is non-zero, GetState will not return until the state
  459. // transition is complete, or the timeout expires.
  460. // The timeout is in milliseconds.
  461. // You can also pass in INFINITE as a special value for the timeout, in
  462. // which case it will block indefinitely waiting for the state transition
  463. // to complete. If the timeout expires, the state returned is the
  464. // state we are trying to reach, and the return code will be
  465. // VFW_S_STATE_INTERMEDIATE. If no state transition is in progress
  466. // the routine returns immediately with return code S_OK.
  467. //
  468. // return State is State_Running, State_Paused or State_Stopped.
  469. // return code is S_OK, or VFW_S_STATE_INTERMEDIATE if state
  470. // transition is not complete or an error value if the method failed.
  471. HRESULT GetState(
  472. [in] DWORD dwMilliSecsTimeout,
  473. [out] FILTER_STATE *State);
  474. // tell the filter the reference clock to which it should synchronize
  475. // activity. This is most important to rendering filters and may not
  476. // be of any interest to other filters.
  477. HRESULT SetSyncSource(
  478. [in] IReferenceClock * pClock);
  479. // get the reference clock currently in use (it may be NULL)
  480. HRESULT GetSyncSource(
  481. [out] IReferenceClock ** pClock);
  482. }
  483. typedef IMediaFilter *PMEDIAFILTER;
  484. //=====================================================================
  485. //=====================================================================
  486. // Defines IBaseFilter interface
  487. //
  488. // all multimedia components will expose this interface
  489. // this interface abstracts an object that has typed input and output
  490. // connections and can be dynamically aggregated.
  491. //
  492. // IMediaFilter supports synchronisation and activity state: IBaseFilter
  493. // is derived from that since all filters need to support IMediaFilter,
  494. // whereas a few objects (plug-in control distributors for example) will
  495. // support IMediaFilter but not IBaseFilter.
  496. //
  497. // IMediaFilter is itself derived from IPersist so that every filter
  498. //supports GetClassID()
  499. //=====================================================================
  500. //=====================================================================
  501. [
  502. object,
  503. uuid(56a86895-0ad4-11ce-b03a-0020af0ba770),
  504. pointer_default(unique)
  505. ]
  506. interface IBaseFilter : IMediaFilter {
  507. // enumerate all the pins available on this filter
  508. // allows enumeration of all pins only.
  509. //
  510. HRESULT EnumPins(
  511. [out] IEnumPins ** ppEnum // enum interface returned here
  512. );
  513. // Convert the external identifier of a pin to an IPin *
  514. // This pin id is quite different from the pin Name in CreatePin.
  515. // In CreatePin the Name is invented by the caller. In FindPin the Id
  516. // must have come from a previous call to IPin::QueryId. Whether or not
  517. // this operation would cause a pin to be created depends on the filter
  518. // design, but if called twice with the same id it should certainly
  519. // return the same pin both times.
  520. HRESULT FindPin(
  521. [in, string] LPCWSTR Id,
  522. [out] IPin ** ppPin
  523. );
  524. // find out information about this filter
  525. typedef struct _FilterInfo {
  526. WCHAR achName[MAX_FILTER_NAME]; // maybe null if not part of graph
  527. IFilterGraph * pGraph; // null if not part of graph
  528. } FILTER_INFO;
  529. HRESULT QueryFilterInfo(
  530. [out] FILTER_INFO * pInfo
  531. );
  532. // notify a filter that it has joined a filter graph. It is permitted to
  533. // refuse. The filter should addref and store this interface for later use
  534. // since it may need to notify events to this interface. A null pointer indicates
  535. // that the filter is no longer part of a graph.
  536. HRESULT JoinFilterGraph(
  537. [in] IFilterGraph * pGraph,
  538. [in, string] LPCWSTR pName
  539. );
  540. // return a Vendor information string. Optional - may return E_NOTIMPL.
  541. // memory returned should be freed using CoTaskMemFree
  542. HRESULT QueryVendorInfo(
  543. [out, string] LPWSTR* pVendorInfo
  544. );
  545. }
  546. typedef IBaseFilter *PFILTER;
  547. //=====================================================================
  548. //=====================================================================
  549. // sync and state management
  550. //=====================================================================
  551. //=====================================================================
  552. //=====================================================================
  553. //=====================================================================
  554. // Defines IReferenceClock interface
  555. //=====================================================================
  556. //=====================================================================
  557. [
  558. object,
  559. uuid(56a86897-0ad4-11ce-b03a-0020af0ba770),
  560. pointer_default(unique)
  561. ]
  562. interface IReferenceClock : IUnknown {
  563. // get the time now
  564. HRESULT GetTime(
  565. [out] REFERENCE_TIME *pTime
  566. );
  567. // ask for an async notification that a time has elapsed
  568. HRESULT AdviseTime(
  569. [in] REFERENCE_TIME baseTime, // base reference time
  570. [in] REFERENCE_TIME streamTime, // stream offset time
  571. [in] HEVENT hEvent, // advise via this event
  572. [out] DWORD_PTR * pdwAdviseCookie // where your cookie goes
  573. );
  574. // ask for an async periodic notification that a time has elapsed
  575. HRESULT AdvisePeriodic(
  576. [in] REFERENCE_TIME startTime, // starting at this time
  577. [in] REFERENCE_TIME periodTime, // time between notifications
  578. [in] HSEMAPHORE hSemaphore, // advise via a semaphore
  579. [out] DWORD_PTR * pdwAdviseCookie // where your cookie goes
  580. );
  581. // cancel a request for notification
  582. HRESULT Unadvise(
  583. [in] DWORD_PTR dwAdviseCookie);
  584. }
  585. typedef IReferenceClock *PREFERENCECLOCK;
  586. //=====================================================================
  587. //=====================================================================
  588. // Defines IReferenceClock2 interface
  589. //=====================================================================
  590. //=====================================================================
  591. [
  592. object,
  593. uuid(36b73885-c2c8-11cf-8b46-00805f6cef60),
  594. pointer_default(unique)
  595. ]
  596. interface IReferenceClock2 : IReferenceClock {
  597. }
  598. typedef IReferenceClock2 *PREFERENCECLOCK2;
  599. //=====================================================================
  600. //=====================================================================
  601. // Data transport interfaces
  602. //=====================================================================
  603. //=====================================================================
  604. //=====================================================================
  605. //=====================================================================
  606. // Defines IMediaSample interface
  607. //=====================================================================
  608. //=====================================================================
  609. [
  610. local,
  611. object,
  612. uuid(56a8689a-0ad4-11ce-b03a-0020af0ba770),
  613. pointer_default(unique)
  614. ]
  615. interface IMediaSample : IUnknown {
  616. // get me a read/write pointer to this buffer's memory. I will actually
  617. // want to use sizeUsed bytes.
  618. HRESULT GetPointer([out] BYTE ** ppBuffer);
  619. // return the size in bytes of the buffer data area
  620. long GetSize(void);
  621. // get the stream time at which this sample should start and finish.
  622. HRESULT GetTime(
  623. [out] REFERENCE_TIME * pTimeStart, // put time here
  624. [out] REFERENCE_TIME * pTimeEnd
  625. );
  626. // Set the stream time at which this sample should start and finish.
  627. // pTimeStart==pTimeEnd==NULL will invalidate the time stamps in
  628. // this sample
  629. HRESULT SetTime(
  630. [in] REFERENCE_TIME * pTimeStart, // put time here
  631. [in] REFERENCE_TIME * pTimeEnd
  632. );
  633. // sync-point property. If true, then the beginning of this
  634. // sample is a sync-point. (note that if AM_MEDIA_TYPE.bTemporalCompression
  635. // is false then all samples are sync points). A filter can start
  636. // a stream at any sync point. S_FALSE if not sync-point, S_OK if true.
  637. HRESULT IsSyncPoint(void);
  638. HRESULT SetSyncPoint(BOOL bIsSyncPoint);
  639. // preroll property. If true, this sample is for preroll only and
  640. // shouldn't be displayed.
  641. HRESULT IsPreroll(void);
  642. HRESULT SetPreroll(BOOL bIsPreroll);
  643. long GetActualDataLength(void);
  644. HRESULT SetActualDataLength(long);
  645. // these allow for limited format changes in band - if no format change
  646. // has been made when you receive a sample GetMediaType will return S_FALSE
  647. HRESULT GetMediaType(AM_MEDIA_TYPE **ppMediaType);
  648. HRESULT SetMediaType(AM_MEDIA_TYPE *pMediaType);
  649. // returns S_OK if there is a discontinuity in the data (this frame is
  650. // not a continuation of the previous stream of data
  651. // - there has been a seek or some dropped samples).
  652. HRESULT IsDiscontinuity(void);
  653. // set the discontinuity property - TRUE if this sample is not a
  654. // continuation, but a new sample after a seek or a dropped sample.
  655. HRESULT SetDiscontinuity(BOOL bDiscontinuity);
  656. // get the media times for this sample
  657. HRESULT GetMediaTime(
  658. [out] LONGLONG * pTimeStart,
  659. [out] LONGLONG * pTimeEnd
  660. );
  661. // Set the media times for this sample
  662. // pTimeStart==pTimeEnd==NULL will invalidate the media time stamps in
  663. // this sample
  664. HRESULT SetMediaTime(
  665. [in] LONGLONG * pTimeStart,
  666. [in] LONGLONG * pTimeEnd
  667. );
  668. }
  669. typedef IMediaSample *PMEDIASAMPLE;
  670. // Values for dwFlags for AM_SAMPLE_PROPERTIES
  671. enum tagAM_SAMPLE_PROPERTY_FLAGS
  672. { AM_SAMPLE_SPLICEPOINT = 0x01, /* Is this a splice point
  673. IE can it be decoded
  674. without reference to
  675. previous data */
  676. AM_SAMPLE_PREROLL = 0x02, /* Is this a preroll sample */
  677. AM_SAMPLE_DATADISCONTINUITY = 0x04, /* Set if start of new segment */
  678. AM_SAMPLE_TYPECHANGED = 0x08, /* Has the type changed */
  679. AM_SAMPLE_TIMEVALID = 0x10, /* Set if time is valid */
  680. AM_SAMPLE_TIMEDISCONTINUITY = 0x40, /* time gap in data starts after
  681. this sample - pbBuffer can
  682. be NULL
  683. */
  684. AM_SAMPLE_FLUSH_ON_PAUSE = 0x80, /* For live data - discard
  685. in paused state
  686. */
  687. AM_SAMPLE_STOPVALID = 0x100, /* Stop time is valid */
  688. AM_SAMPLE_ENDOFSTREAM = 0x200, /* End of stream after
  689. this data
  690. This is reserved for
  691. kernel streaming and is
  692. not currently used by
  693. ActiveMovie
  694. */
  695. AM_STREAM_MEDIA = 0, /* Normal data stream id */
  696. AM_STREAM_CONTROL = 1 /* Control stream id */
  697. /* > 7FFFFFFF is application
  698. defined stream
  699. */
  700. };
  701. // Media sample generic properties structure
  702. typedef struct tagAM_SAMPLE2_PROPERTIES {
  703. DWORD cbData; // Length of generic data for extensiblity
  704. // Number of bytes INCLUDING this field
  705. DWORD dwTypeSpecificFlags; // Type specific flag data
  706. DWORD dwSampleFlags; // Flags bits defined by AM_SAMPLE_xxx flags
  707. // All undefined bits RESERVED (set to 0,
  708. // leave on copy)
  709. LONG lActual; // Length of data in buffer
  710. REFERENCE_TIME tStart; // Start time if valid
  711. REFERENCE_TIME tStop; // Stop time if valid
  712. DWORD dwStreamId; // Stream 0 is normal media transport
  713. // Stream 1 is control
  714. AM_MEDIA_TYPE *pMediaType; // Copy of media type - INVALID after Release()
  715. BYTE *pbBuffer; // Pointer to buffer - INVALID after Release()
  716. LONG cbBuffer; // Length of buffer
  717. } AM_SAMPLE2_PROPERTIES;
  718. //=====================================================================
  719. //=====================================================================
  720. // Defines IMediaSample2 interface
  721. //=====================================================================
  722. //=====================================================================
  723. [
  724. local,
  725. object,
  726. uuid(36b73884-c2c8-11cf-8b46-00805f6cef60),
  727. pointer_default(unique)
  728. ]
  729. interface IMediaSample2 : IMediaSample {
  730. // Get sample properties
  731. //
  732. // cbProperties - length of generic data to retrieve
  733. // pbProperties - pointer to generic data buffer - can
  734. // be NULL if cbProperties is NULL
  735. // data conforms to AM_SAMPLE_PROPERTIES
  736. //
  737. HRESULT GetProperties(
  738. [in] DWORD cbProperties,
  739. [out, size_is(cbProperties)] BYTE * pbProperties
  740. );
  741. // Set sample properties
  742. //
  743. // cbProperties - length of generic data to set
  744. // pbProperties - pointer to generic data buffer - can
  745. // be NULL if cbProperties is NULL
  746. // data conforms to AM_SAMPLE_PROPERTIES
  747. //
  748. //
  749. HRESULT SetProperties(
  750. [in] DWORD cbProperties,
  751. [in, size_is(cbProperties)] const BYTE * pbProperties
  752. );
  753. // // Get the clock associated with the sample
  754. // HRESULT GetClock(
  755. // [out] IReferenceClock2 **ppClock
  756. // );
  757. // // Get a pointer to the object containing the data
  758. // //
  759. // // riid - IID of interface required on object
  760. // // ppvobject - Pointer to object containing the data
  761. // //
  762. // // Returns
  763. // // S_OK - Got the object
  764. // // E_NOINTERFACE - object does not support this interface
  765. // // if IUnknown is not supported
  766. // // there is no backing object
  767. // // E_NOTIMPL - samples don't have backing objects
  768. // //
  769. // //
  770. // HRESULT GetBackingObject(
  771. // [in] REFIID riid,
  772. // [out] void **ppvObject
  773. // );
  774. }
  775. typedef IMediaSample2 *PMEDIASAMPLE2;
  776. // flags for dwFlags in IMemAllocator::GetBuffer
  777. // AM_GBF_PREVFRAMESKIPPED is only significant when asking for a buffer from the
  778. // video renderer. It should be TRUE if and only if the previous frame
  779. // was skipped. It affects quality management.
  780. // AM_GBF_NOTASYNCPOINT indicates to the downstream filter (most likely the
  781. // video renderer) that you are not going to fill this buffer with a sync point
  782. // (keyframe) so now would be a bad time to return a buffer with a dynamic
  783. // format change, because you will be unable to switch to the new format without
  784. // waiting for the next sync point, causing some frames to be dropped.
  785. #define AM_GBF_PREVFRAMESKIPPED 1
  786. #define AM_GBF_NOTASYNCPOINT 2
  787. cpp_quote("#define AM_GBF_PREVFRAMESKIPPED 1")
  788. cpp_quote("#define AM_GBF_NOTASYNCPOINT 2")
  789. // This may not be supported by allocators
  790. cpp_quote("#define AM_GBF_NOWAIT 4")
  791. // This flag is supported by the VMR's surface allocator
  792. // When set the DDraw surface used for the media sample
  793. // is returned is an un-locked state. Calls the GetPointer on
  794. // the returned media sample will fail and return a NULL pointer
  795. //
  796. cpp_quote("#define AM_GBF_NODDSURFACELOCK 8")
  797. //=====================================================================
  798. //=====================================================================
  799. // Defines IMemAllocator interface
  800. //
  801. // an allocator of IMediaSample blocks to be used for data transfer between
  802. // pins. Can be provided by input, output or a third party. Release
  803. // the IMediaSample object obtained back to the pool by calling
  804. // IMediaSample::Release.
  805. //=====================================================================
  806. //=====================================================================
  807. [
  808. object,
  809. uuid(56a8689c-0ad4-11ce-b03a-0020af0ba770),
  810. pointer_default(unique)
  811. ]
  812. interface IMemAllocator : IUnknown {
  813. // negotiate buffer sizes, buffer count and alignment. pRequest is filled
  814. // in by the caller with the requested values. pActual will be returned
  815. // by the allocator with the closest that the allocator can come to this.
  816. // Cannot be called unless the allocator is decommitted.
  817. // Calls to GetBuffer need not succeed until Commit is called.
  818. HRESULT SetProperties(
  819. [in] ALLOCATOR_PROPERTIES* pRequest,
  820. [out] ALLOCATOR_PROPERTIES* pActual);
  821. // return the properties actually being used on this allocator
  822. HRESULT GetProperties(
  823. [out] ALLOCATOR_PROPERTIES* pProps);
  824. // commit the memory for the agreed buffers
  825. HRESULT Commit(void);
  826. // release the memory for the agreed buffers. Any threads waiting in
  827. // GetBuffer will return with an error. GetBuffer calls will always fail
  828. // if called before Commit or after Decommit.
  829. HRESULT Decommit(void);
  830. // get container for a sample. Blocking, synchronous call to get the
  831. // next free buffer (as represented by an IMediaSample interface).
  832. // on return, the time etc properties will be invalid, but the buffer
  833. // pointer and size will be correct.
  834. // Will only succeed if memory is committed. If GetBuffer is blocked
  835. // waiting for a buffer and Decommit is called on another thread,
  836. // GetBuffer will return with an error.
  837. HRESULT GetBuffer(
  838. [out] IMediaSample **ppBuffer,
  839. [in] REFERENCE_TIME * pStartTime,
  840. [in] REFERENCE_TIME * pEndTime,
  841. [in] DWORD dwFlags
  842. );
  843. // put a buffer back on the allocators free list.
  844. // this is typically called by the Release() method of the media
  845. // sample when the reference count goes to 0
  846. //
  847. HRESULT ReleaseBuffer(
  848. [in] IMediaSample *pBuffer
  849. );
  850. }
  851. typedef IMemAllocator *PMEMALLOCATOR;
  852. //=====================================================================
  853. //=====================================================================
  854. // Defines IMemAllocatorCallbackTemp interface
  855. //
  856. // If the allocator supports IMemAllocator2 then callbacks are
  857. // available
  858. //
  859. //=====================================================================
  860. //=====================================================================
  861. [
  862. object,
  863. uuid(379a0cf0-c1de-11d2-abf5-00a0c905f375),
  864. pointer_default(unique)
  865. ]
  866. interface IMemAllocatorCallbackTemp : IMemAllocator {
  867. // Set notification interface. pNotify can be NULL
  868. HRESULT SetNotify(
  869. [in] IMemAllocatorNotifyCallbackTemp *pNotify);
  870. // Get current stats
  871. HRESULT GetFreeCount(
  872. [out] LONG *plBuffersFree);
  873. }
  874. //=====================================================================
  875. //=====================================================================
  876. // Defines IMemAllocatorNotify interface
  877. //
  878. //=====================================================================
  879. //=====================================================================
  880. [
  881. object,
  882. uuid(92980b30-c1de-11d2-abf5-00a0c905f375),
  883. pointer_default(unique)
  884. ]
  885. interface IMemAllocatorNotifyCallbackTemp : IUnknown {
  886. // Called whenever ReleaseBuffer is called in the allocator
  887. // Note the caller may have acquired locks and this call may
  888. // occur in any context so generally the implementor of this
  889. // call will just set an event or post a message for another
  890. // thread to take action.
  891. HRESULT NotifyRelease();
  892. }
  893. //=====================================================================
  894. //=====================================================================
  895. // Defines IMemInputPin interface
  896. //
  897. // basic shared memory transport interface.
  898. //=====================================================================
  899. //=====================================================================
  900. [
  901. object,
  902. uuid(56a8689d-0ad4-11ce-b03a-0020af0ba770),
  903. pointer_default(unique)
  904. ]
  905. interface IMemInputPin : IUnknown {
  906. // return the allocator interface that this input pin
  907. // would like the output pin to use
  908. HRESULT GetAllocator(
  909. [out] IMemAllocator ** ppAllocator);
  910. // tell the input pin which allocator the output pin is actually
  911. // going to use.
  912. // If the readonly flag is set, then all samples from this allocator are
  913. // to be treated as read-only, and should be copied before being modified.
  914. HRESULT NotifyAllocator(
  915. [in] IMemAllocator * pAllocator,
  916. [in] BOOL bReadOnly
  917. );
  918. // this method is optional (can return E_NOTIMPL). Output pins are not obliged to call
  919. // this method, nor are they obliged to fulfil the request. Input pins making such a
  920. // request should check the allocator in NotifyAllocator to see if it meets their needs. If
  921. // not, the input pin is responsible for any necessary data copy.
  922. // Zero values will be treated as don't care: so a pin can return an alignment value
  923. // and leave the other values 0.
  924. HRESULT GetAllocatorRequirements( [out] ALLOCATOR_PROPERTIES*pProps);
  925. // here's the next block of data from the stream. AddRef it if
  926. // you need to hold it beyond the end of the Receive call.
  927. // call pSample->Release when done with it.
  928. //
  929. // This is a blocking synchronous call. Usually no blocking
  930. // will occur but if a filter cannot process the sample immediately
  931. // it may use the caller's thread to wait until it can.
  932. HRESULT Receive(
  933. [in] IMediaSample * pSample);
  934. // Same as Receive but with multiple samples. Useful for
  935. // fragmented streams
  936. HRESULT ReceiveMultiple(
  937. [in, size_is(nSamples)] IMediaSample **pSamples,
  938. [in] long nSamples,
  939. [out] long *nSamplesProcessed);
  940. // See if Receive might block
  941. // Returns S_OK if it can block, S_FALSE if it can't or some
  942. // failure code (assume it can in this case)
  943. HRESULT ReceiveCanBlock();
  944. }
  945. typedef IMemInputPin *PMEMINPUTPIN;
  946. //=====================================================================
  947. //=====================================================================
  948. // Defines IAMovieSetup interface
  949. //
  950. // exported by filter to allow it to be self-registering
  951. //=====================================================================
  952. //=====================================================================
  953. [
  954. object,
  955. uuid(a3d8cec0-7e5a-11cf-bbc5-00805f6cef20),
  956. pointer_default(unique)
  957. ]
  958. interface IAMovieSetup : IUnknown {
  959. // methods to register and unregister
  960. // filter, etc.
  961. HRESULT Register( );
  962. HRESULT Unregister( );
  963. }
  964. typedef IAMovieSetup *PAMOVIESETUP;
  965. //=====================================================================
  966. //=====================================================================
  967. // Defines IMediaSeeking interface
  968. //
  969. // Controls seeking (time, bytes, frames, fields and samples)
  970. //=====================================================================
  971. //=====================================================================
  972. typedef enum AM_SEEKING_SeekingFlags
  973. {
  974. AM_SEEKING_NoPositioning = 0x00, // No change
  975. AM_SEEKING_AbsolutePositioning = 0x01, // Position is supplied and is absolute
  976. AM_SEEKING_RelativePositioning = 0x02, // Position is supplied and is relative
  977. AM_SEEKING_IncrementalPositioning = 0x03, // (Stop) position relative to current
  978. // Useful for seeking when paused (use +1)
  979. AM_SEEKING_PositioningBitsMask = 0x03, // Useful mask
  980. AM_SEEKING_SeekToKeyFrame = 0x04, // Just seek to key frame (performance gain)
  981. AM_SEEKING_ReturnTime = 0x08, // Plug the media time equivalents back into the supplied LONGLONGs
  982. AM_SEEKING_Segment = 0x10, // At end just do EC_ENDOFSEGMENT,
  983. // don't do EndOfStream
  984. AM_SEEKING_NoFlush = 0x20 // Don't flush
  985. } AM_SEEKING_SEEKING_FLAGS;
  986. typedef enum AM_SEEKING_SeekingCapabilities
  987. {
  988. AM_SEEKING_CanSeekAbsolute = 0x001,
  989. AM_SEEKING_CanSeekForwards = 0x002,
  990. AM_SEEKING_CanSeekBackwards = 0x004,
  991. AM_SEEKING_CanGetCurrentPos = 0x008,
  992. AM_SEEKING_CanGetStopPos = 0x010,
  993. AM_SEEKING_CanGetDuration = 0x020,
  994. AM_SEEKING_CanPlayBackwards = 0x040,
  995. AM_SEEKING_CanDoSegments = 0x080,
  996. AM_SEEKING_Source = 0x100 // Doesn't pass thru used to
  997. // count segment ends
  998. } AM_SEEKING_SEEKING_CAPABILITIES;
  999. [
  1000. object,
  1001. uuid(36b73880-c2c8-11cf-8b46-00805f6cef60),
  1002. pointer_default(unique)
  1003. ]
  1004. interface IMediaSeeking : IUnknown {
  1005. // Returns the capability flags
  1006. HRESULT GetCapabilities( [out] DWORD * pCapabilities );
  1007. // And's the capabilities flag with the capabilities requested.
  1008. // Returns S_OK if all are present, S_FALSE if some are present, E_FAIL if none.
  1009. // *pCababilities is always updated with the result of the 'and'ing and can be
  1010. // checked in the case of an S_FALSE return code.
  1011. HRESULT CheckCapabilities( [in,out] DWORD * pCapabilities );
  1012. // returns S_OK if mode is supported, S_FALSE otherwise
  1013. HRESULT IsFormatSupported([in] const GUID * pFormat);
  1014. HRESULT QueryPreferredFormat([out] GUID * pFormat);
  1015. HRESULT GetTimeFormat([out] GUID *pFormat);
  1016. // Returns S_OK if *pFormat is the current time format, otherwise S_FALSE
  1017. // This may be used instead of the above and will save the copying of the GUID
  1018. HRESULT IsUsingTimeFormat([in] const GUID * pFormat);
  1019. // (may return VFE_E_WRONG_STATE if graph is stopped)
  1020. HRESULT SetTimeFormat([in] const GUID * pFormat);
  1021. // return current properties
  1022. HRESULT GetDuration([out] LONGLONG *pDuration);
  1023. HRESULT GetStopPosition([out] LONGLONG *pStop);
  1024. HRESULT GetCurrentPosition([out] LONGLONG *pCurrent);
  1025. // Convert time from one format to another.
  1026. // We must be able to convert between all of the formats that we say we support.
  1027. // (However, we can use intermediate formats (e.g. MEDIA_TIME).)
  1028. // If a pointer to a format is null, it implies the currently selected format.
  1029. HRESULT ConvertTimeFormat([out] LONGLONG * pTarget, [in] const GUID * pTargetFormat,
  1030. [in] LONGLONG Source, [in] const GUID * pSourceFormat );
  1031. // Set current and end positions in one operation
  1032. // Either pointer may be null, implying no change
  1033. HRESULT SetPositions( [in,out] LONGLONG * pCurrent, [in] DWORD dwCurrentFlags
  1034. , [in,out] LONGLONG * pStop, [in] DWORD dwStopFlags );
  1035. // Get CurrentPosition & StopTime
  1036. // Either pointer may be null, implying not interested
  1037. HRESULT GetPositions( [out] LONGLONG * pCurrent,
  1038. [out] LONGLONG * pStop );
  1039. // Get earliest / latest times to which we can currently seek "efficiently".
  1040. // This method is intended to help with graphs where the source filter has
  1041. // a very high latency. Seeking within the returned limits should just
  1042. // result in a re-pushing of already cached data. Seeking beyond these
  1043. // limits may result in extended delays while the data is fetched (e.g.
  1044. // across a slow network).
  1045. // (NULL pointer is OK, means caller isn't interested.)
  1046. HRESULT GetAvailable( [out] LONGLONG * pEarliest, [out] LONGLONG * pLatest );
  1047. // Rate stuff
  1048. HRESULT SetRate([in] double dRate);
  1049. HRESULT GetRate([out] double * pdRate);
  1050. // Preroll
  1051. HRESULT GetPreroll([out] LONGLONG * pllPreroll);
  1052. }
  1053. typedef IMediaSeeking *PMEDIASEEKING;
  1054. // Flags for IMediaEventEx
  1055. cpp_quote("enum tagAM_MEDIAEVENT_FLAGS")
  1056. cpp_quote("{")
  1057. cpp_quote(" AM_MEDIAEVENT_NONOTIFY = 0x01")
  1058. cpp_quote("};")