Example #1
0
 def getPipelineDesc(self):
     return '''
         filesrc location="%s" !
         decodebin name=decoder !
         audio/x-raw-int,width=16,depth=16,channels=2 !
         level name=level !
         %s ! identity name=identity !
         filesink location="%s" name=sink''' % (
         gstreamer.quoteParse(
             self._inpath).encode('utf-8'), self._profile.pipeline,
         gstreamer.quoteParse(self._outpath).encode('utf-8'))
Example #2
0
 def getPipelineDesc(self):
     return '''
         filesrc location="%s" !
         decodebin name=decoder !
         audio/x-raw-int,width=16,depth=16,channels=2 !
         level name=level !
         %s ! identity name=identity !
         filesink location="%s" name=sink''' % (
             gstreamer.quoteParse(self._inpath).encode('utf-8'),
             self._profile.pipeline,
             gstreamer.quoteParse(self._outpath).encode('utf-8'))
Example #3
0
 def getPipelineDesc(self):
     # start with an emit interval of one frame, because we end up setting
     # the final interval after paused and after processing some samples
     # already, which is too late
     interval = int(self.gst.SECOND / 75.0)
     return '''
         filesrc location="%s" !
         decodebin name=decoder !
         audio/x-raw-int,width=16,depth=16,channels=2 !
         level name=level interval=%d !
         %s ! identity name=identity !
         filesink location="%s" name=sink''' % (
         gstreamer.quoteParse(self._inpath).encode('utf-8'), interval,
         self._profile.pipeline, gstreamer.quoteParse(
             self._outpath).encode('utf-8'))
Example #4
0
 def getPipelineDesc(self):
     # start with an emit interval of one frame, because we end up setting
     # the final interval after paused and after processing some samples
     # already, which is too late
     interval = int(self.gst.SECOND / 75.0)
     return '''
         filesrc location="%s" !
         decodebin name=decoder !
         audio/x-raw-int,width=16,depth=16,channels=2 !
         level name=level interval=%d !
         %s ! identity name=identity !
         filesink location="%s" name=sink''' % (
             gstreamer.quoteParse(self._inpath).encode('utf-8'),
             interval,
             self._profile.pipeline,
             gstreamer.quoteParse(self._outpath).encode('utf-8'))
Example #5
0
    def _testSuffix(self, suffix):
        # because of https://bugzilla.gnome.org/show_bug.cgi?id=688625
        # we first create the file with a 'normal' filename, then rename
        self.runner = task.SyncRunner(verbose=False)
        fd, path = tempfile.mkstemp()

        cmd = "gst-launch " \
            "audiotestsrc num-buffers=100 samplesperbuffer=1024 ! " \
            "audioconvert ! audio/x-raw-int,width=16,depth=16,channels =2 ! " \
            "wavenc ! " \
            "filesink location=\"%s\" > /dev/null 2>&1" % (
            gstreamer.quoteParse(path).encode('utf-8'), )
        self.debug('Running cmd %r' % cmd)
        os.system(cmd)
        self.failUnless(os.path.exists(path))
        os.close(fd)

        fd, newpath = tempfile.mkstemp(suffix=suffix)
        os.rename(path, newpath)

        encodetask = encode.EncodeTask(newpath, newpath + '.out',
            encode.WavProfile())
        self.runner.run(encodetask, verbose=False)
        os.close(fd)
        os.unlink(newpath)
        os.unlink(newpath + '.out')
