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

MPEG_TIME

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

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

フィールド

フィールドサイズx64x86説明
HoursBYTE1+0+0時刻の時(0~23)。
MinutesBYTE1+1+1時刻の分(0~59)。
SecondsBYTE1+2+2時刻の秒(0~59)。

各言語での定義

#include <windows.h>

// MPEG_TIME  (x64 3 / x86 3 バイト)
#pragma pack(push, 1)
typedef struct MPEG_TIME {
    BYTE Hours;
    BYTE Minutes;
    BYTE Seconds;
} MPEG_TIME;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MPEG_TIME
{
    public byte Hours;
    public byte Minutes;
    public byte Seconds;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MPEG_TIME
    Public Hours As Byte
    Public Minutes As Byte
    Public Seconds As Byte
End Structure
import ctypes
from ctypes import wintypes

class MPEG_TIME(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Hours", ctypes.c_ubyte),
        ("Minutes", ctypes.c_ubyte),
        ("Seconds", ctypes.c_ubyte),
    ]
#[repr(C, packed(1))]
pub struct MPEG_TIME {
    pub Hours: u8,
    pub Minutes: u8,
    pub Seconds: u8,
}
import "golang.org/x/sys/windows"

type MPEG_TIME struct {
	Hours byte
	Minutes byte
	Seconds byte
}
type
  MPEG_TIME = packed record
    Hours: Byte;
    Minutes: Byte;
    Seconds: Byte;
  end;
const MPEG_TIME = extern struct {
    Hours: u8,
    Minutes: u8,
    Seconds: u8,
};
type
  MPEG_TIME {.packed.} = object
    Hours: uint8
    Minutes: uint8
    Seconds: uint8
align(1)
struct MPEG_TIME
{
    ubyte Hours;
    ubyte Minutes;
    ubyte Seconds;
}

HSP用 定義

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

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

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