ホーム › Media.DirectShow › AM_SAMPLE2_PROPERTIES
AM_SAMPLE2_PROPERTIES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbData | DWORD | 4 | +0 | +0 | この構造体の有効データサイズをバイト単位で示す。 |
| dwTypeSpecificFlags | DWORD | 4 | +4 | +4 | メディア種別固有のフラグを示す。 |
| dwSampleFlags | DWORD | 4 | +8 | +8 | サンプルの状態を示すフラグ(AM_SAMPLE_*)を示す。 |
| lActual | INT | 4 | +12 | +12 | バッファ内の実際のデータ長をバイト単位で示す。 |
| tStart | LONGLONG | 8 | +16 | +16 | サンプルの開始時刻を100ナノ秒単位で示す。 |
| tStop | LONGLONG | 8 | +24 | +24 | サンプルの終了時刻を100ナノ秒単位で示す。 |
| dwStreamId | DWORD | 4 | +32 | +32 | サンプルが属するストリームの識別子を示す。 |
| pMediaType | AM_MEDIA_TYPE* | 8/4 | +40 | +36 | サンプルのメディア種別を示すAM_MEDIA_TYPEへのポインター。NULL可。 |
| pbBuffer | BYTE* | 8/4 | +48 | +40 | サンプルデータを格納するバッファへのポインター。 |
| cbBuffer | INT | 4 | +56 | +44 | バッファ全体のサイズをバイト単位で示す。 |
各言語での定義
#include <windows.h>
// AM_SAMPLE2_PROPERTIES (x64 64 / x86 48 バイト)
typedef struct AM_SAMPLE2_PROPERTIES {
DWORD cbData;
DWORD dwTypeSpecificFlags;
DWORD dwSampleFlags;
INT lActual;
LONGLONG tStart;
LONGLONG tStop;
DWORD dwStreamId;
AM_MEDIA_TYPE* pMediaType;
BYTE* pbBuffer;
INT cbBuffer;
} AM_SAMPLE2_PROPERTIES;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AM_SAMPLE2_PROPERTIES
{
public uint cbData;
public uint dwTypeSpecificFlags;
public uint dwSampleFlags;
public int lActual;
public long tStart;
public long tStop;
public uint dwStreamId;
public IntPtr pMediaType;
public IntPtr pbBuffer;
public int cbBuffer;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AM_SAMPLE2_PROPERTIES
Public cbData As UInteger
Public dwTypeSpecificFlags As UInteger
Public dwSampleFlags As UInteger
Public lActual As Integer
Public tStart As Long
Public tStop As Long
Public dwStreamId As UInteger
Public pMediaType As IntPtr
Public pbBuffer As IntPtr
Public cbBuffer As Integer
End Structureimport ctypes
from ctypes import wintypes
class AM_SAMPLE2_PROPERTIES(ctypes.Structure):
_fields_ = [
("cbData", wintypes.DWORD),
("dwTypeSpecificFlags", wintypes.DWORD),
("dwSampleFlags", wintypes.DWORD),
("lActual", ctypes.c_int),
("tStart", ctypes.c_longlong),
("tStop", ctypes.c_longlong),
("dwStreamId", wintypes.DWORD),
("pMediaType", ctypes.c_void_p),
("pbBuffer", ctypes.c_void_p),
("cbBuffer", ctypes.c_int),
]#[repr(C)]
pub struct AM_SAMPLE2_PROPERTIES {
pub cbData: u32,
pub dwTypeSpecificFlags: u32,
pub dwSampleFlags: u32,
pub lActual: i32,
pub tStart: i64,
pub tStop: i64,
pub dwStreamId: u32,
pub pMediaType: *mut core::ffi::c_void,
pub pbBuffer: *mut core::ffi::c_void,
pub cbBuffer: i32,
}import "golang.org/x/sys/windows"
type AM_SAMPLE2_PROPERTIES struct {
cbData uint32
dwTypeSpecificFlags uint32
dwSampleFlags uint32
lActual int32
tStart int64
tStop int64
dwStreamId uint32
pMediaType uintptr
pbBuffer uintptr
cbBuffer int32
}type
AM_SAMPLE2_PROPERTIES = record
cbData: DWORD;
dwTypeSpecificFlags: DWORD;
dwSampleFlags: DWORD;
lActual: Integer;
tStart: Int64;
tStop: Int64;
dwStreamId: DWORD;
pMediaType: Pointer;
pbBuffer: Pointer;
cbBuffer: Integer;
end;const AM_SAMPLE2_PROPERTIES = extern struct {
cbData: u32,
dwTypeSpecificFlags: u32,
dwSampleFlags: u32,
lActual: i32,
tStart: i64,
tStop: i64,
dwStreamId: u32,
pMediaType: ?*anyopaque,
pbBuffer: ?*anyopaque,
cbBuffer: i32,
};type
AM_SAMPLE2_PROPERTIES {.bycopy.} = object
cbData: uint32
dwTypeSpecificFlags: uint32
dwSampleFlags: uint32
lActual: int32
tStart: int64
tStop: int64
dwStreamId: uint32
pMediaType: pointer
pbBuffer: pointer
cbBuffer: int32struct AM_SAMPLE2_PROPERTIES
{
uint cbData;
uint dwTypeSpecificFlags;
uint dwSampleFlags;
int lActual;
long tStart;
long tStop;
uint dwStreamId;
void* pMediaType;
void* pbBuffer;
int cbBuffer;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; AM_SAMPLE2_PROPERTIES サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbData : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwTypeSpecificFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwSampleFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lActual : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; tStart : LONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; tStop : LONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; dwStreamId : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; pMediaType : AM_MEDIA_TYPE* (+36, 4byte) varptr(st)+36 を基点に操作(4byte:入れ子/配列)
; pbBuffer : BYTE* (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; cbBuffer : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; AM_SAMPLE2_PROPERTIES サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; cbData : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwTypeSpecificFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwSampleFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lActual : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; tStart : LONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; tStop : LONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; dwStreamId : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; pMediaType : AM_MEDIA_TYPE* (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; pbBuffer : BYTE* (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; cbBuffer : INT (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global AM_SAMPLE2_PROPERTIES
#field int cbData
#field int dwTypeSpecificFlags
#field int dwSampleFlags
#field int lActual
#field int64 tStart
#field int64 tStop
#field int dwStreamId
#field intptr pMediaType
#field intptr pbBuffer
#field int cbBuffer
#endstruct
stdim st, AM_SAMPLE2_PROPERTIES ; NSTRUCT 変数を確保
st->cbData = 100
mes "cbData=" + st->cbData