Ask Your Question

Revision history [back]

How to use gst_memory_new_wrapped wrap opencv mat ?

I want use “gst_memory_new_wrapped” wrapped opencv mat and put it to appsrc and stream it out. I fetch v4l2 buffer from my cam and transfer it to mat

init_v4l2_capture(dev_node, cmdline.width, cmdline.height, V4L2_PIX_FMT_YUYV);

cv::Mat mat = cv::Mat(480,640,CV_8UC2,(void*)fbuffer1);

Then transfer it to BGR and do something.

cv::cvtColor(mat,rgb_mat,cv::COLOR_YUV2BGR_YUY2);

After that I put it to a GstMemory use "gst_memory_new_wrapped" and use "gst_buffer_append_memory" append to a GstBuffer and push it to appsrc.

gst_wrapped_mem = gst_memory_new_wrapped( (GstMemoryFlags)0, (gpointer) rgb_cv.data, 640*480*3 ,0,640*480*2,NULL, NULL);

gst_buffer_append_memory(buffer1, gst_wrapped_mem);

g_signal_emit_by_name(gst_handle1->src, "push-buffer", buffer1, &ret1);

At lase the appsrc caps format is BGR.

And finally i got that .... "mysource" is my appsrc name. Thread 3 "mysource:src" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffe6c74700 (LWP 301)] 0x00007fffe7d7bf33 in ?? () from /usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0

How to use gst_memory_new_wrapped wrap opencv mat ?

I want use “gst_memory_new_wrapped” wrapped opencv mat and put it to appsrc and stream it out. I fetch v4l2 buffer from my cam and transfer it to mat

init_v4l2_capture(dev_node, cmdline.width, cmdline.height, V4L2_PIX_FMT_YUYV);

cv::Mat mat = cv::Mat(480,640,CV_8UC2,(void*)fbuffer1);

Then transfer it to BGR and do something.

cv::cvtColor(mat,rgb_mat,cv::COLOR_YUV2BGR_YUY2);

After that I put it to a GstMemory use "gst_memory_new_wrapped" and use "gst_buffer_append_memory" append to a GstBuffer and push it to appsrc.

gst_wrapped_mem = gst_memory_new_wrapped( (GstMemoryFlags)0, (gpointer) rgb_cv.data, 640*480*3 ,0,640*480*2,NULL, NULL);

gst_buffer_append_memory(buffer1, gst_wrapped_mem);

g_signal_emit_by_name(gst_handle1->src, "push-buffer", buffer1, &ret1);

At lase the appsrc caps format is BGR.

And finally i got that .... "mysource" is my appsrc name. Thread 3 "mysource:src" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffe6c74700 (LWP 301)] 0x00007fffe7d7bf33 in ?? () from /usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0

How to use gst_memory_new_wrapped wrap opencv mat ?

I want use “gst_memory_new_wrapped” wrapped opencv mat and put it to appsrc and stream it out. I fetch v4l2 buffer from my cam and transfer it to mat

init_v4l2_capture(dev_node, cmdline.width, cmdline.height, V4L2_PIX_FMT_YUYV);

cv::Mat mat = cv::Mat(480,640,CV_8UC2,(void*)fbuffer1);

Then transfer it to BGR and do something.

cv::cvtColor(mat,rgb_mat,cv::COLOR_YUV2BGR_YUY2);

After that I put it to a GstMemory use "gst_memory_new_wrapped" and use "gst_buffer_append_memory" append to a GstBuffer and push it to appsrc.

gst_wrapped_mem = gst_memory_new_wrapped( (GstMemoryFlags)0, (gpointer) rgb_cv.data, 640*480*3 ,0,640*480*2,NULL, NULL);

gst_buffer_append_memory(buffer1, gst_wrapped_mem);

g_signal_emit_by_name(gst_handle1->src, "push-buffer", buffer1, &ret1);

At lase the appsrc caps format is BGR.

And finally i got that .... "mysource" is my appsrc name. Thread 3 "mysource:src" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffe6c74700 (LWP 301)] 0x00007fffe7d7bf33 in ?? () from /usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0