ホーム › Media.MediaFoundation › MFVideoInfo
MFVideoInfo
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwWidth | DWORD | 4 | +0 | +0 | デコードされた画像の幅 (ピクセル単位)。 |
| dwHeight | DWORD | 4 | +4 | +4 | デコードされた画像の高さ (ピクセル単位)。 |
| PixelAspectRatio | MFRatio | 8 | +8 | +8 | ピクセルアスペクト比。MFRatio 構造体として指定します。 |
| SourceChromaSubsampling | MFVideoChromaSubsampling | 4 | +16 | +16 | 元の画像のクロマサブサンプリング。MFVideoChromaSubsampling 列挙型のメンバーとして指定します。 |
| InterlaceMode | MFVideoInterlaceMode | 4 | +20 | +20 | 画像のインターレース方式。MFVideoInterlaceMode 列挙型のメンバーとして指定します。 |
| TransferFunction | MFVideoTransferFunction | 4 | +24 | +24 | R'G'B' のガンマカーブ関数。MFVideoTransferFunction 列挙型のメンバーとして指定します。 |
| ColorPrimaries | MFVideoPrimaries | 4 | +28 | +28 | ビデオソースの色原色 (カラープライマリ)。MFVideoPrimaries 列挙型のメンバーとして指定します。この値は、R'G'B' から線形 RGB への変換を示します。 |
| TransferMatrix | MFVideoTransferMatrix | 4 | +32 | +32 | Y'Cb'Cr' から R'G'B への変換行列。MFVideoTransferMatrix 列挙型のメンバーとして指定します。 |
| SourceLighting | MFVideoLighting | 4 | +36 | +36 | 想定される視聴環境。MFVideoLighting 列挙型のメンバーとして指定します。 |
| FramesPerSecond | MFRatio | 8 | +40 | +40 | 1 秒あたりのフレーム数。MFRatio 構造体として指定します。フレームレートが不明または可変の場合は、分子と分母の両方を 0 に設定してください。MFRatio 構造体の一方のメンバーのみが 0 である状態は無効です。 |
| NominalRange | MFNominalRange | 4 | +48 | +48 | 有効な RGB 値の範囲。MFNominalRange 列挙型のメンバーとして指定します。この値は、色の値にヘッドルームおよびトウルームが含まれるかどうかを示します。 |
| GeometricAperture | MFVideoArea | 16 | +52 | +52 | 幾何学的アパーチャー。MFVideoArea 構造体として指定します。詳細については、MF_MT_GEOMETRIC_APERTURE を参照してください。 |
| MinimumDisplayAperture | MFVideoArea | 16 | +68 | +68 | 表示アパーチャー。MFVideoArea 構造体として指定します。表示アパーチャーは、表示することを意図したビデオ画像の領域です。この領域外のデータはオーバースキャン領域となります。詳細については、MF_MT_MINIMUM_DISPLAY_APERTURE を参照してください。 |
| PanScanAperture | MFVideoArea | 16 | +84 | +84 | パンスキャン矩形。MFVideoArea 構造体として指定します。パンスキャン矩形は、パンアンドスキャンモードで表示される画像の領域を定義します。ワイドスクリーンのコンテンツを 4 x 3 のディスプレイに表示する場合などに使用できます。この値は、VideoFlags メンバーに MFVideoFlag_PanScanEnabled フラグが含まれている場合にのみ有効です。 |
| VideoFlags | ULONGLONG | 8 | +104 | +104 | MFVideoFlags 列挙型の 0 個以上のフラグのビット単位の OR。 |
公式ドキュメント
圧縮形式と非圧縮形式の両方に適用されるビデオ形式の情報を格納します。
この構造体は MFVIDEOFORMAT 構造体で使用されます。
解説(Remarks)
MFVideoInfo 構造体を使用するのではなく、メディアタイプの属性を使用することが推奨されます。次の表は、この構造体のメンバーに対応する属性の一覧です。
| 構造体のメンバー | メディアタイプ属性 |
|---|---|
| dwWidth、dwHeight | MF_MT_FRAME_SIZE |
| PixelAspectRatio | MF_MT_PIXEL_ASPECT_RATIO |
| SourceChromaSubsampling | MF_MT_VIDEO_CHROMA_SITING |
| InterlaceMode | MF_MT_INTERLACE_MODE |
| TransferFunction | MF_MT_TRANSFER_FUNCTION |
| ColorPrimaries | MF_MT_VIDEO_PRIMARIES |
| TransferMatrix | MF_MT_YUV_MATRIX |
| SourceLighting | MF_MT_VIDEO_LIGHTING |
| FramesPerSecond | MF_MT_FRAME_RATE |
| NominalRange | MF_MT_VIDEO_NOMINAL_RANGE |
| GeometricAperture | MF_MT_GEOMETRIC_APERTURE |
| MinimumDisplayAperture | MF_MT_MINIMUM_DISPLAY_APERTURE |
| PanScanAperture | MF_MT_PAN_SCAN_APERTURE |
| VideoFlags | MFVideoFlags を参照してください。 |
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#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 Structureimport 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: uint64struct 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