AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi bass.dll netradio beispiel mit wma?
Thema durchsuchen
Ansicht
Themen-Optionen

bass.dll netradio beispiel mit wma?

Ein Thema von AlexII · begonnen am 5. Okt 2009 · letzter Beitrag vom 11. Okt 2009
Antwort Antwort
Seite 1 von 2  1 2      
AlexII

Registriert seit: 28. Apr 2008
1.717 Beiträge
 
FreePascal / Lazarus
 
#1

bass.dll netradio beispiel mit wma?

  Alt 5. Okt 2009, 13:09
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...
  Mit Zitat antworten Zitat
Benutzerbild von Gausi
Gausi

Registriert seit: 17. Jul 2005
847 Beiträge
 
Delphi 11 Alexandria
 
#2

Re: bass.dll netradio beispiel mit wma?

  Alt 5. Okt 2009, 14:55
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.
The angels have the phone box.
  Mit Zitat antworten Zitat
AlexII

Registriert seit: 28. Apr 2008
1.717 Beiträge
 
FreePascal / Lazarus
 
#3

Re: bass.dll netradio beispiel mit wma?

  Alt 5. Okt 2009, 16:35
Ne die Buffer-Anzeige funkt auch nicht.
  Mit Zitat antworten Zitat
Wishmaster

Registriert seit: 14. Sep 2002
Ort: Steinbach, MB, Canada
301 Beiträge
 
Delphi XE2 Architect
 
#4

Re: bass.dll netradio beispiel mit wma?

  Alt 6. Okt 2009, 01:36
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;
  Mit Zitat antworten Zitat
AlexII

Registriert seit: 28. Apr 2008
1.717 Beiträge
 
FreePascal / Lazarus
 
#5

Re: bass.dll netradio beispiel mit wma?

  Alt 6. Okt 2009, 20:45
Und wie baut man das in das netradio Beispiel ein? Und wo ist die DoPlayChanBuffering Funktion? Irgendwie blicke ich hier nicht durch.
  Mit Zitat antworten Zitat
AlexII

Registriert seit: 28. Apr 2008
1.717 Beiträge
 
FreePascal / Lazarus
 
#6

Re: bass.dll netradio beispiel mit wma?

  Alt 9. Okt 2009, 18:56
Weiß keiner mehr weiter?
  Mit Zitat antworten Zitat
Wishmaster

Registriert seit: 14. Sep 2002
Ort: Steinbach, MB, Canada
301 Beiträge
 
Delphi XE2 Architect
 
#7

Re: bass.dll netradio beispiel mit wma?

  Alt 9. Okt 2009, 21:42
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;
  Mit Zitat antworten Zitat
AlexII

Registriert seit: 28. Apr 2008
1.717 Beiträge
 
FreePascal / Lazarus
 
#8

Re: bass.dll netradio beispiel mit wma?

  Alt 9. Okt 2009, 21:53
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.
  Mit Zitat antworten Zitat
Wishmaster

Registriert seit: 14. Sep 2002
Ort: Steinbach, MB, Canada
301 Beiträge
 
Delphi XE2 Architect
 
#9

Re: bass.dll netradio beispiel mit wma?

  Alt 9. Okt 2009, 22:38
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;
  Mit Zitat antworten Zitat
AlexII

Registriert seit: 28. Apr 2008
1.717 Beiträge
 
FreePascal / Lazarus
 
#10

Re: bass.dll netradio beispiel mit wma?

  Alt 10. Okt 2009, 11:27
beffering bleibt leider bei 0% stehen
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:19 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz