Win32 API 日本語リファレンス
ホームMedia.DirectShow.Tv › VA_OPTIONAL_VIDEO_PROPERTIES

VA_OPTIONAL_VIDEO_PROPERTIES

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

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

フィールド

フィールドサイズx64x86説明
dwPictureHeightWORD2+0+0ピクチャの高さをピクセル単位で示す。WORD型だがフィールド名はdwを冠する。
dwPictureWidthWORD2+2+2ピクチャの幅をピクセル単位で示す。WORD型でフレーム解像度の横方向を表す。
dwAspectRatioXWORD2+4+4アスペクト比の水平成分。dwAspectRatioYとの比で画面比を表現する。
dwAspectRatioYWORD2+6+6アスペクト比の垂直成分。dwAspectRatioXとの比で表示比率を定める。
VAVideoFormatVA_VIDEO_FORMAT4+8+8ビデオ信号のフォーマットを示す列挙値。NTSC/PAL等の方式を指す。
VAColorPrimariesVA_COLOR_PRIMARIES4+12+12色域の基準原色を示す列挙値。色空間の三原色座標を識別する。
VATransferCharacteristicsVA_TRANSFER_CHARACTERISTICS4+16+16光電気伝達特性(ガンマ)を示す列挙値。輝度変換曲線を識別する。
VAMatrixCoefficientsVA_MATRIX_COEFFICIENTS4+20+20色変換行列係数を示す列挙値。YUVとRGB間の変換係数を識別する。

各言語での定義

#include <windows.h>

// VA_OPTIONAL_VIDEO_PROPERTIES  (x64 24 / x86 24 バイト)
typedef struct VA_OPTIONAL_VIDEO_PROPERTIES {
    WORD dwPictureHeight;
    WORD dwPictureWidth;
    WORD dwAspectRatioX;
    WORD dwAspectRatioY;
    VA_VIDEO_FORMAT VAVideoFormat;
    VA_COLOR_PRIMARIES VAColorPrimaries;
    VA_TRANSFER_CHARACTERISTICS VATransferCharacteristics;
    VA_MATRIX_COEFFICIENTS VAMatrixCoefficients;
} VA_OPTIONAL_VIDEO_PROPERTIES;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VA_OPTIONAL_VIDEO_PROPERTIES
{
    public ushort dwPictureHeight;
    public ushort dwPictureWidth;
    public ushort dwAspectRatioX;
    public ushort dwAspectRatioY;
    public int VAVideoFormat;
    public int VAColorPrimaries;
    public int VATransferCharacteristics;
    public int VAMatrixCoefficients;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VA_OPTIONAL_VIDEO_PROPERTIES
    Public dwPictureHeight As UShort
    Public dwPictureWidth As UShort
    Public dwAspectRatioX As UShort
    Public dwAspectRatioY As UShort
    Public VAVideoFormat As Integer
    Public VAColorPrimaries As Integer
    Public VATransferCharacteristics As Integer
    Public VAMatrixCoefficients As Integer
End Structure
import ctypes
from ctypes import wintypes

class VA_OPTIONAL_VIDEO_PROPERTIES(ctypes.Structure):
    _fields_ = [
        ("dwPictureHeight", ctypes.c_ushort),
        ("dwPictureWidth", ctypes.c_ushort),
        ("dwAspectRatioX", ctypes.c_ushort),
        ("dwAspectRatioY", ctypes.c_ushort),
        ("VAVideoFormat", ctypes.c_int),
        ("VAColorPrimaries", ctypes.c_int),
        ("VATransferCharacteristics", ctypes.c_int),
        ("VAMatrixCoefficients", ctypes.c_int),
    ]
#[repr(C)]
pub struct VA_OPTIONAL_VIDEO_PROPERTIES {
    pub dwPictureHeight: u16,
    pub dwPictureWidth: u16,
    pub dwAspectRatioX: u16,
    pub dwAspectRatioY: u16,
    pub VAVideoFormat: i32,
    pub VAColorPrimaries: i32,
    pub VATransferCharacteristics: i32,
    pub VAMatrixCoefficients: i32,
}
import "golang.org/x/sys/windows"

type VA_OPTIONAL_VIDEO_PROPERTIES struct {
	dwPictureHeight uint16
	dwPictureWidth uint16
	dwAspectRatioX uint16
	dwAspectRatioY uint16
	VAVideoFormat int32
	VAColorPrimaries int32
	VATransferCharacteristics int32
	VAMatrixCoefficients int32
}
type
  VA_OPTIONAL_VIDEO_PROPERTIES = record
    dwPictureHeight: Word;
    dwPictureWidth: Word;
    dwAspectRatioX: Word;
    dwAspectRatioY: Word;
    VAVideoFormat: Integer;
    VAColorPrimaries: Integer;
    VATransferCharacteristics: Integer;
    VAMatrixCoefficients: Integer;
  end;
const VA_OPTIONAL_VIDEO_PROPERTIES = extern struct {
    dwPictureHeight: u16,
    dwPictureWidth: u16,
    dwAspectRatioX: u16,
    dwAspectRatioY: u16,
    VAVideoFormat: i32,
    VAColorPrimaries: i32,
    VATransferCharacteristics: i32,
    VAMatrixCoefficients: i32,
};
type
  VA_OPTIONAL_VIDEO_PROPERTIES {.bycopy.} = object
    dwPictureHeight: uint16
    dwPictureWidth: uint16
    dwAspectRatioX: uint16
    dwAspectRatioY: uint16
    VAVideoFormat: int32
    VAColorPrimaries: int32
    VATransferCharacteristics: int32
    VAMatrixCoefficients: int32
struct VA_OPTIONAL_VIDEO_PROPERTIES
{
    ushort dwPictureHeight;
    ushort dwPictureWidth;
    ushort dwAspectRatioX;
    ushort dwAspectRatioY;
    int VAVideoFormat;
    int VAColorPrimaries;
    int VATransferCharacteristics;
    int VAMatrixCoefficients;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VA_OPTIONAL_VIDEO_PROPERTIES サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; dwPictureHeight : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; dwPictureWidth : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; dwAspectRatioX : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; dwAspectRatioY : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; VAVideoFormat : VA_VIDEO_FORMAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; VAColorPrimaries : VA_COLOR_PRIMARIES (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; VATransferCharacteristics : VA_TRANSFER_CHARACTERISTICS (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; VAMatrixCoefficients : VA_MATRIX_COEFFICIENTS (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VA_OPTIONAL_VIDEO_PROPERTIES
    #field short dwPictureHeight
    #field short dwPictureWidth
    #field short dwAspectRatioX
    #field short dwAspectRatioY
    #field int VAVideoFormat
    #field int VAColorPrimaries
    #field int VATransferCharacteristics
    #field int VAMatrixCoefficients
#endstruct

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