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

WM_WRITER_STATISTICS

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

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

フィールド

フィールドサイズx64x86説明
qwSampleCountULONGLONG8+0+0サンプル数を格納する QWORD です。
qwByteCountULONGLONG8+8+8バイト数を格納する QWORD です。
qwDroppedSampleCountULONGLONG8+16+16破棄されたサンプル数を格納する QWORD です。
qwDroppedByteCountULONGLONG8+24+24破棄されたバイト数を格納する QWORD です。
dwCurrentBitrateDWORD4+32+32現在のビットレートを格納する DWORD です。
dwAverageBitrateDWORD4+36+36平均ビットレートを格納する DWORD です。
dwExpectedBitrateDWORD4+40+40予測されるビットレートを格納する DWORD です。
dwCurrentSampleRateDWORD4+44+44現在のサンプルレートを格納する DWORD です。
dwAverageSampleRateDWORD4+48+48平均サンプルレートを格納する DWORD です。
dwExpectedSampleRateDWORD4+52+52予測されるサンプルレートを格納する DWORD です。

公式ドキュメント

[このページに関連する機能である Windows Media Format 11 SDK はレガシー機能です。この機能は Source Reader および Sink Writer に置き換えられました。Source ReaderSink Writer は Windows 10 および Windows 11 向けに最適化されています。Microsoft は、可能な場合には新しいコードで Windows Media Format 11 SDK ではなく Source ReaderSink Writer を使用することを強く推奨します。また、レガシー API を使用している既存のコードについても、可能であれば新しい API を使用するように書き換えることを推奨します。]

WM_WRITER_STATISTICS 構造体は、書き込み操作のパフォーマンスを表します。

解説(Remarks)

