[pulseaudio-discuss] [PATCH] Added fixed port 5004 option for rtp sender

archlinux at nicohood.de archlinux at nicohood.de
Sat Feb 11 10:55:49 UTC 2017


From: NicoHood <nicohood at users.noreply.github.com>

---
 src/paprefs.cc    | 23 ++++++++++++++++++++---
 src/paprefs.glade | 56 ++++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 67 insertions(+), 12 deletions(-)

diff --git a/src/paprefs.cc b/src/paprefs.cc
index 9f3ad31..ca6d9bf 100644
--- a/src/paprefs.cc
+++ b/src/paprefs.cc
@@ -60,6 +60,7 @@ public:
         *rtpReceiveCheckButton,
         *rtpSendCheckButton,
         *rtpLoopbackCheckButton,
+        *rtpPortCheckButton,
         *combineCheckButton,
         *upnpMediaServerCheckButton,
         *upnpNullSinkCheckButton;
@@ -146,6 +147,7 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
     x->get_widget("rtpReceiveCheckButton", rtpReceiveCheckButton);
     x->get_widget("rtpSendCheckButton", rtpSendCheckButton);
     x->get_widget("rtpLoopbackCheckButton", rtpLoopbackCheckButton);
+    x->get_widget("rtpPortCheckButton", rtpPortCheckButton);
     x->get_widget("combineCheckButton", combineCheckButton);
     x->get_widget("upnpMediaServerCheckButton", upnpMediaServerCheckButton);
     x->get_widget("upnpNullSinkCheckButton", upnpNullSinkCheckButton);
@@ -177,6 +179,7 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade:
 
     rtpSendCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend));
     rtpLoopbackCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend));
+    rtpPortCheckButton->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend));
     rtpMikeRadioButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend));
     rtpSpeakerRadioButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend));
     rtpNullSinkRadioButton->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onChangeRtpSend));
@@ -221,6 +224,7 @@ void MainWindow::updateSensitive() {
     rtpSendCheckButton->set_sensitive(rtpSendAvailable);
     b = rtpSendCheckButton->get_active();
     rtpLoopbackCheckButton->set_sensitive(b && !rtpSpeakerRadioButton->get_active() && rtpSendAvailable);
+    rtpPortCheckButton->set_sensitive(b && rtpSendAvailable);
     rtpMikeRadioButton->set_sensitive(b && rtpSendAvailable);
     rtpSpeakerRadioButton->set_sensitive(b && rtpSendAvailable);
     rtpNullSinkRadioButton->set_sensitive(b && rtpSendAvailable);
@@ -513,12 +517,13 @@ void MainWindow::writeToGConfRtpReceive() {
 
 void MainWindow::writeToGConfRtpSend() {
     Gnome::Conf::ChangeSet changeSet;
-    bool loopbackEnabled, mikeEnabled, speakerEnabled = false;
+    bool loopbackEnabled, fixedPort, mikeEnabled, speakerEnabled = false;
 
     changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/locked", true);
     gconf->change_set_commit(changeSet, true);
 
     changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/loopback_enabled", loopbackEnabled = rtpLoopbackCheckButton->get_active());
+    changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/fixed_port", fixedPort = rtpPortCheckButton->get_active());
 
     changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/mode", Glib::ustring(
                           (mikeEnabled = rtpMikeRadioButton->get_active()) ? "microphone" :
@@ -534,7 +539,18 @@ void MainWindow::writeToGConfRtpSend() {
                                                                                 "sink_properties=\"device.description='RTP Multicast' device.bus='network' device.icon_name='network-server'\""));
 
             changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/name1", Glib::ustring("module-rtp-send"));
-            changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/args1", Glib::ustring(loopbackEnabled ? "source=rtp.monitor loop=1" : "source=rtp.monitor loop=0"));
+
+            Glib::ustring params = "source=rtp.monitor";
+            if (loopbackEnabled) {
+                params += " loop=1";
+            }
+            else {
+                params += " loop=0";
+            }
+            if(fixedPort) {
+                params += " port=5004";
+            }
+            changeSet.set(PA_GCONF_PATH_MODULES"/rtp-send/args1", params);
         } else {
             char tmp[256];
 
@@ -617,6 +633,7 @@ void MainWindow::readFromGConf() {
 
     rtpSendCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/rtp-send/enabled"));
     rtpLoopbackCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/rtp-send/loopback_enabled"));
+    rtpPortCheckButton->set_active(gconf->get_bool(PA_GCONF_PATH_MODULES"/rtp-send/fixed_port"));
 
     mode = gconf->get_string(PA_GCONF_PATH_MODULES"/rtp-send/mode");
     if (mode == "microphone")
@@ -637,7 +654,7 @@ void MainWindow::readFromGConf() {
 }
 
 gchar * MainWindow::modulePath(const gchar *name) {
-  gchar *path, *c, **versions;
+  gchar *path, **versions;
 
   versions = g_strsplit(pa_get_library_version(), ".", 3);
   if (versions[0] && versions[1]) {
diff --git a/src/paprefs.glade b/src/paprefs.glade
index b2567de..da6b891 100644
--- a/src/paprefs.glade
+++ b/src/paprefs.glade
@@ -1,16 +1,17 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <glade-interface>
   <!-- interface-requires gtk+ 2.16 -->
   <!-- interface-naming-policy toplevel-contextual -->
   <widget class="GtkWindow" id="mainWindow">
+    <property name="can_focus">False</property>
     <property name="title" translatable="yes">PulseAudio Preferences</property>
     <property name="resizable">False</property>
     <property name="icon_name">preferences-desktop</property>
     <child>
       <widget class="GtkVBox" id="vbox20">
         <property name="visible">True</property>
+        <property name="can_focus">False</property>
         <property name="border_width">12</property>
-        <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child>
           <widget class="GtkNotebook" id="notebook1">
@@ -20,12 +21,13 @@
             <child>
               <widget class="GtkVBox" id="vbox30">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
-                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <widget class="GtkHBox" id="hbox1">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <child>
                       <widget class="GtkCheckButton" id="zeroconfDiscoverCheckButton">
                         <property name="label" translatable="yes">Make discoverable _PulseAudio network sound devices available locally</property>
@@ -67,6 +69,7 @@
                 <child>
                   <widget class="GtkHBox" id="hbox2">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <child>
                       <widget class="GtkCheckButton" id="zeroconfRaopDiscoverCheckButton">
                         <property name="label" translatable="yes">Make discoverable Apple A_irTunes sound devices available locally</property>
@@ -109,6 +112,7 @@
                   <widget class="GtkLabel" id="tm">
                     <property name="visible">True</property>
                     <property name="sensitive">False</property>
+                    <property name="can_focus">False</property>
                     <property name="label" translatable="yes"><i>Apple and AirTunes are trademarks of Apple Inc., registered in the U.S. and other countries.</i></property>
                     <property name="use_markup">True</property>
                     <property name="single_line_mode">True</property>
@@ -125,6 +129,7 @@
             <child>
               <widget class="GtkLabel" id="label1">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="label" translatable="yes">Network _Access</property>
                 <property name="use_underline">True</property>
@@ -137,12 +142,13 @@
             <child>
               <widget class="GtkVBox" id="vbox2">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
-                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <widget class="GtkHBox" id="hbox3">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <child>
                       <widget class="GtkCheckButton" id="remoteAccessCheckButton">
                         <property name="label" translatable="yes">Enable _network access to local sound devices</property>
@@ -183,15 +189,17 @@
                 <child>
                   <widget class="GtkAlignment" id="alignment8">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
                       <widget class="GtkVBox" id="vbox34">
                         <property name="visible">True</property>
-                        <property name="orientation">vertical</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">6</property>
                         <child>
                           <widget class="GtkHBox" id="hbox4">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <child>
                               <widget class="GtkCheckButton" id="zeroconfBrowseCheckButton">
                                 <property name="label" translatable="yes">Allow other machines on the LAN to _discover local sound devices</property>
@@ -224,6 +232,8 @@
                             </child>
                           </widget>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
@@ -254,6 +264,7 @@
                 <child>
                   <widget class="GtkHBox" id="hbox5">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <child>
                       <widget class="GtkCheckButton" id="upnpMediaServerCheckButton">
                         <property name="label" translatable="yes">Make local sound devices available as DLNA/_UPnP Media Server</property>
@@ -295,11 +306,12 @@
                 <child>
                   <widget class="GtkAlignment" id="alignment2">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
                       <widget class="GtkVBox" id="vbox3">
                         <property name="visible">True</property>
-                        <property name="orientation">vertical</property>
+                        <property name="can_focus">False</property>
                         <child>
                           <widget class="GtkCheckButton" id="upnpNullSinkCheckButton">
                             <property name="label" translatable="yes">Create separate audio device for DLNA/UPnP media streaming</property>
@@ -333,6 +345,7 @@
             <child>
               <widget class="GtkLabel" id="label3">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="label" translatable="yes">Network _Server</property>
                 <property name="use_underline">True</property>
@@ -346,12 +359,13 @@
             <child>
               <widget class="GtkVBox" id="vbox31">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
-                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <widget class="GtkHBox" id="hbox6">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <child>
                       <widget class="GtkCheckButton" id="rtpReceiveCheckButton">
                         <property name="label" translatable="yes">Enable Multicast/RTP re_ceiver</property>
@@ -392,6 +406,7 @@
                 <child>
                   <widget class="GtkHBox" id="hbox7">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <child>
                       <widget class="GtkCheckButton" id="rtpSendCheckButton">
                         <property name="label" translatable="yes">Enable Multicast/RTP s_ender</property>
@@ -432,11 +447,12 @@
                 <child>
                   <widget class="GtkAlignment" id="alignment10">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
                       <widget class="GtkVBox" id="vbox36">
                         <property name="visible">True</property>
-                        <property name="orientation">vertical</property>
+                        <property name="can_focus">False</property>
                         <property name="spacing">6</property>
                         <child>
                           <widget class="GtkRadioButton" id="rtpMikeRadioButton">
@@ -501,10 +517,27 @@
                             <property name="position">3</property>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="GtkCheckButton" id="rtpPortCheckButton">
+                            <property name="label" translatable="yes">Send on fixed _port 5004</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">4</property>
+                          </packing>
+                        </child>
                       </widget>
                     </child>
                   </widget>
                   <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
                     <property name="position">2</property>
                   </packing>
                 </child>
@@ -516,6 +549,7 @@
             <child>
               <widget class="GtkLabel" id="label2">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="label" translatable="yes">Multicast/R_TP</property>
                 <property name="use_underline">True</property>
@@ -529,8 +563,8 @@
             <child>
               <widget class="GtkVBox" id="vbox4">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="border_width">12</property>
-                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <widget class="GtkCheckButton" id="combineCheckButton">
@@ -555,6 +589,7 @@
             <child>
               <widget class="GtkLabel" id="label4">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Simultaneous _Output</property>
                 <property name="use_underline">True</property>
               </widget>
@@ -566,12 +601,15 @@
             </child>
           </widget>
           <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
             <property name="position">0</property>
           </packing>
         </child>
         <child>
           <widget class="GtkHButtonBox" id="hbuttonbox1">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
               <widget class="GtkButton" id="closeButton">
-- 
2.11.1



More information about the pulseaudio-discuss mailing list