ホーム › Media.DirectShow › AVIStreamHeader
AVIStreamHeader
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| fccType | DWORD | 4 | +0 | +0 | ストリーム種別を示すFourCC('vids'映像、'auds'音声等)。 |
| fccHandler | DWORD | 4 | +4 | +4 | 推奨されるコーデック(ハンドラ)を示すFourCC。 |
| dwFlags | DWORD | 4 | +8 | +8 | ストリーム属性フラグ。無効化等を示すビット集合。 |
| wPriority | WORD | 2 | +12 | +12 | ストリームの優先度。 |
| wLanguage | WORD | 2 | +14 | +14 | ストリームの言語コード。 |
| dwInitialFrames | DWORD | 4 | +16 | +16 | ストリーム開始までの先行フレーム数。 |
| dwScale | DWORD | 4 | +20 | +20 | 時間単位の分母。dwRateと共にレートを表す。 |
| dwRate | DWORD | 4 | +24 | +24 | 時間単位の分子。dwScaleで割るとサンプル毎秒となる。 |
| dwStart | DWORD | 4 | +28 | +28 | ストリームの開始時刻。dwScale単位。 |
| dwLength | DWORD | 4 | +32 | +32 | ストリームの長さ。dwScale単位またはサンプル数。 |
| dwSuggestedBufferSize | DWORD | 4 | +36 | +36 | 推奨される読み込みバッファサイズ。単位はバイト。 |
| dwQuality | DWORD | 4 | +40 | +40 | 品質指標。0~10000、-1で既定値。 |
| dwSampleSize | DWORD | 4 | +44 | +44 | 1サンプルのバイト数。0なら可変サイズ。 |
| rcFrame | RECT | 16 | +48 | +48 | 映像表示先矩形(RECT)。 |
各言語での定義
#include <windows.h>
// RECT (x64 16 / x86 16 バイト)
typedef struct RECT {
INT left;
INT top;
INT right;
INT bottom;
} RECT;
// AVIStreamHeader (x64 64 / x86 64 バイト)
typedef struct AVIStreamHeader {
DWORD fccType;
DWORD fccHandler;
DWORD dwFlags;
WORD wPriority;
WORD wLanguage;
DWORD dwInitialFrames;
DWORD dwScale;
DWORD dwRate;
DWORD dwStart;
DWORD dwLength;
DWORD dwSuggestedBufferSize;
DWORD dwQuality;
DWORD dwSampleSize;
RECT rcFrame;
} AVIStreamHeader;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AVIStreamHeader
{
public uint fccType;
public uint fccHandler;
public uint dwFlags;
public ushort wPriority;
public ushort wLanguage;
public uint dwInitialFrames;
public uint dwScale;
public uint dwRate;
public uint dwStart;
public uint dwLength;
public uint dwSuggestedBufferSize;
public uint dwQuality;
public uint dwSampleSize;
public RECT rcFrame;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
Public left As Integer
Public top As Integer
Public right As Integer
Public bottom As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AVIStreamHeader
Public fccType As UInteger
Public fccHandler As UInteger
Public dwFlags As UInteger
Public wPriority As UShort
Public wLanguage As UShort
Public dwInitialFrames As UInteger
Public dwScale As UInteger
Public dwRate As UInteger
Public dwStart As UInteger
Public dwLength As UInteger
Public dwSuggestedBufferSize As UInteger
Public dwQuality As UInteger
Public dwSampleSize As UInteger
Public rcFrame As RECT
End Structureimport ctypes
from ctypes import wintypes
class RECT(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class AVIStreamHeader(ctypes.Structure):
_fields_ = [
("fccType", wintypes.DWORD),
("fccHandler", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("wPriority", ctypes.c_ushort),
("wLanguage", ctypes.c_ushort),
("dwInitialFrames", wintypes.DWORD),
("dwScale", wintypes.DWORD),
("dwRate", wintypes.DWORD),
("dwStart", wintypes.DWORD),
("dwLength", wintypes.DWORD),
("dwSuggestedBufferSize", wintypes.DWORD),
("dwQuality", wintypes.DWORD),
("dwSampleSize", wintypes.DWORD),
("rcFrame", RECT),
]#[repr(C)]
pub struct RECT {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct AVIStreamHeader {
pub fccType: u32,
pub fccHandler: u32,
pub dwFlags: u32,
pub wPriority: u16,
pub wLanguage: u16,
pub dwInitialFrames: u32,
pub dwScale: u32,
pub dwRate: u32,
pub dwStart: u32,
pub dwLength: u32,
pub dwSuggestedBufferSize: u32,
pub dwQuality: u32,
pub dwSampleSize: u32,
pub rcFrame: RECT,
}import "golang.org/x/sys/windows"
type RECT struct {
left int32
top int32
right int32
bottom int32
}
type AVIStreamHeader struct {
fccType uint32
fccHandler uint32
dwFlags uint32
wPriority uint16
wLanguage uint16
dwInitialFrames uint32
dwScale uint32
dwRate uint32
dwStart uint32
dwLength uint32
dwSuggestedBufferSize uint32
dwQuality uint32
dwSampleSize uint32
rcFrame RECT
}type
RECT = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
AVIStreamHeader = record
fccType: DWORD;
fccHandler: DWORD;
dwFlags: DWORD;
wPriority: Word;
wLanguage: Word;
dwInitialFrames: DWORD;
dwScale: DWORD;
dwRate: DWORD;
dwStart: DWORD;
dwLength: DWORD;
dwSuggestedBufferSize: DWORD;
dwQuality: DWORD;
dwSampleSize: DWORD;
rcFrame: RECT;
end;const RECT = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const AVIStreamHeader = extern struct {
fccType: u32,
fccHandler: u32,
dwFlags: u32,
wPriority: u16,
wLanguage: u16,
dwInitialFrames: u32,
dwScale: u32,
dwRate: u32,
dwStart: u32,
dwLength: u32,
dwSuggestedBufferSize: u32,
dwQuality: u32,
dwSampleSize: u32,
rcFrame: RECT,
};type
RECT {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
AVIStreamHeader {.bycopy.} = object
fccType: uint32
fccHandler: uint32
dwFlags: uint32
wPriority: uint16
wLanguage: uint16
dwInitialFrames: uint32
dwScale: uint32
dwRate: uint32
dwStart: uint32
dwLength: uint32
dwSuggestedBufferSize: uint32
dwQuality: uint32
dwSampleSize: uint32
rcFrame: RECTstruct RECT
{
int left;
int top;
int right;
int bottom;
}
struct AVIStreamHeader
{
uint fccType;
uint fccHandler;
uint dwFlags;
ushort wPriority;
ushort wLanguage;
uint dwInitialFrames;
uint dwScale;
uint dwRate;
uint dwStart;
uint dwLength;
uint dwSuggestedBufferSize;
uint dwQuality;
uint dwSampleSize;
RECT rcFrame;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; AVIStreamHeader サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; fccType : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fccHandler : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; wPriority : WORD (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; wLanguage : WORD (+14, 2byte) wpoke st,14,値 / 値 = wpeek(st,14)
; dwInitialFrames : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwScale : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwRate : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwStart : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwLength : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwSuggestedBufferSize : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwQuality : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwSampleSize : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; rcFrame : RECT (+48, 16byte) varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECT
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global AVIStreamHeader
#field int fccType
#field int fccHandler
#field int dwFlags
#field short wPriority
#field short wLanguage
#field int dwInitialFrames
#field int dwScale
#field int dwRate
#field int dwStart
#field int dwLength
#field int dwSuggestedBufferSize
#field int dwQuality
#field int dwSampleSize
#field RECT rcFrame
#endstruct
stdim st, AVIStreamHeader ; NSTRUCT 変数を確保
st->fccType = 100
mes "fccType=" + st->fccType