Skip to content

Commit 9d37024

Browse files
committed
added support for rtpmp2ts protocol
1 parent 7514d16 commit 9d37024

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

codec/gstEncoder.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,40 @@ bool gstEncoder::buildLaunchStr()
376376

377377
mOptions.deviceType = videoOptions::DEVICE_IP;
378378
}
379+
else if( uri.protocol == "rtpmp2ts" )
380+
{
381+
// https://forums.developer.nvidia.com/t/gstreamer-udp-to-vlc/215349/5
382+
if( mOptions.codec == videoOptions::CODEC_H264 )
383+
ss << "h264parse config-interval=1 ! mpegtsmux ! rtpmp2tpay ! udpsink host=";
384+
else if (mOptions.codec == videoOptions::CODEC_H265 )
385+
ss << "h265parse config-interval=1 ! mpegtsmux ! rtpmp2tpay ! udpsink host=";
386+
else
387+
{
388+
LogError(LOG_GSTREAMER "gstEncoder -- rtpmp2ts output only supports h264 and h265. Unsupported codec (%s)\n", uri.extension.c_str());
389+
return false;
390+
}
391+
392+
ss << uri.location << " ";
393+
394+
if( uri.port != 0 )
395+
ss << "port=" << uri.port;
396+
397+
ss << " auto-multicast=true";
398+
399+
mOptions.deviceType = videoOptions::DEVICE_IP;
400+
}
379401
else if( uri.protocol == "rtmp" )
380402
{
381403
ss << "flvmux streamable=true ! queue ! rtmpsink location=";
382404
ss << uri.string << " ";
383405

384406
mOptions.deviceType = videoOptions::DEVICE_IP;
385407
}
408+
else
409+
{
410+
LogError(LOG_GSTREAMER "gstEncoder -- invalid protocol (%s)\n", uri.protocol.c_str());
411+
return false;
412+
}
386413

387414
mLaunchStr = ss.str();
388415

video/videoOutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ videoOutput* videoOutput::Create( const videoOptions& options )
8080
else
8181
output = imageWriter::Create(options);
8282
}
83-
else if( uri.protocol == "rtp" || uri.protocol == "rtmp" )
83+
else if( uri.protocol == "rtp" || uri.protocol == "rtmp" || uri.protocol == "rtpmp2ts" )
8484
{
8585
output = gstEncoder::Create(options);
8686
}

0 commit comments

Comments
 (0)