'c conversion in pascal, change parameters in a filter directshow

I have to convert this to free pascal for Lazarus to change parameters in a filter directshow, i have a guide written in c. Filters are : http://sourceforge.net/projects/videoprocessing/ I use only ScaleFilter.dll for resize my video. In SettingsInterface.h to describe how to configure the filter in application.

DEFINE_GUID( IID_ISettingsInterface, /* 388EEF20-40CC-4752-A0FF-66AA5C4AF8FA */
    0x388eef20, 0x40cc, 0x4752, 0xa0, 0xff, 0x66, 0xaa, 0x5c, 0x4a,
    0xf8, 0xfa);
#undef  INTERFACE
#define INTERFACE   ISettingsInterface

DECLARE_INTERFACE_( ISettingsInterface, IUnknown )
{
    /// Method to set parameter named type to value
    STDMETHOD(SetParameter)( const char* type, const char* value) = 0;
}; 

I have translated so:

type
  ISettingsInterface = interface(IUnknown)
    ['{388EEF20-40CC-4752-A0FF-66AA5C4AF8FA}']
  
    function SetParameter(const tipo , valore: bstr): HResult; stdcall;
    //function SetParameter(const tipo , valore: PAnsiChar): HResult; stdcall;
  end;   // bstr -> thanks to Marco Van de Voort
  ...
const 
  targetwidth  = 'targetwidth';
  targetheight = 'targetheight';
  tipowidth    = '720';
  tipoheight   = '576';
  IID_ISettingsInterface : TGUID = '{388EEF20-40CC-4752-A0FF-66AA5C4AF8FA}'; 
var 
  pSettingsInterface :ISettingsInterface;
  ...

ScaleFilter.QueryInterface(IID_ISettingsInterface, pSettingsInterface); 
hr := pSettingsInterface.SetParameter(targetwidth, tipowidth);
hr := pSettingsInterface.SetParameter(targetheight, tipoheight); 
fgRender.Play;
//*******

In run application : hr := pSettingsInterface.SetParameter(targetwidth, tipowidth); // ( External error SIGSEGV );

the parameters in the filter are not changed.

can anyone help me? thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source