Example #6
0
    def start(self, runner):
        task.Task.start(self, runner)

        # here to avoid import gst eating our options
        import gst

        # FIXME: this hardcodes flac; we should be using the correct
        #        tag element instead
        self._pipeline = gst.parse_launch(
            '''
            filesrc location="%s" !
            flactag name=tagger !
            filesink location="%s"''' %
            (gstreamer.quoteParse(self._inpath).encode('utf-8'),
             gstreamer.quoteParse(self._outpath).encode('utf-8')))

        # set tags
        tagger = self._pipeline.get_by_name('tagger')
        if self._taglist:
            tagger.merge_tags(self._taglist, gst.TAG_MERGE_APPEND)

        self.debug('pausing pipeline')
        self._pipeline.set_state(gst.STATE_PAUSED)
        self._pipeline.get_state()
        self.debug('paused pipeline')

        # add eos handling
        bus = self._pipeline.get_bus()
        bus.add_signal_watch()
        bus.connect('message::eos', self._message_eos_cb)

        self.debug('scheduling setting to play')

        # since set_state returns non-False, adding it as timeout_add
        # will repeatedly call it, and block the main loop; so
        #   gobject.timeout_add(0L, self._pipeline.set_state,
        #       gst.STATE_PLAYING)
        # would not work.

        def play():
            self._pipeline.set_state(gst.STATE_PLAYING)
            return False

        self.schedule(0, play)

        #self._pipeline.set_state(gst.STATE_PLAYING)
        self.debug('scheduled setting to play')
Example #7
0
 def getPipelineDesc(self):
     return """
         filesrc location="%s" !
         decodebin ! audio/x-raw-int !
         fakesink name=sink""" % gstreamer.quoteParse(
         self._path
     ).encode(
         "utf-8"
     )
Example #8
0
    def start(self, runner):
        task.Task.start(self, runner)

        # here to avoid import gst eating our options
        import gst

        # FIXME: this hardcodes flac; we should be using the correct
        #        tag element instead
        self._pipeline = gst.parse_launch('''
            filesrc location="%s" !
            flactag name=tagger !
            filesink location="%s"''' % (
                gstreamer.quoteParse(self._inpath).encode('utf-8'),
                gstreamer.quoteParse(self._outpath).encode('utf-8')))

        # set tags
        tagger = self._pipeline.get_by_name('tagger')
        if self._taglist:
            tagger.merge_tags(self._taglist, gst.TAG_MERGE_APPEND)

        self.debug('pausing pipeline')
        self._pipeline.set_state(gst.STATE_PAUSED)
        self._pipeline.get_state()
        self.debug('paused pipeline')

        # add eos handling
        bus = self._pipeline.get_bus()
        bus.add_signal_watch()
        bus.connect('message::eos', self._message_eos_cb)

        self.debug('scheduling setting to play')
        # since set_state returns non-False, adding it as timeout_add
        # will repeatedly call it, and block the main loop; so
        #   gobject.timeout_add(0L, self._pipeline.set_state,
        #       gst.STATE_PLAYING)
        # would not work.

        def play():
            self._pipeline.set_state(gst.STATE_PLAYING)
            return False
        self.schedule(0, play)

        #self._pipeline.set_state(gst.STATE_PLAYING)
        self.debug('scheduled setting to play')
Example #9
0
 def getPipelineDesc(self):
     return '''
         filesrc location="%s" !
         decodebin name=decode ! audio/x-raw-int !
         appsink name=sink sync=False emit-signals=True
         ''' % gstreamer.quoteParse(self._path).encode('utf-8')
Example #10
0
 def getPipelineDesc(self):
     return '''
         filesrc location="%s" !
         decodebin name=decoder !
         fakesink''' % (gstreamer.quoteParse(self._path).encode('utf-8'))
Example #11
0
 def getPipelineDesc(self):
     return '''
         filesrc location="%s" !
         decodebin name=decode ! audio/x-raw-int !
         appsink name=sink sync=False emit-signals=True
         ''' % gstreamer.quoteParse(self._path).encode('utf-8')
Example #12
0
 def getPipelineDesc(self):
     return '''
         filesrc location="%s" !
         decodebin ! audio/x-raw-int !
         fakesink name=sink''' % \
             gstreamer.quoteParse(self._path).encode('utf-8')
Example #13
0
 def getPipelineDesc(self):
     return '''
         filesrc location="%s" !
         decodebin name=decoder !
         fakesink''' % (
             gstreamer.quoteParse(self._path).encode('utf-8'))