ホーム › Media.DirectShow › AM_MPEGSTREAMTYPE
AM_MPEGSTREAMTYPE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwStreamId | DWORD | 4 | +0 | +0 | MPEGエレメンタリストリームの識別子。 |
| dwReserved | DWORD | 4 | +4 | +4 | 予約フィールド。将来の拡張用で通常は0。 |
| mt | AM_MEDIA_TYPE | 88/72 | +8 | +8 | ストリームのメディア種別(AM_MEDIA_TYPE)。 |
| bFormat | BYTE | 1 | +96 | +80 | フォーマット固有データの可変長配列。先頭1バイトを起点とする。 |
各言語での定義
#include <windows.h>
// AM_MEDIA_TYPE (x64 88 / x86 72 バイト)
typedef struct AM_MEDIA_TYPE {
GUID majortype;
GUID subtype;
BOOL bFixedSizeSamples;
BOOL bTemporalCompression;
DWORD lSampleSize;
GUID formattype;
IUnknown* pUnk;
DWORD cbFormat;
BYTE* pbFormat;
} AM_MEDIA_TYPE;
// AM_MPEGSTREAMTYPE (x64 104 / x86 84 バイト)
typedef struct AM_MPEGSTREAMTYPE {
DWORD dwStreamId;
DWORD dwReserved;
AM_MEDIA_TYPE mt;
BYTE bFormat[1];
} AM_MPEGSTREAMTYPE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AM_MEDIA_TYPE
{
public Guid majortype;
public Guid subtype;
[MarshalAs(UnmanagedType.Bool)] public bool bFixedSizeSamples;
[MarshalAs(UnmanagedType.Bool)] public bool bTemporalCompression;
public uint lSampleSize;
public Guid formattype;
public IntPtr pUnk;
public uint cbFormat;
public IntPtr pbFormat;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AM_MPEGSTREAMTYPE
{
public uint dwStreamId;
public uint dwReserved;
public AM_MEDIA_TYPE mt;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] bFormat;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AM_MEDIA_TYPE
Public majortype As Guid
Public subtype As Guid
<MarshalAs(UnmanagedType.Bool)> Public bFixedSizeSamples As Boolean
<MarshalAs(UnmanagedType.Bool)> Public bTemporalCompression As Boolean
Public lSampleSize As UInteger
Public formattype As Guid
Public pUnk As IntPtr
Public cbFormat As UInteger
Public pbFormat As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AM_MPEGSTREAMTYPE
Public dwStreamId As UInteger
Public dwReserved As UInteger
Public mt As AM_MEDIA_TYPE
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public bFormat() As Byte
End Structureimport ctypes
from ctypes import wintypes
class AM_MEDIA_TYPE(ctypes.Structure):
_fields_ = [
("majortype", GUID),
("subtype", GUID),
("bFixedSizeSamples", wintypes.BOOL),
("bTemporalCompression", wintypes.BOOL),
("lSampleSize", wintypes.DWORD),
("formattype", GUID),
("pUnk", ctypes.c_void_p),
("cbFormat", wintypes.DWORD),
("pbFormat", ctypes.c_void_p),
]
class AM_MPEGSTREAMTYPE(ctypes.Structure):
_fields_ = [
("dwStreamId", wintypes.DWORD),
("dwReserved", wintypes.DWORD),
("mt", AM_MEDIA_TYPE),
("bFormat", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct AM_MEDIA_TYPE {
pub majortype: GUID,
pub subtype: GUID,
pub bFixedSizeSamples: i32,
pub bTemporalCompression: i32,
pub lSampleSize: u32,
pub formattype: GUID,
pub pUnk: *mut core::ffi::c_void,
pub cbFormat: u32,
pub pbFormat: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct AM_MPEGSTREAMTYPE {
pub dwStreamId: u32,
pub dwReserved: u32,
pub mt: AM_MEDIA_TYPE,
pub bFormat: [u8; 1],
}import "golang.org/x/sys/windows"
type AM_MEDIA_TYPE struct {
majortype windows.GUID
subtype windows.GUID
bFixedSizeSamples int32
bTemporalCompression int32
lSampleSize uint32
formattype windows.GUID
pUnk uintptr
cbFormat uint32
pbFormat uintptr
}
type AM_MPEGSTREAMTYPE struct {
dwStreamId uint32
dwReserved uint32
mt AM_MEDIA_TYPE
bFormat [1]byte
}type
AM_MEDIA_TYPE = record
majortype: TGUID;
subtype: TGUID;
bFixedSizeSamples: BOOL;
bTemporalCompression: BOOL;
lSampleSize: DWORD;
formattype: TGUID;
pUnk: Pointer;
cbFormat: DWORD;
pbFormat: Pointer;
end;
AM_MPEGSTREAMTYPE = record
dwStreamId: DWORD;
dwReserved: DWORD;
mt: AM_MEDIA_TYPE;
bFormat: array[0..0] of Byte;
end;const AM_MEDIA_TYPE = extern struct {
majortype: GUID,
subtype: GUID,
bFixedSizeSamples: i32,
bTemporalCompression: i32,
lSampleSize: u32,
formattype: GUID,
pUnk: ?*anyopaque,
cbFormat: u32,
pbFormat: ?*anyopaque,
};
const AM_MPEGSTREAMTYPE = extern struct {
dwStreamId: u32,
dwReserved: u32,
mt: AM_MEDIA_TYPE,
bFormat: [1]u8,
};type
AM_MEDIA_TYPE {.bycopy.} = object
majortype: GUID
subtype: GUID
bFixedSizeSamples: int32
bTemporalCompression: int32
lSampleSize: uint32
formattype: GUID
pUnk: pointer
cbFormat: uint32
pbFormat: pointer
AM_MPEGSTREAMTYPE {.bycopy.} = object
dwStreamId: uint32
dwReserved: uint32
mt: AM_MEDIA_TYPE
bFormat: array[1, uint8]struct AM_MEDIA_TYPE
{
GUID majortype;
GUID subtype;
int bFixedSizeSamples;
int bTemporalCompression;
uint lSampleSize;
GUID formattype;
void* pUnk;
uint cbFormat;
void* pbFormat;
}
struct AM_MPEGSTREAMTYPE
{
uint dwStreamId;
uint dwReserved;
AM_MEDIA_TYPE mt;
ubyte[1] bFormat;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; AM_MPEGSTREAMTYPE サイズ: 84 バイト(x86)
dim st, 21 ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; dwStreamId : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwReserved : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; mt : AM_MEDIA_TYPE (+8, 72byte) varptr(st)+8 を基点に操作(72byte:入れ子/配列)
; bFormat : BYTE (+80, 1byte) varptr(st)+80 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; AM_MPEGSTREAMTYPE サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; dwStreamId : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwReserved : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; mt : AM_MEDIA_TYPE (+8, 88byte) varptr(st)+8 を基点に操作(88byte:入れ子/配列)
; bFormat : BYTE (+96, 1byte) varptr(st)+96 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global AM_MEDIA_TYPE
#field GUID majortype
#field GUID subtype
#field bool bFixedSizeSamples
#field bool bTemporalCompression
#field int lSampleSize
#field GUID formattype
#field intptr pUnk
#field int cbFormat
#field intptr pbFormat
#endstruct
#defstruct global AM_MPEGSTREAMTYPE
#field int dwStreamId
#field int dwReserved
#field AM_MEDIA_TYPE mt
#field byte bFormat 1
#endstruct
stdim st, AM_MPEGSTREAMTYPE ; NSTRUCT 変数を確保
st->dwStreamId = 100
mes "dwStreamId=" + st->dwStreamId