changeset 7a01ef1a661a in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=7a01ef1a661a
description: ability to fix framerate and video size for jingle video.
diffstat:
data/gui/preferences_window.ui | 48 +++++++++++++++++++++++++++++++++++++-
src/common/config.py | 2 +
src/common/jingle_rtp.py | 16 ++++++++++++-
src/config.py | 52 +++++++++++++++++++++++++++++++----------
4 files changed, 103 insertions(+), 15 deletions(-)
diffs (198 lines):
diff -r bda0dc14fb70 -r 7a01ef1a661a data/gui/preferences_window.ui
--- a/data/gui/preferences_window.ui Fri Jun 18 07:45:07 2010 +0200
+++ b/data/gui/preferences_window.ui Sat Jun 19 15:44:10 2010 +0200
@@ -2136,7 +2136,7 @@
<child>
<object class="GtkTable" id="table8">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">4</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
@@ -2184,6 +2184,52 @@
<property name="bottom_attach">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="label26">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label"
translatable="yes">Video framerate</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label27">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label"
translatable="yes">Video size</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox"
id="video_framerate_combobox">
+ <property name="visible">True</property>
+ <signal name="changed"
handler="on_video_framerate_combobox_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox"
id="video_size_combobox">
+ <property name="visible">True</property>
+ <signal name="changed"
handler="on_video_size_combobox_changed"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff -r bda0dc14fb70 -r 7a01ef1a661a src/common/config.py
--- a/src/common/config.py Fri Jun 18 07:45:07 2010 +0200
+++ b/src/common/config.py Sat Jun 19 15:44:10 2010 +0200
@@ -277,6 +277,8 @@
'audio_output_device': [opt_str, 'autoaudiosink'],
'video_input_device': [opt_str, 'autovideosrc ! videoscale !
ffmpegcolorspace'],
'video_output_device': [opt_str, 'autovideosink'],
+ 'video_framerate': [opt_str, '', _('Optionally fix jingle output
video framerate. Example: 10/1 or 25/2')],
+ 'video_size': [opt_str, '', _('Optionally resize jingle output
video. Example: 320x240')],
'audio_input_volume': [opt_int, 50],
'audio_output_volume': [opt_int, 50],
'use_stun_server': [opt_bool, True, _('If True, Gajim will try to
use a STUN server when using jingle. The one in "stun_server" option, or the
one given by the jabber server.')],
diff -r bda0dc14fb70 -r 7a01ef1a661a src/common/jingle_rtp.py
--- a/src/common/jingle_rtp.py Fri Jun 18 07:45:07 2010 +0200
+++ b/src/common/jingle_rtp.py Sat Jun 19 15:44:10 2010 +0200
@@ -365,8 +365,22 @@
JingleRTPContent.setup_stream(self)
# the local parts
+ if gajim.config.get('video_framerate'):
+ framerate = 'videorate ! video/x-raw-yuv,framerate=%s ! ' % \
+ gajim.config.get('video_framerate')
+ else:
+ framerate = ''
+ try:
+ w, h = gajim.config.get('video_size').split('x')
+ except:
+ w = h = None
+ if w and h:
+ video_size = 'video/x-raw-yuv,width=%s,height=%s ! ' % (w, h)
+ else:
+ video_size = ''
self.src_bin = self.make_bin_from_config('video_input_device',
- '%s ! videoscale ! ffmpegcolorspace', _("video input"))
+ '%%s ! %svideoscale ! %sffmpegcolorspace' % (framerate,
video_size),
+ _("video input"))
#caps = gst.element_factory_make('capsfilter')
#caps.set_property('caps', gst.caps_from_string('video/x-raw-yuv,
width=320, height=240'))
diff -r bda0dc14fb70 -r 7a01ef1a661a src/config.py
--- a/src/config.py Fri Jun 18 07:45:07 2010 +0200
+++ b/src/config.py Sat Jun 19 15:44:10 2010 +0200
@@ -429,27 +429,47 @@
buf.connect('changed', self.on_msg_textview_changed)
### Audio / Video tab ###
- def create_av_combobox(opt_name, device_dict):
+ def create_av_combobox(opt_name, device_dict, config_name=None,
+ key=None):
combobox = self.xml.get_object(opt_name + '_combobox')
cell = gtk.CellRendererText()
combobox.pack_start(cell, True)
combobox.add_attribute(cell, 'text', 0)
model = gtk.ListStore(str, str)
combobox.set_model(model)
-
- for index, (name, value) in
enumerate(sorted(device_dict.iteritems())):
+ if config_name:
+ config = gajim.config.get(config_name)
+ else:
+ config = gajim.config.get(opt_name + '_device')
+
+ for index, (name, value) in enumerate(sorted(device_dict.\
+ iteritems(), key=key)):
model.append((name, value))
- if gajim.config.get(opt_name + '_device') == value:
+ if config == value:
combobox.set_active(index)
if HAS_GST:
create_av_combobox('audio_input',
AudioInputManager().get_devices())
- create_av_combobox('audio_output',
AudioOutputManager().get_devices())
+ create_av_combobox('audio_output',
AudioOutputManager().get_devices(
+ ))
create_av_combobox('video_input',
VideoInputManager().get_devices())
- create_av_combobox('video_output',
VideoOutputManager().get_devices())
+ create_av_combobox('video_output',
VideoOutputManager().get_devices(
+ ))
+
+ def cmp_framerate(f1, f2):
+ print 'tt'
+ create_av_combobox('video_framerate', {_('Default'): '',
+ '15fps': '15/1', '10fps': '10/1', '5fps': '5/1',
+ '2.5fps': '5/2'}, 'video_framerate', key=lambda x: -1 if \
+ x[0] == 'Default' else float(x[0][:-3]))
+ create_av_combobox('video_size', {_('Default'): '',
+ '800x600': '800x600', '640x480': '640x480',
+ '320x240': '320x240'}, 'video_size', key=lambda x: -1 if \
+ x[0] == 'Default' else int(x[0][:3]))
+
else:
for opt_name in ('audio_input', 'audio_output', 'video_input',
- 'video_output'):
+ 'video_output', 'video_framerate', 'video_size'):
combobox = self.xml.get_object(opt_name + '_combobox')
combobox.set_sensitive(False)
@@ -1076,23 +1096,29 @@
def on_msg_treemodel_row_deleted(self, model, path):
self.save_status_messages(model)
- def on_av_combobox_changed(self, combobox, opt_name):
+ def on_av_combobox_changed(self, combobox, config_name):
model = combobox.get_model()
active = combobox.get_active()
device = model[active][1].decode('utf-8')
- gajim.config.set(opt_name + '_device', device)
+ gajim.config.set(config_name, device)
def on_audio_input_combobox_changed(self, widget):
- self.on_av_combobox_changed(widget, 'audio_input')
+ self.on_av_combobox_changed(widget, 'audio_input_device')
def on_audio_output_combobox_changed(self, widget):
- self.on_av_combobox_changed(widget, 'audio_output')
+ self.on_av_combobox_changed(widget, 'audio_output_device')
def on_video_input_combobox_changed(self, widget):
- self.on_av_combobox_changed(widget, 'video_input')
+ self.on_av_combobox_changed(widget, 'video_input_device')
def on_video_output_combobox_changed(self, widget):
- self.on_av_combobox_changed(widget, 'video_output')
+ self.on_av_combobox_changed(widget, 'video_output_device')
+
+ def on_video_framerate_combobox_changed(self, widget):
+ self.on_av_combobox_changed(widget, 'video_framerate')
+
+ def on_video_size_combobox_changed(self, widget):
+ self.on_av_combobox_changed(widget, 'video_size')
def on_stun_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'use_stun_server',
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits