ホーム › Media.DirectShow › 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)。 |
| SampleFlags | DWORD | 4 | +24 | +20 | サンプルのフラグ。パレット更新等を示すビット集合。 |
| SrcResource | void* | 8/4 | +32 | +24 | ソース映像リソース(サーフェス)へのポインタ。 |
| SrcRect | RECT | 16 | +40 | +28 | ソースから切り出す矩形領域(RECT)。 |
| DstRect | RECT | 16 | +56 | +44 | 出力先の描画矩形領域(RECT)。 |
| Pal | DXVA2_AYUVSample8 | 64 | +72 | +60 | サブストリーム用のAYUVパレット配列(DXVA2_AYUVSample8、16色)。 |
| PlanarAlpha | DXVA2_Fixed32 | 8/4 | +136 | +124 | サンプル全体の平面アルファ値(DXVA2_Fixed32固定小数)。 |
各言語での定義
#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;
DWORD SampleFlags;
void* SrcResource;
RECT SrcRect;
RECT DstRect;
DXVA2_AYUVSample8 Pal[16];
DXVA2_Fixed32 PlanarAlpha;
} 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 uint SampleFlags;
public IntPtr SrcResource;
public RECT SrcRect;
public RECT DstRect;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public DXVA2_AYUVSample8[] Pal;
public DXVA2_Fixed32 PlanarAlpha;
}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 SampleFlags As UInteger
Public SrcResource 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
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),
("SampleFlags", wintypes.DWORD),
("SrcResource", ctypes.c_void_p),
("SrcRect", RECT),
("DstRect", RECT),
("Pal", DXVA2_AYUVSample8 * 16),
("PlanarAlpha", DXVA2_Fixed32),
]#[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 SampleFlags: u32,
pub SrcResource: *mut core::ffi::c_void,
pub SrcRect: RECT,
pub DstRect: RECT,
pub Pal: [DXVA2_AYUVSample8; 16],
pub PlanarAlpha: DXVA2_Fixed32,
}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
SampleFlags uint32
SrcResource uintptr
SrcRect RECT
DstRect RECT
Pal [16]DXVA2_AYUVSample8
PlanarAlpha DXVA2_Fixed32
}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;
SampleFlags: DWORD;
SrcResource: Pointer;
SrcRect: RECT;
DstRect: RECT;
Pal: array[0..15] of DXVA2_AYUVSample8;
PlanarAlpha: DXVA2_Fixed32;
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,
SampleFlags: u32,
SrcResource: ?*anyopaque,
SrcRect: RECT,
DstRect: RECT,
Pal: [16]DXVA2_AYUVSample8,
PlanarAlpha: DXVA2_Fixed32,
};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
SampleFlags: uint32
SrcResource: pointer
SrcRect: RECT
DstRect: RECT
Pal: array[16, DXVA2_AYUVSample8]
PlanarAlpha: DXVA2_Fixed32struct 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;
uint SampleFlags;
void* SrcResource;
RECT SrcRect;
RECT DstRect;
DXVA2_AYUVSample8[16] Pal;
DXVA2_Fixed32 PlanarAlpha;
}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:入れ子/配列)
; SampleFlags : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; SrcResource : void* (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; SrcRect : RECT (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; DstRect : RECT (+44, 16byte) varptr(st)+44 を基点に操作(16byte:入れ子/配列)
; Pal : DXVA2_AYUVSample8 (+60, 64byte) varptr(st)+60 を基点に操作(64byte:入れ子/配列)
; PlanarAlpha : DXVA2_Fixed32 (+124, 4byte) varptr(st)+124 を基点に操作(4byte:入れ子/配列)
; ※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:入れ子/配列)
; SampleFlags : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; SrcResource : void* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; SrcRect : RECT (+40, 16byte) varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; DstRect : RECT (+56, 16byte) varptr(st)+56 を基点に操作(16byte:入れ子/配列)
; Pal : DXVA2_AYUVSample8 (+72, 64byte) varptr(st)+72 を基点に操作(64byte:入れ子/配列)
; PlanarAlpha : DXVA2_Fixed32 (+136, 8byte) varptr(st)+136 を基点に操作(8byte:入れ子/配列)
; ※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 int SampleFlags
#field intptr SrcResource
#field RECT SrcRect
#field RECT DstRect
#field DXVA2_AYUVSample8 Pal 16
#field DXVA2_Fixed32 PlanarAlpha
#endstruct
stdim st, DXVA2_VIDEOSAMPLE ; NSTRUCT 変数を確保
st->Start = 100
mes "Start=" + st->Start