Author Topic: Bass_DRM  (Read 1917 times)

Duncan Edwards

  • Guest
Bass_DRM
« on: 27 Mar '09 - 15:57 »
If I perform this step:

Once you have received your stub library from Microsoft, you can request the BASSWMA object files to link with it and build your DRM-enabled BASSWMA.

can I potentially use BASSWMA to progressively play DRMed WMA files?  So basically, start playing partially downloaded DRMed WMA files as they are downloading.

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: Bass_DRM
« Reply #1 on: 27 Mar '09 - 16:27 »
Do you mean playing a file with BASSWMA while something else is downloading it? I'm not sure about that (you could try it with non-DRM files first), but streaming/playing the file from the server should be fine; it should also be possible to have it save a local copy via the IWMReaderAdvanced2::SaveFileAs function, which is accessible via BASS_WMA_GetWMObject.

Duncan Edwards

  • Guest
Re: Bass_DRM
« Reply #2 on: 27 Mar '09 - 16:32 »
Sorry, I guess I wasn't clear.  I basically mean playing a Windows Media Audio file whilst also saving it to the drive at the same time - so that I don't have to download the file again but can play it locally.

So, as far as I can tell, that is a yes then?

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: Bass_DRM
« Reply #3 on: 27 Mar '09 - 16:59 »
Yes. I tried streaming and saving (as described above) a DRM file from a web-server just now, and it was fine. If you have some other setup in mind, you could test it with non-DRM files first, before going to the trouble of getting a DRM stub library, etc...

Duncan Edwards

  • Guest
Re: Bass_DRM
« Reply #4 on: 27 Mar '09 - 17:53 »
That sounds great Ian.  I've looked at a test that an existing developer here has done, and it utilises the BASS_StreamCreateFile method (passing a memory pointer as opposed to a file name).  Is this the best way to go for DRM protected files, or is there a better way?

Ian @ un4seen

  • Administrator
  • Posts: 20437
Re: Bass_DRM
« Reply #5 on: 30 Mar '09 - 14:44 »
Do you mean for streaming and saving a local copy? If so, what I did is use BASS_StreamCreateURL to stream the file from the server, and then IWMReaderAdvanced2::SaveFileAs to save a local copy of it, something like this...

Code: [Select]
bool SaveLocalCopy(HSTREAM stream, const WCHAR *filename)
{
IWMReader *wmr=(IWMReader*)BASS_WMA_GetWMObject(stream);
if (!wmr) return false;
IWMReaderAdvanced2 *wmra2;
if (FAILED(wmr->QueryInterface(IID_IWMReaderAdvanced2, &wmra2))) return false;
HRESULT r=wmra2->SaveFileAs(filename);
wmra2->Release();
return SUCCEEDED(r);
}

To play the local copy, you can use the filename in a BASS_StreamCreate call. I don't think there is really anything to be gained by pre-loading the file to memory first.

Note that in order to use BASS_StreamCreateFile/URL with WMA files, BASSWMA must first be loaded as a plugin via BASS_PluginLoad.