IBasicVideo2 接口是 DirectShow 多媒体框架中的接口之一,是对 IBasicVideo 接口的扩展,提供了一些额外的方法,用于更精细的视频控制。

以下是 IBasicVideo2 接口的定义:
// Control.h 头文件可能包含如下定义
#include <Control.h>

// IBasicVideo2 接口的 GUID
DEFINE_GUID(IID_IBasicVideo2, 0x329bb360-f6ea-11d1-9038-00a0c9697298);

// IBasicVideo2 接口的定义
DECLARE_INTERFACE_(IBasicVideo2, IBasicVideo)
{
    STDMETHOD(get_AvgTimePerFrame)(REFTIME *pAvgTimePerFrame) PURE;
    STDMETHOD(get_BitRate)(long *pBitRate) PURE;
    STDMETHOD(get_BitErrorRate)(long *pBitErrorRate) PURE;
    STDMETHOD(get_VideoWidth)(long *pVideoWidth) PURE;
    STDMETHOD(get_VideoHeight)(long *pVideoHeight) PURE;
    STDMETHOD(put_SourceLeft)(long SourceLeft) PURE;
    STDMETHOD(get_SourceLeft)(long *pSourceLeft) PURE;
    STDMETHOD(put_SourceWidth)(long SourceWidth) PURE;
    STDMETHOD(get_SourceWidth)(long *pSourceWidth) PURE;
    STDMETHOD(put_SourceTop)(long SourceTop) PURE;
    STDMETHOD(get_SourceTop)(long *pSourceTop) PURE;
    STDMETHOD(put_SourceHeight)(long SourceHeight) PURE;
    STDMETHOD(get_SourceHeight)(long *pSourceHeight) PURE;
    STDMETHOD(put_DestinationLeft)(long DestinationLeft) PURE;
    STDMETHOD(get_DestinationLeft)(long *pDestinationLeft) PURE;
    STDMETHOD(put_DestinationWidth)(long DestinationWidth) PURE;
    STDMETHOD(get_DestinationWidth)(long *pDestinationWidth) PURE;
    STDMETHOD(put_DestinationTop)(long DestinationTop) PURE;
    STDMETHOD(get_DestinationTop)(long *pDestinationTop) PURE;
    STDMETHOD(put_DestinationHeight)(long DestinationHeight) PURE;
    STDMETHOD(get_DestinationHeight)(long *pDestinationHeight) PURE;
    STDMETHOD(SetSourcePosition)(long Left, long Top, long Width, long Height) PURE;
    STDMETHOD(GetSourcePosition)(long *pLeft, long *pTop, long *pWidth, long *pHeight) PURE;
    STDMETHOD(SetDefaultSourcePosition)() PURE;
    STDMETHOD(SetDestinationPosition)(long Left, long Top, long Width, long Height) PURE;
    STDMETHOD(GetDestinationPosition)(long *pLeft, long *pTop, long *pWidth, long *pHeight) PURE;
    STDMETHOD(SetDefaultDestinationPosition)() PURE;
    STDMETHOD(GetVideoSize)(long *pWidth, long *pHeight) PURE;
    STDMETHOD(GetVideoPaletteEntries)(long StartIndex, long Entries, long *pRetrieved, long *pPalette) PURE;
    STDMETHOD(GetCurrentImage)(long *pBufferSize, long *pDIBImage) PURE;
    STDMETHOD(IsUsingDefaultSource)() PURE;
    STDMETHOD(IsUsingDefaultDestination)() PURE;

    // 新增方法
    STDMETHOD(GetPreferredAspectRatio)(long *plAspectX, long *plAspectY) PURE;
};

这个接口继承了 IBasicVideo 接口,并添加了一个新的方法 GetPreferredAspectRatio,用于获取首选的视频宽高比。

如果你正在使用 DirectShow 框架,并且需要更精细的视频控制,可以使用 IBasicVideo2 接口。请注意,这些接口和头文件是特定于 Windows 平台的多媒体编程,通常在使用 DirectShow 进行音视频处理的场景中才会用到。


转载请注明出处:http://www.zyzy.cn/article/detail/25101/Win32 API/Control.h/IBasicVideo2