AVISTREAMINFOW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| fccType | DWORD | 4 | +0 | +0 | ストリームの種類を示す 4 文字コードです。AVI ストリームで一般的に使用されるデータについて、次の定数が定義されています。
| ||||||||||
| fccHandler | DWORD | 4 | +4 | +4 | このビデオストリームを保存するときに圧縮するコンプレッサーハンドラーの 4 文字コードです (例: mmioFOURCC ('M','S','V','C'))。このメンバーはオーディオストリームでは使用されません。 | ||||||||||
| dwFlags | DWORD | 4 | +8 | +8 | ストリームに適用されるフラグです。これらのフラグの上位ワードのビットは、ストリームに格納されるデータの種類に固有です。次のフラグが定義されています。
| ||||||||||
| dwCaps | DWORD | 4 | +12 | +12 | 機能フラグです。現在は使用されていません。 | ||||||||||
| wPriority | WORD | 2 | +16 | +16 | ストリームの優先度です。 | ||||||||||
| wLanguage | WORD | 2 | +18 | +18 | ストリームの言語です。 | ||||||||||
| dwScale | DWORD | 4 | +20 | +20 | ストリームに適用される時間スケールです。dwRate を dwScale で割ると、1 秒あたりのサンプル数で表した再生レートが得られます。 ビデオストリームの場合、このレートはフレームレートにします。オーディオストリームの場合、このレートはオーディオブロックサイズ (WAVEFORMAT または PCMWAVEFORMAT 構造体の nBlockAlign メンバー) に対応させます。PCM (パルス符号変調) オーディオの場合、これはサンプルレートに一致します。 | ||||||||||
| dwRate | DWORD | 4 | +24 | +24 | 整数形式で表したレートです。1 秒あたりのサンプル数でレートを求めるには、この値を dwScale の値で割ります。 | ||||||||||
| dwStart | DWORD | 4 | +28 | +28 | AVI ファイルの最初のフレームのサンプル番号です。単位は dwRate と dwScale によって定義されます。通常は 0 ですが、ファイルと同時に開始しないストリームの遅延時間を指定できます。 AVI ツールのリリース 1.0 では、0 以外の開始時間はサポートされていません。 | ||||||||||
| dwLength | DWORD | 4 | +32 | +32 | このストリームの長さです。単位は dwRate と dwScale によって定義されます。 | ||||||||||
| dwInitialFrames | DWORD | 4 | +36 | +36 | オーディオのスキューです。このメンバーは、インターリーブされたファイルにおいて、ビデオフレームに対してオーディオデータをどれだけ先行させるかを指定します。通常は約 0.75 秒です。 | ||||||||||
| dwSuggestedBufferSize | DWORD | 4 | +40 | +40 | ストリームに推奨されるバッファーサイズ (バイト単位) です。通常、このメンバーにはストリーム内で最大のチャンクに対応する値が格納されます。適切なバッファーサイズを使用すると、再生がより効率的になります。適切なバッファーサイズが分からない場合は 0 を使用します。 | ||||||||||
| dwQuality | DWORD | 4 | +44 | +44 | ストリーム内のビデオデータの品質を示す値です。品質は 0 から 10,000 までの数値で表されます。圧縮データの場合、通常は圧縮ソフトウェアに渡された品質パラメーターの値を表します。–1 に設定した場合、ドライバーは既定の品質値を使用します。 | ||||||||||
| dwSampleSize | DWORD | 4 | +48 | +48 | 単一のデータサンプルのサイズ (バイト単位) です。このメンバーの値が 0 の場合、サンプルのサイズは可変であり、各データサンプル (ビデオフレームなど) はそれぞれ別のチャンクに格納する必要があります。0 以外の値は、複数のデータサンプルをファイル内の 1 つのチャンクにまとめられることを示します。 ビデオストリームの場合、この値は通常 0 ですが、すべてのビデオフレームが同じサイズであれば 0 以外にすることもできます。オーディオストリームの場合、この値は、そのオーディオを記述する WAVEFORMAT または WAVEFORMATEX 構造体の nBlockAlign メンバーと同じにする必要があります。 | ||||||||||
| rcFrame | RECT | 16 | +52 | +52 | ビデオの転送先四角形の寸法です。値は、四角形の左上隅の座標、高さ、および幅を表します。 | ||||||||||
| dwEditCount | DWORD | 4 | +68 | +68 | ストリームが編集された回数です。このカウントはストリームハンドラーが管理します。 | ||||||||||
| dwFormatChangeCount | DWORD | 4 | +72 | +72 | ストリームの形式が変更された回数です。このカウントはストリームハンドラーが管理します。 | ||||||||||
| szName | WCHAR | 128 | +76 | +76 | ストリームの説明を格納する NULL 終端文字列です。 |
公式ドキュメント
AVISTREAMINFO 構造体は、単一のストリームに関する情報を格納します。
解説(Remarks)
vfw.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして AVISTREAMINFO を定義しています。エンコーディングに依存しないエイリアスと、エンコーディングに依存するコードを混在させて使用すると、不一致が生じ、コンパイルエラーまたは実行時エラーの原因となる可能性があります。詳細については、「Conventions for Function Prototypes」を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// RECT (x64 16 / x86 16 バイト)
typedef struct RECT {
INT left;
INT top;
INT right;
INT bottom;
} RECT;
// AVISTREAMINFOW (x64 204 / x86 204 バイト)
typedef struct AVISTREAMINFOW {
DWORD fccType;
DWORD fccHandler;
DWORD dwFlags;
DWORD dwCaps;
WORD wPriority;
WORD wLanguage;
DWORD dwScale;
DWORD dwRate;
DWORD dwStart;
DWORD dwLength;
DWORD dwInitialFrames;
DWORD dwSuggestedBufferSize;
DWORD dwQuality;
DWORD dwSampleSize;
RECT rcFrame;
DWORD dwEditCount;
DWORD dwFormatChangeCount;
WCHAR szName[64];
} AVISTREAMINFOW;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 AVISTREAMINFOW
{
public uint fccType;
public uint fccHandler;
public uint dwFlags;
public uint dwCaps;
public ushort wPriority;
public ushort wLanguage;
public uint dwScale;
public uint dwRate;
public uint dwStart;
public uint dwLength;
public uint dwInitialFrames;
public uint dwSuggestedBufferSize;
public uint dwQuality;
public uint dwSampleSize;
public RECT rcFrame;
public uint dwEditCount;
public uint dwFormatChangeCount;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szName;
}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 AVISTREAMINFOW
Public fccType As UInteger
Public fccHandler As UInteger
Public dwFlags As UInteger
Public dwCaps As UInteger
Public wPriority As UShort
Public wLanguage As UShort
Public dwScale As UInteger
Public dwRate As UInteger
Public dwStart As UInteger
Public dwLength As UInteger
Public dwInitialFrames As UInteger
Public dwSuggestedBufferSize As UInteger
Public dwQuality As UInteger
Public dwSampleSize As UInteger
Public rcFrame As RECT
Public dwEditCount As UInteger
Public dwFormatChangeCount As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szName As String
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 AVISTREAMINFOW(ctypes.Structure):
_fields_ = [
("fccType", wintypes.DWORD),
("fccHandler", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("dwCaps", wintypes.DWORD),
("wPriority", ctypes.c_ushort),
("wLanguage", ctypes.c_ushort),
("dwScale", wintypes.DWORD),
("dwRate", wintypes.DWORD),
("dwStart", wintypes.DWORD),
("dwLength", wintypes.DWORD),
("dwInitialFrames", wintypes.DWORD),
("dwSuggestedBufferSize", wintypes.DWORD),
("dwQuality", wintypes.DWORD),
("dwSampleSize", wintypes.DWORD),
("rcFrame", RECT),
("dwEditCount", wintypes.DWORD),
("dwFormatChangeCount", wintypes.DWORD),
("szName", ctypes.c_wchar * 64),
]#[repr(C)]
pub struct RECT {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct AVISTREAMINFOW {
pub fccType: u32,
pub fccHandler: u32,
pub dwFlags: u32,
pub dwCaps: u32,
pub wPriority: u16,
pub wLanguage: u16,
pub dwScale: u32,
pub dwRate: u32,
pub dwStart: u32,
pub dwLength: u32,
pub dwInitialFrames: u32,
pub dwSuggestedBufferSize: u32,
pub dwQuality: u32,
pub dwSampleSize: u32,
pub rcFrame: RECT,
pub dwEditCount: u32,
pub dwFormatChangeCount: u32,
pub szName: [u16; 64],
}import "golang.org/x/sys/windows"
type RECT struct {
left int32
top int32
right int32
bottom int32
}
type AVISTREAMINFOW struct {
fccType uint32
fccHandler uint32
dwFlags uint32
dwCaps uint32
wPriority uint16
wLanguage uint16
dwScale uint32
dwRate uint32
dwStart uint32
dwLength uint32
dwInitialFrames uint32
dwSuggestedBufferSize uint32
dwQuality uint32
dwSampleSize uint32
rcFrame RECT
dwEditCount uint32
dwFormatChangeCount uint32
szName [64]uint16
}type
RECT = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
AVISTREAMINFOW = record
fccType: DWORD;
fccHandler: DWORD;
dwFlags: DWORD;
dwCaps: DWORD;
wPriority: Word;
wLanguage: Word;
dwScale: DWORD;
dwRate: DWORD;
dwStart: DWORD;
dwLength: DWORD;
dwInitialFrames: DWORD;
dwSuggestedBufferSize: DWORD;
dwQuality: DWORD;
dwSampleSize: DWORD;
rcFrame: RECT;
dwEditCount: DWORD;
dwFormatChangeCount: DWORD;
szName: array[0..63] of WideChar;
end;const RECT = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const AVISTREAMINFOW = extern struct {
fccType: u32,
fccHandler: u32,
dwFlags: u32,
dwCaps: u32,
wPriority: u16,
wLanguage: u16,
dwScale: u32,
dwRate: u32,
dwStart: u32,
dwLength: u32,
dwInitialFrames: u32,
dwSuggestedBufferSize: u32,
dwQuality: u32,
dwSampleSize: u32,
rcFrame: RECT,
dwEditCount: u32,
dwFormatChangeCount: u32,
szName: [64]u16,
};type
RECT {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
AVISTREAMINFOW {.bycopy.} = object
fccType: uint32
fccHandler: uint32
dwFlags: uint32
dwCaps: uint32
wPriority: uint16
wLanguage: uint16
dwScale: uint32
dwRate: uint32
dwStart: uint32
dwLength: uint32
dwInitialFrames: uint32
dwSuggestedBufferSize: uint32
dwQuality: uint32
dwSampleSize: uint32
rcFrame: RECT
dwEditCount: uint32
dwFormatChangeCount: uint32
szName: array[64, uint16]struct RECT
{
int left;
int top;
int right;
int bottom;
}
struct AVISTREAMINFOW
{
uint fccType;
uint fccHandler;
uint dwFlags;
uint dwCaps;
ushort wPriority;
ushort wLanguage;
uint dwScale;
uint dwRate;
uint dwStart;
uint dwLength;
uint dwInitialFrames;
uint dwSuggestedBufferSize;
uint dwQuality;
uint dwSampleSize;
RECT rcFrame;
uint dwEditCount;
uint dwFormatChangeCount;
wchar[64] szName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; AVISTREAMINFOW サイズ: 204 バイト(x64)
dim st, 51 ; 4byte整数×51(構造体サイズ 204 / 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 も可)
; dwCaps : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; wPriority : WORD (+16, 2byte) wpoke st,16,値 / 値 = wpeek(st,16)
; wLanguage : WORD (+18, 2byte) wpoke st,18,値 / 値 = wpeek(st,18)
; 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 も可)
; dwInitialFrames : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwSuggestedBufferSize : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwQuality : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; dwSampleSize : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; rcFrame : RECT (+52, 16byte) varptr(st)+52 を基点に操作(16byte:入れ子/配列)
; dwEditCount : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; dwFormatChangeCount : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; szName : WCHAR (+76, 128byte) varptr(st)+76 を基点に操作(128byte:入れ子/配列)
; ※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 AVISTREAMINFOW
#field int fccType
#field int fccHandler
#field int dwFlags
#field int dwCaps
#field short wPriority
#field short wLanguage
#field int dwScale
#field int dwRate
#field int dwStart
#field int dwLength
#field int dwInitialFrames
#field int dwSuggestedBufferSize
#field int dwQuality
#field int dwSampleSize
#field RECT rcFrame
#field int dwEditCount
#field int dwFormatChangeCount
#field wchar szName 64
#endstruct
stdim st, AVISTREAMINFOW ; NSTRUCT 変数を確保
st->fccType = 100
mes "fccType=" + st->fccType