gst-dsexample works in “in-place” mode( GstBaseTransform (gstreamer.freedesktop.org)).
And if you have read the code carefully, you will find the “dsexample->inter_buf” is just an internal buffer to get the surface data be transferred to “dsexample->cvmat” and finally it will be save as an image. There is no path to pass the “dsexample->inter_buf” to the src pad.
Please make sure you are familiar with Gstreamer plugin and application development and coding skills before you customize new feature with deepstream APIs. https://gstreamer.freedesktop.org/
If you want to do such change, you may refer to Deepstream sample code snippet - Intelligent Video Analytics / DeepStream SDK - NVIDIA Developer Forums