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

DSHOW_STREAM_DESC

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

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

フィールド

フィールドサイズx64x86説明
VersionNoDWORD4+0+0本構造体のバージョン番号。互換性判定に用いる。
StreamIdDWORD4+4+4ストリームの識別子。複数ストリームを区別する。
DefaultBOOL4+8+8既定ストリームか否かを示すBOOL。TRUEで既定選択を表す。
CreationBOOL4+12+12ストリーム生成の可否を示すBOOL。TRUEで作成対象を表す。
ReservedDWORD4+16+16予約領域。将来拡張用で通常は0を設定する。

各言語での定義

#include <windows.h>

// DSHOW_STREAM_DESC  (x64 20 / x86 20 バイト)
typedef struct DSHOW_STREAM_DESC {
    DWORD VersionNo;
    DWORD StreamId;
    BOOL Default;
    BOOL Creation;
    DWORD Reserved;
} DSHOW_STREAM_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DSHOW_STREAM_DESC
{
    public uint VersionNo;
    public uint StreamId;
    [MarshalAs(UnmanagedType.Bool)] public bool Default;
    [MarshalAs(UnmanagedType.Bool)] public bool Creation;
    public uint Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DSHOW_STREAM_DESC
    Public VersionNo As UInteger
    Public StreamId As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public Default As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public Creation As Boolean
    Public Reserved As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DSHOW_STREAM_DESC(ctypes.Structure):
    _fields_ = [
        ("VersionNo", wintypes.DWORD),
        ("StreamId", wintypes.DWORD),
        ("Default", wintypes.BOOL),
        ("Creation", wintypes.BOOL),
        ("Reserved", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DSHOW_STREAM_DESC {
    pub VersionNo: u32,
    pub StreamId: u32,
    pub Default: i32,
    pub Creation: i32,
    pub Reserved: u32,
}
import "golang.org/x/sys/windows"

type DSHOW_STREAM_DESC struct {
	VersionNo uint32
	StreamId uint32
	Default int32
	Creation int32
	Reserved uint32
}
type
  DSHOW_STREAM_DESC = record
    VersionNo: DWORD;
    StreamId: DWORD;
    Default: BOOL;
    Creation: BOOL;
    Reserved: DWORD;
  end;
const DSHOW_STREAM_DESC = extern struct {
    VersionNo: u32,
    StreamId: u32,
    Default: i32,
    Creation: i32,
    Reserved: u32,
};
type
  DSHOW_STREAM_DESC {.bycopy.} = object
    VersionNo: uint32
    StreamId: uint32
    Default: int32
    Creation: int32
    Reserved: uint32
struct DSHOW_STREAM_DESC
{
    uint VersionNo;
    uint StreamId;
    int Default;
    int Creation;
    uint Reserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DSHOW_STREAM_DESC サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; VersionNo : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; StreamId : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Default : BOOL (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Creation : BOOL (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Reserved : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DSHOW_STREAM_DESC
    #field int VersionNo
    #field int StreamId
    #field bool Default
    #field bool Creation
    #field int Reserved
#endstruct

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