Пример #1
0
    @staticmethod
    @interfacedoc
    def description():
        return "WebM GStreamer based encoder and muxer"

    @staticmethod
    @interfacedoc
    def format():
        return "WebM"

    @staticmethod
    @interfacedoc
    def file_extension():
        return "webm"

    @staticmethod
    @interfacedoc
    def mime_type():
        return "video/webm"

    @interfacedoc
    def set_metadata(self, metadata):
        self.metadata = metadata

if __name__ == "__main__":
    # Run doctest from __main__ and unittest from test_analyzer_preprocessors
    from tests import test_encoding, test_transcoding
    from tests.unit_timeside import run_test_module
    run_test_module([test_encoding, test_transcoding], test_prefix='testWebM')
Пример #2
0
            self.end_cond.acquire()
            self.pipeline.set_state(gst.STATE_NULL)
            self.mainloop.quit()
            self.end_reached = True
            err, debug = message.parse_error()
            self.error_msg = "Error: %s" % err, debug
            self.end_cond.notify()
            self.end_cond.release()

    @interfacedoc
    def process(self, frames, eod=False):
        self.eod = eod
        if eod:
            self.num_samples +=  frames.shape[0]
        else:
            self.num_samples += self.blocksize()
        buf = numpy_array_to_gst_buffer(frames, frames.shape[0],self.num_samples, self.samplerate())
        self.src.emit('push-buffer', buf)
        if self.eod:
            self.src.emit('end-of-stream')
        if self.streaming:
            self.chunk = self.app.emit('pull-buffer')
        return frames, eod


if __name__ == "__main__":
    # Run doctest from __main__ and unittest from test_analyzer_preprocessors
    from tests import test_encoding, test_transcoding
    from tests.unit_timeside import run_test_module
    run_test_module([test_encoding, test_transcoding])
Пример #3
0
            self.buffer = stack[nb_frames * self.stepsize:]

            eod_list = np.repeat(False, nb_frames)
            if eod and len(eod_list):
                eod_list[-1] = eod

            for index, eod in zip(xrange(0, nb_frames*self.stepsize, self.stepsize), eod_list):
                yield (stack[index:index + self.blocksize],eod)

    @functools.wraps(process_func)
    def wrapper(analyzer, frames, eod):
        # Pre-processing
        if not hasattr(analyzer, 'frames_buffer'):
            analyzer.frames_buffer = framesBuffer(analyzer.input_blocksize,
                                                  analyzer.input_stepsize)

        # Processing
        for adapted_frames, adapted_eod in analyzer.frames_buffer.frames(frames, eod):
            process_func(analyzer, adapted_frames, adapted_eod)

        return frames, eod
    return wrapper


if __name__ == "__main__":
    # Run doctest from __main__ and unittest from test_analyzer_preprocessors
    from tests import test_analyzer_preprocessors
    from tests.unit_timeside import run_test_module
    run_test_module(test_analyzer_preprocessors)
Пример #4
0
    except  GError as e:
        raise IOError(e)
    info = dict()

    # Duration in seconds
    info['duration'] = uri_info.get_duration() / GST_SECOND

    audio_streams = uri_info.get_audio_streams()
    info['streams'] = []
    for stream in audio_streams:
        stream_info = {'bitrate': stream.get_bitrate (),
                       'channels': stream.get_channels (),
                       'depth': stream.get_depth (),
                       'max_bitrate': stream.get_max_bitrate(),
                       'samplerate': stream.get_sample_rate()
                       }
        info['streams'].append(stream_info)

    return info



if __name__ == "__main__":
    # Run doctest from __main__ and unittest from tests
    from tests.unit_timeside import run_test_module
    # load corresponding tests
    from tests import test_decoder_utils

    run_test_module(test_decoder_utils)