[vlc-devel] [PATCH 1/2] srt: add srt stream wizard

Aaron Boxer boxerab at gmail.com
Fri Mar 15 01:18:46 CET 2019


>From 0c20cb24268deb8934d96a98bfa6cdb6a06a1370 Mon Sep 17 00:00:00 2001
From: Aaron Boxer <aaron.boxer at collabora.com>
Date: Mon, 4 Mar 2019 21:07:44 -0500
Subject: [PATCH 1/2] srt: add srt stream wizard

---
 .../gui/qt/components/sout/sout_widgets.cpp   | 52 +++++++++++++++++++
 .../gui/qt/components/sout/sout_widgets.hpp   | 13 +++++
 modules/gui/qt/dialogs/sout.cpp               | 11 ++--
 modules/gui/qt/ui/open_net.ui                 |  1 +
 4 files changed, 74 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt/components/sout/sout_widgets.cpp
b/modules/gui/qt/components/sout/sout_widgets.cpp
index a6793e9243..1f47fba0eb 100644
--- a/modules/gui/qt/components/sout/sout_widgets.cpp
+++ b/modules/gui/qt/components/sout/sout_widgets.cpp
@@ -359,6 +359,58 @@ QString UDPDestBox::getMRL( const QString& mux )
     return m.getMrl();
 }

+SRTDestBox::SRTDestBox( QWidget *_parent, const char *_mux )
+    : VirtualDestBox( _parent ), mux( qfu(_mux) )
+{
+    label->setText( qtr( "This module outputs the transcoded stream to a
network via SRT.") );
+
+    QLabel *SRTLabel = new QLabel( qtr("Address"), this );
+    SRTEdit = new QLineEdit(this);
+    layout->addWidget(SRTLabel, 1, 0, 1, 1);
+    layout->addWidget(SRTEdit, 1, 1, 1, 1);
+
+    QLabel *SRTPortLabel = new QLabel( qtr("Base port"), this );
+    SRTPort = new QSpinBox(this);
+    SRTPort->setMaximumSize(QSize(90, 16777215));
+
SRTPort->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+    SRTPort->setMinimum(1);
+    SRTPort->setMaximum(65535);
+    SRTPort->setValue(7001);
+    layout->addWidget(SRTPortLabel, 2, 0, 1, 1);
+    layout->addWidget(SRTPort, 2, 1, 1, 1);
+
+    QLabel *SAPNameLabel = new QLabel( qtr("Stream name"), this );
+    SAPName = new QLineEdit(this);
+    layout->addWidget(SAPNameLabel, 3, 0, 1, 1);
+    layout->addWidget(SAPName, 3, 1, 1, 1);
+
+    CT( SRTEdit );
+    CS( SRTPort );
+    CT( SAPName );
+}
+
+QString SRTDestBox::getMRL( const QString& )
+{
+    QString addr = SRTEdit->text();
+    QString name = SAPName->text();
+
+    if( addr.isEmpty() ) return qfu("");
+    QString destination = addr + ":" + QString::number(SRTPort->value());
+    SoutMrl m;
+    m.begin( "srt" );
+    m.option( "dst", destination );
+    /* mp4-mux ain't usable in rtp-output either */
+    if( !mux.isEmpty() )
+        m.option( "mux", mux );
+    if( !name.isEmpty() )
+    {
+        m.option( "sap" );
+        m.option( "name", name );
+    }
+    m.end();
+
+    return m.getMrl();
+}


 RTPDestBox::RTPDestBox( QWidget *_parent, const char *_mux )
diff --git a/modules/gui/qt/components/sout/sout_widgets.hpp
b/modules/gui/qt/components/sout/sout_widgets.hpp
index 5b9496c83a..3413c8d239 100644
--- a/modules/gui/qt/components/sout/sout_widgets.hpp
+++ b/modules/gui/qt/components/sout/sout_widgets.hpp
@@ -117,6 +117,19 @@ class UDPDestBox: public VirtualDestBox
         QSpinBox *UDPPort;
 };

+class SRTDestBox: public VirtualDestBox
+{
+    Q_OBJECT
+    public:
+        SRTDestBox( QWidget *_parent = NULL, const char *mux = NULL );
+        QString getMRL( const QString& ) Q_DECL_OVERRIDE;
+    private:
+        QLineEdit *SRTEdit;
+        QSpinBox *SRTPort;
+        QLineEdit *SAPName;
+        QString mux;
+};
+
 class RTPDestBox: public VirtualDestBox
 {
     Q_OBJECT
diff --git a/modules/gui/qt/dialogs/sout.cpp
b/modules/gui/qt/dialogs/sout.cpp
index 8c2be69e23..003427acae 100644
--- a/modules/gui/qt/dialogs/sout.cpp
+++ b/modules/gui/qt/dialogs/sout.cpp
@@ -69,6 +69,7 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t
*_p_intf, const QString&
     ui.destBox->addItem( "HTTP" );
     ui.destBox->addItem( "MS-WMSP (MMSH)" );
     ui.destBox->addItem( "RTSP" );
+    ui.destBox->addItem( "SRT / MPEG Transport Stream" );
     ui.destBox->addItem( "RTP / MPEG Transport Stream" );
     ui.destBox->addItem( "RTP Audio/Video Profile" );
     ui.destBox->addItem( "UDP (legacy)" );
@@ -132,18 +133,22 @@ void SoutDialog::addDest( )
             caption = qfu( "RTSP" );
             break;
         case 4:
+            db = new SRTDestBox( this, "ts" );
+            caption = "SRT/TS";
+            break;
+        case 5:
             db = new RTPDestBox( this, "ts" );
             caption = "RTP/TS";
             break;
-        case 5:
+        case 6:
             db = new RTPDestBox( this );
             caption = "RTP/AVP";
             break;
-        case 6:
+        case 7:
             db = new UDPDestBox( this );
             caption = "UDP";
             break;
-        case 7:
+        case 8:
             db = new ICEDestBox( this );
             caption = "Icecast";
             break;
diff --git a/modules/gui/qt/ui/open_net.ui b/modules/gui/qt/ui/open_net.ui
index e565ff3fd9..82c5347476 100644
--- a/modules/gui/qt/ui/open_net.ui
+++ b/modules/gui/qt/ui/open_net.ui
@@ -41,6 +41,7 @@
         </property>
         <property name="text">
          <string notr="true">http://www.example.com/stream.avi
+srt://server.example.org:7001
 rtp://@:1234
 mms://mms.examples.com/stream.asx
 rtsp://server.example.org:8080/test.sdp
-- 
2.17.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190314/69f3330b/attachment.html>


More information about the vlc-devel mailing list