ホーム › Media.MediaFoundation › DXVA2_VideoSample
DXVA2_VideoSample
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Start | LONGLONG | 8 | +0 | +0 | サンプルの開始時刻を100ナノ秒単位で示す。 |
| End | LONGLONG | 8 | +8 | +8 | サンプルの終了時刻を100ナノ秒単位で示す。 |
| SampleFormat | DXVA2_ExtendedFormat | 8/4 | +16 | +16 | サンプルの色空間や輝度範囲を示すDXVA2_ExtendedFormat構造体。 |
| SrcSurface | IDirect3DSurface9* | 8/4 | +24 | +20 | 入力ビデオを保持するIDirect3DSurface9インターフェースへのポインタ。 |
| SrcRect | RECT | 16 | +32 | +24 | ソースサーフェス内の処理対象矩形領域。 |
| DstRect | RECT | 16 | +48 | +40 | 出力先における描画矩形領域。 |
| Pal | DXVA2_AYUVSample8 | 64 | +64 | +56 | パレット形式の場合に用いるDXVA2_AYUVSample8型のパレット。 |
| PlanarAlpha | DXVA2_Fixed32 | 8/4 | +128 | +120 | サンプル全体に適用する平面アルファ値を示すDXVA2_Fixed32。 |
| SampleData | DWORD | 4 | +136 | +124 | サンプルの追加属性を示すビットフラグ。 |
各言語での定義
#include <windows.h>
// DXVA2_ExtendedFormat (x64 8 / x86 4 バイト)
typedef struct DXVA2_ExtendedFormat {
_Anonymous_e__Union Anonymous;
} DXVA2_ExtendedFormat;
// RECT (x64 16 / x86 16 バイト)
typedef struct RECT {
INT left;
INT top;
INT right;
INT bottom;
} RECT;
// DXVA2_AYUVSample8 (x64 4 / x86 4 バイト)
typedef struct DXVA2_AYUVSample8 {
BYTE Cr;
BYTE Cb;
BYTE Y;
BYTE Alpha;
} DXVA2_AYUVSample8;
// DXVA2_Fixed32 (x64 8 / x86 4 バイト)
typedef struct DXVA2_Fixed32 {
_Anonymous_e__Union Anonymous;
} DXVA2_Fixed32;
// DXVA2_VideoSample (x64 144 / x86 128 バイト)
typedef struct DXVA2_VideoSample {
LONGLONG Start;
LONGLONG End;
DXVA2_ExtendedFormat SampleFormat;
IDirect3DSurface9* SrcSurface;
RECT SrcRect;
RECT DstRect;
DXVA2_AYUVSample8 Pal[16];
DXVA2_Fixed32 PlanarAlpha;
DWORD SampleData;
} DXVA2_VideoSample;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVA2_ExtendedFormat
{
public _Anonymous_e__Union Anonymous;
}
[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 DXVA2_AYUVSample8
{
public byte Cr;
public byte Cb;
public byte Y;
public byte Alpha;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVA2_Fixed32
{
public _Anonymous_e__Union Anonymous;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVA2_VideoSample
{
public long Start;
public long End;
public DXVA2_ExtendedFormat SampleFormat;
public IntPtr SrcSurface;
public RECT SrcRect;
public RECT DstRect;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public DXVA2_AYUVSample8[] Pal;
public DXVA2_Fixed32 PlanarAlpha;
public uint SampleData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVA2_ExtendedFormat
Public Anonymous As _Anonymous_e__Union
End Structure
<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 DXVA2_AYUVSample8
Public Cr As Byte
Public Cb As Byte
Public Y As Byte
Public Alpha As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVA2_Fixed32
Public Anonymous As _Anonymous_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVA2_VideoSample
Public Start As Long
Public End As Long
Public SampleFormat As DXVA2_ExtendedFormat
Public SrcSurface As IntPtr
Public SrcRect As RECT
Public DstRect As RECT
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Pal() As DXVA2_AYUVSample8
Public PlanarAlpha As DXVA2_Fixed32
Public SampleData As UInteger
End Structureimport ctypes
from ctypes import wintypes
class DXVA2_ExtendedFormat(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Union),
]
class RECT(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class DXVA2_AYUVSample8(ctypes.Structure):
_fields_ = [
("Cr", ctypes.c_ubyte),
("Cb", ctypes.c_ubyte),
("Y", ctypes.c_ubyte),
("Alpha", ctypes.c_ubyte),
]
class DXVA2_Fixed32(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Union),
]
class DXVA2_VideoSample(ctypes.Structure):
_fields_ = [
("Start", ctypes.c_longlong),
("End", ctypes.c_longlong),
("SampleFormat", DXVA2_ExtendedFormat),
("SrcSurface", ctypes.c_void_p),
("SrcRect", RECT),
("DstRect", RECT),
("Pal", DXVA2_AYUVSample8 * 16),
("PlanarAlpha", DXVA2_Fixed32),
("SampleData", wintypes.DWORD),
]#[repr(C)]
pub struct DXVA2_ExtendedFormat {
pub Anonymous: _Anonymous_e__Union,
}
#[repr(C)]
pub struct RECT {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct DXVA2_AYUVSample8 {
pub Cr: u8,
pub Cb: u8,
pub Y: u8,
pub Alpha: u8,
}
#[repr(C)]
pub struct DXVA2_Fixed32 {
pub Anonymous: _Anonymous_e__Union,
}
#[repr(C)]
pub struct DXVA2_VideoSample {
pub Start: i64,
pub End: i64,
pub SampleFormat: DXVA2_ExtendedFormat,
pub SrcSurface: *mut core::ffi::c_void,
pub SrcRect: RECT,
pub DstRect: RECT,
pub Pal: [DXVA2_AYUVSample8; 16],
pub PlanarAlpha: DXVA2_Fixed32,
pub SampleData: u32,
}import "golang.org/x/sys/windows"
type DXVA2_ExtendedFormat struct {
Anonymous _Anonymous_e__Union
}
type RECT struct {
left int32
top int32
right int32
bottom int32
}
type DXVA2_AYUVSample8 struct {
Cr byte
Cb byte
Y byte
Alpha byte
}
type DXVA2_Fixed32 struct {
Anonymous _Anonymous_e__Union
}
type DXVA2_VideoSample struct {
Start int64
End int64
SampleFormat DXVA2_ExtendedFormat
SrcSurface uintptr
SrcRect RECT
DstRect RECT
Pal [16]DXVA2_AYUVSample8
PlanarAlpha DXVA2_Fixed32
SampleData uint32
}type
DXVA2_ExtendedFormat = record
Anonymous: _Anonymous_e__Union;
end;
RECT = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
DXVA2_AYUVSample8 = record
Cr: Byte;
Cb: Byte;
Y: Byte;
Alpha: Byte;
end;
DXVA2_Fixed32 = record
Anonymous: _Anonymous_e__Union;
end;
DXVA2_VideoSample = record
Start: Int64;
End: Int64;
SampleFormat: DXVA2_ExtendedFormat;
SrcSurface: Pointer;
SrcRect: RECT;
DstRect: RECT;
Pal: array[0..15] of DXVA2_AYUVSample8;
PlanarAlpha: DXVA2_Fixed32;
SampleData: DWORD;
end;const DXVA2_ExtendedFormat = extern struct {
Anonymous: _Anonymous_e__Union,
};
const RECT = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const DXVA2_AYUVSample8 = extern struct {
Cr: u8,
Cb: u8,
Y: u8,
Alpha: u8,
};
const DXVA2_Fixed32 = extern struct {
Anonymous: _Anonymous_e__Union,
};
const DXVA2_VideoSample = extern struct {
Start: i64,
End: i64,
SampleFormat: DXVA2_ExtendedFormat,
SrcSurface: ?*anyopaque,
SrcRect: RECT,
DstRect: RECT,
Pal: [16]DXVA2_AYUVSample8,
PlanarAlpha: DXVA2_Fixed32,
SampleData: u32,
};type
DXVA2_ExtendedFormat {.bycopy.} = object
Anonymous: _Anonymous_e__Union
RECT {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
DXVA2_AYUVSample8 {.bycopy.} = object
Cr: uint8
Cb: uint8
Y: uint8
Alpha: uint8
DXVA2_Fixed32 {.bycopy.} = object
Anonymous: _Anonymous_e__Union
DXVA2_VideoSample {.bycopy.} = object
Start: int64
End: int64
SampleFormat: DXVA2_ExtendedFormat
SrcSurface: pointer
SrcRect: RECT
DstRect: RECT
Pal: array[16, DXVA2_AYUVSample8]
PlanarAlpha: DXVA2_Fixed32
SampleData: uint32struct DXVA2_ExtendedFormat
{
_Anonymous_e__Union Anonymous;
}
struct RECT
{
int left;
int top;
int right;
int bottom;
}
struct DXVA2_AYUVSample8
{
ubyte Cr;
ubyte Cb;
ubyte Y;
ubyte Alpha;
}
struct DXVA2_Fixed32
{
_Anonymous_e__Union Anonymous;
}
struct DXVA2_VideoSample
{
long Start;
long End;
DXVA2_ExtendedFormat SampleFormat;
void* SrcSurface;
RECT SrcRect;
RECT DstRect;
DXVA2_AYUVSample8[16] Pal;
DXVA2_Fixed32 PlanarAlpha;
uint SampleData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DXVA2_VideoSample サイズ: 128 バイト(x86)
dim st, 32 ; 4byte整数×32(構造体サイズ 128 / 4 切り上げ)
; Start : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; End : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; SampleFormat : DXVA2_ExtendedFormat (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; SrcSurface : IDirect3DSurface9* (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; SrcRect : RECT (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; DstRect : RECT (+40, 16byte) varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; Pal : DXVA2_AYUVSample8 (+56, 64byte) varptr(st)+56 を基点に操作(64byte:入れ子/配列)
; PlanarAlpha : DXVA2_Fixed32 (+120, 4byte) varptr(st)+120 を基点に操作(4byte:入れ子/配列)
; SampleData : DWORD (+124, 4byte) st.31 = 値 / 値 = st.31 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DXVA2_VideoSample サイズ: 144 バイト(x64)
dim st, 36 ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; Start : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; End : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; SampleFormat : DXVA2_ExtendedFormat (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; SrcSurface : IDirect3DSurface9* (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; SrcRect : RECT (+32, 16byte) varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; DstRect : RECT (+48, 16byte) varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; Pal : DXVA2_AYUVSample8 (+64, 64byte) varptr(st)+64 を基点に操作(64byte:入れ子/配列)
; PlanarAlpha : DXVA2_Fixed32 (+128, 8byte) varptr(st)+128 を基点に操作(8byte:入れ子/配列)
; SampleData : DWORD (+136, 4byte) st.34 = 値 / 値 = st.34 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DXVA2_ExtendedFormat
#field byte Anonymous 8
#endstruct
#defstruct global RECT
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global DXVA2_AYUVSample8
#field byte Cr
#field byte Cb
#field byte Y
#field byte Alpha
#endstruct
#defstruct global DXVA2_Fixed32
#field byte Anonymous 8
#endstruct
#defstruct global DXVA2_VideoSample
#field int64 Start
#field int64 End
#field DXVA2_ExtendedFormat SampleFormat
#field intptr SrcSurface
#field RECT SrcRect
#field RECT DstRect
#field DXVA2_AYUVSample8 Pal 16
#field DXVA2_Fixed32 PlanarAlpha
#field int SampleData
#endstruct
stdim st, DXVA2_VideoSample ; NSTRUCT 変数を確保
st->Start = 100
mes "Start=" + st->Start