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

MFVideoInfo

構造体
サイズx64: 112 バイト / x86: 112 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwWidthDWORD4+0+0ビデオ画像の幅をピクセル単位で示す。
dwHeightDWORD4+4+4ビデオ画像の高さをピクセル単位で示す。
PixelAspectRatioMFRatio8+8+8ピクセルのアスペクト比を示すMFRatio。
SourceChromaSubsamplingMFVideoChromaSubsampling4+16+16ソースのクロマサブサンプリング方式を示すMFVideoChromaSubsampling列挙値。
InterlaceModeMFVideoInterlaceMode4+20+20インターレース方式を示すMFVideoInterlaceMode列挙値。
TransferFunctionMFVideoTransferFunction4+24+24ガンマ補正等の伝達関数を示すMFVideoTransferFunction列挙値。
ColorPrimariesMFVideoPrimaries4+28+28色域の原色を示すMFVideoPrimaries列挙値。
TransferMatrixMFVideoTransferMatrix4+32+32RGB-YUV変換行列を示すMFVideoTransferMatrix列挙値。
SourceLightingMFVideoLighting4+36+36ソースの想定照明環境を示すMFVideoLighting列挙値。
FramesPerSecondMFRatio8+40+40フレームレートを示すMFRatio。
NominalRangeMFNominalRange4+48+48輝度の公称範囲(0-255/16-235等)を示すMFNominalRange列挙値。
GeometricApertureMFVideoArea16+52+52幾何学的アパーチャ(表示すべき領域)を示すMFVideoArea。
MinimumDisplayApertureMFVideoArea16+68+68最小表示アパーチャ領域を示すMFVideoArea。
PanScanApertureMFVideoArea16+84+84パンスキャン表示時のアパーチャ領域を示すMFVideoArea。
VideoFlagsULONGLONG8+104+104ビデオ属性を示す64ビットのビットフラグ。

各言語での定義

#include <windows.h>

// MFRatio  (x64 8 / x86 8 バイト)
typedef struct MFRatio {
    DWORD Numerator;
    DWORD Denominator;
} MFRatio;

// MFOffset  (x64 4 / x86 4 バイト)
typedef struct MFOffset {
    WORD fract;
    SHORT value;
} MFOffset;

// SIZE  (x64 8 / x86 8 バイト)
typedef struct SIZE {
    INT cx;
    INT cy;
} SIZE;

// MFVideoArea  (x64 16 / x86 16 バイト)
typedef struct MFVideoArea {
    MFOffset OffsetX;
    MFOffset OffsetY;
    SIZE Area;
} MFVideoArea;

