I am currently implementing custom Deepstream plugin for video analytics. This plugin will come after “nvstreammux” element in pipeline. The logic of the plugin is as follow:
- Map input buffer (GstBuffer) to NvBufSurface.
- Obtain NvDsBatchMeta of input buffer.
- Create new NvBufSurface and new NvDsBatchMeta, both empty.
- Fill new NvBufSurface and NvDsBatchMeta, from point 3, with modified data based on original input buffer objects, from point 1 and 2.
- Convert filled NvBufSurface, from point 4, to GstBuffer.
- Convert filled NvDsBatchMeta, from point 4, to GstMeta.
- Attach metadata, from point 6, to buffer, from point 5.
- Discard original buffer along with its metadata, from point 1 and 2.
- Push modified buffer, from point 7, to srcpad.
In short I want to create brand new buffer based on NvBufSurface along with brand new metadata based on NvDsBatchMeta and push it downstream, while discarding original buffer.
The thing is I cannot find appropriate way to “convert” NvDsBatchMeta to GstBuffer and NvDsBatchMeta to GstMeta, so that the next element in pipeline “nvinfer” will handle them.
I would appreciate any help in this subject. I just hope I am not missing some crucial point.