HEAACWAVEFORMAT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wfInfo | HEAACWAVEINFO | 30 | +0 | +0 | HEAACWAVEINFO 構造体です。 |
| pbAudioSpecificConfig | BYTE | 1 | +30 | +30 | ISO/IEC 14496-3 で定義されている AudioSpecificConfig() の値を格納するバイト配列です。この配列は、構造体の宣言で示されているサイズよりも大きい場合があります。サイズを判断するには wfInfo.wfx.cbSize の値を使用してください。 |
公式ドキュメント
[このページに関連する機能である DirectShow はレガシー機能です。この機能は MediaPlayer、IMFMediaEngine、および Audio/Video Capture in Media Foundation に置き換えられました。これらの機能は Windows 10 および Windows 11 向けに最適化されています。Microsoft は、可能な場合は新しいコードで DirectShow ではなく MediaPlayer、IMFMediaEngine、Audio/Video Capture in Media Foundation を使用することを強く推奨します。レガシー API を使用している既存のコードについても、可能であれば新しい API を使用するように書き直すことを Microsoft は推奨します。]
AudioSpecificConfig() データを含む AAC または HE-AAC ストリームのフォーマットデータを格納します。
解説(Remarks)
HEAACWAVEINFO 構造体に続く AudioSpecificConfig() データにアクセスするには、この構造体を使用します。このデータは、HEAACWAVEFORMAT 構造体の wStructType メンバーが 0 の場合にのみ存在します。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// WAVEFORMATEX (x64 18 / x86 18 バイト)
#pragma pack(push, 1)
typedef struct WAVEFORMATEX {
WORD wFormatTag;
WORD nChannels;
DWORD nSamplesPerSec;
DWORD nAvgBytesPerSec;
WORD nBlockAlign;
WORD wBitsPerSample;
WORD cbSize;
} WAVEFORMATEX;
#pragma pack(pop)
// HEAACWAVEINFO (x64 30 / x86 30 バイト)
#pragma pack(push, 1)
typedef struct HEAACWAVEINFO {
WAVEFORMATEX wfx;
WORD wPayloadType;
WORD wAudioProfileLevelIndication;
WORD wStructType;
WORD wReserved1;
DWORD dwReserved2;
} HEAACWAVEINFO;
#pragma pack(pop)
// HEAACWAVEFORMAT (x64 31 / x86 31 バイト)
typedef struct HEAACWAVEFORMAT {
HEAACWAVEINFO wfInfo;
BYTE pbAudioSpecificConfig[1];
} HEAACWAVEFORMAT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct WAVEFORMATEX
{
public ushort wFormatTag;
public ushort nChannels;
public uint nSamplesPerSec;
public uint nAvgBytesPerSec;
public ushort nBlockAlign;
public ushort wBitsPerSample;
public ushort cbSize;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct HEAACWAVEINFO
{
public WAVEFORMATEX wfx;
public ushort wPayloadType;
public ushort wAudioProfileLevelIndication;
public ushort wStructType;
public ushort wReserved1;
public uint dwReserved2;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HEAACWAVEFORMAT
{
public HEAACWAVEINFO wfInfo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] pbAudioSpecificConfig;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure WAVEFORMATEX
Public wFormatTag As UShort
Public nChannels As UShort
Public nSamplesPerSec As UInteger
Public nAvgBytesPerSec As UInteger
Public nBlockAlign As UShort
Public wBitsPerSample As UShort
Public cbSize As UShort
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure HEAACWAVEINFO
Public wfx As WAVEFORMATEX
Public wPayloadType As UShort
Public wAudioProfileLevelIndication As UShort
Public wStructType As UShort
Public wReserved1 As UShort
Public dwReserved2 As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HEAACWAVEFORMAT
Public wfInfo As HEAACWAVEINFO
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public pbAudioSpecificConfig() As Byte
End Structureimport ctypes
from ctypes import wintypes
class WAVEFORMATEX(ctypes.Structure):
_pack_ = 1
_fields_ = [
("wFormatTag", ctypes.c_ushort),
("nChannels", ctypes.c_ushort),
("nSamplesPerSec", wintypes.DWORD),
("nAvgBytesPerSec", wintypes.DWORD),
("nBlockAlign", ctypes.c_ushort),
("wBitsPerSample", ctypes.c_ushort),
("cbSize", ctypes.c_ushort),
]
class HEAACWAVEINFO(ctypes.Structure):
_pack_ = 1
_fields_ = [
("wfx", WAVEFORMATEX),
("wPayloadType", ctypes.c_ushort),
("wAudioProfileLevelIndication", ctypes.c_ushort),
("wStructType", ctypes.c_ushort),
("wReserved1", ctypes.c_ushort),
("dwReserved2", wintypes.DWORD),
]
class HEAACWAVEFORMAT(ctypes.Structure):
_fields_ = [
("wfInfo", HEAACWAVEINFO),
("pbAudioSpecificConfig", ctypes.c_ubyte * 1),
]#[repr(C, packed(1))]
pub struct WAVEFORMATEX {
pub wFormatTag: u16,
pub nChannels: u16,
pub nSamplesPerSec: u32,
pub nAvgBytesPerSec: u32,
pub nBlockAlign: u16,
pub wBitsPerSample: u16,
pub cbSize: u16,
}
#[repr(C, packed(1))]
pub struct HEAACWAVEINFO {
pub wfx: WAVEFORMATEX,
pub wPayloadType: u16,
pub wAudioProfileLevelIndication: u16,
pub wStructType: u16,
pub wReserved1: u16,
pub dwReserved2: u32,
}
#[repr(C)]
pub struct HEAACWAVEFORMAT {
pub wfInfo: HEAACWAVEINFO,
pub pbAudioSpecificConfig: [u8; 1],
}import "golang.org/x/sys/windows"
type WAVEFORMATEX struct {
wFormatTag uint16
nChannels uint16
nSamplesPerSec uint32
nAvgBytesPerSec uint32
nBlockAlign uint16
wBitsPerSample uint16
cbSize uint16
}
type HEAACWAVEINFO struct {
wfx WAVEFORMATEX
wPayloadType uint16
wAudioProfileLevelIndication uint16
wStructType uint16
wReserved1 uint16
dwReserved2 uint32
}
type HEAACWAVEFORMAT struct {
wfInfo HEAACWAVEINFO
pbAudioSpecificConfig [1]byte
}type
WAVEFORMATEX = packed record
wFormatTag: Word;
nChannels: Word;
nSamplesPerSec: DWORD;
nAvgBytesPerSec: DWORD;
nBlockAlign: Word;
wBitsPerSample: Word;
cbSize: Word;
end;
HEAACWAVEINFO = packed record
wfx: WAVEFORMATEX;
wPayloadType: Word;
wAudioProfileLevelIndication: Word;
wStructType: Word;
wReserved1: Word;
dwReserved2: DWORD;
end;
HEAACWAVEFORMAT = record
wfInfo: HEAACWAVEINFO;
pbAudioSpecificConfig: array[0..0] of Byte;
end;const WAVEFORMATEX = extern struct {
wFormatTag: u16,
nChannels: u16,
nSamplesPerSec: u32,
nAvgBytesPerSec: u32,
nBlockAlign: u16,
wBitsPerSample: u16,
cbSize: u16,
};
const HEAACWAVEINFO = extern struct {
wfx: WAVEFORMATEX,
wPayloadType: u16,
wAudioProfileLevelIndication: u16,
wStructType: u16,
wReserved1: u16,
dwReserved2: u32,
};
const HEAACWAVEFORMAT = extern struct {
wfInfo: HEAACWAVEINFO,
pbAudioSpecificConfig: [1]u8,
};type
WAVEFORMATEX {.packed.} = object
wFormatTag: uint16
nChannels: uint16
nSamplesPerSec: uint32
nAvgBytesPerSec: uint32
nBlockAlign: uint16
wBitsPerSample: uint16
cbSize: uint16
HEAACWAVEINFO {.packed.} = object
wfx: WAVEFORMATEX
wPayloadType: uint16
wAudioProfileLevelIndication: uint16
wStructType: uint16
wReserved1: uint16
dwReserved2: uint32
HEAACWAVEFORMAT {.bycopy.} = object
wfInfo: HEAACWAVEINFO
pbAudioSpecificConfig: array[1, uint8]align(1)
struct WAVEFORMATEX
{
ushort wFormatTag;
ushort nChannels;
uint nSamplesPerSec;
uint nAvgBytesPerSec;
ushort nBlockAlign;
ushort wBitsPerSample;
ushort cbSize;
}
align(1)
struct HEAACWAVEINFO
{
WAVEFORMATEX wfx;
ushort wPayloadType;
ushort wAudioProfileLevelIndication;
ushort wStructType;
ushort wReserved1;
uint dwReserved2;
}
struct HEAACWAVEFORMAT
{
HEAACWAVEINFO wfInfo;
ubyte[1] pbAudioSpecificConfig;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HEAACWAVEFORMAT サイズ: 31 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 31 / 4 切り上げ)
; wfInfo : HEAACWAVEINFO (+0, 30byte) varptr(st)+0 を基点に操作(30byte:入れ子/配列)
; pbAudioSpecificConfig : BYTE (+30, 1byte) varptr(st)+30 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WAVEFORMATEX, pack=1
#field short wFormatTag
#field short nChannels
#field int nSamplesPerSec
#field int nAvgBytesPerSec
#field short nBlockAlign
#field short wBitsPerSample
#field short cbSize
#endstruct
#defstruct global HEAACWAVEINFO, pack=1
#field WAVEFORMATEX wfx
#field short wPayloadType
#field short wAudioProfileLevelIndication
#field short wStructType
#field short wReserved1
#field int dwReserved2
#endstruct
#defstruct global HEAACWAVEFORMAT
#field HEAACWAVEINFO wfInfo
#field byte pbAudioSpecificConfig 1
#endstruct
stdim st, HEAACWAVEFORMAT ; NSTRUCT 変数を確保