![]() |
bass.dll netradio beispiel mit wma?
Kennt jemand von euch ein Beispiel Code wie man mit netradio der bass.dll auch wma-Streams abspielen lassen kann. Aber nicht nur abspielen, sondern auch buffer anzeige, meta usw...
|
Re: bass.dll netradio beispiel mit wma?
Das Abspielen sollte klappen, wenn du vorher über das Plugin-System die bass-wma.dll einbindest. Die Buffer-Anzeige sollte damit auch laufen, in welchem Format die Meta-Informationen (Titel, Interpret, etc.) gesendet werden, weiß ich nicht.
|
Re: bass.dll netradio beispiel mit wma?
Ne die Buffer-Anzeige funkt auch nicht.
|
Re: bass.dll netradio beispiel mit wma?
Delphi-Quellcode:
BASS_SetConfig(BASS_CONFIG_NET_PREBUF, 0); // The prebuffering progress BASS_SetConfig(BASS_CONFIG_WMA_PREBUF, 1); // The WMA prebuffering progress Hint: 'The prebuffering progress can be monitored via BASS_StreamGetFilePosition' 'This option is disabled by default.'
Delphi-Quellcode:
// WMA Prebuffer
if (BASS_StreamGetFilePosition(Channel, BASS_FILEPOS_WMA_BUFFER) <> -1) then repeat progress := BASS_StreamGetFilePosition(Channel, BASS_FILEPOS_WMA_BUFFER); if (progress = DW_ERROR) or (progress = 100) then Break; DoPlayChanBuffering(Progress); // Result until progress >75 else begin DoPlayChanBuffering(Progress); repeat Len:= BASS_StreamGetFilePosition(Channel, BASS_FILEPOS_END); if Len = DW_ERROR then Break; Progress:= (BASS_StreamGetFilePosition(Channel, BASS_FILEPOS_DOWNLOAD) - BASS_StreamGetFilePosition(Channel, BASS_FILEPOS_CURRENT)) * 100 div Len; DoPlayChanBuffering(Progress); // Result until Progress > 75; |
Re: bass.dll netradio beispiel mit wma?
Und wie baut man das in das netradio Beispiel ein? Und wo ist die DoPlayChanBuffering Funktion? :gruebel: Irgendwie blicke ich hier nicht durch.
|
Re: bass.dll netradio beispiel mit wma?
Weiß keiner mehr weiter? :gruebel:
|
Re: bass.dll netradio beispiel mit wma?
Hi
ich weiß schohn weiter. Hast du dir mall die Bass Demos angeschaut? Besonders das netradio Beispiel. DoPlayChanBuffering ist ein Event. Du kannst auch SendMessage(win, WM_INFO_UPDATE, 2, progress) benutzen!
Delphi-Quellcode:
procedure StatusProc(buffer: Pointer; len, user: DWORD); stdcall;
begin if (buffer <> nil) and (len = 0) then SendMessage(win, WM_INFO_UPDATE, 8, DWORD(PChar(buffer))); end; function OpenURL(url: PChar): Integer; var icy: PChar; Len, Progress: DWORD; begin Result := 0; BASS_StreamFree(chan); // close old stream progress := 0; SendMessage(win, WM_INFO_UPDATE, 0, 0); // reset the Labels and trying connecting chan := BASS_StreamCreateURL(url, 0, BASS_STREAM_STATUS, @StatusProc, 0); if (chan = 0) then begin //lets catch the error here inside the Thread // and send it to the WndProc SendMessage(win, WM_INFO_UPDATE, 1, Bass_ErrorGetCode()); // Oops Error end else begin // Progress repeat len := BASS_StreamGetFilePosition(chan, BASS_FILEPOS_END); if (len = DW_Error) then break; // something's gone wrong! (eg. BASS_Free called) progress := (BASS_StreamGetFilePosition(chan, BASS_FILEPOS_DOWNLOAD) - BASS_StreamGetFilePosition(chan, BASS_FILEPOS_CURRENT)) * 100 div len; // percentage of buffer filled SendMessage(win, WM_INFO_UPDATE, 2, progress); // show the Progess value in the label until progress > 75; // get the broadcast name and bitrate icy := BASS_ChannelGetTags(chan, BASS_TAG_ICY); if (icy = nil) then icy := BASS_ChannelGetTags(chan, BASS_TAG_HTTP); // no ICY tags, try HTTP if (icy <> nil) then while (icy^ <> #0) do begin if (Copy(icy, 1, 9) = 'icy-name:') then SendMessage(win, WM_INFO_UPDATE, 3, DWORD(PChar(Copy(icy, 10, MaxInt)))) else if (Copy(icy, 1, 7) = 'icy-br:') then SendMessage(win, WM_INFO_UPDATE, 4, DWORD(PChar('bitrate: ' + Copy(icy, 8, MaxInt)))); icy := icy + Length(icy) + 1; end; // get the stream title and set sync for subsequent titles DoMeta(); BASS_ChannelSetSync(chan, BASS_SYNC_META, 0, @MetaSync, 0); // play it! BASS_ChannelPlay(chan, FALSE); end; cthread := 0; end; |
Re: bass.dll netradio beispiel mit wma?
Verzeih... irgendwie verstehe ich dich nicht. Der Code kann ja kein wma Buffer anzeigen und wie man dein Code im Post #4 in das Beispiel integriert hab ich noch nicht verstanden, verzeih. :gruebel:
|
Re: bass.dll netradio beispiel mit wma?
Delphi-Quellcode:
procedure StatusProc(buffer: Pointer; len, user: DWORD); stdcall;
begin if (buffer <> nil) and (len = 0) then SendMessage(win, WM_INFO_UPDATE, 8, DWORD(PChar(buffer))); end; function OpenURL(url: PChar): Integer; var icy: PChar; Len, Progress: DWORD; begin Result := 0; BASS_StreamFree(chan); // close old stream progress := 0; SendMessage(win, WM_INFO_UPDATE, 0, 0); // reset the Labels and trying connecting chan := BASS_StreamCreateURL(url, 0, BASS_STREAM_STATUS, @StatusProc, 0); if (chan = 0) then begin //lets catch the error here inside the Thread // and send it to the WndProc SendMessage(win, WM_INFO_UPDATE, 1, Bass_ErrorGetCode()); // Oops Error end else begin // Progress { du kannst auch den channel Type überprüfen (BASS_ChannelGetInfo BASS_CTYPE_STREAM_WMA ) } // WMA Prebuffer if (BASS_StreamGetFilePosition(chan , BASS_FILEPOS_WMA_BUFFER) <> -1) then repeat progress := BASS_StreamGetFilePosition(chan , BASS_FILEPOS_WMA_BUFFER); if (progress = DW_ERROR) or (progress = 100) then Break; SendMessage(win, WM_INFO_UPDATE, 2, progress); // show the Progess value in the label until progress >75 else repeat len := BASS_StreamGetFilePosition(chan, BASS_FILEPOS_END); if (len = DW_Error) then break; // something's gone wrong! (eg. BASS_Free called) progress := (BASS_StreamGetFilePosition(chan, BASS_FILEPOS_DOWNLOAD) - BASS_StreamGetFilePosition(chan, BASS_FILEPOS_CURRENT)) * 100 div len; // percentage of buffer filled SendMessage(win, WM_INFO_UPDATE, 2, progress); // show the Progess value in the label until progress > 75; // get the broadcast name and bitrate icy := BASS_ChannelGetTags(chan, BASS_TAG_ICY); if (icy = nil) then icy := BASS_ChannelGetTags(chan, BASS_TAG_HTTP); // no ICY tags, try HTTP if (icy <> nil) then while (icy^ <> #0) do begin if (Copy(icy, 1, 9) = 'icy-name:') then SendMessage(win, WM_INFO_UPDATE, 3, DWORD(PChar(Copy(icy, 10, MaxInt)))) else if (Copy(icy, 1, 7) = 'icy-br:') then SendMessage(win, WM_INFO_UPDATE, 4, DWORD(PChar('bitrate: ' + Copy(icy, 8, MaxInt)))); icy := icy + Length(icy) + 1; end; // get the stream title and set sync for subsequent titles DoMeta(); BASS_ChannelSetSync(chan, BASS_SYNC_META, 0, @MetaSync, 0); // play it! BASS_ChannelPlay(chan, FALSE); end; cthread := 0; end; |
Re: bass.dll netradio beispiel mit wma?
beffering bleibt leider bei 0% stehen :gruebel:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:44 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz