[farsight2/master] Show the current send codecs in the fs2-gui
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:23:28 PST 2008
---
tests/gui/fs2-gui.glade | 100 +++++++++++++++++++++++++++++++++++++++--------
tests/gui/fs2-gui.py | 49 +++++++++++++++++++++++
2 files changed, 132 insertions(+), 17 deletions(-)
diff --git a/tests/gui/fs2-gui.glade b/tests/gui/fs2-gui.glade
index af2e464..0c276fe 100644
--- a/tests/gui/fs2-gui.glade
+++ b/tests/gui/fs2-gui.glade
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.0 on Mon Mar 31 15:42:21 2008 -->
+<!--Generated with glade3 3.4.0 on Tue Jun 17 12:24:01 2008 -->
<glade-interface>
<widget class="GtkWindow" id="main_window">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -32,37 +32,103 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkAspectFrame" id="preview_aspectframe">
+ <widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="border_width">6</property>
- <property name="label_xalign">0</property>
- <property name="ratio">1.3300000429153442</property>
<child>
- <widget class="GtkDrawingArea" id="preview_drawingarea">
- <property name="width_request">160</property>
- <property name="height_request">120</property>
+ <widget class="GtkAspectFrame" id="preview_aspectframe">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <signal name="expose_event" handler="exposed"/>
+ <property name="border_width">6</property>
+ <property name="label_xalign">0</property>
+ <property name="ratio">1.3300000429153442</property>
+ <child>
+ <widget class="GtkDrawingArea" id="preview_drawingarea">
+ <property name="width_request">160</property>
+ <property name="height_request">120</property>
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <signal name="expose_event" handler="exposed"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="frame_label">
+ <property name="visible">True</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"><b>User</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
</widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
<child>
- <widget class="GtkLabel" id="frame_label">
+ <widget class="GtkTable" id="table4">
<property name="visible">True</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"><b>User</b></property>
- <property name="use_markup">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</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">Audio:</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="x_padding">6</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</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">Video:</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="x_padding">6</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="audio_combobox">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <signal name="changed" handler="audio_combobox_changed_cb"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="video_combobox">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <signal name="changed" handler="video_combobox_changed_cb"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
</widget>
<packing>
- <property name="type">label_item</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
</child>
<child>
<widget class="GtkHBox" id="participants_hbox">
diff --git a/tests/gui/fs2-gui.py b/tests/gui/fs2-gui.py
index cd8bf3c..04de2ef 100644
--- a/tests/gui/fs2-gui.py
+++ b/tests/gui/fs2-gui.py
@@ -152,9 +152,18 @@ class FsUIPipeline:
elif message.structure.has_name("farsight-codecs-changed"):
print message.src.get_name(), ": ", message.structure.get_name()
message.structure["session"].uisession.codecs_changed()
+ if message.structure["session"] == self.audiosession.fssession:
+ self.codecs_changed_audio()
+ if message.structure["session"] == self.videosession.fssession:
+ self.codecs_changed_video()
elif message.structure.has_name("farsight-send-codec-changed"):
print message.src.get_name(), ": ", message.structure.get_name()
print "send codec changed: " + message.structure["codec"].to_string()
+ if message.structure["session"] == self.audiosession.fssession:
+ self.codecs_changed_audio()
+ if message.structure["session"] == self.videosession.fssession:
+ self.codecs_changed_video()
+
elif message.structure.has_name("farsight-error"):
print "Async error ("+ str(message.structure["error-no"]) +"): " + message.structure["error-msg"] +" --- "+ message.structure["debug-msg"]
else:
@@ -640,9 +649,26 @@ class FsMainUI:
def __init__(self, mode, ip, port):
self.mode = mode
self.pipeline = FsUIPipeline()
+ self.pipeline.codecs_changed_audio = self.reset_audio_codecs
+ self.pipeline.codecs_changed_video = self.reset_video_codecs
self.glade = gtk.glade.XML(gladefile, "main_window")
self.glade.signal_autoconnect(self)
self.mainwindow = self.glade.get_widget("main_window")
+ self.audio_combobox = self.glade.get_widget("audio_combobox")
+ self.video_combobox = self.glade.get_widget("video_combobox")
+ liststore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
+ self.audio_combobox.set_model(liststore)
+ cell = gtk.CellRendererText()
+ self.audio_combobox.pack_start(cell, True)
+ self.audio_combobox.add_attribute(cell, 'text', 0)
+ self.reset_audio_codecs()
+ liststore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
+ self.video_combobox.set_model(liststore)
+ cell = gtk.CellRendererText()
+ self.video_combobox.pack_start(cell, True)
+ self.video_combobox.add_attribute(cell, 'text', 0)
+ self.reset_video_codecs()
+
if mode == CLIENT:
self.client = FsUIClient(ip, port, mycname, FsUIParticipant,
self.pipeline, self)
@@ -658,6 +684,28 @@ class FsMainUI:
self.mainwindow.show()
+ def reset_codecs(self, combobox, fssession):
+ liststore = combobox.get_model()
+ current = fssession.get_property("current-send-codec")
+ liststore.clear()
+ for c in fssession.get_property("codecs"):
+ str = ("%s: %s/%s %s" % (c.id,
+ c.media_type.value_nick,
+ c.encoding_name,
+ c.clock_rate))
+ iter = liststore.append([str, c])
+ if current and c and current.id == c.id:
+ combobox.set_active_iter(iter)
+ print "active: "+ c.to_string()
+
+ def reset_audio_codecs(self):
+ self.reset_codecs(self.audio_combobox,
+ self.pipeline.audiosession.fssession)
+
+ def reset_video_codecs(self):
+ self.reset_codecs(self.video_combobox,
+ self.pipeline.videosession.fssession)
+
def exposed(self, widget, *args):
"Callback from the exposed event of the widget to make the preview sink"
if not VIDEO:
@@ -721,6 +769,7 @@ class FsMainUI:
del self.dtmf
+
class FsUIStartup:
"Displays the startup window and then creates the FsMainUI"
--
1.5.6.5
More information about the farsight-commits
mailing list