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

MFCreateVideoMediaTypeFromBitMapInfoHeader

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

シグネチャ

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

HRESULT MFCreateVideoMediaTypeFromBitMapInfoHeader(
    const BITMAPINFOHEADER* pbmihBitMapInfoHeader,
    DWORD dwPixelAspectRatioX,
    DWORD dwPixelAspectRatioY,
    MFVideoInterlaceMode InterlaceMode,
    ULONGLONG VideoFlags,
    ULONGLONG qwFramesPerSecondNumerator,
    ULONGLONG qwFramesPerSecondDenominator,
    DWORD dwMaxBitRate,
    IMFVideoMediaType** ppIVideoMediaType
);

パラメーター

名前方向
pbmihBitMapInfoHeaderBITMAPINFOHEADER*in
dwPixelAspectRatioXDWORDin
dwPixelAspectRatioYDWORDin
InterlaceModeMFVideoInterlaceModein
VideoFlagsULONGLONGin
qwFramesPerSecondNumeratorULONGLONGin
qwFramesPerSecondDenominatorULONGLONGin
dwMaxBitRateDWORDin
ppIVideoMediaTypeIMFVideoMediaType**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MFCreateVideoMediaTypeFromBitMapInfoHeader(
    const BITMAPINFOHEADER* pbmihBitMapInfoHeader,
    DWORD dwPixelAspectRatioX,
    DWORD dwPixelAspectRatioY,
    MFVideoInterlaceMode InterlaceMode,
    ULONGLONG VideoFlags,
    ULONGLONG qwFramesPerSecondNumerator,
    ULONGLONG qwFramesPerSecondDenominator,
    DWORD dwMaxBitRate,
    IMFVideoMediaType** ppIVideoMediaType
);
[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFCreateVideoMediaTypeFromBitMapInfoHeader(
    IntPtr pbmihBitMapInfoHeader,   // BITMAPINFOHEADER*
    uint dwPixelAspectRatioX,   // DWORD
    uint dwPixelAspectRatioY,   // DWORD
    int InterlaceMode,   // MFVideoInterlaceMode
    ulong VideoFlags,   // ULONGLONG
    ulong qwFramesPerSecondNumerator,   // ULONGLONG
    ulong qwFramesPerSecondDenominator,   // ULONGLONG
    uint dwMaxBitRate,   // DWORD
    IntPtr ppIVideoMediaType   // IMFVideoMediaType** out
);
<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFCreateVideoMediaTypeFromBitMapInfoHeader(
    pbmihBitMapInfoHeader As IntPtr,   ' BITMAPINFOHEADER*
    dwPixelAspectRatioX As UInteger,   ' DWORD
    dwPixelAspectRatioY As UInteger,   ' DWORD
    InterlaceMode As Integer,   ' MFVideoInterlaceMode
    VideoFlags As ULong,   ' ULONGLONG
    qwFramesPerSecondNumerator As ULong,   ' ULONGLONG
    qwFramesPerSecondDenominator As ULong,   ' ULONGLONG
    dwMaxBitRate As UInteger,   ' DWORD
    ppIVideoMediaType As IntPtr   ' IMFVideoMediaType** out
) As Integer
End Function
' pbmihBitMapInfoHeader : BITMAPINFOHEADER*
' dwPixelAspectRatioX : DWORD
' dwPixelAspectRatioY : DWORD
' InterlaceMode : MFVideoInterlaceMode
' VideoFlags : ULONGLONG
' qwFramesPerSecondNumerator : ULONGLONG
' qwFramesPerSecondDenominator : ULONGLONG
' dwMaxBitRate : DWORD
' ppIVideoMediaType : IMFVideoMediaType** out
Declare PtrSafe Function MFCreateVideoMediaTypeFromBitMapInfoHeader Lib "mfplat" ( _
    ByVal pbmihBitMapInfoHeader As LongPtr, _
    ByVal dwPixelAspectRatioX As Long, _
    ByVal dwPixelAspectRatioY As Long, _
    ByVal InterlaceMode As Long, _
    ByVal VideoFlags As LongLong, _
    ByVal qwFramesPerSecondNumerator As LongLong, _
    ByVal qwFramesPerSecondDenominator As LongLong, _
    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

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

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

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFCreateVideoMediaTypeFromBitMapInfoHeader = mfplat.NewProc("MFCreateVideoMediaTypeFromBitMapInfoHeader")
)

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