summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/audio/Makefile.am13
-rw-r--r--gst-libs/gst/audio/audio.c31
-rw-r--r--gst-libs/gst/audio/audio.h89
-rw-r--r--gst-libs/gst/audio/gstaudiofilter.c322
-rw-r--r--gst-libs/gst/audio/gstaudiofilter.h84
-rw-r--r--gst-libs/gst/audio/gstaudiofilterexample.c170
-rw-r--r--gst-libs/gst/media-info/media-info-priv.c17
-rw-r--r--gst-libs/gst/media-info/media-info-test.c56
-rw-r--r--gst-libs/gst/media-info/media-info.c6
-rw-r--r--gst-libs/gst/play/gstplay.c68
-rw-r--r--gst-libs/gst/play/play.c68
-rw-r--r--gst-libs/gst/play/play.old.c68
-rw-r--r--gst-libs/gst/riff/riff-media.c294
-rw-r--r--gst-libs/gst/riff/riff-read.c17
-rw-r--r--gst-libs/gst/video/video.c29
-rw-r--r--gst-libs/gst/video/video.h346
16 files changed, 1037 insertions, 641 deletions
diff --git a/gst-libs/gst/audio/Makefile.am b/gst-libs/gst/audio/Makefile.am
index 4f95f4ef..d99cbcc6 100644
--- a/gst-libs/gst/audio/Makefile.am
+++ b/gst-libs/gst/audio/Makefile.am
@@ -1,12 +1,21 @@
librarydir = $(libdir)/gstreamer-@GST_MAJORMINOR@
-library_LTLIBRARIES = libgstaudio.la
+library_LTLIBRARIES = libgstaudio.la libgstaudiofilter.la libgstaudiofilterexample.la
libgstaudio_la_SOURCES = audio.c audioclock.c
libgstaudioincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/audio
-libgstaudioinclude_HEADERS = audio.h audioclock.h
+libgstaudioinclude_HEADERS = audio.h audioclock.h gstaudiofilter.h
libgstaudio_la_LIBADD =
libgstaudio_la_CFLAGS = $(GST_CFLAGS)
libgstaudio_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+libgstaudiofilter_la_SOURCES = gstaudiofilter.c gstaudiofilter.h
+libgstaudiofilter_la_CFLAGS = $(GST_CFLAGS)
+libgstaudiofilter_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+libgstaudiofilterexample_la_SOURCES = gstaudiofilterexample.c
+libgstaudiofilterexample_la_CFLAGS = $(GST_CFLAGS)
+libgstaudiofilterexample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c
index f5ddaf8b..bec298e9 100644
--- a/gst-libs/gst/audio/audio.c
+++ b/gst-libs/gst/audio/audio.c
@@ -35,22 +35,23 @@ gst_audio_frame_byte_size (GstPad* pad)
int width = 0;
int channels = 0;
-
- GstCaps *caps = NULL;
+ GstCaps *caps;
+ GstStructure *structure;
/* get caps of pad */
caps = GST_PAD_CAPS (pad);
- if (caps == NULL)
- {
+ if (caps == NULL) {
/* ERROR: could not get caps of pad */
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return 0;
}
- gst_caps_get_int (caps, "width", &width);
- gst_caps_get_int (caps, "channels", &channels);
+ structure = gst_caps_get_structure (caps, 0);
+
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "channels", &channels);
return (width / 8) * channels;
}
@@ -83,6 +84,7 @@ gst_audio_frame_rate (GstPad *pad)
{
GstCaps *caps = NULL;
gint rate;
+ GstStructure *structure;
/* get caps of pad */
caps = GST_PAD_CAPS (pad);
@@ -94,7 +96,8 @@ gst_audio_frame_rate (GstPad *pad)
return 0;
}
else {
- gst_caps_get_int (caps, "rate", &rate);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &rate);
return rate;
}
}
@@ -115,6 +118,7 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
double length;
GstCaps *caps = NULL;
+ GstStructure *structure;
g_assert (GST_IS_BUFFER (buf));
/* get caps of pad */
@@ -128,10 +132,11 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
}
else
{
+ structure = gst_caps_get_structure (caps, 0);
bytes = GST_BUFFER_SIZE (buf);
- gst_caps_get_int (caps, "width", &width);
- gst_caps_get_int (caps, "channels", &channels);
- gst_caps_get_int (caps, "rate", &rate);
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "channels", &channels);
+ gst_structure_get_int (structure, "rate", &rate);
g_assert (bytes != 0);
g_assert (width != 0);
@@ -152,6 +157,7 @@ gst_audio_highest_sample_value (GstPad* pad)
gboolean is_signed = FALSE;
gint width = 0;
GstCaps *caps = NULL;
+ GstStructure *structure;
caps = GST_PAD_CAPS (pad);
if (caps == NULL)
@@ -160,8 +166,9 @@ gst_audio_highest_sample_value (GstPad* pad)
GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
}
- gst_caps_get_int (caps, "width", &width);
- gst_caps_get_boolean (caps, "signed", &is_signed);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_boolean (structure, "signed", &is_signed);
if (is_signed) --width;
/* example : 16 bit, signed : samples between -32768 and 32767 */
diff --git a/gst-libs/gst/audio/audio.h b/gst-libs/gst/audio/audio.h
index 0958f654..73a4043f 100644
--- a/gst-libs/gst/audio/audio.h
+++ b/gst-libs/gst/audio/audio.h
@@ -50,66 +50,43 @@ G_BEGIN_DECLS
#define GST_AUDIO_DEF_RATE 44100
-#define GST_AUDIO_INT_PAD_TEMPLATE_PROPS \
- gst_props_new (\
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- "channels", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- "endianness", GST_PROPS_LIST (\
- GST_PROPS_INT (G_LITTLE_ENDIAN),\
- GST_PROPS_INT (G_BIG_ENDIAN)\
- ),\
- "width", GST_PROPS_LIST (\
- GST_PROPS_INT (8),\
- GST_PROPS_INT (16),\
- GST_PROPS_INT (32)\
- ),\
- "depth", GST_PROPS_INT_RANGE (1, 32),\
- "signed", GST_PROPS_LIST (\
- GST_PROPS_BOOLEAN (TRUE),\
- GST_PROPS_BOOLEAN (FALSE)\
- ),\
- "buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- NULL)
+#define GST_AUDIO_INT_PAD_TEMPLATE_CAPS \
+ "audio/x-raw-int, " \
+ "rate = (int) [ 1, MAX ], " \
+ "channels = (int) [ 1, MAX ], " \
+ "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+ "width = (int) { 8, 16, 32 }, " \
+ "depth = (int) [ 1, 32 ], " \
+ "signed = (boolean) { true, false }, " \
+ "buffer-frames = (int) [ 1, MAX ]"
+
/* "standard" int audio is native order, 16 bit stereo. */
-#define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_PROPS \
- gst_props_new (\
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- "channels", GST_PROPS_INT (2),\
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),\
- "width", GST_PROPS_INT (16),\
- "depth", GST_PROPS_INT (16),\
- "signed", GST_PROPS_LIST (\
- GST_PROPS_BOOLEAN (TRUE),\
- GST_PROPS_BOOLEAN (FALSE)\
- ),\
- "buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- NULL)
-
-#define GST_AUDIO_FLOAT_PAD_TEMPLATE_PROPS \
- gst_props_new (\
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- "channels", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- "endianness", GST_PROPS_LIST (\
- GST_PROPS_INT (G_LITTLE_ENDIAN),\
- GST_PROPS_INT (G_BIG_ENDIAN)\
- ),\
- "width", GST_PROPS_LIST (\
- GST_PROPS_INT (32),\
- GST_PROPS_INT (64)\
- ),\
- "buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- NULL)
+#define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS \
+ "audio/x-raw-int, " \
+ "rate = (int) [ 1, MAX ], " \
+ "channels = (int) 2, " \
+ "endianness = (int) BYTE_ORDER, " \
+ "width = (int) 16, " \
+ "depth = (int) 16, " \
+ "signed = (boolean) true, " \
+ "buffer-frames = (int) [ 1, MAX]"
+
+#define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS \
+ "audio/x-raw-float, " \
+ "rate = (int) [ 1, MAX ], " \
+ "channels = (int) [ 1, MAX ], " \
+ "endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " \
+ "width = (int) { 32, 64 }, " \
+ "buffer-frames = (int) [ 1, MAX]"
/* "standard" float audio is native order, 32 bit mono. */
-#define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS \
- gst_props_new (\
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- "channels", GST_PROPS_INT (1),\
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),\
- "width", GST_PROPS_INT (32),\
- "buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT),\
- NULL)
+#define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS \
+ "audio/x-raw-float, " \
+ "rate = (int) [ 1, MAX ], " \
+ "channels = (int) 1, " \
+ "endianness = (int) BYTE_ORDER, " \
+ "buffer-frames = (int) [ 1, MAX]"
/*
* this library defines and implements some helper functions for audio
diff --git a/gst-libs/gst/audio/gstaudiofilter.c b/gst-libs/gst/audio/gstaudiofilter.c
new file mode 100644
index 00000000..46e7c7de
--- /dev/null
+++ b/gst-libs/gst/audio/gstaudiofilter.c
@@ -0,0 +1,322 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2003> David Schleef <ds@schleef.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/*#define DEBUG_ENABLED */
+#include <gstaudiofilter.h>
+
+#include <string.h>
+
+
+/* GstAudiofilter signals and args */
+enum {
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+enum {
+ ARG_0,
+ ARG_METHOD,
+ /* FILL ME */
+};
+
+static void gst_audiofilter_base_init (gpointer g_class);
+static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data);
+static void gst_audiofilter_init (GTypeInstance *instance, gpointer g_class);
+
+static void gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+
+static void gst_audiofilter_chain (GstPad *pad, GstData *_data);
+GstCaps * gst_audiofilter_class_get_capslist(GstAudiofilterClass *klass);
+
+static GstElementClass *parent_class = NULL;
+
+GType
+gst_audiofilter_get_type (void)
+{
+ static GType audiofilter_type = 0;
+
+ if (!audiofilter_type) {
+ static const GTypeInfo audiofilter_info = {
+ sizeof(GstAudiofilterClass),
+ gst_audiofilter_base_init,
+ NULL,
+ gst_audiofilter_class_init,
+ NULL,
+ NULL,
+ sizeof(GstAudiofilter),
+ 0,
+ gst_audiofilter_init,
+ };
+ audiofilter_type = g_type_register_static(GST_TYPE_ELEMENT,
+ "GstAudiofilter", &audiofilter_info, G_TYPE_FLAG_ABSTRACT);
+ }
+ return audiofilter_type;
+}
+
+static void gst_audiofilter_base_init (gpointer g_class)
+{
+ static GstElementDetails audiofilter_details = {
+ "Audio filter base class",
+ "Filter/Effect/Audio",
+ "Filters audio",
+ "David Schleef <ds@schleef.org>"
+ };
+ GstAudiofilterClass *klass = (GstAudiofilterClass *) g_class;
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+ gst_element_class_set_details (element_class, &audiofilter_details);
+}
+
+static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data)
+{
+ GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
+ GstAudiofilterClass *klass;
+
+ klass = (GstAudiofilterClass *)g_class;
+ gobject_class = (GObjectClass*)klass;
+ gstelement_class = (GstElementClass*)klass;
+
+ parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+
+ gobject_class->set_property = gst_audiofilter_set_property;
+ gobject_class->get_property = gst_audiofilter_get_property;
+}
+
+static GstCaps *
+gst_audiofilter_getcaps (GstPad *pad)
+{
+ GstAudiofilter *audiofilter;
+ GstCaps *othercaps;
+ GstAudiofilterClass *audiofilter_class;
+
+ GST_DEBUG("gst_audiofilter_sink_getcaps");
+ audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad));
+
+ audiofilter_class = GST_AUDIOFILTER_CLASS (
+ G_OBJECT_GET_CLASS (audiofilter));
+
+ if (pad == audiofilter->srcpad) {
+ othercaps = gst_pad_get_allowed_caps (audiofilter->sinkpad);
+ } else {
+ othercaps = gst_pad_get_allowed_caps (audiofilter->srcpad);
+ }
+
+ return gst_caps_intersect (othercaps, audiofilter_class->caps);
+}
+
+static GstPadLinkReturn
+gst_audiofilter_link (GstPad *pad, const GstCaps *caps)
+{
+ GstAudiofilter *audiofilter;
+ GstPadLinkReturn ret;
+ GstPadLinkReturn link_ret;
+ GstStructure *structure;
+ GstAudiofilterClass *audiofilter_class;
+
+ GST_DEBUG("gst_audiofilter_link");
+ audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad));
+ audiofilter_class = GST_AUDIOFILTER_CLASS (
+ G_OBJECT_GET_CLASS (audiofilter));
+
+
+ if (pad == audiofilter->srcpad) {
+ link_ret = gst_pad_try_set_caps (audiofilter->sinkpad, caps);
+ } else {
+ link_ret = gst_pad_try_set_caps (audiofilter->srcpad, caps);
+ }
+
+ if (link_ret != GST_PAD_LINK_OK) return link_ret;
+
+ structure = gst_caps_get_structure (caps, 0);
+
+ if (strcmp (gst_structure_get_name (structure), "audio/x-raw-int") == 0) {
+ ret = gst_structure_get_int (structure, "depth", &audiofilter->depth);
+ ret &= gst_structure_get_int (structure, "width", &audiofilter->width);
+ ret &= gst_structure_get_int (structure, "channels", &audiofilter->channels);
+ } else if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float")
+ == 0) {
+
+ } else {
+ g_assert_not_reached();
+ }
+ ret &= gst_structure_get_int (structure, "rate", &audiofilter->rate);
+
+ if (audiofilter_class->setup) (audiofilter_class->setup) (audiofilter);
+
+ return GST_PAD_LINK_OK;
+}
+
+static void
+gst_audiofilter_init (GTypeInstance *instance, gpointer g_class)
+{
+ GstAudiofilter *audiofilter = GST_AUDIOFILTER (instance);
+ GstPadTemplate *pad_template;
+
+ GST_DEBUG("gst_audiofilter_init");
+
+ pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class),
+ "sink");
+ g_return_if_fail(pad_template != NULL);
+ audiofilter->sinkpad = gst_pad_new_from_template(pad_template, "sink");
+ gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->sinkpad);
+ gst_pad_set_chain_function(audiofilter->sinkpad,gst_audiofilter_chain);
+ gst_pad_set_link_function(audiofilter->sinkpad,gst_audiofilter_link);
+ gst_pad_set_getcaps_function(audiofilter->sinkpad,gst_audiofilter_getcaps);
+
+ pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class),
+ "src");
+ g_return_if_fail(pad_template != NULL);
+ audiofilter->srcpad = gst_pad_new_from_template(pad_template, "src");
+ gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->srcpad);
+ gst_pad_set_link_function(audiofilter->srcpad,gst_audiofilter_link);
+ gst_pad_set_getcaps_function(audiofilter->srcpad,gst_audiofilter_getcaps);
+
+ audiofilter->inited = FALSE;
+}
+
+static void
+gst_audiofilter_chain (GstPad *pad, GstData *data)
+{
+ GstBuffer *inbuf = GST_BUFFER (data);
+ GstAudiofilter *audiofilter;
+ GstBuffer *outbuf;
+ GstAudiofilterClass *audiofilter_class;
+
+ GST_DEBUG ("gst_audiofilter_chain");
+
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (inbuf != NULL);
+
+ audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad));
+ //g_return_if_fail (audiofilter->inited);
+ audiofilter_class = GST_AUDIOFILTER_CLASS (
+ G_OBJECT_GET_CLASS (audiofilter));
+
+ GST_DEBUG ("gst_audiofilter_chain: got buffer of %d bytes in '%s'",
+ GST_BUFFER_SIZE(inbuf), GST_OBJECT_NAME (audiofilter));
+
+ if(audiofilter->passthru){
+ gst_pad_push(audiofilter->srcpad, data);
+ return;
+ }
+
+ if (gst_data_is_writable(data)) {
+ if (audiofilter_class->filter_inplace) {
+ (audiofilter_class->filter_inplace) (audiofilter, inbuf);
+ outbuf = inbuf;
+ } else {
+ outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(inbuf));
+ GST_BUFFER_DURATION(outbuf) = GST_BUFFER_DURATION(inbuf);
+ GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(inbuf);
+
+ (audiofilter_class->filter) (audiofilter, outbuf, inbuf);
+ gst_buffer_unref(inbuf);
+ }
+ } else {
+ outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(inbuf));
+ GST_BUFFER_DURATION(outbuf) = GST_BUFFER_DURATION(inbuf);
+ GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(inbuf);
+ if (audiofilter_class->filter) {
+ (audiofilter_class->filter) (audiofilter, outbuf, inbuf);
+ } else {
+ memcpy(GST_BUFFER_DATA(outbuf), GST_BUFFER_DATA(inbuf),
+ GST_BUFFER_SIZE(inbuf));
+
+ (audiofilter_class->filter_inplace) (audiofilter, outbuf);
+ }
+ gst_buffer_unref(inbuf);
+ }
+
+ gst_pad_push(audiofilter->srcpad, GST_DATA (outbuf));
+}
+
+static void
+gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+ GstAudiofilter *src;
+
+ /* it's not null if we got it, but it might not be ours */
+ g_return_if_fail(GST_IS_AUDIOFILTER(object));
+ src = GST_AUDIOFILTER(object);
+
+ GST_DEBUG("gst_audiofilter_set_property");
+ switch (prop_id) {
+ default:
+ break;
+ }
+}
+
+static void
+gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ GstAudiofilter *src;
+
+ /* it's not null if we got it, but it might not be ours */
+ g_return_if_fail(GST_IS_AUDIOFILTER(object));
+ src = GST_AUDIOFILTER(object);
+
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+void gst_audiofilter_class_add_pad_templates (
+ GstAudiofilterClass *audiofilter_class, const GstCaps *caps)
+{
+ GstElementClass *element_class = GST_ELEMENT_CLASS (audiofilter_class);
+
+ audiofilter_class->caps = gst_caps_copy(caps);
+
+ gst_element_class_add_pad_template (element_class,
+ gst_pad_template_new("src", GST_PAD_SRC, GST_PAD_ALWAYS,
+ gst_caps_copy(caps)));
+
+ gst_element_class_add_pad_template (element_class,
+ gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_caps_copy(caps)));
+}
+
+static gboolean
+plugin_init (GstPlugin *plugin)
+{
+ return TRUE;
+}
+
+GST_PLUGIN_DEFINE (
+ GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstaudiofilter",
+ "Audio filter parent class",
+ plugin_init,
+ VERSION,
+ "LGPL",
+ GST_PACKAGE,
+ GST_ORIGIN
+)
+
diff --git a/gst-libs/gst/audio/gstaudiofilter.h b/gst-libs/gst/audio/gstaudiofilter.h
new file mode 100644
index 00000000..4723c329
--- /dev/null
+++ b/gst-libs/gst/audio/gstaudiofilter.h
@@ -0,0 +1,84 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GST_AUDIOFILTER_H__
+#define __GST_AUDIOFILTER_H__
+
+
+#include <gst/gst.h>
+
+
+G_BEGIN_DECLS
+
+typedef struct _GstAudiofilter GstAudiofilter;
+typedef struct _GstAudiofilterClass GstAudiofilterClass;
+
+typedef void (*GstAudiofilterFilterFunc)(GstAudiofilter *filter,
+ GstBuffer *outbuf, GstBuffer *inbuf);
+typedef void (*GstAudiofilterInplaceFilterFunc)(GstAudiofilter *filter,
+ GstBuffer *buffer);
+
+typedef void (*GstAudiofilterSetupFunc) (GstAudiofilter *filter);
+
+
+#define GST_TYPE_AUDIOFILTER \
+ (gst_audiofilter_get_type())
+#define GST_AUDIOFILTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIOFILTER,GstAudiofilter))
+#define GST_AUDIOFILTER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOFILTER,GstAudiofilterClass))
+#define GST_IS_AUDIOFILTER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIOFILTER))
+#define GST_IS_AUDIOFILTER_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER))
+
+struct _GstAudiofilter {
+ GstElement element;
+
+ GstPad *sinkpad,*srcpad;
+
+ /* audio state */
+ gboolean inited;
+
+ int rate;
+ int width;
+ int channels;
+ int depth;
+ gboolean passthru;
+
+};
+
+struct _GstAudiofilterClass {
+ GstElementClass parent_class;
+
+ GstCaps *caps;
+ GstAudiofilterSetupFunc setup;
+ GstAudiofilterInplaceFilterFunc filter_inplace;
+ GstAudiofilterFilterFunc filter;
+};
+
+GType gst_audiofilter_get_type(void);
+
+void gst_audiofilter_class_add_pad_templates (GstAudiofilterClass *audiofilterclass, const GstCaps *caps);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIOFILTER_H__ */
+
diff --git a/gst-libs/gst/audio/gstaudiofilterexample.c b/gst-libs/gst/audio/gstaudiofilterexample.c
new file mode 100644
index 00000000..15e111af
--- /dev/null
+++ b/gst-libs/gst/audio/gstaudiofilterexample.c
@@ -0,0 +1,170 @@
+/* GStreamer
+ * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
+ * Copyright (C) <2003> David Schleef <ds@schleef.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <gst/audio/gstaudiofilter.h>
+
+typedef struct _GstAudiofilterExample GstAudiofilterExample;
+typedef struct _GstAudiofilterExampleClass GstAudiofilterExampleClass;
+
+#define GST_TYPE_AUDIOFILTER_EXAMPLE \
+ (gst_audiofilter_example_get_type())
+#define GST_AUDIOFILTER_EXAMPLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIOFILTER_EXAMPLE,GstAudiofilterExample))
+#define GST_AUDIOFILTER_EXAMPLE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOFILTER_EXAMPLE,GstAudiofilterExampleClass))
+#define GST_IS_AUDIOFILTER_EXAMPLE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIOFILTER_EXAMPLE))
+#define GST_IS_AUDIOFILTER_EXAMPLE_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER_EXAMPLE))
+
+struct _GstAudiofilterExample {
+ GstAudiofilter audiofilter;
+
+};
+
+struct _GstAudiofilterExampleClass {
+ GstAudiofilterClass parent_class;
+
+};
+
+
+/* GstAudiofilterExample signals and args */
+enum {
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+enum {
+ ARG_0,
+ ARG_METHOD,
+ /* FILL ME */
+};
+
+static void gst_audiofilter_example_base_init (gpointer g_class);
+static void gst_audiofilter_example_class_init (gpointer g_class, gpointer class_data);
+
+static void gst_audiofilter_example_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void gst_audiofilter_example_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+
+GType
+gst_audiofilter_example_get_type (void)
+{
+ static GType audiofilter_example_type = 0;
+
+ if (!audiofilter_example_type) {
+ static const GTypeInfo audiofilter_example_info = {
+ sizeof(GstAudiofilterExampleClass),
+ gst_audiofilter_example_base_init,
+ NULL,
+ gst_audiofilter_example_class_init,
+ NULL,
+ NULL,
+ sizeof(GstAudiofilterExample),
+ 0,
+ NULL,
+ };
+ audiofilter_example_type = g_type_register_static(GST_TYPE_AUDIOFILTER,
+ "GstAudiofilterExample", &audiofilter_example_info, 0);
+ }
+ return audiofilter_example_type;
+}
+
+static void gst_audiofilter_example_base_init (gpointer g_class)
+{
+ static GstElementDetails audiofilter_example_details = {
+ "Audio filter example",
+ "Filter/Effect/Audio",
+ "Filters audio",
+ "David Schleef <ds@schleef.org>"
+ };
+ GstAudiofilterExampleClass *klass = (GstAudiofilterExampleClass *) g_class;
+ GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+ gst_element_class_set_details (element_class, &audiofilter_example_details);
+}
+
+static void gst_audiofilter_example_class_init (gpointer g_class, gpointer class_data)
+{
+ GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
+ GstAudiofilterExampleClass *klass;
+
+ klass = (GstAudiofilterExampleClass *)g_class;
+ gobject_class = (GObjectClass*)klass;
+ gstelement_class = (GstElementClass*)klass;
+
+ gobject_class->set_property = gst_audiofilter_example_set_property;
+ gobject_class->get_property = gst_audiofilter_example_get_property;
+}
+
+static void
+gst_audiofilter_example_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+ GstAudiofilterExample *src;
+
+ /* it's not null if we got it, but it might not be ours */
+ g_return_if_fail(GST_IS_AUDIOFILTER_EXAMPLE(object));
+ src = GST_AUDIOFILTER_EXAMPLE(object);
+
+ GST_DEBUG("gst_audiofilter_example_set_property");
+ switch (prop_id) {
+ default:
+ break;
+ }
+}
+
+static void
+gst_audiofilter_example_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ GstAudiofilterExample *src;
+
+ /* it's not null if we got it, but it might not be ours */
+ g_return_if_fail(GST_IS_AUDIOFILTER_EXAMPLE(object));
+ src = GST_AUDIOFILTER_EXAMPLE(object);
+
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static gboolean
+plugin_init (GstPlugin *plugin)
+{
+ return TRUE;
+}
+
+GST_PLUGIN_DEFINE (
+ GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstaudiofilter_example",
+ "Audio filter example",
+ plugin_init,
+ VERSION,
+ "LGPL",
+ GST_PACKAGE,
+ GST_ORIGIN
+)
diff --git a/gst-libs/gst/media-info/media-info-priv.c b/gst-libs/gst/media-info/media-info-priv.c
index 77981598..c7f470ea 100644
--- a/gst-libs/gst/media-info/media-info-priv.c
+++ b/gst-libs/gst/media-info/media-info-priv.c
@@ -136,13 +136,13 @@ gmi_reset (GstMediaInfo *info)
if (priv->format)
{
GMI_DEBUG ("unreffing priv->format, error before this ?\n");
- gst_caps_unref (priv->format);
+ gst_caps_free (priv->format);
priv->format = NULL;
}
if (priv->metadata)
{
GMI_DEBUG ("unreffing priv->metadata, error before this ?\n");
- gst_caps_unref (priv->metadata);
+ gst_caps_free (priv->metadata);
priv->metadata = NULL;
}
if (priv->stream)
@@ -193,12 +193,12 @@ gmi_seek_to_track (GstMediaInfo *info, long track)
/* clear structs because of the seek */
if (priv->metadata)
{
- gst_caps_unref (priv->metadata);
+ gst_caps_free (priv->metadata);
priv->metadata = NULL;
}
if (priv->streaminfo)
{
- gst_caps_unref (priv->streaminfo);
+ gst_caps_free (priv->streaminfo);
priv->streaminfo = NULL;
}
return TRUE;
@@ -304,7 +304,7 @@ gmip_find_type_pre (GstMediaInfoPriv *priv)
if (priv->type)
{
/* we don't need to unref, this is done inside gsttypefind.c
- gst_caps_unref (priv->type);
+ gst_caps_free (priv->type);
*/
priv->type = NULL;
}
@@ -573,14 +573,13 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
&format, &value_end);
if (res)
{
- GstPropsEntry *length;
/* substract to get the length */
GMI_DEBUG("DEBUG: start %lld, end %lld\n", value_start, value_end);
value_end -= value_start;
/* FIXME: check units; this is in seconds */
- length = gst_props_entry_new ("length",
- GST_PROPS_INT ((int) (value_end / 1E6)));
- gst_props_add_entry (gst_caps_get_props (priv->streaminfo), length);
+
+ gst_caps_set_simple (priv->streaminfo,
+ "length", G_TYPE_INT, (int) (value_end / 1E6), NULL);
}
}
}
diff --git a/gst-libs/gst/media-info/media-info-test.c b/gst-libs/gst/media-info/media-info-test.c
index 553e97c6..5a73c8bd 100644
--- a/gst-libs/gst/media-info/media-info-test.c
+++ b/gst-libs/gst/media-info/media-info-test.c
@@ -5,56 +5,6 @@
#include "media-info.h"
static void
-caps_print (GstCaps *caps)
-{
- if (caps == NULL) return;
- /*
- if (!strcmp (gst_caps_get_mime (caps), "application/x-gst-metadata") ||
- !strcmp (gst_caps_get_mime (caps), "application/x-gst-streaminfo"))
- */
- if (TRUE)
- {
- GstProps *props = caps->properties;
- GList *walk;
-
- if (props == NULL)
- {
- g_print (" none\n");
- return;
- }
- walk = props->properties;
-
- while (walk) {
- GstPropsEntry *entry = (GstPropsEntry *) walk->data;
- const gchar *name;
- const gchar *str_val;
- gint int_val;
- GstPropsType type;
-
- name = gst_props_entry_get_name (entry);
- type = gst_props_entry_get_props_type (entry);
- switch (type) {
- case GST_PROPS_STRING_TYPE:
- gst_props_entry_get_string (entry, &str_val);
- g_print (" %s='%s'\n", name, str_val);
- break;
- case GST_PROPS_INT_TYPE:
- gst_props_entry_get_int (entry, &int_val);
- g_print (" %s=%d\n", name, int_val);
- break;
- default:
- break;
- }
-
- walk = g_list_next (walk);
- }
- }
- else {
- g_print (" unkown caps type\n");
- }
-}
-
-static void
info_print (GstMediaInfoStream *stream)
{
int i;
@@ -77,11 +27,11 @@ info_print (GstMediaInfoStream *stream)
g_print ("- track %d\n", i);
track = (GstMediaInfoTrack *) p->data;
g_print (" - metadata:\n");
- caps_print (track->metadata);
+ g_print ("%s\n", gst_caps_to_string (track->metadata));
g_print (" - streaminfo:\n");
- caps_print (track->streaminfo);
+ g_print ("%s\n", gst_caps_to_string (track->streaminfo));
g_print (" - format:\n");
- caps_print (track->format);
+ g_print ("%s\n", gst_caps_to_string (track->format));
p = p->next;
}
}
diff --git a/gst-libs/gst/media-info/media-info.c b/gst-libs/gst/media-info/media-info.c
index 92957e16..e214e8e1 100644
--- a/gst-libs/gst/media-info/media-info.c
+++ b/gst-libs/gst/media-info/media-info.c
@@ -294,7 +294,8 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
GMI_DEBUG("doing find_type_post\n");
gmip_find_type_post (priv);
GMI_DEBUG("finding out mime type\n");
- mime = g_strdup (gst_caps_get_mime (priv->type));
+ mime = g_strdup (gst_structure_get_name (
+ gst_caps_get_structure(priv->type, 0)));
GMI_DEBUG("found out mime type: %s\n", mime);
decoder = gmi_get_decoder (info, mime);
if (decoder == NULL)
@@ -443,7 +444,8 @@ gst_media_info_read (GstMediaInfo *info, const char *location, guint16 flags)
if (!gmip_find_type (priv)) return NULL;
- mime = g_strdup (gst_caps_get_mime (priv->type));
+ mime = g_strdup (gst_structure_get_name (
+ gst_caps_get_structure(priv->type, 0)));
GMI_DEBUG("mime type: %s\n", mime);
/* c) figure out decoder */
diff --git a/gst-libs/gst/play/gstplay.c b/gst-libs/gst/play/gstplay.c
index 8e0c9754..d79e06f3 100644
--- a/gst-libs/gst/play/gstplay.c
+++ b/gst-libs/gst/play/gstplay.c
@@ -20,6 +20,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include <string.h>
#include "gstplay.h"
@@ -919,40 +920,41 @@ gst_play_get_sink_element (GstPlay *play,
}
else {
/* If not a src pad checking caps */
- GstCaps *caps;
+ const GstCaps *caps;
+ GstStructure *structure;
+ gboolean has_video_cap = FALSE;
+ gboolean has_audio_cap = FALSE;
+
caps = gst_pad_get_caps (GST_PAD (pads->data));
- while (caps) {
- gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
- if (g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "audio/x-raw-int") == 0) {
- has_audio_cap = TRUE;
- }
-
- if ((g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "video/x-raw-yuv") == 0) ||
- (g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "video/x-raw-rgb") == 0)) {
- has_video_cap = TRUE;
- }
-
- switch (sink_type) {
- case GST_PLAY_SINK_TYPE_AUDIO:
- if (has_audio_cap)
- has_correct_type = TRUE;
- break;;
- case GST_PLAY_SINK_TYPE_VIDEO:
- if (has_video_cap)
- has_correct_type = TRUE;
- break;;
- case GST_PLAY_SINK_TYPE_ANY:
- if ((has_video_cap) || (has_audio_cap))
- has_correct_type = TRUE;
- break;;
- default:
- has_correct_type = FALSE;
- }
-
- caps = caps->next;
+ structure = gst_caps_get_structure (caps, 0);
+
+ if (strcmp (gst_structure_get_name (structure),
+ "audio/x-raw-int") == 0) {
+ has_audio_cap = TRUE;
+ }
+
+ if (strcmp (gst_structure_get_name (structure),
+ "video/x-raw-yuv") == 0 ||
+ strcmp (gst_structure_get_name (structure),
+ "video/x-raw-rgb") == 0) {
+ has_video_cap = TRUE;
+ }
+
+ switch (sink_type) {
+ case GST_PLAY_SINK_TYPE_AUDIO:
+ if (has_audio_cap)
+ has_correct_type = TRUE;
+ break;;
+ case GST_PLAY_SINK_TYPE_VIDEO:
+ if (has_video_cap)
+ has_correct_type = TRUE;
+ break;;
+ case GST_PLAY_SINK_TYPE_ANY:
+ if ((has_video_cap) || (has_audio_cap))
+ has_correct_type = TRUE;
+ break;;
+ default:
+ has_correct_type = FALSE;
}
}
diff --git a/gst-libs/gst/play/play.c b/gst-libs/gst/play/play.c
index 8e0c9754..d79e06f3 100644
--- a/gst-libs/gst/play/play.c
+++ b/gst-libs/gst/play/play.c
@@ -20,6 +20,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include <string.h>
#include "gstplay.h"
@@ -919,40 +920,41 @@ gst_play_get_sink_element (GstPlay *play,
}
else {
/* If not a src pad checking caps */
- GstCaps *caps;
+ const GstCaps *caps;
+ GstStructure *structure;
+ gboolean has_video_cap = FALSE;
+ gboolean has_audio_cap = FALSE;
+
caps = gst_pad_get_caps (GST_PAD (pads->data));
- while (caps) {
- gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
- if (g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "audio/x-raw-int") == 0) {
- has_audio_cap = TRUE;
- }
-
- if ((g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "video/x-raw-yuv") == 0) ||
- (g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "video/x-raw-rgb") == 0)) {
- has_video_cap = TRUE;
- }
-
- switch (sink_type) {
- case GST_PLAY_SINK_TYPE_AUDIO:
- if (has_audio_cap)
- has_correct_type = TRUE;
- break;;
- case GST_PLAY_SINK_TYPE_VIDEO:
- if (has_video_cap)
- has_correct_type = TRUE;
- break;;
- case GST_PLAY_SINK_TYPE_ANY:
- if ((has_video_cap) || (has_audio_cap))
- has_correct_type = TRUE;
- break;;
- default:
- has_correct_type = FALSE;
- }
-
- caps = caps->next;
+ structure = gst_caps_get_structure (caps, 0);
+
+ if (strcmp (gst_structure_get_name (structure),
+ "audio/x-raw-int") == 0) {
+ has_audio_cap = TRUE;
+ }
+
+ if (strcmp (gst_structure_get_name (structure),
+ "video/x-raw-yuv") == 0 ||
+ strcmp (gst_structure_get_name (structure),
+ "video/x-raw-rgb") == 0) {
+ has_video_cap = TRUE;
+ }
+
+ switch (sink_type) {
+ case GST_PLAY_SINK_TYPE_AUDIO:
+ if (has_audio_cap)
+ has_correct_type = TRUE;
+ break;;
+ case GST_PLAY_SINK_TYPE_VIDEO:
+ if (has_video_cap)
+ has_correct_type = TRUE;
+ break;;
+ case GST_PLAY_SINK_TYPE_ANY:
+ if ((has_video_cap) || (has_audio_cap))
+ has_correct_type = TRUE;
+ break;;
+ default:
+ has_correct_type = FALSE;
}
}
diff --git a/gst-libs/gst/play/play.old.c b/gst-libs/gst/play/play.old.c
index 64963661..513a3e12 100644
--- a/gst-libs/gst/play/play.old.c
+++ b/gst-libs/gst/play/play.old.c
@@ -26,6 +26,7 @@
#include "config.h"
#endif
+#include <string.h>
#include "play.h"
enum
@@ -906,43 +907,38 @@ gst_play_get_sink_element (GstPlay * play,
else
{
/* If not a src pad checking caps */
- GstCaps *caps;
- caps = gst_pad_get_caps (GST_PAD (pads->data));
- while (caps)
+ gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
+ const char *media_type;
+
+ media_type = gst_structure_get_name (gst_caps_get_structure (
+ gst_pad_get_caps (GST_PAD (pads->data)), 0));
+ if (strcmp (media_type, "audio/x-raw-int") == 0)
+ {
+ has_audio_cap = TRUE;
+ }
+ if ((strcmp (media_type, "video/x-raw-yuv") == 0) ||
+ (strcmp (media_type, "video/x-raw-rgb") == 0))
+
+ {
+ has_video_cap = TRUE;
+ }
+
+ switch (sink_type)
{
- gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
- if (g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "audio/x-raw-int") == 0)
- {
- has_audio_cap = TRUE;
- }
- if ((g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "video/x-raw-yuv") == 0) ||
- (g_ascii_strcasecmp (gst_caps_get_mime (caps),
- "video/x-raw-rgb") == 0))
-
- {
- has_video_cap = TRUE;
- }
-
- switch (sink_type)
- {
- case GST_PLAY_SINK_TYPE_AUDIO:
- if (has_audio_cap)
- has_correct_type = TRUE;
- break;;
- case GST_PLAY_SINK_TYPE_VIDEO:
- if (has_video_cap)
- has_correct_type = TRUE;
- break;;
- case GST_PLAY_SINK_TYPE_ANY:
- if ((has_video_cap) || (has_audio_cap))
- has_correct_type = TRUE;
- break;;
- default:
- has_correct_type = FALSE;
- }
- caps = caps->next;
+ case GST_PLAY_SINK_TYPE_AUDIO:
+ if (has_audio_cap)
+ has_correct_type = TRUE;
+ break;;
+ case GST_PLAY_SINK_TYPE_VIDEO:
+ if (has_video_cap)
+ has_correct_type = TRUE;
+ break;;
+ case GST_PLAY_SINK_TYPE_ANY:
+ if ((has_video_cap) || (has_audio_cap))
+ has_correct_type = TRUE;
+ break;;
+ default:
+ has_correct_type = FALSE;
}
}
pads = g_list_next (pads);
diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c
index eeb6fd63..cbeb3492 100644
--- a/gst-libs/gst/riff/riff-media.c
+++ b/gst-libs/gst/riff/riff-media.c
@@ -36,40 +36,28 @@ gst_riff_create_video_caps (guint32 codec_fcc,
switch (codec_fcc) {
case GST_MAKE_FOURCC('I','4','2','0'):
case GST_MAKE_FOURCC('Y','U','Y','2'):
- caps = GST_CAPS_NEW (
- "riff_video_raw",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (codec_fcc)
- );
+ caps = gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, codec_fcc,
+ NULL);
break;
case GST_MAKE_FOURCC('M','J','P','G'): /* YUY2 MJPEG */
case GST_MAKE_FOURCC('J','P','E','G'): /* generic (mostly RGB) MJPEG */
case GST_MAKE_FOURCC('P','I','X','L'): /* Miro/Pinnacle fourccs */
case GST_MAKE_FOURCC('V','I','X','L'): /* Miro/Pinnacle fourccs */
- caps = GST_CAPS_NEW (
- "riff_video_jpeg",
- "video/x-jpeg",
- NULL
- );
+ caps = gst_caps_new_simple ("video/x-jpeg", NULL);
break;
case GST_MAKE_FOURCC('H','F','Y','U'):
- caps = GST_CAPS_NEW (
- "riff_video_hfyu",
- "video/x-huffyuv",
- NULL
- );
+ caps = gst_caps_new_simple ( "video/x-huffyuv", NULL);
break;
case GST_MAKE_FOURCC('M','P','E','G'):
case GST_MAKE_FOURCC('M','P','G','I'):
- caps = GST_CAPS_NEW (
- "riff_video_mpeg1",
- "video/mpeg",
- "systemstream", GST_PROPS_BOOLEAN (FALSE),
- "mpegversion", GST_PROPS_BOOLEAN (1)
- );
+ caps = gst_caps_new_simple ("video/mpeg",
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_BOOLEAN, 1,
+ NULL);
break;
case GST_MAKE_FOURCC('H','2','6','3'):
@@ -79,138 +67,98 @@ gst_riff_create_video_caps (guint32 codec_fcc,
case GST_MAKE_FOURCC('V','D','O','W'):
case GST_MAKE_FOURCC('V','I','V','O'):
case GST_MAKE_FOURCC('x','2','6','3'):
- caps = GST_CAPS_NEW (
- "riff_video_h263",
- "video/x-h263",
- NULL
- );
+ caps = gst_caps_new_simple ("video/x-h263", NULL);
break;
case GST_MAKE_FOURCC('D','I','V','3'):
case GST_MAKE_FOURCC('D','I','V','4'):
case GST_MAKE_FOURCC('D','I','V','5'):
- caps = GST_CAPS_NEW (
- "riff_video_divx3",
- "video/x-divx",
- "divxversion", GST_PROPS_INT(3)
- );
+ caps = gst_caps_new_simple ("video/x-divx",
+ "divxversion", G_TYPE_INT, 3,
+ NULL);
break;
case GST_MAKE_FOURCC('d','i','v','x'):
case GST_MAKE_FOURCC('D','I','V','X'):
case GST_MAKE_FOURCC('D','X','5','0'):
- caps = GST_CAPS_NEW (
- "riff_video_divx45",
- "video/x-divx",
- "divxversion", GST_PROPS_INT(5)
- );
+ caps = gst_caps_new_simple ("video/x-divx",
+ "divxversion", G_TYPE_INT, 5,
+ NULL);
break;
case GST_MAKE_FOURCC('X','V','I','D'):
case GST_MAKE_FOURCC('x','v','i','d'):
- caps = GST_CAPS_NEW (
- "riff_video_xvid",
- "video/x-xvid",
- NULL
- );
+ caps = gst_caps_new_simple ("video/x-xvid", NULL);
break;
case GST_MAKE_FOURCC('M','P','G','4'):
- caps = GST_CAPS_NEW (
- "riff_video_msmpeg41",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (41)
- );
+ caps = gst_caps_new_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 41,
+ NULL);
break;
case GST_MAKE_FOURCC('M','P','4','2'):
- caps = GST_CAPS_NEW (
- "riff_video_msmpeg42",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (42)
- );
+ caps = gst_caps_new_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 42,
+ NULL);
break;
case GST_MAKE_FOURCC('M','P','4','3'):
- caps = GST_CAPS_NEW (
- "riff_video_msmpeg43",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (43)
- );
+ caps = gst_caps_new_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 43,
+ NULL);
break;
case GST_MAKE_FOURCC('3','I','V','1'):
case GST_MAKE_FOURCC('3','I','V','2'):
- caps = GST_CAPS_NEW (
- "riff_video_3ivx",
- "video/x-3ivx",
- NULL
- );
+ caps = gst_caps_new_simple ( "video/x-3ivx", NULL);
break;
case GST_MAKE_FOURCC('D','V','S','D'):
case GST_MAKE_FOURCC('d','v','s','d'):
- caps = GST_CAPS_NEW (
- "riff_video_dv",
- "video/x-dv",
- "systemstream", GST_PROPS_BOOLEAN (FALSE)
- );
+ caps = gst_caps_new_simple ("video/x-dv",
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ NULL);
break;
case GST_MAKE_FOURCC('W','M','V','1'):
- caps = GST_CAPS_NEW (
- "riff_video_wmv1",
- "video/x-wmv",
- "wmvversion", GST_PROPS_INT (1)
- );
+ caps = gst_caps_new_simple ("video/x-wmv",
+ "wmvversion", G_TYPE_INT, 1,
+ NULL);
break;
case GST_MAKE_FOURCC('W','M','V','2'):
- caps = GST_CAPS_NEW (
- "riff_video_wmv2",
- "video/x-wmv",
- "wmvversion", GST_PROPS_INT (2)
- );
+ caps = gst_caps_new_simple ("video/x-wmv",
+ "wmvversion", G_TYPE_INT, 2,
+ NULL);
break;
default:
GST_WARNING ("Unkown video fourcc " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec_fcc));
- break;
+ return NULL;
}
- /* add general properties */
- if (caps != NULL) {
- GstPropsEntry *framerate, *width, *height;
-
- if (strh != NULL) {
- gfloat fps = 1. * strh->rate / strh->scale;
-
- framerate = gst_props_entry_new ("framerate",
- GST_PROPS_FLOAT (fps));
- } else {
- framerate = gst_props_entry_new ("framerate",
- GST_PROPS_FLOAT_RANGE (0., G_MAXFLOAT));
- }
-
- if (strf != NULL) {
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (strf->width));
- height = gst_props_entry_new ("height",
- GST_PROPS_INT (strf->height));
- } else {
- width = gst_props_entry_new ("width",
- GST_PROPS_INT_RANGE (16, 4096));
- height = gst_props_entry_new ("height",
- GST_PROPS_INT_RANGE (16, 4096));
- }
-
- if (!caps->properties)
- caps->properties = gst_props_empty_new ();
-
- gst_props_add_entry (caps->properties, width);
- gst_props_add_entry (caps->properties, height);
- gst_props_add_entry (caps->properties, framerate);
+ if (strh != NULL) {
+ gfloat fps = 1. * strh->rate / strh->scale;
+
+ gst_caps_set_simple (caps, "framerate", G_TYPE_DOUBLE, fps, NULL);
+ } else {
+ gst_caps_set_simple (caps,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE,
+ NULL);
+ }
+
+ if (strf != NULL) {
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, strf->width,
+ "height", G_TYPE_INT, strf->height,
+ NULL);
+ } else {
+ gst_caps_set_simple (caps,
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ NULL);
}
return caps;
@@ -225,57 +173,38 @@ gst_riff_create_audio_caps (guint16 codec_id,
switch (codec_id) {
case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
- caps = GST_CAPS_NEW ("riff_audio_mp1l3",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT (3));
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, 3,
+ NULL);
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
- caps = GST_CAPS_NEW ("riff_audio_mp1l12",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT (2));
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, 2,
+ NULL);
break;
- case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ {
- GstPropsEntry *width = NULL, *depth = NULL, *signedness = NULL;
-
+ case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */
if (strf != NULL) {
gint ba = GUINT16_FROM_LE (strf->blockalign);
gint ch = GUINT16_FROM_LE (strf->channels);
gint ws = GUINT16_FROM_LE (strf->size);
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (ba * 8 / ch));
- depth = gst_props_entry_new ("depth",
- GST_PROPS_INT (ws));
- signedness = gst_props_entry_new ("signed",
- GST_PROPS_BOOLEAN (ws != 8));
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+ "width", G_TYPE_INT, (int)(ba * 8 / ch),
+ "depth", G_TYPE_INT, ws,
+ "signed", G_TYPE_BOOLEAN, ws != 8,
+ NULL);
} else {
- signedness = gst_props_entry_new ("signed",
- GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)));
- width = gst_props_entry_new ("width",
- GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)));
- depth = gst_props_entry_new ("depth",
- GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)));
+ caps = gst_caps_from_string ("audio/x-raw-int, "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "signed = (boolean) { true, false }, "
+ "width = (int) { 8, 16 }, "
+ "height = (int) { 8, 16 }");
}
-
- caps = GST_CAPS_NEW ("riff_audio_pcm",
- "audio/x-raw-int",
- "endianness",
- GST_PROPS_INT (G_LITTLE_ENDIAN));
- gst_props_add_entry (caps->properties, width);
- gst_props_add_entry (caps->properties, depth);
- gst_props_add_entry (caps->properties, signedness);
-
- }
break;
case GST_RIFF_WAVE_FORMAT_MULAW:
@@ -283,9 +212,7 @@ gst_riff_create_audio_caps (guint16 codec_id,
GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
strf->size);
}
- caps = GST_CAPS_NEW ("riff_audio_mulaw",
- "audio/x-mulaw",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
break;
case GST_RIFF_WAVE_FORMAT_ALAW:
@@ -293,9 +220,7 @@ gst_riff_create_audio_caps (guint16 codec_id,
GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
strf->size);
}
- caps = GST_CAPS_NEW ("riff_audio_alaw",
- "audio/x-alaw",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-alaw", NULL);
break;
case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
@@ -304,15 +229,11 @@ gst_riff_create_audio_caps (guint16 codec_id,
case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
- caps = GST_CAPS_NEW ("riff_audio_vorbis",
- "audio/x-vorbis",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
break;
case GST_RIFF_WAVE_FORMAT_A52:
- caps = GST_CAPS_NEW ("riff_audio_ac3",
- "audio/x-ac3",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-ac3", NULL);
break;
default:
@@ -321,26 +242,16 @@ gst_riff_create_audio_caps (guint16 codec_id,
break;
}
- if (caps != NULL) {
- GstPropsEntry *samplerate, *channels;
-
- if (strf != NULL) {
- samplerate = gst_props_entry_new ("rate",
- GST_PROPS_INT (strf->rate));
- channels = gst_props_entry_new ("channels",
- GST_PROPS_INT (strf->channels));
- } else {
- samplerate = gst_props_entry_new ("rate",
- GST_PROPS_INT_RANGE (8000, 96000));
- channels = gst_props_entry_new ("channels",
- GST_PROPS_INT_RANGE (1, 2));
- }
-
- if (!caps->properties)
- caps->properties = gst_props_empty_new ();
-
- gst_props_add_entry (caps->properties, samplerate);
- gst_props_add_entry (caps->properties, channels);
+ if (strf != NULL) {
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT, strf->rate,
+ "channels", G_TYPE_INT, strf->channels,
+ NULL);
+ } else {
+ gst_caps_set_simple (caps,
+ "rate", GST_TYPE_INT_RANGE, 8000, 96000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
return caps;
@@ -357,14 +268,13 @@ gst_riff_create_iavs_caps (guint32 codec_fcc,
/* is this correct? */
case GST_MAKE_FOURCC ('D','V','S','D'):
case GST_MAKE_FOURCC ('d','v','s','d'):
- caps = GST_CAPS_NEW ("riff_iavs_dv",
- "video/x-dv",
- "systemstream", GST_PROPS_BOOLEAN (TRUE));
+ caps = gst_caps_new_simple ("video/x-dv",
+ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
default:
GST_WARNING ("Unkown IAVS fourcc " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (codec_fcc));
- break;
+ return NULL;
}
return caps;
@@ -398,12 +308,13 @@ gst_riff_create_video_template_caps (void)
0
};
guint i;
- GstCaps *caps = NULL, *one;
+ GstCaps *caps, *one;
+ caps = gst_caps_new_empty ();
for (i = 0; tags[i] != 0; i++) {
one = gst_riff_create_video_caps (tags[i], NULL, NULL);
if (one)
- caps = gst_caps_append (caps, one);
+ gst_caps_append (caps, one);
}
return caps;
@@ -424,12 +335,13 @@ gst_riff_create_audio_template_caps (void)
0
};
guint i;
- GstCaps *caps = NULL, *one;
+ GstCaps *caps, *one;
+ caps = gst_caps_new_empty ();
for (i = 0; tags[i] != 0; i++) {
one = gst_riff_create_audio_caps (tags[i], NULL, NULL);
if (one)
- caps = gst_caps_append (caps, one);
+ gst_caps_append (caps, one);
}
return caps;
@@ -444,13 +356,15 @@ gst_riff_create_iavs_template_caps (void)
0
};
guint i;
- GstCaps *caps = NULL, *one;
+ GstCaps *caps, *one;
+ caps = gst_caps_new_empty ();
for (i = 0; tags[i] != 0; i++) {
one = gst_riff_create_iavs_caps (tags[i], NULL, NULL);
if (one)
- caps = gst_caps_append (caps, one);
+ gst_caps_append (caps, one);
}
return caps;
}
+
diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c
index c264cced..815b3a7b 100644
--- a/gst-libs/gst/riff/riff-read.c
+++ b/gst-libs/gst/riff/riff-read.c
@@ -714,7 +714,7 @@ gst_riff_read_info (GstRiffRead *riff)
GstRiffLevel *level;
GList *last;
gchar *name, *type;
- GstProps *props;
+ GstCaps *caps;
/* What we're doing here is ugly (oh no!); we look
* at our LIST tag size and assure that we do not
@@ -726,11 +726,10 @@ gst_riff_read_info (GstRiffRead *riff)
end = level->start + level->length;
g_free (level);
- props = gst_props_empty_new ();
+ caps = gst_caps_new_simple ("application/x-gst-metadata", NULL);
while (gst_bytestream_tell (riff->bs) < end) {
if (!gst_riff_peek_head (riff, &tag, NULL, NULL)) {
- gst_props_unref (props);
return FALSE;
}
@@ -813,26 +812,18 @@ gst_riff_read_info (GstRiffRead *riff)
}
if (type) {
- GstPropsEntry *entry;
-
if (!gst_riff_read_ascii (riff, &tag, &name)) {
- gst_props_unref (props);
return FALSE;
}
- entry = gst_props_entry_new (type, GST_PROPS_STRING (name));
- gst_props_add_entry (props, entry);
+ gst_caps_set_simple (caps, type, G_TYPE_STRING, name, NULL);
} else {
gst_riff_read_skip (riff);
}
}
/* let the world know about this wonderful thing */
- gst_props_debug (props);
- gst_caps_replace_sink (&riff->metadata,
- gst_caps_new ("riff_metadata",
- "application/x-gst-metadata",
- props));
+ gst_caps_replace (&riff->metadata, caps);
g_object_notify (G_OBJECT (riff), "metadata");
return TRUE;
diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c
index 706acc3b..6d804a4d 100644
--- a/gst-libs/gst/video/video.c
+++ b/gst-libs/gst/video/video.c
@@ -26,11 +26,12 @@
/* This is simply a convenience function, nothing more or less */
-gfloat
+gdouble
gst_video_frame_rate (GstPad *pad)
{
- gfloat fps = 0.;
+ gdouble fps = 0.;
GstCaps *caps;
+ GstStructure *structure;
/* get pad caps */
caps = GST_PAD_CAPS (pad);
@@ -41,16 +42,14 @@ gst_video_frame_rate (GstPad *pad)
return 0.;
}
- if (!gst_caps_has_property_typed (caps, "framerate",
- GST_PROPS_FLOAT_TYPE)) {
+ structure = gst_caps_get_structure (caps, 0);
+ if (!gst_structure_get_double (structure, "framerate", &fps)){
g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME (pad));
return 0.;
}
- gst_caps_get_float (caps, "framerate", &fps);
-
GST_DEBUG ("Framerate request on pad %s:%s: %f",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME(pad), fps);
@@ -64,8 +63,12 @@ gst_video_get_size (GstPad *pad,
gint *height)
{
GstCaps *caps;
+ GstStructure *structure;
+ gboolean ret;
g_return_val_if_fail (pad != NULL, FALSE);
+ g_return_val_if_fail (width != NULL, FALSE);
+ g_return_val_if_fail (height != NULL, FALSE);
caps = GST_PAD_CAPS (pad);
@@ -76,21 +79,17 @@ gst_video_get_size (GstPad *pad,
return FALSE;
}
- if (!gst_caps_has_property_typed (caps, "width",
- GST_PROPS_INT_TYPE) ||
- !gst_caps_has_property_typed (caps, "height",
- GST_PROPS_FLOAT_TYPE)) {
+ structure = gst_caps_get_structure (caps, 0);
+ ret = gst_structure_get_int (structure, "width", width);
+ ret &= gst_structure_get_int (structure, "height", height);
+
+ if (!ret) {
g_warning ("gstvideo: failed to get size properties on pad %s:%s",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME(pad));
return FALSE;
}
- if (width)
- gst_caps_get_int (caps, "width", width);
- if (height)
- gst_caps_get_int (caps, "height", height);
-
GST_DEBUG ("size request on pad %s:%s: %dx%d",
GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
GST_PAD_NAME (pad),
diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h
index 3ce2a2e9..7f5a1fdf 100644
--- a/gst-libs/gst/video/video.h
+++ b/gst-libs/gst/video/video.h
@@ -23,203 +23,175 @@
#include <gst/gst.h>
-#define R_MASK_32 0xff000000
-#define G_MASK_32 0x00ff0000
-#define B_MASK_32 0x0000ff00
+#define R_MASK_32 "0xff000000"
+#define G_MASK_32 "0x00ff0000"
+#define B_MASK_32 "0x0000ff00"
-#define R_MASK_32_REVERSE 0x000000ff
-#define G_MASK_32_REVERSE 0x0000ff00
-#define B_MASK_32_REVERSE 0x00ff0000
+#define R_MASK_32_REVERSE "0x000000ff"
+#define G_MASK_32_REVERSE "0x0000ff00"
+#define B_MASK_32_REVERSE "0x00ff0000"
-#define R_MASK_24 0xff0000
-#define G_MASK_24 0x00ff00
-#define B_MASK_24 0x0000ff
+#define R_MASK_24 "0xff0000"
+#define G_MASK_24 "0x00ff00"
+#define B_MASK_24 "0x0000ff"
-#define R_MASK_24_REVERSE 0x0000ff
-#define G_MASK_24_REVERSE 0x00ff00
-#define B_MASK_24_REVERSE 0xff0000
+#define R_MASK_24_REVERSE "0x0000ff"
+#define G_MASK_24_REVERSE "0x00ff00"
+#define B_MASK_24_REVERSE "0xff0000"
-#define R_MASK_16 0xf800
-#define G_MASK_16 0x07e0
-#define B_MASK_16 0x001f
+#define R_MASK_16 "0xf800"
+#define G_MASK_16 "0x07e0"
+#define B_MASK_16 "0x001f"
-#define R_MASK_15 0x8c00
-#define G_MASK_15 0x03e0
-#define B_MASK_15 0x001f
+#define R_MASK_15 "0x7c00"
+#define G_MASK_15 "0x03e0"
+#define B_MASK_15 "0x001f"
-#define SIZE_RANGE GST_PROPS_INT_RANGE (16, 4096)
-#define FPS_RANGE GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
+#define R_MASK_32_INT 0xff000000
+#define G_MASK_32_INT 0x00ff0000
+#define B_MASK_32_INT 0x0000ff00
+
+#define R_MASK_32_REVERSE_INT 0x000000ff
+#define G_MASK_32_REVERSE_INT 0x0000ff00
+#define B_MASK_32_REVERSE_INT 0x00ff0000
+
+#define R_MASK_24_INT 0xff0000
+#define G_MASK_24_INT 0x00ff00
+#define B_MASK_24_INT 0x0000ff
+
+#define R_MASK_24_REVERSE_INT 0x0000ff
+#define G_MASK_24_REVERSE_INT 0x00ff00
+#define B_MASK_24_REVERSE_INT 0xff0000
+
+#define R_MASK_16_INT 0xf800
+#define G_MASK_16_INT 0x07e0
+#define B_MASK_16_INT 0x001f
+
+#define R_MASK_15_INT 0x7c00
+#define G_MASK_15_INT 0x03e0
+#define B_MASK_15_INT 0x001f
+
+#define SIZE_RANGE "(int) [ 16, 4096 ]"
+#define FPS_RANGE "(double) [ 0, max ]"
/* properties for pad templates */
-#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32 \
- gst_props_new ( \
- "bpp", GST_PROPS_LIST ( \
- GST_PROPS_INT (24), \
- GST_PROPS_INT (32) \
- ), \
- "depth", GST_PROPS_LIST ( \
- GST_PROPS_INT (24), \
- GST_PROPS_INT (32) \
- ), \
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \
- "red_mask", GST_PROPS_LIST ( \
- GST_PROPS_INT (R_MASK_32), \
- GST_PROPS_INT (R_MASK_24) \
- ), \
- "green_mask", GST_PROPS_LIST ( \
- GST_PROPS_INT (G_MASK_32), \
- GST_PROPS_INT (G_MASK_24) \
- ), \
- "blue_mask", GST_PROPS_LIST ( \
- GST_PROPS_INT (B_MASK_32), \
- GST_PROPS_INT (B_MASK_24) \
- ), \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
-
-#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32_REVERSE \
- gst_props_new ( \
- "bpp", GST_PROPS_LIST ( \
- GST_PROPS_INT (24), \
- GST_PROPS_INT (32) \
- ), \
- "depth", GST_PROPS_LIST ( \
- GST_PROPS_INT (24), \
- GST_PROPS_INT (32) \
- ), \
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \
- "red_mask", GST_PROPS_LIST ( \
- GST_PROPS_INT (R_MASK_32_REVERSE), \
- GST_PROPS_INT (R_MASK_24_REVERSE) \
- ), \
- "green_mask", GST_PROPS_LIST ( \
- GST_PROPS_INT (G_MASK_32_REVERSE), \
- GST_PROPS_INT (G_MASK_24_REVERSE) \
- ), \
- "blue_mask", GST_PROPS_LIST ( \
- GST_PROPS_INT (B_MASK_32_REVERSE), \
- GST_PROPS_INT (B_MASK_24_REVERSE) \
- ), \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
-
-#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32 \
- gst_props_new ( \
- "bpp", GST_PROPS_INT (32), \
- "depth", GST_PROPS_INT (32), \
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \
- "red_mask", GST_PROPS_INT (R_MASK_32), \
- "green_mask", GST_PROPS_INT (G_MASK_32), \
- "blue_mask", GST_PROPS_INT (B_MASK_32), \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
-
-#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24 \
- gst_props_new ( \
- "bpp", GST_PROPS_INT (24), \
- "depth", GST_PROPS_INT (24), \
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \
- "red_mask", GST_PROPS_INT (R_MASK_24), \
- "green_mask", GST_PROPS_INT (G_MASK_24), \
- "blue_mask", GST_PROPS_INT (B_MASK_24), \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
-
-#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32_REVERSE \
- gst_props_new ( \
- "bpp", GST_PROPS_INT (32), \
- "depth", GST_PROPS_INT (32), \
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \
- "red_mask", GST_PROPS_INT (R_MASK_32_REVERSE), \
- "green_mask", GST_PROPS_INT (G_MASK_32_REVERSE), \
- "blue_mask", GST_PROPS_INT (B_MASK_32_REVERSE), \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
-
-#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_REVERSE \
- gst_props_new ( \
- "bpp", GST_PROPS_INT (24), \
- "depth", GST_PROPS_INT (24), \
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \
- "red_mask", GST_PROPS_INT (R_MASK_24_REVERSE), \
- "green_mask", GST_PROPS_INT (G_MASK_24_REVERSE), \
- "blue_mask", GST_PROPS_INT (B_MASK_24_REVERSE), \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
-
-#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15_16 \
- gst_props_new ( \
- "bpp", GST_PROPS_INT (16), \
- "depth", GST_PROPS_LIST ( \
- GST_PROPS_INT (15), \
- GST_PROPS_INT (16) \
- ), \
- "endianness", GST_PROPS_INT (G_BYTE_ORDER), \
- "red_mask", GST_PROPS_LIST ( \
- GST_PROPS_INT (R_MASK_15), \
- GST_PROPS_INT (R_MASK_16) \
- ), \
- "green_mask", GST_PROPS_LIST ( \
- GST_PROPS_INT (G_MASK_15), \
- GST_PROPS_INT (G_MASK_16) \
- ), \
- "blue_mask", GST_PROPS_LIST ( \
- GST_PROPS_INT (B_MASK_15), \
- GST_PROPS_INT (B_MASK_16) \
- ), \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
-
-#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_16 \
- gst_props_new ( \
- "bpp", GST_PROPS_INT (16), \
- "depth", GST_PROPS_INT (16), \
- "endianness", GST_PROPS_INT (G_BYTE_ORDER), \
- "red_mask", GST_PROPS_INT (R_MASK_16), \
- "green_mask", GST_PROPS_INT (G_MASK_16), \
- "blue_mask", GST_PROPS_INT (B_MASK_16), \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
-
-#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15 \
- gst_props_new ( \
- "bpp", GST_PROPS_INT (15), \
- "depth", GST_PROPS_INT (15), \
- "endianness", GST_PROPS_INT (G_BYTE_ORDER), \
- "red_mask", GST_PROPS_INT (R_MASK_15), \
- "green_mask", GST_PROPS_INT (G_MASK_15), \
- "blue_mask", GST_PROPS_INT (B_MASK_15), \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
-
-#define GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(fourcc) \
- gst_props_new (\
- "format", fourcc, \
- "width", SIZE_RANGE, \
- "height", SIZE_RANGE, \
- "framerate", FPS_RANGE, \
- NULL)
+#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_32 \
+ "video/x-raw-rgb, " \
+ "bpp = (int) { 24, 32 }, " \
+ "depth = (int) { 24, 32 }, " \
+ "endianness = (int) BIG_ENDIAN, " \
+ "red_mask = (int) { " R_MASK_32 ", " R_MASK_24 " }, " \
+ "green_mask = (int) { " G_MASK_32 ", " G_MASK_24 " }, " \
+ "blue_mask = (int) { " B_MASK_32 ", " B_MASK_24 " }, " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
+
+#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_32_REVERSE \
+ "video/x-raw-rgb, " \
+ "bpp = (int) { 24, 32 }, " \
+ "depth = (int) { 24, 32 }, " \
+ "endianness = (int) BIG_ENDIAN, " \
+ "red_mask = (int) { " R_MASK_32_REVERSE ", " R_MASK_24_REVERSE "}, " \
+ "green_mask = (int) { " G_MASK_32_REVERSE ", " G_MASK_24_REVERSE "}, " \
+ "blue_mask = (int) { " B_MASK_32_REVERSE ", " B_MASK_24_REVERSE "}, " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
+
+#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 \
+ "video/x-raw-rgb, " \
+ "bpp = (int) 32, " \
+ "depth = (int) 32, " \
+ "endianness = (int) BIG_ENDIAN, " \
+ "red_mask = (int) " R_MASK_32 ", " \
+ "green_mask = (int) " G_MASK_32 ", " \
+ "blue_mask = (int) " B_MASK_32 ", " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
+
+#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24 \
+ "video/x-raw-rgb, " \
+ "bpp = (int) 24, " \
+ "depth = (int) 24, " \
+ "endianness = (int) BIG_ENDIAN, " \
+ "red_mask = (int) " R_MASK_24 ", " \
+ "green_mask = (int) " G_MASK_24 ", " \
+ "blue_mask = (int) " B_MASK_24 ", " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
+
+#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32_REVERSE \
+ "video/x-raw-rgb, " \
+ "bpp = (int) 32, " \
+ "depth = (int) 32, " \
+ "endianness = (int) BIG_ENDIAN, " \
+ "red_mask = (int) " R_MASK_32_REVERSE ", " \
+ "green_mask = (int) " G_MASK_32_REVERSE ", " \
+ "blue_mask = (int) " B_MASK_32_REVERSE ", " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
+
+#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_REVERSE \
+ "video/x-raw-rgb, " \
+ "bpp = (int) 24, " \
+ "depth = (int) 24, " \
+ "endianness = (int) BIG_ENDIAN, " \
+ "red_mask = (int) " R_MASK_24_REVERSE ", " \
+ "green_mask = (int) " G_MASK_24_REVERSE ", " \
+ "blue_mask = (int) " B_MASK_24_REVERSE ", " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
+
+#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_15_16 \
+ "video/x-raw-rgb, " \
+ "bpp = (int) 16, " \
+ "depth = (int) { 15, 16 }, " \
+ "endianness = (int) BYTE_ORDER, " \
+ "red_mask = (int) { " R_MASK_15 ", " R_MASK_16 " }, " \
+ "green_mask = (int) { " G_MASK_15 ", " G_MASK_16 " }, " \
+ "blue_mask = (int) { " B_MASK_15 ", " B_MASK_16 " }, " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
+
+#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_16 \
+ "video/x-raw-rgb, " \
+ "bpp = (int) 16, " \
+ "depth = (int) 16, " \
+ "endianness = (int) BYTE_ORDER, " \
+ "red_mask = (int) " R_MASK_16 ", " \
+ "green_mask = (int) " G_MASK_16 ", " \
+ "blue_mask = (int) " B_MASK_16 ", " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
+
+#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_15 \
+ "video/x-raw-rgb, " \
+ "bpp = (int) 16, " \
+ "depth = (int) 15, " \
+ "endianness = (int) BYTE_ORDER, " \
+ "red_mask = (int) " R_MASK_15 ", " \
+ "green_mask = (int) " G_MASK_15 ", " \
+ "blue_mask = (int) " B_MASK_15 ", " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
+
+#define GST_VIDEO_YUV_PAD_TEMPLATE_CAPS(fourcc) \
+ "video/x-raw-yuv, " \
+ "format = (fourcc) " fourcc ", " \
+ "width = " SIZE_RANGE ", " \
+ "height = " SIZE_RANGE ", " \
+ "framerate = " FPS_RANGE
/* functions */
-gfloat gst_video_frame_rate (GstPad *pad);
+gdouble gst_video_frame_rate (GstPad *pad);
gboolean gst_video_get_size (GstPad *pad,
gint *width,
gint *height);