Receive video data buffer by Appsrc on Android JNI

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Receive video data buffer by Appsrc on Android JNI

sofien rahmouni
I'm trying to display a received data from an UDP Socket (which already token
by a Callback from the callback of AppSink)

Here is my code which is supposed to display the received data :

static void
gst_native_receive_video_data(JNIEnv *env, jobject thiz, jbyteArray array) {

    jbyte *data = (*env)->GetByteArrayElements(env, array, NULL);
    jsize size = (*env)->GetArrayLength(env, array);

    GstBuffer *buffer = gst_buffer_new_allocate(NULL, size, NULL);
    gst_buffer_fill(buffer, 0, data, size);

    gchar* videoConsumerString = g_strdup_printf ("appsrc name=source
is-live=true do-timestamp=true min-latency=0 max-latency=100000000 !
video/x-raw,format=RGB,width=320,height=240,framerate=30/1 ! videoconvert !
autovideosink");
    GstElement *consumer = gst_parse_launch (videoConsumerString, NULL);
    g_free (videoConsumerString);

    GstElement* source = gst_bin_get_by_name (GST_BIN (consumer), "source");
    gst_app_src_push_buffer (GST_APP_SRC (source), buffer);
    gst_element_set_state (consumer, GST_STATE_PLAYING);

    gst_object_unref (source);
    gst_object_unref(consumer);

    (*env)->ReleaseByteArrayElements(env, array, data, JNI_ABORT);

}


Please give me the correct way to display the received data.

Thank you in advance for your help.

*P.S:* I'm newbie on Gstreamer Community

Best Regards,
Sofien



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel