# and the pipeline construction went well (or not))
# - Add an input source choice for the user (camera on IP or webcam)
# - Add a time counter
-# - Add a VU-meter to check if audio feed is emitting signal
# - Add a 'CPU load' widget
# - Add the FSF logo (need to do some pixel art) as an application icon
# - Add the FSF logo inside the streamer use the 'textoverlay' method in ElementFactory.make()
'organisation':'NC',}
start_time = 0
+
class Streamgui(object):
self.videowidget = Gtk.DrawingArea()
self.videowidget.set_size_request(600, 400)
- self.vumeter = Gtk.ProgressBar()
- self.vumeter.set_orientation(Gtk.Orientation.VERTICAL)
- self.vumeter.set_inverted(True)
+ # True stereo feed has to be implemented:
+ self.vumeter_l = Gtk.ProgressBar()
+ self.vumeter_l.set_orientation(Gtk.Orientation.VERTICAL)
+ self.vumeter_l.set_inverted(True)
+ self.vumeter_r = Gtk.ProgressBar()
+ self.vumeter_r.set_orientation(Gtk.Orientation.VERTICAL)
+ self.vumeter_r.set_inverted(True)
## Use CSS to modify the color of ProgressBar
## color = Gdk.RGBA()
## Gdk.RGBA.parse(color, 'rgb(240,0,150)')
self.streamtime_value = Gtk.Label('00:00:00')
hbox_videoaudio.pack_start(self.videowidget, True, True, 0)
- hbox_videoaudio.pack_start(self.vumeter, True, True, 0)
+ hbox_videoaudio.pack_start(self.vumeter_l, False, False, 3)
+ hbox_videoaudio.pack_start(self.vumeter_r, False, False, 3)
vbox_labels.pack_start(self.baseinfo_label, True, True, 0)
vbox_labels.pack_start(self.speakerinfo_label, True, True, 0)
vbox_labels.pack_start(self.sessioninfo_label, True, True, 0)
bus = gstconf.get_gstreamer_bus()
bus.connect('sync-message::element', self.on_sync_message)
- bus.connect('message', self.on_level_message)
+ bus.connect('message', self.on_message)
## Try to use 'sync-message::element' instead of 'message''
def on_sync_message(self, bus, message):
imagesink.set_property('force-aspect-ratio', True)
imagesink.set_window_handle(self.videowidget.get_property('window').get_xid())
- def on_level_message(self, bus, message):
+ def on_message(self, bus, message):
+ # Getting the RMS audio level value:
s = Gst.Message.get_structure(message)
if message.type == Gst.MessageType.ELEMENT:
if str(Gst.Structure.get_name(s)) == 'level':
pct = self.iec_scale(s.get_value('rms')[0])
- ##print('Level value: ', pct, '%')
- self.vumeter.set_fraction(pct)
+ ##print('Level value: ', pct, '%') # [DEBUG]
+ self.vumeter_l.set_fraction(pct)
+ self.vumeter_r.set_fraction(pct)
+ # Watching for feed loss during streaming:
+ t = message.type
+ if t == Gst.MessageType.ERROR:
+ self.create_backup_pipeline()
+ #pass
+ def create_backup_pipeline(self):
+ labelname = self.stream_button.get_label()
+ if labelname == 'ON AIR':
+ self.pipel = gstconf.New_user_pipeline(feed='backup',)
+ bus = gstconf.get_gstreamer_bus()
+ bus.connect('sync-message::element', self.on_sync_message)
+ self.pipel.stream_play()
+ print('[WARNING] Backup pipeline started.')
+
def on_stream_clicked(self, widget):
labelname = self.stream_button.get_label()