But I want to allocate specific buffer and make my gst command use it.
I could set v4l2src io-mode to userptr but I don't know how can I assign my
buffer to my gstreamer pipeline in my application.
Could you help or give some guide to assign my buffer to my gstreamer
Re: How can I set my custom memory buffer to v4l2src userptr?
Le jeudi 04 mars 2021 à 02:31 -0600, dongjin.ha a écrit :
> Hi all,
> My c++ application runs the camera with
> For example, my command string is here.
> "v4l2src device=/dev/video" + std::to_string(num) + " ! video/x-raw,
> format=UYVY, width=1920,height=1080 ! \
> videoconvert ! video/x-raw, format=RGB ! appsink name=mysink"
> Actually with this command, there's no problem.
> But I want to allocate specific buffer and make my gst command use it.
> I could set v4l2src io-mode to userptr but I don't know how can I assign my
> buffer to my gstreamer pipeline in my application.
> Could you help or give some guide to assign my buffer to my gstreamer
If you enable userptr, v4l2src will use downstream buffers as provided by pool
in the allocation query. If videoconvert is in active, videoconvert will be the
provider. With appsink, to handle the allocation query, you need to use a pad
probe, this is not very hard. An example, it's not offering any pool in this
case though, left as an exercise:
WARNING, V4L2 drivers don't always operate with virtual memory. Drivers also
have limited support for user provided strides. Youre millage may vary from
platform to platform. Also, userptr requires bling cache flushing, as we cannot
assume if it will be used by CPU or Device. This has an important performance
impact. I'm not sure why you need this, but I'm sure it will be difficult and
you should handle a copy fallback.