19 Jun '13 - 03:15 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: WMA buffer progress  (Read 2469 times)
rogier21
Posts: 33


« on: 5 Jul '08 - 19:08 »
Reply with quoteQuote

Hello,

I have a few questions about the WMA plugin.

Why does WMA does not have the BASS_WMA_StreamCreateURL, like BASS_FLAC_StreamCreateURL and BASS_AAC_StreamCreateURL, not really important, but then I would be able to attach a DOWNLOADPROC...

And how can I realize prebuffering of WMA streams? If I call BASS_WMA_StreamCreateFile I found out that the program does not continue untill buffering is actually complete and playing, not like BASS_StreamCreateURL...

Third thing I noticed, how does BASS_TAG_WMA_META work?
I am not able to retrieve the current song with BASS_TAG_WMA, but according the manual BASS_TAG_WMA_META should do it, but it will always return nil Sad For example: mms://talpa06.streaming.is.nl/20001-VP Plays fine, but no BASS_TAG_WMA_META.

Can you see whats wrong with the first stream of this file? It plays fine in WMP, but not in bass.
http://www.radiodigitaal.nl/asx/radio538/538stream.asx
Thanks!
« Last Edit: 5 Jul '08 - 20:01 by rogier21 » Logged
radio42
Posts: 4030


« Reply #1 on: 5 Jul '08 - 20:28 »
Reply with quoteQuote

IN which language do you program?
Logged
rogier21
Posts: 33


« Reply #2 on: 5 Jul '08 - 21:20 »
Reply with quoteQuote

IN which language do you program?
Sorry forgot to mention, in Delphi.
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #3 on: 6 Jul '08 - 15:54 »
Reply with quoteQuote

Why does WMA does not have the BASS_WMA_StreamCreateURL, like BASS_FLAC_StreamCreateURL and BASS_AAC_StreamCreateURL, not really important, but then I would be able to attach a DOWNLOADPROC...

The other add-ons use BASS's file routines, but WMA streams are handled by the Windows Media modules, which unfortunately do not allow downloading and playing at the same time; only one or the other. So a DOWNLOADPROC is not possible.

And how can I realize prebuffering of WMA streams? If I call BASS_WMA_StreamCreateFile I found out that the program does not continue untill buffering is actually complete and playing, not like BASS_StreamCreateURL...

As of 2.4, BASS_WMA_StreamCreateFile shouldn't actually prebuffer at all by default (BASS_CONFIG_WMA_PREBUF can be used to change that). Also, BASS_ChannelPlay shouldn't be held-up by prebuffering either. Instead, playback will start stalled and be resumed once prebuffering is complete.

If you want to monitor the prebuffering progress, you can do so using BASS_StreamGetFilePosition (BASS_FILEPOS_WMA_BUFFER).

Third thing I noticed, how does BASS_TAG_WMA_META work?
I am not able to retrieve the current song with BASS_TAG_WMA, but according the manual BASS_TAG_WMA_META should do it, but it will always return nil Sad For example: mms://talpa06.streaming.is.nl/20001-VP Plays fine, but no BASS_TAG_WMA_META.

BASS_TAG_WMA_META gives the most recent mid-stream tag (script) to be received in the WMA stream. Most WMA streams do not include any, but the WMALIVE example does (the "Caption" box), so you could use that to test things.

Can you see whats wrong with the first stream of this file? It plays fine in WMP, but not in bass.
http://www.radiodigitaal.nl/asx/radio538/538stream.asx

That ASX file appears to contain only 1 stream at this time, and it's playing fine here Smiley

Perhaps it was a temporary server problem that you experienced?
Logged
rogier21
Posts: 33


« Reply #4 on: 7 Jul '08 - 12:59 »
Reply with quoteQuote

Hello Ian,

Thanks for your reply, I have played around with it and went through the docs a few more times but I still have some issues where you maybe can shine a light on Smiley

Quote
As of 2.4, BASS_WMA_StreamCreateFile shouldn't actually prebuffer at all by default (BASS_CONFIG_WMA_PREBUF can be used to change that). Also, BASS_ChannelPlay shouldn't be held-up by prebuffering either. Instead, playback will start stalled and be resumed once prebuffering is complete.

If you want to monitor the prebuffering progress, you can do so using BASS_StreamGetFilePosition (BASS_FILEPOS_WMA_BUFFER).
I tried to use the same routine as I would monitor a 'normal' streams progress:
Channel := BASS_WMA_StreamCreateFile(False, PChar(URL), 0, 0, BASS_STREAM_DECODE);
      repeat
        Len := BASS_StreamGetFilePosition (Channel , BASS_FILEPOS_WMA_BUFFER);
        if (Len = DW_Error) then
          Break;
        Progress := (BASS_StreamGetFilePosition(Channel , BASS_FILEPOS_DOWNLOAD) -
                    BASS_StreamGetFilePosition(Channel , BASS_FILEPOS_CURRENT))
                    * 100 div len;
        SendMessage(win, WM_UPDATE_STATUS, DWORD(Ch), DWORD(PChar(Format('Buffering %d%%',[Progress]))));
      until
        Progress > 75;
edit: But now I read the manual again, and I came with this, seems to work Smiley (it does not update very fast thoe)
          Len := BASS_StreamGetFilePosition (Channel[Ch].Mp3, BASS_FILEPOS_WMA_BUFFER);
          if (Len = DW_Error) then
            Break;
          Progress := Len;
          SendMessage(win, WM_UPDATE_STATUS, DWORD(Ch), DWORD(PChar(Format('Buffering %d%%',[Len]))));

