Esempio n. 1
0
    def _bus_message_received_cb(self, bus, message):
        """
        @param bus: the message bus sending the message
        @param message: the message received
        """
        if message.structure.get_name() == "ieee1394-bus-reset":
            # we have a firewire bus reset
            s = message.structure
            # current-device-change is only in gst-plugins-good >= 0.10.3
            if 'current-device-change' in s.keys():
                if s['current-device-change'] != 0:
                    # we actually have a connect or disconnect of the camera
                    # so first remove all the previous messages warning about a
                    # firewire-bus-reset

                    for m in self.state.get('messages'):
                        if m.id.startswith('firewire-bus-reset'):
                            self.state.remove('messages', m)

                    if s['current-device-change'] == 1:
                        # connected
                        m = messages.Info(T_(N_(
                            "The camera has now been reconnected.")),
                            mid="firewire-bus-reset-%d" % s['nodecount'],
                            priority=40)
                        self.state.append('messages', m)
                    elif s['current-device-change'] == -1:
                        # disconnected
                        m = messages.Warning(T_(N_(
                            "The camera has been disconnected.")),
                            mid="firewire-bus-reset-%d" % s['nodecount'],
                            priority=40)
                        self.state.append('messages', m)
Esempio n. 2
0
    def requireElements(self, workerName, *elementNames):
        """Require that the given list of GStreamer elements exists on the
        given worker. If the elements do not exist, an error message is
        posted and the next button remains blocked.
        @param workerName: name of the worker to check on
        @type workerName: string
        @param elementNames: names of the elements to check
        @type elementNames: list of strings
        @returns: element name
        @rtype: deferred -> list of strings
        """
        if not self._adminModel:
            self.debug('No admin connected, not checking presence of elements')
            return

        self.debug('requiring elements %r' % (elementNames, ))
        f = ngettext(
            "Checking the existence of GStreamer element '%s' "
            "on %s worker.",
            "Checking the existence of GStreamer elements '%s' "
            "on %s worker.", len(elementNames))
        msg = messages.Info(T_(f, "', '".join(elementNames), workerName),
                            mid='require-elements')

        self.add_msg(msg)

        def gotMissingElements(elements, workerName):
            self.clear_msg('require-elements')

            if elements:
                self.warning('elements %r do not exist' % (elements, ))
                f = ngettext(
                    "Worker '%s' is missing GStreamer element '%s'.",
                    "Worker '%s' is missing GStreamer elements '%s'.",
                    len(elements))
                message = messages.Error(
                    T_(f, workerName, "', '".join(elements)))
                message.add(
                    T_(
                        N_("\n"
                           "Please install the necessary GStreamer plug-ins that "
                           "provide these elements and restart the worker.")))
                message.add(
                    T_(
                        N_("\n\n"
                           "You will not be able to go forward using this worker."
                           )))
                message.id = 'element' + '-'.join(elementNames)
                documentation.messageAddGStreamerInstall(message)
                self.add_msg(message)
            self.taskFinished(bool(elements))
            return elements

        self.waitForTask('require elements %r' % (elementNames, ))
        d = self.checkElements(workerName, *elementNames)
        d.addCallback(gotMissingElements, workerName)

        return d
Esempio n. 3
0
    def _runChecks(self):
        self._setSensitive(False)
        msg = messages.Info(T_(N_('Checking for Firewire device...')),
            mid='firewire-check')
        self.wizard.add_msg(msg)

        d = self.runInWorker('flumotion.worker.checks.gst010', 'check1394',
            mid='firewire-check', guid=self.guid.get_selected())

        def chooseDecoder(missing):
            if 'ffdec_dvvideo' in missing and 'dvdec' not in missing:
                msg = messages.Warning(T_(
                    N_("GStreamer's dv decoder element (dvdec) will be used "
                       "instead of FFmpeg's which is better in terms of "
                       "performance.\nIf the configuration doesn't work "
                       "properly, consider installing the ffmpeg plugins for "
                       "gstreamer.")), mid='firewire-warning')
                self.wizard.add_msg(msg)
                self.model.properties.decoder = 'dvdec'
            elif 'dvdec' in missing:
                msg = messages.Error(T_(
                    N_("None of the dv decoder elements was found in your "
                       "system, consider installing the ffmpeg plugins for "
                       "gstreamer to continue.")), mid='firewire-error')
                self.wizard.add_msg(msg)
                self.wizard.blockNext(True)

        def firewireCheckDone(options):
            self.wizard.clear_msg('firewire-check')
            self._dims = (options['width'], options['height'])
            self._par = options['par']
            self._input_heights = [self._dims[1]/i for i in self._factors]
            self._input_widths = [self._dims[0]/i for i in self._factors]
            values = []
            for i, height in enumerate(self._input_heights):
                values.append(('%d pixels' % height, i))
            self.combobox_scaled_height.prefill(values)
            if len(values) > 2:
                self.combobox_scaled_height.set_active(1)
            self._setSensitive(True)
            self._update_output_format(True)

            d = self.wizard.checkElements(self.model.worker,
                                          'ffdec_dvvideo', 'dvdec')
            d.addCallback(chooseDecoder)
            return d

        def trapRemoteFailure(failure):
            failure.trap(errors.RemoteRunFailure)

        def trapRemoteError(failure):
            failure.trap(errors.RemoteRunError)

        d.addCallback(firewireCheckDone)
        d.addErrback(trapRemoteError)
        d.addErrback(trapRemoteFailure)
        return d
