C # wrapper for an array of three pointers

I am currently working on a C # shell to work with the Dallmeier Light Light Common API.
See Previous Post: C # Wrapper and Callbacks

I have almost everything that is "wrapped up", but I am stuck at the end of a callback that contains an array of three pointers and 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 get current YUV image.
Arguments SessionHandle: handle the current session.
Return PlayerID (see callback).
The callback is IPlayerId: id for the Player object

            - yuvData: an array of three pointers to Y, U, and V part of the image
              . The YUV format used is the YUV420 tablet (not packaged).
              char * y = yuvData [0];
              char * u = yuvData [1];
              char * v = yuvData [2];
            - pitch: an array of integers for steps for the Y, U, and V parts of the image
            - width: the internal width of the image.
            - height
            - ts: timestamp of the current frame
            - extData: additional data for the frame

How do I wrap this in C #?

Any help is greatly appreciated.

+1
source share
1 answer

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

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

0
source

Source: https://habr.com/ru/post/1739440/


All Articles