09-23-2009 06:18 AM
Hello!
I try to implement following C# Function in LabVIEW:
// Set the Framerate, and video size
private void SetConfigParms(IPin pStill, int iWidth, int iHeight, short iBPP)
{
int hr;
AMMediaType media;
VideoInfoHeader v;
IAMStreamConfig videoStreamConfig = pStill as IAMStreamConfig;
// Get the existing format block
hr = videoStreamConfig.GetFormat(out media);
DsError.ThrowExceptionForHR(hr);
try
{
// copy out the videoinfoheader
v = new VideoInfoHeader();
Marshal.PtrToStructure( media.formatPtr, v );
// if overriding the width, set the width
if (iWidth > 0)
{
v.BmiHeader.Width = iWidth;
}
// if overriding the Height, set the Height
if (iHeight > 0)
{
v.BmiHeader.Height = iHeight;
}
// if overriding the bits per pixel
if (iBPP > 0)
{
v.BmiHeader.BitCount = iBPP;
}
// Copy the media structure back
Marshal.StructureToPtr( v, media.formatPtr, false );
// Set the new format
hr = videoStreamConfig.SetFormat( media );
DsError.ThrowExceptionForHR( hr );
}
finally
{
DsUtils.FreeAMMediaType(media);
media = null;
}
}
There is a Function:
Marshal.PtrToStructure( media.formatPtr, v );
Here you can see what I just made:
Do anybody know how I can implement the function?
Thank you, Eugen Graf
09-23-2009 08:19 AM
Nobody can help?
I'm developing on the Open Source Project "LabVIEW Webcam Library". If anybody's interest for it, so notify me about it.
05-01-2014 03:00 PM
While I lack the knowledge to help develop this, I am extrememly interested in this, as I am about to start a project where I will need to view the live footage from a camera. Are you finished developing this?