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

WM_WRITER_STATISTICS_EX

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

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

フィールド

フィールドサイズx64x86説明
dwBitratePlusOverheadDWORD4+0+0オーバーヘッドを含めたビットレートを格納する DWORD です。
dwCurrentSampleDropRateInQueueDWORD4+4+4CPU の負荷を軽減するためにキュー内でサンプルが破棄される現在の割合を格納する DWORD です。
dwCurrentSampleDropRateInCodecDWORD4+8+8コーデック内でサンプルが破棄される現在の割合を格納する DWORD です。サンプルに含まれる新しいデータが少ない場合、そのサンプルは破棄されることがあります。これを防ぐには、IWMWriterAdvanced2::SetInputSetting を呼び出して g_wszFixedFrameRate 設定を TRUE に設定します。
dwCurrentSampleDropRateInMultiplexerDWORD4+12+12到着が遅れたりバッファーウィンドウをオーバーフローしたりしたために、マルチプレクサー内でサンプルが破棄される現在の割合を格納する DWORD です。
dwTotalSampleDropsInQueueDWORD4+16+16キュー内で破棄されたサンプルの総数を格納する DWORD です。
dwTotalSampleDropsInCodecDWORD4+20+20コーデック内で破棄されたサンプルの総数を格納する DWORD です。
dwTotalSampleDropsInMultiplexerDWORD4+24+24マルチプレクサー内で破棄されたサンプルの総数を格納する 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_EX 構造体は、拡張ライター統計情報を取得するために IWMWriterAdvanced3::GetStatisticsEx で使用されます。

解説(Remarks)

サンプルレートはキロヘルツ単位で示されます。

基本的なライター統計情報は WM_WRITER_STATISTICS 構造体に格納されており、IWMWriterAdvanced::GetStatistics を呼び出して取得する必要があります。

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

各言語での定義

#include <windows.h>

// WM_WRITER_STATISTICS_EX  (x64 28 / x86 28 バイト)
typedef struct WM_WRITER_STATISTICS_EX {
    DWORD dwBitratePlusOverhead;
    DWORD dwCurrentSampleDropRateInQueue;
    DWORD dwCurrentSampleDropRateInCodec;
    DWORD dwCurrentSampleDropRateInMultiplexer;
    DWORD dwTotalSampleDropsInQueue;
    DWORD dwTotalSampleDropsInCodec;
    DWORD dwTotalSampleDropsInMultiplexer;
} WM_WRITER_STATISTICS_EX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WM_WRITER_STATISTICS_EX
{
    public uint dwBitratePlusOverhead;
    public uint dwCurrentSampleDropRateInQueue;
    public uint dwCurrentSampleDropRateInCodec;
    public uint dwCurrentSampleDropRateInMultiplexer;
    public uint dwTotalSampleDropsInQueue;
    public uint dwTotalSampleDropsInCodec;
    public uint dwTotalSampleDropsInMultiplexer;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WM_WRITER_STATISTICS_EX
    Public dwBitratePlusOverhead As UInteger
    Public dwCurrentSampleDropRateInQueue As UInteger
    Public dwCurrentSampleDropRateInCodec As UInteger
    Public dwCurrentSampleDropRateInMultiplexer As UInteger
    Public dwTotalSampleDropsInQueue As UInteger
    Public dwTotalSampleDropsInCodec As UInteger
    Public dwTotalSampleDropsInMultiplexer As UInteger
End Structure
import ctypes
from ctypes import wintypes

class WM_WRITER_STATISTICS_EX(ctypes.Structure):
    _fields_ = [
        ("dwBitratePlusOverhead", wintypes.DWORD),
        ("dwCurrentSampleDropRateInQueue", wintypes.DWORD),
        ("dwCurrentSampleDropRateInCodec", wintypes.DWORD),
        ("dwCurrentSampleDropRateInMultiplexer", wintypes.DWORD),
        ("dwTotalSampleDropsInQueue", wintypes.DWORD),
        ("dwTotalSampleDropsInCodec", wintypes.DWORD),
        ("dwTotalSampleDropsInMultiplexer", wintypes.DWORD),
    ]
#[repr(C)]
pub struct WM_WRITER_STATISTICS_EX {
    pub dwBitratePlusOverhead: u32,
    pub dwCurrentSampleDropRateInQueue: u32,
    pub dwCurrentSampleDropRateInCodec: u32,
    pub dwCurrentSampleDropRateInMultiplexer: u32,
    pub dwTotalSampleDropsInQueue: u32,
    pub dwTotalSampleDropsInCodec: u32,
    pub dwTotalSampleDropsInMultiplexer: u32,
}
import "golang.org/x/sys/windows"

type WM_WRITER_STATISTICS_EX struct {
	dwBitratePlusOverhead uint32
	dwCurrentSampleDropRateInQueue uint32
	dwCurrentSampleDropRateInCodec uint32
	dwCurrentSampleDropRateInMultiplexer uint32
	dwTotalSampleDropsInQueue uint32
	dwTotalSampleDropsInCodec uint32
	dwTotalSampleDropsInMultiplexer uint32
}
type
  WM_WRITER_STATISTICS_EX = record
    dwBitratePlusOverhead: DWORD;
    dwCurrentSampleDropRateInQueue: DWORD;
    dwCurrentSampleDropRateInCodec: DWORD;
    dwCurrentSampleDropRateInMultiplexer: DWORD;
    dwTotalSampleDropsInQueue: DWORD;
    dwTotalSampleDropsInCodec: DWORD;
    dwTotalSampleDropsInMultiplexer: DWORD;
  end;
const WM_WRITER_STATISTICS_EX = extern struct {
    dwBitratePlusOverhead: u32,
    dwCurrentSampleDropRateInQueue: u32,
    dwCurrentSampleDropRateInCodec: u32,
    dwCurrentSampleDropRateInMultiplexer: u32,
    dwTotalSampleDropsInQueue: u32,
    dwTotalSampleDropsInCodec: u32,
    dwTotalSampleDropsInMultiplexer: u32,
};
type
  WM_WRITER_STATISTICS_EX {.bycopy.} = object
    dwBitratePlusOverhead: uint32
    dwCurrentSampleDropRateInQueue: uint32
    dwCurrentSampleDropRateInCodec: uint32
    dwCurrentSampleDropRateInMultiplexer: uint32
    dwTotalSampleDropsInQueue: uint32
    dwTotalSampleDropsInCodec: uint32
    dwTotalSampleDropsInMultiplexer: uint32
struct WM_WRITER_STATISTICS_EX
{
    uint dwBitratePlusOverhead;
    uint dwCurrentSampleDropRateInQueue;
    uint dwCurrentSampleDropRateInCodec;
    uint dwCurrentSampleDropRateInMultiplexer;
    uint dwTotalSampleDropsInQueue;
    uint dwTotalSampleDropsInCodec;
    uint dwTotalSampleDropsInMultiplexer;
}

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_EX サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; dwBitratePlusOverhead : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwCurrentSampleDropRateInQueue : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwCurrentSampleDropRateInCodec : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwCurrentSampleDropRateInMultiplexer : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwTotalSampleDropsInQueue : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwTotalSampleDropsInCodec : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwTotalSampleDropsInMultiplexer : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WM_WRITER_STATISTICS_EX
    #field int dwBitratePlusOverhead
    #field int dwCurrentSampleDropRateInQueue
    #field int dwCurrentSampleDropRateInCodec
    #field int dwCurrentSampleDropRateInMultiplexer
    #field int dwTotalSampleDropsInQueue
    #field int dwTotalSampleDropsInCodec
    #field int dwTotalSampleDropsInMultiplexer
#endstruct

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