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

WMT_PAYLOAD_FRAGMENT

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

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

フィールド

フィールドサイズx64x86説明
dwPayloadIndexDWORD4+0+0ペイロードのインデックス番号。
segmentDataWMT_BUFFER_SEGMENT16/12+8+4このペイロード断片のバッファセグメント(WMT_BUFFER_SEGMENT)。

各言語での定義

#include <windows.h>

// WMT_BUFFER_SEGMENT  (x64 16 / x86 12 バイト)
typedef struct WMT_BUFFER_SEGMENT {
    INSSBuffer* pBuffer;
    DWORD cbOffset;
    DWORD cbLength;
} WMT_BUFFER_SEGMENT;

// WMT_PAYLOAD_FRAGMENT  (x64 24 / x86 16 バイト)
typedef struct WMT_PAYLOAD_FRAGMENT {
    DWORD dwPayloadIndex;
    WMT_BUFFER_SEGMENT segmentData;
} WMT_PAYLOAD_FRAGMENT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WMT_BUFFER_SEGMENT
{
    public IntPtr pBuffer;
    public uint cbOffset;
    public uint cbLength;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WMT_PAYLOAD_FRAGMENT
{
    public uint dwPayloadIndex;
    public WMT_BUFFER_SEGMENT segmentData;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WMT_BUFFER_SEGMENT
    Public pBuffer As IntPtr
    Public cbOffset As UInteger
    Public cbLength As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WMT_PAYLOAD_FRAGMENT
    Public dwPayloadIndex As UInteger
    Public segmentData As WMT_BUFFER_SEGMENT
End Structure
import ctypes
from ctypes import wintypes

class WMT_BUFFER_SEGMENT(ctypes.Structure):
    _fields_ = [
        ("pBuffer", ctypes.c_void_p),
        ("cbOffset", wintypes.DWORD),
        ("cbLength", wintypes.DWORD),
    ]

class WMT_PAYLOAD_FRAGMENT(ctypes.Structure):
    _fields_ = [
        ("dwPayloadIndex", wintypes.DWORD),
        ("segmentData", WMT_BUFFER_SEGMENT),
    ]
#[repr(C)]
pub struct WMT_BUFFER_SEGMENT {
    pub pBuffer: *mut core::ffi::c_void,
    pub cbOffset: u32,
    pub cbLength: u32,
}

#[repr(C)]
pub struct WMT_PAYLOAD_FRAGMENT {
    pub dwPayloadIndex: u32,
    pub segmentData: WMT_BUFFER_SEGMENT,
}
import "golang.org/x/sys/windows"

type WMT_BUFFER_SEGMENT struct {
	pBuffer uintptr
	cbOffset uint32
	cbLength uint32
}

type WMT_PAYLOAD_FRAGMENT struct {
	dwPayloadIndex uint32
	segmentData WMT_BUFFER_SEGMENT
}
type
  WMT_BUFFER_SEGMENT = record
    pBuffer: Pointer;
    cbOffset: DWORD;
    cbLength: DWORD;
  end;

  WMT_PAYLOAD_FRAGMENT = record
    dwPayloadIndex: DWORD;
    segmentData: WMT_BUFFER_SEGMENT;
  end;
const WMT_BUFFER_SEGMENT = extern struct {
    pBuffer: ?*anyopaque,
    cbOffset: u32,
    cbLength: u32,
};

const WMT_PAYLOAD_FRAGMENT = extern struct {
    dwPayloadIndex: u32,
    segmentData: WMT_BUFFER_SEGMENT,
};
type
  WMT_BUFFER_SEGMENT {.bycopy.} = object
    pBuffer: pointer
    cbOffset: uint32
    cbLength: uint32

  WMT_PAYLOAD_FRAGMENT {.bycopy.} = object
    dwPayloadIndex: uint32
    segmentData: WMT_BUFFER_SEGMENT
struct WMT_BUFFER_SEGMENT
{
    void* pBuffer;
    uint cbOffset;
    uint cbLength;
}

struct WMT_PAYLOAD_FRAGMENT
{
    uint dwPayloadIndex;
    WMT_BUFFER_SEGMENT segmentData;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WMT_PAYLOAD_FRAGMENT サイズ: 16 バイト(x86)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; dwPayloadIndex : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; segmentData : WMT_BUFFER_SEGMENT (+4, 12byte)  varptr(st)+4 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WMT_PAYLOAD_FRAGMENT サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; dwPayloadIndex : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; segmentData : WMT_BUFFER_SEGMENT (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WMT_BUFFER_SEGMENT
    #field intptr pBuffer
    #field int cbOffset
    #field int cbLength
#endstruct

#defstruct global WMT_PAYLOAD_FRAGMENT
    #field int dwPayloadIndex
    #field WMT_BUFFER_SEGMENT segmentData
#endstruct

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