From: Paul Brossier Date: Sun, 14 Apr 2013 23:20:04 +0000 (-0500) Subject: timeside/{decoder/core,encoder/coder,tools/gstutils}.py: only import gst when needed X-Git-Tag: 0.5.0~115^2~33 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=46956233faa5f43da238c7785be23bed0322ea8f;p=timeside.git timeside/{decoder/core,encoder/coder,tools/gstutils}.py: only import gst when needed --- diff --git a/timeside/decoder/core.py b/timeside/decoder/core.py index d447608..2ddb349 100644 --- a/timeside/decoder/core.py +++ b/timeside/decoder/core.py @@ -29,6 +29,7 @@ from timeside.api import IDecoder from timeside.tools import * import Queue +from gst import _gst as gst GST_APPSINK_MAX_BUFFERS = 10 QUEUE_SIZE = 10 diff --git a/timeside/encoder/core.py b/timeside/encoder/core.py index 87165e2..4a7383b 100644 --- a/timeside/encoder/core.py +++ b/timeside/encoder/core.py @@ -23,6 +23,7 @@ from timeside.core import Processor, implements, interfacedoc from timeside.api import IEncoder from timeside.tools import * +from gst import _gst as gst class GstEncoder(Processor): diff --git a/timeside/tools/gstutils.py b/timeside/tools/gstutils.py index 2c60a36..461b9af 100644 --- a/timeside/tools/gstutils.py +++ b/timeside/tools/gstutils.py @@ -2,14 +2,13 @@ from numpy import array, getbuffer, frombuffer import pygst pygst.require('0.10') -import gst import gobject - gobject.threads_init() def numpy_array_to_gst_buffer(frames): + from gst import Buffer """ gstreamer buffer to numpy array conversion """ - buf = gst.Buffer(getbuffer(frames.astype("float32"))) + buf = Buffer(getbuffer(frames.astype("float32"))) return buf def gst_buffer_to_numpy_array(buf, chan):