// MFVideoInfo  (x64 112 / x86 112 バイト)
typedef struct MFVideoInfo {
    DWORD dwWidth;
    DWORD dwHeight;
    MFRatio PixelAspectRatio;
    MFVideoChromaSubsampling SourceChromaSubsampling;
    MFVideoInterlaceMode InterlaceMode;
    MFVideoTransferFunction TransferFunction;
    MFVideoPrimaries ColorPrimaries;
    MFVideoTransferMatrix TransferMatrix;
    MFVideoLighting SourceLighting;
    MFRatio FramesPerSecond;
    MFNominalRange NominalRange;
    MFVideoArea GeometricAperture;
    MFVideoArea MinimumDisplayAperture;
    MFVideoArea PanScanAperture;
    ULONGLONG VideoFlags;
} MFVideoInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFRatio
{
    public uint Numerator;
    public uint Denominator;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFOffset
{
    public ushort fract;
    public short value;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIZE
{
    public int cx;
    public int cy;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVideoArea
{
    public MFOffset OffsetX;
    public MFOffset OffsetY;
    public SIZE Area;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVideoInfo
{
    public uint dwWidth;
    public uint dwHeight;
    public MFRatio PixelAspectRatio;
    public int SourceChromaSubsampling;
    public int InterlaceMode;
    public int TransferFunction;
    public int ColorPrimaries;
    public int TransferMatrix;
    public int SourceLighting;
    public MFRatio FramesPerSecond;
    public int NominalRange;
    public MFVideoArea GeometricAperture;
    public MFVideoArea MinimumDisplayAperture;
    public MFVideoArea PanScanAperture;
    public ulong VideoFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFRatio
    Public Numerator As UInteger
    Public Denominator As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFOffset
    Public fract As UShort
    Public value As Short
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIZE
    Public cx As Integer
    Public cy As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFVideoArea
    Public OffsetX As MFOffset
    Public OffsetY As MFOffset
    Public Area As SIZE
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFVideoInfo
    Public dwWidth As UInteger
    Public dwHeight As UInteger
    Public PixelAspectRatio As MFRatio
    Public SourceChromaSubsampling As Integer
    Public InterlaceMode As Integer
    Public TransferFunction As Integer
    Public ColorPrimaries As Integer
    Public TransferMatrix As Integer
    Public SourceLighting As Integer
    Public FramesPerSecond As MFRatio
    Public NominalRange As Integer
    Public GeometricAperture As MFVideoArea
    Public MinimumDisplayAperture As MFVideoArea
    Public PanScanAperture As MFVideoArea
    Public VideoFlags As ULong
End Structure
import ctypes
from ctypes import wintypes

class MFRatio(ctypes.Structure):
    _fields_ = [
        ("Numerator", wintypes.DWORD),
        ("Denominator", wintypes.DWORD),
    ]

class MFOffset(ctypes.Structure):
    _fields_ = [
        ("fract", ctypes.c_ushort),
        ("value", ctypes.c_short),
    ]

class SIZE(ctypes.Structure):
    _fields_ = [
        ("cx", ctypes.c_int),
        ("cy", ctypes.c_int),
    ]

class MFVideoArea(ctypes.Structure):
    _fields_ = [
        ("OffsetX", MFOffset),
        ("OffsetY", MFOffset),
        ("Area", SIZE),
    ]

class MFVideoInfo(ctypes.Structure):
    _fields_ = [
        ("dwWidth", wintypes.DWORD),
        ("dwHeight", wintypes.DWORD),
        ("PixelAspectRatio", MFRatio),
        ("SourceChromaSubsampling", ctypes.c_int),
        ("InterlaceMode", ctypes.c_int),
        ("TransferFunction", ctypes.c_int),
        ("ColorPrimaries", ctypes.c_int),
        ("TransferMatrix", ctypes.c_int),
        ("SourceLighting", ctypes.c_int),
        ("FramesPerSecond", MFRatio),
        ("NominalRange", ctypes.c_int),
        ("GeometricAperture", MFVideoArea),
        ("MinimumDisplayAperture", MFVideoArea),
        ("PanScanAperture", MFVideoArea),
        ("VideoFlags", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct MFRatio {
    pub Numerator: u32,
    pub Denominator: u32,
}

#[repr(C)]
pub struct MFOffset {
    pub fract: u16,
    pub value: i16,
}

#[repr(C)]
pub struct SIZE {
    pub cx: i32,
    pub cy: i32,
}

#[repr(C)]
pub struct MFVideoArea {
    pub OffsetX: MFOffset,
    pub OffsetY: MFOffset,
    pub Area: SIZE,
}

#[repr(C)]
pub struct MFVideoInfo {
    pub dwWidth: u32,
    pub dwHeight: u32,
    pub PixelAspectRatio: MFRatio,
    pub SourceChromaSubsampling: i32,
    pub InterlaceMode: i32,
    pub TransferFunction: i32,
    pub ColorPrimaries: i32,
    pub TransferMatrix: i32,
    pub SourceLighting: i32,
    pub FramesPerSecond: MFRatio,
    pub NominalRange: i32,
    pub GeometricAperture: MFVideoArea,
    pub MinimumDisplayAperture: MFVideoArea,
    pub PanScanAperture: MFVideoArea,
    pub VideoFlags: u64,
}
import "golang.org/x/sys/windows"

type MFRatio struct {
	Numerator uint32
	Denominator uint32
}

type MFOffset struct {
	fract uint16
	value int16
}

type SIZE struct {
	cx int32
	cy int32
}

type MFVideoArea struct {
	OffsetX MFOffset
	OffsetY MFOffset
	Area SIZE
}

type MFVideoInfo struct {
	dwWidth uint32
	dwHeight uint32
	PixelAspectRatio MFRatio
	SourceChromaSubsampling int32
	InterlaceMode int32
	TransferFunction int32
	ColorPrimaries int32
	TransferMatrix int32
	SourceLighting int32
	FramesPerSecond MFRatio
	NominalRange int32
	GeometricAperture MFVideoArea
	MinimumDisplayAperture MFVideoArea
	PanScanAperture MFVideoArea
	VideoFlags uint64
}
type
  MFRatio = record
    Numerator: DWORD;
    Denominator: DWORD;
  end;

  MFOffset = record
    fract: Word;
    value: Smallint;
  end;

  SIZE = record
    cx: Integer;
    cy: Integer;
  end;

  MFVideoArea = record
    OffsetX: MFOffset;
    OffsetY: MFOffset;
    Area: SIZE;
  end;

  MFVideoInfo = record
    dwWidth: DWORD;
    dwHeight: DWORD;
    PixelAspectRatio: MFRatio;
    SourceChromaSubsampling: Integer;
    InterlaceMode: Integer;
    TransferFunction: Integer;
    ColorPrimaries: Integer;
    TransferMatrix: Integer;
    SourceLighting: Integer;
    FramesPerSecond: MFRatio;
    NominalRange: Integer;
    GeometricAperture: MFVideoArea;
    MinimumDisplayAperture: MFVideoArea;
    PanScanAperture: MFVideoArea;
    VideoFlags: UInt64;
  end;
const MFRatio = extern struct {
    Numerator: u32,
    Denominator: u32,
};

const MFOffset = extern struct {
    fract: u16,
    value: i16,
};

const SIZE = extern struct {
    cx: i32,
    cy: i32,
};

const MFVideoArea = extern struct {
    OffsetX: MFOffset,
    OffsetY: MFOffset,
    Area: SIZE,
};

const MFVideoInfo = extern struct {
    dwWidth: u32,
    dwHeight: u32,
    PixelAspectRatio: MFRatio,
    SourceChromaSubsampling: i32,
    InterlaceMode: i32,
    TransferFunction: i32,
    ColorPrimaries: i32,
    TransferMatrix: i32,
    SourceLighting: i32,
    FramesPerSecond: MFRatio,
    NominalRange: i32,
    GeometricAperture: MFVideoArea,
    MinimumDisplayAperture: MFVideoArea,
    PanScanAperture: MFVideoArea,
    VideoFlags: u64,
};
type
  MFRatio {.bycopy.} = object
    Numerator: uint32
    Denominator: uint32

  MFOffset {.bycopy.} = object
    fract: uint16
    value: int16

  SIZE {.bycopy.} = object
    cx: int32
    cy: int32

  MFVideoArea {.bycopy.} = object
    OffsetX: MFOffset
    OffsetY: MFOffset
    Area: SIZE

  MFVideoInfo {.bycopy.} = object
    dwWidth: uint32
    dwHeight: uint32
    PixelAspectRatio: MFRatio
    SourceChromaSubsampling: int32
    InterlaceMode: int32
    TransferFunction: int32
    ColorPrimaries: int32
    TransferMatrix: int32
    SourceLighting: int32
    FramesPerSecond: MFRatio
    NominalRange: int32
    GeometricAperture: MFVideoArea
    MinimumDisplayAperture: MFVideoArea
    PanScanAperture: MFVideoArea
    VideoFlags: uint64
struct MFRatio
{
    uint Numerator;
    uint Denominator;
}

struct MFOffset
{
    ushort fract;
    short value;
}

struct SIZE
{
    int cx;
    int cy;
}

struct MFVideoArea
{
    MFOffset OffsetX;
    MFOffset OffsetY;
    SIZE Area;
}

struct MFVideoInfo
{
    uint dwWidth;
    uint dwHeight;
    MFRatio PixelAspectRatio;
    int SourceChromaSubsampling;
    int InterlaceMode;
    int TransferFunction;
    int ColorPrimaries;
    int TransferMatrix;
    int SourceLighting;
    MFRatio FramesPerSecond;
    int NominalRange;
    MFVideoArea GeometricAperture;
    MFVideoArea MinimumDisplayAperture;
    MFVideoArea PanScanAperture;
    ulong VideoFlags;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MFVideoInfo サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; dwWidth : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwHeight : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; PixelAspectRatio : MFRatio (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; SourceChromaSubsampling : MFVideoChromaSubsampling (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; InterlaceMode : MFVideoInterlaceMode (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; TransferFunction : MFVideoTransferFunction (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ColorPrimaries : MFVideoPrimaries (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; TransferMatrix : MFVideoTransferMatrix (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; SourceLighting : MFVideoLighting (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; FramesPerSecond : MFRatio (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; NominalRange : MFNominalRange (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; GeometricAperture : MFVideoArea (+52, 16byte)  varptr(st)+52 を基点に操作(16byte:入れ子/配列)
; MinimumDisplayAperture : MFVideoArea (+68, 16byte)  varptr(st)+68 を基点に操作(16byte:入れ子/配列)
; PanScanAperture : MFVideoArea (+84, 16byte)  varptr(st)+84 を基点に操作(16byte:入れ子/配列)
; VideoFlags : ULONGLONG (+104, 8byte)  qpoke st,104,値 / qpeek(st,104)  ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MFRatio
    #field int Numerator
    #field int Denominator
#endstruct

#defstruct global MFOffset
    #field short fract
    #field short value
#endstruct

#defstruct global SIZE
    #field int cx
    #field int cy
#endstruct

#defstruct global MFVideoArea
    #field MFOffset OffsetX
    #field MFOffset OffsetY
    #field SIZE Area
#endstruct

#defstruct global MFVideoInfo
    #field int dwWidth
    #field int dwHeight
    #field MFRatio PixelAspectRatio
    #field int SourceChromaSubsampling
    #field int InterlaceMode
    #field int TransferFunction
    #field int ColorPrimaries
    #field int TransferMatrix
    #field int SourceLighting
    #field MFRatio FramesPerSecond
    #field int NominalRange
    #field MFVideoArea GeometricAperture
    #field MFVideoArea MinimumDisplayAperture
    #field MFVideoArea PanScanAperture
    #field int64 VideoFlags
#endstruct

stdim st, MFVideoInfo        ; NSTRUCT 変数を確保
st->dwWidth = 100
mes "dwWidth=" + st->dwWidth