summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2003-12-22 01:47:09 +0000
committerDavid Schleef <ds@schleef.org>2003-12-22 01:47:09 +0000
commitce51f6173ca1c37d90f8e2e316d90316583d7755 (patch)
tree270b121765a11455f5bf8166b526d7ac336dc56c /gst
parentf43f0a9fd781bafab689e46bd936af9cb5ed2690 (diff)
Merge CAPS branch
Original commit message from CVS: Merge CAPS branch
Diffstat (limited to 'gst')
-rw-r--r--gst/audiofx/audiowsincband.c21
-rw-r--r--gst/audiofx/audiowsinclimit.c21
-rw-r--r--gst/auparse/gstauparse.c78
-rw-r--r--gst/avi/gstavidemux.c32
-rw-r--r--gst/avi/gstavimux.c460
-rw-r--r--gst/cutter/gstcutter.c51
-rw-r--r--gst/debug/efence.c40
-rw-r--r--gst/effectv/gstaging.c24
-rw-r--r--gst/effectv/gstdice.c24
-rw-r--r--gst/effectv/gstedge.c24
-rw-r--r--gst/effectv/gsteffectv.c52
-rw-r--r--gst/effectv/gsteffectv.h4
-rw-r--r--gst/effectv/gstquark.c24
-rw-r--r--gst/effectv/gstrev.c24
-rw-r--r--gst/effectv/gstshagadelic.c24
-rw-r--r--gst/effectv/gstvertigo.c24
-rw-r--r--gst/effectv/gstwarp.c25
-rw-r--r--gst/flx/gstflxdec.c58
-rw-r--r--gst/goom/gstgoom.c114
-rw-r--r--gst/law/alaw-decode.c34
-rw-r--r--gst/law/alaw-encode.c33
-rw-r--r--gst/law/alaw.c40
-rw-r--r--gst/law/mulaw-decode.c37
-rw-r--r--gst/law/mulaw-encode.c33
-rw-r--r--gst/law/mulaw.c43
-rw-r--r--gst/level/gstlevel.c71
-rw-r--r--gst/matroska/matroska-demux.c471
-rw-r--r--gst/matroska/matroska-demux.h4
-rw-r--r--gst/matroska/matroska-mux.c487
-rw-r--r--gst/matroska/matroska-mux.h2
-rw-r--r--gst/median/gstmedian.c46
-rw-r--r--gst/monoscope/gstmonoscope.c105
-rw-r--r--gst/qtdemux/qtdemux.c332
-rw-r--r--gst/rtp/gstrtpL16depay.c68
-rw-r--r--gst/rtp/gstrtpL16enc.c65
-rw-r--r--gst/rtp/gstrtpL16parse.c68
-rw-r--r--gst/rtp/gstrtpL16pay.c65
-rw-r--r--gst/rtp/gstrtpgsmdepay.c51
-rw-r--r--gst/rtp/gstrtpgsmenc.c59
-rw-r--r--gst/rtp/gstrtpgsmparse.c51
-rw-r--r--gst/rtp/gstrtpgsmpay.c59
-rw-r--r--gst/smpte/gstsmpte.c83
-rw-r--r--gst/smpte/gstsmpte.h2
-rw-r--r--gst/udp/gstudpsink.c4
-rw-r--r--gst/videocrop/gstvideocrop.c71
-rw-r--r--gst/videofilter/gstvideofilter.c226
-rw-r--r--gst/videofilter/gstvideofilter.h4
-rw-r--r--gst/videoflip/gstvideoflip.c166
-rw-r--r--gst/videoflip/videoflip.c36
-rw-r--r--gst/videoflip/videoflip.h4
-rw-r--r--gst/wavenc/gstwavenc.c86
-rw-r--r--gst/wavenc/gstwavenc.h3
-rw-r--r--gst/wavparse/gstwavparse.c162
-rw-r--r--gst/wavparse/gstwavparse.h2
54 files changed, 1859 insertions, 2338 deletions
diff --git a/gst/audiofx/audiowsincband.c b/gst/audiofx/audiowsincband.c
index c7144621..77529053 100644
--- a/gst/audiofx/audiowsincband.c
+++ b/gst/audiofx/audiowsincband.c
@@ -105,7 +105,7 @@ static void gst_bpwsinc_get_property (GObject * object, guint prop_id,
static void gst_bpwsinc_chain (GstPad * pad, GstData *_data);
static GstPadLinkReturn
- gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps);
+ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_bpwsinc_signals[LAST_SIGNAL] = { 0 }; */
@@ -136,8 +136,10 @@ gst_bpwsinc_base_init (gpointer g_class)
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
/* register src pads */
- gst_element_class_add_pad_template (element_class, gst_filter_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_filter_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_filter_sink_template));
gst_element_class_set_details (element_class, &gst_bpwsinc_details);
}
@@ -176,12 +178,14 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass)
static void
gst_bpwsinc_init (GstBPWSinc * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_filter_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_filter_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_bpwsinc_chain);
gst_pad_set_link_function (filter->sinkpad, gst_bpwsinc_sink_connect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_filter_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_filter_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->wing_size = 50;
@@ -191,7 +195,7 @@ gst_bpwsinc_init (GstBPWSinc * filter)
}
static GstPadLinkReturn
-gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
+gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
{
int i = 0;
double sum = 0.0;
@@ -204,10 +208,7 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
g_assert (GST_IS_PAD (pad));
g_assert (caps != NULL);
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- set_retval = gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ set_retval = gst_pad_try_set_caps (filter->srcpad, caps);
if (set_retval > 0)
{
diff --git a/gst/audiofx/audiowsinclimit.c b/gst/audiofx/audiowsinclimit.c
index aaa7463e..603d8775 100644
--- a/gst/audiofx/audiowsinclimit.c
+++ b/gst/audiofx/audiowsinclimit.c
@@ -102,7 +102,7 @@ static void gst_lpwsinc_get_property (GObject * object, guint prop_id,
static void gst_lpwsinc_chain (GstPad * pad, GstData *_data);
static GstPadLinkReturn
- gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps);
+ gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_lpwsinc_signals[LAST_SIGNAL] = { 0 }; */
@@ -133,8 +133,10 @@ gst_lpwsinc_base_init (gpointer g_class)
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
/* register src pads */
- gst_element_class_add_pad_template (element_class, gst_filter_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_filter_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_filter_sink_template));
gst_element_class_set_details (element_class, &gst_lpwsinc_details);
}
@@ -168,12 +170,14 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass)
static void
gst_lpwsinc_init (GstLPWSinc * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_filter_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_filter_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_lpwsinc_chain);
gst_pad_set_link_function (filter->sinkpad, gst_lpwsinc_sink_connect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_filter_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_filter_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->wing_size = 50;
@@ -182,7 +186,7 @@ gst_lpwsinc_init (GstLPWSinc * filter)
}
static GstPadLinkReturn
-gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
+gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
{
int i = 0;
double sum = 0.0;
@@ -193,10 +197,7 @@ gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
g_assert (GST_IS_PAD (pad));
g_assert (caps != NULL);
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- set_retval = gst_pad_try_set_caps(filter->srcpad, gst_caps_ref (caps));
+ set_retval = gst_pad_try_set_caps(filter->srcpad, caps);
if (set_retval > 0)
{
diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c
index 91ef0c35..d4f50644 100644
--- a/gst/auparse/gstauparse.c
+++ b/gst/auparse/gstauparse.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <gstauparse.h>
+#include <gst/audio/audio.h>
/* elementfactory information */
static GstElementDetails gst_auparse_details = GST_ELEMENT_DETAILS (
@@ -37,47 +38,26 @@ static GstElementDetails gst_auparse_details = GST_ELEMENT_DETAILS (
"Erik Walthinsen <omega@cse.ogi.edu>"
);
-GST_PAD_TEMPLATE_FACTORY (sink_factory_templ,
+static GstStaticPadTemplate gst_auparse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "auparse_sink",
- "audio/x-au",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "audio/x-au" )
+);
-GST_PAD_TEMPLATE_FACTORY (src_factory_templ,
+static GstStaticPadTemplate gst_auparse_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "auparse_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "signed", GST_PROPS_LIST(
- GST_PROPS_BOOLEAN (FALSE),
- GST_PROPS_BOOLEAN (TRUE)
- ),
- "width", GST_PROPS_LIST(
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST(
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000,48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- ),
- GST_CAPS_NEW (
- "auparse_src_alaw",
- "audio/x-alaw",
- "rate", GST_PROPS_INT_RANGE (8000,48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS (
+ GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ "audio/x-alaw, "
+ "rate = (int) [ 8000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
)
-)
+);
/* AuParse signals and args */
enum {
@@ -127,9 +107,9 @@ gst_auparse_base_init (gpointer g_class)
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory_templ));
+ gst_static_pad_template_get (&gst_auparse_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory_templ));
+ gst_static_pad_template_get (&gst_auparse_src_template));
gst_element_class_set_details (element_class, &gst_auparse_details);
}
@@ -148,12 +128,12 @@ static void
gst_auparse_init (GstAuParse *auparse)
{
auparse->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory_templ), "sink");
+ gst_static_pad_template_get (&gst_auparse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (auparse), auparse->sinkpad);
gst_pad_set_chain_function (auparse->sinkpad, gst_auparse_chain);
auparse->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_factory_templ), "src");
+ gst_static_pad_template_get (&gst_auparse_src_template), "src");
gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
auparse->offset = 0;
@@ -170,7 +150,7 @@ gst_auparse_chain (GstPad *pad, GstData *_data)
GstAuParse *auparse;
gchar *data;
glong size;
- GstCaps* tempcaps;
+ GstCaps *tempcaps;
gint law, depth;
gboolean sign;
@@ -258,19 +238,17 @@ gst_auparse_chain (GstPad *pad, GstData *_data)
}
if (law) {
- tempcaps = GST_CAPS_NEW ("auparse_src",
- "audio/x-alaw",
- "rate", GST_PROPS_INT (auparse->frequency),
- "channels", GST_PROPS_INT (auparse->channels));
+ tempcaps = gst_caps_new_simple ("audio/x-alaw",
+ "rate", G_TYPE_INT, auparse->frequency,
+ "channels", G_TYPE_INT, auparse->channels, NULL);
} else {
- tempcaps = GST_CAPS_NEW ("auparse_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "rate", GST_PROPS_INT (auparse->frequency),
- "channels", GST_PROPS_INT (auparse->channels),
- "depth", GST_PROPS_INT (depth),
- "width", GST_PROPS_INT (depth),
- "signed", GST_PROPS_BOOLEAN (sign));
+ tempcaps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BIG_ENDIAN,
+ "rate", G_TYPE_INT, auparse->frequency,
+ "channels", G_TYPE_INT, auparse->channels,
+ "depth", G_TYPE_INT, depth,
+ "width", G_TYPE_INT, depth,
+ "signed", G_TYPE_BOOLEAN, sign, NULL);
}
if (gst_pad_try_set_caps (auparse->srcpad, tempcaps) <= 0) {
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c
index 5f19fce5..04c5c8c9 100644
--- a/gst/avi/gstavidemux.c
+++ b/gst/avi/gstavidemux.c
@@ -42,15 +42,12 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (sink_templ,
+static GstStaticPadTemplate sink_templ =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "avidemux_sink",
- "video/x-msvideo",
- NULL
- )
+ GST_STATIC_CAPS ("video/x-msvideo")
);
static void gst_avi_demux_base_init (GstAviDemuxClass *klass);
@@ -138,20 +135,19 @@ gst_avi_demux_base_init (GstAviDemuxClass *klass)
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- audcaps, NULL);
+ audcaps);
- vidcaps = gst_caps_append (
- gst_riff_create_video_template_caps (),
- gst_riff_create_iavs_template_caps ());
+ vidcaps = gst_riff_create_video_template_caps ();
+ gst_caps_append (vidcaps, gst_riff_create_iavs_template_caps ());
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- vidcaps, NULL);
+ vidcaps);
gst_element_class_add_pad_template (element_class, audiosrctempl);
gst_element_class_add_pad_template (element_class, videosrctempl);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_templ));
+ gst_static_pad_template_get (&sink_templ));
gst_element_class_set_details (element_class, &gst_avi_demux_details);
}
@@ -185,7 +181,7 @@ gst_avi_demux_init (GstAviDemux *avi)
GST_FLAG_SET (avi, GST_ELEMENT_EVENT_AWARE);
avi->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_templ), "sink");
+ gst_static_pad_template_get (&sink_templ), "sink");
gst_element_add_pad (GST_ELEMENT (avi), avi->sinkpad);
GST_RIFF_READ (avi)->sinkpad = avi->sinkpad;
@@ -232,16 +228,10 @@ gst_avi_demux_reset (GstAviDemux *avi)
static void
gst_avi_demux_streaminfo (GstAviDemux *avi)
{
- GstProps *props;
-
- props = gst_props_empty_new ();
-
/* compression formats are added later - a bit hacky */
- gst_caps_replace_sink (&avi->streaminfo,
- gst_caps_new ("avi_streaminfo",
- "application/x-gst-streaminfo",
- props));
+ gst_caps_replace (&avi->streaminfo,
+ gst_caps_new_simple ("application/x-gst-streaminfo", NULL));
/*g_object_notify(G_OBJECT(avi), "streaminfo");*/
}
diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c
index 451871fa..d67a8627 100644
--- a/gst/avi/gstavimux.c
+++ b/gst/avi/gstavimux.c
@@ -54,139 +54,85 @@ enum {
ARG_BIGFILE,
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
+static GstStaticPadTemplate src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "avimux_src_video",
- "video/x-msvideo",
- NULL
- )
-)
+ GST_STATIC_CAPS ("video/x-msvideo")
+);
-GST_PAD_TEMPLATE_FACTORY (video_sink_factory,
+static GstStaticPadTemplate video_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"video_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW (
- "avimux_sink_video_yuv",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC('Y','U','Y','2')),
- GST_PROPS_FOURCC (GST_MAKE_FOURCC('I','4','2','0'))
- ),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_jpeg",
- "video/x-jpeg",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_divx",
- "video/x-divx",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "divxversion", GST_PROPS_INT_RANGE (3, 5)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_xvid",
- "video/x-xvid",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_3ivx",
- "video/x-3ivx",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_msmpeg",
- "video/x-msmpeg",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "msmpegversion", GST_PROPS_INT_RANGE (41, 43)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_mpeg",
- "video/mpeg",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "mpegversion", GST_PROPS_INT (1),
- "systemstream", GST_PROPS_BOOLEAN (FALSE)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_h263",
- "video/x-h263",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_dv",
- "video/x-dv",
- "width", GST_PROPS_INT (720),
- "height", GST_PROPS_LIST (
- GST_PROPS_INT (576),
- GST_PROPS_INT (480)
- ),
- "systemstream", GST_PROPS_BOOLEAN (FALSE)
- ),
- GST_CAPS_NEW (
- "avimux_sink_video_hfyu",
- "video/x-huffyuv",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096)
+ GST_STATIC_CAPS (
+ "video/x-raw-yuv, "
+ "format = (fourcc) { YUY2, I420 }, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-jpeg, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-divx, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "divxversion = (int) [ 3, 5 ]; "
+ "video/x-xvid, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-3ivx, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-msmpeg, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "msmpegversion = (int) [ 41, 43 ]; "
+ "video/mpeg, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "mpegversion = (int) 1, "
+ "systemstream = (boolean) FALSE; "
+ "video/x-h263, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]; "
+ "video/x-dv, "
+ "width = (int) 720, "
+ "height = (int) { 576, 480 }, "
+ "systemstream = (boolean) FALSE; "
+ "video/x-huffyuv, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ]"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (audio_sink_factory,
+static GstStaticPadTemplate audio_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"audio_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW (
- "avimux_sink_audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (1000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- ),
- GST_CAPS_NEW (
- "avimux_sink_audio_mpeg",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT_RANGE (1, 3),
- "rate", GST_PROPS_INT_RANGE (1000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- ),
- GST_CAPS_NEW (
- "avimux_sink_audio_vorbis",
- "audio/x-vorbis",
- "rate", GST_PROPS_INT_RANGE (1000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- ),
- GST_CAPS_NEW (
- "avimux_sink_audio_ac3",
- "audio/x-ac3",
- "rate", GST_PROPS_INT_RANGE (1000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 6)
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/mpeg, "
+ "mpegversion = (int) 1, "
+ "layer = (int) [ 1, 3 ], "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-vorbis, "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]; "
+ "audio/x-ac3, "
+ "rate = (int) [ 1000, 96000 ], "
+ "channels = (int) [ 1, 2 ]"
)
-)
+);
static void gst_avimux_base_init (gpointer g_class);
@@ -246,11 +192,11 @@ gst_avimux_base_init (gpointer g_class)
);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (audio_sink_factory));
+ gst_static_pad_template_get (&audio_sink_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (video_sink_factory));
+ gst_static_pad_template_get (&video_sink_factory));
gst_element_class_set_details (element_class, &gst_avimux_details);
}
@@ -334,113 +280,101 @@ gst_avimux_init (GstAviMux *avimux)
}
static GstPadLinkReturn
-gst_avimux_vidsinkconnect (GstPad *pad, GstCaps *vscaps)
+gst_avimux_vidsinkconnect (GstPad *pad, const GstCaps *vscaps)
{
GstAviMux *avimux;
- GstCaps *caps;
+ GstStructure *structure;
+ const gchar* mimetype;
+ gdouble fps = 0.;
+ gboolean ret;
avimux = GST_AVIMUX (gst_pad_get_parent (pad));
- /* we are not going to act on variable caps */
- if (!GST_CAPS_IS_FIXED (vscaps))
- return GST_PAD_LINK_DELAYED;
-
GST_DEBUG ("avimux: video sinkconnect triggered on %s",
gst_pad_get_name (pad));
- for (caps = vscaps; caps != NULL; caps = vscaps = vscaps->next)
- {
- const gchar* mimetype = gst_caps_get_mime(caps);
- gfloat fps = 0.;
-
- /* global */
- avimux->vids.size = sizeof(gst_riff_strf_vids);
- avimux->vids.planes = 1;
- gst_caps_get (caps, "width", &avimux->vids.width,
- "height", &avimux->vids.height,
- "framerate", &fps,
- NULL);
- if (fps != 0.)
- avimux->vids_hdr.scale = avimux->vids_hdr.rate / fps;
-
- if (!strcmp (mimetype, "video/x-raw-yuv"))
- {
- guint32 format;
-
- gst_caps_get_fourcc_int (caps, "format", &format);
- avimux->vids.compression = format;
- switch (format)
- {
- case GST_MAKE_FOURCC('Y','U','Y','2'):
- avimux->vids.bit_cnt = 16;
- break;
- case GST_MAKE_FOURCC('I','4','2','0'):
- avimux->vids.bit_cnt = 12;
- break;
- }
+ structure = gst_caps_get_structure (vscaps, 0);
+ mimetype = gst_structure_get_name (structure);
- goto done;
- }
- else
+ /* global */
+ avimux->vids.size = sizeof(gst_riff_strf_vids);
+ avimux->vids.planes = 1;
+ ret = gst_structure_get_int (structure, "width", &avimux->vids.width);
+ ret &= gst_structure_get_int (structure, "height", &avimux->vids.height);
+ ret &= gst_structure_get_double (structure, "framerate", &fps);
+ if (!ret) return GST_PAD_LINK_REFUSED;
+
+ if (fps != 0.)
+ avimux->vids_hdr.scale = avimux->vids_hdr.rate / fps;
+
+ if (!strcmp (mimetype, "video/x-raw-yuv")) {
+ guint32 format;
+
+ gst_structure_get_fourcc (structure, "format", &format);
+ avimux->vids.compression = format;
+ switch (format)
{
- avimux->vids.bit_cnt = 24;
- avimux->vids.compression = 0;
-
- /* find format */
- if (!strcmp (mimetype, "video/x-huffyuv")) {
- avimux->vids.compression = GST_MAKE_FOURCC('H','F','Y','U');
- } else if (!strcmp (mimetype, "video/x-jpeg")) {
- avimux->vids.compression = GST_MAKE_FOURCC('M','J','P','G');
- } else if (!strcmp (mimetype, "video/x-divx")) {
- gint divxversion;
- gst_caps_get_int (caps, "divxversion", &divxversion);
- switch (divxversion) {
- case 3:
- avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','3');
- break;
- case 4:
- avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','X');
- break;
- case 5:
- avimux->vids.compression = GST_MAKE_FOURCC('D','X','5','0');
- break;
- }
- } else if (!strcmp (mimetype, "video/x-xvid")) {
- avimux->vids.compression = GST_MAKE_FOURCC('X','V','I','D');
- } else if (!strcmp (mimetype, "video/x-3ivx")) {
- avimux->vids.compression = GST_MAKE_FOURCC('3','I','V','2');
- } else if (!strcmp (mimetype, "video/x-msmpeg")) {
- gint msmpegversion;
- gst_caps_get_int (caps, "msmpegversion", &msmpegversion);
- switch (msmpegversion) {
- case 41:
- avimux->vids.compression = GST_MAKE_FOURCC('M','P','G','4');
- break;
- case 42:
- avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','2');
- break;
- case 43:
- avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','3');
+ case GST_MAKE_FOURCC('Y','U','Y','2'):
+ avimux->vids.bit_cnt = 16;
+ break;
+ case GST_MAKE_FOURCC('I','4','2','0'):
+ avimux->vids.bit_cnt = 12;
+ break;
+ }
+ } else {
+ avimux->vids.bit_cnt = 24;
+ avimux->vids.compression = 0;
+
+ /* find format */
+ if (!strcmp (mimetype, "video/x-huffyuv")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('H','F','Y','U');
+ } else if (!strcmp (mimetype, "video/x-jpeg")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('M','J','P','G');
+ } else if (!strcmp (mimetype, "video/x-divx")) {
+ gint divxversion;
+ gst_structure_get_int (structure, "divxversion", &divxversion);
+ switch (divxversion) {
+ case 3:
+ avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','3');
+ break;
+ case 4:
+ avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','X');
+ break;
+ case 5:
+ avimux->vids.compression = GST_MAKE_FOURCC('D','X','5','0');
break;
- }
- } else if (!strcmp (mimetype, "video/x-dv")) {
- avimux->vids.compression = GST_MAKE_FOURCC('D','V','S','D');
- } else if (!strcmp (mimetype, "video/x-h263")) {
- avimux->vids.compression = GST_MAKE_FOURCC('H','2','6','3');
- } else if (!strcmp (mimetype, "video/mpeg")) {
- avimux->vids.compression = GST_MAKE_FOURCC('M','P','E','G');
}
-
- if (!avimux->vids.compression) {
- continue;
+ } else if (!strcmp (mimetype, "video/x-xvid")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('X','V','I','D');
+ } else if (!strcmp (mimetype, "video/x-3ivx")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('3','I','V','2');
+ } else if (!strcmp (mimetype, "video/x-msmpeg")) {
+ gint msmpegversion;
+ gst_structure_get_int (structure, "msmpegversion", &msmpegversion);
+ switch (msmpegversion) {
+ case 41:
+ avimux->vids.compression = GST_MAKE_FOURCC('M','P','G','4');
+ break;
+ case 42:
+ avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','2');
+ break;
+ case 43:
+ avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','3');
+ break;
}
+ } else if (!strcmp (mimetype, "video/x-dv")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('D','V','S','D');
+ } else if (!strcmp (mimetype, "video/x-h263")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('H','2','6','3');
+ } else if (!strcmp (mimetype, "video/mpeg")) {
+ avimux->vids.compression = GST_MAKE_FOURCC('M','P','E','G');
+ }
- goto done;
+ if (!avimux->vids.compression) {
+ return GST_PAD_LINK_DELAYED;
}
}
- return GST_PAD_LINK_REFUSED;
-done:
avimux->vids_hdr.fcc_handler = avimux->vids.compression;
avimux->vids.image_size = avimux->vids.height * avimux->vids.width;
avimux->avi_hdr.width = avimux->vids.width;
@@ -450,80 +384,70 @@ done:
}
static GstPadLinkReturn
-gst_avimux_audsinkconnect (GstPad *pad, GstCaps *vscaps)
+gst_avimux_audsinkconnect (GstPad *pad, const GstCaps *vscaps)
{
GstAviMux *avimux;
- GstCaps *caps;
+ GstStructure *structure;
+ const gchar* mimetype;
+ int i;
avimux = GST_AVIMUX (gst_pad_get_parent (pad));
- /* we are not going to act on variable caps */
- if (!GST_CAPS_IS_FIXED (vscaps))
- return GST_PAD_LINK_DELAYED;
-
GST_DEBUG ("avimux: audio sinkconnect triggered on %s",
gst_pad_get_name (pad));
- for (caps = vscaps; caps != NULL; caps = vscaps = vscaps->next)
- {
- const gchar* mimetype = gst_caps_get_mime(caps);
+ structure = gst_caps_get_structure (vscaps, 0);
+ mimetype = gst_structure_get_name (structure);
- /* we want these for all */
- gst_caps_get (caps, "channels", &avimux->auds.channels,
- "rate", &avimux->auds.rate,
- NULL);
+ /* we want these for all */
+ gst_structure_get_int (structure, "channels", &i);
+ avimux->auds.channels = i;
+ gst_structure_get_int (structure, "rate", &i);
+ avimux->auds.rate = i;
- if (!strcmp (mimetype, "audio/x-raw-int"))
- {
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_PCM;
+ if (!strcmp (mimetype, "audio/x-raw-int")) {
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_PCM;
- gst_caps_get (caps, "width", &avimux->auds.blockalign,
- "depth", &avimux->auds.size,
- NULL);
+ gst_structure_get_int (structure, "width", &i);
+ avimux->auds.blockalign = i;
+ gst_structure_get_int (structure, "depth", &i);
+ avimux->auds.size = i;
- /* set some more info straight */
- avimux->auds.blockalign /= 8;
- avimux->auds.blockalign *= avimux->auds.channels;
- avimux->auds.av_bps = avimux->auds.blockalign * avimux->auds.rate;
- goto done;
- }
- else if (!strcmp (mimetype, "audio/mpeg") ||
+ /* set some more info straight */
+ avimux->auds.blockalign /= 8;
+ avimux->auds.blockalign *= avimux->auds.channels;
+ avimux->auds.av_bps = avimux->auds.blockalign * avimux->auds.rate;
+ } else if (!strcmp (mimetype, "audio/mpeg") ||
!strcmp (mimetype, "audio/x-vorbis") ||
- !strcmp (mimetype, "audio/x-ac3"))
- {
- avimux->auds.format = 0;
-
- if (!strcmp (mimetype, "audio/mpeg")) {
- gint layer = 3;
- gst_caps_get_int(caps, "layer", &layer);
- switch (layer) {
- case 3:
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3;
- break;
- case 1: case 2:
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12;
- break;
- }
- } else if (!strcmp (mimetype, "audio/x-vorbis")) {
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS3;
- } else if (!strcmp (mimetype, "audio/x-ac3")) {
- avimux->auds.format = GST_RIFF_WAVE_FORMAT_A52;
+ !strcmp (mimetype, "audio/x-ac3")) {
+ avimux->auds.format = 0;
+
+ if (!strcmp (mimetype, "audio/mpeg")) {
+ gint layer = 3;
+ gst_structure_get_int (structure, "layer", &layer);
+ switch (layer) {
+ case 3:
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3;
+ break;
+ case 1: case 2:
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12;
+ break;
}
+ } else if (!strcmp (mimetype, "audio/x-vorbis")) {
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS3;
+ } else if (!strcmp (mimetype, "audio/x-ac3")) {
+ avimux->auds.format = GST_RIFF_WAVE_FORMAT_A52;
+ }
- avimux->auds.blockalign = 1;
- avimux->auds.av_bps = 0;
- avimux->auds.size = 16;
-
- if (!avimux->auds.format) {
- continue;
- }
+ avimux->auds.blockalign = 1;
+ avimux->auds.av_bps = 0;
+ avimux->auds.size = 16;
- goto done;
+ if (!avimux->auds.format) {
+ return GST_PAD_LINK_REFUSED;
}
}
- return GST_PAD_LINK_REFUSED;
-done:
avimux->auds_hdr.rate = avimux->auds.blockalign * avimux->auds.rate;
avimux->auds_hdr.samplesize = avimux->auds.blockalign;
avimux->auds_hdr.scale = avimux->auds.blockalign;
diff --git a/gst/cutter/gstcutter.c b/gst/cutter/gstcutter.c
index b4ac2bd5..83114939 100644
--- a/gst/cutter/gstcutter.c
+++ b/gst/cutter/gstcutter.c
@@ -51,35 +51,25 @@ enum {
ARG_LEAKY
};
-GST_PAD_TEMPLATE_FACTORY (cutter_src_factory,
+static GstStaticPadTemplate cutter_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "cutter_src_int",
- "audio/x-raw-int",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
- ),
- gst_caps_new (
- "cutter_src_float",
- "audio/x-raw-float",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
+ GST_STATIC_CAPS (
+ GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS
)
);
-GST_PAD_TEMPLATE_FACTORY (cutter_sink_factory,
+static GstStaticPadTemplate cutter_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "cutter_sink_int",
- "audio/x-raw-int",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
- ),
- gst_caps_new (
- "cutter_sink_float",
- "audio/x-raw-float",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
+ GST_STATIC_CAPS (
+ GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS
)
);
@@ -129,13 +119,13 @@ gst_cutter_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (cutter_src_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (cutter_sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&cutter_src_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&cutter_sink_factory));
gst_element_class_set_details (element_class, &cutter_details);
}
static GstPadLinkReturn
-gst_cutter_link (GstPad *pad, GstCaps *caps)
+gst_cutter_link (GstPad *pad, const GstCaps*caps)
{
GstCutter *filter;
GstPad *otherpad;
@@ -145,9 +135,7 @@ gst_cutter_link (GstPad *pad, GstCaps *caps)
g_return_val_if_fail (GST_IS_CUTTER (filter), GST_PAD_LINK_REFUSED);
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
- if (GST_CAPS_IS_FIXED (caps))
- return gst_pad_try_set_caps (otherpad, gst_caps_ref (caps));
- return GST_PAD_LINK_DELAYED;
+ return gst_pad_try_set_caps (otherpad, caps);
}
static void
@@ -200,8 +188,10 @@ gst_cutter_class_init (GstCutterClass *klass)
static void
gst_cutter_init (GstCutter *filter)
{
- filter->sinkpad = gst_pad_new_from_template (cutter_sink_factory (),"sink");
- filter->srcpad = gst_pad_new_from_template (cutter_src_factory (),"src");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&cutter_sink_factory),"sink");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&cutter_src_factory),"src");
filter->threshold_level = 0.1;
filter->threshold_length = 0.5;
@@ -461,13 +451,16 @@ void
gst_cutter_get_caps (GstPad *pad, GstCutter* filter)
{
GstCaps *caps = NULL;
+ GstStructure *structure;
caps = GST_PAD_CAPS (pad);
/* FIXME : Please change this to a better warning method ! */
g_assert (caps != NULL);
if (caps == NULL)
printf ("WARNING: get_caps: Could not get caps of pad !\n");
- gst_caps_get_int (caps, "width", &filter->width);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "width", &filter->width);
filter->max_sample = gst_audio_highest_sample_value (pad);
filter->have_caps = TRUE;
}
+
diff --git a/gst/debug/efence.c b/gst/debug/efence.c
index 2c4c9b92..d46218f8 100644
--- a/gst/debug/efence.c
+++ b/gst/debug/efence.c
@@ -56,18 +56,20 @@ enum {
ARG_FENCE_TOP
};
-GST_PAD_TEMPLATE_FACTORY (gst_efence_sink_factory,
+static GstStaticPadTemplate gst_efence_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_ANY
+ GST_STATIC_CAPS_ANY
);
-GST_PAD_TEMPLATE_FACTORY (gst_efence_src_factory,
+static GstStaticPadTemplate gst_efence_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_ANY
+ GST_STATIC_CAPS_ANY
);
static void gst_efence_base_init (gpointer g_class);
@@ -100,7 +102,7 @@ void *gst_fenced_buffer_alloc(GstBuffer *buffer, unsigned int length,
GstBuffer *gst_fenced_buffer_new(void);
static GstPadLinkReturn
-gst_efence_link (GstPad *pad, GstCaps *caps)
+gst_efence_link (GstPad *pad, const GstCaps *caps)
{
GstEFence *filter;
GstPad *otherpad;
@@ -111,19 +113,7 @@ gst_efence_link (GstPad *pad, GstCaps *caps)
GST_PAD_LINK_REFUSED);
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
- if (GST_CAPS_IS_FIXED (caps))
- {
- /* caps are not fixed, so try to link on the other side and see if
- * that works */
-
- if (!gst_pad_try_set_caps (otherpad, caps))
- return GST_PAD_LINK_REFUSED;
-
- /* caps on other side were accepted, so we're ok */
- return GST_PAD_LINK_OK;
- }
- /* not enough information yet, delay negotation */
- return GST_PAD_LINK_DELAYED;
+ return gst_pad_try_set_caps (otherpad, caps);
}
GType
@@ -157,8 +147,10 @@ gst_efence_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_efence_sink_factory ());
- gst_element_class_add_pad_template (element_class, gst_efence_src_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_efence_sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_efence_src_factory));
gst_element_class_set_details (element_class, &plugin_details);
}
@@ -190,11 +182,11 @@ gst_efence_class_init (GstEFenceClass *klass)
static void
gst_efence_init (GstEFence *filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_efence_sink_factory (),
- "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_efence_sink_factory), "sink");
gst_pad_set_link_function (filter->sinkpad, gst_efence_link);
- filter->srcpad = gst_pad_new_from_template (gst_efence_src_factory (),
- "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_efence_src_factory), "src");
gst_pad_set_link_function (filter->srcpad, gst_efence_link);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
diff --git a/gst/effectv/gstaging.c b/gst/effectv/gstaging.c
index be7723cc..294117df 100644
--- a/gst/effectv/gstaging.c
+++ b/gst/effectv/gstaging.c
@@ -142,8 +142,10 @@ gst_agingtv_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_agingtv_details);
}
@@ -164,34 +166,36 @@ gst_agingtv_class_init (GstAgingTVClass * klass)
}
static GstPadLinkReturn
-gst_agingtv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_agingtv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstAgingTV *filter;
+ GstStructure *structure;
filter = GST_AGINGTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
filter->video_size = filter->width * filter->height;
filter->aging_mode = 0;
aging_mode_switch (filter);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_agingtv_init (GstAgingTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_agingtv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_agingtv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
}
diff --git a/gst/effectv/gstdice.c b/gst/effectv/gstdice.c
index 4f58a8fb..c2c2de73 100644
--- a/gst/effectv/gstdice.c
+++ b/gst/effectv/gstdice.c
@@ -132,8 +132,10 @@ gst_dicetv_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_dicetv_details);
}
@@ -169,34 +171,36 @@ gst_dicetv_class_init (GstDiceTVClass * klass)
}
static GstPadLinkReturn
-gst_dicetv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_dicetv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstDiceTV *filter;
+ GstStructure *structure;
filter = GST_DICETV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
g_free (filter->dicemap);
filter->dicemap = (gchar *) g_malloc (filter->height * filter->width * sizeof(char));
gst_dicetv_create_map (filter);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_dicetv_init (GstDiceTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_dicetv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_dicetv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->dicemap = NULL;
diff --git a/gst/effectv/gstedge.c b/gst/effectv/gstedge.c
index 09d59251..200de671 100644
--- a/gst/effectv/gstedge.c
+++ b/gst/effectv/gstedge.c
@@ -121,8 +121,10 @@ gst_edgetv_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_edgetv_details);
}
@@ -143,17 +145,17 @@ gst_edgetv_class_init (GstEdgeTVClass * klass)
}
static GstPadLinkReturn
-gst_edgetv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_edgetv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstEdgeTV *filter;
+ GstStructure *structure;
filter = GST_EDGETV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
filter->map_width = filter->width / 4;
filter->map_height = filter->height / 4;
@@ -163,18 +165,20 @@ gst_edgetv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->map = (guint32 *)g_malloc (filter->map_width * filter->map_height * sizeof(guint32) * 2);
bzero(filter->map, filter->map_width * filter->map_height * sizeof(guint32) * 2);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_edgetv_init (GstEdgeTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_edgetv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_edgetv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->map = NULL;
diff --git a/gst/effectv/gsteffectv.c b/gst/effectv/gsteffectv.c
index 6ab3447f..2c90e223 100644
--- a/gst/effectv/gsteffectv.c
+++ b/gst/effectv/gsteffectv.c
@@ -49,43 +49,21 @@ static struct _elements_entry _elements[] = {
};
-GstPadTemplate*
-gst_effectv_src_factory (void)
-{
- static GstPadTemplate *templ = NULL;
- if (!templ) {
- templ = GST_PAD_TEMPLATE_NEW (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "effectv_src",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32
- )
- );
- }
- return templ;
-}
+GstStaticPadTemplate gst_effectv_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
-GstPadTemplate*
-gst_effectv_sink_factory (void)
-{
- static GstPadTemplate *templ = NULL;
- if (!templ) {
- templ = GST_PAD_TEMPLATE_NEW (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "effectv_sink",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32
- )
- );
- }
- return templ;
-}
+GstStaticPadTemplate gst_effectv_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
static gboolean
plugin_init (GstPlugin * plugin)
@@ -94,7 +72,7 @@ plugin_init (GstPlugin * plugin)
while (_elements[i].name) {
if (!gst_element_register (plugin, _elements[i].name,
- GST_RANK_NONE, (_elements[i].type) ()))
+ GST_RANK_NONE, (_elements[i].type) ()))
return FALSE;
i++;
}
diff --git a/gst/effectv/gsteffectv.h b/gst/effectv/gsteffectv.h
index ef4bf713..4cf7f3e3 100644
--- a/gst/effectv/gsteffectv.h
+++ b/gst/effectv/gsteffectv.h
@@ -32,5 +32,5 @@ GType gst_vertigotv_get_type (void);
GType gst_revtv_get_type (void);
GType gst_quarktv_get_type (void);
-extern GstPadTemplate *gst_effectv_sink_factory ();
-extern GstPadTemplate *gst_effectv_src_factory ();
+extern GstStaticPadTemplate gst_effectv_sink_template;
+extern GstStaticPadTemplate gst_effectv_src_template;
diff --git a/gst/effectv/gstquark.c b/gst/effectv/gstquark.c
index 5c2a95f7..6d51bc5c 100644
--- a/gst/effectv/gstquark.c
+++ b/gst/effectv/gstquark.c
@@ -138,8 +138,10 @@ gst_quarktv_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_quarktv_details);
}
@@ -166,18 +168,18 @@ gst_quarktv_class_init (GstQuarkTVClass * klass)
}
static GstPadLinkReturn
-gst_quarktv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_quarktv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstQuarkTV *filter;
gint i;
+ GstStructure *structure;
filter = GST_QUARKTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
filter->area = filter->width * filter->height;
@@ -188,18 +190,20 @@ gst_quarktv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->planetable[i] = NULL;
}
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_quarktv_init (GstQuarkTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_quarktv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_quarktv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->planes = PLANES;
diff --git a/gst/effectv/gstrev.c b/gst/effectv/gstrev.c
index 91bbafee..bca245d2 100644
--- a/gst/effectv/gstrev.c
+++ b/gst/effectv/gstrev.c
@@ -149,8 +149,10 @@ gst_revtv_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_revtv_details);
}
@@ -181,30 +183,32 @@ gst_revtv_class_init (GstRevTVClass * klass)
}
static GstPadLinkReturn
-gst_revtv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_revtv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRevTV *filter;
+ GstStructure *structure;
filter = GST_REVTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_revtv_init (GstRevTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_revtv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_revtv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->vgrabtime = 1;
diff --git a/gst/effectv/gstshagadelic.c b/gst/effectv/gstshagadelic.c
index 0ebe415c..22948b57 100644
--- a/gst/effectv/gstshagadelic.c
+++ b/gst/effectv/gstshagadelic.c
@@ -130,8 +130,10 @@ gst_shagadelictv_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get(&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_shagadelictv_details);
}
@@ -152,18 +154,18 @@ gst_shagadelictv_class_init (GstShagadelicTVClass * klass)
}
static GstPadLinkReturn
-gst_shagadelictv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_shagadelictv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstShagadelicTV *filter;
gint area;
+ GstStructure *structure;
filter = GST_SHAGADELICTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
area = filter->width * filter->height;
@@ -175,18 +177,20 @@ gst_shagadelictv_sinkconnect (GstPad * pad, GstCaps * caps)
gst_shagadelic_initialize (filter);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_shagadelictv_init (GstShagadelicTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_shagadelictv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_shagadelictv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->ripple = NULL;
diff --git a/gst/effectv/gstvertigo.c b/gst/effectv/gstvertigo.c
index 9ab0f0ab..2d286644 100644
--- a/gst/effectv/gstvertigo.c
+++ b/gst/effectv/gstvertigo.c
@@ -135,8 +135,10 @@ gst_vertigotv_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_vertigotv_details);
}
@@ -186,18 +188,18 @@ gst_vertigotv_reset_handler (GstElement *element)
static GstPadLinkReturn
-gst_vertigotv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_vertigotv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstVertigoTV *filter;
gint area;
+ GstStructure *structure;
filter = GST_VERTIGOTV (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
area = filter->width * filter->height;
@@ -209,18 +211,20 @@ gst_vertigotv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->alt_buffer = filter->buffer + area;
filter->phase = 0;
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_vertigotv_init (GstVertigoTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_vertigotv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_vertigotv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->buffer = NULL;
diff --git a/gst/effectv/gstwarp.c b/gst/effectv/gstwarp.c
index 9ea36624..03648536 100644
--- a/gst/effectv/gstwarp.c
+++ b/gst/effectv/gstwarp.c
@@ -136,8 +136,10 @@ gst_warptv_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_effectv_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_effectv_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_effectv_sink_template));
gst_element_class_set_details (element_class, &gst_warptv_details);
}
@@ -158,32 +160,33 @@ gst_warptv_class_init (GstWarpTVClass * klass)
}
static GstPadLinkReturn
-gst_warptv_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_warptv_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstWarpTV *filter;
+ GstStructure *structure;
filter = GST_WARPTV (gst_pad_get_parent (pad));
+ structure = gst_caps_get_structure (caps, 0);
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
gst_warptv_initialize (filter);
- return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
+ return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
gst_warptv_init (GstWarpTV * filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_effectv_sink_factory (), "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_warptv_chain);
gst_pad_set_link_function (filter->sinkpad, gst_warptv_sinkconnect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (gst_effectv_src_factory (), "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_effectv_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->tval = 0;
diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c
index 4a144804..ca893394 100644
--- a/gst/flx/gstflxdec.c
+++ b/gst/flx/gstflxdec.c
@@ -47,36 +47,22 @@ enum {
};
/* input */
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "flxdec_sink",
- "video/x-fli",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "video/x-fli" )
+);
/* output */
-GST_PAD_TEMPLATE_FACTORY (src_video_factory,
+static GstStaticPadTemplate src_video_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "src_video",
- "video/x-raw-rgb",
- "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", GST_PROPS_INT_RANGE(320, 1280),
- "height", GST_PROPS_INT_RANGE(200, 1024),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
-)
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
static void gst_flxdec_class_init (GstFlxDecClass *klass);
@@ -130,9 +116,9 @@ gst_flxdec_base_init (GstFlxDecClass *klass)
gst_element_class_set_details (gstelement_class, &flxdec_details);
gst_element_class_add_pad_template (gstelement_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_add_pad_template (gstelement_class,
- GST_PAD_TEMPLATE_GET (src_video_factory));
+ gst_static_pad_template_get (&src_video_factory));
}
static void
@@ -158,12 +144,12 @@ static void
gst_flxdec_init(GstFlxDec *flxdec)
{
flxdec->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ gst_static_pad_template_get (&sink_factory), "sink");
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->sinkpad);
gst_element_set_loop_function(GST_ELEMENT(flxdec),gst_flxdec_loop);
flxdec->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_video_factory), "src");
+ gst_static_pad_template_get (&src_video_factory), "src");
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->srcpad);
flxdec->bs = NULL;
@@ -444,6 +430,7 @@ gst_flxdec_loop (GstElement *element)
GstBuffer *buf;
GstBuffer *databuf;
guchar *data, *chunk;
+ GstCaps *caps;
GstFlxDec *flxdec;
FlxHeader *flxh;
@@ -497,19 +484,11 @@ gst_flxdec_loop (GstElement *element)
flxdec->frame_time = flxh->speed * GST_MSECOND;
}
- gst_pad_try_set_caps (flxdec->srcpad,
- GST_CAPS_NEW (
- "src_video",
- "video/x-raw-rgb",
- "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", GST_PROPS_INT (flxh->width),
- "height", GST_PROPS_INT (flxh->height),
- "framerate", GST_PROPS_FLOAT (GST_SECOND/flxdec->frame_time)));
+ caps = gst_caps_from_string (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32);
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, flxh->width,
+ "height", G_TYPE_INT, flxh->height,
+ "framerate", G_TYPE_DOUBLE, GST_SECOND/flxdec->frame_time, NULL);
if (flxh->depth <= 8)
flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height);
@@ -521,7 +500,6 @@ gst_flxdec_loop (GstElement *element)
g_print("GstFlxDec: (FLC) oframe1 : 0x%08x\n", flxh->oframe1);
g_print("GstFlxDec: (FLC) oframe2 : 0x%08x\n", flxh->oframe2);
}
-
flxdec->size = (flxh->width * flxh->height);
diff --git a/gst/goom/gstgoom.c b/gst/goom/gstgoom.c
index ac885c15..d892f4c6 100644
--- a/gst/goom/gstgoom.c
+++ b/gst/goom/gstgoom.c
@@ -45,7 +45,7 @@ struct _GstGOOM {
gint16 datain[2][512];
/* video state */
- gfloat fps;
+ gdouble fps;
gint width;
gint height;
gint channels;
@@ -78,33 +78,28 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (src_template,
+static GstStaticPadTemplate src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "goomsrc",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32
- )
-)
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
-GST_PAD_TEMPLATE_FACTORY (sink_template,
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink", /* the name of the pads */
GST_PAD_SINK, /* type of the pad */
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "goomsink", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- /* Properties follow: */
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (8000, 96000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 8000, 96000 ], "
+ "channels = (int) [ 1, 2 ]"
)
-)
+);
static void gst_goom_class_init (GstGOOMClass *klass);
@@ -117,8 +112,8 @@ static GstElementStateReturn
static void gst_goom_chain (GstPad *pad, GstData *_data);
-static GstPadLinkReturn gst_goom_sinkconnect (GstPad *pad, GstCaps *caps);
-static GstPadLinkReturn gst_goom_srcconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_goom_sinkconnect (GstPad *pad, const GstCaps *caps);
+static GstPadLinkReturn gst_goom_srcconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
@@ -151,9 +146,9 @@ gst_goom_base_init (GstGOOMClass *klass)
gst_element_class_set_details (element_class, &gst_goom_details);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_template));
+ gst_static_pad_template_get (&sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_template));
+ gst_static_pad_template_get (&src_template));
}
static void
@@ -177,9 +172,9 @@ gst_goom_init (GstGOOM *goom)
{
/* create the sink and src pads */
goom->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_template ), "sink");
+ gst_static_pad_template_get (&sink_template ), "sink");
goom->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_template ), "src");
+ gst_static_pad_template_get (&src_template ), "src");
gst_element_add_pad (GST_ELEMENT (goom), goom->sinkpad);
gst_element_add_pad (GST_ELEMENT (goom), goom->srcpad);
@@ -207,39 +202,33 @@ gst_goom_dispose (GObject *object)
}
static GstPadLinkReturn
-gst_goom_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_goom_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstGOOM *goom;
+ GstStructure *structure;
+
goom = GST_GOOM (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "channels", &goom->channels);
+ gst_structure_get_int (structure, "channels", &goom->channels);
return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
-gst_goom_srcconnect (GstPad *pad, GstCaps *caps)
+gst_goom_srcconnect (GstPad *pad, const GstCaps *caps)
{
GstGOOM *goom;
+ GstStructure *structure;
+
goom = GST_GOOM (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+ structure = gst_caps_get_structure (caps, 0);
- if (gst_caps_has_property_typed (caps, "width", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "width", &goom->width);
- }
- if (gst_caps_has_property_typed (caps, "height", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "height", &goom->height);
- }
- if (gst_caps_has_property_typed (caps, "framerate", GST_PROPS_FLOAT_TYPE)) {
- gst_caps_get_float (caps, "framerate", &goom->fps);
- }
+ gst_structure_get_int (structure, "width", &goom->width);
+ gst_structure_get_int (structure, "height", &goom->height);
+ gst_structure_get_double (structure, "framerate", &goom->fps);
goom_set_resolution (goom->width, goom->height);
goom->srcnegotiated = TRUE;
@@ -247,36 +236,6 @@ gst_goom_srcconnect (GstPad *pad, GstCaps *caps)
return GST_PAD_LINK_OK;
}
-static gboolean
-gst_goom_negotiate_default (GstGOOM *goom)
-{
- GstCaps *caps;
-
- caps = GST_CAPS_NEW (
- "goomsrc",
- "video/x-raw-rgb",
- "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
- "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", GST_PROPS_INT (goom->width),
- "height", GST_PROPS_INT (goom->height),
- "framerate", GST_PROPS_FLOAT (goom->fps)
- );
-
- if (gst_pad_try_set_caps (goom->srcpad, caps) <= 0) {
- return FALSE;
- }
-
- goom_set_resolution (goom->width, goom->height);
- goom->srcnegotiated = TRUE;
-
- return TRUE;
-}
-
static void
gst_goom_chain (GstPad *pad, GstData *_data)
{
@@ -318,13 +277,6 @@ gst_goom_chain (GstPad *pad, GstData *_data)
if (!GST_PAD_IS_USABLE (goom->srcpad))
goto done;
- if (!goom->srcnegotiated) {
- if (!gst_goom_negotiate_default (goom)) {
- gst_element_error (GST_ELEMENT (goom), "could not negotiate src format");
- goto done;
- }
- }
-
samples_in = GST_BUFFER_SIZE (bufin) / (sizeof (gint16) * goom->channels);
GST_DEBUG ("input buffer has %d samples", samples_in);
diff --git a/gst/law/alaw-decode.c b/gst/law/alaw-decode.c
index d656fdd1..00108948 100644
--- a/gst/law/alaw-decode.c
+++ b/gst/law/alaw-decode.c
@@ -80,31 +80,29 @@ static gint alaw_to_s16(guint8 a_val)
}
static GstPadLinkReturn
-alawdec_link (GstPad *pad, GstCaps *caps)
+alawdec_link (GstPad *pad, const GstCaps *caps)
{
GstCaps* tempcaps;
gint rate, channels;
+ GstStructure *structure;
+ gboolean ret;
GstALawDec* alawdec = GST_ALAWDEC (GST_OBJECT_PARENT (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- if (!gst_caps_get (caps, "rate", &rate,
- "channels", &channels,
- NULL))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rate);
+ ret &= gst_structure_get_int (structure, "channels", &channels);
+ if (!ret) return GST_PAD_LINK_REFUSED;
- tempcaps = GST_CAPS_NEW (
- "alawdec_src_caps",
- "audio/x-raw-int",
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "rate", GST_PROPS_INT (rate),
- "channels", GST_PROPS_INT (channels),
- NULL);
+ tempcaps = gst_caps_new_simple ( "audio/x-raw-int",
+ "depth", G_TYPE_INT, 16,
+ "width", G_TYPE_INT, 16,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channels,
+ NULL);
return gst_pad_try_set_caps (alawdec->srcpad, tempcaps);
}
diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c
index d13427bb..6efdb64f 100644
--- a/gst/law/alaw-encode.c
+++ b/gst/law/alaw-encode.c
@@ -120,30 +120,29 @@ static GstElementClass *parent_class = NULL;
/*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; */
static GstPadLinkReturn
-alawenc_link (GstPad *pad, GstCaps *caps)
+alawenc_link (GstPad *pad, const GstCaps *caps)
{
GstCaps* tempcaps;
gint rate, channels;
+ GstStructure *structure;
+ gboolean ret;
GstALawEnc* alawenc = GST_ALAWENC (GST_OBJECT_PARENT (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- if (!gst_caps_get (caps, "rate", &rate,
- "channels", &channels,
- NULL))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rate);
+ ret &= gst_structure_get_int (structure, "channels", &channels);
+
+ if (!ret) return GST_PAD_LINK_REFUSED;
- tempcaps = GST_CAPS_NEW (
- "alawenc_src_caps",
- "audio/x-alaw",
- "depth", GST_PROPS_INT (8),
- "width", GST_PROPS_INT (8),
- "signed", GST_PROPS_BOOLEAN (FALSE),
- "rate", GST_PROPS_INT (rate),
- "channels", GST_PROPS_INT (channels),
- NULL);
+ tempcaps = gst_caps_new_simple ("audio/x-alaw",
+ "depth", G_TYPE_INT, 8,
+ "width", G_TYPE_INT, 8,
+ "signed", G_TYPE_BOOLEAN, FALSE,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channels,
+ NULL);
return gst_pad_try_set_caps (alawenc->srcpad, tempcaps);
}
diff --git a/gst/law/alaw.c b/gst/law/alaw.c
index 70cb12da..be0559bb 100644
--- a/gst/law/alaw.c
+++ b/gst/law/alaw.c
@@ -7,31 +7,23 @@
static GstCaps*
alaw_factory (void)
{
- return
- gst_caps_new (
- "test_src",
- "audio/x-alaw",
- gst_props_new (
- "rate", GST_PROPS_INT_RANGE (8000, 192000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-alaw",
+ "rate", GST_TYPE_INT_RANGE, 8000, 192000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
static GstCaps*
linear_factory (void)
{
- return
- gst_caps_new (
- "test_sink",
- "audio/x-raw-int",
- gst_props_new (
- "width", GST_PROPS_INT(16),
- "depth", GST_PROPS_INT(16),
- "endianness", GST_PROPS_INT(G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN(TRUE),
- "rate", GST_PROPS_INT_RANGE (8000, 192000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-raw-int",
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "rate", GST_TYPE_INT_RANGE, 8000, 192000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
GstPadTemplate *alawenc_src_template, *alawenc_sink_template;
@@ -45,11 +37,11 @@ plugin_init (GstPlugin *plugin)
alaw_caps = alaw_factory ();
linear_caps = linear_factory ();
- alawenc_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,alaw_caps, NULL);
- alawenc_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,linear_caps, NULL);
+ alawenc_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,alaw_caps);
+ alawenc_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,linear_caps);
- alawdec_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,linear_caps, NULL);
- alawdec_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,alaw_caps, NULL);
+ alawdec_src_template = gst_pad_template_new ("src",GST_PAD_SRC,GST_PAD_ALWAYS,linear_caps);
+ alawdec_sink_template = gst_pad_template_new ("sink",GST_PAD_SINK,GST_PAD_ALWAYS,alaw_caps);
if (!gst_element_register (plugin, "alawenc",
GST_RANK_NONE, GST_TYPE_ALAWENC) ||
diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c
index 725dc837..d04a6ed4 100644
--- a/gst/law/mulaw-decode.c
+++ b/gst/law/mulaw-decode.c
@@ -59,32 +59,29 @@ static GstElementClass *parent_class = NULL;
static GstPadLinkReturn
-mulawdec_link (GstPad *pad, GstCaps *caps)
+mulawdec_link (GstPad *pad, const GstCaps *caps)
{
GstCaps* tempcaps;
gint rate, channels;
+ GstStructure *structure;
+ gboolean ret;
GstMuLawDec* mulawdec = GST_MULAWDEC (GST_OBJECT_PARENT (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- if (!gst_caps_get (caps, "rate", &rate,
- "channels", &channels,
- NULL))
- return GST_PAD_LINK_DELAYED;
-
- tempcaps = GST_CAPS_NEW (
- "sinesrc_src_caps",
- "audio/x-raw-int",
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "rate", GST_PROPS_INT (rate),
- "channels", GST_PROPS_INT (channels),
- NULL);
-
+ structure = gst_caps_get_structure (caps, 0);
+ ret = gst_structure_get_int (structure, "rate", &rate);
+ ret = gst_structure_get_int (structure, "channels", &channels);
+ if (!ret) return GST_PAD_LINK_REFUSED;
+
+ tempcaps = gst_caps_new_simple ("audio/x-mulaw",
+ "depth", G_TYPE_INT, 16,
+ "width", G_TYPE_INT, 16,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channels,
+ NULL);
+
return gst_pad_try_set_caps (mulawdec->srcpad, tempcaps);
}
diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c
index 97e861bb..b15815a1 100644
--- a/gst/law/mulaw-encode.c
+++ b/gst/law/mulaw-encode.c
@@ -58,33 +58,30 @@ static GstElementClass *parent_class = NULL;
/*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; */
static GstPadLinkReturn
-mulawenc_link (GstPad *pad, GstCaps *caps)
+mulawenc_link (GstPad *pad, const GstCaps *caps)
{
GstCaps* tempcaps;
gint rate, channels;
+ GstStructure *structure;
+ gboolean ret;
GstMuLawEnc* mulawenc = GST_MULAWENC (GST_OBJECT_PARENT (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
+ ret = gst_structure_get_int (structure, "rate", &rate);
+ ret = gst_structure_get_int (structure, "channels", &channels);
+ if (!ret) return GST_PAD_LINK_REFUSED;
- if (!gst_caps_get (caps, "rate", &rate,
- "channels", &channels,
- NULL))
- return GST_PAD_LINK_DELAYED;
-
- tempcaps = GST_CAPS_NEW (
- "sinesrc_src_caps",
- "audio/x-mulaw",
- "depth", GST_PROPS_INT (8),
- "width", GST_PROPS_INT (8),
- "signed", GST_PROPS_BOOLEAN (FALSE),
- "rate", GST_PROPS_INT (rate),
- "channels", GST_PROPS_INT (channels),
- NULL);
+ tempcaps = gst_caps_new_simple ("audio/x-mulaw",
+ "depth", G_TYPE_INT, 8,
+ "width", G_TYPE_INT, 8,
+ "signed", G_TYPE_BOOLEAN, FALSE,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, channels,
+ NULL);
return gst_pad_try_set_caps (mulawenc->srcpad, tempcaps);
-}
+}
GType
gst_mulawenc_get_type(void) {
diff --git a/gst/law/mulaw.c b/gst/law/mulaw.c
index f2f465a8..2aae63cd 100644
--- a/gst/law/mulaw.c
+++ b/gst/law/mulaw.c
@@ -7,34 +7,23 @@
static GstCaps*
mulaw_factory (void)
{
- return
- gst_caps_new (
- "test_src",
- "audio/x-mulaw",
- gst_props_new (
- "width", GST_PROPS_INT(8),
- "depth", GST_PROPS_INT(8),
- "signed", GST_PROPS_BOOLEAN(FALSE),
- "rate", GST_PROPS_INT_RANGE (8000, 192000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-mulaw",
+ "rate", GST_TYPE_INT_RANGE, 8000, 192000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
static GstCaps*
linear_factory (void)
{
- return
- gst_caps_new (
- "test_sink",
- "audio/x-raw-int",
- gst_props_new (
- "width", GST_PROPS_INT(16),
- "depth", GST_PROPS_INT(16),
- "signed", GST_PROPS_BOOLEAN(TRUE),
- "endianness", GST_PROPS_INT(G_BYTE_ORDER),
- "rate", GST_PROPS_INT_RANGE (8000, 192000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return gst_caps_new_simple ("audio/x-raw-int",
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "rate", GST_TYPE_INT_RANGE, 8000, 192000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
GstPadTemplate *mulawenc_src_template, *mulawenc_sink_template;
@@ -49,14 +38,14 @@ plugin_init (GstPlugin *plugin)
linear_caps = linear_factory ();
mulawenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- mulaw_caps, NULL);
+ mulaw_caps);
mulawenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- linear_caps, NULL);
+ linear_caps);
mulawdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- linear_caps, NULL);
+ linear_caps);
mulawdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- mulaw_caps, NULL);
+ mulaw_caps);
if (!gst_element_register (plugin, "mulawenc",
GST_RANK_NONE, GST_TYPE_MULAWENC) ||
diff --git a/gst/level/gstlevel.c b/gst/level/gstlevel.c
index 72feef24..e81828aa 100644
--- a/gst/level/gstlevel.c
+++ b/gst/level/gstlevel.c
@@ -25,6 +25,7 @@
#include "config.h"
#endif
#include <gst/gst.h>
+#include <gst/audio/audio.h>
#include "gstlevel.h"
#include "math.h"
@@ -38,47 +39,21 @@ static GstElementDetails level_details = {
/* pad templates */
-GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
+static GstStaticPadTemplate sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"level_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "level_sink",
- "audio/x-raw-int",
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- )
-)
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
+);
-GST_PAD_TEMPLATE_FACTORY (src_template_factory,
+static GstStaticPadTemplate src_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"level_src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "level_src",
- "audio/x-raw-int",
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- )
-)
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
+);
/* Filter signals and args */
enum {
@@ -130,22 +105,20 @@ gst_level_get_type (void)
}
static GstPadLinkReturn
-gst_level_link (GstPad *pad, GstCaps *caps)
+gst_level_link (GstPad *pad, const GstCaps *caps)
{
GstLevel *filter;
GstPad *otherpad;
GstPadLinkReturn res;
+ GstStructure *structure;
int i;
+ gboolean ret;
filter = GST_LEVEL (gst_pad_get_parent (pad));
g_return_val_if_fail (filter != NULL, GST_PAD_LINK_REFUSED);
g_return_val_if_fail (GST_IS_LEVEL (filter), GST_PAD_LINK_REFUSED);
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
-
res = gst_pad_try_set_caps (otherpad, caps);
/* if ok, set filter */
if (res != GST_PAD_LINK_OK && res != GST_PAD_LINK_DONE) {
@@ -154,12 +127,12 @@ gst_level_link (GstPad *pad, GstCaps *caps)
filter->num_samples = 0;
- if (!gst_caps_get_int (caps, "rate", &(filter->rate)))
- return GST_PAD_LINK_REFUSED;
- if (!gst_caps_get_int (caps, "width", &(filter->width)))
- return GST_PAD_LINK_REFUSED;
- if (!gst_caps_get_int (caps, "channels", &(filter->channels)))
- return GST_PAD_LINK_REFUSED;
+ structure = gst_caps_get_structure (caps, 0);
+ ret = gst_structure_get_int (structure, "rate", &filter->rate);
+ ret &= gst_structure_get_int (structure, "width", &filter->width);
+ ret &= gst_structure_get_int (structure, "channels", &filter->channels);
+
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* allocate channel variable arrays */
if (filter->CS) g_free (filter->CS);
@@ -393,9 +366,9 @@ gst_level_base_init (GstLevelClass *klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_template_factory));
+ gst_static_pad_template_get (&sink_template_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_template_factory));
+ gst_static_pad_template_get (&src_template_factory));
gst_element_class_set_details (element_class, &level_details);
element_class->change_state = gst_level_change_state;
@@ -443,9 +416,9 @@ gst_level_class_init (GstLevelClass *klass)
static void
gst_level_init (GstLevel *filter)
{
- filter->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_template_factory), "sink");
+ filter->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&sink_template_factory), "sink");
gst_pad_set_link_function (filter->sinkpad, gst_level_link);
- filter->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_template_factory), "src");
+ filter->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (&src_template_factory), "src");
gst_pad_set_link_function (filter->srcpad, gst_level_link);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index a495de65..0d222fe7 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -45,16 +45,13 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (sink_templ,
+static GstStaticPadTemplate sink_templ =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "matroskademux_sink",
- "video/x-matroska",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "video/x-matroska" )
+);
/* gobject magic foo */
static void gst_matroska_demux_base_init (GstMatroskaDemuxClass *klass);
@@ -163,7 +160,7 @@ gst_matroska_demux_base_init (GstMatroskaDemuxClass *klass)
gst_element_class_add_pad_template (element_class, audiosrctempl);
gst_element_class_add_pad_template (element_class, subtitlesrctempl);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_templ));
+ gst_static_pad_template_get (&sink_templ));
gst_element_class_set_details (element_class,
&gst_matroska_demux_details);
}
@@ -179,10 +176,10 @@ gst_matroska_demux_class_init (GstMatroskaDemuxClass *klass)
g_object_class_install_property (gobject_class, ARG_METADATA,
g_param_spec_boxed ("metadata", "Metadata", "Metadata",
- GST_TYPE_CAPS, G_PARAM_READABLE));
+ GST_TYPE_STRUCTURE, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, ARG_STREAMINFO,
g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo",
- GST_TYPE_CAPS, G_PARAM_READABLE));
+ GST_TYPE_STRUCTURE, G_PARAM_READABLE));
parent_class = g_type_class_ref (GST_TYPE_EBML_READ);
@@ -251,6 +248,7 @@ gst_matroska_demux_reset (GstElement *element)
demux->num_v_streams = 0;
/* reset media info */
+
gst_caps_replace (&demux->metadata, NULL);
gst_caps_replace (&demux->streaminfo, NULL);
@@ -2157,6 +2155,114 @@ gst_matroska_demux_loop (GstElement *element)
gst_matroska_demux_loop_stream (demux);
}
+#if 0
+static GstCaps *
+gst_matroska_demux_vfw_caps (guint32 codec_fcc,
+ gst_riff_strf_vids *vids)
+{
+ GstCaps *caps = NULL;
+
+ switch (codec_fcc) {
+ case GST_MAKE_FOURCC('I','4','2','0'):
+ case GST_MAKE_FOURCC('Y','U','Y','2'):
+ 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_simple ("video/x-jpeg", NULL);
+ break;
+
+ case GST_MAKE_FOURCC('H','F','Y','U'):
+ 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_simple ("video/mpeg",
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_BOOLEAN, 1, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('H','2','6','3'):
+ case GST_MAKE_FOURCC('i','2','6','3'):
+ case GST_MAKE_FOURCC('L','2','6','3'):
+ case GST_MAKE_FOURCC('M','2','6','3'):
+ 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_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_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_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_simple ("video/x-xvid", NULL);
+ break;
+
+ case GST_MAKE_FOURCC('M','P','G','4'):
+ 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_simple ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 42, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('M','P','4','3'):
+ 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_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_simple ("video/x-dv",
+ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
+ break;
+
+ case GST_MAKE_FOURCC('W','M','V','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_simple ("video/x-wmv",
+ "wmvversion", G_TYPE_INT, 2, NULL);
+ break;
+
+ default:
+ GST_WARNING ("matroskademux: unkown VFW video format " GST_FOURCC_FORMAT,
+ GST_FOURCC_ARGS (codec_fcc));
+ return NULL;
+ break;
+ }
+
+ return caps;
+}
+#endif
+
static GstCaps *
gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
const gchar *codec_id,
@@ -2169,7 +2275,6 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC)) {
gst_riff_strf_vids *vids = NULL;
- GstCaps *t;
if (data) {
vids = (gst_riff_strf_vids *) data;
@@ -2200,12 +2305,6 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
} else {
caps = gst_riff_create_video_template_caps ();
}
-
- for (t = caps; t != NULL; t = t->next) {
- gst_props_remove_entry_by_name (t->properties, "width");
- gst_props_remove_entry_by_name (t->properties, "height");
- gst_props_remove_entry_by_name (t->properties, "framerate");
- }
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED)) {
/* how nice, this is undocumented... */
if (videocontext != NULL) {
@@ -2223,45 +2322,32 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
return NULL;
}
- caps = GST_CAPS_NEW ("matroskademux_src_uncompressed",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (fourcc));
+ caps = gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
} else {
- caps = GST_CAPS_NEW ("matroskademux_src_uncompressed",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','V','1','2'))
- )
- );
+ caps = gst_caps_from_string ("video/x-raw-yuv, "
+ "format = (fourcc) { I420, YUY2, YV12 }");
}
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP)) {
- caps = GST_CAPS_NEW ("matroskademux_src_divx4",
- "video/x-divx",
- "divxversion", GST_PROPS_INT (4));
+ caps = gst_caps_new_simple ("video/x-divx",
+ "divxversion", G_TYPE_INT, 4, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AP)) {
- caps = GST_CAPS_NEW ("matroskademux_src_divx5",
- "video/x-divx",
- "divxversion", GST_PROPS_INT (5));
- caps = gst_caps_append (caps,
- GST_CAPS_NEW ("matroskademux_src_xvid",
- "video/x-xvid",
- NULL));
- caps = gst_caps_append (caps,
- GST_CAPS_NEW ("matroskademux_src_mpeg4asp/ap",
- "video/mpeg",
- "mpegversion", GST_PROPS_INT (4),
- "systemstream", GST_PROPS_BOOLEAN (FALSE)));
+ caps = gst_caps_new_full (
+ gst_structure_new ("video/x-divx",
+ "divxversion", G_TYPE_INT, 5, NULL),
+ gst_structure_new ("video/x-xvid", NULL),
+ gst_structure_new ("video/mpeg",
+ "mpegversion", G_TYPE_INT, 4,
+ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL),
+ NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3)) {
- caps = GST_CAPS_NEW ("matroskademux_src_msmpeg4v3",
- "video/x-divx",
- "divxversion", GST_PROPS_INT (3));
- caps = gst_caps_append (caps,
- GST_CAPS_NEW ("matroskademux_src_divx3",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (43)));
+ caps = gst_caps_new_full (
+ gst_structure_new ("video/x-divx",
+ "divxversion", G_TYPE_INT, 3, NULL),
+ gst_structure_new ("video/x-msmpeg",
+ "msmpegversion", G_TYPE_INT, 43, NULL),
+ NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG1) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG2)) {
gint mpegversion = -1;
@@ -2273,36 +2359,37 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
else
g_assert (0);
- caps = GST_CAPS_NEW ("matroska_demux_mpeg1",
- "video/mpeg",
- "systemstream", GST_PROPS_BOOLEAN (FALSE),
- "mpegversion", GST_PROPS_INT (mpegversion));
+ caps = gst_caps_new_simple ("video/mpeg",
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_INT, mpegversion, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MJPEG)) {
- caps = GST_CAPS_NEW ("matroska_demux_mjpeg",
- "video/x-jpeg",
- NULL);
+ caps = gst_caps_new_simple ("video/x-jpeg", NULL);
} else {
GST_WARNING ("Unknown codec '%s', cannot build Caps",
codec_id);
+ return NULL;
}
if (caps != NULL) {
- GstCaps *one;
- GstPropsEntry *fps = NULL;
- GstPropsEntry *width = NULL, *height = NULL;
- GstPropsEntry *pixel_width = NULL, *pixel_height = NULL;
+ int i;
+ GstStructure *structure;
- for (one = caps; one != NULL; one = one->next) {
+ for (i=0;i<gst_caps_get_size(caps);i++){
+ structure = gst_caps_get_structure (caps, i);
if (videocontext != NULL) {
if (videocontext->pixel_width > 0 &&
videocontext->pixel_height > 0) {
gint w = videocontext->pixel_width;
gint h = videocontext->pixel_height;
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (w));
- height = gst_props_entry_new ("height",
- GST_PROPS_INT (h));
+ gst_structure_set (structure,
+ "width", G_TYPE_INT, w,
+ "height", G_TYPE_INT, h, NULL);
+ } else {
+ gst_structure_set (structure,
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ NULL);
}
#if 0
if (videocontext->display_width > 0 &&
@@ -2310,59 +2397,117 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *videocontext,
gint w = 100 * videocontext->display_width / videocontext->pixel_width;
gint h = 100 * videocontext->display_height / videocontext->pixel_height;
- pixel_width = gst_props_entry_new ("pixel_width",
- GST_PROPS_INT (w));
- pixel_height = gst_props_entry_new ("pixel_height",
- GST_PROPS_INT (h));
+ gst_structure_set (structure,
+ "pixel_width", G_TYPE_INT, w,
+ "pixel_height", G_TYPE_INT, h,
+ NULL);
}
#endif
if (context->default_duration > 0) {
gfloat framerate = 1. * GST_SECOND / context->default_duration;
- fps = gst_props_entry_new ("framerate",
- GST_PROPS_FLOAT (framerate));
+ gst_structure_set (structure,
+ "framerate", G_TYPE_DOUBLE, framerate, NULL);
} else {
/* sort of a hack to get most codecs to support,
* even if the default_duration is missing */
- fps = gst_props_entry_new ("framerate", GST_PROPS_FLOAT (25.));
+ gst_structure_set (structure,
+ "framerate", G_TYPE_DOUBLE, 25.0, NULL);
}
} 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 0
- pixel_width = gst_props_entry_new ("pixel_width",
- GST_PROPS_INT_RANGE (0, 255));
- pixel_height = gst_props_entry_new ("pixel_height",
- GST_PROPS_INT_RANGE (0, 255));
-#endif
- fps = gst_props_entry_new ("framerate",
- GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ gst_structure_set (structure,
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ "pixel_width", GST_TYPE_INT_RANGE, 0, 255,
+ "pixel_height", GST_TYPE_INT_RANGE, 0, 255,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
}
+ }
+ }
- if (one->properties == NULL) {
- one->properties = gst_props_empty_new ();
- }
+ return caps;
+}
+
+#if 0
+static GstCaps *
+gst_matroskademux_acm_caps (guint16 codec_id,
+ gst_riff_strf_auds *auds)
+{
+ GstCaps *caps = NULL;
+
+ switch (codec_id) {
+ case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "layer", G_TYPE_INT, 3, NULL);
+ break;
- if (width != NULL && height != NULL) {
- gst_props_add_entry (one->properties, width);
- gst_props_add_entry (one->properties, height);
+ case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "layer", G_TYPE_INT, 2, NULL);
+ break;
+
+ case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ {
+ if (auds != NULL) {
+ gint ba = GUINT16_FROM_LE (auds->blockalign);
+ gint ch = GUINT16_FROM_LE (auds->channels);
+ gint ws = GUINT16_FROM_LE (auds->size);
+
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+ "width", G_TYPE_INT, ba * 8 / ch,
+ "depth", G_TYPE_INT, ws,
+ "signed", G_TYPE_BOOLEAN, ws != 8, NULL);
+ } else {
+ caps = gst_caps_from_string ("audio/x-raw-int, "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "depth = (int) { 8, 16 }, "
+ "width = (int) { 8, 16 }");
}
- if (pixel_width != NULL && pixel_height != NULL) {
- gst_props_add_entry (one->properties, pixel_width);
- gst_props_add_entry (one->properties, pixel_height);
+ }
+ break;
+
+ case GST_RIFF_WAVE_FORMAT_MULAW:
+ if (auds != NULL && auds->size != 8) {
+ g_warning ("invalid depth (%d) of mulaw audio, overwriting.",
+ auds->size);
}
+ caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
+ break;
- if (fps != NULL) {
- gst_props_add_entry (one->properties, fps);
+ case GST_RIFF_WAVE_FORMAT_ALAW:
+ if (auds != NULL && auds->size != 8) {
+ g_warning ("invalid depth (%d) of alaw audio, overwriting.",
+ auds->size);
}
- }
+ caps = gst_caps_new_simple ("audio/x-alaw", NULL);
+ break;
+
+ case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
+ case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
+ case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
+ 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_simple ("audio/x-vorbis", NULL);
+ break;
+
+ case GST_RIFF_WAVE_FORMAT_A52:
+ caps = gst_caps_new_simple ("audio/x-ac3", NULL);
+ break;
+
+ default:
+ GST_WARNING ("matroskademux: unkown ACM audio format 0x%04x",
+ codec_id);
+ return NULL;
+ break;
}
return caps;
}
+#endif
static GstCaps *
gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
@@ -2388,14 +2533,12 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
else
g_assert (0);
- caps = GST_CAPS_NEW ("matroskademux_mpeg1-l1",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT (layer));
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, layer, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE)) {
gint endianness = -1;
- GstPropsEntry *depth, *width, *sign;
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE))
endianness = G_BIG_ENDIAN;
@@ -2405,60 +2548,35 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
g_assert (0);
if (context != NULL) {
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (audiocontext->bitdepth));
- depth = gst_props_entry_new ("depth",
- GST_PROPS_INT (audiocontext->bitdepth));
- sign = gst_props_entry_new ("signed",
- GST_PROPS_BOOLEAN (audiocontext->bitdepth == 8));
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "width", G_TYPE_INT, audiocontext->bitdepth,
+ "depth", G_TYPE_INT, audiocontext->bitdepth,
+ "signed", G_TYPE_BOOLEAN, audiocontext->bitdepth == 8, NULL);
} else {
- 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)));
- sign = gst_props_entry_new ("signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)));
+ caps = gst_caps_from_string ("audio/x-raw-int, "
+ "signed = (boolean) { TRUE, FALSE }, "
+ "depth = (int) { 8, 16 }, "
+ "width = (int) { 8, 16 }");
}
-
- caps = GST_CAPS_NEW ("matroskademux_audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (endianness));
- gst_props_add_entry (caps->properties, width);
- gst_props_add_entry (caps->properties, depth);
- gst_props_add_entry (caps->properties, sign);
+ gst_caps_set_simple (caps, "endianness", G_TYPE_INT, endianness, NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) {
- GstPropsEntry *width;
-
+ caps = gst_caps_new_simple ("audio/x-raw-float",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
if (audiocontext != NULL) {
- width = gst_props_entry_new ("width",
- GST_PROPS_INT (audiocontext->bitdepth));
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, audiocontext->bitdepth, NULL);
} else {
- width = gst_props_entry_new ("width", GST_PROPS_LIST (
- GST_PROPS_INT (32),
- GST_PROPS_INT (64)));
+ gst_caps_set_simple (caps,
+ "width", GST_TYPE_INT_RANGE, 32, 64, NULL);
}
-
- caps = GST_CAPS_NEW ("matroskademux_audio_float",
- "audio/x-raw-float",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT));
-
- gst_props_add_entry (caps->properties, width);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AC3) ||
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_DTS)) {
- caps = GST_CAPS_NEW ("matroskademux_audio_ac3/dts",
- "audio/x-ac3",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-ac3", NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_VORBIS)) {
- caps = GST_CAPS_NEW ("matroskademux_audio_vorbis",
- "audio/x-vorbis",
- NULL);
+ caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_ACM)) {
gst_riff_strf_auds *auds = NULL;
- GstCaps *t;
if (data) {
auds = (gst_riff_strf_auds *) data;
@@ -2475,11 +2593,6 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
} else {
caps = gst_riff_create_audio_template_caps ();
}
-
- for (t = caps; t != NULL; t = t->next) {
- gst_props_remove_entry_by_name (t->properties, "rate");
- gst_props_remove_entry_by_name (t->properties, "channels");
- }
} else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG2,
strlen (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2)) ||
!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG4,
@@ -2495,41 +2608,33 @@ gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *audiocontext,
else
g_assert (0);
- caps = GST_CAPS_NEW ("matroska_demux_aac_mpeg2",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (mpegversion));
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, mpegversion, NULL);
} else {
GST_WARNING ("Unknown codec '%s', cannot build Caps",
codec_id);
+ return NULL;
}
if (caps != NULL) {
- GstCaps *one;
- GstPropsEntry *chans = NULL, *rate = NULL;
+ GstStructure *structure;
+ int i;
- for (one = caps; one != NULL; one = one->next) {
+ for (i=0; i<gst_caps_get_size(caps); i++){
+ structure = gst_caps_get_structure (caps, i);
if (audiocontext != NULL) {
if (audiocontext->samplerate > 0 &&
audiocontext->channels > 0) {
- chans = gst_props_entry_new ("channels",
- GST_PROPS_INT (audiocontext->channels));
- rate = gst_props_entry_new ("rate",
- GST_PROPS_INT (audiocontext->samplerate));
+ gst_structure_set (structure,
+ "channels", G_TYPE_INT, audiocontext->channels,
+ "rate", G_TYPE_INT, audiocontext->samplerate,
+ NULL);
}
} else {
- chans = gst_props_entry_new ("channels",
- GST_PROPS_INT_RANGE (1, 6));
- rate = gst_props_entry_new ("rate",
- GST_PROPS_INT_RANGE (4000, 96000));
- }
-
- if (caps->properties == NULL) {
- caps->properties = gst_props_empty_new ();
- }
-
- if (chans != NULL && rate != NULL) {
- gst_props_add_entry (caps->properties, chans);
- gst_props_add_entry (caps->properties, rate);
+ gst_structure_set (structure,
+ "channels", GST_TYPE_INT_RANGE, 1, 6,
+ "rate", GST_TYPE_INT_RANGE, 4000, 96000,
+ NULL);
}
}
}
@@ -2610,8 +2715,7 @@ gboolean
gst_matroska_demux_plugin_init (GstPlugin *plugin)
{
gint i;
- GstCaps *videosrccaps = NULL, *audiosrccaps = NULL,
- *subtitlesrccaps = NULL, *temp;
+ GstCaps *videosrccaps, *audiosrccaps, *subtitlesrccaps, *temp;
const gchar *video_id[] = {
GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC,
GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED,
@@ -2653,38 +2757,41 @@ gst_matroska_demux_plugin_init (GstPlugin *plugin)
return FALSE;
/* video src template */
+ videosrccaps = gst_caps_new_empty ();
for (i = 0; video_id[i] != NULL; i++) {
temp = gst_matroska_demux_video_caps (NULL, video_id[i], NULL, 0);
- videosrccaps = gst_caps_append (videosrccaps, temp);
+ gst_caps_append (videosrccaps, temp);
}
for (i = 0; complex_id[i] != NULL; i++) {
temp = gst_matroska_demux_complex_caps (NULL, video_id[i], NULL, 0);
- videosrccaps = gst_caps_append (videosrccaps, temp);
+ gst_caps_append (videosrccaps, temp);
}
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- videosrccaps, NULL);
+ videosrccaps);
+ audiosrccaps = gst_caps_new_empty ();
/* audio src template */
for (i = 0; audio_id[i] != NULL; i++) {
temp = gst_matroska_demux_audio_caps (NULL, audio_id[i], NULL, 0);
- audiosrccaps = gst_caps_append (audiosrccaps, temp);
+ gst_caps_append (audiosrccaps, temp);
}
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- audiosrccaps, NULL);
+ audiosrccaps);
+ subtitlesrccaps = gst_caps_new_empty ();
/* subtitle src template */
for (i = 0; subtitle_id[i] != NULL; i++) {
temp = gst_matroska_demux_subtitle_caps (NULL, subtitle_id[i], NULL, 0);
- subtitlesrccaps = gst_caps_append (subtitlesrccaps, temp);
+ gst_caps_append (subtitlesrccaps, temp);
}
subtitlesrctempl = gst_pad_template_new ("subtitle_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
- subtitlesrccaps, NULL);
+ subtitlesrccaps);
/* create an elementfactory for the matroska_demux element */
if (!gst_element_register (plugin, "matroskademux",
diff --git a/gst/matroska/matroska-demux.h b/gst/matroska/matroska-demux.h
index 7356e695..e393a52a 100644
--- a/gst/matroska/matroska-demux.h
+++ b/gst/matroska/matroska-demux.h
@@ -66,8 +66,8 @@ typedef struct _GstMatroskaDemux {
GstClock *clock;
/* metadata */
- GstCaps *metadata,
- *streaminfo;
+ GstCaps *metadata;
+ GstCaps *streaminfo;
gchar *muxing_app, *writing_app;
gint64 created;
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c
index 0522d875..a80be303 100644
--- a/gst/matroska/matroska-mux.c
+++ b/gst/matroska/matroska-mux.c
@@ -40,114 +40,82 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (src_templ,
+static GstStaticPadTemplate src_templ =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "matroskamux_src",
- "video/x-matroska",
- NULL
- )
-)
+ GST_STATIC_CAPS ("video/x-matroska")
+);
-#define COMMON_VIDEO_PROPERTIES \
- "width", GST_PROPS_INT_RANGE (16, 4096), \
- "height", GST_PROPS_INT_RANGE (16, 4096), \
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
+#define COMMON_VIDEO_CAPS \
+ "width = (int) [ 16, 4096 ], " \
+ "height = (int) [ 16, 4096 ], " \
+ "framerate = (double) [ 0, MAX ]"
-GST_PAD_TEMPLATE_FACTORY (videosink_templ,
+static GstStaticPadTemplate videosink_templ =
+GST_STATIC_PAD_TEMPLATE (
"video_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW ("matroska_video_sink_mpeg",
- "video/mpeg",
- "mpegversion", GST_PROPS_LIST (
- GST_PROPS_INT (1),
- GST_PROPS_INT (2),
- GST_PROPS_INT (4)
- ),
- "systemstream", GST_PROPS_BOOLEAN (FALSE),
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_divx",
- "video/x-divx",
- "divxversion", GST_PROPS_INT_RANGE (3, 5),
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_xvid",
- "video/x-xvid",
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_msmpeg4v3",
- "video/x-msmpeg",
- "msmpegversion", GST_PROPS_INT (43),
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_jpeg",
- "video/x-jpeg",
- COMMON_VIDEO_PROPERTIES),
- GST_CAPS_NEW ("matroska_video_sink_rawyuv",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))
- ),
- COMMON_VIDEO_PROPERTIES)
-)
-
-#define COMMON_AUDIO_PROPERTIES \
- "channels", GST_PROPS_INT_RANGE (1, 8), \
- "rate", GST_PROPS_INT_RANGE (8000, 96000)
+ GST_STATIC_CAPS (
+ "video/mpeg, "
+ "mpegversion = (int) { 1, 2, 4 }, "
+ "systemstream = (boolean) false, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-divx, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-xvid, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-msmpeg, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-jpeg, "
+ COMMON_VIDEO_CAPS "; "
+ "video/x-raw-yuv, "
+ "format = (fourcc) { YUY2, I420 }, "
+ COMMON_VIDEO_CAPS
+ )
+);
+
+#define COMMON_AUDIO_CAPS \
+ "channels = (int) [ 1, 8 ], " \
+ "rate = (int) [ 8000, 96000 ]"
/* FIXME:
* * audio/x-raw-float: endianness needs defining.
* * audio/x-vorbis: private data setup needs work.
*/
-GST_PAD_TEMPLATE_FACTORY (audiosink_templ,
+static GstStaticPadTemplate audiosink_templ =
+GST_STATIC_PAD_TEMPLATE (
"audio_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW ("matroska_audio_sink_mpeg1",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT_RANGE (1, 3),
- COMMON_AUDIO_PROPERTIES),
- GST_CAPS_NEW ("matroska_audio_sink_mpeg24",
- "audio/mpeg",
- "mpegversion", GST_PROPS_LIST (
- GST_PROPS_INT (2),
- GST_PROPS_INT (4)
- ),
- COMMON_AUDIO_PROPERTIES),
- GST_CAPS_NEW ("matroska_audio_sink_ac3",
- "audio/x-ac3",
- COMMON_AUDIO_PROPERTIES),
- GST_CAPS_NEW ("matroska_audio_sink_raw_int",
- "audio/x-raw-int",
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16),
- GST_PROPS_INT (24)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16),
- GST_PROPS_INT (24)
- ),
- "endianness", GST_PROPS_LIST (
- GST_PROPS_INT (G_BIG_ENDIAN),
- GST_PROPS_INT (G_LITTLE_ENDIAN)
- ),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- COMMON_AUDIO_PROPERTIES)
-)
-
-GST_PAD_TEMPLATE_FACTORY (subtitlesink_templ,
+ GST_STATIC_CAPS (
+ "audio/mpeg, "
+ "mpegversion = (int) 1, "
+ "layer = (int) [ 1, 3 ], "
+ COMMON_AUDIO_CAPS "; "
+ "audio/mpeg, "
+ "mpegversion = (int) { 2, 4 }, "
+ COMMON_AUDIO_CAPS "; "
+ "audio/x-ac3, "
+ COMMON_AUDIO_CAPS "; "
+ "audio/x-raw-int, "
+ "width = (int) { 8, 16, 24 }, "
+ "depth = (int) { 8, 16, 24 }, "
+ "endianness = (int) { BIG_ENDIAN, LITTLE_ENDIAN }, "
+ "signed = (boolean) { true, false }, "
+ COMMON_AUDIO_CAPS
+ )
+);
+
+static GstStaticPadTemplate subtitlesink_templ =
+GST_STATIC_PAD_TEMPLATE (
"subtitle_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- NULL
-)
+ GST_STATIC_CAPS_ANY
+);
/* gobject magic foo */
static void gst_matroska_mux_base_init (GstMatroskaMuxClass *klass);
@@ -221,13 +189,13 @@ gst_matroska_mux_base_init (GstMatroskaMuxClass *klass)
};
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (videosink_templ));
+ gst_static_pad_template_get (&videosink_templ));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (audiosink_templ));
+ gst_static_pad_template_get (&audiosink_templ));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (subtitlesink_templ));
+ gst_static_pad_template_get (&subtitlesink_templ));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_templ));
+ gst_static_pad_template_get (&src_templ));
gst_element_class_set_details (element_class,
&gst_matroska_mux_details);
}
@@ -315,10 +283,9 @@ gst_matroska_mux_reset (GstElement *element)
/* reset media info (to default) */
gst_caps_replace (&mux->metadata,
- GST_CAPS_NEW ("matroska_metadata",
- "application/x-gst-metadata",
- "application", GST_PROPS_STRING (""),
- "date", GST_PROPS_STRING ("")));
+ gst_caps_new_simple ("application/x-gst-metadata",
+ "application", G_TYPE_STRING, "",
+ "date", G_TYPE_STRING, "", NULL));
/* reset indexes */
mux->num_indexes = 0;
@@ -331,18 +298,16 @@ gst_matroska_mux_reset (GstElement *element)
}
static GstPadLinkReturn
-gst_matroska_mux_video_pad_link (GstPad *pad,
- GstCaps *caps)
+gst_matroska_mux_video_pad_link (GstPad *pad, const GstCaps *caps)
{
GstMatroskaTrackContext *context = NULL;
GstMatroskaTrackVideoContext *videocontext;
GstMatroskaMux *mux = GST_MATROSKA_MUX (gst_pad_get_parent (pad));
const gchar *mimetype;
gint width, height, pixel_width, pixel_height, i;
- gfloat framerate;
-
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ gdouble framerate;
+ GstStructure *structure;
+ gboolean ret;
/* find context */
for (i = 0; i < mux->num_streams; i++) {
@@ -357,97 +322,93 @@ gst_matroska_mux_video_pad_link (GstPad *pad,
videocontext = (GstMatroskaTrackVideoContext *) context;
/* gst -> matroska ID'ing */
- for (; caps != NULL; caps = caps->next) {
- mimetype = gst_caps_get_mime (caps);
-
- /* get general properties */
- gst_caps_get (caps,
- "width", &width,
- "height", &height,
- "framerate", &framerate,
- NULL);
- videocontext->pixel_width = width;
- videocontext->pixel_height = height;
- context->default_duration = GST_SECOND / framerate;
-
- if (gst_caps_has_property (caps, "pixel_width") &&
- gst_caps_has_property (caps, "pixel_height")) {
- gst_caps_get (caps,
- "pixel_width", &pixel_width,
- "pixel_height", &pixel_height,
- NULL);
- if (pixel_width > pixel_height) {
- videocontext->display_width = width * pixel_width / pixel_height;
- videocontext->display_height = height;
- } else if (pixel_width < pixel_height) {
- videocontext->display_width = width;
- videocontext->display_height = height * pixel_height / pixel_width;
- } else {
- videocontext->display_width = 0;
- videocontext->display_height = 0;
- }
+ structure = gst_caps_get_structure (caps, 0);
+
+ mimetype = gst_structure_get_name (structure);
+
+ /* get general properties */
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "height", &height);
+ gst_structure_get_double (structure, "framerate", &framerate);
+
+ videocontext->pixel_width = width;
+ videocontext->pixel_height = height;
+ context->default_duration = GST_SECOND / framerate;
+
+ ret = gst_structure_get_int (structure, "pixel_width", &pixel_width);
+ ret &= gst_structure_get_int (structure, "pixel_height", &pixel_height);
+ if (ret) {
+ if (pixel_width > pixel_height) {
+ videocontext->display_width = width * pixel_width / pixel_height;
+ videocontext->display_height = height;
+ } else if (pixel_width < pixel_height) {
+ videocontext->display_width = width;
+ videocontext->display_height = height * pixel_height / pixel_width;
} else {
videocontext->display_width = 0;
videocontext->display_height = 0;
}
+ } else {
+ videocontext->display_width = 0;
+ videocontext->display_height = 0;
+ }
- videocontext->asr_mode = GST_MATROSKA_ASPECT_RATIO_MODE_FREE;
- videocontext->eye_mode = GST_MATROSKA_EYE_MODE_MONO;
- videocontext->fourcc = 0;
-
- /* find type */
- if (!strcmp (mimetype, "video/x-raw-yuv")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED);
- gst_caps_get_fourcc_int (caps, "format", &videocontext->fourcc);
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/x-jpeg")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MJPEG);
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/x-divx")) {
- gint divxversion;
-
- gst_caps_get_int (caps, "divxversion", &divxversion);
- switch (divxversion) {
- case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
- break;
- case 4:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP);
- break;
- case 5:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
- break;
- }
+ videocontext->asr_mode = GST_MATROSKA_ASPECT_RATIO_MODE_FREE;
+ videocontext->eye_mode = GST_MATROSKA_EYE_MODE_MONO;
+ videocontext->fourcc = 0;
+
+ /* find type */
+ if (!strcmp (mimetype, "video/x-raw-yuv")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED);
+ gst_structure_get_fourcc (structure, "format", &videocontext->fourcc);
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/x-jpeg")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MJPEG);
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/x-divx")) {
+ gint divxversion;
+
+ gst_structure_get_int (structure, "divxversion", &divxversion);
+ switch (divxversion) {
+ case 3:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
+ break;
+ case 4:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP);
+ break;
+ case 5:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+ break;
+ }
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/x-xvid")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/mpeg")) {
- gint mpegversion;
-
- gst_caps_get_int (caps, "mpegversion", &mpegversion);
- switch (mpegversion) {
- case 1:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1);
- break;
- case 2:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2);
- break;
- case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
- break;
- }
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/x-xvid")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/mpeg")) {
+ gint mpegversion;
+
+ gst_structure_get_int (structure, "mpegversion", &mpegversion);
+ switch (mpegversion) {
+ case 1:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG1);
+ break;
+ case 2:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG2);
+ break;
+ case 3:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
+ break;
+ }
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "video/x-msmpeg")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "video/x-msmpeg")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
- return GST_PAD_LINK_OK;
- }
+ return GST_PAD_LINK_OK;
}
return GST_PAD_LINK_REFUSED;
@@ -455,16 +416,14 @@ gst_matroska_mux_video_pad_link (GstPad *pad,
static GstPadLinkReturn
gst_matroska_mux_audio_pad_link (GstPad *pad,
- GstCaps *caps)
+ const GstCaps *caps)
{
GstMatroskaTrackContext *context = NULL;
GstMatroskaTrackAudioContext *audiocontext;
GstMatroskaMux *mux = GST_MATROSKA_MUX (gst_pad_get_parent (pad));
const gchar *mimetype;
gint samplerate, channels, i;
-
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ GstStructure *structure;
/* find context */
for (i = 0; i < mux->num_streams; i++) {
@@ -478,81 +437,77 @@ gst_matroska_mux_audio_pad_link (GstPad *pad,
g_assert (context->type == GST_MATROSKA_TRACK_TYPE_AUDIO);
audiocontext = (GstMatroskaTrackAudioContext *) context;
- for (; caps != NULL; caps = caps->next) {
- mimetype = gst_caps_get_mime (caps);
-
- /* general setup */
- gst_caps_get (caps,
- "rate", &samplerate,
- "channels", &channels,
- NULL);
- audiocontext->samplerate = samplerate;
- audiocontext->channels = channels;
- audiocontext->bitdepth = 0;
-
- if (!strcmp (mimetype, "audio/mpeg")) {
- gint mpegversion = 0;
-
- gst_caps_get_int (caps, "mpegversion", &mpegversion);
- switch (mpegversion) {
- case 1: {
- gint layer;
-
- gst_caps_get_int (caps, "layer", &layer);
- switch (layer) {
- case 1:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1);
- break;
- case 2:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2);
- break;
- case 3:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3);
- break;
- }
- break;
+ structure = gst_caps_get_structure (caps, 0);
+ mimetype = gst_structure_get_name (structure);
+
+ /* general setup */
+ gst_structure_get_int (structure, "rate", &samplerate);
+ gst_structure_get_int (structure, "channels", &channels);
+
+ audiocontext->samplerate = samplerate;
+ audiocontext->channels = channels;
+ audiocontext->bitdepth = 0;
+
+ if (!strcmp (mimetype, "audio/mpeg")) {
+ gint mpegversion = 0;
+
+ gst_structure_get_int (structure, "mpegversion", &mpegversion);
+ switch (mpegversion) {
+ case 1: {
+ gint layer;
+
+ gst_structure_get_int (structure, "layer", &layer);
+ switch (layer) {
+ case 1:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1);
+ break;
+ case 2:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2);
+ break;
+ case 3:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3);
+ break;
}
- case 2:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2
- "MAIN");
- break;
- case 4:
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4
- "MAIN");
- break;
+ break;
}
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "audio/x-raw-int")) {
- gint endianness, width, depth;
- gboolean signedness;
-
- gst_caps_get (caps,
- "endianness", &endianness,
- "width", &width,
- "depth", &depth,
- "signed", &signedness,
- NULL);
- if (width != depth ||
- (width == 8 && signedness) || (width != 8 && !signedness))
- continue;
-
- audiocontext->bitdepth = depth;
- if (endianness == G_BIG_ENDIAN)
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE);
- else
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE);
-
- return GST_PAD_LINK_OK;
- } else if (!strcmp (mimetype, "audio/x-raw-float")) {
- /* FIXME: endianness is undefined */
- } else if (!strcmp (mimetype, "audio/x-vorbis")) {
- /* FIXME: private data setup needs work */
- } else if (!strcmp (mimetype, "audio/x-ac3")) {
- context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_AC3);
-
- return GST_PAD_LINK_OK;
+ case 2:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG2
+ "MAIN");
+ break;
+ case 4:
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_MPEG4
+ "MAIN");
+ break;
}
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "audio/x-raw-int")) {
+ gint endianness, width, depth;
+ gboolean signedness;
+
+ gst_structure_get_int (structure, "endianness", &endianness);
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "depth", &depth);
+ gst_structure_get_int (structure, "signed", &signedness);
+ if (width != depth ||
+ (width == 8 && signedness) || (width == 16 && !signedness))
+ return GST_PAD_LINK_REFUSED;
+
+ audiocontext->bitdepth = depth;
+ if (endianness == G_BIG_ENDIAN)
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE);
+ else
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE);
+
+ return GST_PAD_LINK_OK;
+ } else if (!strcmp (mimetype, "audio/x-raw-float")) {
+ /* FIXME: endianness is undefined */
+ } else if (!strcmp (mimetype, "audio/x-vorbis")) {
+ /* FIXME: private data setup needs work */
+ } else if (!strcmp (mimetype, "audio/x-ac3")) {
+ context->codec_id = g_strdup (GST_MATROSKA_CODEC_ID_AUDIO_AC3);
+
+ return GST_PAD_LINK_OK;
}
return GST_PAD_LINK_REFUSED;
@@ -560,7 +515,7 @@ gst_matroska_mux_audio_pad_link (GstPad *pad,
static GstPadLinkReturn
gst_matroska_mux_subtitle_pad_link (GstPad *pad,
- GstCaps *caps)
+ const GstCaps *caps)
{
/* Consider this as boilerplate code for now. There is
* no single subtitle creation element in GStreamer,
@@ -749,10 +704,12 @@ gst_matroska_mux_start (GstMatroskaMux *mux)
gst_ebml_write_float (ebml, GST_MATROSKA_ID_DURATION, 0);
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_MUXINGAPP, "GStreamer");
if (mux->metadata &&
- gst_caps_has_property (mux->metadata, "application")) {
+ gst_structure_has_field (gst_caps_get_structure(mux->metadata,0),
+ "application")) {
const gchar *app;
- gst_caps_get_string (mux->metadata, "application", &app);
+ app = gst_structure_get_string (gst_caps_get_structure(mux->metadata, 0),
+ "application");
if (app && app[0]) {
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_WRITINGAPP, app);
}
diff --git a/gst/matroska/matroska-mux.h b/gst/matroska/matroska-mux.h
index b89f0d22..119237c9 100644
--- a/gst/matroska/matroska-mux.h
+++ b/gst/matroska/matroska-mux.h
@@ -62,7 +62,7 @@ typedef struct _GstMatroskaMux {
num_v_streams, num_a_streams, num_t_streams;
/* metadata - includes writing_app and creation_time */
- GstCaps *metadata;
+ GstCaps *metadata;
/* state */
GstMatroskaMuxState state;
diff --git a/gst/median/gstmedian.c b/gst/median/gstmedian.c
index b4d41660..719ed8d8 100644
--- a/gst/median/gstmedian.c
+++ b/gst/median/gstmedian.c
@@ -32,31 +32,21 @@ static GstElementDetails median_details = {
"Wim Taymans <wim.taymans@chello.be>"
};
-GST_PAD_TEMPLATE_FACTORY (median_src_factory,
+static GstStaticPadTemplate median_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "median_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420"))
- )
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
-GST_PAD_TEMPLATE_FACTORY (median_sink_factory,
+static GstStaticPadTemplate median_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "median_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420"))
- )
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
/* Median signals and args */
@@ -115,9 +105,9 @@ gst_median_base_init (GstMedianClass *klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (median_sink_factory));
+ gst_static_pad_template_get (&median_sink_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (median_src_factory));
+ gst_static_pad_template_get (&median_src_factory));
gst_element_class_set_details (element_class, &median_details);
}
@@ -147,32 +137,32 @@ gst_median_class_init (GstMedianClass *klass)
}
static gboolean
-gst_median_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_median_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstMedian *filter;
+ GstStructure *structure;
filter = GST_MEDIAN (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &filter->width);
- gst_caps_get_int (caps, "height", &filter->height);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
/* forward to the next plugin */
- return gst_pad_try_set_caps(filter->srcpad, gst_caps_copy_1(caps));
+ return gst_pad_try_set_caps(filter->srcpad, caps);
}
void gst_median_init (GstMedian *median)
{
median->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (median_sink_factory), "sink");
+ gst_static_pad_template_get (&median_sink_factory), "sink");
gst_pad_set_link_function (median->sinkpad, gst_median_sinkconnect);
gst_pad_set_chain_function (median->sinkpad, gst_median_chain);
gst_element_add_pad (GST_ELEMENT (median), median->sinkpad);
median->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (median_src_factory), "src");
+ gst_static_pad_template_get (&median_src_factory), "src");
gst_element_add_pad (GST_ELEMENT (median), median->srcpad);
median->filtersize = 5;
diff --git a/gst/monoscope/gstmonoscope.c b/gst/monoscope/gstmonoscope.c
index 5d64b5c8..37ab9f2c 100644
--- a/gst/monoscope/gstmonoscope.c
+++ b/gst/monoscope/gstmonoscope.c
@@ -23,6 +23,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
+#include <gst/audio/audio.h>
#include "monoscope.h"
#define GST_TYPE_MONOSCOPE (gst_monoscope_get_type())
@@ -39,14 +40,13 @@ struct _GstMonoscope {
/* pads */
GstPad *sinkpad,*srcpad;
- GstBufferPool *peerpool;
/* the timestamp of the next frame */
guint64 next_time;
gint16 datain[512];
/* video state */
- gfloat fps;
+ gdouble fps;
gint width;
gint height;
gboolean first_buffer;
@@ -81,41 +81,21 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (src_template,
+static GstStaticPadTemplate src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "monoscopesrc",
- "video/x-raw-rgb",
- "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", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32)
+);
-GST_PAD_TEMPLATE_FACTORY (sink_template,
- "sink", /* the name of the pads */
- GST_PAD_SINK, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "monoscopesink", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- /* Properties follow: */
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (8000, 96000),
- "channels", GST_PROPS_INT (1)
- )
-)
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS)
+);
static void gst_monoscope_class_init (GstMonoscopeClass *klass);
@@ -125,9 +105,9 @@ static void gst_monoscope_init (GstMonoscope *monoscope);
static void gst_monoscope_chain (GstPad *pad, GstData *_data);
static GstPadLinkReturn
- gst_monoscope_sinkconnect (GstPad *pad, GstCaps *caps);
+ gst_monoscope_sinkconnect (GstPad *pad, const GstCaps *caps);
static GstPadLinkReturn
- gst_monoscope_srcconnect (GstPad *pad, GstCaps *caps);
+ gst_monoscope_srcconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
@@ -159,9 +139,9 @@ gst_monoscope_base_init (GstMonoscopeClass *klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_template));
+ gst_static_pad_template_get (&src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_template));
+ gst_static_pad_template_get (&sink_template));
gst_element_class_set_details (element_class, &gst_monoscope_details);
}
@@ -182,9 +162,9 @@ gst_monoscope_init (GstMonoscope *monoscope)
{
/* create the sink and src pads */
monoscope->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_template ), "sink");
+ gst_static_pad_template_get (&sink_template ), "sink");
monoscope->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_template ), "src");
+ gst_static_pad_template_get (&src_template ), "src");
gst_element_add_pad (GST_ELEMENT (monoscope), monoscope->sinkpad);
gst_element_add_pad (GST_ELEMENT (monoscope), monoscope->srcpad);
@@ -193,7 +173,6 @@ gst_monoscope_init (GstMonoscope *monoscope)
gst_pad_set_link_function (monoscope->srcpad, gst_monoscope_srcconnect);
monoscope->next_time = 0;
- monoscope->peerpool = NULL;
/* reset the initial video state */
monoscope->first_buffer = TRUE;
@@ -203,15 +182,11 @@ gst_monoscope_init (GstMonoscope *monoscope)
}
static GstPadLinkReturn
-gst_monoscope_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_monoscope_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstMonoscope *monoscope;
monoscope = GST_MONOSCOPE (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
-
return GST_PAD_LINK_OK;
}
@@ -220,38 +195,32 @@ gst_monoscope_negotiate (GstMonoscope *monoscope)
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "monoscopesrc",
- "video/x-raw-rgb",
- "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", GST_PROPS_INT (monoscope->width),
- "height", GST_PROPS_INT (monoscope->height),
- "framerate", GST_PROPS_FLOAT (monoscope->fps)
- );
+ caps = gst_caps_new_simple ("video/x-raw-rgb",
+ "bpp", G_TYPE_INT, 32,
+ "depth", G_TYPE_INT, 32,
+ "endianness", G_TYPE_INT, G_BIG_ENDIAN,
+ "red_mask", G_TYPE_INT, R_MASK_32,
+ "green_mask", G_TYPE_INT, G_MASK_32,
+ "blue_mask", G_TYPE_INT, B_MASK_32,
+ "width", G_TYPE_INT, monoscope->width,
+ "height", G_TYPE_INT, monoscope->height,
+ "framerate", G_TYPE_DOUBLE, monoscope->fps, NULL);
return gst_pad_try_set_caps (monoscope->srcpad, caps);
}
static GstPadLinkReturn
-gst_monoscope_srcconnect (GstPad *pad, GstCaps *caps)
+gst_monoscope_srcconnect (GstPad *pad, const GstCaps *caps)
{
GstPadLinkReturn ret;
GstMonoscope *monoscope = GST_MONOSCOPE (gst_pad_get_parent (pad));
+ GstStructure *structure;
- if (gst_caps_has_property_typed (caps, "width", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "width", &monoscope->width);
- }
- if (gst_caps_has_property_typed (caps, "height", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "height", &monoscope->height);
- }
- if (gst_caps_has_property_typed (caps, "framerate", GST_PROPS_FLOAT_TYPE)) {
- gst_caps_get_float (caps, "framerate", &monoscope->fps);
- }
+ structure = gst_caps_get_structure (caps, 0);
+
+ gst_structure_get_int (structure, "width", &monoscope->width);
+ gst_structure_get_int (structure, "height", &monoscope->height);
+ gst_structure_get_double (structure, "framerate", &monoscope->fps);
if ((ret = gst_monoscope_negotiate (monoscope)) <= 0)
return ret;
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index 623f69b2..e1fc8712 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -111,23 +111,30 @@ enum {
ARG_0
};
-GST_PAD_TEMPLATE_FACTORY (sink_templ,
+static GstStaticPadTemplate gst_qtdemux_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "qtdemux_sink",
- "video/quicktime",
- NULL
- ),
- GST_CAPS_NEW (
- "qtdemux_sink",
- "audio/x-m4a",
- NULL
- )
-)
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS_ANY
+);
+
+static GstStaticPadTemplate gst_qtdemux_videosrc_template =
+GST_STATIC_PAD_TEMPLATE (
+ "audio_%02d",
+ GST_PAD_SRC,
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS_ANY
+);
+
+static GstStaticPadTemplate gst_qtdemux_audiosrc_template =
+GST_STATIC_PAD_TEMPLATE (
+ "video_%02d",
+ GST_PAD_SRC,
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS_ANY
+);
-static GstPadTemplate *videosrctempl, *audiosrctempl;
static GstElementClass *parent_class = NULL;
static void gst_qtdemux_class_init (GstQTDemuxClass *klass);
@@ -167,10 +174,13 @@ static void gst_qtdemux_base_init (GstQTDemuxClass *klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_templ));
- gst_element_class_add_pad_template (element_class, videosrctempl);
- gst_element_class_add_pad_template (element_class, audiosrctempl);
+ gst_static_pad_template_get (&gst_qtdemux_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_qtdemux_videosrc_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_qtdemux_audiosrc_template));
gst_element_class_set_details (element_class, &gst_qtdemux_details);
+
}
static void gst_qtdemux_class_init (GstQTDemuxClass *klass)
@@ -189,14 +199,17 @@ static void gst_qtdemux_class_init (GstQTDemuxClass *klass)
static void
gst_qtdemux_init (GstQTDemux *qtdemux)
{
- qtdemux->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_templ), "sink");
- gst_element_set_loop_function (GST_ELEMENT (qtdemux), gst_qtdemux_loop_header);
+ qtdemux->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_qtdemux_sink_template), "sink");
+ gst_element_set_loop_function (GST_ELEMENT (qtdemux),
+ gst_qtdemux_loop_header);
gst_element_add_pad (GST_ELEMENT (qtdemux), qtdemux->sinkpad);
}
static gboolean
plugin_init (GstPlugin *plugin)
{
+#if 0
GstCaps *audiocaps = NULL, *videocaps = NULL, *temp;
const guint32 audio_fcc[] = {
/* FILLME */
@@ -227,6 +240,7 @@ plugin_init (GstPlugin *plugin)
GST_PAD_SRC,
GST_PAD_SOMETIMES,
videocaps, NULL);
+#endif
return gst_element_register (plugin, "qtdemux",
GST_RANK_PRIMARY, GST_TYPE_QTDEMUX);
@@ -484,9 +498,8 @@ static void gst_qtdemux_loop_header (GstElement *element)
if(stream->subtype == GST_MAKE_FOURCC('v','i','d','e')){
float fps = 1. * GST_SECOND / stream->samples[stream->sample_index].duration;
if (fps != stream->fps) {
- gst_props_remove_entry_by_name(stream->caps->properties, "framerate");
- gst_props_add_entry(stream->caps->properties,
- gst_props_entry_new("framerate", GST_PROPS_FLOAT(fps)));
+ gst_caps_set_simple (stream->caps, "framerate", G_TYPE_DOUBLE, fps,
+ NULL);
stream->fps = fps;
gst_pad_try_set_caps(stream->pad, stream->caps);
}
@@ -506,11 +519,10 @@ static void gst_qtdemux_loop_header (GstElement *element)
}
-static GstCaps *gst_qtdemux_src_getcaps(GstPad *pad, GstCaps *caps)
+static GstCaps *gst_qtdemux_src_getcaps(GstPad *pad)
{
GstQTDemux *qtdemux;
QtDemuxStream *stream;
- int i;
GST_DEBUG ("gst_qtdemux_src_getcaps");
@@ -518,20 +530,12 @@ static GstCaps *gst_qtdemux_src_getcaps(GstPad *pad, GstCaps *caps)
g_return_val_if_fail(GST_IS_QTDEMUX(qtdemux), NULL);
- GST_DEBUG ("looking for pad %p in qtdemux %p", pad, qtdemux);
- GST_DEBUG ("n_streams is %d", qtdemux->n_streams);
- for(i=0;i<qtdemux->n_streams;i++){
- stream = qtdemux->streams[i];
- if(stream->pad == pad){
- return stream->caps;
- }
- }
-
- GST_DEBUG ("Couldn't find stream cooresponding to pad\n");
-
- return NULL;
+ stream = GST_PAD_ELEMENT_PRIVATE (pad);
+ return gst_caps_copy(stream->caps);
}
+#if 0
+/* This function doesn't do anything useful, but might be useful later */
static GstPadLinkReturn
gst_qtdemux_src_link(GstPad *pad, GstCaps *caps)
{
@@ -559,42 +563,40 @@ gst_qtdemux_src_link(GstPad *pad, GstCaps *caps)
return GST_PAD_LINK_REFUSED;
}
+#endif
void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
{
if(stream->subtype == GST_MAKE_FOURCC('v','i','d','e')){
- stream->pad = gst_pad_new_from_template (videosrctempl,
+ stream->pad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_qtdemux_videosrc_template),
g_strdup_printf ("video_%02d", qtdemux->n_video_streams));
stream->fps = 1. * GST_SECOND / stream->samples[0].duration;
if(stream->caps){
- GstProps *properties = gst_props_intersect(
- stream->caps->properties,
- gst_props_new("width",GST_PROPS_INT(stream->width),
- "height",GST_PROPS_INT(stream->height),
- "framerate", GST_PROPS_FLOAT(stream->fps), NULL));
- if (stream->caps->properties != NULL)
- gst_props_unref (stream->caps->properties);
- stream->caps->properties = properties;
+ gst_caps_set_simple(stream->caps,
+ "width", G_TYPE_INT, stream->width,
+ "height", G_TYPE_INT, stream->height,
+ "framerate", G_TYPE_DOUBLE, stream->fps, NULL);
}
qtdemux->n_video_streams++;
}else{
- stream->pad = gst_pad_new_from_template (audiosrctempl,
+ stream->pad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_qtdemux_audiosrc_template),
g_strdup_printf ("audio_%02d", qtdemux->n_audio_streams));
if(stream->caps){
- GstProps *properties = gst_props_intersect(
- stream->caps->properties,
- gst_props_new("rate",GST_PROPS_INT((int)stream->rate),
- "channels",GST_PROPS_INT(stream->n_channels), NULL));
- if (stream->caps->properties != NULL)
- gst_props_unref (stream->caps->properties);
- stream->caps->properties = properties;
+ gst_caps_set_simple(stream->caps,
+ "rate", G_TYPE_INT, (int)stream->rate,
+ "channels", G_TYPE_INT, stream->n_channels, NULL);
}
qtdemux->n_audio_streams++;
}
gst_pad_set_getcaps_function(stream->pad, gst_qtdemux_src_getcaps);
+#ifdef unused
gst_pad_set_link_function(stream->pad, gst_qtdemux_src_link);
+#endif
+ GST_PAD_ELEMENT_PRIVATE(stream->pad) = stream;
qtdemux->streams[qtdemux->n_streams] = stream;
qtdemux->n_streams++;
GST_DEBUG ("n_streams is now %d", qtdemux->n_streams);
@@ -604,7 +606,7 @@ void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
/* Note: we need to have everything set up before calling try_set_caps */
if(stream->caps){
- g_print("setting caps to %s\n",gst_caps_to_string(stream->caps));
+ GST_DEBUG_CAPS ("setting caps",stream->caps);
gst_pad_try_set_caps(stream->pad, stream->caps);
}
@@ -1358,11 +1360,6 @@ static void qtdemux_parse_trak(GstQTDemux *qtdemux, GNode *trak)
return;
}
- if(stream->caps){
- gst_caps_ref(stream->caps);
- gst_caps_sink(stream->caps);
- }
-
/* sample to chunk */
stsc = qtdemux_tree_get_child_by_type(stbl, FOURCC_stsc);
g_assert(stsc);
@@ -1528,87 +1525,51 @@ static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc)
switch(fourcc){
case GST_MAKE_FOURCC('j','p','e','g'):
/* JPEG */
- return GST_CAPS_NEW("jpeg_caps","image/jpeg",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("image/jpeg");
case GST_MAKE_FOURCC('m','j','p','a'):
/* Motion-JPEG (format A) */
- return GST_CAPS_NEW("mjpa_caps","image/jpeg",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("image/jpeg");
case GST_MAKE_FOURCC('m','j','p','b'):
/* Motion-JPEG (format B) */
- return GST_CAPS_NEW("mjpb_caps","image/jpeg",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("image/jpeg");
case GST_MAKE_FOURCC('S','V','Q','3'):
- return GST_CAPS_NEW("SVQ3_caps","video/x-svq",
- "svqversion", GST_PROPS_INT(3),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-svq, "
+ "svqversion = (int) 3");
case GST_MAKE_FOURCC('s','v','q','i'):
case GST_MAKE_FOURCC('S','V','Q','1'):
- return GST_CAPS_NEW("SVQ1_caps","video/x-svq",
- "svqversion", GST_PROPS_INT(1),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-svq, "
+ "svqversion = (int) 1");
case GST_MAKE_FOURCC('r','a','w',' '):
/* uncompressed RGB */
- return GST_CAPS_NEW("raw__caps","video/x-raw-rgb",
- "endianness",GST_PROPS_INT(G_BIG_ENDIAN),
+ return gst_caps_from_string ("video/x-raw-rgb, "
+ "endianness = (int) BIG_ENDIAN");
/*"bpp", GST_PROPS_INT(x),
"depth", GST_PROPS_INT(x),
"red_mask", GST_PROPS_INT(x),
"green_mask", GST_PROPS_INT(x),
"blue_mask", GST_PROPS_INT(x), FIXME! */
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('Y','u','v','2'):
/* uncompressed YUV2 */
- return GST_CAPS_NEW("Yuv2_caps","video/x-raw-yuv",
- "format",GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','V','2')),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-raw-yuv, "
+ "format = (fourcc) YUY2");
case GST_MAKE_FOURCC('m','p','e','g'):
/* MPEG */
- return GST_CAPS_NEW("mpeg_caps","video/mpeg",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "systemstream", GST_PROPS_BOOLEAN(FALSE),
- "mpegversion", GST_PROPS_INT(1));
+ return gst_caps_from_string ("video/mpeg, "
+ "systemstream = (boolean) false, "
+ "mpegversion = (int) 1");
case GST_MAKE_FOURCC('g','i','f',' '):
- return GST_CAPS_NEW("gif__caps","image/gif",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("image/gif");
case GST_MAKE_FOURCC('h','2','6','3'):
/* H.263 */
/* ffmpeg uses the height/width props, don't know why */
- return GST_CAPS_NEW("h263_caps","video/x-h263",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-h263");
case GST_MAKE_FOURCC('m','p','4','v'):
/* MPEG-4 */
- return GST_CAPS_NEW("mp4v_caps", "video/mpeg",
- "mpegversion",GST_PROPS_INT(4),
- "systemstream", GST_PROPS_BOOLEAN(FALSE),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/mpeg, "
+ "mpegversion = (int) 4, "
+ "systemstream = (boolean) false");
case GST_MAKE_FOURCC('3','I','V','1'):
- return GST_CAPS_NEW("3IV1_caps", "video/x-3ivx",
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096));
+ return gst_caps_from_string ("video/x-3ivx");
case GST_MAKE_FOURCC('r','p','z','a'):
case GST_MAKE_FOURCC('c','v','i','d'):
/* Cinepak */
@@ -1617,7 +1578,7 @@ static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc)
case GST_MAKE_FOURCC('s','m','c',' '):
case GST_MAKE_FOURCC('k','p','c','d'):
default:
- g_print("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
+ g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
"' to caps\n", GST_FOURCC_ARGS(fourcc));
return NULL;
}
@@ -1627,130 +1588,89 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
{
switch(fourcc){
case GST_MAKE_FOURCC('N','O','N','E'):
- return NULL; /*GST_CAPS_NEW("NONE_caps","audio/raw",NULL);*/
+ return NULL; /*gst_caps_from_string ("audio/raw");*/
case GST_MAKE_FOURCC('r','a','w',' '):
/* FIXME */
- return GST_CAPS_NEW("raw__caps","audio/x-raw-int",
- "width",GST_PROPS_INT(8),
- "depth",GST_PROPS_INT(8),
- "signed",GST_PROPS_BOOLEAN(FALSE),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('t','w','o','s'):
/* FIXME */
- return GST_CAPS_NEW("twos_caps","audio/x-raw-int",
- "width",GST_PROPS_INT(16),
- "depth",GST_PROPS_INT(16),
- "endianness",GST_PROPS_INT(G_BIG_ENDIAN),
- "signed",GST_PROPS_BOOLEAN(TRUE),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "endianness = (int) G_BIG_ENDIAN, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('s','o','w','t'):
/* FIXME */
- return GST_CAPS_NEW("sowt_caps","audio/x-raw-int",
- "width",GST_PROPS_INT(16),
- "depth",GST_PROPS_INT(16),
- "endianness",GST_PROPS_INT(G_LITTLE_ENDIAN),
- "signed",GST_PROPS_BOOLEAN(TRUE),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "endianness = (int) G_LITTLE_ENDIAN, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('f','l','6','4'):
- return GST_CAPS_NEW("fl64_caps","audio/x-raw-float",
- "width",GST_PROPS_INT (64),
- "endianness",GST_PROPS_INT (G_BIG_ENDIAN),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-float, "
+ "width = (int) 64, "
+ "endianness = (int) G_BIG_ENDIAN");
case GST_MAKE_FOURCC('f','l','3','2'):
- return GST_CAPS_NEW("fl32_caps","audio/x-raw-float",
- "width",GST_PROPS_INT (32),
- "endianness",GST_PROPS_INT (G_BIG_ENDIAN),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-float, "
+ "width = (int) 32, "
+ "endianness = (int) G_BIG_ENDIAN");
case GST_MAKE_FOURCC('i','n','2','4'):
/* FIXME */
- return GST_CAPS_NEW("in24_caps","audio/x-raw-int",
- "width",GST_PROPS_INT(24),
- "depth",GST_PROPS_INT(32),
- "endianness",GST_PROPS_INT(G_BIG_ENDIAN),
- "signed",GST_PROPS_BOOLEAN(TRUE),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 24, "
+ "depth = (int) 32, "
+ "endianness = (int) G_BIG_ENDIAN, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('i','n','3','2'):
/* FIXME */
- return GST_CAPS_NEW("in32_caps","audio/x-raw-int",
- "width",GST_PROPS_INT(24),
- "depth",GST_PROPS_INT(32),
- "endianness",GST_PROPS_INT(G_BIG_ENDIAN),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-raw-int, "
+ "width = (int) 32, "
+ "depth = (int) 32, "
+ "endianness = (int) G_BIG_ENDIAN, "
+ "signed = (boolean) true");
case GST_MAKE_FOURCC('u','l','a','w'):
/* FIXME */
- return GST_CAPS_NEW("ulaw_caps","audio/x-mulaw",
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-mulaw");
case GST_MAKE_FOURCC('a','l','a','w'):
/* FIXME */
- return GST_CAPS_NEW("alaw_caps","audio/x-alaw",
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
+ return gst_caps_from_string ("audio/x-alaw");
case 0x6d730002:
/* Microsoft ADPCM-ACM code 2 */
- return GST_CAPS_NEW("msxx_caps","audio/x-adpcm",
- "layout", GST_PROPS_STRING("microsoft"),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-adpcm, "
+ "layout = (string) microsoft");
case 0x6d730011:
/* FIXME DVI/Intel IMA ADPCM/ACM code 17 */
- return GST_CAPS_NEW("msxx_caps","audio/x-adpcm",
- "layout", GST_PROPS_STRING("quicktime"),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-adpcm, "
+ "layout = (string) quicktime");
case 0x6d730055:
/* MPEG layer 3, CBR only (pre QT4.1) */
case 0x5500736d:
case GST_MAKE_FOURCC('.','m','p','3'):
/* MPEG layer 3, CBR & VBR (QT4.1 and later) */
- return GST_CAPS_NEW("_mp3_caps","audio/mpeg",
- "mpegversion", GST_PROPS_INT(1),
- "layer", GST_PROPS_INT(3),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/mpeg, "
+ "layer = (int) 3, "
+ "mpegversion = (int) 1");
case GST_MAKE_FOURCC('M','A','C','3'):
/* MACE 3:1 */
- return GST_CAPS_NEW("MAC3_caps","audio/x-mace",
- "maceversion",GST_PROPS_INT(3),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-mace, "
+ "maceversion = (int) 3");
case GST_MAKE_FOURCC('M','A','C','6'):
/* MACE 6:1 */
- return GST_CAPS_NEW("MAC3_caps","audio/x-mace",
- "maceversion",GST_PROPS_INT(6),
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-mace, "
+ "maceversion = (int) 6");
case GST_MAKE_FOURCC('O','g','g','V'):
/* Ogg Vorbis */
- return GST_CAPS_NEW("OggV_caps","application/ogg",
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("application/ogg");
case GST_MAKE_FOURCC('d','v','c','a'):
/* DV audio */
- return GST_CAPS_NEW("dvca_caps","audio/x-dv",
- "rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
- "channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
- NULL);
+ return gst_caps_from_string ("audio/x-dv");
case GST_MAKE_FOURCC('m','p','4','a'):
/* MPEG-4 AAC */
- return GST_CAPS_NEW("mp4a_caps", "audio/mpeg",
- "mpegversion", GST_PROPS_INT(4),
- "rate", GST_PROPS_INT_RANGE(1, G_MAXINT),
- "channels", GST_PROPS_INT_RANGE(1, G_MAXINT),
- "systemstream", GST_PROPS_BOOLEAN(FALSE), NULL);
+ return gst_caps_from_string ("audio/mpeg, "
+ "mpegversion = (int) 4");
case GST_MAKE_FOURCC('q','t','v','r'):
/* ? */
case GST_MAKE_FOURCC('Q','D','M','2'):
@@ -1764,7 +1684,7 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
case GST_MAKE_FOURCC('a','g','s','m'):
/* ? */
default:
- g_print("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
+ g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
"' to caps\n", GST_FOURCC_ARGS(fourcc));
return NULL;
}
diff --git a/gst/rtp/gstrtpL16depay.c b/gst/rtp/gstrtpL16depay.c
index 3a18e295..16d128c6 100644
--- a/gst/rtp/gstrtpL16depay.c
+++ b/gst/rtp/gstrtpL16depay.c
@@ -41,29 +41,27 @@ enum
ARG_PAYLOAD_TYPE,
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2))
-)
-
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpL16parse_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
+ )
+);
+
+static GstStaticPadTemplate gst_rtpL16parse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass);
@@ -108,9 +106,9 @@ gst_rtpL16parse_base_init (GstRtpL16ParseClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpL16parse_src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpL16parse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_L16parse_details);
}
@@ -141,8 +139,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass)
static void
gst_rtpL16parse_init (GstRtpL16Parse * rtpL16parse)
{
- rtpL16parse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
- rtpL16parse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ rtpL16parse->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16parse_src_template), "src");
+ rtpL16parse->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16parse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->sinkpad);
gst_pad_set_chain_function (rtpL16parse->sinkpad, gst_rtpL16parse_chain);
@@ -172,15 +172,11 @@ gst_rtpL16_caps_nego (GstRtpL16Parse *rtpL16parse)
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT (rtpL16parse->frequency),
- "channels", GST_PROPS_INT (rtpL16parse->channels));
+ caps = gst_caps_copy(gst_static_caps_get (&gst_rtpL16parse_src_template.static_caps));
+
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT, rtpL16parse->frequency,
+ "channel", G_TYPE_INT, rtpL16parse->channels, NULL);
gst_pad_try_set_caps (rtpL16parse->srcpad, caps);
}
diff --git a/gst/rtp/gstrtpL16enc.c b/gst/rtp/gstrtpL16enc.c
index 610ef051..45d6a95a 100644
--- a/gst/rtp/gstrtpL16enc.c
+++ b/gst/rtp/gstrtpL16enc.c
@@ -44,30 +44,27 @@ enum
ARG_0,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- )
+static GstStaticPadTemplate gst_rtpL16enc_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
+ )
);
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpL16enc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16enc_class_init (GstRtpL16EncClass * klass);
@@ -78,7 +75,7 @@ static void gst_rtpL16enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_rtpL16enc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps);
+static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps);
static GstElementStateReturn gst_rtpL16enc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
@@ -111,9 +108,9 @@ gst_rtpL16enc_base_init (GstRtpL16EncClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpL16enc_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpL16enc_src_template));
gst_element_class_set_details (element_class, &gst_rtpL16enc_details);
}
@@ -137,8 +134,10 @@ gst_rtpL16enc_class_init (GstRtpL16EncClass * klass)
static void
gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
{
- rtpL16enc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
- rtpL16enc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
+ rtpL16enc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16enc_sink_template), "sink");
+ rtpL16enc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16enc_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->srcpad);
gst_pad_set_chain_function (rtpL16enc->sinkpad, gst_rtpL16enc_chain);
@@ -155,14 +154,20 @@ gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
}
static GstPadLinkReturn
-gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRtpL16Enc *rtpL16enc;
+ GstStructure *structure;
+ gboolean ret;
rtpL16enc = GST_RTP_L16_ENC (gst_pad_get_parent (pad));
- gst_caps_get_int (caps, "rate", &rtpL16enc->frequency);
- gst_caps_get_int (caps, "channels", &rtpL16enc->channels);
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rtpL16enc->frequency);
+ ret &= gst_structure_get_int (structure, "channels", &rtpL16enc->channels);
+
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpL16enc->time_interval = GST_SECOND / (2 * rtpL16enc->channels * rtpL16enc->frequency);
diff --git a/gst/rtp/gstrtpL16parse.c b/gst/rtp/gstrtpL16parse.c
index 3a18e295..16d128c6 100644
--- a/gst/rtp/gstrtpL16parse.c
+++ b/gst/rtp/gstrtpL16parse.c
@@ -41,29 +41,27 @@ enum
ARG_PAYLOAD_TYPE,
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2))
-)
-
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpL16parse_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
+ )
+);
+
+static GstStaticPadTemplate gst_rtpL16parse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass);
@@ -108,9 +106,9 @@ gst_rtpL16parse_base_init (GstRtpL16ParseClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpL16parse_src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpL16parse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_L16parse_details);
}
@@ -141,8 +139,10 @@ gst_rtpL16parse_class_init (GstRtpL16ParseClass * klass)
static void
gst_rtpL16parse_init (GstRtpL16Parse * rtpL16parse)
{
- rtpL16parse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
- rtpL16parse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ rtpL16parse->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16parse_src_template), "src");
+ rtpL16parse->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16parse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpL16parse), rtpL16parse->sinkpad);
gst_pad_set_chain_function (rtpL16parse->sinkpad, gst_rtpL16parse_chain);
@@ -172,15 +172,11 @@ gst_rtpL16_caps_nego (GstRtpL16Parse *rtpL16parse)
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT (rtpL16parse->frequency),
- "channels", GST_PROPS_INT (rtpL16parse->channels));
+ caps = gst_caps_copy(gst_static_caps_get (&gst_rtpL16parse_src_template.static_caps));
+
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT, rtpL16parse->frequency,
+ "channel", G_TYPE_INT, rtpL16parse->channels, NULL);
gst_pad_try_set_caps (rtpL16parse->srcpad, caps);
}
diff --git a/gst/rtp/gstrtpL16pay.c b/gst/rtp/gstrtpL16pay.c
index 610ef051..45d6a95a 100644
--- a/gst/rtp/gstrtpL16pay.c
+++ b/gst/rtp/gstrtpL16pay.c
@@ -44,30 +44,27 @@ enum
ARG_0,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audio_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
- )
+static GstStaticPadTemplate gst_rtpL16enc_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) [ 1, 2 ]"
+ )
);
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpL16enc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
);
static void gst_rtpL16enc_class_init (GstRtpL16EncClass * klass);
@@ -78,7 +75,7 @@ static void gst_rtpL16enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_rtpL16enc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps);
+static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps);
static GstElementStateReturn gst_rtpL16enc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
@@ -111,9 +108,9 @@ gst_rtpL16enc_base_init (GstRtpL16EncClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpL16enc_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpL16enc_src_template));
gst_element_class_set_details (element_class, &gst_rtpL16enc_details);
}
@@ -137,8 +134,10 @@ gst_rtpL16enc_class_init (GstRtpL16EncClass * klass)
static void
gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
{
- rtpL16enc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
- rtpL16enc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
+ rtpL16enc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16enc_sink_template), "sink");
+ rtpL16enc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpL16enc_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->srcpad);
gst_pad_set_chain_function (rtpL16enc->sinkpad, gst_rtpL16enc_chain);
@@ -155,14 +154,20 @@ gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc)
}
static GstPadLinkReturn
-gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRtpL16Enc *rtpL16enc;
+ GstStructure *structure;
+ gboolean ret;
rtpL16enc = GST_RTP_L16_ENC (gst_pad_get_parent (pad));
- gst_caps_get_int (caps, "rate", &rtpL16enc->frequency);
- gst_caps_get_int (caps, "channels", &rtpL16enc->channels);
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rtpL16enc->frequency);
+ ret &= gst_structure_get_int (structure, "channels", &rtpL16enc->channels);
+
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpL16enc->time_interval = GST_SECOND / (2 * rtpL16enc->channels * rtpL16enc->frequency);
diff --git a/gst/rtp/gstrtpgsmdepay.c b/gst/rtp/gstrtpgsmdepay.c
index edc027b1..8f1b301a 100644
--- a/gst/rtp/gstrtpgsmdepay.c
+++ b/gst/rtp/gstrtpgsmdepay.c
@@ -41,26 +41,25 @@ enum
ARG_FREQUENCY
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000))
-)
-
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpgsmparse_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ]"
+ )
);
+static GstStaticPadTemplate gst_rtpgsmparse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
+);
+
+
static void gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_base_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse);
@@ -103,9 +102,9 @@ gst_rtpgsmparse_base_init (GstRtpGSMParseClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get(&gst_rtpgsmparse_src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get(&gst_rtpgsmparse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_gsmparse_details);
}
@@ -133,8 +132,10 @@ gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass)
static void
gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse)
{
- rtpgsmparse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
- rtpgsmparse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ rtpgsmparse->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_rtpgsmparse_src_template), "src");
+ rtpgsmparse->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_rtpgsmparse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->sinkpad);
gst_pad_set_chain_function (rtpgsmparse->sinkpad, gst_rtpgsmparse_chain);
@@ -161,10 +162,8 @@ gst_rtpgsm_caps_nego (GstRtpGSMParse *rtpgsmparse)
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT (rtpgsmparse->frequency));
+ caps = gst_caps_new_simple ("audio/x-gsm",
+ "rate", G_TYPE_INT, rtpgsmparse->frequency);
gst_pad_try_set_caps (rtpgsmparse->srcpad, caps);
}
diff --git a/gst/rtp/gstrtpgsmenc.c b/gst/rtp/gstrtpgsmenc.c
index c32e32f8..495e4367 100644
--- a/gst/rtp/gstrtpgsmenc.c
+++ b/gst/rtp/gstrtpgsmenc.c
@@ -45,26 +45,24 @@ enum
ARG_0,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000)
- )
-)
-
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
-)
+static GstStaticPadTemplate gst_rtpgsmenc_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ]"
+ )
+);
+
+static GstStaticPadTemplate gst_rtpgsmenc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
+);
+
static void gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass);
static void gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass);
@@ -74,7 +72,7 @@ static void gst_rtpgsmenc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_rtpgsmenc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps);
+static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps * caps);
static GstElementStateReturn gst_rtpgsmenc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
@@ -107,9 +105,9 @@ gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpgsmenc_src_template));
gst_element_class_set_details (element_class, &gst_rtpgsmenc_details);
}
@@ -133,8 +131,10 @@ gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass)
static void
gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
{
- rtpgsmenc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
- rtpgsmenc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
+ rtpgsmenc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "sink");
+ rtpgsmenc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->srcpad);
gst_pad_set_chain_function (rtpgsmenc->sinkpad, gst_rtpgsmenc_chain);
@@ -150,13 +150,18 @@ gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
}
static GstPadLinkReturn
-gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRtpGSMEnc *rtpgsmenc;
+ GstStructure *structure;
+ gboolean ret;
rtpgsmenc = GST_RTP_GSM_ENC (gst_pad_get_parent (pad));
- gst_caps_get_int (caps, "rate", &rtpgsmenc->frequency);
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rtpgsmenc->frequency);
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpgsmenc->time_interval = GST_SECOND / (2 * rtpgsmenc->frequency);
diff --git a/gst/rtp/gstrtpgsmparse.c b/gst/rtp/gstrtpgsmparse.c
index edc027b1..8f1b301a 100644
--- a/gst/rtp/gstrtpgsmparse.c
+++ b/gst/rtp/gstrtpgsmparse.c
@@ -41,26 +41,25 @@ enum
ARG_FREQUENCY
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000))
-)
-
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
+static GstStaticPadTemplate gst_rtpgsmparse_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ]"
+ )
);
+static GstStaticPadTemplate gst_rtpgsmparse_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
+);
+
+
static void gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_base_init (GstRtpGSMParseClass * klass);
static void gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse);
@@ -103,9 +102,9 @@ gst_rtpgsmparse_base_init (GstRtpGSMParseClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get(&gst_rtpgsmparse_src_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get(&gst_rtpgsmparse_sink_template));
gst_element_class_set_details (element_class, &gst_rtp_gsmparse_details);
}
@@ -133,8 +132,10 @@ gst_rtpgsmparse_class_init (GstRtpGSMParseClass * klass)
static void
gst_rtpgsmparse_init (GstRtpGSMParse * rtpgsmparse)
{
- rtpgsmparse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
- rtpgsmparse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ rtpgsmparse->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_rtpgsmparse_src_template), "src");
+ rtpgsmparse->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get(&gst_rtpgsmparse_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->srcpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmparse), rtpgsmparse->sinkpad);
gst_pad_set_chain_function (rtpgsmparse->sinkpad, gst_rtpgsmparse_chain);
@@ -161,10 +162,8 @@ gst_rtpgsm_caps_nego (GstRtpGSMParse *rtpgsmparse)
{
GstCaps *caps;
- caps = GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT (rtpgsmparse->frequency));
+ caps = gst_caps_new_simple ("audio/x-gsm",
+ "rate", G_TYPE_INT, rtpgsmparse->frequency);
gst_pad_try_set_caps (rtpgsmparse->srcpad, caps);
}
diff --git a/gst/rtp/gstrtpgsmpay.c b/gst/rtp/gstrtpgsmpay.c
index c32e32f8..495e4367 100644
--- a/gst/rtp/gstrtpgsmpay.c
+++ b/gst/rtp/gstrtpgsmpay.c
@@ -45,26 +45,24 @@ enum
ARG_0,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000)
- )
-)
-
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "rtp",
- "application/x-rtp",
- NULL)
-)
+static GstStaticPadTemplate gst_rtpgsmenc_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ( "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ]"
+ )
+);
+
+static GstStaticPadTemplate gst_rtpgsmenc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-rtp")
+);
+
static void gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass);
static void gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass);
@@ -74,7 +72,7 @@ static void gst_rtpgsmenc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_rtpgsmenc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps);
+static GstPadLinkReturn gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps * caps);
static GstElementStateReturn gst_rtpgsmenc_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
@@ -107,9 +105,9 @@ gst_rtpgsmenc_base_init (GstRtpGSMEncClass * klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_factory));
+ gst_static_pad_template_get (&gst_rtpgsmenc_src_template));
gst_element_class_set_details (element_class, &gst_rtpgsmenc_details);
}
@@ -133,8 +131,10 @@ gst_rtpgsmenc_class_init (GstRtpGSMEncClass * klass)
static void
gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
{
- rtpgsmenc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink");
- rtpgsmenc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src");
+ rtpgsmenc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "sink");
+ rtpgsmenc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gst_rtpgsmenc_sink_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->sinkpad);
gst_element_add_pad (GST_ELEMENT (rtpgsmenc), rtpgsmenc->srcpad);
gst_pad_set_chain_function (rtpgsmenc->sinkpad, gst_rtpgsmenc_chain);
@@ -150,13 +150,18 @@ gst_rtpgsmenc_init (GstRtpGSMEnc * rtpgsmenc)
}
static GstPadLinkReturn
-gst_rtpgsmenc_sinkconnect (GstPad * pad, GstCaps * caps)
+gst_rtpgsmenc_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstRtpGSMEnc *rtpgsmenc;
+ GstStructure *structure;
+ gboolean ret;
rtpgsmenc = GST_RTP_GSM_ENC (gst_pad_get_parent (pad));
- gst_caps_get_int (caps, "rate", &rtpgsmenc->frequency);
+ structure = gst_caps_get_structure (caps, 0);
+
+ ret = gst_structure_get_int (structure, "rate", &rtpgsmenc->frequency);
+ if (!ret) return GST_PAD_LINK_REFUSED;
/* Pre-calculate what we can */
rtpgsmenc->time_interval = GST_SECOND / (2 * rtpgsmenc->frequency);
diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c
index fb51667a..fffc4caa 100644
--- a/gst/smpte/gstsmpte.c
+++ b/gst/smpte/gstsmpte.c
@@ -33,41 +33,35 @@ static GstElementDetails smpte_details = {
"Wim Taymans <wim.taymans@chello.be>"
};
-GST_PAD_TEMPLATE_FACTORY (smpte_src_factory,
+static GstStaticPadTemplate gst_smpte_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "smpte_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
+ GST_STATIC_CAPS (
+ GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (smpte_sink1_factory,
+static GstStaticPadTemplate gst_smpte_sink1_template =
+GST_STATIC_PAD_TEMPLATE (
"sink1",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "smpte_sink1",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
+ GST_STATIC_CAPS (
+ GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (smpte_sink2_factory,
+static GstStaticPadTemplate gst_smpte_sink2_template =
+GST_STATIC_PAD_TEMPLATE (
"sink2",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "smpte_sink2",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
+ GST_STATIC_CAPS (
+ GST_VIDEO_YUV_PAD_TEMPLATE_CAPS("I420")
)
-)
+);
/* SMPTE signals and args */
@@ -158,11 +152,11 @@ gst_smpte_base_init (GstSMPTEClass *klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (smpte_sink1_factory));
+ gst_static_pad_template_get(&gst_smpte_sink1_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (smpte_sink2_factory));
+ gst_static_pad_template_get(&gst_smpte_sink2_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (smpte_src_factory));
+ gst_static_pad_template_get(&gst_smpte_src_template));
gst_element_class_set_details (element_class, &smpte_details);
}
@@ -236,40 +230,42 @@ gst_smpte_update_mask (GstSMPTE *smpte, gint type, gint depth, gint width, gint
}
static gboolean
-gst_smpte_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_smpte_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstSMPTE *smpte;
+ GstStructure *structure;
+ gboolean ret;
smpte = GST_SMPTE (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &smpte->width);
- gst_caps_get_int (caps, "height", &smpte->height);
- gst_caps_get_float (caps, "framerate", &smpte->fps);
+ ret = gst_structure_get_int (structure, "width", &smpte->width);
+ ret &= gst_structure_get_int (structure, "height", &smpte->height);
+ ret &= gst_structure_get_double (structure, "framerate", &smpte->fps);
+ if (!ret) return GST_PAD_LINK_REFUSED;
gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width, smpte->height);
/* forward to the next plugin */
- return gst_pad_try_set_caps(smpte->srcpad, gst_caps_copy_1(caps));
+ return gst_pad_try_set_caps(smpte->srcpad, caps);
}
static void
gst_smpte_init (GstSMPTE *smpte)
{
smpte->sinkpad1 = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (smpte_sink1_factory), "sink1");
+ gst_static_pad_template_get(&gst_smpte_sink1_template), "sink1");
gst_pad_set_link_function (smpte->sinkpad1, gst_smpte_sinkconnect);
gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad1);
smpte->sinkpad2 = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (smpte_sink2_factory), "sink2");
+ gst_static_pad_template_get(&gst_smpte_sink2_template), "sink2");
gst_pad_set_link_function (smpte->sinkpad2, gst_smpte_sinkconnect);
gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad2);
smpte->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (smpte_src_factory), "src");
+ gst_static_pad_template_get(&gst_smpte_src_template), "src");
gst_element_add_pad (GST_ELEMENT (smpte), smpte->srcpad);
gst_element_set_loop_function (GST_ELEMENT (smpte), gst_smpte_loop);
@@ -366,16 +362,15 @@ gst_smpte_loop (GstElement *element)
outbuf = gst_buffer_new_and_alloc (smpte->width * smpte->height * 3);
if (!GST_PAD_CAPS (smpte->srcpad)) {
- if (!gst_pad_try_set_caps (smpte->srcpad,
- GST_CAPS_NEW (
- "smpte_srccaps",
- "video/raw",
- "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
- "width", GST_PROPS_INT (smpte->width),
- "height", GST_PROPS_INT (smpte->height),
- "framerate", GST_PROPS_FLOAT (smpte->fps)
- )))
- {
+ GstCaps *caps;
+ caps = gst_caps_copy (gst_static_caps_get (
+ &gst_smpte_src_template.static_caps));
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, smpte->width,
+ "height", G_TYPE_INT, smpte->height,
+ "framerate", G_TYPE_DOUBLE, smpte->fps, NULL);
+
+ if (!gst_pad_try_set_caps (smpte->srcpad, caps)) {
gst_element_error (element, "cannot set caps");
return;
}
diff --git a/gst/smpte/gstsmpte.h b/gst/smpte/gstsmpte.h
index c51d4fbe..40844209 100644
--- a/gst/smpte/gstsmpte.h
+++ b/gst/smpte/gstsmpte.h
@@ -44,7 +44,7 @@ struct _GstSMPTE {
gint format;
gint width;
gint height;
- gfloat fps;
+ gdouble fps;
gint duration;
gint position;
diff --git a/gst/udp/gstudpsink.c b/gst/udp/gstudpsink.c
index 4e3a48d8..4773d291 100644
--- a/gst/udp/gstudpsink.c
+++ b/gst/udp/gstudpsink.c
@@ -150,7 +150,7 @@ gst_udpsink_class_init (GstUDPSink *klass)
static GstPadLinkReturn
-gst_udpsink_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_udpsink_sink_link (GstPad *pad, const GstCaps *caps)
{
GstUDPSink *udpsink;
struct sockaddr_in serv_addr;
@@ -251,7 +251,7 @@ gst_udpsink_init (GstUDPSink *udpsink)
udpsink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (udpsink), udpsink->sinkpad);
gst_pad_set_chain_function (udpsink->sinkpad, gst_udpsink_chain);
- gst_pad_set_link_function (udpsink->sinkpad, gst_udpsink_sinkconnect);
+ gst_pad_set_link_function (udpsink->sinkpad, gst_udpsink_sink_link);
udpsink->host = g_strdup (UDP_DEFAULT_HOST);
udpsink->port = UDP_DEFAULT_PORT;
diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
index fb3ea230..ab975a23 100644
--- a/gst/videocrop/gstvideocrop.c
+++ b/gst/videocrop/gstvideocrop.c
@@ -48,7 +48,7 @@ struct _GstVideoCrop {
/* caps */
gint width, height;
- gfloat fps;
+ gdouble fps;
gint crop_left, crop_right, crop_top, crop_bottom;
};
@@ -80,29 +80,21 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (video_crop_src_template_factory,
+static GstStaticPadTemplate gst_video_crop_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "video_crop_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
-GST_PAD_TEMPLATE_FACTORY (video_crop_sink_template_factory,
+static GstStaticPadTemplate gst_video_crop_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "video_crop_sink",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
static void gst_video_crop_base_init (gpointer g_class);
@@ -115,7 +107,7 @@ static void gst_video_crop_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
static GstPadLinkReturn
- gst_video_crop_sink_connect (GstPad *pad, GstCaps *caps);
+ gst_video_crop_sink_link (GstPad *pad, const GstCaps *caps);
static void gst_video_crop_chain (GstPad *pad, GstData *_data);
static GstElementStateReturn
@@ -155,9 +147,9 @@ gst_video_crop_base_init (gpointer g_class)
gst_element_class_set_details (element_class, &gst_video_crop_details);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (video_crop_sink_template_factory));
+ gst_static_pad_template_get (&gst_video_crop_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (video_crop_src_template_factory));
+ gst_static_pad_template_get (&gst_video_crop_src_template));
}
static void
gst_video_crop_class_init (GstVideoCropClass *klass)
@@ -194,13 +186,13 @@ gst_video_crop_init (GstVideoCrop *video_crop)
{
/* create the sink and src pads */
video_crop->sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET (video_crop_sink_template_factory), "sink");
+ gst_static_pad_template_get (&gst_video_crop_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (video_crop), video_crop->sinkpad);
- gst_pad_set_chain_function (video_crop->sinkpad, GST_DEBUG_FUNCPTR (gst_video_crop_chain));
- gst_pad_set_link_function (video_crop->sinkpad, GST_DEBUG_FUNCPTR (gst_video_crop_sink_connect));
+ gst_pad_set_chain_function (video_crop->sinkpad, gst_video_crop_chain);
+ gst_pad_set_link_function (video_crop->sinkpad, gst_video_crop_sink_link);
video_crop->srcpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET (video_crop_src_template_factory), "src");
+ gst_static_pad_template_get (&gst_video_crop_src_template), "src");
gst_element_add_pad (GST_ELEMENT (video_crop), video_crop->srcpad);
video_crop->crop_right = 0;
@@ -270,19 +262,18 @@ gst_video_crop_get_property (GObject *object, guint prop_id, GValue *value, GPar
}
static GstPadLinkReturn
-gst_video_crop_sink_connect (GstPad *pad, GstCaps *caps)
+gst_video_crop_sink_link (GstPad *pad, const GstCaps *caps)
{
GstVideoCrop *video_crop;
-
- /* we are not going to act on variable caps */
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ GstStructure *structure;
+ gboolean ret;
video_crop = GST_VIDEO_CROP (gst_pad_get_parent (pad));
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &video_crop->width);
- gst_caps_get_int (caps, "height", &video_crop->height);
- gst_caps_get_float (caps, "framerate", &video_crop->fps);
+ ret = gst_structure_get_int (structure, "width", &video_crop->width);
+ ret &= gst_structure_get_int (structure, "height", &video_crop->height);
+ ret &= gst_structure_get_double (structure, "framerate", &video_crop->fps);
return GST_PAD_LINK_OK;
}
@@ -380,22 +371,6 @@ gst_video_crop_chain (GstPad *pad, GstData *_data)
new_height = video_crop->height -
(video_crop->crop_top + video_crop->crop_bottom);
- if (GST_PAD_CAPS (video_crop->srcpad) == NULL) {
- if (gst_pad_try_set_caps (video_crop->srcpad,
- GST_CAPS_NEW (
- "video_crop_caps",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- "width", GST_PROPS_INT (new_width),
- "height", GST_PROPS_INT (new_height),
- "framerate", GST_PROPS_FLOAT (video_crop->fps)
- )) <= 0)
- {
- gst_element_error (GST_ELEMENT (video_crop), "could not negotiate pads");
- return;
- }
- }
-
outbuf = gst_buffer_new_and_alloc ((new_width * new_height * 3) / 2);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buffer);
diff --git a/gst/videofilter/gstvideofilter.c b/gst/videofilter/gstvideofilter.c
index 91753528..86ab15a0 100644
--- a/gst/videofilter/gstvideofilter.c
+++ b/gst/videofilter/gstvideofilter.c
@@ -107,10 +107,10 @@ static void gst_videofilter_class_init (gpointer g_class, gpointer class_data)
gobject_class->get_property = gst_videofilter_get_property;
}
-static GstCaps *gst_videofilter_format_get_caps(GstVideofilterFormat *format)
+static GstStructure *gst_videofilter_format_get_structure(GstVideofilterFormat *format)
{
unsigned int fourcc;
- GstCaps *caps;
+ GstStructure *structure;
if(format->filter_func==NULL)
return NULL;
@@ -118,79 +118,48 @@ static GstCaps *gst_videofilter_format_get_caps(GstVideofilterFormat *format)
fourcc = GST_MAKE_FOURCC(format->fourcc[0],format->fourcc[1],format->fourcc[2],format->fourcc[3]);
if(format->bpp){
- caps = GST_CAPS_NEW ("videofilter", "video/x-raw-rgb",
- "depth", GST_PROPS_INT(format->bpp),
- "bpp", GST_PROPS_INT(format->depth),
- "endianness", GST_PROPS_INT(format->endianness),
- "red_mask", GST_PROPS_INT(format->red_mask),
- "green_mask", GST_PROPS_INT(format->green_mask),
- "blue_mask", GST_PROPS_INT(format->blue_mask));
+ structure = gst_structure_new ("video/x-raw-rgb",
+ "depth", G_TYPE_INT, format->bpp,
+ "bpp", G_TYPE_INT, format->depth,
+ "endianness", G_TYPE_INT, format->endianness,
+ "red_mask", G_TYPE_INT, format->red_mask,
+ "green_mask", G_TYPE_INT, format->green_mask,
+ "blue_mask", G_TYPE_INT, format->blue_mask, NULL);
}else{
- caps = GST_CAPS_NEW ("videoflip", "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (fourcc),
- "height", GST_PROPS_INT_RANGE (1,G_MAXINT),
- "width", GST_PROPS_INT_RANGE (1,G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0,G_MAXFLOAT)
- );
+ structure = gst_structure_new ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
}
- return caps;
+ gst_structure_set(structure,
+ "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+ "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
+
+ return structure;
}
GstCaps * gst_videofilter_class_get_capslist(GstVideofilterClass *klass)
{
- static GstCaps *capslist = NULL;
GstCaps *caps;
+ GstStructure *structure;
int i;
- if (capslist){
- gst_caps_ref(capslist);
- return capslist;
- }
-
+ caps = gst_caps_new_empty();
for(i=0;i<klass->formats->len;i++){
- caps = gst_videofilter_format_get_caps(g_ptr_array_index(klass->formats,i));
- capslist = gst_caps_append(capslist, caps);
+ structure = gst_videofilter_format_get_structure(g_ptr_array_index(klass->formats,i));
+ gst_caps_append_structure (caps, structure);
}
- gst_caps_ref(capslist);
- return capslist;
-}
-
-static GstCaps* gst_videofilter_caps_add_variable_part (GstCaps *caps)
-{
- GstCaps *yuv, *rgb;
-
- if (caps == NULL)
- return NULL;
-
- yuv = GST_CAPS_NEW("videofilter_size","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
- rgb = GST_CAPS_NEW("videofilter_size","video/x-raw-rgb",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
- yuv = gst_caps_intersect (yuv, caps);
- rgb = gst_caps_intersect (rgb, caps);
- if (yuv) {
- gst_caps_append (yuv, rgb);
- } else {
- g_assert (rgb);
- yuv = rgb;
- }
- gst_caps_unref (caps);
-
- return yuv;
+ return caps;
}
static GstCaps *
-gst_videofilter_sink_getcaps (GstPad *pad, GstCaps *caps)
+gst_videofilter_sink_getcaps (GstPad *pad)
{
GstVideofilter *videofilter;
GstVideofilterClass *klass;
- GstCaps *capslist = NULL;
+ GstCaps *caps;
GstCaps *peercaps;
int i;
@@ -207,115 +176,81 @@ gst_videofilter_sink_getcaps (GstPad *pad, GstCaps *caps)
/* Look through our list of caps and find those that match with
* the peer's formats. Create a list of them. */
/* FIXME optimize if peercaps == NULL */
+ caps = gst_caps_new_empty ();
for(i=0;i<klass->formats->len;i++){
GstCaps *icaps;
- GstCaps *fromcaps = gst_videofilter_format_get_caps(g_ptr_array_index(
- klass->formats,i));
+ GstCaps *fromcaps;
+
+ fromcaps = gst_caps_new_full (gst_videofilter_format_get_structure (
+ g_ptr_array_index (klass->formats,i)));
- icaps = gst_caps_intersect(fromcaps, peercaps);
- //if(gst_caps_is_always_compatible(fromcaps, peercaps)){
+ icaps = gst_caps_intersect (fromcaps, peercaps);
if(icaps != NULL){
- capslist = gst_caps_append(capslist, fromcaps);
+ gst_caps_append (caps, fromcaps);
+ } else {
+ gst_caps_free (fromcaps);
}
- //gst_caps_unref (fromcaps);
- if(icaps) gst_caps_unref (icaps);
+ if(icaps) gst_caps_free (icaps);
}
- gst_caps_unref (peercaps);
+ gst_caps_free (peercaps);
- capslist = gst_videofilter_caps_add_variable_part (capslist);
-
- return capslist;
+ return caps;
}
static GstPadLinkReturn
-gst_videofilter_src_link (GstPad *pad, GstCaps *caps)
+gst_videofilter_src_link (GstPad *pad, const GstCaps *caps)
{
GstVideofilter *videofilter;
- GstPadLinkReturn ret;
- GstCaps *peercaps;
+ GstStructure *structure;
+ gboolean ret;
GST_DEBUG("gst_videofilter_src_link");
videofilter = GST_VIDEOFILTER (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
-
- gst_caps_debug(caps,"ack");
+ structure = gst_caps_get_structure (caps, 0);
videofilter->format = gst_videofilter_find_format_by_caps (videofilter,caps);
g_return_val_if_fail(videofilter->format, GST_PAD_LINK_REFUSED);
- gst_caps_get_int (caps, "width", &videofilter->to_width);
- gst_caps_get_int (caps, "height", &videofilter->to_height);
-
- GST_DEBUG("width %d height %d",videofilter->to_width,videofilter->to_height);
-
- peercaps = gst_caps_copy(caps);
-
- gst_caps_set(peercaps, "width", GST_PROPS_INT_RANGE (0, G_MAXINT));
- gst_caps_set(peercaps, "height", GST_PROPS_INT_RANGE (0, G_MAXINT));
-
- ret = gst_pad_try_set_caps (videofilter->srcpad, peercaps);
+ ret = gst_structure_get_int (structure, "width", &videofilter->to_width);
+ ret &= gst_structure_get_int (structure, "height", &videofilter->to_height);
+ ret &= gst_structure_get_double (structure, "framerate", &videofilter->framerate);
- gst_caps_unref(peercaps);
+ if (!ret) return GST_PAD_LINK_REFUSED;
- if(ret==GST_PAD_LINK_OK){
- caps = gst_pad_get_caps (videofilter->srcpad);
+ GST_DEBUG("width %d height %d",videofilter->to_width,videofilter->to_height);
- gst_caps_get_int (caps, "width", &videofilter->from_width);
- gst_caps_get_int (caps, "height", &videofilter->from_height);
- //gst_videofilter_setup(videofilter);
- }
+ gst_videofilter_setup(videofilter);
- return ret;
+ return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
-gst_videofilter_sink_link (GstPad *pad, GstCaps *caps)
+gst_videofilter_sink_link (GstPad *pad, const GstCaps *caps)
{
GstVideofilter *videofilter;
GstPadLinkReturn ret;
- GstCaps *peercaps;
+ GstStructure *structure;
GST_DEBUG("gst_videofilter_sink_link");
videofilter = GST_VIDEOFILTER (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+ structure = gst_caps_get_structure (caps, 0);
videofilter->format = gst_videofilter_find_format_by_caps (videofilter,caps);
- GST_DEBUG("sink_link: %s\n",gst_caps_to_string(caps));
g_return_val_if_fail(videofilter->format, GST_PAD_LINK_REFUSED);
- gst_caps_get_int (caps, "width", &videofilter->from_width);
- gst_caps_get_int (caps, "height", &videofilter->from_height);
- gst_caps_get_float (caps, "framerate", &videofilter->framerate);
-
- gst_videofilter_setup(videofilter);
-
- peercaps = gst_caps_copy(caps);
-
- gst_caps_set(peercaps, "width", GST_PROPS_INT (videofilter->to_width));
- gst_caps_set(peercaps, "height", GST_PROPS_INT (videofilter->to_height));
- gst_caps_set(peercaps, "framerate", GST_PROPS_FLOAT (videofilter->framerate));
+ ret = gst_structure_get_int (structure, "width", &videofilter->from_width);
+ ret &= gst_structure_get_int (structure, "height", &videofilter->from_height);
+ ret &= gst_structure_get_double (structure, "framerate", &videofilter->framerate);
- GST_DEBUG("setting %s\n",gst_caps_to_string(peercaps));
+ if (!ret) return GST_PAD_LINK_REFUSED;
- ret = gst_pad_try_set_caps (videofilter->srcpad, peercaps);
+ GST_DEBUG("width %d height %d",videofilter->from_width,videofilter->from_height);
- //gst_caps_unref(peercaps);
-
- if(ret==GST_PAD_LINK_OK || ret==GST_PAD_LINK_DONE){
- caps = gst_pad_get_caps (videofilter->srcpad);
-
- //gst_caps_get_int (caps, "width", &videofilter->to_width);
- //gst_caps_get_int (caps, "height", &videofilter->to_height);
- //gst_videofilter_setup(videofilter);
- }
+ gst_videofilter_setup(videofilter);
- return ret;
+ return GST_PAD_LINK_OK;
}
static void
@@ -457,6 +392,7 @@ void gst_videofilter_set_output_size(GstVideofilter *videofilter,
{
int ret;
GstCaps *srccaps;
+ GstStructure *structure;
g_return_if_fail(GST_IS_VIDEOFILTER(videofilter));
@@ -467,18 +403,16 @@ void gst_videofilter_set_output_size(GstVideofilter *videofilter,
* videofilter->format->depth)/8;
srccaps = gst_caps_copy(gst_pad_get_caps(videofilter->srcpad));
+ structure = gst_caps_get_structure (srccaps, 0);
- if(!GST_CAPS_IS_FIXED(srccaps)){
- gst_caps_unref (srccaps);
- return;
- }
-
- gst_caps_set(srccaps, "width", GST_PROPS_INT (videofilter->to_width));
- gst_caps_set(srccaps, "height", GST_PROPS_INT (videofilter->to_height));
+ gst_structure_set (structure, "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height, NULL);
ret = gst_pad_try_set_caps (videofilter->srcpad, srccaps);
- g_return_if_fail(ret<0);
+ if (ret < 0) {
+ g_critical ("could not set output size");
+ }
}
static void gst_videofilter_setup(GstVideofilter *videofilter)
@@ -513,12 +447,13 @@ static void gst_videofilter_setup(GstVideofilter *videofilter)
}
GstVideofilterFormat *gst_videofilter_find_format_by_caps(GstVideofilter *videofilter,
- GstCaps *caps)
+ const GstCaps *caps)
{
int i;
- GstCaps *c;
GstVideofilterClass *klass;
GstVideofilterFormat *format;
+ gboolean ret;
+ GstStructure *structure;
klass = GST_VIDEOFILTER_CLASS(G_OBJECT_GET_CLASS(videofilter));
@@ -526,15 +461,16 @@ GstVideofilterFormat *gst_videofilter_find_format_by_caps(GstVideofilter *videof
for(i=0;i<klass->formats->len;i++){
format = g_ptr_array_index(klass->formats,i);
- c = gst_videofilter_format_get_caps(format);
+ structure = gst_videofilter_format_get_structure(format);
+
+ if(structure){
+ GstCaps *format_caps;
+ format_caps = gst_caps_new_full (structure, NULL);
+ ret = gst_caps_is_always_compatible (caps, format_caps);
+ gst_caps_free (format_caps);
- if(c){
- if(gst_caps_is_always_compatible(caps, c)){
- gst_caps_unref(c);
- return format;
- }
+ if (ret) return format;
}
- gst_caps_unref(c);
}
return NULL;
@@ -548,17 +484,15 @@ void gst_videofilter_class_add_format(GstVideofilterClass *videofilterclass,
void gst_videofilter_class_add_pad_templates (GstVideofilterClass *videofilter_class)
{
- GstCaps *caps;
GstElementClass *element_class = GST_ELEMENT_CLASS (videofilter_class);
- caps = gst_videofilter_class_get_capslist (videofilter_class);
- caps = gst_videofilter_caps_add_variable_part (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_pad_template_new("src", GST_PAD_SRC, GST_PAD_ALWAYS,
+ gst_videofilter_class_get_capslist (videofilter_class)));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_NEW("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps));
+ gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_videofilter_class_get_capslist (videofilter_class)));
}
static gboolean
diff --git a/gst/videofilter/gstvideofilter.h b/gst/videofilter/gstvideofilter.h
index 63f96920..9ec7593e 100644
--- a/gst/videofilter/gstvideofilter.h
+++ b/gst/videofilter/gstvideofilter.h
@@ -75,7 +75,7 @@ struct _GstVideofilter {
/* private */
gint from_buf_size;
gint to_buf_size;
- gfloat framerate;
+ gdouble framerate;
GstBuffer *in_buf;
GstBuffer *out_buf;
@@ -95,7 +95,7 @@ int gst_videofilter_get_input_height(GstVideofilter *videofilter);
void gst_videofilter_set_output_size(GstVideofilter *videofilter,
int width, int height);
GstVideofilterFormat *gst_videofilter_find_format_by_caps(GstVideofilter *filter,
- GstCaps *caps);
+ const GstCaps *caps);
GstCaps *gst_videofilter_class_get_capslist(GstVideofilterClass *videofilterclass);
void gst_videofilter_class_add_format(GstVideofilterClass *videofilterclass,
diff --git a/gst/videoflip/gstvideoflip.c b/gst/videoflip/gstvideoflip.c
index 7d65cac5..0f20f47b 100644
--- a/gst/videoflip/gstvideoflip.c
+++ b/gst/videoflip/gstvideoflip.c
@@ -57,6 +57,7 @@ static void gst_videoflip_get_property (GObject *object, guint prop_id, GValue
static void gst_videoflip_chain (GstPad *pad, GstData *_data);
static GstCaps * gst_videoflip_get_capslist(void);
+
static GstElementClass *parent_class = NULL;
#define GST_TYPE_VIDEOFLIP_METHOD (gst_videoflip_method_get_type())
@@ -86,38 +87,28 @@ gst_videoflip_method_get_type(void)
static GstPadTemplate *
gst_videoflip_src_template_factory(void)
{
- static GstPadTemplate *templ = NULL;
-
- if(!templ){
- /* well, actually RGB too, but since there's no RGB format anyway */
- GstCaps *caps = GST_CAPS_NEW("src","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ /* well, actually RGB too, but since there's no RGB format anyway */
+ GstCaps *caps = gst_caps_from_string ("video/x-raw-yuv, "
+ "width = (int) [ 0, MAX ], "
+ "height = (int) [ 0, MAX ], "
+ "framerate = (double) [ 0, MAX ]");
- caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
+ caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
- templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
- }
- return templ;
+ return gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
}
static GstPadTemplate *
gst_videoflip_sink_template_factory(void)
{
- static GstPadTemplate *templ = NULL;
-
- if(!templ){
- GstCaps *caps = GST_CAPS_NEW("sink","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ GstCaps *caps = gst_caps_from_string ("video/x-raw-yuv, "
+ "width = (int) [ 0, MAX ], "
+ "height = (int) [ 0, MAX ], "
+ "framerate = (double) [ 0, MAX ]");
- caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
+ caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
- templ = GST_PAD_TEMPLATE_NEW("src", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
- }
- return templ;
+ return gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
}
GType
@@ -149,8 +140,10 @@ gst_videoflip_base_init (gpointer g_class)
gst_element_class_set_details (element_class, &videoflip_details);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_videoflip_sink_template_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (gst_videoflip_src_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_videoflip_sink_template_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_videoflip_src_template_factory ());
}
static void
gst_videoflip_class_init (GstVideoflipClass *klass)
@@ -176,34 +169,30 @@ gst_videoflip_class_init (GstVideoflipClass *klass)
static GstCaps *
gst_videoflip_get_capslist(void)
{
- static GstCaps *capslist = NULL;
GstCaps *caps;
+ GstStructure *structure;
int i;
- if (capslist){
- gst_caps_ref(capslist);
- return capslist;
- }
-
+ caps = gst_caps_new_empty ();
for(i=0;i<videoflip_n_formats;i++){
- caps = videoflip_get_caps(videoflip_formats + i);
- capslist = gst_caps_append(capslist, caps);
+ structure = videoflip_get_cap (videoflip_formats + i);
+ gst_caps_append_structure (caps, structure);
}
- gst_caps_ref(capslist);
- return capslist;
+ return caps;
}
static GstCaps *
-gst_videoflip_sink_getcaps (GstPad *pad, GstCaps *caps)
+gst_videoflip_sink_getcaps (GstPad *pad)
{
GstVideoflip *videoflip;
GstCaps *capslist = NULL;
GstCaps *peercaps;
GstCaps *sizecaps;
+ GstCaps *caps;
int i;
- GST_DEBUG ("gst_videoflip_src_link");
+ GST_DEBUG ("gst_videoflip_sink_getcaps");
videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad));
/* get list of peer's caps */
@@ -218,111 +207,70 @@ gst_videoflip_sink_getcaps (GstPad *pad, GstCaps *caps)
/* Look through our list of caps and find those that match with
* the peer's formats. Create a list of them. */
for(i=0;i<videoflip_n_formats;i++){
- GstCaps *fromcaps = videoflip_get_caps(videoflip_formats + i);
+ GstCaps *fromcaps = gst_caps_new_full(videoflip_get_cap(
+ videoflip_formats + i), NULL);
if(gst_caps_is_always_compatible(fromcaps, peercaps)){
- capslist = gst_caps_append(capslist, fromcaps);
+ gst_caps_append(capslist, fromcaps);
}
- gst_caps_unref (fromcaps);
}
- gst_caps_unref (peercaps);
+ gst_caps_free (peercaps);
- sizecaps = GST_CAPS_NEW("videoflip_size","video/x-raw-yuv",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
+ sizecaps = gst_caps_from_string ("video/x-raw-yuv, "
+ "width = (int) [ 0, MAX ], "
+ "height = (int) [ 0, MAX ], "
+ "framerate = (double) [ 0, MAX ]");
- caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
- gst_caps_unref (sizecaps);
+ caps = gst_caps_intersect(capslist, sizecaps);
+ gst_caps_free (sizecaps);
return caps;
}
static GstPadLinkReturn
-gst_videoflip_src_link (GstPad *pad, GstCaps *caps)
+gst_videoflip_src_link (GstPad *pad, const GstCaps *caps)
{
GstVideoflip *videoflip;
- GstPadLinkReturn ret;
- GstCaps *peercaps;
+ GstStructure *structure;
+ gboolean ret;
GST_DEBUG ("gst_videoflip_src_link");
videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad));
-
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
-
- gst_caps_debug(caps,"ack");
+
+ structure = gst_caps_get_structure (caps, 0);
videoflip->format = videoflip_find_by_caps (caps);
g_return_val_if_fail(videoflip->format, GST_PAD_LINK_REFUSED);
- gst_caps_get_int (caps, "width", &videoflip->to_width);
- gst_caps_get_int (caps, "height", &videoflip->to_height);
-
- GST_DEBUG ("width %d height %d",videoflip->to_width,videoflip->to_height);
+ ret = gst_structure_get_int (structure, "width", &videoflip->to_width);
+ ret &= gst_structure_get_int (structure, "height", &videoflip->to_height);
- peercaps = gst_caps_copy(caps);
+ if (!ret) return GST_PAD_LINK_REFUSED;
- gst_caps_set(peercaps, "width", GST_PROPS_INT_RANGE (0, G_MAXINT));
- gst_caps_set(peercaps, "height", GST_PROPS_INT_RANGE (0, G_MAXINT));
-
- ret = gst_pad_try_set_caps (videoflip->srcpad, peercaps);
-
- gst_caps_unref(peercaps);
-
- if(ret==GST_PAD_LINK_OK){
- caps = gst_pad_get_caps (videoflip->srcpad);
-
- gst_caps_get_int (caps, "width", &videoflip->from_width);
- gst_caps_get_int (caps, "height", &videoflip->from_height);
- gst_videoflip_setup(videoflip);
- }
-
- return ret;
+ return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
-gst_videoflip_sink_link (GstPad *pad, GstCaps *caps)
+gst_videoflip_sink_link (GstPad *pad, const GstCaps *caps)
{
GstVideoflip *videoflip;
- GstPadLinkReturn ret;
- GstCaps *peercaps;
+ GstStructure *structure;
+ gboolean ret;
- GST_DEBUG ("gst_videoflip_src_link");
+ GST_DEBUG ("gst_videoflip_sink_link");
videoflip = GST_VIDEOFLIP (gst_pad_get_parent (pad));
-
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+
+ structure = gst_caps_get_structure (caps, 0);
videoflip->format = videoflip_find_by_caps (caps);
- gst_caps_debug(caps,"ack");
g_return_val_if_fail(videoflip->format, GST_PAD_LINK_REFUSED);
- gst_caps_get_int (caps, "width", &videoflip->from_width);
- gst_caps_get_int (caps, "height", &videoflip->from_height);
-
- gst_videoflip_setup(videoflip);
-
- peercaps = gst_caps_copy(caps);
-
- gst_caps_set(peercaps, "width", GST_PROPS_INT (videoflip->to_width));
- gst_caps_set(peercaps, "height", GST_PROPS_INT (videoflip->to_height));
+ ret = gst_structure_get_int (structure, "width", &videoflip->from_width);
+ ret &= gst_structure_get_int (structure, "height", &videoflip->from_height);
- ret = gst_pad_try_set_caps (videoflip->srcpad, peercaps);
-
- gst_caps_unref(peercaps);
-
- if(ret==GST_PAD_LINK_OK){
- caps = gst_pad_get_caps (videoflip->srcpad);
-
- gst_caps_get_int (caps, "width", &videoflip->to_width);
- gst_caps_get_int (caps, "height", &videoflip->to_height);
- gst_videoflip_setup(videoflip);
- }
+ if (!ret) return GST_PAD_LINK_REFUSED;
- return ret;
+ return GST_PAD_LINK_OK;
}
static void
@@ -330,7 +278,7 @@ gst_videoflip_init (GstVideoflip *videoflip)
{
GST_DEBUG ("gst_videoflip_init");
videoflip->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (gst_videoflip_sink_template_factory),
+ gst_videoflip_sink_template_factory(),
"sink");
gst_element_add_pad(GST_ELEMENT(videoflip),videoflip->sinkpad);
gst_pad_set_chain_function(videoflip->sinkpad,gst_videoflip_chain);
@@ -338,7 +286,7 @@ gst_videoflip_init (GstVideoflip *videoflip)
gst_pad_set_getcaps_function(videoflip->sinkpad,gst_videoflip_sink_getcaps);
videoflip->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (gst_videoflip_src_template_factory),
+ gst_videoflip_src_template_factory(),
"src");
gst_element_add_pad(GST_ELEMENT(videoflip),videoflip->srcpad);
gst_pad_set_link_function(videoflip->srcpad,gst_videoflip_src_link);
diff --git a/gst/videoflip/videoflip.c b/gst/videoflip/videoflip.c
index f108ea62..7956165d 100644
--- a/gst/videoflip/videoflip.c
+++ b/gst/videoflip/videoflip.c
@@ -43,11 +43,11 @@ struct videoflip_format_struct videoflip_formats[] = {
int videoflip_n_formats = sizeof(videoflip_formats)/sizeof(videoflip_formats[0]);
-GstCaps *
-videoflip_get_caps(struct videoflip_format_struct *format)
+GstStructure *
+videoflip_get_cap(struct videoflip_format_struct *format)
{
unsigned int fourcc;
- GstCaps *caps;
+ GstStructure *structure;
if(format->scale==NULL)
return NULL;
@@ -55,40 +55,40 @@ videoflip_get_caps(struct videoflip_format_struct *format)
fourcc = GST_MAKE_FOURCC(format->fourcc[0],format->fourcc[1],format->fourcc[2],format->fourcc[3]);
if(format->bpp){
- caps = GST_CAPS_NEW ("videoflip", "video/x-raw-rgb",
- "depth", GST_PROPS_INT(format->bpp),
- "bpp", GST_PROPS_INT(format->depth),
- "endianness", GST_PROPS_INT(format->endianness),
- "red_mask", GST_PROPS_INT(format->red_mask),
- "green_mask", GST_PROPS_INT(format->green_mask),
- "blue_mask", GST_PROPS_INT(format->blue_mask));
+ structure = gst_structure_new("video/x-raw-rgb",
+ "depth", G_TYPE_INT, format->bpp,
+ "bpp", G_TYPE_INT, format->depth,
+ "endianness", G_TYPE_INT, format->endianness,
+ "red_mask", G_TYPE_INT, format->red_mask,
+ "green_mask", G_TYPE_INT, format->green_mask,
+ "blue_mask", G_TYPE_INT, format->blue_mask, NULL);
}else{
- caps = GST_CAPS_NEW ("videoflip", "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (fourcc));
+ structure = gst_structure_new("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
}
- return caps;
+ return structure;
}
struct videoflip_format_struct *
-videoflip_find_by_caps(GstCaps *caps)
+videoflip_find_by_caps(const GstCaps *caps)
{
int i;
- GST_DEBUG ("finding %p",caps);
+ GST_DEBUG ("finding %p", caps);
g_return_val_if_fail(caps != NULL, NULL);
for (i = 0; i < videoflip_n_formats; i++){
GstCaps *c;
- c = videoflip_get_caps(videoflip_formats + i);
+ c = gst_caps_new_full (videoflip_get_cap (videoflip_formats + i), NULL);
if(c){
if(gst_caps_is_always_compatible(caps, c)){
- gst_caps_unref(c);
+ gst_caps_free(c);
return videoflip_formats + i;
}
- gst_caps_unref(c);
+ gst_caps_free(c);
}
}
diff --git a/gst/videoflip/videoflip.h b/gst/videoflip/videoflip.h
index e61cbffe..e912fe98 100644
--- a/gst/videoflip/videoflip.h
+++ b/gst/videoflip/videoflip.h
@@ -37,9 +37,9 @@ struct videoflip_format_struct {
extern struct videoflip_format_struct videoflip_formats[];
extern int videoflip_n_formats;
-GstCaps *videoflip_get_caps(struct videoflip_format_struct *format);
+GstStructure *videoflip_get_cap(struct videoflip_format_struct *format);
-struct videoflip_format_struct *videoflip_find_by_caps(GstCaps *caps);
+struct videoflip_format_struct *videoflip_find_by_caps(const GstCaps *caps);
#endif
diff --git a/gst/wavenc/gstwavenc.c b/gst/wavenc/gstwavenc.c
index 3ae50008..769c95ea 100644
--- a/gst/wavenc/gstwavenc.c
+++ b/gst/wavenc/gstwavenc.c
@@ -78,42 +78,31 @@ static GstElementDetails gst_wavenc_details = GST_ELEMENT_DETAILS (
static GstPadTemplate *srctemplate, *sinktemplate;
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "wavenc_raw",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, MAX ], "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "signed = (boolean) true"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (src_factory,
+static GstStaticPadTemplate src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "wavenc_wav",
- "audio/x-wav",
- NULL
- )
-)
+ GST_STATIC_CAPS ("audio/x-wav")
+);
enum {
PROP_0,
- PROP_METADATA
};
static GstElementClass *parent_class = NULL;
@@ -174,10 +163,6 @@ set_property (GObject *object,
enc = GST_WAVENC (object);
switch (prop_id) {
- case PROP_METADATA:
- enc->metadata = g_value_get_boxed (value);
- break;
-
default:
break;
}
@@ -190,32 +175,24 @@ gst_wavenc_base_init (gpointer g_class)
gst_element_class_set_details (element_class, &gst_wavenc_details);
- srctemplate = src_factory ();
- gst_element_class_add_pad_template (element_class, srctemplate);
-
- sinktemplate = sink_factory ();
- gst_element_class_add_pad_template (element_class, sinktemplate);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_factory));
}
static void
gst_wavenc_class_init (GstWavEncClass *klass)
{
GstElementClass *element_class;
- GObjectClass *object_class;
+ GObjectClass *object_class;
element_class = (GstElementClass *) klass;
- object_class = (GObjectClass *) klass;
-
- object_class->set_property = set_property;
+ object_class = (GObjectClass *) klass;
+ object_class->set_property = set_property;
element_class->change_state = gst_wavenc_change_state;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
- g_object_class_install_property (object_class,
- PROP_METADATA,
- g_param_spec_boxed ("metadata", "", "",
- GST_TYPE_CAPS,
- G_PARAM_WRITABLE));
}
static gboolean
@@ -264,20 +241,18 @@ gst_wavenc_setup (GstWavEnc *wavenc)
}
static GstPadLinkReturn
-gst_wavenc_sinkconnect (GstPad *pad,
- GstCaps *caps)
+gst_wavenc_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstWavEnc *wavenc;
+ GstStructure *structure;
wavenc = GST_WAVENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "channels", &wavenc->channels);
- gst_caps_get_int (caps, "rate", &wavenc->rate);
- gst_caps_get_int (caps, "depth", &wavenc->bits);
+ gst_structure_get_int (structure, "channels", &wavenc->channels);
+ gst_structure_get_int (structure, "rate", &wavenc->rate);
+ gst_structure_get_int (structure, "depth", &wavenc->bits);
gst_wavenc_setup (wavenc);
@@ -318,9 +293,8 @@ gst_wavenc_init (GstWavEnc *wavenc)
wavenc->setup = FALSE;
wavenc->flush_header = TRUE;
- wavenc->metadata = NULL;
- GST_FLAG_SET (wavenc, GST_ELEMENT_EVENT_AWARE);
+ GST_FLAG_SET (wavenc, GST_ELEMENT_EVENT_AWARE);
}
struct _maps {
@@ -344,6 +318,7 @@ struct _maps {
{ 0, NULL }
};
+#if 0
static guint32
get_id_from_name (const char *name)
{
@@ -598,6 +573,7 @@ write_labels (GstWavEnc *wavenc)
gst_pad_push (wavenc->srcpad, GST_DATA (buf));
g_string_free (info_str, FALSE);
}
+#endif
static void
gst_wavenc_chain (GstPad *pad,
@@ -618,12 +594,14 @@ gst_wavenc_chain (GstPad *pad,
if (GST_EVENT_TYPE (buf) == GST_EVENT_EOS) {
wavenc->pad_eos = TRUE;
+#if 0
/* Write our metadata if we have any */
if (wavenc->metadata) {
write_metadata (wavenc);
write_cues (wavenc);
write_labels (wavenc);
}
+#endif
gst_wavenc_stop_file (wavenc);
gst_pad_push (wavenc->srcpad,
diff --git a/gst/wavenc/gstwavenc.h b/gst/wavenc/gstwavenc.h
index 6c3f56f0..8810001a 100644
--- a/gst/wavenc/gstwavenc.h
+++ b/gst/wavenc/gstwavenc.h
@@ -57,9 +57,6 @@ struct _GstWavEnc {
gboolean setup, flush_header, pad_eos;
guchar header[WAV_HEADER_LEN];
-
- /* Metadata */
- GstCaps *metadata;
};
struct _GstWavEncClass {
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c
index cc550e88..e1b93a1b 100644
--- a/gst/wavparse/gstwavparse.c
+++ b/gst/wavparse/gstwavparse.c
@@ -60,61 +60,62 @@ static GstElementDetails gst_wavparse_details = GST_ELEMENT_DETAILS (
"Erik Walthinsen <omega@cse.ogi.edu>"
);
-GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
+static GstStaticPadTemplate sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"wavparse_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "wavparse_wav",
- "audio/x-wav",
- NULL
- )
-)
+ GST_STATIC_CAPS ("audio/x-wav")
+);
-GST_PAD_TEMPLATE_FACTORY (src_template_factory,
+static GstStaticPadTemplate src_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"wavparse_src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
+ GST_STATIC_CAPS_ANY
+);
+#if 0
+ GST_STATIC_CAPS (
"wavparse_raw",
"audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
+ "endianness", G_TYPE_INT (G_LITTLE_ENDIAN),
"signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (FALSE),
- GST_PROPS_BOOLEAN (TRUE)
+ G_TYPE_BOOLEAN (FALSE),
+ G_TYPE_BOOLEAN (TRUE)
),
"width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
+ G_TYPE_INT (8),
+ G_TYPE_INT (16)
),
"depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
+ G_TYPE_INT (8),
+ G_TYPE_INT (16)
),
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ "rate", G_TYPE_INT_RANGE (8000, 48000),
+ "channels", G_TYPE_INT_RANGE (1, 2)
),
- GST_CAPS_NEW (
+ GST_STATIC_CAPS (
"wavparse_mpeg",
"audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- "layer", GST_PROPS_INT_RANGE (1, 3)
+ "mpegversion", G_TYPE_INT, 1,
+ "rate", G_TYPE_INT_RANGE (8000, 48000),
+ "channels", G_TYPE_INT_RANGE (1, 2),
+ "layer", G_TYPE_INT_RANGE (1, 3)
),
- GST_CAPS_NEW (
+ GST_STATIC_CAPS (
"parsewav_law",
"audio/x-alaw",
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ "rate", G_TYPE_INT_RANGE (8000, 48000),
+ "channels", G_TYPE_INT_RANGE (1, 2)
),
- GST_CAPS_NEW (
+ GST_STATIC_CAPS (
"parsewav_law",
"audio/x-mulaw",
- "rate", GST_PROPS_INT_RANGE (8000, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ "rate", G_TYPE_INT_RANGE (8000, 48000),
+ "channels", G_TYPE_INT_RANGE (1, 2)
)
-)
+#endif
/* WavParse signals and args */
enum {
@@ -124,7 +125,6 @@ enum {
enum {
PROP_0,
- PROP_METADATA
};
static GstElementClass *parent_class = NULL;
@@ -161,8 +161,8 @@ gst_wavparse_base_init (gpointer g_class)
gst_element_class_set_details (element_class, &gst_wavparse_details);
/* register src pads */
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (sink_template_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (src_template_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_template_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_template_factory));
}
static void
gst_wavparse_class_init (GstWavParseClass *klass)
@@ -177,21 +177,13 @@ gst_wavparse_class_init (GstWavParseClass *klass)
object_class->get_property = gst_wavparse_get_property;
gstelement_class->change_state = gst_wavparse_change_state;
-
- g_object_class_install_property (object_class, PROP_METADATA,
- g_param_spec_boxed ("metadata",
- "Metadata", "Metadata",
- GST_TYPE_CAPS,
- G_PARAM_READABLE));
}
static void
gst_wavparse_init (GstWavParse *wavparse)
{
- GstProps *props;
-
/* sink */
- wavparse->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_template_factory), "sink");
+ wavparse->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&sink_template_factory), "sink");
gst_element_add_pad (GST_ELEMENT (wavparse), wavparse->sinkpad);
gst_pad_set_formats_function (wavparse->sinkpad, gst_wavparse_get_formats);
@@ -201,7 +193,7 @@ gst_wavparse_init (GstWavParse *wavparse)
gst_pad_set_query_function (wavparse->sinkpad, gst_wavparse_pad_query);
/* source */
- wavparse->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_template_factory), "src");
+ wavparse->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (&src_template_factory), "src");
gst_element_add_pad (GST_ELEMENT (wavparse), wavparse->srcpad);
gst_pad_set_formats_function (wavparse->srcpad, gst_wavparse_get_formats);
gst_pad_set_convert_function (wavparse->srcpad, gst_wavparse_pad_convert);
@@ -217,14 +209,6 @@ gst_wavparse_init (GstWavParse *wavparse)
wavparse->bps = 0;
wavparse->seek_pending = FALSE;
wavparse->seek_offset = 0;
-
- props = gst_props_empty_new ();
-
- /* Metadata is added later when we find it */
- gst_caps_replace_sink (&wavparse->metadata,
- gst_caps_new ("wav_metadata",
- "application/x-gst-metadata",
- props));
}
static void
@@ -238,15 +222,12 @@ gst_wavparse_get_property (GObject *object,
wavparse = GST_WAVPARSE (object);
switch (prop_id) {
- case PROP_METADATA:
- g_value_set_boxed (value, wavparse->metadata);
- break;
-
default:
break;
}
}
+#if 0
static void
gst_wavparse_parse_adtl (GstWavParse *wavparse,
int len)
@@ -310,8 +291,8 @@ gst_wavparse_parse_adtl (GstWavParse *wavparse,
new_caps = gst_caps_new ("label",
"application/x-gst-metadata",
gst_props_new (
- "identifier", GST_PROPS_INT (labl.identifier),
- "name", GST_PROPS_STRING (label_name),
+ "identifier", G_TYPE_INT (labl.identifier),
+ "name", G_TYPE_STRING (label_name),
NULL));
if (gst_props_get (props, "labels", &caps, NULL)) {
@@ -362,9 +343,9 @@ gst_wavparse_parse_adtl (GstWavParse *wavparse,
new_caps = gst_caps_new ("ltxt",
"application/x-gst-metadata",
gst_props_new (
- "identifier", GST_PROPS_INT (ltxt.identifier),
- "name", GST_PROPS_STRING (label_name),
- "length", GST_PROPS_INT (ltxt.length),
+ "identifier", G_TYPE_INT (ltxt.identifier),
+ "name", G_TYPE_STRING (label_name),
+ "length", G_TYPE_INT (ltxt.length),
NULL));
if (gst_props_get (props, "ltxts", &caps, NULL)) {
@@ -405,8 +386,8 @@ gst_wavparse_parse_adtl (GstWavParse *wavparse,
new_caps = gst_caps_new ("note",
"application/x-gst-metadata",
gst_props_new (
- "identifier", GST_PROPS_INT (note.identifier),
- "name", GST_PROPS_STRING (label_name),
+ "identifier", G_TYPE_INT (note.identifier),
+ "name", G_TYPE_STRING (label_name),
NULL));
if (gst_props_get (props, "notes", &caps, NULL)) {
@@ -536,7 +517,7 @@ gst_wavparse_parse_info (GstWavParse *wavparse,
if (type) {
GstPropsEntry *entry;
- entry = gst_props_entry_new (type, GST_PROPS_STRING (name));
+ entry = gst_props_entry_new (type, G_TYPE_STRING (name));
gst_props_add_entry (wavparse->metadata->properties, entry);
}
}
@@ -595,8 +576,8 @@ gst_wavparse_parse_cues (GstWavParse *wavparse,
caps = gst_caps_new ("cues",
"application/x-gst-metadata",
gst_props_new (
- "identifier", GST_PROPS_INT (points[i].identifier),
- "position", GST_PROPS_INT (points[i].offset),
+ "identifier", G_TYPE_INT (points[i].identifier),
+ "position", G_TYPE_INT (points[i].offset),
NULL));
cues = g_list_append (cues, caps);
}
@@ -640,36 +621,33 @@ gst_wavparse_parse_fmt (GstWavParse *wavparse)
return;
}
- caps = GST_CAPS_NEW ("parsewav_src",
- mime,
- "rate", GST_PROPS_INT (wavparse->rate),
- "channels", GST_PROPS_INT (wavparse->channels)
- );
+ caps = gst_caps_new_simple (mime,
+ "rate", G_TYPE_INT, wavparse->rate,
+ "channels", G_TYPE_INT, wavparse->channels,
+ NULL);
}
case GST_RIFF_WAVE_FORMAT_PCM:
- caps = GST_CAPS_NEW ("parsewav_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
- "signed", GST_PROPS_BOOLEAN ((wavparse->width > 8) ? TRUE : FALSE),
- "width", GST_PROPS_INT (wavparse->width),
- "depth", GST_PROPS_INT (wavparse->width),
- "rate", GST_PROPS_INT (wavparse->rate),
- "channels", GST_PROPS_INT (wavparse->channels)
- );
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+ "signed", G_TYPE_BOOLEAN, (wavparse->width > 8) ? TRUE : FALSE,
+ "width", G_TYPE_INT, wavparse->width,
+ "depth", G_TYPE_INT, wavparse->width,
+ "rate", G_TYPE_INT, wavparse->rate,
+ "channels", G_TYPE_INT, wavparse->channels,
+ NULL);
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12:
case GST_RIFF_WAVE_FORMAT_MPEGL3: {
int layer = (wavparse->format == GST_RIFF_WAVE_FORMAT_MPEGL12) ? 2 : 3;
- caps = GST_CAPS_NEW ("parsewav_src",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT (layer),
- "rate", GST_PROPS_INT (wavparse->rate),
- "channels", GST_PROPS_INT (wavparse->channels)
- );
+ caps = gst_caps_new_simple ("audio/mpeg",
+ "mpegversion", G_TYPE_INT, 1,
+ "layer", G_TYPE_INT, layer,
+ "rate", G_TYPE_INT, wavparse->rate,
+ "channels", G_TYPE_INT, wavparse->channels,
+ NULL);
}
break;
@@ -687,6 +665,7 @@ gst_wavparse_parse_fmt (GstWavParse *wavparse)
wavparse->rate, wavparse->channels);
}
}
+#endif
static gboolean
gst_wavparse_handle_sink_event (GstWavParse *wavparse)
@@ -853,32 +832,34 @@ gst_wavparse_loop (GstElement *element)
switch (chunk.id) {
case GST_RIFF_TAG_data:
+#if 0
wavparse->state = GST_WAVPARSE_DATA;
wavparse->dataleft = chunk.size;
wavparse->byteoffset = 0;
flush = 0;
+#endif
break;
case GST_RIFF_TAG_fmt:
- gst_wavparse_parse_fmt (wavparse);
+ //gst_wavparse_parse_fmt (wavparse);
break;
case GST_RIFF_TAG_cue:
- gst_wavparse_parse_cues (wavparse, chunk.size);
+ //gst_wavparse_parse_cues (wavparse, chunk.size);
break;
case GST_RIFF_TAG_LIST:
GST_DEBUG ("list type: %4.4s", (char *) &chunk.type);
switch (chunk.type) {
case GST_RIFF_LIST_INFO:
- gst_wavparse_parse_info (wavparse, chunk.size - 4);
+ //gst_wavparse_parse_info (wavparse, chunk.size - 4);
flush = 0;
break;
case GST_RIFF_LIST_adtl:
- gst_wavparse_parse_adtl (wavparse, chunk.size - 4);
+ //gst_wavparse_parse_adtl (wavparse, chunk.size - 4);
flush = 0;
break;
@@ -1108,7 +1089,6 @@ gst_wavparse_change_state (GstElement *element)
wavparse->bps = 0;
wavparse->seek_pending = FALSE;
wavparse->seek_offset = 0;
- gst_caps_replace (&wavparse->metadata, NULL);
break;
case GST_STATE_READY_TO_NULL:
diff --git a/gst/wavparse/gstwavparse.h b/gst/wavparse/gstwavparse.h
index d45cde51..3893a293 100644
--- a/gst/wavparse/gstwavparse.h
+++ b/gst/wavparse/gstwavparse.h
@@ -77,8 +77,6 @@ struct _GstWavParse {
guint64 seek_offset;
GstBuffer *buf;
-
- GstCaps *metadata;
};
struct _GstWavParseClass {