TIMECODE_SAMPLE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| qwTick | LONGLONG | 8 | +0 | +0 | サンプルのタイムスタンプ(ティック)。LONGLONGで時間位置を示す。 |
| timecode | TIMECODE | 8 | +8 | +8 | SMPTEタイムコード値(TIMECODE)。時分秒フレームを保持する。 |
| dwUser | DWORD | 4 | +16 | +16 | ユーザー定義データ。アプリ独自の付加情報を格納する。 |
| dwFlags | TIMECODE_SAMPLE_FLAGS | 4 | +20 | +20 | タイムコードサンプルのフラグ(TIMECODE_SAMPLE_FLAGS)。有効性等を示す。 |
各言語での定義
#include <windows.h>
// TIMECODE (x64 8 / x86 8 バイト)
typedef struct TIMECODE {
_Anonymous_e__Struct Anonymous;
ULONGLONG qw;
} TIMECODE;
// TIMECODE_SAMPLE (x64 24 / x86 24 バイト)
typedef struct TIMECODE_SAMPLE {
LONGLONG qwTick;
TIMECODE timecode;
DWORD dwUser;
TIMECODE_SAMPLE_FLAGS dwFlags;
} TIMECODE_SAMPLE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TIMECODE
{
public _Anonymous_e__Struct Anonymous;
public ulong qw;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TIMECODE_SAMPLE
{
public long qwTick;
public TIMECODE timecode;
public uint dwUser;
public uint dwFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TIMECODE
Public Anonymous As _Anonymous_e__Struct
Public qw As ULong
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TIMECODE_SAMPLE
Public qwTick As Long
Public timecode As TIMECODE
Public dwUser As UInteger
Public dwFlags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class TIMECODE(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Struct),
("qw", ctypes.c_ulonglong),
]
class TIMECODE_SAMPLE(ctypes.Structure):
_fields_ = [
("qwTick", ctypes.c_longlong),
("timecode", TIMECODE),
("dwUser", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
]#[repr(C)]
pub struct TIMECODE {
pub Anonymous: _Anonymous_e__Struct,
pub qw: u64,
}
#[repr(C)]
pub struct TIMECODE_SAMPLE {
pub qwTick: i64,
pub timecode: TIMECODE,
pub dwUser: u32,
pub dwFlags: u32,
}import "golang.org/x/sys/windows"
type TIMECODE struct {
Anonymous _Anonymous_e__Struct
qw uint64
}
type TIMECODE_SAMPLE struct {
qwTick int64
timecode TIMECODE
dwUser uint32
dwFlags uint32
}type
TIMECODE = record
Anonymous: _Anonymous_e__Struct;
qw: UInt64;
end;
TIMECODE_SAMPLE = record
qwTick: Int64;
timecode: TIMECODE;
dwUser: DWORD;
dwFlags: DWORD;
end;const TIMECODE = extern struct {
Anonymous: _Anonymous_e__Struct,
qw: u64,
};
const TIMECODE_SAMPLE = extern struct {
qwTick: i64,
timecode: TIMECODE,
dwUser: u32,
dwFlags: u32,
};type
TIMECODE {.bycopy.} = object
Anonymous: _Anonymous_e__Struct
qw: uint64
TIMECODE_SAMPLE {.bycopy.} = object
qwTick: int64
timecode: TIMECODE
dwUser: uint32
dwFlags: uint32struct TIMECODE
{
_Anonymous_e__Struct Anonymous;
ulong qw;
}
struct TIMECODE_SAMPLE
{
long qwTick;
TIMECODE timecode;
uint dwUser;
uint dwFlags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TIMECODE_SAMPLE サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; qwTick : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; timecode : TIMECODE (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; dwUser : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwFlags : TIMECODE_SAMPLE_FLAGS (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TIMECODE_SAMPLE
#field int64 qwTick
#field byte timecode 8
#field int dwUser
#field int dwFlags
#endstruct
stdim st, TIMECODE_SAMPLE ; NSTRUCT 変数を確保
st->qwTick = 100
mes "qwTick=" + st->qwTick
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。