how to capture continuous frame from nvcamerasrc using plugin i made??

Hi,

I’d like to capture continuous frames from nvcamerasrc using plugin i made.
So i made a simple plug-in(myfilter) to capture continuous frame like belows.

static GstFlowReturn
gst_my_filter_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
GstMyFilter *filter;
gint size=0;

GstMapInfo map;
int ret = 0;
guint8 *ptr_val;

filter = GST_MYFILTER (parent);

if (filter->silent == FALSE)
g_print (“my nick name is dooman.\n”);

gst_buffer_map (buf, &map, GST_MAP_READ);
ptr_val=map.data;
g_print ("[dooman:size] 0x%lx, 0x%lx, 0x%lx, %d, sizeof-%d\n", *ptr_val++, *ptr_val++, *ptr_val++, map.size, sizeof(GstBuffer));
gst_buffer_unmap (buf, &map);

gst_video_frame_unmap (&frame);
}

I expect get pixel value through map.data, but i got unexpected value (0x28, 0x3, 0x0…) and size is 808.

[dooman:size] 0x28, 0x3, 0x0, 808, sizeof-112
my nick name is dooman.
[dooman:size] 0x28, 0x3, 0x0, 808, sizeof-112
my nick name is dooman.
[dooman:size] 0x28, 0x3, 0x0, 808, sizeof-112
my nick name is dooman.
[dooman:size] 0x28, 0x3, 0x0, 808, sizeof-112
^Chandling interrupt.
Interrupt: Stopping pipeline …
EOS on shutdown enabled – Forcing EOS on the pipeline
Waiting for EOS…
Got EOS from element “pipeline0”.
EOS received - stopping pipeline…
Execution ended after 0:00:01.521510177
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …

So i test using v4l2src. and i got reasonable pixel value and size.

gst-launch-1.0 v4l2src num-buffers=100 device="/dev/video0" ! bayer2rgb ! videoconvert ! ‘video/x-raw, width=1920, height=1080, format=(string)I420’ ! myfilter ! multifilesink location=test%d.raw -v

[dooman:size] 0x42, 0x18, 0x1c, 3110400, sizeof-112
dddmy nick name is dooman.
[dooman:size] 0x49, 0x18, 0x1e, 3110400, sizeof-112
dddmy nick name is dooman.
[dooman:size] 0x48, 0x18, 0x29, 3110400, sizeof-112
dddmy nick name is dooman.
[dooman:size] 0x63, 0x1a, 0x34, 3110400, sizeof-112
dddmy nick name is dooman.
[dooman:size] 0x4b, 0x1a, 0x2a, 3110400, sizeof-112
dddmy nick name is dooman.
[dooman:size] 0x5e, 0x19, 0x31, 3110400, sizeof-112
dddmy nick name is dooman.
[dooman:size] 0x20, 0x18, 0x63, 3110400, sizeof-112
ddd^Chandling interrupt.
Interrupt: Stopping pipeline …
Execution ended after 0:00:02.917818016
Setting pipeline to PAUSED …
Setting pipeline to READY …
[ 36.026664] tegra-vi4 15700000.vi: Status: 5 channel:00 frame:0058
[ 36.032956] tegra-vi4 15700000.vi: timestamp sof 45840411776 eof 45840529344 data 0x00000001
[ 36.042208] tegra-vi4 15700000.vi: capture_id 36 stream 2 vchan 0
Setting pipeline to NULL …
Freeing pipeline …

My Questions
Question 1) how to capture continuous frame from nvcamerasrc using plugin i made??

Question 2) I wonder that value i captured (0x28, 0x3, 0x0…) and size (808) are a kind of metadatas??

Thanks,
Doohan93

Hi,
The output of nvcamerasrc is DMA buffer(video/x-raw(memory:NVMM)). You need nvvidconv to convert into CPU buffers.

A sample code for your reference:
https://devtalk.nvidia.com/default/topic/1010111/jetson-tx1/nvmm-memory/post/5158652/#5158652