Esempio n. 1
0
    def init(self):
        # add keys for eaters and feeders uiState
        self.feeders = {} # feeder feedName -> Feeder
        self.eaters = {} # eater eaterAlias -> Eater
        self.uiState.addListKey('feeders')
        self.uiState.addListKey('eaters')
        self.uiState.addKey('gst-debug')

        self.pipeline = None
        self.pipeline_signals = []
        self.bus_signal_id = None
        self.effects = {}
        self._feeder_probe_cl = None

        self._pad_monitors = padmonitor.PadMonitorSet(
            lambda: self.setMood(moods.happy),
            lambda: self.setMood(moods.hungry))

        self._clock_slaved = False
        self.clock_provider = None
        self._master_clock_info = None # (ip, port, basetime) if we're the
                                       # clock master

        self._change_monitor = gstreamer.StateChangeMonitor()

        # multifdsink's get-stats signal had critical bugs before this version
        self._get_stats_supported = (gstreamer.get_plugin_version('tcp')
                                     >= (0, 10, 11, 0))
Esempio n. 2
0
    def errbackResult(failure):
        log.debug('check', 'returning failed Result, %r' % failure)
        m = None
        if failure.check(errors.GStreamerGstError):
            source, gerror, debug = failure.value.args
            log.debug('check', 'GStreamer GError: %s (debug: %s)' % (
                gerror.message, debug))
            if gerror.domain == "gst-resource-error-quark":
                if gerror.code == int(gst.RESOURCE_ERROR_NOT_FOUND):
                    # dv1394src was fixed after gst-plugins-good 0.10.2
                    # to distinguish NOT_FOUND and OPEN_READ
                    version = gstreamer.get_plugin_version('1394')
                    if version >= (0, 10, 0, 0) and version <= (0, 10, 2, 0):
                        m = messages.Error(T_(
                            N_("Could not find or open the Firewire device. "
                               "Check the device node and its permissions.")))
                    else:
                        m = messages.Error(T_(
                            N_("No Firewire device found.")))
                elif gerror.code == int(gst.RESOURCE_ERROR_OPEN_READ):
                    m = messages.Error(T_(
                        N_("Could not open Firewire device for reading. "
                           "Check permissions on the device.")))

            if not m:
                m = check.handleGStreamerDeviceError(failure, 'Firewire',
                    mid=mid)

        if not m:
            m = messages.Error(T_(N_("Could not probe Firewire device.")),
                debug=check.debugFailure(failure))

        m.id = mid
        result.add(m)
        return result
Esempio n. 3
0
    def __init__(self, name, component, sourcePad, pipeline,
                 width, height, is_square, add_borders=False,
                 width_correction=8, height_correction=0):
        """
        @param element:     the video source element on which the post
                            processing effect will be added
        @param pipeline:    the pipeline of the element
        """
        feedcomponent.PostProcEffect.__init__(self, name, sourcePad,
            VideoscaleBin(width, height, is_square, add_borders,
                          width_correction, height_correction), pipeline)
        self.pipeline = pipeline
        self.component = component

        vt = gstreamer.get_plugin_version('videoscale')
        if not vt:
            raise errors.MissingElementError('videoscale')
        # 'add-borders' property was added in gst-plugins-base 0.10.29,
        # and it's requiered to respect DAR by adding black borders
        if not vt > (0, 10, 29, 0):
            self.component.addMessage(
                messages.Warning(T_(N_(
                    "The videoscale element correctly "
                    "works with GStreamer base newer than 0.10.29.1."
                    "You should update your version of GStreamer."))))
Esempio n. 4
0
    def get_pipeline_string(self, properties):
        dp = ""
        if 'drop-probability' in properties:
            vt = gstreamer.get_plugin_version('coreelements')
            if not vt:
                raise errors.MissingElementError('identity')
            if not vt > (0, 10, 12, 0):
                self.addMessage(
                    messages.Warning(
                        T_(
                            N_("The 'drop-probability' property is specified, but "
                               "it only works with GStreamer core newer than 0.10.12."
                               " You should update your version of GStreamer.")
                        )))
            else:
                drop_probability = properties['drop-probability']
                if drop_probability < 0.0 or drop_probability > 1.0:
                    self.addMessage(
                        messages.Warning(
                            T_(
                                N_("The 'drop-probability' property can only be "
                                   "between 0.0 and 1.0."))))
                else:
                    dp = " drop-probability=%f" % drop_probability

        return 'identity silent=true %s' % dp
Esempio n. 5
0
 def _add_source_bin(self, pipeline):
     if gstreamer.element_factory_exists("appsrc") and \
         gstreamer.get_plugin_version("app") >= (0, 10, 22, 0):
         self.source = gst.element_factory_make('appsrc', 'source')
         self.source.set_property('do-timestamp', True)
         self.source.connect('need-data', self.push_buffer)
     else:
         #FIXME: fluoverlaysrc only needed on gst-plugins-base < 0.10.22
         gobject.type_register(OverlayImageSource)
         gst.element_register(OverlayImageSource, "fluoverlaysrc",
                              gst.RANK_MARGINAL)
         self.source = gst.element_factory_make('fluoverlaysrc', 'source')
     # create the source bin
     self.sourceBin = gst.Bin()
     # create the alphacolor element
     alphacolor = gst.element_factory_make('alphacolor')
     # add the elements to the source bin and link them
     self.sourceBin.add_many(self.source, alphacolor)
     self.source.link(alphacolor)
     pipeline.add(self.sourceBin)
     # create the source ghost pad
     self.sourceBin.add_pad(gst.GhostPad('src', alphacolor.get_pad('src')))
     # set the locked state and wait until we get the first caps change
     # and we know the widht and height of the input stream
     self.sourceBin.set_locked_state(True)
Esempio n. 6
0
    def check_properties(self, props, addMessage):

        # F0.6: remove backwards-compatible properties
        self.fixRenamedProperties(props, [
            ('issuer', 'issuer-class'),
            ('mount_point', 'mount-point'),
            ('porter_socket_path', 'porter-socket-path'),
            ('porter_username', 'porter-username'),
            ('porter_password', 'porter-password'),
            ('user_limit', 'client-limit'),
            ('bandwidth_limit', 'bandwidth-limit'),
            ('burst_on_connect', 'burst-on-connect'),
            ('burst_size', 'burst-size'),
            ])

        if props.get('type', 'master') == 'slave':
            for k in 'socket-path', 'username', 'password':
                if not 'porter-' + k in props:
                    raise errors.ConfigError("slave mode, missing required"
                                             " property 'porter-%s'" % k)

        if 'burst-size' in props and 'burst-time' in props:
            raise errors.ConfigError('both burst-size and burst-time '
                                     'set, cannot satisfy')

        # tcp is where multifdsink is
        version = gstreamer.get_plugin_version('tcp')
        if version < (0, 10, 9, 1):
            m = messages.Error(T_(N_(
                "Version %s of the '%s' GStreamer plug-in is too old.\n"),
                    ".".join(map(str, version)), 'multifdsink'))
            m.add(T_(N_("Please upgrade '%s' to version %s."),
                'gst-plugins-base', '0.10.10'))
            addMessage(m)
Esempio n. 7
0
    def errbackAlsaBugResult(failure, result, mid, device):
        # alsasrc in gst-plugins-base <= 0.10.14 was accidentally reporting
        # GST_RESOURCE_ERROR_WRITE when it could not be opened for reading.
        if not failure.check(errors.GStreamerGstError):
            return failure
        if source_factory != 'alsasrc':
            return failure
        version = gstreamer.get_plugin_version('alsasrc')
        if version > (0, 10, 14):
            return failure

        source, gerror, debug = failure.value.args
        log.debug(
            'check', 'GStreamer GError: %s (domain %s, code %d, debug %s)' %
            (gerror.message, gerror.domain, gerror.code, debug))

        if gerror.domain == "gst-resource-error-quark":
            if gerror.code == int(gst.RESOURCE_ERROR_OPEN_WRITE):
                m = messages.Error(
                    T_(
                        N_("Could not open device '%s' for reading.  "
                           "Check permissions on the device."), device))
                result.add(m)
                return result

        return failure
Esempio n. 8
0
    def configure_pipeline(self, pipeline, properties):
        def notify_pattern(obj, pspec):
            self.uiState.set('pattern', int(obj.get_property('pattern')))

        source = self.get_element('source')
        source.connect('notify::pattern', notify_pattern)
        if 'pattern' in properties:
            source.set_property('pattern', properties['pattern'])

        if 'drop-probability' in properties:
            vt = gstreamer.get_plugin_version('coreelements')
            if not vt:
                raise errors.MissingElementError('identity')
            if not vt > (0, 10, 12, 0):
                self.addMessage(
                    messages.Warning(
                        T_(
                            N_("The 'drop-probability' property is specified, but "
                               "it only works with GStreamer core newer than 0.10.12."
                               " You should update your version of GStreamer.")
                        )))
            else:
                drop_probability = properties['drop-probability']
                if drop_probability < 0.0 or drop_probability > 1.0:
                    self.addMessage(
                        messages.Warning(
                            T_(
                                N_("The 'drop-probability' property can only be "
                                   "between 0.0 and 1.0."))))
                else:
                    identity = self.get_element('identity')
                    identity.set_property('drop-probability', drop_probability)
Esempio n. 9
0
 def _add_source_bin(self, pipeline):
     if gstreamer.element_factory_exists("appsrc") and \
         gstreamer.get_plugin_version("app") >= (0, 10, 22, 0):
         self.source = gst.element_factory_make('appsrc', 'source')
         self.source.set_property('do-timestamp', True)
         self.source.connect('need-data', self.push_buffer)
     else:
         #FIXME: fluoverlaysrc only needed on gst-plugins-base < 0.10.22
         gobject.type_register(OverlayImageSource)
         gst.element_register(OverlayImageSource, "fluoverlaysrc",
             gst.RANK_MARGINAL)
         self.source = gst.element_factory_make('fluoverlaysrc', 'source')
     # create the source bin
     self.sourceBin = gst.Bin()
     # create the alphacolor element
     alphacolor = gst.element_factory_make('alphacolor')
     # add the elements to the source bin and link them
     self.sourceBin.add_many(self.source, alphacolor)
     self.source.link(alphacolor)
     pipeline.add(self.sourceBin)
     # create the source ghost pad
     self.sourceBin.add_pad(gst.GhostPad('src', alphacolor.get_pad('src')))
     # set the locked state and wait until we get the first caps change
     # and we know the widht and height of the input stream
     self.sourceBin.set_locked_state(True)
Esempio n. 10
0
    def init(self):
        # add keys for eaters and feeders uiState
        self.feeders = {}  # feeder feedName -> Feeder
        self.eaters = {}  # eater eaterAlias -> Eater
        self.uiState.addListKey('feeders')
        self.uiState.addListKey('eaters')
        self.uiState.addKey('gst-debug')

        self.pipeline = None
        self.pipeline_signals = []
        self.bus_signal_id = None
        self.effects = {}
        self._feeder_probe_cl = None

        self._pad_monitors = padmonitor.PadMonitorSet(
            lambda: self.setMood(moods.happy),
            lambda: self.setMood(moods.hungry))

        self._clock_slaved = False
        self.clock_provider = None
        self._master_clock_info = None  # (ip, port, basetime) if we're the
        # clock master

        self._change_monitor = gstreamer.StateChangeMonitor()

        # multifdsink's get-stats signal had critical bugs before this version
        self._get_stats_supported = (gstreamer.get_plugin_version('tcp') >=
                                     (0, 10, 11, 0))
