From 88274f4fe7e8e0381dfb584ee013186a8485d643 Mon Sep 17 00:00:00 2001 From: Thomas Fillon Date: Thu, 6 Mar 2014 09:47:53 +0100 Subject: [PATCH] gstutils: use reshape((-1,chan)) to reshape buffer automatically with the right shape --- timeside/tools/gstutils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/timeside/tools/gstutils.py b/timeside/tools/gstutils.py index 67e09c6..960a8db 100644 --- a/timeside/tools/gstutils.py +++ b/timeside/tools/gstutils.py @@ -21,8 +21,7 @@ def numpy_array_to_gst_buffer(frames, chunk_size, num_samples, sample_rate): def gst_buffer_to_numpy_array(buf, chan): """ gstreamer buffer to numpy array conversion """ - samples = frombuffer(buf.data, dtype='float32') - samples.resize([len(samples)/chan, chan]) + samples = frombuffer(buf.data, dtype='float32').reshape((-1, chan)) return samples -- 2.39.5