ホーム › Media.Multimedia › AVIStreamReadData
AVIStreamReadData
関数AVIストリームから追加ヘッダーデータを読み込む。
シグネチャ
// AVIFIL32.dll
#include <windows.h>
HRESULT AVIStreamReadData(
IAVIStream* pavi,
DWORD fcc,
void* lp, // optional
INT* lpcb
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pavi | IAVIStream* | in | 開いているストリームへのハンドル。 |
| fcc | DWORD | in | データを識別する 4 文字コード (four-character code)。 |
| lp | void* | outoptional | オプションのヘッダーデータを格納するバッファーへのポインター。 |
| lpcb | INT* | inout | lpData に使用するバッファーサイズを指定する場所へのポインター。読み取りに成功すると、AVIFile はこの値を変更し、lpData 用のバッファーに書き込まれたデータ量を示します。 |
戻り値の型: HRESULT
公式ドキュメント
AVIStreamReadData 関数は、ストリームからオプションのヘッダーデータを読み取ります。
戻り値
成功した場合は 0 を、それ以外の場合はエラーを返します。戻り値 AVIERR_NODATA は、指定されたチャンク識別子を持つデータがシステムで見つからなかったことを示します。
解説(Remarks)
この関数は、ストリームからオプションのヘッダー情報のみを取得します。この情報はカスタムであり、定められた形式はありません。
引数 pavi は、IAVIStream インターフェイスへのポインターです。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// AVIFIL32.dll
#include <windows.h>
HRESULT AVIStreamReadData(
IAVIStream* pavi,
DWORD fcc,
void* lp, // optional
INT* lpcb
);[DllImport("AVIFIL32.dll", ExactSpelling = true)]
static extern int AVIStreamReadData(
IntPtr pavi, // IAVIStream*
uint fcc, // DWORD
IntPtr lp, // void* optional, out
ref int lpcb // INT* in/out
);<DllImport("AVIFIL32.dll", ExactSpelling:=True)>
Public Shared Function AVIStreamReadData(
pavi As IntPtr, ' IAVIStream*
fcc As UInteger, ' DWORD
lp As IntPtr, ' void* optional, out
ByRef lpcb As Integer ' INT* in/out
) As Integer
End Function' pavi : IAVIStream*
' fcc : DWORD
' lp : void* optional, out
' lpcb : INT* in/out
Declare PtrSafe Function AVIStreamReadData Lib "avifil32" ( _
ByVal pavi As LongPtr, _
ByVal fcc As Long, _
ByVal lp As LongPtr, _
ByRef lpcb As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
AVIStreamReadData = ctypes.windll.avifil32.AVIStreamReadData
AVIStreamReadData.restype = ctypes.c_int
AVIStreamReadData.argtypes = [
ctypes.c_void_p, # pavi : IAVIStream*
wintypes.DWORD, # fcc : DWORD
ctypes.POINTER(None), # lp : void* optional, out
ctypes.POINTER(ctypes.c_int), # lpcb : INT* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('AVIFIL32.dll')
AVIStreamReadData = Fiddle::Function.new(
lib['AVIStreamReadData'],
[
Fiddle::TYPE_VOIDP, # pavi : IAVIStream*
-Fiddle::TYPE_INT, # fcc : DWORD
Fiddle::TYPE_VOIDP, # lp : void* optional, out
Fiddle::TYPE_VOIDP, # lpcb : INT* in/out
],
Fiddle::TYPE_INT)#[link(name = "avifil32")]
extern "system" {
fn AVIStreamReadData(
pavi: *mut core::ffi::c_void, // IAVIStream*
fcc: u32, // DWORD
lp: *mut (), // void* optional, out
lpcb: *mut i32 // INT* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("AVIFIL32.dll")]
public static extern int AVIStreamReadData(IntPtr pavi, uint fcc, IntPtr lp, ref int lpcb);
"@
$api = Add-Type -MemberDefinition $sig -Name 'AVIFIL32_AVIStreamReadData' -Namespace Win32 -PassThru
# $api::AVIStreamReadData(pavi, fcc, lp, lpcb)#uselib "AVIFIL32.dll"
#func global AVIStreamReadData "AVIStreamReadData" sptr, sptr, sptr, sptr
; AVIStreamReadData pavi, fcc, lp, varptr(lpcb) ; 戻り値は stat
; pavi : IAVIStream* -> "sptr"
; fcc : DWORD -> "sptr"
; lp : void* optional, out -> "sptr"
; lpcb : INT* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "AVIFIL32.dll" #cfunc global AVIStreamReadData "AVIStreamReadData" sptr, int, sptr, var ; res = AVIStreamReadData(pavi, fcc, lp, lpcb) ; pavi : IAVIStream* -> "sptr" ; fcc : DWORD -> "int" ; lp : void* optional, out -> "sptr" ; lpcb : INT* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "AVIFIL32.dll" #cfunc global AVIStreamReadData "AVIStreamReadData" sptr, int, sptr, sptr ; res = AVIStreamReadData(pavi, fcc, lp, varptr(lpcb)) ; pavi : IAVIStream* -> "sptr" ; fcc : DWORD -> "int" ; lp : void* optional, out -> "sptr" ; lpcb : INT* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT AVIStreamReadData(IAVIStream* pavi, DWORD fcc, void* lp, INT* lpcb) #uselib "AVIFIL32.dll" #cfunc global AVIStreamReadData "AVIStreamReadData" intptr, int, intptr, var ; res = AVIStreamReadData(pavi, fcc, lp, lpcb) ; pavi : IAVIStream* -> "intptr" ; fcc : DWORD -> "int" ; lp : void* optional, out -> "intptr" ; lpcb : INT* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT AVIStreamReadData(IAVIStream* pavi, DWORD fcc, void* lp, INT* lpcb) #uselib "AVIFIL32.dll" #cfunc global AVIStreamReadData "AVIStreamReadData" intptr, int, intptr, intptr ; res = AVIStreamReadData(pavi, fcc, lp, varptr(lpcb)) ; pavi : IAVIStream* -> "intptr" ; fcc : DWORD -> "int" ; lp : void* optional, out -> "intptr" ; lpcb : INT* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
avifil32 = windows.NewLazySystemDLL("AVIFIL32.dll")
procAVIStreamReadData = avifil32.NewProc("AVIStreamReadData")
)
// pavi (IAVIStream*), fcc (DWORD), lp (void* optional, out), lpcb (INT* in/out)
r1, _, err := procAVIStreamReadData.Call(
uintptr(pavi),
uintptr(fcc),
uintptr(lp),
uintptr(lpcb),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction AVIStreamReadData(
pavi: Pointer; // IAVIStream*
fcc: DWORD; // DWORD
lp: Pointer; // void* optional, out
lpcb: Pointer // INT* in/out
): Integer; stdcall;
external 'AVIFIL32.dll' name 'AVIStreamReadData';result := DllCall("AVIFIL32\AVIStreamReadData"
, "Ptr", pavi ; IAVIStream*
, "UInt", fcc ; DWORD
, "Ptr", lp ; void* optional, out
, "Ptr", lpcb ; INT* in/out
, "Int") ; return: HRESULT●AVIStreamReadData(pavi, fcc, lp, lpcb) = DLL("AVIFIL32.dll", "int AVIStreamReadData(void*, dword, void*, void*)")
# 呼び出し: AVIStreamReadData(pavi, fcc, lp, lpcb)
# pavi : IAVIStream* -> "void*"
# fcc : DWORD -> "dword"
# lp : void* optional, out -> "void*"
# lpcb : INT* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "avifil32" fn AVIStreamReadData(
pavi: ?*anyopaque, // IAVIStream*
fcc: u32, // DWORD
lp: ?*anyopaque, // void* optional, out
lpcb: [*c]i32 // INT* in/out
) callconv(std.os.windows.WINAPI) i32;proc AVIStreamReadData(
pavi: pointer, # IAVIStream*
fcc: uint32, # DWORD
lp: pointer, # void* optional, out
lpcb: ptr int32 # INT* in/out
): int32 {.importc: "AVIStreamReadData", stdcall, dynlib: "AVIFIL32.dll".}pragma(lib, "avifil32");
extern(Windows)
int AVIStreamReadData(
void* pavi, // IAVIStream*
uint fcc, // DWORD
void* lp, // void* optional, out
int* lpcb // INT* in/out
);ccall((:AVIStreamReadData, "AVIFIL32.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt32, Ptr{Cvoid}, Ptr{Int32}),
pavi, fcc, lp, lpcb)
# pavi : IAVIStream* -> Ptr{Cvoid}
# fcc : DWORD -> UInt32
# lp : void* optional, out -> Ptr{Cvoid}
# lpcb : INT* in/out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t AVIStreamReadData(
void* pavi,
uint32_t fcc,
void* lp,
int32_t* lpcb);
]]
local avifil32 = ffi.load("avifil32")
-- avifil32.AVIStreamReadData(pavi, fcc, lp, lpcb)
-- pavi : IAVIStream*
-- fcc : DWORD
-- lp : void* optional, out
-- lpcb : INT* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('AVIFIL32.dll');
const AVIStreamReadData = lib.func('__stdcall', 'AVIStreamReadData', 'int32_t', ['void *', 'uint32_t', 'void *', 'int32_t *']);
// AVIStreamReadData(pavi, fcc, lp, lpcb)
// pavi : IAVIStream* -> 'void *'
// fcc : DWORD -> 'uint32_t'
// lp : void* optional, out -> 'void *'
// lpcb : INT* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("AVIFIL32.dll", {
AVIStreamReadData: { parameters: ["pointer", "u32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.AVIStreamReadData(pavi, fcc, lp, lpcb)
// pavi : IAVIStream* -> "pointer"
// fcc : DWORD -> "u32"
// lp : void* optional, out -> "pointer"
// lpcb : INT* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t AVIStreamReadData(
void* pavi,
uint32_t fcc,
void* lp,
int32_t* lpcb);
C, "AVIFIL32.dll");
// $ffi->AVIStreamReadData(pavi, fcc, lp, lpcb);
// pavi : IAVIStream*
// fcc : DWORD
// lp : void* optional, out
// lpcb : INT* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Avifil32 extends StdCallLibrary {
Avifil32 INSTANCE = Native.load("avifil32", Avifil32.class);
int AVIStreamReadData(
Pointer pavi, // IAVIStream*
int fcc, // DWORD
Pointer lp, // void* optional, out
IntByReference lpcb // INT* in/out
);
}@[Link("avifil32")]
lib LibAVIFIL32
fun AVIStreamReadData = AVIStreamReadData(
pavi : Void*, # IAVIStream*
fcc : UInt32, # DWORD
lp : Void*, # void* optional, out
lpcb : Int32* # INT* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef AVIStreamReadDataNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>, Pointer<Int32>);
typedef AVIStreamReadDataDart = int Function(Pointer<Void>, int, Pointer<Void>, Pointer<Int32>);
final AVIStreamReadData = DynamicLibrary.open('AVIFIL32.dll')
.lookupFunction<AVIStreamReadDataNative, AVIStreamReadDataDart>('AVIStreamReadData');
// pavi : IAVIStream* -> Pointer<Void>
// fcc : DWORD -> Uint32
// lp : void* optional, out -> Pointer<Void>
// lpcb : INT* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function AVIStreamReadData(
pavi: Pointer; // IAVIStream*
fcc: DWORD; // DWORD
lp: Pointer; // void* optional, out
lpcb: Pointer // INT* in/out
): Integer; stdcall;
external 'AVIFIL32.dll' name 'AVIStreamReadData';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "AVIStreamReadData"
c_AVIStreamReadData :: Ptr () -> Word32 -> Ptr () -> Ptr Int32 -> IO Int32
-- pavi : IAVIStream* -> Ptr ()
-- fcc : DWORD -> Word32
-- lp : void* optional, out -> Ptr ()
-- lpcb : INT* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let avistreamreaddata =
foreign "AVIStreamReadData"
((ptr void) @-> uint32_t @-> (ptr void) @-> (ptr int32_t) @-> returning int32_t)
(* pavi : IAVIStream* -> (ptr void) *)
(* fcc : DWORD -> uint32_t *)
(* lp : void* optional, out -> (ptr void) *)
(* lpcb : INT* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library avifil32 (t "AVIFIL32.dll"))
(cffi:use-foreign-library avifil32)
(cffi:defcfun ("AVIStreamReadData" avistream-read-data :convention :stdcall) :int32
(pavi :pointer) ; IAVIStream*
(fcc :uint32) ; DWORD
(lp :pointer) ; void* optional, out
(lpcb :pointer)) ; INT* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $AVIStreamReadData = Win32::API::More->new('AVIFIL32',
'int AVIStreamReadData(LPVOID pavi, DWORD fcc, LPVOID lp, LPVOID lpcb)');
# my $ret = $AVIStreamReadData->Call($pavi, $fcc, $lp, $lpcb);
# pavi : IAVIStream* -> LPVOID
# fcc : DWORD -> DWORD
# lp : void* optional, out -> LPVOID
# lpcb : INT* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型