Quote
BASS_TAG_WMA_META gives the most recent mid-stream tag (script) to be received in the WMA stream. Most WMA streams do not include any, but the WMALIVE example does (the "Caption" box), so you could use that to test things.
Same here, tried with the wmalive example, the Title box is read out fine, with BASS_TAG_WMA, but if I want to read out the Captaion, and use BASS_TAG_WMA_META, I get nil Sad To read out all the lines I tried:
  Meta := BASS_ChannelGetTags(Channel, BASS_TAG_WMA_META);
  ShowMessage(Meta);
  if Meta <> nil then
  begin
    while Meta^ <> #0 do
    begin
      ShowMessage(Meta);
      Meta := Meta + Length(Meta) + 1;
    end;
  end;
But no luck...

Quote
That ASX file appears to contain only 1 stream at this time, and it's playing fine here Smiley

Perhaps it was a temporary server problem that you experienced?
Hm true, I swear it was six before Smiley But still, if I want to load this ASX directly in bass it will give me the error BASS_ERROR_FILEFORM.

It works at yours?
« Last Edit: 7 Jul '08 - 14:59 by rogier21 » Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #5 on: 7 Jul '08 - 14:59 »
Reply with quoteQuote

I tried to use the same routine as I would monitor a 'normal' streams progress:
Channel := BASS_WMA_StreamCreateFile(False, PChar(URL), 0, 0, BASS_STREAM_DECODE);
      repeat
        Len := BASS_StreamGetFilePosition (Channel , BASS_FILEPOS_WMA_BUFFER);
        if (Len = DW_Error) then
          Break;
        Progress := (BASS_StreamGetFilePosition(Channel , BASS_FILEPOS_DOWNLOAD) -
                    BASS_StreamGetFilePosition(Channel , BASS_FILEPOS_CURRENT))
                    * 100 div len;
        SendMessage(win, WM_UPDATE_STATUS, DWORD(Ch), DWORD(PChar(Format('Buffering %d%%',[Progress]))));
      until
        Progress > 75;
But the len always gives 0, not -1, just 0... I tried also with the wmalive example.

BASS_FILEPOS_WMA_BUFFER is actually the buffering progress as a percentage. So you could just do this...

        Progress := BASS_StreamGetFilePosition (Channel , BASS_FILEPOS_WMA_BUFFER);

Same here, tried with the wmalive example, the Title box is read out fine, with BASS_TAG_WMA, but if I want to read out the Captaion, and use BASS_TAG_WMA_META, I get nil Sad

When are you attempting to read the META tag? Note that they come mid-stream, so are unlikely to be available immediately following creation of the stream. I suggest using a BASS_SYNC_WMA_META sync to be informed of their arrival.

...if I want to load this ASX directly in bass it will give me the error BASS_ERROR_FILEFORM.

It works at yours?

Yep, the ASX is also playing fine here, but the BASS_CONFIG_NET_PLAYLIST option needs to be enabled first Smiley
Logged
rogier21
Posts: 33


« Reply #6 on: 7 Jul '08 - 15:05 »
Reply with quoteQuote

Ah ok the SYNC might do it, yes I tried to read the meta directly after start.

I just edited my previous post with the buffer yeah Cheesy That's much easier, it does say in the manual, I just read over it Smiley

BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST, 1);
Is enabled, but the ASX does not want to load. Is it possible you have to FORCE it to load in WMA? Because I do it like this:
    Channel[Ch].Mp3 := BASS_StreamCreateURL(PChar(URL), 0, BASS_STREAM_DECODE, nil, nil);

    // Try WMA
    if Channel[Ch].Mp3 = 0 then
    begin
      Channel[Ch].Mp3 := BASS_WMA_StreamCreateFile(False, PChar(URL), 0, 0, BASS_STREAM_DECODE);
      if Channel[Ch].Mp3 > 0 then
        IsWMA := True;
    end;
    // Try FLAC
    if Channel[Ch].Mp3 = 0 then
      Channel[Ch].Mp3 := BASS_FLAC_StreamCreateURL(PChar(URL), 0, BASS_STREAM_DECODE, nil, nil);

    // Try AAC
    if Channel[Ch].Mp3 = 0 then
      Channel[Ch].Mp3 := BASS_AAC_StreamCreateURL(PChar(URL), 0, BASS_STREAM_DECODE, nil, nil);

Thanks for your help!
Logged
Ian @ un4seen
Administrator
Posts: 15363


« Reply #7 on: 7 Jul '08 - 17:08 »
Reply with quoteQuote

I should have also mentioned that the BASS_CONFIG_NET_PLAYLIST option applies to the standard stream creation functions, eg. BASS_StreamCreateURL. So BASSWMA would have to be loaded as a plugin (via BASS_PluginLoad) in order to take advantage of it. I would suggest using the plugin system anyway, instead of a bunch of "if" Smiley
Logged
rogier21
Posts: 33


« Reply #8 on: 7 Jul '08 - 19:17 »
Reply with quoteQuote

I should have also mentioned that the BASS_CONFIG_NET_PLAYLIST option applies to the standard stream creation functions, eg. BASS_StreamCreateURL. So BASSWMA would have to be loaded as a plugin (via BASS_PluginLoad) in order to take advantage of it. I would suggest using the plugin system anyway, instead of a bunch of "if" Smiley
That did the trick Cheesy

I have it all working now, thanks for your help Ian.
« Last Edit: 8 Jul '08 - 12:06 by rogier21 » Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines