Save image in `gie_primary_processing_done_buf_prob` in deepstream_app.c.

So I want to save the frame as a jpeg image if a specific class is detected.

As of now, I have followed osd_sink_pad_buffer_probe in deepstream_test1_app.c to get the necessary info. But I am stuck on how to save the frame as a jpeg/png file.
I want to be able to do this without adding another plugin in the pipeline (gstdexample).

Any help will be highly appreciated.

Please refer to 2, 5 in FAQ