Capture WMA Webstream

Started by Thomas Dippel, 23 May '03 - 01:28

Thomas Dippel

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

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

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

Basically, something like this...
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 :)