开发者

C# wrapper for array of three pointers

开发者 https://www.devze.com 2022-12-22 18:19 出处:网络
I\'m currently working on a C# wrapper to work with Dallmeier Common API light. See previous posting: C# wrapper and Callbacks

I'm currently working on a C# wrapper to work with Dallmeier Common API light.

See previous posting: C# wrapper and Callbacks

I've got pretty much everything 'wrapped' but I'm stuck on wrapping a callback which contains an array of three pointers & an array integers:

dlm_setYUVDataCllback

int(int SessionHandle, void (*callback) (long IPlayerID, unsigned char** yuvData,  
    int* pitch, int width, int height, int64_t ts, char* extData))  

Function Set callback, to receive current YUV image.

Arguments SessionHandle: handle to current session.

Return PlayerID (see callback).

Callback - IPlayerId: id to the Player object

- yuvData: array of three pointers to Y, U and V part of image

The YUV format used is YUV420 planar (not packed).

char *y = yuvData[0];

char *u = yuvData[1];

char *v = yuvData[2];

- pitch: array of integers for pitches for Y, U and V part of image

- width: intrinsic width of image.

- height

- ts : timestamp of current frame

- extData: additional data to frame

开发者_运维技巧How do I go about wrapping this in c#?

Any help is much appreciated.


unsigned char** yuvData should be defined as [MarshalAs(UnmanagedType.ByValArray,SizeConst=3)] IntPtr[] yuvData

You will then get an array of 3 IntPtrs. You can the read the actual data using the Marshal.Read or Marshal.Copy.

0

精彩评论

暂无评论...
验证码 换一张
取 消