Esempio n. 11
0
    def __init__(self,
                 name,
                 component,
                 sourcePad,
                 pipeline,
                 width,
                 height,
                 is_square,
                 add_borders=False,
                 width_correction=8,
                 height_correction=0):
        """
        @param element:     the video source element on which the post
                            processing effect will be added
        @param pipeline:    the pipeline of the element
        """
        feedcomponent.PostProcEffect.__init__(
            self, name, sourcePad,
            VideoscaleBin(width, height, is_square, add_borders,
                          width_correction, height_correction), pipeline)
        self.pipeline = pipeline
        self.component = component

        vt = gstreamer.get_plugin_version('videoscale')
        if not vt:
            raise errors.MissingElementError('videoscale')
        # 'add-borders' property was added in gst-plugins-base 0.10.29,
        # and it's requiered to respect DAR by adding black borders
        if not vt > (0, 10, 29, 0):
            self.component.addMessage(
                messages.Warning(
                    T_(
                        N_("The videoscale element correctly "
                           "works with GStreamer base newer than 0.10.29.1."
                           "You should update your version of GStreamer."))))
Esempio n. 12
0
    def errbackAlsaBugResult(failure, result, mid, device):
        # alsasrc in gst-plugins-base <= 0.10.14 was accidentally reporting
        # GST_RESOURCE_ERROR_WRITE when it could not be opened for reading.
        if not failure.check(errors.GStreamerGstError):
            return failure
        if source_factory != 'alsasrc':
            return failure
        version = gstreamer.get_plugin_version('alsasrc')
        if version > (0, 10, 14):
            return failure

        source, gerror, debug = failure.value.args
        log.debug('check',
            'GStreamer GError: %s (domain %s, code %d, debug %s)' % (
                gerror.message, gerror.domain, gerror.code, debug))

        if gerror.domain == "gst-resource-error-quark":
            if gerror.code == int(gst.RESOURCE_ERROR_OPEN_WRITE):
                m = messages.Error(T_(
                    N_("Could not open device '%s' for reading.  "
                       "Check permissions on the device."), device))
                result.add(m)
                return result

        return failure
Esempio n. 13
0
    def configure_pipeline(self, pipeline, properties):

        def notify_pattern(obj, pspec):
            self.uiState.set('pattern', int(obj.get_property('pattern')))

        source = self.get_element('source')
        source.connect('notify::pattern', notify_pattern)
        if 'pattern' in properties:
            source.set_property('pattern', properties['pattern'])

        if 'drop-probability' in properties:
            vt = gstreamer.get_plugin_version('coreelements')
            if not vt:
                raise errors.MissingElementError('identity')
            if not vt > (0, 10, 12, 0):
                self.addMessage(
                    messages.Warning(T_(N_(
                        "The 'drop-probability' property is specified, but "
                        "it only works with GStreamer core newer than 0.10.12."
                        " You should update your version of GStreamer."))))
            else:
                drop_probability = properties['drop-probability']
                if drop_probability < 0.0 or drop_probability > 1.0:
                    self.addMessage(
                        messages.Warning(T_(N_(
                            "The 'drop-probability' property can only be "
                            "between 0.0 and 1.0."))))
                else:
                    identity = self.get_element('identity')
                    identity.set_property('drop-probability',
                        drop_probability)
Esempio n. 14
0
    def errbackResult(failure):
        log.debug('check', 'returning failed Result, %r' % failure)
        m = None
        if failure.check(errors.GStreamerGstError):
            source, gerror, debug = failure.value.args
            log.debug('check', 'GStreamer GError: %s (debug: %s)' % (
                gerror.message, debug))
            if gerror.domain == "gst-resource-error-quark":
                if gerror.code == int(gst.RESOURCE_ERROR_NOT_FOUND):
                    # dv1394src was fixed after gst-plugins-good 0.10.2
                    # to distinguish NOT_FOUND and OPEN_READ
                    version = gstreamer.get_plugin_version('1394')
                    if version >= (0, 10, 0, 0) and version <= (0, 10, 2, 0):
                        m = messages.Error(T_(
                            N_("Could not find or open the Firewire device. "
                               "Check the device node and its permissions.")))
                    else:
                        m = messages.Error(T_(
                            N_("No Firewire device found.")))
                elif gerror.code == int(gst.RESOURCE_ERROR_OPEN_READ):
                    m = messages.Error(T_(
                        N_("Could not open Firewire device for reading. "
                           "Check permissions on the device.")))

            if not m:
                m = check.handleGStreamerDeviceError(failure, 'Firewire',
                    mid=mid)

        if not m:
            m = messages.Error(T_(N_("Could not probe Firewire device.")),
                debug=check.debugFailure(failure))

        m.id = mid
        result.add(m)
        return result
Esempio n. 15
0
def checkPlugin(pluginName, packageName, minimumVersion=None,
                featureName=None, featureCheck=None):
    """
    Check if the given plug-in is available.
    Return a result with an error if it is not, or not new enough.

    @param pluginName: name of the plugin to check
    @param packageName: name of the package to tell the user to install
    if the check fails
    @param minimumVersion: minimum version of the plugin, as a tuple.
    Optional.
    @param featureName: name of a specific feature to check for in the
    plugin. Optional. Overrides the minimum version check, if given.
    @param featureCheck: function to call on the found feature, which
    should return a boolean representing whether the feature is good or
    not. Optional, and only makes sense if you specify featureName.
    @rtype: L{messages.Result}
    """
    result = messages.Result()
    version = gstreamer.get_plugin_version(pluginName)

    if not version:
        m = messages.Error(T_(
            N_("This host is missing the '%s' GStreamer plug-in.\n"),
                pluginName))
        m.add(T_(N_(
            "Please install '%s'.\n"), packageName))
        documentation.messageAddGStreamerInstall(m)
        result.add(m)
    elif featureName:
        r = gst.registry_get_default()
        features = r.get_feature_list_by_plugin(pluginName)
        byname = dict([(f.get_name(), f) for f in features])
        if (featureName not in byname
            or (featureCheck and not featureCheck(byname[featureName]))):
            m = messages.Error(T_(
                N_("Your '%s' GStreamer plug-in is too old.\n"), pluginName),
                mid = 'plugin-%s-check' % pluginName)
            m.add(T_(N_(
                "Please upgrade '%s' to version %s or higher."),
                packageName, ".".join([str(x) for x in minimumVersion])))
            documentation.messageAddGStreamerInstall(m)
            result.add(m)
    elif version < minimumVersion:
        m = messages.Error(T_(
            N_("Version %s of the '%s' GStreamer plug-in is too old.\n"),
               ".".join([str(x) for x in version]), pluginName),
            mid = 'plugin-%s-check' % pluginName)
        m.add(T_(N_(
            "Please upgrade '%s' to version %s."), packageName,
               ".".join([str(x) for x in minimumVersion])))
        documentation.messageAddGStreamerInstall(m)
        result.add(m)

    result.succeed(None)
    return defer.succeed(result)
