Author Topic: Capture WMA Webstream  (Read 3363 times)

Thomas Dippel

  • Guest
Capture WMA Webstream
« on: 23 May '03 - 01:28 »
Hi.
I'm wondering if it is possible to open a WMA webstream and save a copy to the disk, like the BASS_StreamCreateURL function for mp3-streams.

I would be very interested in an example in vb.net.

Hope someone can help me :-)

Ian @ un4seen

  • Administrator
  • Posts: 26028
Re: Capture WMA Webstream
« Reply #1 on: 23 May '03 - 13:44 »
You can't currently get the encoded WMA data. It may be possible to add that option in the next release. In the meantime, you'ld have to re-encode the decoded sample data.

Thomas Dippel

  • Guest
Re: Capture WMA Webstream
« Reply #2 on: 23 May '03 - 18:09 »
Ok. Looking forward to the option...
But in the meantime, do you have an example of how to re-encode the decoded sample data from a WMAStream?

Ian @ un4seen

  • Administrator
  • Posts: 26028
Re: Capture WMA Webstream
« Reply #3 on: 24 May '03 - 16:44 »
Basically, something like this...
Code: [Select]
HSTREAM wmahandle;
HWMENCODE encoder;

...

DWORD freq,mono;
wmahandle=BASS_WMA_StreamCreateFile(...);
BASS_ChannelGetAttributes(wmahandle,&freq,0,0);
mono=BASS_ChannelGetFlags(wmahandle)&BASS_SAMPLE_MONO;
encoder=BASS_WMA_EncodeOpenFile(freq,mono,bitrate,filename);
BASS_ChannelSetDSP(wmahandle,&EncoderProc,0);

...

void CALLBACK EncoderProc(HDSP handle,DWORD channel,void *buffer,DWORD length,DWORD user)
{
     BASS_WMA_EncodeWrite(encoder,buffer,length);
}

You could also use BASS_StreamGetTags and BASS_WMA_EncodeSetTag to get the original bitrate and copy the tags to the new file, if you want to be really clever :)