ホーム › Media.DirectShow › AVIMAINHEADER
AVIMAINHEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| fcc | DWORD | 4 | +0 | +0 | チャンクを識別するFourCCコード('avih')。 |
| cb | DWORD | 4 | +4 | +4 | このヘッダのバイト数。 |
| dwMicroSecPerFrame | DWORD | 4 | +8 | +8 | 1フレームあたりの時間。単位はマイクロ秒。 |
| dwMaxBytesPerSec | DWORD | 4 | +12 | +12 | 最大データ転送レート。単位はバイト毎秒。 |
| dwPaddingGranularity | DWORD | 4 | +16 | +16 | データのパディング境界(粒度)。単位はバイト。 |
| dwFlags | DWORD | 4 | +20 | +20 | AVIファイル属性フラグ。インデックス有無等を示すビット集合。 |
| dwTotalFrames | DWORD | 4 | +24 | +24 | ファイル内の総フレーム数。 |
| dwInitialFrames | DWORD | 4 | +28 | +28 | インターリーブ時の先頭オーディオ用フレーム数。 |
| dwStreams | DWORD | 4 | +32 | +32 | ファイル内のストリーム数。 |
| dwSuggestedBufferSize | DWORD | 4 | +36 | +36 | 推奨される読み込みバッファサイズ。単位はバイト。 |
| dwWidth | DWORD | 4 | +40 | +40 | 映像の幅。単位はピクセル。 |
| dwHeight | DWORD | 4 | +44 | +44 | 映像の高さ。単位はピクセル。 |
| dwReserved | DWORD | 16 | +48 | +48 | 予約フィールド配列。将来の拡張用で通常は0。 |
各言語での定義
#include <windows.h>
// AVIMAINHEADER (x64 64 / x86 64 バイト)
#pragma pack(push, 2)
typedef struct AVIMAINHEADER {
DWORD fcc;
DWORD cb;
DWORD dwMicroSecPerFrame;
DWORD dwMaxBytesPerSec;
DWORD dwPaddingGranularity;
DWORD dwFlags;
DWORD dwTotalFrames;
DWORD dwInitialFrames;
DWORD dwStreams;
DWORD dwSuggestedBufferSize;
DWORD dwWidth;
DWORD dwHeight;
DWORD dwReserved[4];
} AVIMAINHEADER;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 2, CharSet = CharSet.Unicode)]
public struct AVIMAINHEADER
{
public uint fcc;
public uint cb;
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, Pack:=2, CharSet:=CharSet.Unicode)>
Public Structure AVIMAINHEADER
Public fcc As UInteger
Public cb As UInteger
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 AVIMAINHEADER(ctypes.Structure):
_pack_ = 2
_fields_ = [
("fcc", wintypes.DWORD),
("cb", wintypes.DWORD),
("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, packed(2))]
pub struct AVIMAINHEADER {
pub fcc: u32,
pub cb: u32,
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 AVIMAINHEADER struct {
fcc uint32
cb uint32
dwMicroSecPerFrame uint32
dwMaxBytesPerSec uint32
dwPaddingGranularity uint32
dwFlags uint32
dwTotalFrames uint32
dwInitialFrames uint32
dwStreams uint32
dwSuggestedBufferSize uint32
dwWidth uint32
dwHeight uint32
dwReserved [4]uint32
}type
AVIMAINHEADER = packed record
fcc: DWORD;
cb: DWORD;
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 AVIMAINHEADER = extern struct {
fcc: u32,
cb: u32,
dwMicroSecPerFrame: u32,
dwMaxBytesPerSec: u32,
dwPaddingGranularity: u32,
dwFlags: u32,
dwTotalFrames: u32,
dwInitialFrames: u32,
dwStreams: u32,
dwSuggestedBufferSize: u32,
dwWidth: u32,
dwHeight: u32,
dwReserved: [4]u32,
};type
AVIMAINHEADER {.packed.} = object
fcc: uint32
cb: uint32
dwMicroSecPerFrame: uint32
dwMaxBytesPerSec: uint32
dwPaddingGranularity: uint32
dwFlags: uint32
dwTotalFrames: uint32
dwInitialFrames: uint32
dwStreams: uint32
dwSuggestedBufferSize: uint32
dwWidth: uint32
dwHeight: uint32
dwReserved: array[4, uint32]align(2)
struct AVIMAINHEADER
{
uint fcc;
uint cb;
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 レイアウト)
; AVIMAINHEADER サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; fcc : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cb : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwMicroSecPerFrame : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwMaxBytesPerSec : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwPaddingGranularity : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwFlags : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwTotalFrames : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwInitialFrames : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwStreams : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwSuggestedBufferSize : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwWidth : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwHeight : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; dwReserved : DWORD (+48, 16byte) varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global AVIMAINHEADER, pack=2
#field int fcc
#field int cb
#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, AVIMAINHEADER ; NSTRUCT 変数を確保
st->fcc = 100
mes "fcc=" + st->fcc