ホーム › Media.DirectShow › MainAVIHeader
MainAVIHeader
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwMicroSecPerFrame | DWORD | 4 | +0 | +0 | 1フレームあたりの時間。単位はマイクロ秒。 |
| dwMaxBytesPerSec | DWORD | 4 | +4 | +4 | 最大データ転送レート。単位はバイト毎秒。 |
| dwPaddingGranularity | DWORD | 4 | +8 | +8 | データのパディング境界(粒度)。単位はバイト。 |
| dwFlags | DWORD | 4 | +12 | +12 | AVIファイル属性フラグ。インデックス有無等を示すビット集合。 |
| dwTotalFrames | DWORD | 4 | +16 | +16 | ファイル内の総フレーム数。 |
| dwInitialFrames | DWORD | 4 | +20 | +20 | インターリーブ時の先頭オーディオ用フレーム数。 |
| dwStreams | DWORD | 4 | +24 | +24 | ファイル内のストリーム数。 |
| dwSuggestedBufferSize | DWORD | 4 | +28 | +28 | 推奨される読み込みバッファサイズ。単位はバイト。 |
| dwWidth | DWORD | 4 | +32 | +32 | 映像の幅。単位はピクセル。 |
| dwHeight | DWORD | 4 | +36 | +36 | 映像の高さ。単位はピクセル。 |
| dwReserved | DWORD | 16 | +40 | +40 | 予約フィールド配列。将来の拡張用で通常は0。 |
各言語での定義
#include <windows.h>
// MainAVIHeader (x64 56 / x86 56 バイト)
typedef struct MainAVIHeader {
DWORD dwMicroSecPerFrame;
DWORD dwMaxBytesPerSec;
DWORD dwPaddingGranularity;
DWORD dwFlags;
DWORD dwTotalFrames;
DWORD dwInitialFrames;
DWORD dwStreams;
DWORD dwSuggestedBufferSize;
DWORD dwWidth;
DWORD dwHeight;
DWORD dwReserved[4];
} MainAVIHeader;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MainAVIHeader
{
public uint dwMicroSecPerFrame;
public uint dwMaxBytesPerSec;
public uint dwPaddingGranularity;
public uint dwFlags;
public uint dwTotalFrames;
public uint dwInitialFrames;
public uint dwStreams;
public uint dwSuggestedBufferSize;
public uint dwWidth;
public uint dwHeight;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] dwReserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MainAVIHeader
Public dwMicroSecPerFrame As UInteger
Public dwMaxBytesPerSec As UInteger
Public dwPaddingGranularity As UInteger
Public dwFlags As UInteger
Public dwTotalFrames As UInteger
Public dwInitialFrames As UInteger
Public dwStreams As UInteger
Public dwSuggestedBufferSize As UInteger
Public dwWidth As UInteger
Public dwHeight As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public dwReserved() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class MainAVIHeader(ctypes.Structure):
_fields_ = [
("dwMicroSecPerFrame", wintypes.DWORD),
("dwMaxBytesPerSec", wintypes.DWORD),
("dwPaddingGranularity", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("dwTotalFrames", wintypes.DWORD),
("dwInitialFrames", wintypes.DWORD),
("dwStreams", wintypes.DWORD),
("dwSuggestedBufferSize", wintypes.DWORD),
("dwWidth", wintypes.DWORD),
("dwHeight", wintypes.DWORD),
("dwReserved", wintypes.DWORD * 4),
]#[repr(C)]
pub struct MainAVIHeader {
pub dwMicroSecPerFrame: u32,
pub dwMaxBytesPerSec: u32,
pub dwPaddingGranularity: u32,
pub dwFlags: u32,
pub dwTotalFrames: u32,
pub dwInitialFrames: u32,
pub dwStreams: u32,
pub dwSuggestedBufferSize: u32,
pub dwWidth: u32,
pub dwHeight: u32,
pub dwReserved: [u32; 4],
}import "golang.org/x/sys/windows"
type MainAVIHeader struct {
dwMicroSecPerFrame uint32
dwMaxBytesPerSec uint32
dwPaddingGranularity uint32
dwFlags uint32
dwTotalFrames uint32
dwInitialFrames uint32
dwStreams uint32
dwSuggestedBufferSize uint32
dwWidth uint32
dwHeight uint32
dwReserved [4]uint32
}type
MainAVIHeader = record
dwMicroSecPerFrame: DWORD;
dwMaxBytesPerSec: DWORD;
dwPaddingGranularity: DWORD;
dwFlags: DWORD;
dwTotalFrames: DWORD;
dwInitialFrames: DWORD;
dwStreams: DWORD;
dwSuggestedBufferSize: DWORD;
dwWidth: DWORD;
dwHeight: DWORD;
dwReserved: array[0..3] of DWORD;
end;const MainAVIHeader = extern struct {
dwMicroSecPerFrame: u32,
dwMaxBytesPerSec: u32,
dwPaddingGranularity: u32,
dwFlags: u32,
dwTotalFrames: u32,
dwInitialFrames: u32,
dwStreams: u32,
dwSuggestedBufferSize: u32,
dwWidth: u32,
dwHeight: u32,
dwReserved: [4]u32,
};type
MainAVIHeader {.bycopy.} = object
dwMicroSecPerFrame: uint32
dwMaxBytesPerSec: uint32
dwPaddingGranularity: uint32
dwFlags: uint32
dwTotalFrames: uint32
dwInitialFrames: uint32
dwStreams: uint32
dwSuggestedBufferSize: uint32
dwWidth: uint32
dwHeight: uint32
dwReserved: array[4, uint32]struct MainAVIHeader
{
uint dwMicroSecPerFrame;
uint dwMaxBytesPerSec;
uint dwPaddingGranularity;
uint dwFlags;
uint dwTotalFrames;
uint dwInitialFrames;
uint dwStreams;
uint dwSuggestedBufferSize;
uint dwWidth;
uint dwHeight;
uint[4] dwReserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MainAVIHeader サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; dwMicroSecPerFrame : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwMaxBytesPerSec : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwPaddingGranularity : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwFlags : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwTotalFrames : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwInitialFrames : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwStreams : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwSuggestedBufferSize : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwWidth : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwHeight : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwReserved : DWORD (+40, 16byte) varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MainAVIHeader
#field int dwMicroSecPerFrame
#field int dwMaxBytesPerSec
#field int dwPaddingGranularity
#field int dwFlags
#field int dwTotalFrames
#field int dwInitialFrames
#field int dwStreams
#field int dwSuggestedBufferSize
#field int dwWidth
#field int dwHeight
#field int dwReserved 4
#endstruct
stdim st, MainAVIHeader ; NSTRUCT 変数を確保
st->dwMicroSecPerFrame = 100
mes "dwMicroSecPerFrame=" + st->dwMicroSecPerFrame