Einzelnen Beitrag anzeigen

Benutzerbild von Gausi
Gausi

Registriert seit: 17. Jul 2005
900 Beiträge
 
Delphi 11 Alexandria
 
#4

Re: bitrate eines streams ermitteln?

  Alt 20. Mai 2010, 16:56
Das geht über Bass_ChannelGetTags mit BASS_TAG_HTTP oder BASS_TAG_ICY als zweiten Parameter. Das könnte dann z.B. so aussehen:

Delphi-Quellcode:
procedure MyPlayerClass.GetURLDetails;
var
  icy: PAnsiChar;
begin
    icy := BASS_ChannelGetTags(Self.MainStream, BASS_TAG_ICY);
    if icy = Nil then
      icy := BASS_ChannelGetTags(Self.MainStream, BASS_TAG_HTTP);

    if (icy <> nil) then
    begin
        while (icy^ <> #0) do
        begin
          if (Copy(icy, 1, 9) = 'icy-name:') then
            Self.Description := Copy(icy, 10, Length(icy) - 9)
          else
            if (Copy(icy, 1, 7) = 'icy-br:') then
              Self.Bitrate := StrTointDef(Copy(icy, 8, Length(icy) - 7),-1)
            else
              if (Copy(icy,1,10) = 'icy-genre:') then
                Self.Genre := Copy(icy, 11, Length(icy) - 10 )
  
          icy := icy + Length(icy) + 1;
        end;
    end;
end;
Being smart will count for nothing if you don't make the world better. You have to use your smarts to count for something, to serve life, not death.
  Mit Zitat antworten Zitat