Sagar Pilkhwal
Sagar Pilkhwal

Reputation: 3993

kurento: How to pass guint8 * to java server as an int[]

I am trying to send the GstBuffer objects map.data to the java server. I have created an event with a parameter as int[] but when raising the event I am getting the following error at compile time.

error: no matching function for call to ‘kurento::module::vadcustomfilter::BufferReceived::BufferReceived(std::shared_ptr<kurento::MediaObject>, const char [16], int*)’

BufferReceived event (shared_from_this (), "Buffer Received", ((int *)buffer));

map.data is of type guint8 *

is there something wrong am doing in type casting ?

I tried sending map.data as std::string but at java side I am not receiving the complete string.

Upvotes: 0

Views: 56

Answers (1)

santoscadenas
santoscadenas

Reputation: 1492

Casting guint8* to char* is fine, because only the sign changes. Casting to int * is not OK because the size is different, in order to send this kind of events, you may need to copy the array of guint8 to an array of int. But think that this is not a fast operation, nor serializing this big event, so do not expect to have a great performance.

Furthermore, what kurento events expects (you should check the signature of BufferReceived) when you declare an array is a std::vector<int>, so in any case you need to create the array and copy the content.

Upvotes: 2

Related Questions