How to pass parameter to Smart Record callback function

When setting up smart record you fill out the params structure and one of the fields is:

params.callback = smart_record_callback; 

I can see the signature of the callback is:

static gpointer smart_record_callback (NvDsSRRecordingInfo *info, gpointer userData)

How do we pass in userData - I can’t see how to set that up in the params structure?

I want to use it to pass in the source_id.


Hardware Platform (Jetson / GPU): Jetson Nano
DeepStream Version: DS5.0 developer preview

Hi @jasonpgf2a
The userData in this call back is the userData pased into through NvDsSRStart() as described below.

Doc: NVIDIA DeepStream SDK Developer Guide — DeepStream 6.3 Release documentation

vDsSRStatus NvDsSRStart (NvDsSRContext *ctx, NvDsSRSessionId *sessionId, guint startTime, guint duration, gpointer userData);

Thanks!

Thankyou @mchi I was looking at the params structure where you specify the callback function name. Have tested and it works well. ;-)

Hi, my pipeline works like this:

rtsp -> decode  -> detect -> track -> dstexample ->osd->tee |
| msg conv + msg broke
| encodeh264 ->rtppay->udpsink

In dstexample, i capture frames when alarm occurs and send a kafka message. 

Now i want to 
1)start smart-record  (which has bbox in frame) related with that alarm and 
2)upload the record file with minio c++ api when it finished.

It seems like i should add a srbin after encoder264, is that right?
Do you have some suggestions about that?

hello, I wanna send some parameter to smart_record_callback function. can you help me?
I can’t find reference code.

A bit late I know… but better than never:

Here’s how I pass a parameter to smart record so that it is available in the callback. In this instance I am passing the source_id of the current detection:

rc = NvDsSRStart (ctx, &sessId, startTime, duration, GUINT_TO_POINTER (source_id));
1 Like