Is it able to make nvinfer run certain frame?

Suppose that you are familiar with gstreamer plugin development. If not, you need to study how to develop gstreamer plugin first.

I don’t think the detection can be implemented with modifying one or two functions in nvinfer. You need to understand the nvinfer work flow before you modify it.
There is nvinfer source codes graph here. DeepStream SDK FAQ