ホーム › Media.Multimedia › COMPVARS
COMPVARS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbSize | INT | 4 | +0 | +0 | この構造体のサイズ。バイト単位で呼び出し前に設定する。 |
| dwFlags | DWORD | 4 | +4 | +4 | 圧縮設定の状態を示すフラグ。ICMF_COMPVARS_VALID等を示す。 |
| hic | HIC | 8/4 | +8 | +8 | 使用するコーデックのハンドル(HIC)。 |
| fccType | DWORD | 4 | +16 | +12 | コンプレッサの種類を示すFOURCC。'vidc'などを示す。 |
| fccHandler | DWORD | 4 | +20 | +16 | 選択されたコーデックハンドラのFOURCC。 |
| lpbiIn | BITMAPINFO* | 8/4 | +24 | +20 | 入力画像のBITMAPINFOへのポインタ。 |
| lpbiOut | BITMAPINFO* | 8/4 | +32 | +24 | 出力(圧縮)フォーマットのBITMAPINFOへのポインタ。 |
| lpBitsOut | void* | 8/4 | +40 | +28 | 圧縮出力データのバッファへのポインタ。 |
| lpBitsPrev | void* | 8/4 | +48 | +32 | 前フレームのデータバッファへのポインタ。差分圧縮に用いる。 |
| lFrame | INT | 4 | +56 | +36 | 現在のフレーム番号。 |
| lKey | INT | 4 | +60 | +40 | キーフレーム間隔。何フレームごとにキーフレームを置くかを示す。 |
| lDataRate | INT | 4 | +64 | +44 | 目標データレート。1秒あたりのバイト数を示す。 |
| lQ | INT | 4 | +68 | +48 | 圧縮品質。0〜10000の範囲、ICQUALITY_DEFAULTで既定値。 |
| lKeyCount | INT | 4 | +72 | +52 | 次のキーフレームまでの残りフレーム数(内部カウンタ)。 |
| lpState | void* | 8/4 | +80 | +56 | コーデックの状態データへのポインタ。 |
| cbState | INT | 4 | +88 | +60 | lpStateの状態データサイズ。バイト単位で示す。 |
各言語での定義
#include <windows.h>
// COMPVARS (x64 96 / x86 64 バイト)
typedef struct COMPVARS {
INT cbSize;
DWORD dwFlags;
HIC hic;
DWORD fccType;
DWORD fccHandler;
BITMAPINFO* lpbiIn;
BITMAPINFO* lpbiOut;
void* lpBitsOut;
void* lpBitsPrev;
INT lFrame;
INT lKey;
INT lDataRate;
INT lQ;
INT lKeyCount;
void* lpState;
INT cbState;
} COMPVARS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COMPVARS
{
public int cbSize;
public uint dwFlags;
public IntPtr hic;
public uint fccType;
public uint fccHandler;
public IntPtr lpbiIn;
public IntPtr lpbiOut;
public IntPtr lpBitsOut;
public IntPtr lpBitsPrev;
public int lFrame;
public int lKey;
public int lDataRate;
public int lQ;
public int lKeyCount;
public IntPtr lpState;
public int cbState;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COMPVARS
Public cbSize As Integer
Public dwFlags As UInteger
Public hic As IntPtr
Public fccType As UInteger
Public fccHandler As UInteger
Public lpbiIn As IntPtr
Public lpbiOut As IntPtr
Public lpBitsOut As IntPtr
Public lpBitsPrev As IntPtr
Public lFrame As Integer
Public lKey As Integer
Public lDataRate As Integer
Public lQ As Integer
Public lKeyCount As Integer
Public lpState As IntPtr
Public cbState As Integer
End Structureimport ctypes
from ctypes import wintypes
class COMPVARS(ctypes.Structure):
_fields_ = [
("cbSize", ctypes.c_int),
("dwFlags", wintypes.DWORD),
("hic", ctypes.c_void_p),
("fccType", wintypes.DWORD),
("fccHandler", wintypes.DWORD),
("lpbiIn", ctypes.c_void_p),
("lpbiOut", ctypes.c_void_p),
("lpBitsOut", ctypes.c_void_p),
("lpBitsPrev", ctypes.c_void_p),
("lFrame", ctypes.c_int),
("lKey", ctypes.c_int),
("lDataRate", ctypes.c_int),
("lQ", ctypes.c_int),
("lKeyCount", ctypes.c_int),
("lpState", ctypes.c_void_p),
("cbState", ctypes.c_int),
]#[repr(C)]
pub struct COMPVARS {
pub cbSize: i32,
pub dwFlags: u32,
pub hic: *mut core::ffi::c_void,
pub fccType: u32,
pub fccHandler: u32,
pub lpbiIn: *mut core::ffi::c_void,
pub lpbiOut: *mut core::ffi::c_void,
pub lpBitsOut: *mut core::ffi::c_void,
pub lpBitsPrev: *mut core::ffi::c_void,
pub lFrame: i32,
pub lKey: i32,
pub lDataRate: i32,
pub lQ: i32,
pub lKeyCount: i32,
pub lpState: *mut core::ffi::c_void,
pub cbState: i32,
}import "golang.org/x/sys/windows"
type COMPVARS struct {
cbSize int32
dwFlags uint32
hic uintptr
fccType uint32
fccHandler uint32
lpbiIn uintptr
lpbiOut uintptr
lpBitsOut uintptr
lpBitsPrev uintptr
lFrame int32
lKey int32
lDataRate int32
lQ int32
lKeyCount int32
lpState uintptr
cbState int32
}type
COMPVARS = record
cbSize: Integer;
dwFlags: DWORD;
hic: Pointer;
fccType: DWORD;
fccHandler: DWORD;
lpbiIn: Pointer;
lpbiOut: Pointer;
lpBitsOut: Pointer;
lpBitsPrev: Pointer;
lFrame: Integer;
lKey: Integer;
lDataRate: Integer;
lQ: Integer;
lKeyCount: Integer;
lpState: Pointer;
cbState: Integer;
end;const COMPVARS = extern struct {
cbSize: i32,
dwFlags: u32,
hic: ?*anyopaque,
fccType: u32,
fccHandler: u32,
lpbiIn: ?*anyopaque,
lpbiOut: ?*anyopaque,
lpBitsOut: ?*anyopaque,
lpBitsPrev: ?*anyopaque,
lFrame: i32,
lKey: i32,
lDataRate: i32,
lQ: i32,
lKeyCount: i32,
lpState: ?*anyopaque,
cbState: i32,
};type
COMPVARS {.bycopy.} = object
cbSize: int32
dwFlags: uint32
hic: pointer
fccType: uint32
fccHandler: uint32
lpbiIn: pointer
lpbiOut: pointer
lpBitsOut: pointer
lpBitsPrev: pointer
lFrame: int32
lKey: int32
lDataRate: int32
lQ: int32
lKeyCount: int32
lpState: pointer
cbState: int32struct COMPVARS
{
int cbSize;
uint dwFlags;
void* hic;
uint fccType;
uint fccHandler;
void* lpbiIn;
void* lpbiOut;
void* lpBitsOut;
void* lpBitsPrev;
int lFrame;
int lKey;
int lDataRate;
int lQ;
int lKeyCount;
void* lpState;
int cbState;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; COMPVARS サイズ: 64 バイト(x86)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; cbSize : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hic : HIC (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; fccType : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; fccHandler : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; lpbiIn : BITMAPINFO* (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; lpbiOut : BITMAPINFO* (+24, 4byte) varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; lpBitsOut : void* (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; lpBitsPrev : void* (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; lFrame : INT (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; lKey : INT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; lDataRate : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; lQ : INT (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; lKeyCount : INT (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; lpState : void* (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; cbState : INT (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COMPVARS サイズ: 96 バイト(x64)
dim st, 24 ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; cbSize : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hic : HIC (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; fccType : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; fccHandler : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; lpbiIn : BITMAPINFO* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; lpbiOut : BITMAPINFO* (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; lpBitsOut : void* (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; lpBitsPrev : void* (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; lFrame : INT (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; lKey : INT (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; lDataRate : INT (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; lQ : INT (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; lKeyCount : INT (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; lpState : void* (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; cbState : INT (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global COMPVARS
#field int cbSize
#field int dwFlags
#field intptr hic
#field int fccType
#field int fccHandler
#field intptr lpbiIn
#field intptr lpbiOut
#field intptr lpBitsOut
#field intptr lpBitsPrev
#field int lFrame
#field int lKey
#field int lDataRate
#field int lQ
#field int lKeyCount
#field intptr lpState
#field int cbState
#endstruct
stdim st, COMPVARS ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize