[vlc-devel] [PATCH] qt4: fix TTL and SAP in sout wizard

Pierre Ynard linkfanel at yahoo.fr
Sat Feb 11 21:49:58 CET 2012


diff --git a/modules/gui/qt4/components/sout/sout_widgets.cpp b/modules/gui/qt4/components/sout/sout_widgets.cpp
index ebf952a..10a24cb 100644
--- a/modules/gui/qt4/components/sout/sout_widgets.cpp
+++ b/modules/gui/qt4/components/sout/sout_widgets.cpp
@@ -108,7 +108,8 @@ FileDestBox::FileDestBox( QWidget *_parent ) : VirtualDestBox( _parent )
     BUTTONACT( fileSelectButton, fileBrowse() );
 }
 
-QString FileDestBox::getMRL( const QString& mux )
+QString FileDestBox::getMRL( const QString& mux, const int, const bool,
+                             const QString&, const QString& )
 {
     if( fileEdit->text().isEmpty() ) return "";
 
@@ -173,7 +174,8 @@ HTTPDestBox::HTTPDestBox( QWidget *_parent ) : VirtualDestBox( _parent )
     CT( HTTPEdit );
 }
 
-QString HTTPDestBox::getMRL( const QString& mux )
+QString HTTPDestBox::getMRL( const QString& mux, const int, const bool,
+                             const QString&, const QString& )
 {
     if( HTTPEdit->text().isEmpty() ) return "";
 
@@ -232,7 +234,8 @@ MMSHDestBox::MMSHDestBox( QWidget *_parent ) : VirtualDestBox( _parent )
     CT( MMSHEdit );
 }
 
-QString MMSHDestBox::getMRL( const QString& )
+QString MMSHDestBox::getMRL( const QString&, const int, const bool,
+                             const QString&, const QString& )
 {
     if( MMSHEdit->text().isEmpty() ) return "";
 
@@ -277,7 +280,8 @@ RTSPDestBox::RTSPDestBox( QWidget *_parent ) : VirtualDestBox( _parent )
     CT( RTSPEdit );
 }
 
-QString RTSPDestBox::getMRL( const QString& )
+QString RTSPDestBox::getMRL( const QString&, const int, const bool,
+                             const QString&, const QString& )
 {
     if( RTSPEdit->text().isEmpty() ) return "";
 
@@ -326,16 +330,34 @@ UDPDestBox::UDPDestBox( QWidget *_parent ) : VirtualDestBox( _parent )
     CT( UDPEdit );
 }
 
-QString UDPDestBox::getMRL( const QString& mux )
+QString UDPDestBox::getMRL( const QString& mux, const int ttl, const bool sap,
+                            const QString& sapName, const QString& sapGroup )
 {
     if( UDPEdit->text().isEmpty() ) return "";
 
     SoutMrl m;
-    m.begin( "udp" );
+    m.begin( "std" );
+
+    SoutMrl access;
+    access.begin( "udp" );
+    access.option( "ttl", ttl );
+    access.end();
+    m.option( "access", access.getMrl() );
+ 
     /* udp output, ts-mux is really only reasonable one to use*/
     if( !mux.isEmpty() && !mux.compare("ts" ) )
         m.option( "mux", mux );
     m.option( "dst", UDPEdit->text(), UDPPort->value() );
+
+    if( sap )
+    {
+        m.option( "sap" );
+        if( !sapName.isEmpty() )
+            m.option( "name", sapName );
+        if( !sapGroup.isEmpty() )
+            m.option( "group", sapGroup );
+    }
+   
     m.end();
 
     return m.getMrl();
@@ -374,7 +396,8 @@ RTPDestBox::RTPDestBox( QWidget *_parent, const char *_mux )
     CT( RTPEdit );
 }
 
-QString RTPDestBox::getMRL( const QString& )
+QString RTPDestBox::getMRL( const QString&, const int ttl, const bool sap,
+                            const QString& sapName, const QString& )
 {
     if( RTPEdit->text().isEmpty() ) return "";
 
@@ -385,6 +408,13 @@ QString RTPDestBox::getMRL( const QString& )
     /* mp4-mux ain't usable in rtp-output either */
     if( mux != NULL )
         m.option( "mux", qfu( mux ) );
+    if( sap )
+    {
+        m.option( "sap" );
+        if( !sapName.isEmpty() )
+            m.option( "name", sapName );
+    }
+    m.option( "ttl", ttl );
     m.end();
 
     return m.getMrl();
@@ -435,7 +465,8 @@ ICEDestBox::ICEDestBox( QWidget *_parent ) : VirtualDestBox( _parent )
 #undef CS
 #undef CT
 
-QString ICEDestBox::getMRL( const QString& )
+QString ICEDestBox::getMRL( const QString&, const int, const bool,
+                            const QString&, const QString& )
 {
     if( ICEEdit->text().isEmpty() ) return "";
 
diff --git a/modules/gui/qt4/components/sout/sout_widgets.hpp b/modules/gui/qt4/components/sout/sout_widgets.hpp
index c7572e2..b5a7f53 100644
--- a/modules/gui/qt4/components/sout/sout_widgets.hpp
+++ b/modules/gui/qt4/components/sout/sout_widgets.hpp
@@ -49,7 +49,8 @@ class VirtualDestBox : public QWidget
     Q_OBJECT
     public:
         VirtualDestBox( QWidget *_parent = NULL ) : QWidget( _parent ){}
-        virtual QString getMRL( const QString& ) = 0;
+        virtual QString getMRL( const QString&, const int, const bool,
+                                const QString&, const QString& ) = 0;
     protected:
         QString mrl;
     signals:
@@ -61,7 +62,8 @@ class FileDestBox: public VirtualDestBox
     Q_OBJECT
     public:
         FileDestBox( QWidget *_parent = NULL );
-        virtual QString getMRL( const QString& );
+        virtual QString getMRL( const QString&, const int, const bool,
+                                const QString&, const QString& );
     private:
         QLineEdit *fileEdit;
     private slots:
@@ -73,7 +75,8 @@ class HTTPDestBox: public VirtualDestBox
     Q_OBJECT
     public:
         HTTPDestBox( QWidget *_parent = NULL );
-        virtual QString getMRL( const QString& );
+        virtual QString getMRL( const QString&, const int, const bool,
+                                const QString&, const QString& );
     private:
         QLineEdit *HTTPEdit;
         QSpinBox *HTTPPort;
@@ -84,7 +87,8 @@ class MMSHDestBox: public VirtualDestBox
     Q_OBJECT
     public:
         MMSHDestBox( QWidget *_parent = NULL );
-        virtual QString getMRL( const QString& );
+        virtual QString getMRL( const QString&, const int, const bool,
+                                const QString&, const QString& );
     private:
         QLineEdit *MMSHEdit;
         QSpinBox *MMSHPort;
@@ -95,7 +99,8 @@ class RTSPDestBox: public VirtualDestBox
     Q_OBJECT
     public:
         RTSPDestBox( QWidget *_parent = NULL );
-        virtual QString getMRL( const QString& );
+        virtual QString getMRL( const QString&, const int, const bool,
+                                const QString&, const QString& );
     private:
         QLineEdit *RTSPEdit;
         QSpinBox *RTSPPort;
@@ -106,7 +111,8 @@ class UDPDestBox: public VirtualDestBox
     Q_OBJECT
     public:
         UDPDestBox( QWidget *_parent = NULL );
-        virtual QString getMRL( const QString& );
+        virtual QString getMRL( const QString&, const int, const bool,
+                                const QString&, const QString& );
     private:
         QLineEdit *UDPEdit;
         QSpinBox *UDPPort;
@@ -117,7 +123,8 @@ class RTPDestBox: public VirtualDestBox
     Q_OBJECT
     public:
         RTPDestBox( QWidget *_parent = NULL, const char *mux = NULL );
-        virtual QString getMRL( const QString& );
+        virtual QString getMRL( const QString&, const int, const bool,
+                                const QString&, const QString& );
     private:
         QLineEdit *RTPEdit;
         QSpinBox *RTPPort;
@@ -129,7 +136,8 @@ class ICEDestBox: public VirtualDestBox
     Q_OBJECT
     public:
         ICEDestBox( QWidget *_parent = NULL );
-        virtual QString getMRL( const QString& );
+        virtual QString getMRL( const QString&, const int, const bool,
+                                const QString&, const QString& );
     private:
         QLineEdit *ICEEdit;
         QLineEdit *ICEMountEdit;
diff --git a/modules/gui/qt4/dialogs/sout.cpp b/modules/gui/qt4/dialogs/sout.cpp
index c091744..4122cdf 100644
--- a/modules/gui/qt4/dialogs/sout.cpp
+++ b/modules/gui/qt4/dialogs/sout.cpp
@@ -193,7 +193,10 @@ void SoutDialog::updateMRL()
         if( !vdb )
             continue;
 
-        QString tempMRL = vdb->getMRL( qs_mux );
+        QString tempMRL = vdb->getMRL( qs_mux, ui.ttl->value(),
+                                       ui.sap->isChecked(),
+                                       ui.sapName->text(),
+                                       ui.sapGroup->text() );
         if( tempMRL.isEmpty() ) continue;
 
         if( multi )
@@ -219,33 +222,7 @@ void SoutDialog::updateMRL()
 
     mrl = smrl.getMrl();
 
-    if( ui.sap->isChecked() )
-    {
-        QString group = ui.sapGroup->text();
-        QString name = ui.sapName->text();
-
-        /* FIXME: This sucks. We should really return a QStringList instead of
-         * (mis)quoting, concatainating and split input item paramters. */
-        name = name.replace( " ", " " );
-        group = group.replace( " ", " " );
-
-        /* We need to add options for both standard and rtp targets */
-        /* This is inelegant but simple and functional */
-        mrl.append( qfu( " :sout-rtp-sap" ) );
-        mrl.append( qfu( " :sout-rtp-name=" ) + name );
-        mrl.append( qfu( " :sout-standard-sap" ) );
-        mrl.append( qfu( " :sout-standard-name=" ) + name );
-        mrl.append( qfu( " :sout-standard-group=" ) + group );
-    }
-    else
-    {
-        mrl.append( qfu( " :no-sout-rtp-sap" ) );
-        mrl.append( qfu( " :no-sout-standard-sap" ) );
-    }
-
     if( ui.soutAll->isChecked() ) mrl.append( " :sout-all" );
-
-    mrl.append( qfu( " :ttl=" ) + QString::number( ui.ttl->value() ) );
     mrl.append( " :sout-keep" );
 
     ui.mrlEdit->setPlainText( mrl );

-- 
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