サンプルレートはキロヘルツ単位で指定されます。たとえば、サンプルレートが 8 の場合は、1 秒あたり 8000 サンプルであることを示します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// WM_WRITER_STATISTICS  (x64 56 / x86 56 バイト)
typedef struct WM_WRITER_STATISTICS {
    ULONGLONG qwSampleCount;
    ULONGLONG qwByteCount;
    ULONGLONG qwDroppedSampleCount;
    ULONGLONG qwDroppedByteCount;
    DWORD dwCurrentBitrate;
    DWORD dwAverageBitrate;
    DWORD dwExpectedBitrate;
    DWORD dwCurrentSampleRate;
    DWORD dwAverageSampleRate;
    DWORD dwExpectedSampleRate;
} WM_WRITER_STATISTICS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WM_WRITER_STATISTICS
{
    public ulong qwSampleCount;
    public ulong qwByteCount;
    public ulong qwDroppedSampleCount;
    public ulong qwDroppedByteCount;
    public uint dwCurrentBitrate;
    public uint dwAverageBitrate;
    public uint dwExpectedBitrate;
    public uint dwCurrentSampleRate;
    public uint dwAverageSampleRate;
    public uint dwExpectedSampleRate;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WM_WRITER_STATISTICS
    Public qwSampleCount As ULong
    Public qwByteCount As ULong
    Public qwDroppedSampleCount As ULong
    Public qwDroppedByteCount As ULong
    Public dwCurrentBitrate As UInteger
    Public dwAverageBitrate As UInteger
    Public dwExpectedBitrate As UInteger
    Public dwCurrentSampleRate As UInteger
    Public dwAverageSampleRate As UInteger
    Public dwExpectedSampleRate As UInteger
End Structure
import ctypes
from ctypes import wintypes

class WM_WRITER_STATISTICS(ctypes.Structure):
    _fields_ = [
        ("qwSampleCount", ctypes.c_ulonglong),
        ("qwByteCount", ctypes.c_ulonglong),
        ("qwDroppedSampleCount", ctypes.c_ulonglong),
        ("qwDroppedByteCount", ctypes.c_ulonglong),
        ("dwCurrentBitrate", wintypes.DWORD),
        ("dwAverageBitrate", wintypes.DWORD),
        ("dwExpectedBitrate", wintypes.DWORD),
        ("dwCurrentSampleRate", wintypes.DWORD),
        ("dwAverageSampleRate", wintypes.DWORD),
        ("dwExpectedSampleRate", wintypes.DWORD),
    ]
#[repr(C)]
pub struct WM_WRITER_STATISTICS {
    pub qwSampleCount: u64,
    pub qwByteCount: u64,
    pub qwDroppedSampleCount: u64,
    pub qwDroppedByteCount: u64,
    pub dwCurrentBitrate: u32,
    pub dwAverageBitrate: u32,
    pub dwExpectedBitrate: u32,
    pub dwCurrentSampleRate: u32,
    pub dwAverageSampleRate: u32,
    pub dwExpectedSampleRate: u32,
}
import "golang.org/x/sys/windows"

type WM_WRITER_STATISTICS struct {
	qwSampleCount uint64
	qwByteCount uint64
	qwDroppedSampleCount uint64
	qwDroppedByteCount uint64
	dwCurrentBitrate uint32
	dwAverageBitrate uint32
	dwExpectedBitrate uint32
	dwCurrentSampleRate uint32
	dwAverageSampleRate uint32
	dwExpectedSampleRate uint32
}
type
  WM_WRITER_STATISTICS = record
    qwSampleCount: UInt64;
    qwByteCount: UInt64;
    qwDroppedSampleCount: UInt64;
    qwDroppedByteCount: UInt64;
    dwCurrentBitrate: DWORD;
    dwAverageBitrate: DWORD;
    dwExpectedBitrate: DWORD;
    dwCurrentSampleRate: DWORD;
    dwAverageSampleRate: DWORD;
    dwExpectedSampleRate: DWORD;
  end;
const WM_WRITER_STATISTICS = extern struct {
    qwSampleCount: u64,
    qwByteCount: u64,
    qwDroppedSampleCount: u64,
    qwDroppedByteCount: u64,
    dwCurrentBitrate: u32,
    dwAverageBitrate: u32,
    dwExpectedBitrate: u32,
    dwCurrentSampleRate: u32,
    dwAverageSampleRate: u32,
    dwExpectedSampleRate: u32,
};
type
  WM_WRITER_STATISTICS {.bycopy.} = object
    qwSampleCount: uint64
    qwByteCount: uint64
    qwDroppedSampleCount: uint64
    qwDroppedByteCount: uint64
    dwCurrentBitrate: uint32
    dwAverageBitrate: uint32
    dwExpectedBitrate: uint32
    dwCurrentSampleRate: uint32
    dwAverageSampleRate: uint32
    dwExpectedSampleRate: uint32
struct WM_WRITER_STATISTICS
{
    ulong qwSampleCount;
    ulong qwByteCount;
    ulong qwDroppedSampleCount;
    ulong qwDroppedByteCount;
    uint dwCurrentBitrate;
    uint dwAverageBitrate;
    uint dwExpectedBitrate;
    uint dwCurrentSampleRate;
    uint dwAverageSampleRate;
    uint dwExpectedSampleRate;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WM_WRITER_STATISTICS サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; qwSampleCount : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; qwByteCount : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; qwDroppedSampleCount : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; qwDroppedByteCount : ULONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; dwCurrentBitrate : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwAverageBitrate : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; dwExpectedBitrate : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwCurrentSampleRate : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwAverageSampleRate : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwExpectedSampleRate : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WM_WRITER_STATISTICS
    #field int64 qwSampleCount
    #field int64 qwByteCount
    #field int64 qwDroppedSampleCount
    #field int64 qwDroppedByteCount
    #field int dwCurrentBitrate
    #field int dwAverageBitrate
    #field int dwExpectedBitrate
    #field int dwCurrentSampleRate
    #field int dwAverageSampleRate
    #field int dwExpectedSampleRate
#endstruct

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