关于接口
IGraphBuilder接口à调用CoCreateInstance 得到的IGraphBuilder接口包含了大部分创建filter graph 的方法 。
IGraphBuilder::AddSourceFilter-àThis method adds a source filter to the filter graph for a specific file.
IGraphBuilder::Connect-àThis method connects the two pins, using intermediates if necessary.
IGraphBuilder::Render-àThis method builds a filter graph that renders the data from this output pin.
IGraphBuilder::RenderFile-àThis method builds a filter graph that renders the specified file. 此方法是创建一个能够播放指定文件的filter graph 。
IGraphBuilder::SetLogFile-àThis method sets the file into which actions taken in attempting to perform an operation are logged.
IMediaControl接口à控制数据流,它包含开启和停止graph的函数。
IMediaControl::AddSourceFilter-àThis method adds to the graph the source filter that can read the given file name, and returns an IDispatch interface pointer representing the filter.
IMediaControl::GetState-àThis method retrieves the state of the filter graph.
IMediaControl::PauseàThis method pauses all the filters in the filter graph.
IMediaControl::RenderFileàThis method adds and connects filters needed to play the specified file.
IMediaControl::RunàThis method switches the entire filter graph into a running state.
IMediaControl::StopàThis method switches all filters in the filter graph to a stopped state.
IMediaControl::StopWhenReadyàThis method waits for an operation such as Pause to complete, allowing filters to queue up data, then stops the filter graph.
IMediaEvent接口à包含从Filter Graph Manager 获取事件的函数。
IMediaEvent::CancelDefaultHandling-àThis method cancels any default handling by the filter graph of the specified event and ensures that it is passed to the application.
IMediaEvent::FreeEventParams-àThis method frees resources associated with the parameters of an event.
IMediaEvent::GetEvent-àThis method retrieves the next notification event.
IMediaEvent::GetEventHandle-àThis method retrieves a handle to a manual-reset event that will be signaled as long as there are event notifications to deliver.
IMediaEvent::RestoreDefaultHandling-àThis method reinstates the normal default handling by a filter graph for the specified event, if there is one.
IMediaEvent::WaitForCompletion-àThis method blocks execution of the application thread until the graph's operation finishes. (等待回放的结束)
小知识点:
return 0是正常退出,return 非零 是异常退出,这是返回给控制台的,不在你编的程序的控制范围内,是给操作系统识别的,对你的程序无影响
其它流媒体常用接口
IFilterGraph接口à滤波器图表接口
IFilterGraph::AddFilter-àThis method adds a filter to the graph and names it by using the pName parameter.
IFilterGraph::ConnectDirect-àThis method connects the two pins directly (without intervening filters).
IFilterGraph::Disconnect-àThis method disconnects this pin.
IFilterGraph::EnumFilters-àThis method provides an enumerator for all filters in the graph.
IFilterGraph::FindFilterByName-àThis method finds a filter that was added to the filter graph with a specific name.
IFilterGraph::Reconnect-àThis method disconnects this and the pin to which it connects and then reconnects it to the same pin. This allows the details of the connection, such as media type and allocator, to be renegotiated.
IFilterGraph::RemoveFilter-àThis method removes a filter from the graph.
IFilterGraph::SetDefaultSyncSource-àThis method sets the default source of synchronization.
IFilterGraph2接口à增强的IFilterGraph
IFilterGraph2::ReconnectEx-àThis method specifies a pin and a media type to reconnect with.
ICaptureGraphBuilder2接口à构造增强型的视频捕获滤波器图表管理器(Filter Graph Manager)
ICaptureGraphBuilder2::ControlStream-àThis method sets the start and stop times for one or more streams of captured data.
ICaptureGraphBuilder2::FindInterface-àThis method searches the graph for a specified interface, starting from a specified filter. You can restrict the search to a section of the graph upstream or downstream of the filter, or restrict it to a particular pin category or media type.
ICaptureGraphBuilder2::FindPin-àThis method retrieves a particular pin on a filter, or determines whether a given pin matches the specified criteria.
ICaptureGraphBuilder2::GetFiltergraph-àThis method retrieves the filter graph that the capture graph builder is using.
ICaptureGraphBuilder2::RenderStream-àThis method connects an output pin on a source filter to a sink filter, optionally through an intermediate filter.
ICaptureGraphBuilder2::SetFiltergraph-àThis method specifies a filter graph for the capture graph builder to use.
ICaptureGraphBuilder2::SetOutputFileName-àThis method creates the file writing section of the filter graph.
IMediaEventEX接口à播放事件接口扩展
IMediaEventEx::GetNotifyFlags-àThis method retrieves whether event notifications are on or off.
IMediaEventEx::SetNotifyFlags-àThis method turns event notifications on or off.
IMediaEventEx::SetNotifyWindow-àThis method registers a window that will handle messages in response to all events from an object.
IMediaPosition接口à播放的位置和速度控制接口(控制播放位置只能为设置时间控制方式)
IMediaPosition::CanSeekBackward-àThis method determines if the current position can be moved backward in the media stream.
IMediaPosition::CanSeekForward-àThis method determines if the current position can be moved forward in the media stream.
IMediaPosition::get_CurrentPosition-àThis method retrieves the current position in terms of the total length of the media stream.
IMediaPosition::get_Duration-àThis method retrieves the total duration of the media stream.
IMediaPosition::get_PrerollTime-àThis method retrieves the time prior to the start position that any nonrandom access device should start rolling.
IMediaPosition::get_Rate-àThis method retrieves the rate of playback relative to normal playback speed.
IMediaPosition::get_StopTime-àThis method retrieves the time at which the media stream stops.
IMediaPosition::put_CurrentPosition-àThis method sets the time that the media stream begins.
IMediaPosition::put_PrerollTime-àThis method sets the time prior to the start position that any nonrandom access device should start rolling.
IMediaPosition::put_Rate-àThis method sets the rate of playback relative to normal speed.
IMediaPosition::put_StopTime-àThis method sets the time at which the media stream will stop.
IMediaSeeking接口à另一个播放的位置和播放速度控制接口,在位置选择方面功能较强,设置播放格式,多种控制播放方式,常用的有:TIME_FORMAT_MEDIA_TIME 单位 100纳秒和TIME_FORMAT_FRAME按帧播放。
IMediaSeeking::CheckCapabilities-àThis method determines which capabilities exist on a media stream by applying seeking capability flags and checking the returned value.
IMediaSeeking::ConvertTimeFormat-àThis method converts a time from one format to another.
IMediaSeeking::GetAvailable-àThis method returns the range of times in which seeking is efficient.
IMediaSeeking::GetCapabilities-àThis method returns the seeking capabilities of the media stream.
IMediaSeeking::GetCurrentPosition-àThis method retrieves the current position in terms of the total length of the media stream.
IMediaSeeking::GetDuration-àThis method retrieves the length of time that the media stream will play.
IMediaSeeking::GetPositions-àThis method returns the current and stop position settings.
IMediaSeeking::GetPreroll-àThis method retrieves the preroll settings.
IMediaSeeking::GetRate-àThis method retrieves the current rate.
IMediaSeeking::GetStopPosition-àThis method retrieves the time at which the media stream stops.
IMediaSeeking::GetTimeFormat-àThis method retrieves the current time format, which determines the format of units used during seeking.
IMediaSeeking::IsFormatSupported-àThis method determines if a specified time format is supported.
IMediaSeeking::IsUsingTimeFormat-àThis method determines if the time format being used in the call is the same as the one currently in use by the interface.
IMediaSeeking::QueryPreferredFormat-àThis method retrieves the preferred time format to be used by the interface.
IMediaSeeking::SetPositions-àThis method sets current and stop positions and applies flags to both.
IMediaSeeking::SetRate-àThis method sets a new playback rate.
IMediaSeeking::SetTimeFormat-àThis method sets the time format, which determines the format of units used during seeking.
IBasicAudio接口à声音控制接口
IBasicAudio method | Description |
Sets the volume (amplitude) of the audio signal. | |
Retrieves the volume (amplitude) of the audio signal. | |
Sets the balance for the audio signal. | |
Retrieves the balance for the audio signal. |
IBasicVideo接口à图像控制接口(比特率,图像宽,高等信息)
IBasicVideo method | Description |
Retrieves the average time between successive frames in 100-nanosecond units. | |
Retrieves an approximate bit rate for the video stream. | |
Retrieves an approximate bit error rate for the video stream. | |
Retrieves the current video width. | |
Retrieves the current video height. | |
Sets the x-axis coordinate for the source video rectangle. | |
Retrieves the x-axis coordinate for the source video rectangle. | |
Sets the width of the source video rectangle. | |
Retrieves the width of the source video rectangle. | |
Sets the y-axis coordinate for the source video rectangle. | |
Retrieves the y-axis coordinate for the source video rectangle. | |
Sets the height of the source video rectangle. | |
Retrieves the height of the source video rectangle. | |
Sets the x-axis coordinate for the destination video rectangle. | |
Retrieves the x-axis coordinate for the destination video rectangle. | |
Sets the width of the destination video rectangle. | |
Retrieves the width of the destination video rectangle. | |
Sets the y-axis coordinate for the destination video rectangle. | |
Retrieves the y-axis coordinate for the destination video rectangle. | |
Sets the height of the destination video rectangle. | |
Retrieves the height of the destination video rectangle. | |
Sets the source video rectangle. | |
Retrieves the source video rectangle. | |
Informs the renderer to use the default source rectangle. | |
Sets the destination rectangle for the window. | |
Retrieves the destination video rectangle for the window. | |
Sets the default destination position for the window. | |
Retrieves the native video dimensions. | |
Retrieves the color palette entries required by the video. | |
Returns a copy of the current image that is waiting at the renderer. | |
Determines if the renderer is using the default source rectangle. | |
Determines if the renderer is using the default destination rectangle. |
IBasicFilter接口àDirectShow中的基本滤波器接口
IVideoWindow接口à显示窗口控制接口(有关播放窗口的一切控制,包括标题标题显示,窗口位置控制等)
IVideoWindow method | Description |
Sets the text caption on the playback window. | |
Retrieves the text caption on the playback window. | |
Sets the playback window style. | |
Retrieves the playback window style. | |
Sets the style of the control window. | |
Retrieves the playback window's extended style bits. | |
Specifies if the window will be automatically shown on the first state change. | |
Returns if the window will be automatically shown on the first state change. | |
Sets the current window state (such as visible or minimized). | |
Retrieves the current window state (such as visible or minimized). | |
Informs the renderer to realize its palette in the background. | |
Returns whenever the renderer realizes its palette in the background. | |
Sets the visibility of the window. | |
Retrieves the visibility of the window. | |
Sets the x-axis coordinate for the video window. | |
Retrieves the x-axis coordinate for the video window. | |
Sets the width of the video window. | |
Retrieves the width of the video window. | |
Sets the y-axis coordinates for the video window. | |
Retrieves the y-axis coordinates for the video window. | |
Sets the height of the video window. | |
Retrieves the height of the video window. | |
Sets the owning parent window for the video playback window. | |
Retrieves the owning parent window for the video playback window. | |
Specifies a window to which the video window will post messages. | |
Retrieves the window set to receive messages from the video window. | |
Retrieves the border color for the video window. | |
Sets the border color for the video window. | |
Returns the full-screen rendering mode of the video renderer filter supporting this interface. | |
Sets the full-screen mode for the video renderer filter supporting this interface. | |
Tells the renderer filter to become the foreground window. | |
Forwards messages that have been received by a parent window to a child window owned by a filter. | |
Sets the video window position on the display. | |
Retrieves the video window position. | |
Retrieves the ideal minimum image size for the video image playback (client) area. | |
Retrieves the ideal maximum image size for the video image playback (client) area. | |
Returns the normal restored window dimensions. | |
Hides the cursor. | |
Determines if the cursor is hidden or showing. |
ISampleGrabber接口à捕获图像窗口(可用于抓图控制)
Method | Description |
Specifies whether the filter should stop the graph after receiving one sample. | |
Specifies the media type for the connection on the Sample Grabber's input pin. | |
Retrieves the media type for the connection on the Sample Grabber's input pin. | |
Specifies whether to copy sample data into a buffer as it goes through the filter. | |
Retrieves a copy of the sample that the filter received most recently. | |
Not currently implemented. | |
Specifies a callback method to call on incoming samples. |
IVideoFrameStep接口à控制单帧播放的接口
IVideoWindow method | Description |
Sets the text caption on the playback window. | |
Retrieves the text caption on the playback window. | |
Sets the playback window style. | |
Retrieves the playback window style. | |
Sets the style of the control window. | |
Retrieves the playback window's extended style bits. | |
Specifies if the window will be automatically shown on the first state change. | |
Returns if the window will be automatically shown on the first state change. | |
Sets the current window state (such as visible or minimized). | |
Retrieves the current window state (such as visible or minimized). | |
Informs the renderer to realize its palette in the background. | |
Returns whenever the renderer realizes its palette in the background. | |
Sets the visibility of the window. | |
Retrieves the visibility of the window. | |
Sets the x-axis coordinate for the video window. | |
Retrieves the x-axis coordinate for the video window. | |
Sets the width of the video window. | |
Retrieves the width of the video window. | |
Sets the y-axis coordinates for the video window. | |
Retrieves the y-axis coordinates for the video window. | |
Sets the height of the video window. | |
Retrieves the height of the video window. | |
Sets the owning parent window for the video playback window. | |
Retrieves the owning parent window for the video playback window. | |
Specifies a window to which the video window will post messages. | |
Retrieves the window set to receive messages from the video window. | |
Retrieves the border color for the video window. | |
Sets the border color for the video window. | |
Returns the full-screen rendering mode of the video renderer filter supporting this interface. | |
Sets the full-screen mode for the video renderer filter supporting this interface. | |
Tells the renderer filter to become the foreground window. | |
Forwards messages that have been received by a parent window to a child window owned by a filter. | |
Sets the video window position on the display. | |
Retrieves the video window position. | |
Retrieves the ideal minimum image size for the video image playback (client) area. | |
Retrieves the ideal maximum image size for the video image playback (client) area. | |
Returns the normal restored window dimensions. | |
Hides the cursor. | |
Determines if the cursor is hidden or showing. |
ICreateDevEnum接口à创建设置枚举接口(视频采集用)
ICreateDevEnum::CreateClassEnumerator-àThe CreateClassEnumerator method creates an enumerator for a specified device category. (MSDN2001)
IEnumMoniker接口à枚举监视器接口(视频采集用)
IEnumMoniker::Clone-àThis method creates another enumerator that contains the same enumeration state as the current one.
Using this function, a client can record a particular point in the enumeration sequence and then return to that point at a later time. The new enumerator supports the same interface as the original one.
IEnumMoniker:IUnknown-àThis interface is used to enumerate the components of a moniker or to enumerate the monikers in a table of monikers.
IEnumMoniker has the same methods as all enumerator interfaces: Next, Skip, Reset, and Clone.
IEnumMoniker::Next-àThis method retrieves the next celt items in the enumeration sequence.
If there are fewer than the requested number of elements left in the sequence, it retrieves the remaining elements.
The number of elements retrieved is returned through pceltFetched (unless the caller passed in NULL for that parameter).
IEnumMoniker::Reset-àThis method resets the enumeration sequence to the beginning.
IEnumMoniker::Skip-àThis method skips over the next specified number of elements in the enumeration sequence.
IMoniker接口à监视接口(视频采集用)
IMoniker::BindToObject-àThis method binds to the object named by the moniker.
IMoniker::BindToStorage-àThis method binds to the object's storage.
IMoniker::CommonPrefixWith-àThis method finds the prefix that the moniker has in common with another moniker.
IMoniker::ComposeWith-àThis method composes with another moniker.
IMoniker::Enum-àThis method enumerates component monikers.
IMoniker::GetDisplayName-àThis method returns the display name.
IMoniker::GetTimeOfLastChange-àThis method returns the time the object was last changed.
IMoniker::Hash-àThis method returns a hash value.
IMoniker::Inverse-àThis method returns the inverse of the moniker.
IMoniker::IsEqual-àThis method compares one moniker with another moniker.
IMoniker::IsRunning-àThis method checks whether object is running.
IMoniker::IsSystemMoniker-àThis method checks whether moniker is one of the system-supplied types.
IMoniker::ParseDisplayName-àThis method converts a display name into a moniker.
IMoniker::Reduce-àThis method reduces the moniker to the simplest form.
IMoniker::RelativePathTo-àThis method constructs a relative moniker between the specified moniker and another.
IPropertyBag接口à属性页接口
IPropertyBag:IUnknown-àThis interface provides an object with a property bag in which the object can persistently save its properties.
IPropertyBag::Read-àThis method asks the property bag to read the named property into a caller-initialized VARIANT.
IPropertyBag::Write-àThis method asks the property bag to save the named property in a caller-initialized VARIANT.