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

KS_FRAME_INFO

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

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

フィールド

フィールドサイズx64x86説明
ExtendedHeaderSizeDWORD4+0+0拡張ヘッダ全体のサイズをバイト単位で示す。
dwFrameFlagsDWORD4+4+4フレームの状態を示すフラグの組み合わせ(KS_VIDEO_FLAG_*など)。
PictureNumberLONGLONG8+8+8連続するピクチャ番号を示す64ビット値。
DropCountLONGLONG8+16+16ドロップされたフレームの累積数を示す。
hDirectDrawHANDLE8/4+24+24関連するDirectDrawオブジェクトのハンドル。NULL可。
hSurfaceHandleHANDLE8/4+32+28対象サーフェスのハンドル。NULL可。
DirectDrawRectRECT16+40+32DirectDrawサーフェス上の有効矩形領域を表すRECT。
Anonymous1_Anonymous1_e__Union4+56+48予約された無名共用体。内部用途で用いる。
Reserved2DWORD4+60+52予約フィールド。将来の拡張用で通常は0を設定する。
Anonymous2_Anonymous2_e__Union8+64+56予約された無名共用体。内部用途で用いる。

共用体: _Anonymous1_e__Union x64 4B / x86 4B

フィールドサイズx64x86
lSurfacePitchINT4+0+0
Reserved1DWORD4+0+0

共用体: _Anonymous2_e__Union x64 8B / x86 8B

フィールドサイズx64x86
Anonymous_Anonymous_e__Struct8/4+0+0
FrameCompletionNumberULONGLONG8+0+0

各言語での定義

#include <windows.h>

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

