G
Guest
Hello,
I am using a video encoder from an existing DLL (MSFCEnc.dll, from Microsoft
Portrait). I manage to call the DLL functions, but one of them, the
setParams(), always returns false... I would like to check with you that I
used the correct correspondance between C++ parameters and C# ones.
C++:
//Set parameters before start compressing
MSFCENC_API HRESULT MSFCEnc_SetParams(
DWORD dwBandwidth, // [in] bps
int nFrameRate, // [in] default 15 fps
int nKeyFrameInterval, // [in] default 5 second
int nVersion, // [in] must be 2
int nOutputBitCount, // [in] 16 or 24, represent RGB565 and RGB24 format
respectively
BOOL bQualityImprove);
C#:
[DllImport("MSFCEnc.dll", EntryPoint="?MSFCEnc_SetParams@@YAJKHHHHH@Z")]
public static extern UInt32 SetParams(
UInt32 dwBandwidth,
Int32 nFrameRate,
Int32 nKeyFrameInterval,
Int32 nVersion,
Int32 nOutputBitCount,
Boolean bQualityImprove );
Call to the method:
UInt32 bandwidth = 56000;
Int32 frameRate = 15;
Int32 keyFrameInterval = 5;
Int32 version = 2;
Int32 outputBitCount = 24;
Boolean autoQualityImprove = true;
UInt32 paramOk = Encoder.SetParams(
bandwidth,
frameRate,
keyFrameInterval,
version,
outputBitCount,
autoQualityImprove);
paramOk always equals S_FALSE (1). I don't know if it is because of wrong
marshalling or because of badly chosen parameters values...
Thanks for the help,
Lionel Reyero
I am using a video encoder from an existing DLL (MSFCEnc.dll, from Microsoft
Portrait). I manage to call the DLL functions, but one of them, the
setParams(), always returns false... I would like to check with you that I
used the correct correspondance between C++ parameters and C# ones.
C++:
//Set parameters before start compressing
MSFCENC_API HRESULT MSFCEnc_SetParams(
DWORD dwBandwidth, // [in] bps
int nFrameRate, // [in] default 15 fps
int nKeyFrameInterval, // [in] default 5 second
int nVersion, // [in] must be 2
int nOutputBitCount, // [in] 16 or 24, represent RGB565 and RGB24 format
respectively
BOOL bQualityImprove);
C#:
[DllImport("MSFCEnc.dll", EntryPoint="?MSFCEnc_SetParams@@YAJKHHHHH@Z")]
public static extern UInt32 SetParams(
UInt32 dwBandwidth,
Int32 nFrameRate,
Int32 nKeyFrameInterval,
Int32 nVersion,
Int32 nOutputBitCount,
Boolean bQualityImprove );
Call to the method:
UInt32 bandwidth = 56000;
Int32 frameRate = 15;
Int32 keyFrameInterval = 5;
Int32 version = 2;
Int32 outputBitCount = 24;
Boolean autoQualityImprove = true;
UInt32 paramOk = Encoder.SetParams(
bandwidth,
frameRate,
keyFrameInterval,
version,
outputBitCount,
autoQualityImprove);
paramOk always equals S_FALSE (1). I don't know if it is because of wrong
marshalling or because of badly chosen parameters values...
Thanks for the help,
Lionel Reyero