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

TIMECODEDATA

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

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

フィールド

フィールドサイズx64x86説明
timeTIMECODE8+0+0SMPTEタイムコード値(TIMECODE)。
dwSMPTEflagsDWORD4+8+8SMPTEタイムコードのフラグ。ドロップフレーム等を示す。
dwUserDWORD4+12+12ユーザ定義データ。任意の付加情報を格納する。

各言語での定義

#include <windows.h>

// TIMECODE  (x64 8 / x86 8 バイト)
typedef struct TIMECODE {
    _Anonymous_e__Struct Anonymous;
    ULONGLONG qw;
} TIMECODE;

// TIMECODEDATA  (x64 16 / x86 16 バイト)
#pragma pack(push, 2)
typedef struct TIMECODEDATA {
    TIMECODE time;
    DWORD dwSMPTEflags;
    DWORD dwUser;
} TIMECODEDATA;
#pragma pack(pop)
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, Pack = 2, CharSet = CharSet.Unicode)]
public struct TIMECODEDATA
{
    public TIMECODE time;
    public uint dwSMPTEflags;
    public uint dwUser;
}
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, Pack:=2, CharSet:=CharSet.Unicode)>
Public Structure TIMECODEDATA
    Public time As TIMECODE
    Public dwSMPTEflags As UInteger
    Public dwUser As UInteger
End Structure
import ctypes
from ctypes import wintypes

class TIMECODE(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("qw", ctypes.c_ulonglong),
    ]

class TIMECODEDATA(ctypes.Structure):
    _pack_ = 2
    _fields_ = [
        ("time", TIMECODE),
        ("dwSMPTEflags", wintypes.DWORD),
        ("dwUser", wintypes.DWORD),
    ]
#[repr(C)]
pub struct TIMECODE {
    pub Anonymous: _Anonymous_e__Struct,
    pub qw: u64,
}

#[repr(C, packed(2))]
pub struct TIMECODEDATA {
    pub time: TIMECODE,
    pub dwSMPTEflags: u32,
    pub dwUser: u32,
}
import "golang.org/x/sys/windows"

type TIMECODE struct {
	Anonymous _Anonymous_e__Struct
	qw uint64
}

type TIMECODEDATA struct {
	time TIMECODE
	dwSMPTEflags uint32
	dwUser uint32
}
type
  TIMECODE = record
    Anonymous: _Anonymous_e__Struct;
    qw: UInt64;
  end;

  TIMECODEDATA = packed record
    time: TIMECODE;
    dwSMPTEflags: DWORD;
    dwUser: DWORD;
  end;
const TIMECODE = extern struct {
    Anonymous: _Anonymous_e__Struct,
    qw: u64,
};

const TIMECODEDATA = extern struct {
    time: TIMECODE,
    dwSMPTEflags: u32,
    dwUser: u32,
};
type
  TIMECODE {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    qw: uint64

  TIMECODEDATA {.packed.} = object
    time: TIMECODE
    dwSMPTEflags: uint32
    dwUser: uint32
struct TIMECODE
{
    _Anonymous_e__Struct Anonymous;
    ulong qw;
}

align(2)
struct TIMECODEDATA
{
    TIMECODE time;
    uint dwSMPTEflags;
    uint dwUser;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TIMECODEDATA サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; time : TIMECODE (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; dwSMPTEflags : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwUser : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TIMECODEDATA, pack=2
    #field byte time 8
    #field int dwSMPTEflags
    #field int dwUser
#endstruct

stdim st, TIMECODEDATA        ; NSTRUCT 変数を確保
st->dwSMPTEflags = 100
mes "dwSMPTEflags=" + st->dwSMPTEflags
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。