// KS_FRAME_INFO  (x64 72 / x86 64 バイト)
typedef struct KS_FRAME_INFO {
    DWORD ExtendedHeaderSize;
    DWORD dwFrameFlags;
    LONGLONG PictureNumber;
    LONGLONG DropCount;
    HANDLE hDirectDraw;
    HANDLE hSurfaceHandle;
    RECT DirectDrawRect;
    _Anonymous1_e__Union Anonymous1;
    DWORD Reserved2;
    _Anonymous2_e__Union Anonymous2;
} KS_FRAME_INFO;
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 KS_FRAME_INFO
{
    public uint ExtendedHeaderSize;
    public uint dwFrameFlags;
    public long PictureNumber;
    public long DropCount;
    public IntPtr hDirectDraw;
    public IntPtr hSurfaceHandle;
    public RECT DirectDrawRect;
    public _Anonymous1_e__Union Anonymous1;
    public uint Reserved2;
    public _Anonymous2_e__Union Anonymous2;
}
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 KS_FRAME_INFO
    Public ExtendedHeaderSize As UInteger
    Public dwFrameFlags As UInteger
    Public PictureNumber As Long
    Public DropCount As Long
    Public hDirectDraw As IntPtr
    Public hSurfaceHandle As IntPtr
    Public DirectDrawRect As RECT
    Public Anonymous1 As _Anonymous1_e__Union
    Public Reserved2 As UInteger
    Public Anonymous2 As _Anonymous2_e__Union
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 KS_FRAME_INFO(ctypes.Structure):
    _fields_ = [
        ("ExtendedHeaderSize", wintypes.DWORD),
        ("dwFrameFlags", wintypes.DWORD),
        ("PictureNumber", ctypes.c_longlong),
        ("DropCount", ctypes.c_longlong),
        ("hDirectDraw", ctypes.c_void_p),
        ("hSurfaceHandle", ctypes.c_void_p),
        ("DirectDrawRect", RECT),
        ("Anonymous1", _Anonymous1_e__Union),
        ("Reserved2", wintypes.DWORD),
        ("Anonymous2", _Anonymous2_e__Union),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct KS_FRAME_INFO {
    pub ExtendedHeaderSize: u32,
    pub dwFrameFlags: u32,
    pub PictureNumber: i64,
    pub DropCount: i64,
    pub hDirectDraw: *mut core::ffi::c_void,
    pub hSurfaceHandle: *mut core::ffi::c_void,
    pub DirectDrawRect: RECT,
    pub Anonymous1: _Anonymous1_e__Union,
    pub Reserved2: u32,
    pub Anonymous2: _Anonymous2_e__Union,
}
import "golang.org/x/sys/windows"

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

type KS_FRAME_INFO struct {
	ExtendedHeaderSize uint32
	dwFrameFlags uint32
	PictureNumber int64
	DropCount int64
	hDirectDraw uintptr
	hSurfaceHandle uintptr
	DirectDrawRect RECT
	Anonymous1 _Anonymous1_e__Union
	Reserved2 uint32
	Anonymous2 _Anonymous2_e__Union
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  KS_FRAME_INFO = record
    ExtendedHeaderSize: DWORD;
    dwFrameFlags: DWORD;
    PictureNumber: Int64;
    DropCount: Int64;
    hDirectDraw: Pointer;
    hSurfaceHandle: Pointer;
    DirectDrawRect: RECT;
    Anonymous1: _Anonymous1_e__Union;
    Reserved2: DWORD;
    Anonymous2: _Anonymous2_e__Union;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const KS_FRAME_INFO = extern struct {
    ExtendedHeaderSize: u32,
    dwFrameFlags: u32,
    PictureNumber: i64,
    DropCount: i64,
    hDirectDraw: ?*anyopaque,
    hSurfaceHandle: ?*anyopaque,
    DirectDrawRect: RECT,
    Anonymous1: _Anonymous1_e__Union,
    Reserved2: u32,
    Anonymous2: _Anonymous2_e__Union,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  KS_FRAME_INFO {.bycopy.} = object
    ExtendedHeaderSize: uint32
    dwFrameFlags: uint32
    PictureNumber: int64
    DropCount: int64
    hDirectDraw: pointer
    hSurfaceHandle: pointer
    DirectDrawRect: RECT
    Anonymous1: _Anonymous1_e__Union
    Reserved2: uint32
    Anonymous2: _Anonymous2_e__Union
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct KS_FRAME_INFO
{
    uint ExtendedHeaderSize;
    uint dwFrameFlags;
    long PictureNumber;
    long DropCount;
    void* hDirectDraw;
    void* hSurfaceHandle;
    RECT DirectDrawRect;
    _Anonymous1_e__Union Anonymous1;
    uint Reserved2;
    _Anonymous2_e__Union Anonymous2;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; KS_FRAME_INFO サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; ExtendedHeaderSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFrameFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; PictureNumber : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; DropCount : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hDirectDraw : HANDLE (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; hSurfaceHandle : HANDLE (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; DirectDrawRect : RECT (+32, 16byte)  varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; Anonymous1 : _Anonymous1_e__Union (+48, 4byte)  varptr(st)+48 を基点に操作(4byte:入れ子/配列)
; Reserved2 : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; Anonymous2 : _Anonymous2_e__Union (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KS_FRAME_INFO サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; ExtendedHeaderSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFrameFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; PictureNumber : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; DropCount : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hDirectDraw : HANDLE (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; hSurfaceHandle : HANDLE (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; DirectDrawRect : RECT (+40, 16byte)  varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; Anonymous1 : _Anonymous1_e__Union (+56, 4byte)  varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; Reserved2 : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; Anonymous2 : _Anonymous2_e__Union (+64, 8byte)  varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; ※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 KS_FRAME_INFO
    #field int ExtendedHeaderSize
    #field int dwFrameFlags
    #field int64 PictureNumber
    #field int64 DropCount
    #field intptr hDirectDraw
    #field intptr hSurfaceHandle
    #field RECT DirectDrawRect
    #field byte Anonymous1 4
    #field int Reserved2
    #field byte Anonymous2 8
#endstruct

stdim st, KS_FRAME_INFO        ; NSTRUCT 変数を確保
st->ExtendedHeaderSize = 100
mes "ExtendedHeaderSize=" + st->ExtendedHeaderSize
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。