Esempio n. 16
0
def checkPlugin(pluginName, packageName, minimumVersion=None,
                featureName=None, featureCheck=None):
    """
    Check if the given plug-in is available.
    Return a result with an error if it is not, or not new enough.

    @param pluginName: name of the plugin to check
    @param packageName: name of the package to tell the user to install
    if the check fails
    @param minimumVersion: minimum version of the plugin, as a tuple.
    Optional.
    @param featureName: name of a specific feature to check for in the
    plugin. Optional. Overrides the minimum version check, if given.
    @param featureCheck: function to call on the found feature, which
    should return a boolean representing whether the feature is good or
    not. Optional, and only makes sense if you specify featureName.
    @rtype: L{messages.Result}
    """
    result = messages.Result()
    version = gstreamer.get_plugin_version(pluginName)

    if not version:
        m = messages.Error(T_(
            N_("This host is missing the '%s' GStreamer plug-in.\n"),
                pluginName))
        m.add(T_(N_(
            "Please install '%s'.\n"), packageName))
        documentation.messageAddGStreamerInstall(m)
        result.add(m)
    elif featureName:
        r = Gst.registry_get()
        features = r.get_feature_list_by_plugin(pluginName)
        byname = dict([(f.get_name(), f) for f in features])
        if (featureName not in byname
            or (featureCheck and not featureCheck(byname[featureName]))):
            m = messages.Error(T_(
                N_("Your '%s' GStreamer plug-in is too old.\n"), pluginName),
                mid = 'plugin-%s-check' % pluginName)
            m.add(T_(N_(
                "Please upgrade '%s' to version %s or higher."),
                packageName, ".".join([str(x) for x in minimumVersion])))
            documentation.messageAddGStreamerInstall(m)
            result.add(m)
    elif version < minimumVersion:
        m = messages.Error(T_(
            N_("Version %s of the '%s' GStreamer plug-in is too old.\n"),
               ".".join([str(x) for x in version]), pluginName),
            mid = 'plugin-%s-check' % pluginName)
        m.add(T_(N_(
            "Please upgrade '%s' to version %s."), packageName,
               ".".join([str(x) for x in minimumVersion])))
        documentation.messageAddGStreamerInstall(m)
        result.add(m)

    result.succeed(None)
    return defer.succeed(result)
    def do_check(self):
        self.debug('running Windows Media Video encoder check.')

        version = self.config['properties'].get('version', 3)

        # For WMV2 we need dmoenc_wmvdmoe2v2.
        if version == 2:
            if gstreamer.element_factory_exists('dmoenc_wmvdmoe2v2'):
                self.wmvEncoder = 'dmoenc_wmvdmoe2v2'
                self.wmvVersion = gstreamer.get_plugin_version('pitfdll')
            else:
                version  = gstreamer.get_plugin_version('pitfdll')
                if not version:
                    self.warning('could not find pitfdll.')
                    m = Error(T_( 
                        N_("This host is missing the 'gst-pitfdll' GStreamer plug-in.\n")))
                else:
                    self.warning('could not find dmoenc_wmvdmoe2v2, probably missing DLL, or old registry.')
                    m = Error(T_(
                        N_("This host is missing the Windows encoder DLL.\n")))
                self.wmvEncoder = None
                self.addMessage(m)
        else:
            # First look for Fluendo WMV encoder.
            if gstreamer.element_factory_exists('fluwmvenc'):
                self.debug('found fluwmvenc, using it.')
                self.wmvEncoder = 'fluwmvenc'
                self.wmvVersion = gstreamer.get_plugin_version('fluwmvenc')
            elif gstreamer.element_factory_exists('dmoenc_wmvdmoe2v3'):
                self.debug('could not find fluwmvenc, found dmoenc_wmvdmoe2v3.')
                self.wmvEncoder = 'dmoenc_wmvdmoe2v3'
                self.wmvVersion = gstreamer.get_plugin_version('pitfdll')
            else:
                self.warning('could not find any WMV encoder.')
                m = Error(T_(
                    N_("This host is missing the WMV encoder plug-ins.\n")))
                self.wmvEncoder = None
                self.addMessage(m)

        self.uiState.set('encoder', self.wmvEncoder)
        self.uiState.set('version', self.wmvVersion)

        return defer.succeed(None)
Esempio n. 18
0
    def configure_pipeline(self, pipeline, properties):
        p = properties
        self.fixRenamedProperties(p, [
                ('show_text', 'show-text'),
                ('fluendo_logo', 'fluendo-logo'),
                ('cc_logo', 'cc-logo'),
                ('xiph_logo', 'xiph-logo')])

        text = None
        if p.get('show-text', False):
            text = p.get('text', 'set the "text" property')
        self.imgBuf, imagesOverflowed, textOverflowed = \
            genimg.generateOverlay(
                text=text,
                showFlumotion=p.get('fluendo-logo', False),
                showCC=p.get('cc-logo', False),
                showXiph=p.get('xiph-logo', False),
                width=p['width'],
                height=p['height'])

        if textOverflowed:
            m = messages.Warning(
                T_(N_("Overlayed text '%s' too wide for the video image."),
                   text), mid="text-too-wide")
            self.addMessage(m)

        if imagesOverflowed:
            m = messages.Warning(
                T_(N_("Overlayed logotypes too wide for the video image.")),
                mid="image-too-wide")
            self.addMessage(m)
        self.capsStr = "video/x-raw-rgb,bpp=32,depth=32,width=%d,height=%d," \
            "red_mask=-16777216,green_mask=16711680,blue_mask=65280," \
            "alpha_mask=255,framerate=0/1" % (p['width'], p['height'])
        padcaps = gst.caps_from_string(self.capsStr)
        source = self.get_element('source')
        if source.get_factory().get_name() == 'appsrc':
            # push buffer when we need to, currently we push a duration of
            # G_MAXINT_64 so we never need to push another one
            # but if we want dynamic change of overlay, we should make
            # duration tunable in properties
            source.connect('need-data', self.push_buffer)
            source.props.caps = padcaps
        else:
            # FIXME: fluoverlaysrc only needed on gst-plugins-base < 0.10.22
            source.imgBuf = self.imgBuf
            source.capsStr = self.capsStr
        vmixerVersion = gstreamer.get_plugin_version('videomixer')
        if vmixerVersion == (0, 10, 7, 0):
            m = messages.Warning(
                T_(N_("The 'videomixer' GStreamer element has a bug in this "
                      "version (0.10.7). You may see many errors in the debug "
                      "output, but it should work correctly anyway.")),
                mid="videomixer-bug")
            self.addMessage(m)
Esempio n. 19
0
 def do_check(self):
     if gstreamer.get_plugin_version('multipart') <= (0, 10, 16, 0):
         m = messages.Warning(
             T_(N_("Versions up to and including %s of the '%s' "
                   "GStreamer plug-in are not suitable for streaming.\n"),
                '0.10.16', 'multipart'))
         m.add(T_(N_("The stream served by the streamer component "
                     "will probably be unplayable.\n")))
         m.add(T_(N_("The issue will be addressed in version %s of '%s'."),
                  '0.10.17', 'gst-plugins-good'))
         self.addMessage(m)
Esempio n. 20
0
    def check_properties(self, props, addMessage):
        streamer.Streamer.check_properties(self, props, addMessage)

        # tcp is where multifdsink is
        version = gstreamer.get_plugin_version('tcp')
        if version < (0, 10, 9, 1):
            m = messages.Error(T_(N_(
                "Version %s of the '%s' GStreamer plug-in is too old.\n"),
                    ".".join(map(str, version)), 'multifdsink'))
            m.add(T_(N_("Please upgrade '%s' to version %s."),
                'gst-plugins-base', '0.10.10'))
            addMessage(m)
Esempio n. 21
0
 def do_check(self):
     self.debug('running WebM check')
     if gstreamer.get_plugin_version('matroska') <= (0, 10, 23, 1):
         m = messages.Warning(
             T_(N_("Versions up to and including %s of the '%s' "
                   "GStreamer plug-in are not suitable for streaming.\n"),
                '0.10.23', 'matroska'))
         m.add(T_(N_("The stream served by the streamer component "
                     "will probably be unplayable.\n")))
         m.add(T_(N_("The issue will be addressed in version %s of '%s'."),
                  '0.10.24', 'gst-plugins-good'))
         self.addMessage(m)
Esempio n. 22
0
    def _set_property(self, prop, value, element):
        if value is None:
            self.debug('No %s set, using default value', prop)
            return

        if prop == 'bitrate':
            self.debug("Setting bitrate to %s", value)
            element.set_property(prop, value)
        if prop == 'max-bitrate':
            self.debug("Setting max bitrate to %s", value)
            element.set_property(prop, value)
        if prop == 'bitrate-mode':
            if value not in self.bitrate_mode:
                m = messages.Error(T_(N_(
                    "The bitrate mode '%s' does not match any "
                    "of the encoder's "
                    "available modes"), value), mid='profile')
                self.addMessage(m)
                raise errors.ComponentSetupHandledError()
            self.debug("Setting bitrate mode to %s", value)
            element.set_property(prop, value)
        if prop == 'byte-stream':
            if value is True:
                self.debug("Setting byte-stream format")
                element.set_property('es', 1)

        if prop in ('max-keyframe-distance', 'min-keyframe-distance'):
            if gstreamer.get_plugin_version('flumch264enc') <= (0, 10, 5, 0):
                m = messages.Warning(
                    T_(N_("Versions up to and including %s of the '%s' "
                        "cannot set this property.\n"),
                        '0.10.5', 'flumch264enc'))
                self.addMessage(m)
                return
            self.debug("Setting %s to %s", prop, value)
            element.set_property(prop, value)

        if prop == 'profile':
            if value not in self.profiles:
                m = messages.Error(T_(N_(
                    "The profile '%s' does not match any of the encoder's "
                    "available profiles"), value), mid='profile')
                self.addMessage(m)
                raise errors.ComponentSetupHandledError()
            self.debug("Setting h264 '%s' profile", value)
            element.set_property(prop, value)
            # Adobe recommends using a keyframe distance equivalent to 10
            # seconds and the GStreamer component doesn't set it. For live
            # we want to have at least on keyframe each 3 seconds
            # See priv#7131
            if value in ['flash_high', 'flash_low']:
                #FIXME: Supposing we have a PAL input with 25fps
                element.set_property('max-keyframe-distance', 75)
Esempio n. 23
0
 def do_check(self):
     # handle http://bugzilla.gnome.org/show_bug.cgi?id=532364
     version = gstreamer.get_plugin_version('tcp')
     if version >= (0, 10, 18, 0) and version < (0, 10, 19, 2):
         m = messages.Error(T_(N_(
             "Version %s of the '%s' GStreamer plug-in contains a bug.\n"),
                ".".join([str(x) for x in version]), 'tcp'),
             mid='tcp-check')
         m.add(T_(N_("The GDP producer cannot function with this bug.\n")))
         m.add(T_(N_("Please upgrade '%s' to version %s."),
             'gst-plugins-base', '0.10.20'))
         self.addMessage(m)
Esempio n. 24
0
 def check_schroenc_bug(result, component):
     if gstreamer.get_plugin_version('schro') == (1, 0, 7, 0):
         m = messages.Warning(
             T_(N_("Version %s of the '%s' GStreamer plug-in "
                   "contains a bug.\n"), '1.0.7', 'schroenc'))
         m.add(T_(N_("The downstream components might stay hungry.\n")))
         m.add(T_(N_("The bug has been fixed during the transition of "
                     "'%s' to the '%s' plug-ins set. "
                     "Please upgrade '%s' to version %s, "
                     "which contains the fixed plug-in."),
                  'schroenc', 'gst-plugins-bad', 'schroenc', '0.10.14'))
         component.addMessage(m)
         return result
