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

DXVA_VideoSample32

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

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

フィールド

フィールドサイズx64x86説明
rtStartLONGLONG8+0+0サンプルの開始時刻(100ナノ秒単位)。
rtEndLONGLONG8+8+8サンプルの終了時刻(100ナノ秒単位)。
SampleFormatDWORD4+16+16サンプルのフォーマットを示す値。インターレース構成等を表す。
SampleFlagsDWORD4+20+20サンプルの状態を示すフラグ群。
lpDDSSrcSurfaceDWORD4+24+24ソースサーフェスを示す32bitハンドル値。
rcSrcRECT16+28+28ソース内の処理対象矩形を示すRECT。
rcDstRECT16+44+44出力先での配置矩形を示すRECT。
PaletteDXVA_AYUVsample264+60+60サンプルに関連付けるパレット情報を示すDXVA_AYUVsample2。

各言語での定義

#include <windows.h>

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

// DXVA_AYUVsample2  (x64 4 / x86 4 バイト)
typedef struct DXVA_AYUVsample2 {
    BYTE bCrValue;
    BYTE bCbValue;
    BYTE bY_Value;
    BYTE bSampleAlpha8;
} DXVA_AYUVsample2;

// DXVA_VideoSample32  (x64 128 / x86 128 バイト)
typedef struct DXVA_VideoSample32 {
    LONGLONG rtStart;
    LONGLONG rtEnd;
    DWORD SampleFormat;
    DWORD SampleFlags;
    DWORD lpDDSSrcSurface;
    RECT rcSrc;
    RECT rcDst;
    DXVA_AYUVsample2 Palette[16];
} DXVA_VideoSample32;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVA_AYUVsample2
{
    public byte bCrValue;
    public byte bCbValue;
    public byte bY_Value;
    public byte bSampleAlpha8;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVA_VideoSample32
{
    public long rtStart;
    public long rtEnd;
    public uint SampleFormat;
    public uint SampleFlags;
    public uint lpDDSSrcSurface;
    public RECT rcSrc;
    public RECT rcDst;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public DXVA_AYUVsample2[] Palette;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVA_AYUVsample2
    Public bCrValue As Byte
    Public bCbValue As Byte
    Public bY_Value As Byte
    Public bSampleAlpha8 As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVA_VideoSample32
    Public rtStart As Long
    Public rtEnd As Long
    Public SampleFormat As UInteger
    Public SampleFlags As UInteger
    Public lpDDSSrcSurface As UInteger
    Public rcSrc As RECT
    Public rcDst As RECT
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Palette() As DXVA_AYUVsample2
End Structure
import ctypes
from ctypes import wintypes

class RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class DXVA_AYUVsample2(ctypes.Structure):
    _fields_ = [
        ("bCrValue", ctypes.c_ubyte),
        ("bCbValue", ctypes.c_ubyte),
        ("bY_Value", ctypes.c_ubyte),
        ("bSampleAlpha8", ctypes.c_ubyte),
    ]

class DXVA_VideoSample32(ctypes.Structure):
    _fields_ = [
        ("rtStart", ctypes.c_longlong),
        ("rtEnd", ctypes.c_longlong),
        ("SampleFormat", wintypes.DWORD),
        ("SampleFlags", wintypes.DWORD),
        ("lpDDSSrcSurface", wintypes.DWORD),
        ("rcSrc", RECT),
        ("rcDst", RECT),
        ("Palette", DXVA_AYUVsample2 * 16),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct DXVA_AYUVsample2 {
    pub bCrValue: u8,
    pub bCbValue: u8,
    pub bY_Value: u8,
    pub bSampleAlpha8: u8,
}

#[repr(C)]
pub struct DXVA_VideoSample32 {
    pub rtStart: i64,
    pub rtEnd: i64,
    pub SampleFormat: u32,
    pub SampleFlags: u32,
    pub lpDDSSrcSurface: u32,
    pub rcSrc: RECT,
    pub rcDst: RECT,
    pub Palette: [DXVA_AYUVsample2; 16],
}
import "golang.org/x/sys/windows"

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type DXVA_AYUVsample2 struct {
	bCrValue byte
	bCbValue byte
	bY_Value byte
	bSampleAlpha8 byte
}

type DXVA_VideoSample32 struct {
	rtStart int64
	rtEnd int64
	SampleFormat uint32
	SampleFlags uint32
	lpDDSSrcSurface uint32
	rcSrc RECT
	rcDst RECT
	Palette [16]DXVA_AYUVsample2
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  DXVA_AYUVsample2 = record
    bCrValue: Byte;
    bCbValue: Byte;
    bY_Value: Byte;
    bSampleAlpha8: Byte;
  end;

  DXVA_VideoSample32 = record
    rtStart: Int64;
    rtEnd: Int64;
    SampleFormat: DWORD;
    SampleFlags: DWORD;
    lpDDSSrcSurface: DWORD;
    rcSrc: RECT;
    rcDst: RECT;
    Palette: array[0..15] of DXVA_AYUVsample2;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const DXVA_AYUVsample2 = extern struct {
    bCrValue: u8,
    bCbValue: u8,
    bY_Value: u8,
    bSampleAlpha8: u8,
};

const DXVA_VideoSample32 = extern struct {
    rtStart: i64,
    rtEnd: i64,
    SampleFormat: u32,
    SampleFlags: u32,
    lpDDSSrcSurface: u32,
    rcSrc: RECT,
    rcDst: RECT,
    Palette: [16]DXVA_AYUVsample2,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  DXVA_AYUVsample2 {.bycopy.} = object
    bCrValue: uint8
    bCbValue: uint8
    bY_Value: uint8
    bSampleAlpha8: uint8

  DXVA_VideoSample32 {.bycopy.} = object
    rtStart: int64
    rtEnd: int64
    SampleFormat: uint32
    SampleFlags: uint32
    lpDDSSrcSurface: uint32
    rcSrc: RECT
    rcDst: RECT
    Palette: array[16, DXVA_AYUVsample2]
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct DXVA_AYUVsample2
{
    ubyte bCrValue;
    ubyte bCbValue;
    ubyte bY_Value;
    ubyte bSampleAlpha8;
}

struct DXVA_VideoSample32
{
    long rtStart;
    long rtEnd;
    uint SampleFormat;
    uint SampleFlags;
    uint lpDDSSrcSurface;
    RECT rcSrc;
    RECT rcDst;
    DXVA_AYUVsample2[16] Palette;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DXVA_VideoSample32 サイズ: 128 バイト(x64)
dim st, 32    ; 4byte整数×32(構造体サイズ 128 / 4 切り上げ)
; rtStart : LONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; rtEnd : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; SampleFormat : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; SampleFlags : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; lpDDSSrcSurface : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; rcSrc : RECT (+28, 16byte)  varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; rcDst : RECT (+44, 16byte)  varptr(st)+44 を基点に操作(16byte:入れ子/配列)
; Palette : DXVA_AYUVsample2 (+60, 64byte)  varptr(st)+60 を基点に操作(64byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global DXVA_AYUVsample2
    #field byte bCrValue
    #field byte bCbValue
    #field byte bY_Value
    #field byte bSampleAlpha8
#endstruct

#defstruct global DXVA_VideoSample32
    #field int64 rtStart
    #field int64 rtEnd
    #field int SampleFormat
    #field int SampleFlags
    #field int lpDDSSrcSurface
    #field RECT rcSrc
    #field RECT rcDst
    #field DXVA_AYUVsample2 Palette 16
#endstruct

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