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

MFCreateASFIndexerByteStream

関数
ASFインデックス用のバイトストリームを生成する。
DLLMF.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT MFCreateASFIndexerByteStream(
    IMFByteStream* pIContentByteStream,
    ULONGLONG cbIndexStartOffset,
    IMFByteStream** pIIndexByteStream
);

パラメーター

名前方向説明
pIContentByteStreamIMFByteStream*inASF コンテンツ本体を読み出す元の IMFByteStream ポインタ。
cbIndexStartOffsetULONGLONGinインデックスが始まるストリーム内のバイトオフセット。
pIIndexByteStreamIMFByteStream**outインデックス用に生成された IMFByteStream を受け取る出力ポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MFCreateASFIndexerByteStream(
    IMFByteStream* pIContentByteStream,
    ULONGLONG cbIndexStartOffset,
    IMFByteStream** pIIndexByteStream
);
[DllImport("MF.dll", ExactSpelling = true)]
static extern int MFCreateASFIndexerByteStream(
    IntPtr pIContentByteStream,   // IMFByteStream*
    ulong cbIndexStartOffset,   // ULONGLONG
    IntPtr pIIndexByteStream   // IMFByteStream** out
);
<DllImport("MF.dll", ExactSpelling:=True)>
Public Shared Function MFCreateASFIndexerByteStream(
    pIContentByteStream As IntPtr,   ' IMFByteStream*
    cbIndexStartOffset As ULong,   ' ULONGLONG
    pIIndexByteStream As IntPtr   ' IMFByteStream** out
) As Integer
End Function
' pIContentByteStream : IMFByteStream*
' cbIndexStartOffset : ULONGLONG
' pIIndexByteStream : IMFByteStream** out
Declare PtrSafe Function MFCreateASFIndexerByteStream Lib "mf" ( _
    ByVal pIContentByteStream As LongPtr, _
    ByVal cbIndexStartOffset As LongLong, _
    ByVal pIIndexByteStream As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFCreateASFIndexerByteStream = ctypes.windll.mf.MFCreateASFIndexerByteStream
MFCreateASFIndexerByteStream.restype = ctypes.c_int
MFCreateASFIndexerByteStream.argtypes = [
    ctypes.c_void_p,  # pIContentByteStream : IMFByteStream*
    ctypes.c_ulonglong,  # cbIndexStartOffset : ULONGLONG
    ctypes.c_void_p,  # pIIndexByteStream : IMFByteStream** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MF.dll')
MFCreateASFIndexerByteStream = Fiddle::Function.new(
  lib['MFCreateASFIndexerByteStream'],
  [
    Fiddle::TYPE_VOIDP,  # pIContentByteStream : IMFByteStream*
    -Fiddle::TYPE_LONG_LONG,  # cbIndexStartOffset : ULONGLONG
    Fiddle::TYPE_VOIDP,  # pIIndexByteStream : IMFByteStream** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mf")]
extern "system" {
    fn MFCreateASFIndexerByteStream(
        pIContentByteStream: *mut core::ffi::c_void,  // IMFByteStream*
        cbIndexStartOffset: u64,  // ULONGLONG
        pIIndexByteStream: *mut *mut core::ffi::c_void  // IMFByteStream** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MF.dll")]
public static extern int MFCreateASFIndexerByteStream(IntPtr pIContentByteStream, ulong cbIndexStartOffset, IntPtr pIIndexByteStream);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MF_MFCreateASFIndexerByteStream' -Namespace Win32 -PassThru
# $api::MFCreateASFIndexerByteStream(pIContentByteStream, cbIndexStartOffset, pIIndexByteStream)
#uselib "MF.dll"
#func global MFCreateASFIndexerByteStream "MFCreateASFIndexerByteStream" sptr, sptr, sptr
; MFCreateASFIndexerByteStream pIContentByteStream, cbIndexStartOffset, pIIndexByteStream   ; 戻り値は stat
; pIContentByteStream : IMFByteStream* -> "sptr"
; cbIndexStartOffset : ULONGLONG -> "sptr"
; pIIndexByteStream : IMFByteStream** out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MF.dll"
#cfunc global MFCreateASFIndexerByteStream "MFCreateASFIndexerByteStream" sptr, int64, sptr
; res = MFCreateASFIndexerByteStream(pIContentByteStream, cbIndexStartOffset, pIIndexByteStream)
; pIContentByteStream : IMFByteStream* -> "sptr"
; cbIndexStartOffset : ULONGLONG -> "int64"
; pIIndexByteStream : IMFByteStream** out -> "sptr"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; HRESULT MFCreateASFIndexerByteStream(IMFByteStream* pIContentByteStream, ULONGLONG cbIndexStartOffset, IMFByteStream** pIIndexByteStream)
#uselib "MF.dll"
#cfunc global MFCreateASFIndexerByteStream "MFCreateASFIndexerByteStream" intptr, int64, intptr
; res = MFCreateASFIndexerByteStream(pIContentByteStream, cbIndexStartOffset, pIIndexByteStream)
; pIContentByteStream : IMFByteStream* -> "intptr"
; cbIndexStartOffset : ULONGLONG -> "int64"
; pIIndexByteStream : IMFByteStream** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mf = windows.NewLazySystemDLL("MF.dll")
	procMFCreateASFIndexerByteStream = mf.NewProc("MFCreateASFIndexerByteStream")
)

// pIContentByteStream (IMFByteStream*), cbIndexStartOffset (ULONGLONG), pIIndexByteStream (IMFByteStream** out)
r1, _, err := procMFCreateASFIndexerByteStream.Call(
	uintptr(pIContentByteStream),
	uintptr(cbIndexStartOffset),
	uintptr(pIIndexByteStream),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MFCreateASFIndexerByteStream(
  pIContentByteStream: Pointer;   // IMFByteStream*
  cbIndexStartOffset: UInt64;   // ULONGLONG
  pIIndexByteStream: Pointer   // IMFByteStream** out
): Integer; stdcall;
  external 'MF.dll' name 'MFCreateASFIndexerByteStream';
result := DllCall("MF\MFCreateASFIndexerByteStream"
    , "Ptr", pIContentByteStream   ; IMFByteStream*
    , "Int64", cbIndexStartOffset   ; ULONGLONG
    , "Ptr", pIIndexByteStream   ; IMFByteStream** out
    , "Int")   ; return: HRESULT
●MFCreateASFIndexerByteStream(pIContentByteStream, cbIndexStartOffset, pIIndexByteStream) = DLL("MF.dll", "int MFCreateASFIndexerByteStream(void*, qword, void*)")
# 呼び出し: MFCreateASFIndexerByteStream(pIContentByteStream, cbIndexStartOffset, pIIndexByteStream)
# pIContentByteStream : IMFByteStream* -> "void*"
# cbIndexStartOffset : ULONGLONG -> "qword"
# pIIndexByteStream : IMFByteStream** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。