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

DVD_PLAYBACK_LOCATION2

構造体
サイズx64: 16 バイト / x86: 16 バイト

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

フィールド

フィールドサイズx64x86説明
TitleNumDWORD4+0+0現在のタイトル番号を示す。
ChapterNumDWORD4+4+4現在のチャプター番号を示す。
TimeCodeDVD_HMSF_TIMECODE4+8+8現在の再生位置を示すDVD_HMSF_TIMECODE構造体。
TimeCodeFlagsDWORD4+12+12タイムコードに関するフラグ(DVD_TC_FLAG_*)を示す。

各言語での定義

#include <windows.h>

// DVD_HMSF_TIMECODE  (x64 4 / x86 4 バイト)
typedef struct DVD_HMSF_TIMECODE {
    BYTE bHours;
    BYTE bMinutes;
    BYTE bSeconds;
    BYTE bFrames;
} DVD_HMSF_TIMECODE;

// DVD_PLAYBACK_LOCATION2  (x64 16 / x86 16 バイト)
typedef struct DVD_PLAYBACK_LOCATION2 {
    DWORD TitleNum;
    DWORD ChapterNum;
    DVD_HMSF_TIMECODE TimeCode;
    DWORD TimeCodeFlags;
} DVD_PLAYBACK_LOCATION2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DVD_HMSF_TIMECODE
{
    public byte bHours;
    public byte bMinutes;
    public byte bSeconds;
    public byte bFrames;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DVD_PLAYBACK_LOCATION2
{
    public uint TitleNum;
    public uint ChapterNum;
    public DVD_HMSF_TIMECODE TimeCode;
    public uint TimeCodeFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DVD_HMSF_TIMECODE
    Public bHours As Byte
    Public bMinutes As Byte
    Public bSeconds As Byte
    Public bFrames As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DVD_PLAYBACK_LOCATION2
    Public TitleNum As UInteger
    Public ChapterNum As UInteger
    Public TimeCode As DVD_HMSF_TIMECODE
    Public TimeCodeFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DVD_HMSF_TIMECODE(ctypes.Structure):
    _fields_ = [
        ("bHours", ctypes.c_ubyte),
        ("bMinutes", ctypes.c_ubyte),
        ("bSeconds", ctypes.c_ubyte),
        ("bFrames", ctypes.c_ubyte),
    ]

class DVD_PLAYBACK_LOCATION2(ctypes.Structure):
    _fields_ = [
        ("TitleNum", wintypes.DWORD),
        ("ChapterNum", wintypes.DWORD),
        ("TimeCode", DVD_HMSF_TIMECODE),
        ("TimeCodeFlags", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DVD_HMSF_TIMECODE {
    pub bHours: u8,
    pub bMinutes: u8,
    pub bSeconds: u8,
    pub bFrames: u8,
}

#[repr(C)]
pub struct DVD_PLAYBACK_LOCATION2 {
    pub TitleNum: u32,
    pub ChapterNum: u32,
    pub TimeCode: DVD_HMSF_TIMECODE,
    pub TimeCodeFlags: u32,
}
import "golang.org/x/sys/windows"

type DVD_HMSF_TIMECODE struct {
	bHours byte
	bMinutes byte
	bSeconds byte
	bFrames byte
}

type DVD_PLAYBACK_LOCATION2 struct {
	TitleNum uint32
	ChapterNum uint32
	TimeCode DVD_HMSF_TIMECODE
	TimeCodeFlags uint32
}
type
  DVD_HMSF_TIMECODE = record
    bHours: Byte;
    bMinutes: Byte;
    bSeconds: Byte;
    bFrames: Byte;
  end;

  DVD_PLAYBACK_LOCATION2 = record
    TitleNum: DWORD;
    ChapterNum: DWORD;
    TimeCode: DVD_HMSF_TIMECODE;
    TimeCodeFlags: DWORD;
  end;
const DVD_HMSF_TIMECODE = extern struct {
    bHours: u8,
    bMinutes: u8,
    bSeconds: u8,
    bFrames: u8,
};

const DVD_PLAYBACK_LOCATION2 = extern struct {
    TitleNum: u32,
    ChapterNum: u32,
    TimeCode: DVD_HMSF_TIMECODE,
    TimeCodeFlags: u32,
};
type
  DVD_HMSF_TIMECODE {.bycopy.} = object
    bHours: uint8
    bMinutes: uint8
    bSeconds: uint8
    bFrames: uint8

  DVD_PLAYBACK_LOCATION2 {.bycopy.} = object
    TitleNum: uint32
    ChapterNum: uint32
    TimeCode: DVD_HMSF_TIMECODE
    TimeCodeFlags: uint32
struct DVD_HMSF_TIMECODE
{
    ubyte bHours;
    ubyte bMinutes;
    ubyte bSeconds;
    ubyte bFrames;
}

struct DVD_PLAYBACK_LOCATION2
{
    uint TitleNum;
    uint ChapterNum;
    DVD_HMSF_TIMECODE TimeCode;
    uint TimeCodeFlags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DVD_PLAYBACK_LOCATION2 サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; TitleNum : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ChapterNum : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; TimeCode : DVD_HMSF_TIMECODE (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; TimeCodeFlags : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DVD_HMSF_TIMECODE
    #field byte bHours
    #field byte bMinutes
    #field byte bSeconds
    #field byte bFrames
#endstruct

#defstruct global DVD_PLAYBACK_LOCATION2
    #field int TitleNum
    #field int ChapterNum
    #field DVD_HMSF_TIMECODE TimeCode
    #field int TimeCodeFlags
#endstruct

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