Convert Gstreamer Buffer to IOS CIImage Format

Raushan Kumar Choudhary raushankumar at tataelxsi.co.in
Sun Nov 1 23:22:26 PST 2015


Hi ,


  We are trying to capture frame in ios from Gstreamer Pipeline but not able to convert buffer in to CIImage.

Please find the code below for reference:



static GstFlowReturn new_sample(GstAppSink *appsink, gpointer data1)

{





    CMSampleBufferRef *buffer =Nil;

    g_signal_emit_by_name (appsink, "pull-buffer", &buffer);

    if (buffer) {

        /* The only thing we do in this example is print a * to indicate a received buffer */

    //g    g_print ("*");



        CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)CMSampleBufferGetImageBuffer(*buffer);

        CIImage* image = [CIImage imageWithCVPixelBuffer:pixelBuffer];

      //  NSLog(@"image...%@",image);

        gst_buffer_unref (buffer);

    }



    return GST_FLOW_OK;

}



Pipeline and setting Callabck:

 pipeline = gst_parse_launch("udpsrc port=5000 caps =\"application/x-rtp, media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264\" ! rtph264depay ! ffdec_h264 !  appsink name=sink sync=false  async=false",&error );


 sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");



    gst_app_sink_set_emit_signals((GstAppSink*)sink, true);

    gst_app_sink_set_drop((GstAppSink*)sink, true);

    gst_app_sink_set_max_buffers((GstAppSink*)sink, 1);

    GstAppSinkCallbacks callbacks = { NULL, new_preroll,new_sample };

    gst_app_sink_set_callbacks (GST_APP_SINK(sink), &callbacks, (__bridge gpointer)(self), NULL);



Please let me know how we can solve this problem.If you have any more process please let me know how we convert buffer to CIImage.


Thanks,
Raushan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20151102/37734bc8/attachment-0001.html>


More information about the gstreamer-devel mailing list