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

WM_STREAM_PRIORITY_RECORD

構造体
サイズx64: 6 バイト / x86: 6 バイトパッキング2

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

フィールド

フィールドサイズx64x86説明
wStreamNumberWORD2+0+0優先度を設定する対象ストリームの番号。
fMandatoryBOOL4+2+2帯域不足でも維持必須のストリームならTRUE。

各言語での定義

#include <windows.h>

// WM_STREAM_PRIORITY_RECORD  (x64 6 / x86 6 バイト)
#pragma pack(push, 2)
typedef struct WM_STREAM_PRIORITY_RECORD {
    WORD wStreamNumber;
    BOOL fMandatory;
} WM_STREAM_PRIORITY_RECORD;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 2, CharSet = CharSet.Unicode)]
public struct WM_STREAM_PRIORITY_RECORD
{
    public ushort wStreamNumber;
    [MarshalAs(UnmanagedType.Bool)] public bool fMandatory;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=2, CharSet:=CharSet.Unicode)>
Public Structure WM_STREAM_PRIORITY_RECORD
    Public wStreamNumber As UShort
    <MarshalAs(UnmanagedType.Bool)> Public fMandatory As Boolean
End Structure
import ctypes
from ctypes import wintypes

class WM_STREAM_PRIORITY_RECORD(ctypes.Structure):
    _pack_ = 2
    _fields_ = [
        ("wStreamNumber", ctypes.c_ushort),
        ("fMandatory", wintypes.BOOL),
    ]
#[repr(C, packed(2))]
pub struct WM_STREAM_PRIORITY_RECORD {
    pub wStreamNumber: u16,
    pub fMandatory: i32,
}
import "golang.org/x/sys/windows"

type WM_STREAM_PRIORITY_RECORD struct {
	wStreamNumber uint16
	fMandatory int32
}
type
  WM_STREAM_PRIORITY_RECORD = packed record
    wStreamNumber: Word;
    fMandatory: BOOL;
  end;
const WM_STREAM_PRIORITY_RECORD = extern struct {
    wStreamNumber: u16,
    fMandatory: i32,
};
type
  WM_STREAM_PRIORITY_RECORD {.packed.} = object
    wStreamNumber: uint16
    fMandatory: int32
align(2)
struct WM_STREAM_PRIORITY_RECORD
{
    ushort wStreamNumber;
    int fMandatory;
}

HSP用 定義

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

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

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