Ejemplo n.º 1
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
Ejemplo n.º 2
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)
Ejemplo 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."))))
Ejemplo n.º 4
0
    def get_pipeline_string(self, properties):
        samplerate = properties.get('samplerate', 44100)
        wave = properties.get('wave', 0)
        self.samplerate = samplerate
        volume = properties.get('volume', 1.0)

        is_live = 'is-live=true'
        source = 'audiotestsrc'

        if not gstreamer.element_factory_exists(source):
            raise errors.MissingElementError(source)

        return ('%s name=source wave=%s %s ! ' \
            'identity name=identity silent=TRUE ! ' \
            'audio/x-raw-int,rate=%d ! ' \
            'volume name=volume volume=%f ! level name=level'
                % (source, wave, is_live, samplerate, volume))
Ejemplo n.º 5
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"
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
    def get_pipeline_string(self, properties):
        def getProps():
            ret = []
            for k, default in (('width', 320), ('height', 240),
                               ('x-offset', 0), ('y-offset', 0), ('framerate',
                                                                  (5, 1))):
                ret.append(properties.get(k, default))
            return ret

        width, height, x_offset, y_offset, framerate = getProps()

        src = 'ximagesrc'
        if not gstreamer.element_factory_exists(src):
            raise errors.MissingElementError(src)

        return (
            '%s startx=%d starty=%d endx=%d endy=%d use-damage=false'
            ' ! ffmpegcolorspace'
            ' ! video/x-raw-yuv,framerate=(fraction)%s,format=(fourcc)I420' %
            (src, x_offset, y_offset, width + x_offset, height + y_offset,
             '%d/%d' % framerate))