Esempio n. 4
0
    def init(self):
        if not gstreamer.get_plugin_version('coreelements'):
            raise errors.MissingElementError('identity')
        if not gstreamer.element_factory_has_property(
                'identity', 'check-imperfect-timestamp'):
            self.checkTimestamp = False
            self.checkOffset = False
            self.addMessage(
                messages.Info(
                    T_(
                        N_("You will get more debugging information "
                           "if you upgrade to GStreamer 0.10.13 or later."))))

        self.EATER_TMPL = self.FDSRC_TMPL + ' %(queue)s ' + self.DEPAY_TMPL
        if self.checkTimestamp or self.checkOffset:
            self.EATER_TMPL += " ! identity name=%(name)s-identity silent=TRUE"
        if self.checkTimestamp:
            self.EATER_TMPL += " check-imperfect-timestamp=1"
        if self.checkOffset:
            self.EATER_TMPL += " check-imperfect-offset=1"
Esempio n. 5
0
    def _populateDevices(self):
        self._setSensitive(False)
        msg = messages.Info(T_(N_('Checking for Firewire devices...')),
                            mid='firewire-check')
        self.wizard.add_msg(msg)
        d = self.runInWorker('flumotion.worker.checks.device', 'fetchDevices',
                             'firewire-check', ['dv1394src'], 'guid')

        def firewireCheckDone(devices):
            self.wizard.clear_msg('firewire-check')
            self.guid.prefill(devices)

        def trapRemoteFailure(failure):
            failure.trap(errors.RemoteRunFailure)

        def trapRemoteError(failure):
            failure.trap(errors.RemoteRunError)

        d.addCallback(firewireCheckDone)
        d.addErrback(trapRemoteError)
        d.addErrback(trapRemoteFailure)

        return d
Esempio n. 6
0
    def configure_pipeline(self, pipeline, properties):
        # add volume effect
        comp_level = pipeline.get_by_name('volumelevel')
        allowVolumeSet = True
        if gst.pygst_version < (0, 10, 7):
            allowVolumeSet = False
            m = messages.Info(T_(
                N_("The soundcard volume cannot be changed with this version "
                   "of the 'gst-python' library.\n")),
                              mid='mixer-track-setting')
            m.add(
                T_(
                    N_("Please upgrade '%s' to version %s or later "
                       "if you require this functionality."), 'gst-python',
                    '0.10.7'))
            self.addMessage(m)

        vol = volume.Volume('inputVolume',
                            comp_level,
                            pipeline,
                            allowIncrease=False,
                            allowVolumeSet=allowVolumeSet)
        self.addEffect(vol)
        self._srcelement = pipeline.get_by_name("src")
 def testCreate(self):
     self.failUnless(messages.Info(T_(N_("Note"))))
     self.failUnless(messages.Warning(T_(N_("warning"))))
 def setup(self):
     self.translatable = (T_(N_("Note")))
     self.message = messages.Info(self.translatable)
     self.other = messages.Warning(T_(N_("Warning")))
Esempio n. 9
0
    def parseProperties(self, properties):
        mountPoint = properties.get('mount-point', '')
        if not mountPoint.startswith('/'):
            mountPoint = '/' + mountPoint
        self.mountPoint = mountPoint

        # Hostname is used for a variety of purposes. We do a best-effort guess
        # where nothing else is possible, but it's much preferable to just
        # configure this
        self.hostname = properties.get('hostname', None)
        self.iface = self.hostname  # We listen on this if explicitly
        # configured, but not if it's only guessed
        # at by the below code.
        if not self.hostname:
            # Don't call this nasty, nasty, probably flaky function unless we
            # need to.
            self.hostname = netutils.guess_public_hostname()

        self.description = properties.get('description', None)
        if self.description is None:
            self.description = "Flumotion Stream"

        # check how to set client sync mode

        if 'client-limit' in properties:
            limit = int(properties['client-limit'])
            self.resource.setUserLimit(limit)
            if limit != self.resource.maxclients:
                m = messages.Info(
                    T_(
                        N_("Your system configuration does not allow the maximum "
                           "client limit to be set to %d clients."), limit))
                m.description = T_(
                    N_("Learn how to increase the maximum number of clients."))
                m.section = 'chapter-optimization'
                m.anchor = 'section-configuration-system-fd'
                self.addMessage(m)

        if 'bandwidth-limit' in properties:
            limit = int(properties['bandwidth-limit'])
            if limit < 1000:
                # The wizard used to set this as being in Mbps, oops.
                self.debug(
                    "Bandwidth limit set to unreasonably low %d bps, "
                    "assuming this is meant to be Mbps", limit)
                limit *= 1000000
            self.resource.setBandwidthLimit(limit)

        if 'redirect-on-overflow' in properties:
            self.resource.setRedirectionOnLimits(
                properties['redirect-on-overflow'])

        if 'bouncer' in properties:
            self.httpauth.setBouncerName(properties['bouncer'])

        if 'allow-default' in properties:
            self.httpauth.setAllowDefault(properties['allow-default'])

        if 'duration' in properties:
            self.httpauth.setDefaultDuration(float(properties['duration']))

        if 'domain' in properties:
            self.httpauth.setDomain(properties['domain'])

        if 'avatarId' in self.config:
            self.httpauth.setRequesterId(self.config['avatarId'])

        if 'ip-filter' in properties:
            logFilter = http.LogFilter()
            for f in properties['ip-filter']:
                logFilter.addIPFilter(f)
            self.resource.setLogFilter(logFilter)

        if 'timeout' in properties:
            self.timeout = properties['timeout'] * gst.SECOND

        self.type = properties.get('type', 'master')
        if self.type == 'slave':
            # already checked for these in do_check
            self._porterPath = properties['porter-socket-path']
            self._porterUsername = properties['porter-username']
            self._porterPassword = properties['porter-password']

        self.port = int(properties.get('port', 8800))