xVideo.dll

  • hallo Marthog

    die geht natuerlich auch kann aber keine dvd abspielen und unter win7 sieht das video nicht so besonders aus.

    das habe ich bisher probiert.

    [autoit]

    $1 = GUICreate("", 600, 500)

    [/autoit][autoit][/autoit][autoit]

    DllCall("xVideo.dll", "long", "xVideo_Free")
    DllCall("xVideo.dll", "long", "xVideo_Init", "long", "0")

    [/autoit][autoit][/autoit][autoit]

    $chan = DllCall("xVideo.dll", "long", "xVideo_StreamCreateFile", "str", "C:\3.avi", "long", "0", "long", "0"); xVideo_StreamCreateFile(OpenFile.lpstrFile, 0, 0) ;"xVideo.dll" (ByVal strfile As String, ByVal pos As Long, ByVal PCHARflags As Long) As Long

    [/autoit][autoit][/autoit][autoit]

    DllCall("xVideo.dll", "none", "xVideo_ChannelSetWindow", "long", $chan, "ptr", WinGetHandle($1))
    DllCall("xVideo.dll", "long", "xVideo_ChannelPlay", "long", $chan)
    GUISetState()

    [/autoit][autoit][/autoit][autoit]

    Sleep(5000)

    [/autoit]
  • Übernimm die Dllcalls nicht von Basic, sondern von C. Das geht am einfachsten.

    Die entscheidende Datei ist xVideo.h.

    Schreib am Besten erstmal die UDF.
    Hier ist schonmal ein Anfang:

    Spoiler anzeigen
    [autoit]

    Global $__xVideo_DLL ; dll - handle

    [/autoit] [autoit][/autoit] [autoit]

    Func _xVideo_UDF_Open()
    $__xVideo_DLL = DllOpen("xVideo.dll")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _xVideo_UDF_Close()
    DllClose($__xVideo_DLL)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Constanten:
    Global Const $xVideo_VERSION = 0x01020001 ; API version
    Global Const $xVideo_ATTRIB_VOL = 1 ;used to set Audio Volume
    Global Const $xVideo_ATTRIB_PAN = 2 ;used to set Audio Pan
    Global Const $xVideo_ATTRIB_RATE = 3 ;used to set Graph Rate
    Global Const $xVideo_ATTRIB_AspectRatio = 4 ;used to set Aspect Ratio
    Global Const $xVideo_ATTRIB_PITCH = 5 ;used to set Audio Pitch
    Global Const $xVideo_ATTRIB_AVSync = 6 ;used to set Audio/Video Delay
    Global Const $xVideo_ATTRIB_TEMPO = 7 ;used to set Audio Tempo
    Global Const $xVideo_ATTRIB_ChanProcess = 8 ;used to set audio channel to be processed

    [/autoit] [autoit][/autoit] [autoit]

    ; ...

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Funktionen
    Func _xVideo_Init($handle)
    Local $aRet = DllCall($__xVideo_DLL, "BOOL", "xVideo_Init", "hwnd", $handle)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc
    Func _xVideo_GetVersion()
    Local $aRet = DllCall($__xVideo_DLL, "DWORD", "xVideo_GetVersion")
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc
    Func _xVideo_Free()
    Local $aRet = DllCall($__xVideo_DLL, "BOOL", "xVideo_Free")
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc
    Func _xVideo_StreamCreateFile($hStream, $pos, $flags)
    Local $aRet = DllCall($__xVideo_DLL, "HANDLE", "xVideo_StreamCreateFile", "ptr", $hStream, "DWORD", $pos, "DWORD", $flags)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; ...

    [/autoit]

    Mit

    [autoit]

    _xVideo_UDF_Open()

    [/autoit]

    wird die DLL geladen und am Ende mit

    [autoit]

    _xVideo_UDF_Close()

    [/autoit]

    wieder freigegeben. Das ist nicht immer nötig, aber es erspart auf jeden Fall Zeit, weil die Datei nicht jedesmal nu geladen werden muss.


    Dein Skript macht überigens keinen Sinn.
    xVideo_Free gibt den Arbeitsspeicher am Ende wieder frei. Am Anfang hat es nichts zu suchen.
    xVideo_Init erwartet als ersten Parameter nicht 0, sondern das Windowhandle (von GUICreate).

  • habe jetzt bild und ton

    aber das video wird 2 mal angezeigt

    kannst du mir da nochmal helfen?


    [autoit]

    #include <array.au3>

    [/autoit][autoit][/autoit][autoit]

    Global $__xVideo_DLL

    [/autoit][autoit][/autoit][autoit]

    $gui = GUICreate("123", 720, 432)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    _xVideo_UDF_Open()
    _xVideo_Init(WinGetHandle($gui))
    _xVideo_SetConfig("xVideo_VideoRenderer","xVideo_VMR9WindowsLess")
    $hVideoStream = _xVideo_StreamCreateFile("C:\3.avi", 0, 0)
    _xVideo_ChannelAddWindow($hVideoStream, $gui)
    _xVideo_PlayStream($hVideoStream)
    _xVideo_ChannelSetPosition($hVideoStream, 2000, "xVideo_POS_SEC")

    [/autoit][autoit][/autoit][autoit]

    _xVideo_ChannelResizeWindow($hVideoStream, 0, 0, 300, 200)
    ;MsgBox(0, "", _xVideo_ChannelGetPosition($hVideoStream, "xVideo_POS_SEC"))
    GUISetState()
    Sleep(5000)
    _xVideo_UDF_Close()

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    ; Funktionen
    Func _xVideo_Init($handle)
    Local $aRet = DllCall($__xVideo_DLL, "ubyte", "xVideo_Init", "hwnd", $handle)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc
    Func _xVideo_GetVersion()
    Local $aRet = DllCall($__xVideo_DLL, "dword", "xVideo_GetVersion")
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc
    Func _xVideo_Free()
    Local $aRet = DllCall($__xVideo_DLL, "ubyte", "xVideo_Free")
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc
    Func _xVideo_StreamCreateFile($hStream, $pos, $flags)
    Local $aRet = DllCall($__xVideo_DLL, "hwnd", "xVideo_StreamCreateFile", "str", $hStream, "dword", $pos, "dword", $flags)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _xVideo_PlayStream($p)
    Local $aRet = DllCall($__xVideo_DLL, "ubyte", "xVideo_ChannelPlay", "dword", $p)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _xVideo_ChannelAddWindow($chan, $win)
    Local $aRet = DllCall($__xVideo_DLL, "hwnd", "xVideo_ChannelAddWindow", "dword", $chan, "hwnd", $win)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _xVideo_SetConfig($option, $value)
    Local $aRet = DllCall($__xVideo_DLL, "ubyte", "xVideo_SetConfig", "dword", $option, "dword", $value)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _xVideo_ChannelSetPosition($chan, $pos, $mode)
    Local $aRet = DllCall($__xVideo_DLL, "ubyte", "xVideo_ChannelSetPosition", "dword", $chan, "double", $pos, "dword", $mode)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _xVideo_ChannelGetPosition($chan, $mode)
    Local $aRet = DllCall($__xVideo_DLL, "double", "xVideo_ChannelGetPosition", "dword", $chan, "dword", $mode)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _xVideo_ChannelResizeWindow($chan, $left, $top, $right, $bottom)
    Local $aRet = DllCall($__xVideo_DLL, "none", "xVideo_ChannelResizeWindow", "dword", $chan, "int", $left, "int", $top, "int", $right, "int", $bottom)
    If @error Then Return SetError(@error, 0, 0)
    Return $aRet[0]
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _xVideo_UDF_Open()
    $__xVideo_DLL = DllOpen("xVideo.dll")
    If @error Then Return SetError(@error, 0, 0)
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _xVideo_UDF_Close()
    DllCall($__xVideo_DLL, "long", "xVideo_Free")
    DllClose($__xVideo_DLL)
    EndFunc

    [/autoit]