13 Replies Latest reply on Jun 21, 2017 4:49 PM by MartyG

    Issue parsing output from rs_get_frame_data()




      I am having a slight issue parsing the data from realsense library function rs_get_frame_data()


      What I need to do is copy the output from rs_get_frame_data() into a local memory buffer and pass that buffer on to GStreamer. Here is my code:


      struct rgb *rgb = ( struct rgb *) rs_get_frame_data( camera, RS_STREAM_COLOR, &e );     // get single frame from realsense camera

      char *buffer = malloc(640*480*3);                                                                                             // allocates buffer large enough to hold a single frame coming from realsense

      memcpy (buffer,rgb, sizeof(rgb));


      Then pass buffer on to GStreamer:

      GstBuffer *gstbuffer = gst_buffer_new_wrapped_full( ( GstMemoryFlags )0, buffer, SIZE, 0, SIZE, NULL, NULL );     //  GStreamer does not seem to like this.  SIZE = 640*480*3 for a single frame


      struct rgb is a 3 character struct defined as


      @struct rgb {

        unsigned char r;

        unsigned char g;

         unsigned char b;



      What am I doing wrong here ?


      Any help is much appreciated.