[vlc-devel] [PATCH] qt4: add the RTSP protocol to the sout dialog

Pierre Ynard linkfanel at yahoo.fr
Sun Jan 24 14:16:17 CET 2010


diff --git a/modules/gui/qt4/components/sout/sout_widgets.cpp b/modules/gui/qt4/components/sout/sout_widgets.cpp
index 7cfd911..6558f3e 100644
--- a/modules/gui/qt4/components/sout/sout_widgets.cpp
+++ b/modules/gui/qt4/components/sout/sout_widgets.cpp
@@ -226,6 +226,57 @@ QString MMSHDestBox::getMRL( const QString& mux )
 }
 
 
+RTSPDestBox::RTSPDestBox( QWidget *_parent ) : VirtualDestBox( _parent )
+{
+    QGridLayout *layout = new QGridLayout( this );
+
+    QLabel *rtspOutput = new QLabel(
+        qtr( "This module outputs the transcoded stream to a network via RTSP."),
+        this );
+    layout->addWidget(rtspOutput, 0, 0, 1, -1);
+
+    QLabel *RTSPLabel = new QLabel( qtr("Path"), this );
+    QLabel *RTSPPortLabel = new QLabel( qtr("Port"), this );
+    layout->addWidget(RTSPLabel, 2, 0, 1, 1);
+    layout->addWidget(RTSPPortLabel, 1, 0, 1, 1);
+
+    RTSPEdit = new QLineEdit(this);
+    RTSPEdit->setText( "/" );
+
+    RTSPPort = new QSpinBox(this);
+    RTSPPort->setMaximumSize(QSize(90, 16777215));
+    RTSPPort->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+    RTSPPort->setMinimum(1);
+    RTSPPort->setMaximum(65535);
+    RTSPPort->setValue(5544);
+
+    layout->addWidget(RTSPEdit, 2, 1, 1, 1);
+    layout->addWidget(RTSPPort, 1, 1, 1, 1);
+    CS( RTSPPort );
+    CT( RTSPEdit );
+}
+
+QString RTSPDestBox::getMRL( const QString& mux )
+{
+    if( RTSPEdit->text().isEmpty() ) return "";
+
+    QString path = RTSPEdit->text();
+    if( path[0] != '/' )
+        path.prepend( qfu("/") );
+    QString port;
+    port.setNum( RTSPPort->value() );
+    QString sdp = "rtsp://:" + port + path;
+
+    SoutMrl m;
+    m.begin( "rtp" );
+    m.option( "sdp", sdp );
+    m.option( "mux", "ts" );
+    m.end();
+
+    return m.getMrl();
+}
+
+
 UDPDestBox::UDPDestBox( QWidget *_parent ) : VirtualDestBox( _parent )
 {
     QGridLayout *layout = new QGridLayout( this );
diff --git a/modules/gui/qt4/components/sout/sout_widgets.hpp b/modules/gui/qt4/components/sout/sout_widgets.hpp
index d2042cd..e46e361 100644
--- a/modules/gui/qt4/components/sout/sout_widgets.hpp
+++ b/modules/gui/qt4/components/sout/sout_widgets.hpp
@@ -90,6 +90,17 @@ class MMSHDestBox: public VirtualDestBox
         QSpinBox *MMSHPort;
 };
 
+class RTSPDestBox: public VirtualDestBox
+{
+    Q_OBJECT;
+    public:
+        RTSPDestBox( QWidget *_parent = NULL );
+        virtual QString getMRL( const QString& );
+    private:
+        QLineEdit *RTSPEdit;
+        QSpinBox *RTSPPort;
+};
+
 class UDPDestBox: public VirtualDestBox
 {
     Q_OBJECT;
diff --git a/modules/gui/qt4/dialogs/sout.cpp b/modules/gui/qt4/dialogs/sout.cpp
index aadaec7..1f512f8 100644
--- a/modules/gui/qt4/dialogs/sout.cpp
+++ b/modules/gui/qt4/dialogs/sout.cpp
@@ -74,6 +74,7 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf, const QString&
     ui.destBox->addItem( qtr( "File" ) );
     ui.destBox->addItem( "HTTP" );
     ui.destBox->addItem( "MS-WMSP (MMSH)" );
+    ui.destBox->addItem( "RTSP" );
     ui.destBox->addItem( "RTP / MPEG Transport Stream" );
     ui.destBox->addItem( "RTP Audio/Video Profile" );
     ui.destBox->addItem( "UDP (legacy)" );
@@ -159,18 +160,22 @@ void SoutDialog::addDest( )
             caption = qfu( "WMSP" );
             break;
         case 3:
+            db = new RTSPDestBox( this );
+            caption = qfu( "RTSP" );
+            break;
+        case 4:
             db = new RTPDestBox( this, "ts" );
             caption = "RTP/TS";
             break;
-        case 4:
+        case 5:
             db = new RTPDestBox( this );
             caption = "RTP/AVP";
             break;
-        case 5:
+        case 6:
             db = new UDPDestBox( this );
             caption = "UDP";
             break;
-        case 6:
+        case 7:
             db = new ICEDestBox( this );
             caption = "Icecast";
             break;


Regards,

-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."



More information about the vlc-devel mailing list