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

AVISTREAMINFOA

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

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

フィールド

フィールドサイズx64x86説明
fccTypeDWORD4+0+0

ストリームの種類を示す 4 文字コードです。AVI ストリームで一般的に見られるデータについて、次の定数が定義されています:

定数 説明
streamtypeAUDIO
オーディオストリームであることを示します。
streamtypeMIDI
MIDI ストリームであることを示します。
streamtypeTEXT
テキストストリームであることを示します。
streamtypeVIDEO
ビデオストリームであることを示します。
fccHandlerDWORD4+4+4このビデオストリームを保存する際に圧縮する圧縮ハンドラーの 4 文字コードです (例: mmioFOURCC ('M','S','V','C'))。このメンバーはオーディオストリームでは使用されません。
dwFlagsDWORD4+8+8

ストリームに適用されるフラグです。これらのフラグの上位ワードのビットは、ストリームに含まれるデータの種類に固有です。次のフラグが定義されています:

名前 説明
AVISTREAMINFO_DISABLED
このストリームは、ユーザーが明示的に有効にした場合にレンダリングされるべきであることを示します。
AVISTREAMINFO_FORMATCHANGES
このビデオストリームにパレットの変更が含まれることを示します。このフラグは、パレットをアニメーション化する必要があることを再生ソフトウェアに知らせます。
dwCapsDWORD4+12+12機能フラグです。現在は使用されていません。
wPriorityWORD2+16+16ストリームの優先度です。
wLanguageWORD2+18+18ストリームの言語です。
dwScaleDWORD4+20+20

ストリームに適用されるタイムスケールです。dwRatedwScale で割ると、1 秒あたりのサンプル数で表した再生レートが得られます。

ビデオストリームの場合、このレートはフレームレートになります。オーディオストリームの場合、このレートはオーディオのブロックサイズ (WAVEFORMAT 構造体または PCMWAVEFORMAT 構造体の nBlockAlign メンバー) に対応します。PCM (パルス符号変調) オーディオの場合は、サンプルレートに等しくなります。

dwRateDWORD4+24+24整数形式で表したレートです。1 秒あたりのサンプル数でレートを求めるには、この値を dwScale の値で割ります。
dwStartDWORD4+28+28

AVI ファイルの最初のフレームのサンプル番号です。単位は dwRate と dwScale によって定義されます。通常は 0 ですが、ファイルと同時に開始しないストリームの遅延時間を指定できます。

AVI ツールのリリース 1.0 では、0 以外の開始時間はサポートされていません。

dwLengthDWORD4+32+32このストリームの長さです。単位は dwRatedwScale によって定義されます。
dwInitialFramesDWORD4+36+36オーディオのスキューです。このメンバーは、インターリーブされたファイルにおいて、ビデオフレームよりどれだけ先行させてオーディオデータをずらすかを指定します。通常は約 0.75 秒です。
dwSuggestedBufferSizeDWORD4+40+40ストリームに推奨されるバッファーサイズ (バイト単位) です。通常、このメンバーにはストリーム内で最大のチャンクに対応する値が格納されます。正しいバッファーサイズを使用すると、再生がより効率的になります。正しいバッファーサイズが分からない場合は 0 を使用します。
dwQualityDWORD4+44+44ストリーム内のビデオデータの品質を示す値です。品質は 0 から 10,000 までの数値で表されます。圧縮データの場合、これは通常、圧縮ソフトウェアに渡された品質パラメーターの値を表します。–1 に設定した場合、ドライバーは既定の品質値を使用します。
dwSampleSizeDWORD4+48+48

単一のデータサンプルのサイズ (バイト単位) です。このメンバーの値が 0 の場合、サンプルのサイズは可変であり、各データサンプル (ビデオフレームなど) はそれぞれ別のチャンクに格納されていなければなりません。0 以外の値は、複数のデータサンプルをファイル内の 1 つのチャンクにまとめられることを示します。

ビデオストリームの場合、この値は通常 0 ですが、すべてのビデオフレームが同じサイズであれば 0 以外になることもあります。オーディオストリームの場合、この値はオーディオを記述する WAVEFORMAT 構造体または WAVEFORMATEX 構造体の nBlockAlign メンバーと同じでなければなりません。

rcFrameRECT16+52+52ビデオの転送先矩形の寸法です。値は矩形の左上隅の座標、高さ、および幅を表します。
dwEditCountDWORD4+68+68ストリームが編集された回数です。このカウントはストリームハンドラーが管理します。
dwFormatChangeCountDWORD4+72+72ストリーム形式が変更された回数です。このカウントはストリームハンドラーが管理します。
szNameCHAR64+76+76ストリームの説明を含む null 終端文字列です。

公式ドキュメント

AVISTREAMINFO 構造体には、単一のストリームに関する情報が格納されます。

解説(Remarks)

メモ

vfw.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版と Unicode 版を自動的に選択するエイリアスとして AVISTREAMINFO を定義します。エンコード中立のエイリアスの使用と、エンコード中立でないコードを混在させると、不一致が生じてコンパイルエラーや実行時エラーの原因となることがあります。詳細については、関数プロトタイプの規則 を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
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;

// AVISTREAMINFOA  (x64 140 / x86 140 バイト)
typedef struct AVISTREAMINFOA {
    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;
    CHAR szName[64];
} AVISTREAMINFOA;
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 AVISTREAMINFOA
{
    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.ByValArray, SizeConst = 64)] public sbyte[] 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 AVISTREAMINFOA
    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.ByValArray, SizeConst:=64)> Public szName() As SByte
End Structure
import 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 AVISTREAMINFOA(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_byte * 64),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct AVISTREAMINFOA {
    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: [i8; 64],
}
import "golang.org/x/sys/windows"

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type AVISTREAMINFOA 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]int8
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  AVISTREAMINFOA = 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 Shortint;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const AVISTREAMINFOA = 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]i8,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  AVISTREAMINFOA {.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, int8]
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct AVISTREAMINFOA
{
    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;
    byte[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 レイアウト)
; AVISTREAMINFOA サイズ: 140 バイト(x64)
dim st, 35    ; 4byte整数×35(構造体サイズ 140 / 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 : CHAR (+76, 64byte)  varptr(st)+76 を基点に操作(64byte:入れ子/配列)
; ※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 AVISTREAMINFOA
    #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 byte szName 64
#endstruct

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