home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-22 | 39.4 KB | 1,055 lines |
- //==========================================================================;
- //
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
- // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
- // PURPOSE.
- //
- // Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
- //
- //--------------------------------------------------------------------------;
-
- // This file contains interface definitions for the ActiveX streaming and
- // synchronisation architecture. Core interfaces shared with the Clockwork
- // implementation are in AXCore.idl, and control interfaces for the type
- // library are in Control.odl
-
- // include after unknwn.idl, objidl.idl and axcore.idl
-
-
- // forward declarations - these are the interfaces declared in this file
-
- interface IEnumRegFilters;
- interface IFileSourceFilter;
- interface IFileSinkFilter;
- interface IGraphBuilder;
- interface IFilterMapper;
- interface IMediaEventSink;
- interface IOverlay;
- interface IOverlayNotify;
- interface IQualityControl;
-
-
- //==========================================================================
- //==========================================================================
- // IEnumRegFilters interface -- enumerates registered filters.
- // enumerator interface returned from IFilterMapper::EnumMatchingFilters().
- // based on IEnum pseudo-template
- //==========================================================================
- //==========================================================================
-
- typedef struct {
- CLSID Clsid; // class id of the filter
- LPWSTR Name; // name of filter
- } REGFILTER;
-
- [
- object,
- uuid(56a868a4-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
-
- // The point of the mapper is to avoid loading filters. By looking in the
- // registry we can reduce the number of filters which must be loaded and tried.
- // This enumerator returns descriptors of filters (including the GUIDs that
- // CoCreateInstance can instantiate). The filters themselves are not loaded.
-
- interface IEnumRegFilters : IUnknown {
- import "unknwn.idl";
-
- // The caller must use CoTaskMemFree to free each REGFILTER* returned
- // in the array.
- HRESULT Next
- ( [in] ULONG cFilters, // place this many filters...
- [out] REGFILTER ** apRegFilter, // ...in this array of REGFILTER*
- [out] ULONG * pcFetched // actual count passed returned here
- );
-
- // I can't think why anyone would want to skip, so it's not implemented.
- // (anyone who thinks they know what they would be skipping over is probably
- // missing some piece of the jigsaw). This ALWAYS returns E_NOTIMPL.
-
- HRESULT Skip(
- [in] ULONG cFilters
- );
-
- HRESULT Reset(void);
-
- // No cloning either - also ALWAYS returns E_NOTIMPL.
-
- HRESULT Clone(
- [out] IEnumRegFilters **ppEnum
- );
- }
-
-
- typedef IEnumRegFilters *PENUMREGFILTERS;
-
-
-
-
- //========================================================================
- //========================================================================
- // abstraction representing the registered information about filters.
- // This allows properties of filters to be looked up without loading them.
- //========================================================================
- //========================================================================
-
- [
- object,
- uuid(56a868a3-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IFilterMapper : IUnknown {
- import "unknwn.idl";
-
- //==========================================================================
- // Registration functions.
- // A filter should be registered before any other use.
- // The registration can be NON_VOLATILE (i.e. permanent, do once ever)
- // or VOLATILE (once per boot of the system).
- // UnregisterFilter (obviously) removes the registration.
- // The action of any of the other calls on unregistered filters is undefined.
- // it will either work or you'll get an error, but I'm not saying which.
- //==========================================================================
-
- // Four predefined values controling the oreder in which filters are tried
- // for intelligent graph building. Intermediate values are legal.
- // Any value <=MERIT_DO_NOT_USE will mean that the filter will never
- // be tried by the filtergrah to automatically complete a connection.
-
- enum { MERIT_PREFERRED = 0x800000,
- MERIT_NORMAL = 0x600000,
- MERIT_UNLIKELY = 0x400000,
- MERIT_DO_NOT_USE= 0x200000
- };
-
- // Register a filter
-
- HRESULT RegisterFilter
- ( [in] CLSID clsid, // GUID of the filter
- [in] LPCWSTR Name, // Descriptive name for the filter
- [in] DWORD dwMerit // DO_NOT_USE, UNLIKELY, NORMAL or PREFERRED.
- );
-
-
- // Register an identifiable instance of a filter. This deals with cases
- // such as two similar sound cards which are driven by the same driver,
- // but we want to choose which oif these cards the sound will come out of.
- // This is not needed if there is only one instance of the filter
- // (e.g. there is only one sound card in the machine) or if all instances
- // of the filter are equivalent.
-
- // The filter itself must have already been registered // ??? Is that true?
- HRESULT RegisterFilterInstance
- ( [in] CLSID clsid, // GUID of the filter
- [in] LPCWSTR Name, // Descriptive name of instance.
- [out] CLSID *MRId // Returned Media Resource Id. A
- // locally unique id for this instance
- // of this filter
- );
-
-
- HRESULT RegisterPin
- ( [in] CLSID Filter, // GUID of filter
- [in] LPCWSTR Name, // Name of the pin
- [in] BOOL bRendered, // The filter renders this input
- [in] BOOL bOutput, // TRUE if this is an Output pin
- [in] BOOL bZero, // TRUE if OK for zero instances of pin
- // In this case you will have to Create
- // a pin to have even one instance
- [in] BOOL bMany, // TRUE if OK for many instances of pin
- [in] CLSID ConnectsToFilter, // Filter it connects to if it has
- // subterranean connection, else NULL
- [in] LPCWSTR ConnectsToPin // Name of pin it connects to
- // NULL for output pins
- );
-
- HRESULT RegisterPinType
- ( [in] CLSID clsFilter, // GUID of filter
- [in] LPCWSTR strName, // Descriptive name of the pin
- [in] CLSID clsMajorType, // Major type of the data stream
- [in] CLSID clsSubType // Sub type of the data stream
- );
-
-
- HRESULT UnregisterFilter
- ( [in] CLSID Filter // GUID of filter
- );
-
-
- HRESULT UnregisterFilterInstance
- ( [in] CLSID MRId // Media Resource Id of this instance
- );
-
-
- HRESULT UnregisterPin
- ( [in] CLSID Filter, // GUID of filter
- [in] LPCWSTR Name // Name of the pin
- );
-
-
- // Set *ppEnum to be an enumerator for filters matching the requirements.
-
- HRESULT EnumMatchingFilters
- ( [out] IEnumRegFilters **ppEnum // enumerator returned
- , [in] DWORD dwMerit // at least this merit needed
- , [in] BOOL bInputNeeded // need at least one input pin
- , [in] CLSID clsInMaj // input major type
- , [in] CLSID clsInSub // input sub type
- , [in] BOOL bRender // must the input be rendered?
- , [in] BOOL bOututNeeded // need at least one output pin
- , [in] CLSID clsOutMaj // output major type
- , [in] CLSID clsOutSub // output sub type
- );
-
- }
-
- //========================================================================
- //========================================================================
- // Defines IQualityControl interface
- //
- // Defines quality messages and allows a quality manager to install itself
- // as the sink for quality messages.
- //========================================================================
- //========================================================================
-
- typedef enum {
- Famine,
- Flood
- } QualityMessageType;
-
- typedef struct{
- QualityMessageType Type;
- long Proportion; // milli-units. 1000 = no change
- // for Flood:
- // What proportion of the media samples currently
- // coming through are required in the future.
- // 800 means please drop another 20%
- // For Famine:
- // How much to "keep in" e.g. 800 means send me
- // 20% less e.g. by dropping 20% of the samples.
- // 1100 would mean "I'm coping, send me more".
- REFERENCE_TIME Late;
- // How much you need to catch up by
- REFERENCE_TIME TimeStamp;
- // The stream time when this was generated (probably
- // corresponds to the start time on some sample).
- } Quality;
-
- typedef IQualityControl *PQUALITYCONTROL;
-
-
- [
- object,
- uuid(56a868a5-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IQualityControl : IUnknown {
-
- // Notify the recipient that a quality change is requested.
- // pSelf is the IFilter* of the sender.
- // this is sent from a filter
- // to (the quality manager or) an upstream peer.
- HRESULT Notify
- ( [in] IFilter * pSelf,
- [in] Quality q
- );
-
- // Notify the recipient that future quality messages are to be sent
- // to iqc. If piqc is NULL then quality messages are to default back to
- // the upstream peer.
- // This is sent from the quality manager to a filter.
- // The recipient should hold piqc as a WEAK reference,
- // i.e. do not AddRef it, do not Release it.
- HRESULT SetSink
- ( [in] IQualityControl * piqc
- );
- }
-
- //=====================================================================
- //=====================================================================
- // Definitions required for overlay transport
- //=====================================================================
- //=====================================================================
-
-
- // Used to communicate the colour that the IOverlay client wants the window
- // painted in so that it can draw directly to the correct clipping region
- // A colour key can be described in two alternate ways, the first is by a
- // range of one or more (system) palette indices. The second is by defining
- // a colour cube with two RGB values, any of which would be acceptable.
- //
- // The CK values are consistent with GDI PALETTEINDEX and PALETTERGB macros
-
-
- enum { CK_NOCOLORKEY = 0x0, // No color key is required
- CK_INDEX = 0x1, // Index into the current system palette
- CK_RGB = 0x2 }; // Color key is an RGB value (or range)
-
- typedef struct tagCOLORKEY {
-
- DWORD KeyType; // Explains meaning of the structure
- DWORD PaletteIndex; // Palette index if available
- COLORREF LowColorValue; // Low colour space RGB value
- COLORREF HighColorValue; // Defines the high RGB value
-
- } COLORKEY;
-
- // When a filter sets up an advise link it can ask that only certain types
- // of notifications be sent, for example just palette changes. While this
- // doesn't mean that the other notification call backs won't ever be called
- // the IOverlay implementation may use this as an efficiency optimisation
-
- enum { ADVISE_NONE = 0x0, // No notifications required
- ADVISE_CLIPPING = 0x1, // Synchronous clip information
- ADVISE_PALETTE = 0x2, // Palette change notifications
- ADVISE_COLORKEY = 0x4, // Called when colour key changes
- ADVISE_POSITION = 0x8 }; // Likewise when window moves etc
-
- const DWORD ADVISE_ALL = ADVISE_CLIPPING |
- ADVISE_PALETTE |
- ADVISE_COLORKEY |
- ADVISE_POSITION;
-
- // This isn't defined when you run IDL
-
- cpp_quote("#ifndef _WINGDI_")
-
- typedef struct _RGNDATAHEADER {
- DWORD dwSize;
- DWORD iType;
- DWORD nCount;
- DWORD nRgnSize;
- RECT rcBound;
- } RGNDATAHEADER;
-
- typedef struct _RGNDATA {
- RGNDATAHEADER rdh;
- char Buffer[1];
- } RGNDATA;
-
- cpp_quote("#endif")
-
-
- //=====================================================================
- //=====================================================================
- // Defines IOverlayNotify interface
- //
- // This interface gives asynchronous notifications of changes to the
- // rendering window - such as changes to the exposed window area
- //=====================================================================
- //=====================================================================
-
- [
- object,
- local,
- uuid(56a868a0-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IOverlayNotify : IUnknown {
-
- // IOverlayNotify methods
-
- // This notifies the filter of palette changes, the filter should copy
- // the array of RGBQUADs if it needs to use them after returning. This
- // is not called when the palette is actually changed in the display
- // but at a short time after (in sync with WM_PALETTECHANGED messages)
-
- HRESULT OnPaletteChange(
- [in] DWORD dwColors, // Number of colours present
- [in] const PALETTEENTRY *pPalette); // Array of palette colours
-
- // This provides synchronous clip changes so that the client is called
- // before the window is moved to freeze the video, and then when the
- // window has stabilised it is called again to start playback again.
- // If the window rect is all zero then the window is invisible, the
- // filter must take a copy of the information if it wants to keep it
-
- HRESULT OnClipChange(
- [in] const RECT *pSourceRect, // Region of video to use
- [in] const RECT *pDestinationRect, // Where video goes
- [in] const RGNDATA *pRgnData); // Defines clipping information
-
- HRESULT OnColorKeyChange([in] const COLORKEY *pColorKey);
-
- // The calls to OnClipChange happen in sync with the window. So it is
- // called with an empty clip list before the window moves to freeze
- // the video, and then when the window has stabilised it is called
- // again with the new clip list. The OnPositionChange callback is for
- // overlay cards that don't want the expense of synchronous clipping
- // updates and just want to know when the source or destination video
- // positions change. They will NOT be called in sync with the window
- // but at some point after the window has changed (basicly in time
- // with WM_SIZE etc messages received). This is therefore suitable
- // for overlay cards that don't inlay their data to the frame buffer
- // NOTE the destination is NOT clipped to the visible display area
-
- HRESULT OnPositionChange([in] const RECT *pSourceRect,
- [in] const RECT *pDestinationRect);
- }
-
- typedef IOverlayNotify *POVERLAYNOTIFY;
-
-
- //=====================================================================
- //=====================================================================
- // Defines IOverlay interface
- //
- // This interface provides information so that a filter can write direct to
- // the frame buffer while placing the video in the correct window position
- //=====================================================================
- //=====================================================================
-
- [
- object,
- local,
- uuid(56a868a1-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IOverlay : IUnknown {
-
- // IOverlay methods
-
- HRESULT GetPalette(
- [out] DWORD *pdwColors, // Number of colours present
- [out] PALETTEENTRY **ppPalette); // Where to put palette data
-
- HRESULT SetPalette(
- [in] DWORD dwColors, // Number of colours present
- [in] PALETTEENTRY *pPalette); // Colours to use for palette
-
- // If you change the colour key through SetColorKey then all the advise
- // links will receive an OnColorKeyChange callback with the new colour
-
- HRESULT GetDefaultColorKey([out] COLORKEY *pColorKey);
- HRESULT GetColorKey([out] COLORKEY *pColorKey);
- HRESULT SetColorKey([in,out] COLORKEY *pColorKey);
- HRESULT GetWindowHandle([out] HWND *pHwnd);
-
- // The IOverlay implementation allocates the memory for the clipping
- // rectangles as it can be variable in length. The filter calling
- // this method should free the memory when it is finished with it
-
- HRESULT GetClipList([out] RECT *pSourceRect,
- [out] RECT *pDestinationRect,
- [out] RGNDATA **ppRgnData);
-
- // Returns the current video source and destination
-
- HRESULT GetVideoPosition([out] RECT *pSourceRect,
- [out] RECT *pDestinationRect);
-
- HRESULT Advise(
- [in] IOverlayNotify *pOverlayNotify, // Notification interface
- [in] DWORD dwInterests); // Callbacks interested in
-
- HRESULT Unadvise(); // Stop the callbacks now
- }
-
- typedef IOverlay *POVERLAY;
-
-
- //=====================================================================
- //=====================================================================
- // control related interfaces (others are defined in control.odl)
- //=====================================================================
- //=====================================================================
-
-
- //=====================================================================
- //=====================================================================
- // Defines IMediaEventSink interface
- //
- // Exposed by filtergraph. Called by filters to notify events. Will be
- // passed on to application by the IMediaControl event methods.
- //=====================================================================
- //=====================================================================
-
- [
- object,
- uuid(56a868a2-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IMediaEventSink : IUnknown {
-
- // notify an event. will be queued, but not delivered to
- // the application on this thread.
- HRESULT Notify(
- [in] long EventCode,
- [in] long EventParam1,
- [in] long EventParam2
- );
- }
-
- typedef IMediaEventSink *PMEDIAEVENTSINK;
-
- //=====================================================================
- //=====================================================================
- // Defines IFileSourceFilter interface
- //
- // Exposed by source filters to set the file name and media type.
- //=====================================================================
- //=====================================================================
-
- [
- object,
- uuid(56a868a6-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IFileSourceFilter : IUnknown {
-
- // Load a file and assign it the given media type
- HRESULT Load(
- [in] LPCOLESTR pszFileName, // Pointer to absolute path of file to open
- [in] const AM_MEDIA_TYPE *pmt // Media type of file - can be NULL
- );
- // Get the currently loaded file name
- HRESULT GetCurFile(
- [out] LPOLESTR *ppszFileName, // Pointer to the path for the current file
- [out] AM_MEDIA_TYPE *pmt // Pointer to the media type
- );
- }
-
- typedef IFileSourceFilter *PFILTERFILESOURCE;
-
- //=====================================================================
- //=====================================================================
- // Defines IFileSinkFilter interface
- //
- // Exposed by renderers to set the output file name.
- //=====================================================================
- //=====================================================================
-
- [
- object,
- uuid(a2104830-7c70-11cf-8bce-00aa00a3f1a6),
- pointer_default(unique)
- ]
- interface IFileSinkFilter : IUnknown {
-
- // Output to this file
- HRESULT SetFileName(
- [in] LPCOLESTR pszFileName, // Pointer to absolute path of output file
- [in] const AM_MEDIA_TYPE *pmt // Media type of file - can be NULL
- );
- // Get the current file name
- HRESULT GetCurFile(
- [out] LPOLESTR *ppszFileName, // Pointer to the path for the current file
- [out] AM_MEDIA_TYPE *pmt // Pointer to the media type
- );
- }
-
- typedef IFileSinkFilter *PFILTERFILESINK;
-
- //=====================================================================
- //=====================================================================
- // Defines IFileAsyncIO interface
- //
- // Exposed by high performance file readers
- //=====================================================================
- //=====================================================================
-
- typedef struct _AsyncIOReq {
- DWORD engine[4]; // used by IO engine
- [size_is(cb)] BYTE * lpv; // points to buffer of data to be transferred
- DWORD cb; // size of data to be transferred
-
- // the following 4 fields intentionally mimic an OVERLAPPED structure
- //
- DWORD dwError; // on return, contains error/success code
- DWORD cbDone; // number of bytes actually transferred
- LARGE_INTEGER liPos; // 64 bit seek location. on return contains read/write location
- DWORD hEvent; // handle (used to mimic OVERLAPPED structure)
-
- DWORD dwUser; // preserved, for user data
- } AsyncIOReq;
-
- [
- object,
- uuid(56a868a7-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IFileAsyncIO : IUnknown {
-
- // query the required alignment for io buffers & sizes
- //
- HRESULT QueryAlignment (
- [out] LPDWORD pdwAlign
- );
-
- // do async, aligned read from a specific location in the file
- //
- HRESULT Read (
- [in] AsyncIOReq * pReq
- );
-
- // do async, aligned write to a specific location in the file
- // the file may be extended as a result.
- //
- HRESULT Write (
- [in] AsyncIOReq * pReq
- );
-
- // wait for the next available read to complete, on success
- // returns the buffer pointer and
- //
- HRESULT WaitForNext (
- [out] AsyncIOReq ** ppReq, // returns pointer to next request to complete
- [in] DWORD dwTimeout // how long to wait, 0 does not wait
- );
-
- // wait for a specific io request to complete
- //
- HRESULT WaitForSpecific (
- [out] AsyncIOReq * pReq, // wait for this request to complete
- [in] DWORD dwTimeout
- );
-
- // discard all pending io and place all requests on the 'done' queue
- //
- HRESULT DiscardPending (void);
-
- // wait for all pending io's to be complete
- //
- HRESULT Flush (void);
- }
-
- typedef IFileAsyncIO * PFILEASYNCIO;
-
-
- //
- // Intelligent connectivity for filters - an interface supported by
- // filter graphs (since it is an extension to IFilterGraph) that supports
- // building of graphs by automatic selection and connection of appropriate
- // filters
-
- [
- object,
- local,
- uuid(56a868a9-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IGraphBuilder : IFilterGraph {
- // Connect these two pins directly or indirectly, using transform filters
- // if necessary.
-
- HRESULT Connect
- ( [in] IPin * ppinOut, // the output pin
- [in] IPin * ppinIn // the input pin
- );
-
-
- // Connect this output pin directly or indirectly, using transform filters
- // if necessary to something that will render it.
-
- HRESULT Render
- ( [in] IPin * ppinOut // the output pin
- );
-
-
- // Build a filter graph that will render this file using this play list.
- // If lpwstrPlayList is NULL then it will use the default play list
- // which will typically render the whole file.
-
- HRESULT RenderFile
- ( [in] LPCWSTR lpcwstrFile,
- [in] LPCWSTR lpcwstrPlayList
- );
-
-
- // Add to the filter graph a source filter for this file. This would
- // be the same source filter that would be added by calling Render.
- // This call gives you more control over building
- // the rest of the graph, e.g. AddFilter(<a renderer of your choice>)
- // and then Connect the two.
- // The IFilter* interface exposed by the source filter is returned
- // in ppFilter, addrefed already for you
- // The filter will be known by the name lpcwstrFIlterName
- // nn this filter graph,
- HRESULT AddSourceFilter
- ( [in] LPCWSTR lpcwstrFileName,
- [in] LPCWSTR lpcwstrFilterName,
- [out] IFilter* *ppFilter
- );
-
-
- // If this call is made then trace information will be written to the
- // file showing the actions taken in attempting to perform an operation.
- HRESULT SetLogFile
- ( [in] HANDLE hFile // open file handle e.g. from CreateFile
- );
-
-
- // Request that the graph builder should return as soon as possible from
- // its current task.
- // Note that it is possible fot the following to occur in the following
- // sequence:
- // Operation begins; Abort is requested; Operation completes normally.
- // This would be normal whenever the quickest way to finish an operation
- // was to simply continue to the end.
- HRESULT Abort();
-
- // Return S_OK if the curent operation is to continue,
- // return S_FALSE if the current operation is to be aborted.
- // This method can be called as a callback from a filter which is doing
- // some operation at the request of the graph.
- HRESULT ShouldOperationContinue();
-
- }
-
-
- //
- // StreamBuilder
- // aka Graph building with constraints
- // aka convergent graphs
- // aka Closed captioning
-
- [
- object,
- local,
- uuid(56a868bf-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IStreamBuilder : IUnknown {
-
- // Connect this output pin directly or indirectly, using transform filters
- // if necessary to thing(s) that will render it, within this graph
- // Move from Initial state to Rendered state.
-
- HRESULT Render
- ( [in] IPin * ppinOut, // the output pin
- [in] IGraphBuilder * pGraph // the graph
- );
-
- // Undo what you did in Render. Return to Initial state.
- HRESULT Backout
- ( [in] IPin * ppinOut, // the output pin
- [in] IGraphBuilder * pGraph // the graph
- );
- }
-
-
- // async reader interface - supported by file source filters. Allows
- // multiple overlapped reads from different positions
-
-
- [
- object,
- uuid(56a868aa-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IAsyncReader : IUnknown
- {
- // pass in your preferred allocator and your preferred properties.
- // method returns the actual allocator to be used. Call GetProperties
- // on returned allocator to learn alignment and prefix etc chosen.
- // this allocator will be not be committed and decommitted by
- // the async reader, only by the consumer.
- // Must call this before calling Request.
- HRESULT RequestAllocator(
- [in] IMemAllocator* pPreferred,
- [in] ALLOCATOR_PROPERTIES* pProps,
- [out] IMemAllocator ** ppActual);
-
- // queue a request for data.
- // media sample start and stop times contain the requested absolute
- // byte position (start inclusive, stop exclusive).
- // may fail if sample not obtained from agreed allocator.
- // may fail if start/stop position does not match agreed alignment.
- // samples allocated from source pin's allocator may fail
- // GetPointer until after returning from WaitForNext.
- // Stop position must be aligned - this means it may exceed duration.
- // on completion, stop position will be corrected to unaligned
- // actual data.
- HRESULT Request(
- [in] IMediaSample* pSample,
- [in] DWORD dwUser); // user context
-
- // block until the next sample is completed or the timeout occurs.
- // timeout (millisecs) may be 0 or INFINITE. Samples may not
- // be delivered in order. If there is a read error of any sort, a
- // notification will already have been sent by the source filter,
- // and HRESULT will be an error.
- // If ppSample is not null, then a Request completed with the result
- // code returned.
- HRESULT WaitForNext(
- [in] DWORD dwTimeout,
- [out] IMediaSample** ppSample, // completed sample
- [out] DWORD * pdwUser); // user context
-
- // sync read of data. Sample passed in must have been acquired from
- // the agreed allocator. Start and stop position must be aligned.
- // equivalent to a Request/WaitForNext pair, but may avoid the
- // need for a thread on the source filter.
- HRESULT SyncReadAligned(
- [in] IMediaSample* pSample);
-
-
- // sync read. works in stopped state as well as run state.
- // need not be aligned. Will fail if read is beyond actual total
- // length.
- HRESULT SyncRead(
- [in] LONGLONG llPosition, // absolute file position
- [in] LONG lLength, // nr bytes required
- [out, size_is(lLength)]
- BYTE* pBuffer); // write data here
-
- // return total length of stream, and currently available length.
- // reads for beyond the available length but within the total length will
- // normally succeed but may block for a long period.
- HRESULT Length(
- [out] LONGLONG* pTotal,
- [out] LONGLONG* pAvailable);
-
- // cause all outstanding reads to return, possibly with a failure code
- //(VFW_E_TIMEOUT) indicating they were cancelled.
- // Between BeginFlush and EndFlush calls, Request calls will fail and
- // WaitForNext calls will always complete immediately.
- HRESULT BeginFlush(void);
- HRESULT EndFlush(void);
- }
-
-
- // interface provided by the filtergraph itself to let other objects
- // (especially plug-in distributors, but also apps like graphedt) know
- // when the graph has changed.
- [
- object,
- uuid(56a868ab-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IGraphVersion : IUnknown
- {
- // returns the current graph version number
- // this is incremented every time there is a change in the
- // set of filters in the graph or in their connections
- //
- // if this is changed since your last enumeration, then re-enumerate
- // the graph
- HRESULT QueryVersion(LONG* pVersion);
- }
-
-
-
-
- //
- // interface describing an object that uses resources.
- //
- // implement if: you request resources using IResourceManager. You will
- // need to pass your implementation of this pointer as an in param.
- //
- // use if: you are a resource manager who implements IResourceManager
- [
- object,
- uuid(56a868ad-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IResourceConsumer : IUnknown
- {
- // you may acquire the resource specified.
- // return values:
- // S_OK -- I have successfully acquired it
- // S_FALSE -- I will acquire it and call NotifyAcquire afterwards
- // VFW_S_NOT_NEEDED: I no longer need the resource
- // FAILED(hr)-I tried to acquire it and failed.
-
- HRESULT
- AcquireResource(
- [in] LONG idResource);
-
-
-
- // Please release the resource.
- // return values:
- // S_OK -- I have released it (and want it again when available)
- // S_FALSE -- I will call NotifyRelease when I have released it
- // other something went wrong.
- HRESULT
- ReleaseResource(
- [in] LONG idResource);
- }
-
-
-
- // interface describing a resource manager that will resolve contention for
- // named resources.
- //
- // implement if: you are a resource manager. The filtergraph will be a resource
- // manager, internally delegating to the system wide resource manager
- // (when there is one)
- //
- // use if: you need resources that are limited. Use the resource manager to
- // resolve contention by registering the resource with this interface,
- // and requesting it from this interface whenever needed.
- //
- // or use if: you detect focus changes which should affect resource usage.
- // Notifying change of focus to the resource manager will cause the resource
- // manager to switch contended resources to the objects that have the user's
- // focus
- [
- object,
- uuid(56a868ac-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IResourceManager : IUnknown
- {
- // tell the manager how many there are of a resource.
- // ok if already registered. will take new count. if new count
- // is lower, will de-allocate resources to new count.
- //
- // You get back a token that will be used in further calls.
- //
- // Passing a count of 0 will eliminate this resource. There is currently
- // no defined way to find the id without knowing the count.
- //
- HRESULT
- Register(
- [in] LPCWSTR pName, // this named resource
- [in] LONG cResource, // has this many instances
- [out] LONG* plToken // token placed here on return
- );
-
- HRESULT
- RegisterGroup(
- [in] LPCWSTR pName, // this named resource group
- [in] LONG cResource, // has this many resources
- [in, size_is(cResource)]
- LONG* palTokens, // these are the contained resources
- [out] LONG* plToken // group resource id put here on return
- );
-
- // request the use of a given, registered resource.
- // possible return values:
- // S_OK == yes you can use it now
- // S_FALSE == you will be called back when the resource is available
- // other - there is an error.
- //
- // The priority of this request should be affected by the associated
- // focus object -- that is, when SetFocus is called for that focus
- // object (or a 'related' object) then my request should be put through.
- //
- // A filter should pass the filter's IUnknown here. The filtergraph
- // will match filters to the filtergraph, and will attempt to trace
- // filters to common source filters when checking focus objects.
- // The Focus object must be valid for the entire lifetime of the request
- // -- until you call CancelRequest or NotifyRelease(id, p, FALSE)
- HRESULT
- RequestResource(
- [in] LONG idResource,
- [in] IUnknown* pFocusObject,
- [in] IResourceConsumer* pConsumer
- );
-
-
- // notify the resource manager that an acquisition attempt completed.
- // Call this method after an AcquireResource method returned
- // S_FALSE to indicate asynchronous acquisition.
- // HR should be S_OK if the resource was successfully acquired, or a
- // failure code if the resource could not be acquired.
- HRESULT
- NotifyAcquire(
- [in] LONG idResource,
- [in] IResourceConsumer* pConsumer,
- [in] HRESULT hr);
-
- // Notify the resource manager that you have released a resource. Call
- // this in response to a ReleaseResource method, or when you have finished
- // with the resource. bStillWant should be TRUE if you still want the
- // resource when it is next available, or FALSE if you no longer want
- // the resource.
- HRESULT
- NotifyRelease(
- [in] LONG idResource,
- [in] IResourceConsumer* pConsumer,
- [in] BOOL bStillWant);
-
- // I don't currently have the resource, and I no longer need it.
- HRESULT
- CancelRequest(
- [in] LONG idResource,
- [in] IResourceConsumer* pConsumer);
-
- // Notify the resource manager that a given object has been given the
- // user's focus. In ActiveMovie, this will normally be a video renderer
- // whose window has received the focus. The filter graph will switch
- // contended resources to (in order):
- // requests made with this same focus object
- // requests whose focus object shares a common source with this
- // requests whose focus object shares a common filter graph
- // After calling this, you *must* call ReleaseFocus before the IUnknown
- // becomes invalid, unless you can guarantee that another SetFocus
- // of a different object is done in the meantime. No addref is held.
- //
- // The resource manager will hold this pointer until replaced or cancelled,
- // and will use it to resolve resource contention. It will call
- // QueryInterface for IFilter at least and if found will call methods on
- // that interface.
- HRESULT
- SetFocus(
- [in] IUnknown* pFocusObject);
-
- // Sets the focus to NULL if the current focus object is still
- // pFocusObject. Call this when
- // the focus object is about to be destroyed to ensure that no-one is
- // still referencing the object.
- HRESULT
- ReleaseFocus(
- [in] IUnknown* pFocusObject);
-
-
-
- // !!! still need
- // -- app override (some form of SetPriority)
- // -- enumeration and description of resources
-
- }
-
-
- //
- // Interface representing an object that can be notified about state
- // and other changes within a filter graph. The filtergraph will call plug-in
- // distributors that expose this optional interface so that they can
- // respond to appropriate changes.
- //
- // Implement if: you are a plug-in distributor (your class id is found
- // under HKCR\Interface\<IID>\Distributor= for some interface).
- //
- // Use if: you are the filtergraph.
- [
- object,
- uuid(56a868af-0ad4-11ce-b03a-0020af0ba770),
- pointer_default(unique)
- ]
- interface IDistributorNotify : IUnknown
- {
- // called when graph is entering stop state. Called before
- // filters are stopped.
- HRESULT Stop(void);
-
- // called when graph is entering paused state, before filters are
- // notified
- HRESULT Pause(void);
-
- // called when graph is entering running state, before filters are
- // notified. tStart is the stream-time offset parameter that will be
- // given to each filter's IFilter::Run method.
- HRESULT Run(REFERENCE_TIME tStart);
-
- // called when the graph's clock is changing, with the new clock. Addref
- // the clock if you hold it beyond this method. Called before
- // the filters are notified.
- HRESULT SetSyncSource(
- [in] IReferenceClock * pClock);
-
- // called when the set of filters or their connections has changed.
- // Called on every AddFilter, RemoveFilter or ConnectDirect (or anything
- // that will lead to one of these).
- // You don't need to rebuild your list of interesting filters at this point
- // but you should release any refcounts you hold on any filters that
- // have been removed.
- HRESULT NotifyGraphChange(void);
- }
-
-
-