Win32 API 日本語リファレンス
ホームMedia.MediaFoundation › MFCreateVideoMediaTypeFromBitMapInfoHeaderEx

MFCreateVideoMediaTypeFromBitMapInfoHeaderEx

関数
ビットマップヘッダーと拡張属性からビデオメディア型を生成する。
DLLMFPlat.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

// MFPlat.dll
#include <windows.h>

HRESULT MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(
    const BITMAPINFOHEADER* pbmihBitMapInfoHeader,
    DWORD cbBitMapInfoHeader,
    DWORD dwPixelAspectRatioX,
    DWORD dwPixelAspectRatioY,
    MFVideoInterlaceMode InterlaceMode,
    ULONGLONG VideoFlags,
    DWORD dwFramesPerSecondNumerator,
    DWORD dwFramesPerSecondDenominator,
    DWORD dwMaxBitRate,
    IMFVideoMediaType** ppIVideoMediaType
);

パラメーター

名前方向
pbmihBitMapInfoHeaderBITMAPINFOHEADER*in
cbBitMapInfoHeaderDWORDin
dwPixelAspectRatioXDWORDin
dwPixelAspectRatioYDWORDin
InterlaceModeMFVideoInterlaceModein
VideoFlagsULONGLONGin
dwFramesPerSecondNumeratorDWORDin
dwFramesPerSecondDenominatorDWORDin
dwMaxBitRateDWORDin
ppIVideoMediaTypeIMFVideoMediaType**out

戻り値の型: HRESULT

各言語での呼び出し定義

// MFPlat.dll
#include <windows.h>