Esempio n. 25
0
    def tryV4L2():
        log.debug('webcam', 'trying v4l2')
        version = gstreamer.get_plugin_version('video4linux2')
        minVersion = (0, 10, 5, 1)
        if not version or version < minVersion:
            log.info('webcam', 'v4l2 version %r too old (need >=%r)',
                     version, minVersion)
            return defer.fail(NotImplementedError())

        pipeline = 'v4l2src name=source device=%s ! fakesink' % (device, )
        d = do_element_check(pipeline, 'source', probeDevice,
                             state=gst.STATE_PAUSED, set_state_deferred=True)
        return d
Esempio n. 26
0
 def check_schroenc_bug(result, component):
     if gstreamer.get_plugin_version('schro') == (1, 0, 7, 0):
         m = messages.Warning(
             T_(N_("Version %s of the '%s' GStreamer plug-in "
                   "contains a bug.\n"), '1.0.7', 'schroenc'))
         m.add(T_(N_("The downstream components might stay hungry.\n")))
         m.add(T_(N_("The bug has been fixed during the transition of "
                     "'%s' to the '%s' plug-ins set. "
                     "Please upgrade '%s' to version %s, "
                     "which contains the fixed plug-in."),
                  'schroenc', 'gst-plugins-bad', 'schroenc', '0.10.14'))
         component.addMessage(m)
         return result
Esempio n. 27
0
    def configure_pipeline(self, pipeline, properties):
        element = pipeline.get_by_name('encoder')

        for p in ('qmin', 'qmax', 'threshold', 'keyframe'):
            if p in properties:
                element.set_property(p, properties[p])

        jpegVersion = gstreamer.get_plugin_version('jpeg')
        if jpegVersion < (0, 10, 11, 1):
            m = messages.Warning(
                T_(N_("The 'smoke' encoder has a bug on versions previous "
                      "to (0.10.11). It will not work unless it is updated.")),
                mid="smokeenc-bug")
            self.addMessage(m)
Esempio n. 28
0
    def check_properties(self, props, addMessage):
        streamer.Streamer.check_properties(self, props, addMessage)

        # tcp is where multifdsink is
        version = gstreamer.get_plugin_version('tcp')
        if version < (0, 10, 9, 1):
            m = messages.Error(
                T_(
                    N_("Version %s of the '%s' GStreamer plug-in is too old.\n"
                       ), ".".join(map(str, version)), 'multifdsink'))
            m.add(
                T_(N_("Please upgrade '%s' to version %s."),
                   'gst-plugins-base', '0.10.10'))
            addMessage(m)
Esempio n. 29
0
    def configure_pipeline(self, pipeline, properties):
        element = pipeline.get_by_name('encoder')

        for p in ('qmin', 'qmax', 'threshold', 'keyframe'):
            if p in properties:
                element.set_property(p, properties[p])

        jpegVersion = gstreamer.get_plugin_version('jpeg')
        if jpegVersion < (0, 10, 11, 1):
            m = messages.Warning(
                T_(N_("The 'smoke' encoder has a bug in versions previous "
                      "to 0.10.11. It will not work unless it is updated.")),
                mid="smokeenc-bug")
            self.addMessage(m)
Esempio n. 30
0
    def tryV4L2():
        log.debug('webcam', 'trying v4l2')
        version = gstreamer.get_plugin_version('video4linux2')
        minVersion = (0, 10, 5, 1)
        if not version or version < minVersion:
            log.info('webcam', 'v4l2 version %r too old (need >=%r)', version,
                     minVersion)
            return defer.fail(NotImplementedError())

        pipeline = 'v4l2src name=source device=%s ! fakesink' % (device, )
        d = do_element_check(pipeline,
                             'source',
                             probeDevice,
                             state=gst.STATE_PAUSED,
                             set_state_deferred=True)
        return d
Esempio n. 31
0
    def get_pipeline_string(self, properties):
        # the order here is important; to have our eater be the reference
        # stream for videomixer it needs to be specified last
        source_element = ""
        if gstreamer.element_factory_exists("appsrc") and \
            gstreamer.get_plugin_version("app") >= (0, 10, 22, 0):
            source_element = "appsrc name=source do-timestamp=true"
        else:
            #FIXME: fluoverlaysrc only needed on gst-plugins-base < 0.10.22
            gobject.type_register(OverlayImageSource)
            ret = gst.element_register(OverlayImageSource, "fluoverlaysrc",
                gst.RANK_MARGINAL)
            source_element = "fluoverlaysrc name=source "
        pipeline = (
            '%s ! alphacolor ! '
            'videomixer name=mix ! @feeder:default@ '
            '@eater:default@ ! ffmpegcolorspace ! mix.' % source_element)

        return pipeline
Esempio n. 32
0
def checkOgg():
    """
    Check for a recent enough Ogg muxer.
    """
    result = messages.Result()
    version = gstreamer.get_plugin_version('ogg')
    if version >= (0, 10, 3, 0) and version < (0, 10, 4, 0):
        m = messages.Warning(T_(
            N_("Version %s of the '%s' GStreamer plug-in contains a bug.\n"),
               string.join([str(x) for x in version], '.'), 'ogg'),
            mid='ogg-check')
        m.add(T_(N_("The generated Ogg stream will not be fully compliant, "
            "and possibly not even play correctly.\n")))
        m.add(T_(N_("Please upgrade '%s' to version %s."), 'gst-plugins-base',
            '0.10.4'))
        result.add(m)

    result.succeed(None)
    return defer.succeed(result)
