Ejemplo n.º 1
0
    def remote_setGstDebug(self, debug):
        """
        Sets the GStreamer debugging levels based on the passed debug string.

        @since: 0.4.2
        """
        self.debug('Setting GStreamer debug level to %s' % debug)
        if not debug:
            return

        for part in debug.split(','):
            glob = None
            value = None
            pair = part.split(':')
            if len(pair) == 1:
                # assume only the value
                value = int(pair[0])
            elif len(pair) == 2:
                glob, value = pair
                value = int(value)
            else:
                self.warning("Cannot parse GStreamer debug setting '%s'." %
                    part)
                continue

            if glob:
                try:
                    # value has to be an integer
                    gst.debug_set_threshold_for_name(glob, value)
                except TypeError:
                    self.warning("Cannot set glob %s to value %s" % (
                        glob, value))
            else:
                gst.debug_set_default_threshold(value)
Ejemplo n.º 2
0
    def remote_setGstDebug(self, debug):
        """
        Sets the GStreamer debugging levels based on the passed debug string.

        @since: 0.4.2
        """
        self.debug('Setting GStreamer debug level to %s' % debug)
        if not debug:
            return

        for part in debug.split(','):
            glob = None
            value = None
            pair = part.split(':')
            if len(pair) == 1:
                # assume only the value
                value = int(pair[0])
            elif len(pair) == 2:
                glob, value = pair
                value = int(value)
            else:
                self.warning("Cannot parse GStreamer debug setting '%s'." %
                             part)
                continue

            if glob:
                try:
                    # value has to be an integer
                    gst.debug_set_threshold_for_name(glob, value)
                except TypeError:
                    self.warning("Cannot set glob %s to value %s" %
                                 (glob, value))
            else:
                gst.debug_set_default_threshold(value)

        self.comp.uiState.set('gst-debug', debug)
Ejemplo n.º 3
0
    init_time = None
vsrc = vetosrc.vetoSource(options.input_path, options.input_prefix,
                          options.input_ext, options.wait_time, init_time,
                          options.dir_digits, options.log_file,
                          options.idq_log_file)

# Create the appsrc with accoutrements
appsrc = pipeparts.mkgeneric(pipeline,
                             None,
                             "appsrc",
                             caps=gst.Caps(vsrc.caps),
                             format="time")
appsrc.connect('need-data', vsrc.need_data)

# Set debug level for logging purposes
gst.debug_set_threshold_for_name('python', gst.LEVEL_INFO)

# Define the muxer.
mux = pipeparts.mkframecppchannelmux(pipeline,
                                     None,
                                     frames_per_file=options.frames_per_file,
                                     frame_duration=options.frame_duration)

# Link the source to the muxer.
appsrc.get_pad("src").link(
    mux.get_pad(options.instrument + ':' + options.channel_name))

# XXX Hacking. Attach probe to the muxer.
hc = handlerClass()
mux_sink = mux.get_pad(options.instrument + ':' + options.channel_name)
mux_sink.add_buffer_probe(hc.earlyBufferHandler)
# Setup the source class
if options.init_time > 0:
    init_time = options.init_time
else:
    init_time = None
vsrc = vetosrc.vetoSource(options.input_path, options.input_prefix,
            options.input_ext, options.wait_time, init_time, options.dir_digits, 
            options.log_file, options.idq_log_file)

# Create the appsrc with accoutrements
appsrc = pipeparts.mkgeneric(pipeline, None, "appsrc", caps=gst.Caps(vsrc.caps), 
    format="time")
appsrc.connect('need-data', vsrc.need_data)

# Set debug level for logging purposes
gst.debug_set_threshold_for_name('python', gst.LEVEL_INFO)

# Define the muxer.
mux = pipeparts.mkframecppchannelmux(pipeline, None, 
    frames_per_file = options.frames_per_file, 
    frame_duration = options.frame_duration)

# Link the source to the muxer. 
appsrc.get_pad("src").link(mux.get_pad(options.instrument + ':' + options.channel_name))

# XXX Hacking. Attach probe to the muxer.
hc = handlerClass()
mux_sink = mux.get_pad(options.instrument + ':' + options.channel_name)
mux_sink.add_buffer_probe(hc.earlyBufferHandler)

# Final destination.
Ejemplo n.º 5
0
# Final destination.
if options.output_type == "fake":
    fakesink = pipeparts.mkfakesink(pipeline, tcpsrc)
    fs_pad = fakesink.get_pad("sink")
    fs_pad.add_event_probe(probeEventHandler)
    fs_pad.add_buffer_probe(probeBufferHandler)
elif options.output_type == "multicast":
    fx = pipeparts.mkgeneric(pipeline,
                             tcpsrc,
                             "gds_framexmitsink",
                             multicast_group=options.multicast_group,
                             multicast_iface=options.multicast_network,
                             port=options.multicast_port,
                             sync=False)
    if options.verbose:
        gst.debug_set_threshold_for_name('gds_framexmitsink', gst.LEVEL_LOG)
    fx_pad = fx.get_pad("sink")
    fx_pad.add_event_probe(probeEventHandler)
    fx_pad.add_buffer_probe(probeBufferHandler)
elif options.output_type == "files":
    try:
        os.makedirs(options.output_path)
    except Exception as e:
        print "Failed with %s" % e

    # Inject tags.  The framecpp_filesink element uses the tags to figure
    # out the output filename.
    src = pipeparts.mktaginject(pipeline, src,
                                "instrument=%s" % options.instrument)

    path = options.output_path
#
#                                    Main
#
# =============================================================================
#

# Set the pipeline up
pipeline = gst.Pipeline("gst_idq_listener")
mainloop = gobject.MainLoop()
handler = simplehandler.Handler(mainloop,pipeline)

# Create the framexmitsrc
src = pipeparts.mkframexmitsrc(pipeline, multicast_group=options.multicast_group,
    multicast_iface=options.multicast_iface, port=options.multicast_port)
if options.verbose:
    gst.debug_set_threshold_for_name('gds_framexmitsrc', gst.LEVEL_LOG)

# Final destination.
if options.output_type == "fake":
    fakesink = pipeparts.mkfakesink(pipeline, src)    
    fs_pad = fakesink.get_pad("sink")
    fs_pad.add_event_probe(probeEventHandler)
    fs_pad.add_buffer_probe(probeBufferHandler) 
elif options.output_type == "files":
    try:
        os.makedirs(options.output_path)
    except Exception as e:
        print "Failed with %s" % e

    # Inject tags.  The framecpp_filesink element uses the tags to figure
    # out the output filename.