HRESULT MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(
    const BITMAPINFOHEADER* pbmihBitMapInfoHeader,
    DWORD cbBitMapInfoHeader,
    DWORD dwPixelAspectRatioX,
    DWORD dwPixelAspectRatioY,
    MFVideoInterlaceMode InterlaceMode,
    ULONGLONG VideoFlags,
    DWORD dwFramesPerSecondNumerator,
    DWORD dwFramesPerSecondDenominator,
    DWORD dwMaxBitRate,
    IMFVideoMediaType** ppIVideoMediaType
);
[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(
    IntPtr pbmihBitMapInfoHeader,   // BITMAPINFOHEADER*
    uint cbBitMapInfoHeader,   // DWORD
    uint dwPixelAspectRatioX,   // DWORD
    uint dwPixelAspectRatioY,   // DWORD
    int InterlaceMode,   // MFVideoInterlaceMode
    ulong VideoFlags,   // ULONGLONG
    uint dwFramesPerSecondNumerator,   // DWORD
    uint dwFramesPerSecondDenominator,   // DWORD
    uint dwMaxBitRate,   // DWORD
    IntPtr ppIVideoMediaType   // IMFVideoMediaType** out
);
<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(
    pbmihBitMapInfoHeader As IntPtr,   ' BITMAPINFOHEADER*
    cbBitMapInfoHeader As UInteger,   ' DWORD
    dwPixelAspectRatioX As UInteger,   ' DWORD
    dwPixelAspectRatioY As UInteger,   ' DWORD
    InterlaceMode As Integer,   ' MFVideoInterlaceMode
    VideoFlags As ULong,   ' ULONGLONG
    dwFramesPerSecondNumerator As UInteger,   ' DWORD
    dwFramesPerSecondDenominator As UInteger,   ' DWORD
    dwMaxBitRate As UInteger,   ' DWORD
    ppIVideoMediaType As IntPtr   ' IMFVideoMediaType** out
) As Integer
End Function
' pbmihBitMapInfoHeader : BITMAPINFOHEADER*
' cbBitMapInfoHeader : DWORD
' dwPixelAspectRatioX : DWORD
' dwPixelAspectRatioY : DWORD
' InterlaceMode : MFVideoInterlaceMode
' VideoFlags : ULONGLONG
' dwFramesPerSecondNumerator : DWORD
' dwFramesPerSecondDenominator : DWORD
' dwMaxBitRate : DWORD
' ppIVideoMediaType : IMFVideoMediaType** out
Declare PtrSafe Function MFCreateVideoMediaTypeFromBitMapInfoHeaderEx Lib "mfplat" ( _
    ByVal pbmihBitMapInfoHeader As LongPtr, _
    ByVal cbBitMapInfoHeader As Long, _
    ByVal dwPixelAspectRatioX As Long, _
    ByVal dwPixelAspectRatioY As Long, _
    ByVal InterlaceMode As Long, _
    ByVal VideoFlags As LongLong, _
    ByVal dwFramesPerSecondNumerator As Long, _
    ByVal dwFramesPerSecondDenominator As Long, _
    ByVal dwMaxBitRate As Long, _
    ByVal ppIVideoMediaType As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFCreateVideoMediaTypeFromBitMapInfoHeaderEx = ctypes.windll.mfplat.MFCreateVideoMediaTypeFromBitMapInfoHeaderEx
MFCreateVideoMediaTypeFromBitMapInfoHeaderEx.restype = ctypes.c_int
MFCreateVideoMediaTypeFromBitMapInfoHeaderEx.argtypes = [
    ctypes.c_void_p,  # pbmihBitMapInfoHeader : BITMAPINFOHEADER*
    wintypes.DWORD,  # cbBitMapInfoHeader : DWORD
    wintypes.DWORD,  # dwPixelAspectRatioX : DWORD
    wintypes.DWORD,  # dwPixelAspectRatioY : DWORD
    ctypes.c_int,  # InterlaceMode : MFVideoInterlaceMode
    ctypes.c_ulonglong,  # VideoFlags : ULONGLONG
    wintypes.DWORD,  # dwFramesPerSecondNumerator : DWORD
    wintypes.DWORD,  # dwFramesPerSecondDenominator : DWORD
    wintypes.DWORD,  # dwMaxBitRate : DWORD
    ctypes.c_void_p,  # ppIVideoMediaType : IMFVideoMediaType** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MFPlat.dll')
MFCreateVideoMediaTypeFromBitMapInfoHeaderEx = Fiddle::Function.new(
  lib['MFCreateVideoMediaTypeFromBitMapInfoHeaderEx'],
  [
    Fiddle::TYPE_VOIDP,  # pbmihBitMapInfoHeader : BITMAPINFOHEADER*
    -Fiddle::TYPE_INT,  # cbBitMapInfoHeader : DWORD
    -Fiddle::TYPE_INT,  # dwPixelAspectRatioX : DWORD
    -Fiddle::TYPE_INT,  # dwPixelAspectRatioY : DWORD
    Fiddle::TYPE_INT,  # InterlaceMode : MFVideoInterlaceMode
    -Fiddle::TYPE_LONG_LONG,  # VideoFlags : ULONGLONG
    -Fiddle::TYPE_INT,  # dwFramesPerSecondNumerator : DWORD
    -Fiddle::TYPE_INT,  # dwFramesPerSecondDenominator : DWORD
    -Fiddle::TYPE_INT,  # dwMaxBitRate : DWORD
    Fiddle::TYPE_VOIDP,  # ppIVideoMediaType : IMFVideoMediaType** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mfplat")]
extern "system" {
    fn MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(
        pbmihBitMapInfoHeader: *const BITMAPINFOHEADER,  // BITMAPINFOHEADER*
        cbBitMapInfoHeader: u32,  // DWORD
        dwPixelAspectRatioX: u32,  // DWORD
        dwPixelAspectRatioY: u32,  // DWORD
        InterlaceMode: i32,  // MFVideoInterlaceMode
        VideoFlags: u64,  // ULONGLONG
        dwFramesPerSecondNumerator: u32,  // DWORD
        dwFramesPerSecondDenominator: u32,  // DWORD
        dwMaxBitRate: u32,  // DWORD
        ppIVideoMediaType: *mut *mut core::ffi::c_void  // IMFVideoMediaType** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MFPlat.dll")]
public static extern int MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(IntPtr pbmihBitMapInfoHeader, uint cbBitMapInfoHeader, uint dwPixelAspectRatioX, uint dwPixelAspectRatioY, int InterlaceMode, ulong VideoFlags, uint dwFramesPerSecondNumerator, uint dwFramesPerSecondDenominator, uint dwMaxBitRate, IntPtr ppIVideoMediaType);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFPlat_MFCreateVideoMediaTypeFromBitMapInfoHeaderEx' -Namespace Win32 -PassThru
# $api::MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(pbmihBitMapInfoHeader, cbBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, dwFramesPerSecondNumerator, dwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType)
#uselib "MFPlat.dll"
#func global MFCreateVideoMediaTypeFromBitMapInfoHeaderEx "MFCreateVideoMediaTypeFromBitMapInfoHeaderEx" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; MFCreateVideoMediaTypeFromBitMapInfoHeaderEx varptr(pbmihBitMapInfoHeader), cbBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, dwFramesPerSecondNumerator, dwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType   ; 戻り値は stat
; pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> "sptr"
; cbBitMapInfoHeader : DWORD -> "sptr"
; dwPixelAspectRatioX : DWORD -> "sptr"
; dwPixelAspectRatioY : DWORD -> "sptr"
; InterlaceMode : MFVideoInterlaceMode -> "sptr"
; VideoFlags : ULONGLONG -> "sptr"
; dwFramesPerSecondNumerator : DWORD -> "sptr"
; dwFramesPerSecondDenominator : DWORD -> "sptr"
; dwMaxBitRate : DWORD -> "sptr"
; ppIVideoMediaType : IMFVideoMediaType** out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MFPlat.dll"
#cfunc global MFCreateVideoMediaTypeFromBitMapInfoHeaderEx "MFCreateVideoMediaTypeFromBitMapInfoHeaderEx" var, int, int, int, int, int64, int, int, int, sptr
; res = MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(pbmihBitMapInfoHeader, cbBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, dwFramesPerSecondNumerator, dwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType)
; pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> "var"
; cbBitMapInfoHeader : DWORD -> "int"
; dwPixelAspectRatioX : DWORD -> "int"
; dwPixelAspectRatioY : DWORD -> "int"
; InterlaceMode : MFVideoInterlaceMode -> "int"
; VideoFlags : ULONGLONG -> "int64"
; dwFramesPerSecondNumerator : DWORD -> "int"
; dwFramesPerSecondDenominator : DWORD -> "int"
; dwMaxBitRate : DWORD -> "int"
; ppIVideoMediaType : IMFVideoMediaType** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; HRESULT MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(BITMAPINFOHEADER* pbmihBitMapInfoHeader, DWORD cbBitMapInfoHeader, DWORD dwPixelAspectRatioX, DWORD dwPixelAspectRatioY, MFVideoInterlaceMode InterlaceMode, ULONGLONG VideoFlags, DWORD dwFramesPerSecondNumerator, DWORD dwFramesPerSecondDenominator, DWORD dwMaxBitRate, IMFVideoMediaType** ppIVideoMediaType)
#uselib "MFPlat.dll"
#cfunc global MFCreateVideoMediaTypeFromBitMapInfoHeaderEx "MFCreateVideoMediaTypeFromBitMapInfoHeaderEx" var, int, int, int, int, int64, int, int, int, intptr
; res = MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(pbmihBitMapInfoHeader, cbBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, dwFramesPerSecondNumerator, dwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType)
; pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> "var"
; cbBitMapInfoHeader : DWORD -> "int"
; dwPixelAspectRatioX : DWORD -> "int"
; dwPixelAspectRatioY : DWORD -> "int"
; InterlaceMode : MFVideoInterlaceMode -> "int"
; VideoFlags : ULONGLONG -> "int64"
; dwFramesPerSecondNumerator : DWORD -> "int"
; dwFramesPerSecondDenominator : DWORD -> "int"
; dwMaxBitRate : DWORD -> "int"
; ppIVideoMediaType : IMFVideoMediaType** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFCreateVideoMediaTypeFromBitMapInfoHeaderEx = mfplat.NewProc("MFCreateVideoMediaTypeFromBitMapInfoHeaderEx")
)

// pbmihBitMapInfoHeader (BITMAPINFOHEADER*), cbBitMapInfoHeader (DWORD), dwPixelAspectRatioX (DWORD), dwPixelAspectRatioY (DWORD), InterlaceMode (MFVideoInterlaceMode), VideoFlags (ULONGLONG), dwFramesPerSecondNumerator (DWORD), dwFramesPerSecondDenominator (DWORD), dwMaxBitRate (DWORD), ppIVideoMediaType (IMFVideoMediaType** out)
r1, _, err := procMFCreateVideoMediaTypeFromBitMapInfoHeaderEx.Call(
	uintptr(pbmihBitMapInfoHeader),
	uintptr(cbBitMapInfoHeader),
	uintptr(dwPixelAspectRatioX),
	uintptr(dwPixelAspectRatioY),
	uintptr(InterlaceMode),
	uintptr(VideoFlags),
	uintptr(dwFramesPerSecondNumerator),
	uintptr(dwFramesPerSecondDenominator),
	uintptr(dwMaxBitRate),
	uintptr(ppIVideoMediaType),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(
  pbmihBitMapInfoHeader: Pointer;   // BITMAPINFOHEADER*
  cbBitMapInfoHeader: DWORD;   // DWORD
  dwPixelAspectRatioX: DWORD;   // DWORD
  dwPixelAspectRatioY: DWORD;   // DWORD
  InterlaceMode: Integer;   // MFVideoInterlaceMode
  VideoFlags: UInt64;   // ULONGLONG
  dwFramesPerSecondNumerator: DWORD;   // DWORD
  dwFramesPerSecondDenominator: DWORD;   // DWORD
  dwMaxBitRate: DWORD;   // DWORD
  ppIVideoMediaType: Pointer   // IMFVideoMediaType** out
): Integer; stdcall;
  external 'MFPlat.dll' name 'MFCreateVideoMediaTypeFromBitMapInfoHeaderEx';
result := DllCall("MFPlat\MFCreateVideoMediaTypeFromBitMapInfoHeaderEx"
    , "Ptr", pbmihBitMapInfoHeader   ; BITMAPINFOHEADER*
    , "UInt", cbBitMapInfoHeader   ; DWORD
    , "UInt", dwPixelAspectRatioX   ; DWORD
    , "UInt", dwPixelAspectRatioY   ; DWORD
    , "Int", InterlaceMode   ; MFVideoInterlaceMode
    , "Int64", VideoFlags   ; ULONGLONG
    , "UInt", dwFramesPerSecondNumerator   ; DWORD
    , "UInt", dwFramesPerSecondDenominator   ; DWORD
    , "UInt", dwMaxBitRate   ; DWORD
    , "Ptr", ppIVideoMediaType   ; IMFVideoMediaType** out
    , "Int")   ; return: HRESULT
●MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(pbmihBitMapInfoHeader, cbBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, dwFramesPerSecondNumerator, dwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType) = DLL("MFPlat.dll", "int MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(void*, dword, dword, dword, int, qword, dword, dword, dword, void*)")
# 呼び出し: MFCreateVideoMediaTypeFromBitMapInfoHeaderEx(pbmihBitMapInfoHeader, cbBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, dwFramesPerSecondNumerator, dwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType)
# pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> "void*"
# cbBitMapInfoHeader : DWORD -> "dword"
# dwPixelAspectRatioX : DWORD -> "dword"
# dwPixelAspectRatioY : DWORD -> "dword"
# InterlaceMode : MFVideoInterlaceMode -> "int"
# VideoFlags : ULONGLONG -> "qword"
# dwFramesPerSecondNumerator : DWORD -> "dword"
# dwFramesPerSecondDenominator : DWORD -> "dword"
# dwMaxBitRate : DWORD -> "dword"
# ppIVideoMediaType : IMFVideoMediaType** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。