ホーム › Media.MediaFoundation › MFCreateVideoMediaTypeFromBitMapInfoHeader
MFCreateVideoMediaTypeFromBitMapInfoHeader
関数ビットマップヘッダーと属性からビデオメディア型を生成する。
シグネチャ
// 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
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pbmihBitMapInfoHeader | BITMAPINFOHEADER* | in | 予約済み。 |
| dwPixelAspectRatioX | DWORD | in | 予約済み。 |
| dwPixelAspectRatioY | DWORD | in | 予約済み。 |
| InterlaceMode | MFVideoInterlaceMode | in | 予約済み。 |
| VideoFlags | ULONGLONG | in | 予約済み。 |
| qwFramesPerSecondNumerator | ULONGLONG | in | 予約済み。 |
| qwFramesPerSecondDenominator | ULONGLONG | in | 予約済み。 |
| dwMaxBitRate | DWORD | in | 予約済み。 |
| ppIVideoMediaType | IMFVideoMediaType** | out | 予約済み。 |
戻り値の型: HRESULT
公式ドキュメント
この関数は実装されていません。(MFCreateVideoMediaTypeFromBitMapInfoHeader)
戻り値
E_FAIL を返します。
解説(Remarks)
注意 Windows 7 より前のバージョンでは、この関数は evr.dll からエクスポートされていました。Windows 7 以降では、この関数は mfplat.dll からエクスポートされ、evr.dll は mfplat.dll を呼び出すスタブ関数をエクスポートします。詳細については、Windows 7 でのライブラリの変更を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// 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 は未対応)。#uselib "MFPlat.dll" #cfunc global MFCreateVideoMediaTypeFromBitMapInfoHeader "MFCreateVideoMediaTypeFromBitMapInfoHeader" sptr, int, int, int, int64, int64, int64, int, sptr ; res = MFCreateVideoMediaTypeFromBitMapInfoHeader(varptr(pbmihBitMapInfoHeader), dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, qwFramesPerSecondNumerator, qwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType) ; pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> "sptr" ; 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" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; 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" intptr, int, int, int, int64, int64, int64, int, intptr ; res = MFCreateVideoMediaTypeFromBitMapInfoHeader(varptr(pbmihBitMapInfoHeader), dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, qwFramesPerSecondNumerator, qwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType) ; pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> "intptr" ; 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" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // HRESULTfunction 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)。const std = @import("std");
extern "mfplat" fn MFCreateVideoMediaTypeFromBitMapInfoHeader(
pbmihBitMapInfoHeader: [*c]BITMAPINFOHEADER, // BITMAPINFOHEADER*
dwPixelAspectRatioX: u32, // DWORD
dwPixelAspectRatioY: u32, // DWORD
InterlaceMode: i32, // MFVideoInterlaceMode
VideoFlags: u64, // ULONGLONG
qwFramesPerSecondNumerator: u64, // ULONGLONG
qwFramesPerSecondDenominator: u64, // ULONGLONG
dwMaxBitRate: u32, // DWORD
ppIVideoMediaType: ?*anyopaque // IMFVideoMediaType** out
) callconv(std.os.windows.WINAPI) i32;proc MFCreateVideoMediaTypeFromBitMapInfoHeader(
pbmihBitMapInfoHeader: ptr BITMAPINFOHEADER, # BITMAPINFOHEADER*
dwPixelAspectRatioX: uint32, # DWORD
dwPixelAspectRatioY: uint32, # DWORD
InterlaceMode: int32, # MFVideoInterlaceMode
VideoFlags: uint64, # ULONGLONG
qwFramesPerSecondNumerator: uint64, # ULONGLONG
qwFramesPerSecondDenominator: uint64, # ULONGLONG
dwMaxBitRate: uint32, # DWORD
ppIVideoMediaType: pointer # IMFVideoMediaType** out
): int32 {.importc: "MFCreateVideoMediaTypeFromBitMapInfoHeader", stdcall, dynlib: "MFPlat.dll".}pragma(lib, "mfplat");
extern(Windows)
int MFCreateVideoMediaTypeFromBitMapInfoHeader(
BITMAPINFOHEADER* pbmihBitMapInfoHeader, // BITMAPINFOHEADER*
uint dwPixelAspectRatioX, // DWORD
uint dwPixelAspectRatioY, // DWORD
int InterlaceMode, // MFVideoInterlaceMode
ulong VideoFlags, // ULONGLONG
ulong qwFramesPerSecondNumerator, // ULONGLONG
ulong qwFramesPerSecondDenominator, // ULONGLONG
uint dwMaxBitRate, // DWORD
void* ppIVideoMediaType // IMFVideoMediaType** out
);ccall((:MFCreateVideoMediaTypeFromBitMapInfoHeader, "MFPlat.dll"), stdcall, Int32,
(Ptr{BITMAPINFOHEADER}, UInt32, UInt32, Int32, UInt64, UInt64, UInt64, UInt32, Ptr{Cvoid}),
pbmihBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, qwFramesPerSecondNumerator, qwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType)
# pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> Ptr{BITMAPINFOHEADER}
# dwPixelAspectRatioX : DWORD -> UInt32
# dwPixelAspectRatioY : DWORD -> UInt32
# InterlaceMode : MFVideoInterlaceMode -> Int32
# VideoFlags : ULONGLONG -> UInt64
# qwFramesPerSecondNumerator : ULONGLONG -> UInt64
# qwFramesPerSecondDenominator : ULONGLONG -> UInt64
# dwMaxBitRate : DWORD -> UInt32
# ppIVideoMediaType : IMFVideoMediaType** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t MFCreateVideoMediaTypeFromBitMapInfoHeader(
void* pbmihBitMapInfoHeader,
uint32_t dwPixelAspectRatioX,
uint32_t dwPixelAspectRatioY,
int32_t InterlaceMode,
uint64_t VideoFlags,
uint64_t qwFramesPerSecondNumerator,
uint64_t qwFramesPerSecondDenominator,
uint32_t dwMaxBitRate,
void* ppIVideoMediaType);
]]
local mfplat = ffi.load("mfplat")
-- mfplat.MFCreateVideoMediaTypeFromBitMapInfoHeader(pbmihBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, qwFramesPerSecondNumerator, qwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType)
-- pbmihBitMapInfoHeader : BITMAPINFOHEADER*
-- dwPixelAspectRatioX : DWORD
-- dwPixelAspectRatioY : DWORD
-- InterlaceMode : MFVideoInterlaceMode
-- VideoFlags : ULONGLONG
-- qwFramesPerSecondNumerator : ULONGLONG
-- qwFramesPerSecondDenominator : ULONGLONG
-- dwMaxBitRate : DWORD
-- ppIVideoMediaType : IMFVideoMediaType** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MFPlat.dll');
const MFCreateVideoMediaTypeFromBitMapInfoHeader = lib.func('__stdcall', 'MFCreateVideoMediaTypeFromBitMapInfoHeader', 'int32_t', ['void *', 'uint32_t', 'uint32_t', 'int32_t', 'uint64_t', 'uint64_t', 'uint64_t', 'uint32_t', 'void *']);
// MFCreateVideoMediaTypeFromBitMapInfoHeader(pbmihBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, qwFramesPerSecondNumerator, qwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType)
// pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> 'void *'
// dwPixelAspectRatioX : DWORD -> 'uint32_t'
// dwPixelAspectRatioY : DWORD -> 'uint32_t'
// InterlaceMode : MFVideoInterlaceMode -> 'int32_t'
// VideoFlags : ULONGLONG -> 'uint64_t'
// qwFramesPerSecondNumerator : ULONGLONG -> 'uint64_t'
// qwFramesPerSecondDenominator : ULONGLONG -> 'uint64_t'
// dwMaxBitRate : DWORD -> 'uint32_t'
// ppIVideoMediaType : IMFVideoMediaType** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MFPlat.dll", {
MFCreateVideoMediaTypeFromBitMapInfoHeader: { parameters: ["pointer", "u32", "u32", "i32", "u64", "u64", "u64", "u32", "pointer"], result: "i32" },
});
// lib.symbols.MFCreateVideoMediaTypeFromBitMapInfoHeader(pbmihBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, qwFramesPerSecondNumerator, qwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType)
// pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> "pointer"
// dwPixelAspectRatioX : DWORD -> "u32"
// dwPixelAspectRatioY : DWORD -> "u32"
// InterlaceMode : MFVideoInterlaceMode -> "i32"
// VideoFlags : ULONGLONG -> "u64"
// qwFramesPerSecondNumerator : ULONGLONG -> "u64"
// qwFramesPerSecondDenominator : ULONGLONG -> "u64"
// dwMaxBitRate : DWORD -> "u32"
// ppIVideoMediaType : IMFVideoMediaType** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t MFCreateVideoMediaTypeFromBitMapInfoHeader(
void* pbmihBitMapInfoHeader,
uint32_t dwPixelAspectRatioX,
uint32_t dwPixelAspectRatioY,
int32_t InterlaceMode,
uint64_t VideoFlags,
uint64_t qwFramesPerSecondNumerator,
uint64_t qwFramesPerSecondDenominator,
uint32_t dwMaxBitRate,
void* ppIVideoMediaType);
C, "MFPlat.dll");
// $ffi->MFCreateVideoMediaTypeFromBitMapInfoHeader(pbmihBitMapInfoHeader, dwPixelAspectRatioX, dwPixelAspectRatioY, InterlaceMode, VideoFlags, qwFramesPerSecondNumerator, qwFramesPerSecondDenominator, dwMaxBitRate, ppIVideoMediaType);
// pbmihBitMapInfoHeader : BITMAPINFOHEADER*
// dwPixelAspectRatioX : DWORD
// dwPixelAspectRatioY : DWORD
// InterlaceMode : MFVideoInterlaceMode
// VideoFlags : ULONGLONG
// qwFramesPerSecondNumerator : ULONGLONG
// qwFramesPerSecondDenominator : ULONGLONG
// dwMaxBitRate : DWORD
// ppIVideoMediaType : IMFVideoMediaType** out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Mfplat extends StdCallLibrary {
Mfplat INSTANCE = Native.load("mfplat", Mfplat.class);
int MFCreateVideoMediaTypeFromBitMapInfoHeader(
Pointer pbmihBitMapInfoHeader, // BITMAPINFOHEADER*
int dwPixelAspectRatioX, // DWORD
int dwPixelAspectRatioY, // DWORD
int InterlaceMode, // MFVideoInterlaceMode
long VideoFlags, // ULONGLONG
long qwFramesPerSecondNumerator, // ULONGLONG
long qwFramesPerSecondDenominator, // ULONGLONG
int dwMaxBitRate, // DWORD
Pointer ppIVideoMediaType // IMFVideoMediaType** out
);
}@[Link("mfplat")]
lib LibMFPlat
fun MFCreateVideoMediaTypeFromBitMapInfoHeader = MFCreateVideoMediaTypeFromBitMapInfoHeader(
pbmihBitMapInfoHeader : BITMAPINFOHEADER*, # BITMAPINFOHEADER*
dwPixelAspectRatioX : UInt32, # DWORD
dwPixelAspectRatioY : UInt32, # DWORD
InterlaceMode : Int32, # MFVideoInterlaceMode
VideoFlags : UInt64, # ULONGLONG
qwFramesPerSecondNumerator : UInt64, # ULONGLONG
qwFramesPerSecondDenominator : UInt64, # ULONGLONG
dwMaxBitRate : UInt32, # DWORD
ppIVideoMediaType : Void* # IMFVideoMediaType** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MFCreateVideoMediaTypeFromBitMapInfoHeaderNative = Int32 Function(Pointer<Void>, Uint32, Uint32, Int32, Uint64, Uint64, Uint64, Uint32, Pointer<Void>);
typedef MFCreateVideoMediaTypeFromBitMapInfoHeaderDart = int Function(Pointer<Void>, int, int, int, int, int, int, int, Pointer<Void>);
final MFCreateVideoMediaTypeFromBitMapInfoHeader = DynamicLibrary.open('MFPlat.dll')
.lookupFunction<MFCreateVideoMediaTypeFromBitMapInfoHeaderNative, MFCreateVideoMediaTypeFromBitMapInfoHeaderDart>('MFCreateVideoMediaTypeFromBitMapInfoHeader');
// pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> Pointer<Void>
// dwPixelAspectRatioX : DWORD -> Uint32
// dwPixelAspectRatioY : DWORD -> Uint32
// InterlaceMode : MFVideoInterlaceMode -> Int32
// VideoFlags : ULONGLONG -> Uint64
// qwFramesPerSecondNumerator : ULONGLONG -> Uint64
// qwFramesPerSecondDenominator : ULONGLONG -> Uint64
// dwMaxBitRate : DWORD -> Uint32
// ppIVideoMediaType : IMFVideoMediaType** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MFCreateVideoMediaTypeFromBitMapInfoHeader"
c_MFCreateVideoMediaTypeFromBitMapInfoHeader :: Ptr () -> Word32 -> Word32 -> Int32 -> Word64 -> Word64 -> Word64 -> Word32 -> Ptr () -> IO Int32
-- pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> Ptr ()
-- dwPixelAspectRatioX : DWORD -> Word32
-- dwPixelAspectRatioY : DWORD -> Word32
-- InterlaceMode : MFVideoInterlaceMode -> Int32
-- VideoFlags : ULONGLONG -> Word64
-- qwFramesPerSecondNumerator : ULONGLONG -> Word64
-- qwFramesPerSecondDenominator : ULONGLONG -> Word64
-- dwMaxBitRate : DWORD -> Word32
-- ppIVideoMediaType : IMFVideoMediaType** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let mfcreatevideomediatypefrombitmapinfoheader =
foreign "MFCreateVideoMediaTypeFromBitMapInfoHeader"
((ptr void) @-> uint32_t @-> uint32_t @-> int32_t @-> uint64_t @-> uint64_t @-> uint64_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> (ptr void) *)
(* dwPixelAspectRatioX : DWORD -> uint32_t *)
(* dwPixelAspectRatioY : DWORD -> uint32_t *)
(* InterlaceMode : MFVideoInterlaceMode -> int32_t *)
(* VideoFlags : ULONGLONG -> uint64_t *)
(* qwFramesPerSecondNumerator : ULONGLONG -> uint64_t *)
(* qwFramesPerSecondDenominator : ULONGLONG -> uint64_t *)
(* dwMaxBitRate : DWORD -> uint32_t *)
(* ppIVideoMediaType : IMFVideoMediaType** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mfplat (t "MFPlat.dll"))
(cffi:use-foreign-library mfplat)
(cffi:defcfun ("MFCreateVideoMediaTypeFromBitMapInfoHeader" mfcreate-video-media-type-from-bit-map-info-header :convention :stdcall) :int32
(pbmih-bit-map-info-header :pointer) ; BITMAPINFOHEADER*
(dw-pixel-aspect-ratio-x :uint32) ; DWORD
(dw-pixel-aspect-ratio-y :uint32) ; DWORD
(interlace-mode :int32) ; MFVideoInterlaceMode
(video-flags :uint64) ; ULONGLONG
(qw-frames-per-second-numerator :uint64) ; ULONGLONG
(qw-frames-per-second-denominator :uint64) ; ULONGLONG
(dw-max-bit-rate :uint32) ; DWORD
(pp-ivideo-media-type :pointer)) ; IMFVideoMediaType** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MFCreateVideoMediaTypeFromBitMapInfoHeader = Win32::API::More->new('MFPlat',
'int MFCreateVideoMediaTypeFromBitMapInfoHeader(LPVOID pbmihBitMapInfoHeader, DWORD dwPixelAspectRatioX, DWORD dwPixelAspectRatioY, int InterlaceMode, UINT64 VideoFlags, UINT64 qwFramesPerSecondNumerator, UINT64 qwFramesPerSecondDenominator, DWORD dwMaxBitRate, LPVOID ppIVideoMediaType)');
# my $ret = $MFCreateVideoMediaTypeFromBitMapInfoHeader->Call($pbmihBitMapInfoHeader, $dwPixelAspectRatioX, $dwPixelAspectRatioY, $InterlaceMode, $VideoFlags, $qwFramesPerSecondNumerator, $qwFramesPerSecondDenominator, $dwMaxBitRate, $ppIVideoMediaType);
# pbmihBitMapInfoHeader : BITMAPINFOHEADER* -> LPVOID
# dwPixelAspectRatioX : DWORD -> DWORD
# dwPixelAspectRatioY : DWORD -> DWORD
# InterlaceMode : MFVideoInterlaceMode -> int
# VideoFlags : ULONGLONG -> UINT64
# qwFramesPerSecondNumerator : ULONGLONG -> UINT64
# qwFramesPerSecondDenominator : ULONGLONG -> UINT64
# dwMaxBitRate : DWORD -> DWORD
# ppIVideoMediaType : IMFVideoMediaType** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f MFCreateVideoMediaTypeFromBitMapInfoHeaderEx — ビットマップヘッダーと拡張属性からビデオメディア型を生成する。