DirectShow API 基础知识概论

来源:互联网 发布:网络借贷需要什么条件 编辑:程序博客网 时间:2024/06/13 22:09

在写代码之前,我认为列出API的常用接口的方法和属性,是很有必要的。

 

  FilgraphManager对象

这是一个最基本的控制器控制对象,看方法就知道了

属性 描述 FilterCollection 当前所有过滤器集合. RegFilterCollection 注册表过滤器集合.
方法 Description AddSourceFilter 加入一个源. GetState 获取过滤器状态.  Pause 暂停. RenderFile 创建过滤器图标. Run 开始运行. Stop 停止. StopWhenReady 等待播放.

 

IBasicAudio接口

 这个接口主要是用来处理音的.

属性 描述 Balance 设置或者获取音效平衡.  Volume

设置或者获取音量. 

 

IVideoWindow接口
这个接口主要处理和窗口相关的控制器.

方法 描述 get_AutoShow  获取释放自动播放. get_BackgroundPalette  Queries whether the video window realizes its palette in the background.  get_BorderColor  Retrieves the color that appears around the edges of the destination rectangle. get_Caption  Retrieves the video window caption.  get_FullScreenMode  Queries whether the video renderer is in full-screen mode.  get_Height  Retrieves the height of the video window.  get_Left  Retrieves the video window's x-coordinate.  get_MessageDrain  Retrieves the window that receives mouse and keyboard messages from the video window, if any.  get_Owner  Retrieves the video window's parent window, if any.  get_Top  Retrieves the video window's y-coordinate.  get_Visible  Queries whether the video window is visible.  get_Width  Retrieves the width of the video window.  get_WindowState  Queries whether the video window is visible, hidden, minimized, or maximized.  get_WindowStyle  Retrieves the window style on the video window.  get_WindowStyleEx  Retrieves the extended window style on the video window.  GetMaxIdealImageSize  Retrieves the maximum ideal size for the video image.  GetMinIdealImageSize  Retrieves the minimum ideal size for the video image.  GetRestorePosition  Retrieves the restored window position.  GetWindowPosition  Retrieves the position of the video window.  HideCursor  Hides the cursor.  IsCursorHidden  Queries whether the cursor is hidden.  NotifyOwnerMessage  Forwards a message to the video window.  put_AutoShow  Specifies whether the video renderer automatically shows the video window when it receives video data. put_BackgroundPalette  Specifies whether the video window realizes its palette in the background.  put_BorderColor  Sets the color that appears around the edges of the destination rectangle. put_Caption  Sets the video window caption.  put_FullScreenMode  Enables or disables full-screen mode.  put_Height  Sets the height of the video window.  put_Left  Sets the video window's x-coordinate.  put_MessageDrain  Specifies a window to receive mouse and keyboard messages from the video window.  put_Owner  Specifies a parent window for the video window.  put_Top  Sets the video window's y-coordinate.  put_Visible  Shows or hides the video window.  put_Width  Sets the width of the video window.  put_WindowState  Shows, hides, minimizes, or maximizes the video window.  put_WindowStyle  Sets the window style on the video window.  put_WindowStyleEx  Sets the extended window style on the video window.  SetWindowForeground  Places the video window at the top of the Z order.  SetWindowPosition  Sets the position of the video window. 

 

IMediaEvent 接口  
此接口主要处理媒体事件.

方法 描述 CancelDefaultHandling 取消控制器对某事件的默认接口 FreeEventParams 释放事件资源 GetEvent 从事件列队获取下一事件. GetEventHandle 从列队获取可用事件句柄. RestoreDefaultHandling 保存控制器对某事件的接口为默认 WaitForCompletion 等待控制器处理数据.

IMediaEventEx接口
 继承的是IMediaEvent 接口。

方法 描述 SetNotifyWindow 注册一个窗口到进程事件信息. SetNotifyFlags 设置事件信息可用. GetNotifyFlags

获取事件信息可用.


 

IMediaPosition 接口

这个接口主要处理播放流的的时间对应的位置信息.

Method Description get_Duration Retrieves the duration of the stream. put_CurrentPosition Sets the current position, relative to the total duration of the stream. get_CurrentPosition Retrieves the current position, relative to the total duration of the stream. get_StopTime Retrieves the time at which the playback will stop, relative to the duration of the stream. put_StopTime Sets the time at which the playback will stop, relative to the duration of the stream. get_PrerollTime Retrieves the amount of data that will be queued before the start position. put_PrerollTime Sets the amount of data that will be queued before the start position. put_Rate Sets the playback rate. get_Rate Retrieves the playback rate. CanSeekForward Determines whether the filter graph can seek forward in the stream. CanSeekBackward Determines whether the filter graph can seek backward in the stream.