How to set source_id in streammux?

In this post: Getting source stream ID from nvosd plugin
ChrisDing provided a solution to set source_id in streammux. I just don’t know where I should put this piece of code:

In streammux,

sscanf (name, "sink_%u", &stream_index);
pad_data->pad_id = stream_index;
frame_meta->source_id = pad_data->pad_id;

Please help

This code is implemented in nvstreammux plugin and it’s not open source.

BTW, user can install a probe on source pad of nvstreammux component and can update source ID information based on pad ID. There needs to be a mapping from pad ID to source ID by user.

yes. I do it that way.