Хотел воспроизвести формат flv, но bass.dll выпадает с ошибкой 41 - не поддерживаемый формат.
Возможно ли как то воспроизвести этот формат с помощью bass.dll ?
RTMPDump ==> http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.4-git-010913-windows.zip
BAS.DLL ==> http://www.signa5.com/autoit/BASS/BASS.zip
Возможно ли как то воспроизвести этот формат с помощью bass.dll ?
Код:
#include <Constants.au3>
#include <Bass.au3>
#include <BassConstants.au3>
Global $playing_state = -1
;Open Bass.DLL. Required for all function calls.
_BASS_STARTUP("BASS.dll")
;Initalize bass. Required for most functions.
_BASS_Init(0, -1, 44100, 0, "")
;Check if bass iniated. If not, we cannot continue.
If @error Then
MsgBox(0, "Error", "Could not initialize audio")
Exit
EndIf
$vSourse = BinaryToString(InetRead('http://101.ru/?an=personal&userid=193366', 3))
$vDertRTMPStream = StringRegExp($vSourse, "\{.*?\,\'file\'\:\'(.*?)\s", 3)
$vClearRTMPStream = StringRegExpReplace($vDertRTMPStream[0], '[\|]uid[\=][\-]\d+[\/][\/]', '')
Local $iPID = Run(@ScriptDir & "\rtmpdump.exe -r " & $vClearRTMPStream & " -o main.flv", @ScriptDir, @SW_SHOW, $STDERR_MERGED)
Local $sOutput = ""
While 1
Sleep(500)
$sOutput &= StdoutRead($iPID)
If @error Then
$sOutput = 'Error'
ExitLoop
EndIf
If StringRegExp($sOutput, '(?is)Starting download', 0) = 1 Then
ExitLoop
EndIf
WEnd
If $sOutput = 'Error' Then Exit
Sleep(3000)
$file = @ScriptDir & '\main.flv'
;Create a stream from that file.
$MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, $BASS_STREAM_AUTOFREE)
;Check if we opened the file correctly.
If @error Then
MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)
Exit
EndIf
;Iniate playback
_BASS_ChannelPlay($MusicHandle, 1)
;Get the length of the song in bytes.
$song_length = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE)
While 1
Sleep(20)
;Get the current position in bytes
$current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE)
;Calculate the percentage
$percent = Round(($current / $song_length) * 100, 0)
;Display that to the user
ToolTip("Completed " & $percent & "%", 0, 0)
;If the song is complete, then exit.
If $current >= $song_length Then ExitLoop
WEnd
Func OnAutoItExit()
;Free Resources
_BASS_Free()
EndFunc ;==>OnAutoItExit
BAS.DLL ==> http://www.signa5.com/autoit/BASS/BASS.zip