[vlc-devel] [PATCH 3/4] srt: add srt stream wizard

Aaron Boxer boxerab at gmail.com
Mon Mar 18 17:39:53 CET 2019


---
 .../gui/qt/components/sout/sout_widgets.cpp   | 55 +++++++++++++++++++
 .../gui/qt/components/sout/sout_widgets.hpp   | 13 +++++
 modules/gui/qt/dialogs/sout.cpp               | 11 +++-
 3 files changed, 76 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..2f65a5d880 100644
--- a/modules/gui/qt/components/sout/sout_widgets.cpp
+++ b/modules/gui/qt/components/sout/sout_widgets.cpp
@@ -359,6 +359,61 @@ 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;
-- 
2.17.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190318/4713138f/attachment-0001.html>


More information about the vlc-devel mailing list