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

AVIStreamRead

関数
AVIストリームからサンプルデータを読み込む。
DLLAVIFIL32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// AVIFIL32.dll
#include <windows.h>

HRESULT AVIStreamRead(
    IAVIStream* pavi,
    INT lStart,
    INT lSamples,
    void* lpBuffer,   // optional
    INT cbBuffer,
    INT* plBytes,   // optional
    INT* plSamples   // optional
);

パラメーター

名前方向
paviIAVIStream*in
lStartINTin
lSamplesINTin
lpBuffervoid*outoptional
cbBufferINTin
plBytesINT*outoptional
plSamplesINT*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

// AVIFIL32.dll
#include <windows.h>

HRESULT AVIStreamRead(
    IAVIStream* pavi,
    INT lStart,
    INT lSamples,
    void* lpBuffer,   // optional
    INT cbBuffer,
    INT* plBytes,   // optional
    INT* plSamples   // optional
);
[DllImport("AVIFIL32.dll", ExactSpelling = true)]
static extern int AVIStreamRead(
    IntPtr pavi,   // IAVIStream*
    int lStart,   // INT
    int lSamples,   // INT
    IntPtr lpBuffer,   // void* optional, out
    int cbBuffer,   // INT
    IntPtr plBytes,   // INT* optional, out
    IntPtr plSamples   // INT* optional, out
);
<DllImport("AVIFIL32.dll", ExactSpelling:=True)>
Public Shared Function AVIStreamRead(
    pavi As IntPtr,   ' IAVIStream*
    lStart As Integer,   ' INT
    lSamples As Integer,   ' INT
    lpBuffer As IntPtr,   ' void* optional, out
    cbBuffer As Integer,   ' INT
    plBytes As IntPtr,   ' INT* optional, out
    plSamples As IntPtr   ' INT* optional, out
) As Integer
End Function
' pavi : IAVIStream*
' lStart : INT
' lSamples : INT
' lpBuffer : void* optional, out
' cbBuffer : INT
' plBytes : INT* optional, out
' plSamples : INT* optional, out
Declare PtrSafe Function AVIStreamRead Lib "avifil32" ( _
    ByVal pavi As LongPtr, _
    ByVal lStart As Long, _
    ByVal lSamples As Long, _
    ByVal lpBuffer As LongPtr, _
    ByVal cbBuffer As Long, _
    ByVal plBytes As LongPtr, _
    ByVal plSamples As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

AVIStreamRead = ctypes.windll.avifil32.AVIStreamRead
AVIStreamRead.restype = ctypes.c_int
AVIStreamRead.argtypes = [
    ctypes.c_void_p,  # pavi : IAVIStream*
    ctypes.c_int,  # lStart : INT
    ctypes.c_int,  # lSamples : INT
    ctypes.POINTER(None),  # lpBuffer : void* optional, out
    ctypes.c_int,  # cbBuffer : INT
    ctypes.POINTER(ctypes.c_int),  # plBytes : INT* optional, out
    ctypes.POINTER(ctypes.c_int),  # plSamples : INT* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('AVIFIL32.dll')
AVIStreamRead = Fiddle::Function.new(
  lib['AVIStreamRead'],
  [
    Fiddle::TYPE_VOIDP,  # pavi : IAVIStream*
    Fiddle::TYPE_INT,  # lStart : INT
    Fiddle::TYPE_INT,  # lSamples : INT
    Fiddle::TYPE_VOIDP,  # lpBuffer : void* optional, out
    Fiddle::TYPE_INT,  # cbBuffer : INT
    Fiddle::TYPE_VOIDP,  # plBytes : INT* optional, out
    Fiddle::TYPE_VOIDP,  # plSamples : INT* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "avifil32")]
extern "system" {
    fn AVIStreamRead(
        pavi: *mut core::ffi::c_void,  // IAVIStream*
        lStart: i32,  // INT
        lSamples: i32,  // INT
        lpBuffer: *mut (),  // void* optional, out
        cbBuffer: i32,  // INT
        plBytes: *mut i32,  // INT* optional, out
        plSamples: *mut i32  // INT* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("AVIFIL32.dll")]
public static extern int AVIStreamRead(IntPtr pavi, int lStart, int lSamples, IntPtr lpBuffer, int cbBuffer, IntPtr plBytes, IntPtr plSamples);
"@
$api = Add-Type -MemberDefinition $sig -Name 'AVIFIL32_AVIStreamRead' -Namespace Win32 -PassThru
# $api::AVIStreamRead(pavi, lStart, lSamples, lpBuffer, cbBuffer, plBytes, plSamples)
#uselib "AVIFIL32.dll"
#func global AVIStreamRead "AVIStreamRead" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; AVIStreamRead pavi, lStart, lSamples, lpBuffer, cbBuffer, varptr(plBytes), varptr(plSamples)   ; 戻り値は stat
; pavi : IAVIStream* -> "sptr"
; lStart : INT -> "sptr"
; lSamples : INT -> "sptr"
; lpBuffer : void* optional, out -> "sptr"
; cbBuffer : INT -> "sptr"
; plBytes : INT* optional, out -> "sptr"
; plSamples : INT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "AVIFIL32.dll"
#cfunc global AVIStreamRead "AVIStreamRead" sptr, int, int, sptr, int, var, var
; res = AVIStreamRead(pavi, lStart, lSamples, lpBuffer, cbBuffer, plBytes, plSamples)
; pavi : IAVIStream* -> "sptr"
; lStart : INT -> "int"
; lSamples : INT -> "int"
; lpBuffer : void* optional, out -> "sptr"
; cbBuffer : INT -> "int"
; plBytes : INT* optional, out -> "var"
; plSamples : INT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT AVIStreamRead(IAVIStream* pavi, INT lStart, INT lSamples, void* lpBuffer, INT cbBuffer, INT* plBytes, INT* plSamples)
#uselib "AVIFIL32.dll"
#cfunc global AVIStreamRead "AVIStreamRead" intptr, int, int, intptr, int, var, var
; res = AVIStreamRead(pavi, lStart, lSamples, lpBuffer, cbBuffer, plBytes, plSamples)
; pavi : IAVIStream* -> "intptr"
; lStart : INT -> "int"
; lSamples : INT -> "int"
; lpBuffer : void* optional, out -> "intptr"
; cbBuffer : INT -> "int"
; plBytes : INT* optional, out -> "var"
; plSamples : INT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	avifil32 = windows.NewLazySystemDLL("AVIFIL32.dll")
	procAVIStreamRead = avifil32.NewProc("AVIStreamRead")
)

// pavi (IAVIStream*), lStart (INT), lSamples (INT), lpBuffer (void* optional, out), cbBuffer (INT), plBytes (INT* optional, out), plSamples (INT* optional, out)
r1, _, err := procAVIStreamRead.Call(
	uintptr(pavi),
	uintptr(lStart),
	uintptr(lSamples),
	uintptr(lpBuffer),
	uintptr(cbBuffer),
	uintptr(plBytes),
	uintptr(plSamples),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function AVIStreamRead(
  pavi: Pointer;   // IAVIStream*
  lStart: Integer;   // INT
  lSamples: Integer;   // INT
  lpBuffer: Pointer;   // void* optional, out
  cbBuffer: Integer;   // INT
  plBytes: Pointer;   // INT* optional, out
  plSamples: Pointer   // INT* optional, out
): Integer; stdcall;
  external 'AVIFIL32.dll' name 'AVIStreamRead';
result := DllCall("AVIFIL32\AVIStreamRead"
    , "Ptr", pavi   ; IAVIStream*
    , "Int", lStart   ; INT
    , "Int", lSamples   ; INT
    , "Ptr", lpBuffer   ; void* optional, out
    , "Int", cbBuffer   ; INT
    , "Ptr", plBytes   ; INT* optional, out
    , "Ptr", plSamples   ; INT* optional, out
    , "Int")   ; return: HRESULT
●AVIStreamRead(pavi, lStart, lSamples, lpBuffer, cbBuffer, plBytes, plSamples) = DLL("AVIFIL32.dll", "int AVIStreamRead(void*, int, int, void*, int, void*, void*)")
# 呼び出し: AVIStreamRead(pavi, lStart, lSamples, lpBuffer, cbBuffer, plBytes, plSamples)
# pavi : IAVIStream* -> "void*"
# lStart : INT -> "int"
# lSamples : INT -> "int"
# lpBuffer : void* optional, out -> "void*"
# cbBuffer : INT -> "int"
# plBytes : INT* optional, out -> "void*"
# plSamples : INT* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。