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

MFGetUncompressedVideoFormat

関数
MFVIDEOFORMATから非圧縮ビデオのFOURCC形式を取得する。
DLLMFPlat.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD MFGetUncompressedVideoFormat(
    const MFVIDEOFORMAT* pVideoFormat
);

パラメーター

名前方向説明
pVideoFormatMFVIDEOFORMAT*inMFVIDEOFORMAT 構造体へのポインター。

戻り値の型: DWORD

公式ドキュメント

非圧縮ビデオ形式の FOURCC 値または D3DFORMAT 値を返します。

戻り値

ビデオ形式を識別する FOURCC 値または D3DFORMAT 値を返します。ビデオ形式が圧縮されている場合、または認識されない場合、戻り値は D3DFMT_UNKNOWN になります。

解説(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)

各言語での呼び出し定義

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

DWORD MFGetUncompressedVideoFormat(
    const MFVIDEOFORMAT* pVideoFormat
);
[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern uint MFGetUncompressedVideoFormat(
    IntPtr pVideoFormat   // MFVIDEOFORMAT*
);
<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFGetUncompressedVideoFormat(
    pVideoFormat As IntPtr   ' MFVIDEOFORMAT*
) As UInteger
End Function
' pVideoFormat : MFVIDEOFORMAT*
Declare PtrSafe Function MFGetUncompressedVideoFormat Lib "mfplat" ( _
    ByVal pVideoFormat As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFGetUncompressedVideoFormat = ctypes.windll.mfplat.MFGetUncompressedVideoFormat
MFGetUncompressedVideoFormat.restype = wintypes.DWORD
MFGetUncompressedVideoFormat.argtypes = [
    ctypes.c_void_p,  # pVideoFormat : MFVIDEOFORMAT*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MFPlat.dll')
MFGetUncompressedVideoFormat = Fiddle::Function.new(
  lib['MFGetUncompressedVideoFormat'],
  [
    Fiddle::TYPE_VOIDP,  # pVideoFormat : MFVIDEOFORMAT*
  ],
  -Fiddle::TYPE_INT)
#[link(name = "mfplat")]
extern "system" {
    fn MFGetUncompressedVideoFormat(
        pVideoFormat: *const MFVIDEOFORMAT  // MFVIDEOFORMAT*
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MFPlat.dll")]
public static extern uint MFGetUncompressedVideoFormat(IntPtr pVideoFormat);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFPlat_MFGetUncompressedVideoFormat' -Namespace Win32 -PassThru
# $api::MFGetUncompressedVideoFormat(pVideoFormat)
#uselib "MFPlat.dll"
#func global MFGetUncompressedVideoFormat "MFGetUncompressedVideoFormat" sptr
; MFGetUncompressedVideoFormat varptr(pVideoFormat)   ; 戻り値は stat
; pVideoFormat : MFVIDEOFORMAT* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MFPlat.dll"
#cfunc global MFGetUncompressedVideoFormat "MFGetUncompressedVideoFormat" var
; res = MFGetUncompressedVideoFormat(pVideoFormat)
; pVideoFormat : MFVIDEOFORMAT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD MFGetUncompressedVideoFormat(MFVIDEOFORMAT* pVideoFormat)
#uselib "MFPlat.dll"
#cfunc global MFGetUncompressedVideoFormat "MFGetUncompressedVideoFormat" var
; res = MFGetUncompressedVideoFormat(pVideoFormat)
; pVideoFormat : MFVIDEOFORMAT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFGetUncompressedVideoFormat = mfplat.NewProc("MFGetUncompressedVideoFormat")
)

// pVideoFormat (MFVIDEOFORMAT*)
r1, _, err := procMFGetUncompressedVideoFormat.Call(
	uintptr(pVideoFormat),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MFGetUncompressedVideoFormat(
  pVideoFormat: Pointer   // MFVIDEOFORMAT*
): DWORD; stdcall;
  external 'MFPlat.dll' name 'MFGetUncompressedVideoFormat';
result := DllCall("MFPlat\MFGetUncompressedVideoFormat"
    , "Ptr", pVideoFormat   ; MFVIDEOFORMAT*
    , "UInt")   ; return: DWORD
●MFGetUncompressedVideoFormat(pVideoFormat) = DLL("MFPlat.dll", "dword MFGetUncompressedVideoFormat(void*)")
# 呼び出し: MFGetUncompressedVideoFormat(pVideoFormat)
# pVideoFormat : MFVIDEOFORMAT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "mfplat" fn MFGetUncompressedVideoFormat(
    pVideoFormat: [*c]MFVIDEOFORMAT // MFVIDEOFORMAT*
) callconv(std.os.windows.WINAPI) u32;
proc MFGetUncompressedVideoFormat(
    pVideoFormat: ptr MFVIDEOFORMAT  # MFVIDEOFORMAT*
): uint32 {.importc: "MFGetUncompressedVideoFormat", stdcall, dynlib: "MFPlat.dll".}
pragma(lib, "mfplat");
extern(Windows)
uint MFGetUncompressedVideoFormat(
    MFVIDEOFORMAT* pVideoFormat   // MFVIDEOFORMAT*
);
ccall((:MFGetUncompressedVideoFormat, "MFPlat.dll"), stdcall, UInt32,
      (Ptr{MFVIDEOFORMAT},),
      pVideoFormat)
# pVideoFormat : MFVIDEOFORMAT* -> Ptr{MFVIDEOFORMAT}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t MFGetUncompressedVideoFormat(
    void* pVideoFormat);
]]
local mfplat = ffi.load("mfplat")
-- mfplat.MFGetUncompressedVideoFormat(pVideoFormat)
-- pVideoFormat : MFVIDEOFORMAT*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MFPlat.dll');
const MFGetUncompressedVideoFormat = lib.func('__stdcall', 'MFGetUncompressedVideoFormat', 'uint32_t', ['void *']);
// MFGetUncompressedVideoFormat(pVideoFormat)
// pVideoFormat : MFVIDEOFORMAT* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MFPlat.dll", {
  MFGetUncompressedVideoFormat: { parameters: ["pointer"], result: "u32" },
});
// lib.symbols.MFGetUncompressedVideoFormat(pVideoFormat)
// pVideoFormat : MFVIDEOFORMAT* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t MFGetUncompressedVideoFormat(
    void* pVideoFormat);
C, "MFPlat.dll");
// $ffi->MFGetUncompressedVideoFormat(pVideoFormat);
// pVideoFormat : MFVIDEOFORMAT*
// 構造体/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 MFGetUncompressedVideoFormat(
        Pointer pVideoFormat   // MFVIDEOFORMAT*
    );
}
@[Link("mfplat")]
lib LibMFPlat
  fun MFGetUncompressedVideoFormat = MFGetUncompressedVideoFormat(
    pVideoFormat : MFVIDEOFORMAT*   # MFVIDEOFORMAT*
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MFGetUncompressedVideoFormatNative = Uint32 Function(Pointer<Void>);
typedef MFGetUncompressedVideoFormatDart = int Function(Pointer<Void>);
final MFGetUncompressedVideoFormat = DynamicLibrary.open('MFPlat.dll')
    .lookupFunction<MFGetUncompressedVideoFormatNative, MFGetUncompressedVideoFormatDart>('MFGetUncompressedVideoFormat');
// pVideoFormat : MFVIDEOFORMAT* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MFGetUncompressedVideoFormat(
  pVideoFormat: Pointer   // MFVIDEOFORMAT*
): DWORD; stdcall;
  external 'MFPlat.dll' name 'MFGetUncompressedVideoFormat';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MFGetUncompressedVideoFormat"
  c_MFGetUncompressedVideoFormat :: Ptr () -> IO Word32
-- pVideoFormat : MFVIDEOFORMAT* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mfgetuncompressedvideoformat =
  foreign "MFGetUncompressedVideoFormat"
    ((ptr void) @-> returning uint32_t)
(* pVideoFormat : MFVIDEOFORMAT* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mfplat (t "MFPlat.dll"))
(cffi:use-foreign-library mfplat)

(cffi:defcfun ("MFGetUncompressedVideoFormat" mfget-uncompressed-video-format :convention :stdcall) :uint32
  (p-video-format :pointer))   ; MFVIDEOFORMAT*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MFGetUncompressedVideoFormat = Win32::API::More->new('MFPlat',
    'DWORD MFGetUncompressedVideoFormat(LPVOID pVideoFormat)');
# my $ret = $MFGetUncompressedVideoFormat->Call($pVideoFormat);
# pVideoFormat : MFVIDEOFORMAT* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型