How to feed rtsp streams to deepstream samples

Hi, I wish to feed rtsp streams into the nvDecInfer_detection sample. I cannot simply change the szFilePath to the rtsp url path in dataProvider.h. Does anyone knows how to feed rtsp streams using deepstream? Thanks.

// Define the file data provider
class FileDataProvider : public DataProvider {
public:
    FileDataProvider(const char *szFilePath, simplelogger::Logger *logger)
	: logger_(logger)
	{
        fp_ = fopen(szFilePath, "rb");
    	if (nullptr == fp_) {
			LOG_ERROR(logger, "Failed to open file " << szFilePath);
			exit(1);
		}
		pLoadBuf_ = new uint8_t[nLoadBuf_];
    	pPktBuf_ = new uint8_t[nPktBuf_];
		assert(nullptr != pLoadBuf_);
	}
    ~FileDataProvider() {
        if (fp_) {
            fclose(fp_);
        }
		if (pLoadBuf_) {
			delete [] pLoadBuf_;
		}
		if (pPktBuf_) {
			delete [] pPktBuf_;
		}
    }

you can use below config

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
uri=rtsp://foo.com/stream1.mp4
num-sources=1
gpu-id=0
nvbuf-memory-type=0