summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-05-19 07:46:05 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-05-19 07:46:05 +0000
commit814b6ea02cd888cf8919ff116e9a5aa0925701b1 (patch)
treea2cd2d8e8152147599180ab391a04326f52331d3
parent7cf902c4b40219e9b7e44ef24defec0c57014d11 (diff)
downloadgst-plugins-bad-814b6ea02cd888cf8919ff116e9a5aa0925701b1.tar.gz
gst-plugins-bad-814b6ea02cd888cf8919ff116e9a5aa0925701b1.tar.bz2
gst-plugins-bad-814b6ea02cd888cf8919ff116e9a5aa0925701b1.zip
gst/interleave/deinterleave.*: Add a property to select whether channel positions should be kept on the mono output b...
Original commit message from CVS: * gst/interleave/deinterleave.c: (gst_deinterleave_class_init), (gst_deinterleave_init), (gst_deinterleave_add_new_pads), (gst_deinterleave_set_pads_caps), (gst_deinterleave_set_property), (gst_deinterleave_get_property): * gst/interleave/deinterleave.h: Add a property to select whether channel positions should be kept on the mono output buffers or should be dropped.
-rw-r--r--ChangeLog10
-rw-r--r--gst/interleave/deinterleave.c73
-rw-r--r--gst/interleave/deinterleave.h1
3 files changed, 78 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 6d8eb025..53712043 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-05-19 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * gst/interleave/deinterleave.c: (gst_deinterleave_class_init),
+ (gst_deinterleave_init), (gst_deinterleave_add_new_pads),
+ (gst_deinterleave_set_pads_caps), (gst_deinterleave_set_property),
+ (gst_deinterleave_get_property):
+ * gst/interleave/deinterleave.h:
+ Add a property to select whether channel positions should be kept on
+ the mono output buffers or should be dropped.
+
2008-05-18 Jan Schmidt <jan.schmidt@sun.com>
* docs/Makefile.am:
diff --git a/gst/interleave/deinterleave.c b/gst/interleave/deinterleave.c
index 5a263a3a..464aecac 100644
--- a/gst/interleave/deinterleave.c
+++ b/gst/interleave/deinterleave.c
@@ -123,12 +123,23 @@ deinterleave_24 (guint8 * out, guint8 * in, guint stride, guint nframes)
GST_BOILERPLATE (GstDeinterleave, gst_deinterleave, GstElement,
GST_TYPE_ELEMENT);
+enum
+{
+ PROP_0,
+ PROP_KEEP_POSITIONS
+};
+
static GstFlowReturn gst_deinterleave_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_deinterleave_sink_setcaps (GstPad * pad, GstCaps * caps);
static GstCaps *gst_deinterleave_getcaps (GstPad * pad);
static gboolean gst_deinterleave_sink_activate_push (GstPad * pad,
gboolean active);
static gboolean gst_deinterleave_sink_event (GstPad * pad, GstEvent * event);
+static void gst_deinterleave_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_deinterleave_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec);
+
static void
gst_deinterleave_finalize (GObject * obj)
@@ -174,6 +185,13 @@ gst_deinterleave_class_init (GstDeinterleaveClass * klass)
"deinterleave element");
gobject_class->finalize = gst_deinterleave_finalize;
+ gobject_class->set_property = gst_deinterleave_set_property;
+ gobject_class->get_property = gst_deinterleave_get_property;
+
+ g_object_class_install_property (gobject_class, PROP_KEEP_POSITIONS,
+ g_param_spec_boolean ("keep-positions", "Keep positions",
+ "Keep the original channel positions on the output buffers",
+ FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
static void
@@ -181,6 +199,7 @@ gst_deinterleave_init (GstDeinterleave * self, GstDeinterleaveClass * klass)
{
self->channels = 0;
self->pos = NULL;
+ self->keep_positions = FALSE;
self->width = 0;
self->func = NULL;
@@ -213,10 +232,15 @@ gst_deinterleave_add_new_pads (GstDeinterleave * self, GstCaps * caps)
g_free (name);
/* Set channel position if we know it */
- if (self->pos) {
+ if (self->keep_positions) {
+ GstAudioChannelPosition pos[1] = { GST_AUDIO_CHANNEL_POSITION_NONE };
+
srccaps = gst_caps_copy (caps);
s = gst_caps_get_structure (srccaps, 0);
- gst_audio_set_channel_positions (s, &self->pos[i]);
+ if (self->pos)
+ gst_audio_set_channel_positions (s, &self->pos[i]);
+ else
+ gst_audio_set_channel_positions (s, pos);
} else {
srccaps = caps;
}
@@ -228,7 +252,7 @@ gst_deinterleave_add_new_pads (GstDeinterleave * self, GstCaps * caps)
gst_element_add_pad (GST_ELEMENT (self), pad);
self->srcpads = g_list_prepend (self->srcpads, gst_object_ref (pad));
- if (self->pos)
+ if (self->keep_positions)
gst_caps_unref (srccaps);
}
@@ -248,17 +272,22 @@ gst_deinterleave_set_pads_caps (GstDeinterleave * self, GstCaps * caps)
GstCaps *srccaps;
/* Set channel position if we know it */
- if (self->pos) {
+ if (self->keep_positions) {
+ GstAudioChannelPosition pos[1] = { GST_AUDIO_CHANNEL_POSITION_NONE };
+
srccaps = gst_caps_copy (caps);
s = gst_caps_get_structure (srccaps, 0);
- gst_audio_set_channel_positions (s, &self->pos[i]);
+ if (self->pos)
+ gst_audio_set_channel_positions (s, &self->pos[i]);
+ else
+ gst_audio_set_channel_positions (s, pos);
} else {
srccaps = caps;
}
gst_pad_set_caps (pad, srccaps);
- if (self->pos)
+ if (self->keep_positions)
gst_caps_unref (srccaps);
}
}
@@ -548,6 +577,38 @@ gst_deinterleave_sink_event (GstPad * pad, GstEvent * event)
return ret;
}
+static void
+gst_deinterleave_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstDeinterleave *self = GST_DEINTERLEAVE (object);
+
+ switch (prop_id) {
+ case PROP_KEEP_POSITIONS:
+ self->keep_positions = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gst_deinterleave_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GstDeinterleave *self = GST_DEINTERLEAVE (object);
+
+ switch (prop_id) {
+ case PROP_KEEP_POSITIONS:
+ g_value_set_boolean (value, self->keep_positions);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static GstFlowReturn
gst_deinterleave_process (GstDeinterleave * self, GstBuffer * buf)
{
diff --git a/gst/interleave/deinterleave.h b/gst/interleave/deinterleave.h
index c13f7644..2287944a 100644
--- a/gst/interleave/deinterleave.h
+++ b/gst/interleave/deinterleave.h
@@ -53,6 +53,7 @@ struct _GstDeinterleave
GstCaps *sinkcaps;
gint channels;
GstAudioChannelPosition *pos;
+ gboolean keep_positions;
GstPad *sink;