Author Topic: Bass as Decoder  (Read 348 times)


  • Posts: 13
Bass as Decoder
« on: 19 Jan '18 - 15:18 »
Hello for all members! How i can use bass as decoder in DShow filter? I tried to use BASS_StreamPutData, but it not work :-[
Code: [Select]
constructor TSimpleTransform.Create(ObjName: String; Unk: IUnKnown; out hr: HRESULT);
  inherited Create(ObjName, Unk, CLSID_SimpleTransform);
  BASS_Init(0,44100,  BASS_DEVICE_LATENCY, hr , nil);
  pchan := BASS_StreamCreate(44100, 2, BASS_STREAM_DECODE, STREAMPROC_PUSH, nil);
  crop_bottom := 100;

function TSimpleTransform.Transform(pIn, pOut: IMediaSample): HRESULT;
   hr: HRESULT;
   y: Integer;
   pSourceBuffer, pDestBuffer : PBYTE;
   chan: DWORD;

   // copy attributes
   hr := Copy(pIn, pOut);
   if (FAILED(hr)) then begin
      Result := hr;


    BASS_StreamPutData(pchan, pSourceBuffer, BASS_STREAMPROC_END);

   Result := S_OK;
I think, this code wrong or not full, but i don't have more ideas ???
Sorry for my English, i'm from Uzbekistan.

Ian @ un4seen

  • Administrator
  • Posts: 21539
Re: Bass as Decoder
« Reply #1 on: 19 Jan '18 - 17:03 »
If you have encoded data, you will need to use BASS_StreamCreateFileUser rather than BASS_StreamCreate (which is only for PCM data). You would also then use BASS_StreamPutFileData instead of BASS_StreamPutData. Before you can use BASS_StreamPutFileData, you will need to provide some data to BASS_StreamCreateFileUser via a FILEREADPROC callback function, so that the data's format can be detected and the appropriate decoder initialized. Please see the BASS_StreamCreateFileUser and BASS_FILEPROCS documentation for details.

I'm not sure if they do exactly the same as what you want, but you could have a look at the source code of these existing projects for some ideas/pointers:


  • Posts: 13
Re: Bass as Decoder
« Reply #2 on: 19 Jan '18 - 17:34 »
Thank you very much, i will study the source code DCBassSource