Esempio n. 33
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. 34
0
def checkTheora():
    """
    Check for a recent enough Theora encoder.
    """
    result = messages.Result()
    version = gstreamer.get_plugin_version('theora')
    if version >= (0, 10, 0, 0) and version < (0, 10, 3, 0):
        m = messages.Warning(T_(
            N_("Version %s of the '%s' GStreamer plug-in contains a bug.\n"),
               string.join([str(x) for x in version], '.'), 'theora'),
            mid='theora-check')
        m.add(T_(N_(
            "Synchronization between audio and video may not be correct.\n")))
        m.add(T_(N_(
            "Please upgrade '%s' to version %s."), 'gst-plugins-base',
                '0.10.3'))
        result.add(m)

    result.succeed(None)
    return defer.succeed(result)
    def do_check(self):
        exists = gstreamer.element_factory_exists('ismlmux')
        if not exists:
            m = messages.Error(T_(N_(
                        "%s is missing. Make sure your %s "
                        "installation is complete."),
                        'ismlmux', 'ismlmux'))
            documentation.messageAddGStreamerInstall(m)
            self.debug(m)
            self.addMessage(m)
            return

        v = gstreamer.get_plugin_version('isomp4')
        if v < (0, 10, 23, 0):
            m = messages.Warning(
                T_(N_("Versions up to and including %s of the '%s' "
                      "GStreamer plug-in are not suitable for "
                      "smooth streaming.\n"),
                      '0.10.23', 'isomp4'))
            self.addMessage(m)
Esempio n. 36
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. 37
0
def checkTheora():
    """
    Check for a recent enough Theora encoder.
    """
    result = messages.Result()
    version = gstreamer.get_plugin_version('theora')
    if version >= (0, 10, 0, 0) and version < (0, 10, 3, 0):
        m = messages.Warning(T_(
            N_("Version %s of the '%s' GStreamer plug-in contains a bug.\n"),
               string.join([str(x) for x in version], '.'), 'theora'),
            mid='theora-check')
        m.add(T_(N_(
            "Synchronization between audio and video may not be correct.\n")))
        m.add(T_(N_(
            "Please upgrade '%s' to version %s."), 'gst-plugins-base',
                '0.10.3'))
        result.add(m)

    result.succeed(None)
    return defer.succeed(result)
Esempio n. 38
0
    def configure_pipeline(self, pipeline, properties):

        self.fixRenamedProperties(properties, [
            ('freq', 'frequency'),
        ])

        element = self.get_element('source')
        if 'frequency' in properties:
            element.set_property('freq', properties['frequency'])
            self.uiState.set('frequency', properties['frequency'])

        if 'drop-probability' in properties:
            vt = gstreamer.get_plugin_version('coreelements')
            if not vt:
                raise errors.MissingElementError('identity')
            if not vt > (0, 10, 12, 0):
                self.addMessage(
                    messages.Warning(
                        T_(
                            N_("The 'drop-probability' property is specified, but "
                               "it only works with GStreamer core newer than 0.10.12."
                               " You should update your version of GStreamer.")
                        )))
            else:
                drop_probability = properties['drop-probability']
                if drop_probability < 0.0 or drop_probability > 1.0:
                    self.addMessage(
                        messages.Warning(
                            T_(
                                N_("The 'drop-probability' property can only be "
                                   "between 0.0 and 1.0."))))
                else:
                    identity = self.get_element('identity')
                    identity.set_property('drop-probability', drop_probability)

        self.uiState.set('samplerate', self.samplerate)
        self.uiState.set('wave', int(element.get_property('wave')))

        level = pipeline.get_by_name('level')
        vol = volume.Volume('volume', level, pipeline)
        self.addEffect(vol)
Esempio n. 39
0
    def configure_pipeline(self, pipeline, properties):
        p = properties
        self.fixRenamedProperties(p, [
                ('show_text', 'show-text'),
                ('fluendo_logo', 'fluendo-logo'),
                ('cc_logo', 'cc-logo'),
                ('xiph_logo', 'xiph-logo')])

        if p.get('width', None) is not None:
            self.warnDeprecatedProperties(['width'])
        if p.get('height', None) is not None:
            self.warnDeprecatedProperties(['height'])

        self.font=p.get('font', None)
        self.showFlumotion=p.get('fluendo-logo', False)
        self.showCC=p.get('cc-logo', False)
        self.showXiph=p.get('xiph-logo', False)
        self.custom=p.get('custom-logo', None)
        if p.get('show-text', False):
            self.text = p.get('text', 'set the "text" property')
        else:
            self.text = None

        vmixerVersion = gstreamer.get_plugin_version('videomixer')
        if vmixerVersion == (0, 10, 7, 0):
            m = messages.Warning(
                T_(N_("The 'videomixer' GStreamer element has a bug in this "
                      "version (0.10.7). You may see many errors in the debug "
                      "output, but it should work correctly anyway.")),
                mid="videomixer-bug")
            self.addMessage(m)

        self.videomixer = pipeline.get_by_name("mix")
        # add a callback for caps change to configure the image source
        # properly using the caps of the input stream
        self.videomixer.get_pad('sink_0').connect('notify::caps',
            self._notify_caps_cb)
        # the source is added to the pipeline, but it's not linked yet, and
        # remains with a locked state until we have enough info about the
        # input stream
        self._add_source_bin(pipeline)
Esempio n. 40
0
def checkTicket1344():
    """
    Check if the version of oggmux is the one that can create borked ogg files.

    Note: this also checks for a problem with gdppay reported in #1341.
    """
    result = messages.Result()
    if gstreamer.get_plugin_version('ogg') == (0, 10, 24, 0):
        m = messages.Warning(T_(
                N_("Version %s of the '%s' GStreamer plug-ins set "
                   "contains various bugs.\n"), '0.10.24', 'gst-plugins-base'),
                             mid='oggmux-check')
        m.add(T_(N_("They are regressions introduced in %s and will be "
                    "fixed in %s.\n"), '0.10.24', '0.10.25'))
        m.add(T_(N_("The component will probably never go to happy.\n")))
        m.add(T_(N_("Please use a different version of %s instead."),
                 'gst-plugins-base'))
        result.add(m)

    result.succeed(None)
    return defer.succeed(result)
