LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing C# Marshal.PtrToStructure () in LabVIEW

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:

 

 

LabVIEW.png

Do anybody know how I can implement the function?

 

Thank you, Eugen Graf

 

0 Kudos
Message 1 of 3
(4,604 Views)

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.

 

DSNet.png

0 Kudos
Message 2 of 3
(4,585 Views)

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?

0 Kudos
Message 3 of 3
(3,126 Views)