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

MFCreateTranscodeTopology

関数
ソースとプロファイルからトランスコード用トポロジを生成する。
DLLMF.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT MFCreateTranscodeTopology(
    IMFMediaSource* pSrc,
    LPCWSTR pwszOutputFilePath,
    IMFTranscodeProfile* pProfile,
    IMFTopology** ppTranscodeTopo
);

パラメーター

名前方向
pSrcIMFMediaSource*in
pwszOutputFilePathLPCWSTRin
pProfileIMFTranscodeProfile*in
ppTranscodeTopoIMFTopology**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MFCreateTranscodeTopology(
    IMFMediaSource* pSrc,
    LPCWSTR pwszOutputFilePath,
    IMFTranscodeProfile* pProfile,
    IMFTopology** ppTranscodeTopo
);
[DllImport("MF.dll", ExactSpelling = true)]
static extern int MFCreateTranscodeTopology(
    IntPtr pSrc,   // IMFMediaSource*
    [MarshalAs(UnmanagedType.LPWStr)] string pwszOutputFilePath,   // LPCWSTR
    IntPtr pProfile,   // IMFTranscodeProfile*
    IntPtr ppTranscodeTopo   // IMFTopology** out
);
<DllImport("MF.dll", ExactSpelling:=True)>
Public Shared Function MFCreateTranscodeTopology(
    pSrc As IntPtr,   ' IMFMediaSource*
    <MarshalAs(UnmanagedType.LPWStr)> pwszOutputFilePath As String,   ' LPCWSTR
    pProfile As IntPtr,   ' IMFTranscodeProfile*
    ppTranscodeTopo As IntPtr   ' IMFTopology** out
) As Integer
End Function
' pSrc : IMFMediaSource*
' pwszOutputFilePath : LPCWSTR
' pProfile : IMFTranscodeProfile*
' ppTranscodeTopo : IMFTopology** out
Declare PtrSafe Function MFCreateTranscodeTopology Lib "mf" ( _
    ByVal pSrc As LongPtr, _
    ByVal pwszOutputFilePath As LongPtr, _
    ByVal pProfile As LongPtr, _
    ByVal ppTranscodeTopo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFCreateTranscodeTopology = ctypes.windll.mf.MFCreateTranscodeTopology
MFCreateTranscodeTopology.restype = ctypes.c_int
MFCreateTranscodeTopology.argtypes = [
    ctypes.c_void_p,  # pSrc : IMFMediaSource*
    wintypes.LPCWSTR,  # pwszOutputFilePath : LPCWSTR
    ctypes.c_void_p,  # pProfile : IMFTranscodeProfile*
    ctypes.c_void_p,  # ppTranscodeTopo : IMFTopology** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MF.dll')
MFCreateTranscodeTopology = Fiddle::Function.new(
  lib['MFCreateTranscodeTopology'],
  [
    Fiddle::TYPE_VOIDP,  # pSrc : IMFMediaSource*
    Fiddle::TYPE_VOIDP,  # pwszOutputFilePath : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pProfile : IMFTranscodeProfile*
    Fiddle::TYPE_VOIDP,  # ppTranscodeTopo : IMFTopology** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mf")]
extern "system" {
    fn MFCreateTranscodeTopology(
        pSrc: *mut core::ffi::c_void,  // IMFMediaSource*
        pwszOutputFilePath: *const u16,  // LPCWSTR
        pProfile: *mut core::ffi::c_void,  // IMFTranscodeProfile*
        ppTranscodeTopo: *mut *mut core::ffi::c_void  // IMFTopology** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MF.dll")]
public static extern int MFCreateTranscodeTopology(IntPtr pSrc, [MarshalAs(UnmanagedType.LPWStr)] string pwszOutputFilePath, IntPtr pProfile, IntPtr ppTranscodeTopo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MF_MFCreateTranscodeTopology' -Namespace Win32 -PassThru
# $api::MFCreateTranscodeTopology(pSrc, pwszOutputFilePath, pProfile, ppTranscodeTopo)
#uselib "MF.dll"
#func global MFCreateTranscodeTopology "MFCreateTranscodeTopology" sptr, sptr, sptr, sptr
; MFCreateTranscodeTopology pSrc, pwszOutputFilePath, pProfile, ppTranscodeTopo   ; 戻り値は stat
; pSrc : IMFMediaSource* -> "sptr"
; pwszOutputFilePath : LPCWSTR -> "sptr"
; pProfile : IMFTranscodeProfile* -> "sptr"
; ppTranscodeTopo : IMFTopology** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MF.dll"
#cfunc global MFCreateTranscodeTopology "MFCreateTranscodeTopology" sptr, wstr, sptr, sptr
; res = MFCreateTranscodeTopology(pSrc, pwszOutputFilePath, pProfile, ppTranscodeTopo)
; pSrc : IMFMediaSource* -> "sptr"
; pwszOutputFilePath : LPCWSTR -> "wstr"
; pProfile : IMFTranscodeProfile* -> "sptr"
; ppTranscodeTopo : IMFTopology** out -> "sptr"
; HRESULT MFCreateTranscodeTopology(IMFMediaSource* pSrc, LPCWSTR pwszOutputFilePath, IMFTranscodeProfile* pProfile, IMFTopology** ppTranscodeTopo)
#uselib "MF.dll"
#cfunc global MFCreateTranscodeTopology "MFCreateTranscodeTopology" intptr, wstr, intptr, intptr
; res = MFCreateTranscodeTopology(pSrc, pwszOutputFilePath, pProfile, ppTranscodeTopo)
; pSrc : IMFMediaSource* -> "intptr"
; pwszOutputFilePath : LPCWSTR -> "wstr"
; pProfile : IMFTranscodeProfile* -> "intptr"
; ppTranscodeTopo : IMFTopology** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mf = windows.NewLazySystemDLL("MF.dll")
	procMFCreateTranscodeTopology = mf.NewProc("MFCreateTranscodeTopology")
)

// pSrc (IMFMediaSource*), pwszOutputFilePath (LPCWSTR), pProfile (IMFTranscodeProfile*), ppTranscodeTopo (IMFTopology** out)
r1, _, err := procMFCreateTranscodeTopology.Call(
	uintptr(pSrc),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszOutputFilePath))),
	uintptr(pProfile),
	uintptr(ppTranscodeTopo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MFCreateTranscodeTopology(
  pSrc: Pointer;   // IMFMediaSource*
  pwszOutputFilePath: PWideChar;   // LPCWSTR
  pProfile: Pointer;   // IMFTranscodeProfile*
  ppTranscodeTopo: Pointer   // IMFTopology** out
): Integer; stdcall;
  external 'MF.dll' name 'MFCreateTranscodeTopology';
result := DllCall("MF\MFCreateTranscodeTopology"
    , "Ptr", pSrc   ; IMFMediaSource*
    , "WStr", pwszOutputFilePath   ; LPCWSTR
    , "Ptr", pProfile   ; IMFTranscodeProfile*
    , "Ptr", ppTranscodeTopo   ; IMFTopology** out
    , "Int")   ; return: HRESULT
●MFCreateTranscodeTopology(pSrc, pwszOutputFilePath, pProfile, ppTranscodeTopo) = DLL("MF.dll", "int MFCreateTranscodeTopology(void*, char*, void*, void*)")
# 呼び出し: MFCreateTranscodeTopology(pSrc, pwszOutputFilePath, pProfile, ppTranscodeTopo)
# pSrc : IMFMediaSource* -> "void*"
# pwszOutputFilePath : LPCWSTR -> "char*"
# pProfile : IMFTranscodeProfile* -> "void*"
# ppTranscodeTopo : IMFTopology** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。