Esempio n. 41
0
    def check_properties(self, props, addMessage):

        if props.get('type', 'master') == 'slave':
            for k in 'socket-path', 'username', 'password':
                if not 'porter-' + k in props:
                    raise errors.ConfigError("slave mode, missing required"
                                             " property 'porter-%s'" % k)

        if 'burst-size' in props and 'burst-time' in props:
            raise errors.ConfigError('both burst-size and burst-time '
                                     'set, cannot satisfy')

        # tcp is where multifdsink is
        version = gstreamer.get_plugin_version('tcp')
        if version < (0, 10, 9, 1):
            m = messages.Error(T_(N_(
                "Version %s of the '%s' GStreamer plug-in is too old.\n"),
                    ".".join(map(str, version)), 'multifdsink'))
            m.add(T_(N_("Please upgrade '%s' to version %s."),
                'gst-plugins-base', '0.10.10'))
            addMessage(m)
Esempio n. 42
0
    def configure_pipeline(self, pipeline, properties):
        p = properties
        self.fixRenamedProperties(p, [
                ('show_text', 'show-text'),
                ('fluendo_logo', 'fluendo-logo'),
                ('cc_logo', 'cc-logo'),
                ('xiph_logo', 'xiph-logo')])

        if p.get('width', None) is not None:
            self.warnDeprecatedProperties(['width'])
        if p.get('height', None) is not None:
            self.warnDeprecatedProperties(['height'])

        self.font=p.get('font', None)
        self.showFlumotion=p.get('fluendo-logo', False)
        self.showCC=p.get('cc-logo', False)
        self.showXiph=p.get('xiph-logo', False)
        if p.get('show-text', False):
            self.text = p.get('text', 'set the "text" property')
        else:
            self.text = None

        vmixerVersion = gstreamer.get_plugin_version('videomixer')
        if vmixerVersion == (0, 10, 7, 0):
            m = messages.Warning(
                T_(N_("The 'videomixer' GStreamer element has a bug in this "
                      "version (0.10.7). You may see many errors in the debug "
                      "output, but it should work correctly anyway.")),
                mid="videomixer-bug")
            self.addMessage(m)

        self.videomixer = pipeline.get_by_name("mix")
        # add a callback for caps change to configure the image source
        # properly using the caps of the input stream
        self.videomixer.get_pad('sink_0').connect('notify::caps',
            self._notify_caps_cb)
        # the source is added to the pipeline, but it's not linked yet, and
        # remains with a locked state until we have enough info about the
        # input stream
        self._add_source_bin(pipeline)
Esempio n. 43
0
def checkOgg():
    """
    Check for a recent enough Ogg muxer.
    """
    result = messages.Result()
    version = gstreamer.get_plugin_version('ogg')
    if version >= (0, 10, 3, 0) and version < (0, 10, 4, 0):
        m = messages.Warning(T_(
            N_("Version %s of the '%s' GStreamer plug-in contains a bug.\n"),
            string.join([str(x) for x in version], '.'), 'ogg'),
                             mid='ogg-check')
        m.add(
            T_(
                N_("The generated Ogg stream will not be fully compliant, "
                   "and might not even play correctly.\n")))
        m.add(
            T_(N_("Please upgrade '%s' to version %s."), 'gst-plugins-base',
               '0.10.4'))
        result.add(m)

    result.succeed(None)
    return defer.succeed(result)
Esempio n. 44
0
    def configure_pipeline(self, pipeline, properties):

        self.fixRenamedProperties(properties, [
             ('freq', 'frequency'),
             ])

        element = self.get_element('source')
        if 'frequency' in properties:
            element.set_property('freq', properties['frequency'])
            self.uiState.set('frequency', properties['frequency'])

        if 'drop-probability' in properties:
            vt = gstreamer.get_plugin_version('coreelements')
            if not vt:
                raise errors.MissingElementError('identity')
            if not vt > (0, 10, 12, 0):
                self.addMessage(
                    messages.Warning(T_(N_(
                        "The 'drop-probability' property is specified, but "
                        "it only works with GStreamer core newer than 0.10.12."
                        " You should update your version of GStreamer."))))
            else:
                drop_probability = properties['drop-probability']
                if drop_probability < 0.0 or drop_probability > 1.0:
                    self.addMessage(
                        messages.Warning(T_(N_(
                            "The 'drop-probability' property can only be "
                            "between 0.0 and 1.0."))))
                else:
                    identity = self.get_element('identity')
                    identity.set_property('drop-probability',
                        drop_probability)

        self.uiState.set('samplerate', self.samplerate)
        self.uiState.set('wave', int(element.get_property('wave')))

        level = pipeline.get_by_name('level')
        vol = volume.Volume('volume', level, pipeline)
        self.addEffect(vol)
Esempio n. 45
0
    def get_pipeline_string(self, properties):
        dp = ""
        if 'drop-probability' in properties:
            vt = gstreamer.get_plugin_version('coreelements')
            if not vt:
                raise errors.MissingElementError('identity')
            if not vt > (0, 10, 12, 0):
                self.addMessage(
                    messages.Warning(T_(N_(
                        "The 'drop-probability' property is specified, but "
                        "it only works with GStreamer core newer than 0.10.12."
                        " You should update your version of GStreamer."))))
            else:
                drop_probability = properties['drop-probability']
                if drop_probability < 0.0 or drop_probability > 1.0:
                    self.addMessage(
                        messages.Warning(T_(N_(
                            "The 'drop-probability' property can only be "
                            "between 0.0 and 1.0."))))
                else:
                    dp = " drop-probability=%f" % drop_probability

        return 'identity silent=true %s' % dp
Esempio n. 46
0
def checkTicket1344():
    """
    Check if the version of oggmux is the one that can create borked ogg files.

    Note: this also checks for a problem with gdppay reported in #1341.
    """
    result = messages.Result()
    if gstreamer.get_plugin_version('ogg') == (0, 10, 24, 0):
        m = messages.Warning(T_(
            N_("Version %s of the '%s' GStreamer plug-ins set "
               "contains various bugs.\n"), '0.10.24', 'gst-plugins-base'),
                             mid='oggmux-check')
        m.add(
            T_(
                N_("They are regressions introduced in %s and will be "
                   "fixed in %s.\n"), '0.10.24', '0.10.25'))
        m.add(T_(N_("The component will probably never go to happy.\n")))
        m.add(
            T_(N_("Please use a different version of %s instead."),
               'gst-plugins-base'))
        result.add(m)

    result.succeed(None)
    return defer.succeed(result)