summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/arts/gst_arts.c50
-rw-r--r--ext/artsd/gstartsdsink.c56
-rw-r--r--ext/audiofile/gstafparse.c83
-rw-r--r--ext/audiofile/gstafsink.c53
-rw-r--r--ext/audiofile/gstafsrc.c48
-rw-r--r--ext/gsm/gstgsmdec.c93
-rw-r--r--ext/gsm/gstgsmenc.c100
-rw-r--r--ext/hermes/gstcolorspace.c355
-rw-r--r--ext/hermes/gstcolorspace.h7
-rw-r--r--ext/hermes/yuv2rgb.c20
-rw-r--r--ext/hermes/yuv2rgb.h2
-rw-r--r--ext/jack/gstjack.c42
-rw-r--r--ext/ladspa/gstladspa.c132
-rw-r--r--ext/ladspa/gstladspa.h2
-rw-r--r--ext/libfame/gstlibfame.c85
-rw-r--r--ext/mas/massink.c26
-rw-r--r--ext/mplex/gstmplex.cc83
-rw-r--r--ext/sdl/sdlvideosink.c70
-rw-r--r--ext/sdl/sdlvideosink.h3
-rw-r--r--ext/snapshot/gstsnapshot.c92
-rw-r--r--ext/sndfile/gstsf.c65
-rw-r--r--ext/swfdec/gstswfdec.c108
-rw-r--r--ext/swfdec/gstswfdec.h1
-rw-r--r--ext/xvid/gstxviddec.c119
-rw-r--r--ext/xvid/gstxviddec.h6
-rw-r--r--ext/xvid/gstxvidenc.c215
-rw-r--r--ext/xvid/gstxvidenc.h6
27 files changed, 753 insertions, 1169 deletions
diff --git a/ext/arts/gst_arts.c b/ext/arts/gst_arts.c
index f726e260..196bd7c1 100644
--- a/ext/arts/gst_arts.c
+++ b/ext/arts/gst_arts.c
@@ -38,36 +38,34 @@ static GstElementDetails gst_arts_details = {
};
-GST_PAD_TEMPLATE_FACTORY ( sink_temp,
+static GstStaticPadTemplate sink_temp =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "arts_sample",
- "audio/x-raw-int",
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "channels", GST_PROPS_INT (2),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER)
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "depth = (int) 16, "
+ "width = (int) 16, "
+ "signed = (boolean) true, "
+ "channels = (int) 2, "
+ "endianness = (int) byte_order"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY ( src_temp,
+static GstStaticPadTemplate src_temp =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "arts_sample",
- "audio/x-raw-int",
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "channels", GST_PROPS_INT (2),
- "rate", GST_PROPS_INT (44100),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "depth = (int) 16, "
+ "width = (int) 16, "
+ "signed = (boolean) true, "
+ "channels = (int) 2, "
+ "rate = (int) 44100, "
+ "endianness = (int) byte_order"
)
-)
+);
enum {
ARG_0,
@@ -112,9 +110,9 @@ gst_arts_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_temp));
+ gst_static_pad_template_get (&sink_temp));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_temp));
+ gst_static_pad_template_get (&src_temp));
gst_element_class_set_details (element_class, &gst_arts_details);
}
@@ -133,10 +131,12 @@ gst_arts_class_init (GstARTSClass *klass)
static void
gst_arts_init (GstARTS *arts)
{
- arts->sinkpad = gst_pad_new_from_template(GST_PAD_TEMPLATE_GET(sink_temp),"sink");
+ arts->sinkpad = gst_pad_new_from_template(
+ gst_element_get_pad_template (GST_ELEMENT (arts), "sink"), "sink");
gst_element_add_pad(GST_ELEMENT(arts),arts->sinkpad);
- arts->srcpad = gst_pad_new_from_template(GST_PAD_TEMPLATE_GET(src_temp),"src");
+ arts->srcpad = gst_pad_new_from_template(
+ gst_element_get_pad_template (GST_ELEMENT (arts), "src"), "src");
gst_element_add_pad(GST_ELEMENT(arts),arts->srcpad);
gst_element_set_loop_function (GST_ELEMENT (arts), gst_arts_loop);
diff --git a/ext/artsd/gstartsdsink.c b/ext/artsd/gstartsdsink.c
index 2c223df1..25ff80c4 100644
--- a/ext/artsd/gstartsdsink.c
+++ b/ext/artsd/gstartsdsink.c
@@ -24,6 +24,7 @@
#include "config.h"
#endif
#include "gstartsdsink.h"
+#include <gst/audio/audio.h>
/* elementfactory information */
static GstElementDetails artsdsink_details = {
@@ -45,31 +46,12 @@ enum {
ARG_NAME,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink", /* the name of the pads */
- GST_PAD_SINK, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "artsdsink_sink", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- "format", GST_PROPS_STRING ("int"),
- "law", GST_PROPS_INT (0),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", 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 (8000, 96000),
- "channels", GST_PROPS_LIST (
- GST_PROPS_INT (1),
- GST_PROPS_INT (2)
- )
- )
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
);
static void gst_artsdsink_base_init (gpointer g_class);
@@ -80,7 +62,7 @@ static gboolean gst_artsdsink_open_audio (GstArtsdsink *sink);
static void gst_artsdsink_close_audio (GstArtsdsink *sink);
static GstElementStateReturn gst_artsdsink_change_state (GstElement *element);
static gboolean gst_artsdsink_sync_parms (GstArtsdsink *artsdsink);
-static GstPadLinkReturn gst_artsdsink_link (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_artsdsink_link (GstPad *pad, const GstCaps *caps);
static void gst_artsdsink_chain (GstPad *pad, GstData *_data);
static void gst_artsdsink_set_property (GObject *object, guint prop_id,
@@ -118,7 +100,8 @@ gst_artsdsink_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));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details (element_class, &artsdsink_details);
}
@@ -151,7 +134,7 @@ static void
gst_artsdsink_init(GstArtsdsink *artsdsink)
{
artsdsink->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ gst_element_get_pad_template (GST_ELEMENT (artsdsink), "sink"), "sink");
gst_element_add_pad(GST_ELEMENT(artsdsink), artsdsink->sinkpad);
gst_pad_set_chain_function(artsdsink->sinkpad, gst_artsdsink_chain);
gst_pad_set_link_function(artsdsink->sinkpad, gst_artsdsink_link);
@@ -175,19 +158,16 @@ gst_artsdsink_sync_parms (GstArtsdsink *artsdsink)
}
static GstPadLinkReturn
-gst_artsdsink_link (GstPad *pad, GstCaps *caps)
+gst_artsdsink_link (GstPad *pad, const GstCaps *caps)
{
GstArtsdsink *artsdsink = GST_ARTSDSINK (gst_pad_get_parent (pad));
+ GstStructure *structure;
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get (caps,
- "rate", &artsdsink->frequency,
- "depth", &artsdsink->depth,
- "signed", &artsdsink->signd,
- "channels", &artsdsink->channels,
- NULL);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &artsdsink->frequency);
+ gst_structure_get_int (structure, "depth", &artsdsink->depth);
+ gst_structure_get_int (structure, "signed", &artsdsink->signd);
+ gst_structure_get_int (structure, "channels", &artsdsink->channels);
if (gst_artsdsink_sync_parms (artsdsink))
return GST_PAD_LINK_OK;
diff --git a/ext/audiofile/gstafparse.c b/ext/audiofile/gstafparse.c
index 6df1ca2e..f61d64f4 100644
--- a/ext/audiofile/gstafparse.c
+++ b/ext/audiofile/gstafparse.c
@@ -50,42 +50,34 @@ enum {
};
/* added a src factory function to force audio/raw MIME type */
-GST_PAD_TEMPLATE_FACTORY (afparse_src_factory,
+static GstStaticPadTemplate afparse_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audiofile_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE), GST_PROPS_BOOLEAN (FALSE)),
- "width", GST_PROPS_INT_RANGE (8, 16),
- "depth", GST_PROPS_INT_RANGE (8, 16),
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, MAX ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "signed = (boolean) { true, false }, "
+ "buffer-frames = (int) [ 1, MAX ]"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (afparse_sink_factory,
+static GstStaticPadTemplate afparse_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "afparse_sink_aiff",
- "audio/x-aiff",
- NULL
- ),
- GST_CAPS_NEW (
- "afparse_sink_wav",
- "audio/x-wav",
- NULL
- ),
- GST_CAPS_NEW (
- "afparse_sink_snd",
- "audio/x-au",
- NULL
+ GST_STATIC_CAPS (
+ "audio/x-aiff; "
+ "audio/x-wav; "
+ "audio/x-au"
)
-)
+);
static void gst_afparse_base_init (gpointer g_class);
static void gst_afparse_class_init(GstAFParseClass *klass);
@@ -131,8 +123,10 @@ gst_afparse_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 (afparse_src_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (afparse_sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&afparse_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&afparse_sink_factory));
gst_element_class_set_details (element_class, &afparse_details);
}
@@ -154,10 +148,12 @@ gst_afparse_class_init (GstAFParseClass *klass)
static void
gst_afparse_init (GstAFParse *afparse)
{
- afparse->srcpad = gst_pad_new_from_template (afparse_src_factory (), "src");
+ afparse->srcpad = gst_pad_new_from_template (
+ gst_element_get_pad_template (GST_ELEMENT (afparse), "src"), "src");
gst_element_add_pad (GST_ELEMENT (afparse), afparse->srcpad);
- afparse->sinkpad = gst_pad_new_from_template (afparse_sink_factory (), "sink");
+ afparse->sinkpad = gst_pad_new_from_template (
+ gst_element_get_pad_template (GST_ELEMENT (afparse), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (afparse), afparse->sinkpad);
gst_element_set_loop_function (GST_ELEMENT (afparse), gst_afparse_loop);
@@ -191,7 +187,6 @@ gst_afparse_loop(GstElement *element)
{
GstAFParse *afparse;
GstBuffer *buf;
- GstBufferPool *bufpool;
gint numframes = 0, frames_to_bytes, frames_per_read, bytes_per_read;
guint8 *data;
gboolean bypass_afread = TRUE;
@@ -230,7 +225,6 @@ gst_afparse_loop(GstElement *element)
frames_per_read = afparse->frames_per_read;
bytes_per_read = frames_per_read * frames_to_bytes;
- bufpool = gst_buffer_pool_get_default (bytes_per_read, 8);
afSeekFrame(afparse->file, AF_DEFAULT_TRACK, 0);
if (bypass_afread){
@@ -269,7 +263,7 @@ gst_afparse_loop(GstElement *element)
}
else {
do {
- buf = gst_buffer_new_from_pool (bufpool, 0, 0);
+ buf = gst_buffer_new_and_alloc (bytes_per_read);
GST_BUFFER_TIMESTAMP(buf) = afparse->timestamp;
data = GST_BUFFER_DATA(buf);
numframes = afReadFrames (afparse->file, AF_DEFAULT_TRACK, data, frames_per_read);
@@ -290,7 +284,6 @@ gst_afparse_loop(GstElement *element)
while (TRUE);
}
gst_afparse_close_file (afparse);
- gst_buffer_pool_unref(bufpool);
gst_bytestream_destroy ((GstByteStream*) afparse->vfile->closure);
@@ -389,17 +382,15 @@ gst_afparse_open_file (GstAFParse *afparse)
/* set caps on src */
/*FIXME: add all the possible formats, especially float ! */
gst_pad_try_set_caps (afparse->srcpad,
- GST_CAPS_NEW (
- "af_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER), /*FIXME */
- "signed", GST_PROPS_BOOLEAN (afparse->is_signed),
- "width", GST_PROPS_INT (afparse->width),
- "depth", GST_PROPS_INT (afparse->width),
- "rate", GST_PROPS_INT (afparse->rate),
- "channels", GST_PROPS_INT (afparse->channels)
- )
- );
+ gst_caps_new_simple (
+ "audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, afparse->is_signed,
+ "width", G_TYPE_INT, afparse->width,
+ "depth", G_TYPE_INT, afparse->width,
+ "rate", G_TYPE_INT, afparse->rate,
+ "channels", G_TYPE_INT, afparse->channels,
+ NULL));
GST_FLAG_SET (afparse, GST_AFPARSE_OPEN);
diff --git a/ext/audiofile/gstafsink.c b/ext/audiofile/gstafsink.c
index efe242d4..5b6b702e 100644
--- a/ext/audiofile/gstafsink.c
+++ b/ext/audiofile/gstafsink.c
@@ -52,22 +52,19 @@ enum {
/* added a sink factory function to force audio/raw MIME type */
/* I think the caps can be broader, we need to change that somehow */
-GST_PAD_TEMPLATE_FACTORY (afsink_sink_factory,
+static GstStaticPadTemplate afsink_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audiofile_sink",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_INT_RANGE (8, 16),
- "depth", GST_PROPS_INT_RANGE (8, 16),
- "rate", GST_PROPS_INT_RANGE (4000, 48000), /*FIXME*/
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, 2 ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "signed = (boolean) { true, false }, "
+ "buffer-frames = (int) [ 1, MAX ]"
)
);
@@ -143,7 +140,8 @@ gst_afsink_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 (afsink_sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&afsink_sink_factory));
gst_element_class_set_details (element_class, &afsink_details);
}
@@ -188,7 +186,7 @@ gst_afsink_init (GstAFSink *afsink)
/* GstPad *pad; this is now done in the struct */
afsink->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (afsink_sink_factory), "sink");
+ gst_element_get_pad_template (GST_ELEMENT (afsink), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (afsink), afsink->sinkpad);
gst_pad_set_chain_function (afsink->sinkpad, gst_afsink_chain);
@@ -284,7 +282,8 @@ static gboolean
gst_afsink_open_file (GstAFSink *sink)
{
AFfilesetup outfilesetup;
- GstCaps *caps;
+ const GstCaps *caps;
+ GstStructure *structure;
int sample_format; /* audiofile's sample format, look in audiofile.h */
int byte_order = 0; /* audiofile's byte order defines */
@@ -301,22 +300,18 @@ gst_afsink_open_file (GstAFSink *sink)
*/
/* get the audio parameters */
- caps = NULL;
g_return_val_if_fail (GST_IS_PAD (sink->sinkpad), FALSE);
caps = GST_PAD_CAPS (sink->sinkpad);
- if (caps == NULL)
- {
- /* FIXME : Please change this to a better warning method ! */
- printf ("WARNING: gstafsink chain : Could not get caps of pad !\n");
- }
- else
- {
- gst_caps_get_int (caps, "channels", &sink->channels);
- gst_caps_get_int (caps, "width", &sink->width);
- gst_caps_get_int (caps, "rate", &sink->rate);
- gst_caps_get_boolean (caps, "signed", &sink->is_signed);
- gst_caps_get_int (caps, "endianness", &sink->endianness_data);
+ if (caps == NULL) {
+ g_critical ("gstafsink chain : Could not get caps of pad !\n");
+ } else {
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "channels", &sink->channels);
+ gst_structure_get_int (structure, "width", &sink->width);
+ gst_structure_get_int (structure, "rate", &sink->rate);
+ gst_structure_get_boolean (structure, "signed", &sink->is_signed);
+ gst_structure_get_int (structure, "endianness", &sink->endianness_data);
}
GST_DEBUG ("channels %d, width %d, rate %d, signed %s",
sink->channels, sink->width, sink->rate,
diff --git a/ext/audiofile/gstafsrc.c b/ext/audiofile/gstafsrc.c
index 13e228fc..0520463d 100644
--- a/ext/audiofile/gstafsrc.c
+++ b/ext/audiofile/gstafsrc.c
@@ -51,22 +51,19 @@ enum {
/* added a src factory function to force audio/raw MIME type */
/* I think the caps can be broader, we need to change that somehow */
-GST_PAD_TEMPLATE_FACTORY (afsrc_src_factory,
+static GstStaticPadTemplate afsrc_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audiofile_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_INT_RANGE (8, 16),
- "depth", GST_PROPS_INT_RANGE (8, 16),
- "rate", GST_PROPS_INT_RANGE (4000, 48000), /*FIXME*/
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, MAX ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "signed = (boolean) { true, false }, "
+ "buffer-frames = (int) [ 1, MAX ]"
)
);
@@ -142,7 +139,8 @@ gst_afsrc_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 (afsrc_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&afsrc_src_factory));
gst_element_class_set_details (element_class, &afsrc_details);
}
@@ -178,7 +176,8 @@ static void
gst_afsrc_init (GstAFSrc *afsrc)
{
/* no need for a template, caps are set based on file, right ? */
- afsrc->srcpad = gst_pad_new_from_template (afsrc_src_factory (), "src");
+ afsrc->srcpad = gst_pad_new_from_template (
+ gst_element_get_pad_template (GST_ELEMENT (afsrc), "src"), "src");
gst_element_add_pad (GST_ELEMENT (afsrc), afsrc->srcpad);
gst_pad_set_get_function (afsrc->srcpad, gst_afsrc_get);
@@ -342,17 +341,14 @@ gst_afsrc_open_file (GstAFSrc *src)
/* set caps on src */
/*FIXME: add all the possible formats, especially float ! */
gst_pad_try_set_caps (src->srcpad,
- GST_CAPS_NEW (
- "af_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER), /*FIXME */
- "signed", GST_PROPS_BOOLEAN (src->is_signed),
- "width", GST_PROPS_INT (src->width),
- "depth", GST_PROPS_INT (src->width),
- "rate", GST_PROPS_INT (src->rate),
- "channels", GST_PROPS_INT (src->channels)
- )
- );
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, src->is_signed,
+ "width", G_TYPE_INT, src->width,
+ "depth", G_TYPE_INT, src->width,
+ "rate", G_TYPE_INT, src->rate,
+ "channels", G_TYPE_INT, src->channels,
+ NULL));
GST_FLAG_SET (src, GST_AFSRC_OPEN);
diff --git a/ext/gsm/gstgsmdec.c b/ext/gsm/gstgsmdec.c
index 095140c1..1359ce97 100644
--- a/ext/gsm/gstgsmdec.c
+++ b/ext/gsm/gstgsmdec.c
@@ -25,8 +25,6 @@
#include "gstgsmdec.h"
-static GstPadTemplate *gsmdec_src_template, *gsmdec_sink_template;
-
/* elementfactory information */
GstElementDetails gst_gsmdec_details = {
"GSM audio decoder",
@@ -51,7 +49,7 @@ static void gst_gsmdec_class_init (GstGSMDec *klass);
static void gst_gsmdec_init (GstGSMDec *gsmdec);
static void gst_gsmdec_chain (GstPad *pad, GstData *_data);
-static GstPadLinkReturn gst_gsmdec_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_gsmdec_sinkconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_gsmdec_signals[LAST_SIGNAL] = { 0 }; */
@@ -77,39 +75,43 @@ gst_gsmdec_get_type(void) {
return gsmdec_type;
}
-GST_CAPS_FACTORY (gsm_caps_factory,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
- )
-)
-
-GST_CAPS_FACTORY (raw_caps_factory,
- GST_CAPS_NEW (
- "gsm_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 (1)
+static GstStaticPadTemplate gsmdec_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (
+ "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
+ )
+);
+
+static GstStaticPadTemplate gsmdec_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"
)
-)
+);
static void
gst_gsmdec_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gsmdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS, gsm_caps_factory(), NULL);
- gsmdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS, raw_caps_factory(), NULL);
- gst_element_class_add_pad_template (element_class, gsmdec_sink_template);
- gst_element_class_add_pad_template (element_class, gsmdec_src_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gsmdec_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gsmdec_src_template));
gst_element_class_set_details (element_class, &gst_gsmdec_details);
}
@@ -129,12 +131,14 @@ gst_gsmdec_init (GstGSMDec *gsmdec)
GST_DEBUG ("gst_gsmdec_init: initializing");
/* create the sink and src pads */
- gsmdec->sinkpad = gst_pad_new_from_template (gsmdec_sink_template, "sink");
+ gsmdec->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gsmdec_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (gsmdec), gsmdec->sinkpad);
gst_pad_set_chain_function (gsmdec->sinkpad, gst_gsmdec_chain);
gst_pad_set_link_function (gsmdec->sinkpad, gst_gsmdec_sinkconnect);
- gsmdec->srcpad = gst_pad_new_from_template (gsmdec_src_template, "src");
+ gsmdec->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gsmdec_src_template), "src");
gst_element_add_pad (GST_ELEMENT (gsmdec), gsmdec->srcpad);
gsmdec->state = gsm_create ();
@@ -142,29 +146,26 @@ gst_gsmdec_init (GstGSMDec *gsmdec)
}
static GstPadLinkReturn
-gst_gsmdec_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_gsmdec_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstGSMDec *gsmdec;
gint rate;
+ GstStructure *structure;
gsmdec = GST_GSMDEC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "rate", &rate);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &rate);
if (gst_pad_try_set_caps (gsmdec->srcpad,
- GST_CAPS_NEW (
- "gsm_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 (rate),
- "channels", GST_PROPS_INT (1)
- )) > 0)
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, 1,
+ NULL)) > 0)
{
return GST_PAD_LINK_OK;
}
diff --git a/ext/gsm/gstgsmenc.c b/ext/gsm/gstgsmenc.c
index d8949b54..a608fea0 100644
--- a/ext/gsm/gstgsmenc.c
+++ b/ext/gsm/gstgsmenc.c
@@ -25,8 +25,6 @@
#include "gstgsmenc.h"
-static GstPadTemplate *gsmenc_src_template, *gsmenc_sink_template;
-
/* elementfactory information */
GstElementDetails gst_gsmenc_details = {
"GSM audio encoder",
@@ -52,7 +50,7 @@ static void gst_gsmenc_class_init (GstGSMEnc *klass);
static void gst_gsmenc_init (GstGSMEnc *gsmenc);
static void gst_gsmenc_chain (GstPad *pad,GstData *_data);
-static GstPadLinkReturn gst_gsmenc_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_gsmenc_sinkconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
static guint gst_gsmenc_signals[LAST_SIGNAL] = { 0 };
@@ -79,45 +77,43 @@ gst_gsmenc_get_type (void)
return gsmenc_type;
}
-GST_CAPS_FACTORY (gsm_caps_factory,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+static GstStaticPadTemplate gsmenc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (
+ "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
-
-GST_CAPS_FACTORY (raw_caps_factory,
- GST_CAPS_NEW (
- "gsm_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 (1)
+);
+
+static GstStaticPadTemplate gsmenc_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"
)
-)
+);
static void
gst_gsmenc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstCaps *raw_caps, *gsm_caps;
- raw_caps = GST_CAPS_GET (raw_caps_factory);
- gsm_caps = GST_CAPS_GET (gsm_caps_factory);
-
- gsmenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
- gsmenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gsm_caps, NULL);
- gst_element_class_add_pad_template (element_class, gsmenc_sink_template);
- gst_element_class_add_pad_template (element_class, gsmenc_src_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gsmenc_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gsmenc_src_template));
gst_element_class_set_details (element_class, &gst_gsmenc_details);
}
@@ -143,12 +139,14 @@ static void
gst_gsmenc_init (GstGSMEnc *gsmenc)
{
/* create the sink and src pads */
- gsmenc->sinkpad = gst_pad_new_from_template (gsmenc_sink_template, "sink");
+ gsmenc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gsmenc_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (gsmenc), gsmenc->sinkpad);
gst_pad_set_chain_function (gsmenc->sinkpad, gst_gsmenc_chain);
gst_pad_set_link_function (gsmenc->sinkpad, gst_gsmenc_sinkconnect);
- gsmenc->srcpad = gst_pad_new_from_template (gsmenc_src_template, "src");
+ gsmenc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gsmenc_src_template), "src");
gst_element_add_pad (GST_ELEMENT (gsmenc), gsmenc->srcpad);
gsmenc->state = gsm_create ();
@@ -158,22 +156,20 @@ gst_gsmenc_init (GstGSMEnc *gsmenc)
}
static GstPadLinkReturn
-gst_gsmenc_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_gsmenc_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstGSMEnc *gsmenc;
+ GstStructure *structure;
gsmenc = GST_GSMENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "rate", &gsmenc->rate);
- if (gst_pad_try_set_caps (gsmenc->srcpad, GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT (gsmenc->rate),
- "channels", GST_PROPS_INT (1)
- )) > 0)
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &gsmenc->rate);
+ if (gst_pad_try_set_caps (gsmenc->srcpad,
+ gst_caps_new_simple("audio/x-gsm",
+ "rate", G_TYPE_INT, gsmenc->rate,
+ "channels", G_TYPE_INT, 1,
+ NULL)) > 0)
{
return GST_PAD_LINK_OK;
}
@@ -195,16 +191,6 @@ gst_gsmenc_chain (GstPad *pad, GstData *_data)
gsmenc = GST_GSMENC (GST_OBJECT_PARENT (pad));
- if (!GST_PAD_CAPS (gsmenc->srcpad)) {
- gst_pad_try_set_caps (gsmenc->srcpad,
- GST_CAPS_NEW (
- "gsm_enc",
- "audio/x-gsm",
- "rate", GST_PROPS_INT (gsmenc->rate),
- "channels", GST_PROPS_INT (1)
- ));
- }
-
data = (gsm_signal*) GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf) / sizeof (gsm_signal);
diff --git a/ext/hermes/gstcolorspace.c b/ext/hermes/gstcolorspace.c
index 837c24e4..7a42e905 100644
--- a/ext/hermes/gstcolorspace.c
+++ b/ext/hermes/gstcolorspace.c
@@ -58,11 +58,7 @@ static void gst_colorspace_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
static GstPadLinkReturn
- gst_colorspace_sinkconnect (GstPad *pad, GstCaps *caps);
-static GstPadLinkReturn
- gst_colorspace_srcconnect (GstPad *pad, GstCaps *caps);
-static GstPadLinkReturn
- gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps);
+ gst_colorspace_link (GstPad *pad, const GstCaps *caps);
static void gst_colorspace_chain (GstPad *pad, GstData *_data);
static GstElementStateReturn
gst_colorspace_change_state (GstElement *element);
@@ -77,36 +73,24 @@ static GstPadTemplate *srctempl, *sinktempl;
static GstElementClass *parent_class = NULL;
/*static guint gst_colorspace_signals[LAST_SIGNAL] = { 0 }; */
-static GstBufferPool*
-colorspace_get_bufferpool (GstPad *pad)
-{
- GstColorspace *space;
-
- space = GST_COLORSPACE (gst_pad_get_parent (pad));
-
- if (space->type == GST_COLORSPACE_NONE && !space->disabled)
- return gst_pad_get_bufferpool (space->srcpad);
- else
- return NULL;
-}
-
static gboolean
colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *to_caps)
{
guint32 from_space, to_space;
+ GstStructure *from_struct;
+ GstStructure *to_struct;
g_return_val_if_fail (to_caps != NULL, FALSE);
g_return_val_if_fail (from_caps != NULL, FALSE);
- if (gst_caps_has_property (from_caps, "format"))
- gst_caps_get_fourcc_int (from_caps, "format", &from_space);
- else
- from_space = GST_MAKE_FOURCC ('R','G','B',' ');
+ from_struct = gst_caps_get_structure (from_caps, 0);
+ to_struct = gst_caps_get_structure (to_caps, 0);
- if (gst_caps_has_property (to_caps, "format"))
- gst_caps_get_fourcc_int (to_caps, "format", &to_space);
- else
- to_space = GST_MAKE_FOURCC ('R','G','B',' ');
+ from_space = GST_MAKE_FOURCC ('R','G','B',' ');
+ gst_structure_get_fourcc (from_struct, "format", &from_space);
+
+ to_space = GST_MAKE_FOURCC ('R','G','B',' ');
+ gst_structure_get_fourcc (to_struct, "format", &to_space);
GST_INFO ("set up converter for " GST_FOURCC_FORMAT
" (%08x) to " GST_FOURCC_FORMAT " (%08x)",
@@ -118,7 +102,7 @@ colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *t
{
gint from_bpp;
- gst_caps_get_int (from_caps, "bpp", &from_bpp);
+ gst_structure_get_int (from_struct, "bpp", &from_bpp);
switch (to_space) {
case GST_MAKE_FOURCC ('R','G','B',' '):
@@ -126,11 +110,11 @@ colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *t
{
gint to_bpp;
- gst_caps_get_int (to_caps, "bpp", &to_bpp);
+ gst_structure_get_int (to_struct, "bpp", &to_bpp);
- gst_caps_get_int (from_caps, "red_mask", &space->source.r);
- gst_caps_get_int (from_caps, "green_mask", &space->source.g);
- gst_caps_get_int (from_caps, "blue_mask", &space->source.b);
+ gst_structure_get_int (from_struct, "red_mask", &space->source.r);
+ gst_structure_get_int (from_struct, "green_mask", &space->source.g);
+ gst_structure_get_int (from_struct, "blue_mask", &space->source.b);
space->source.a = 0;
space->srcbpp = space->source.bits = from_bpp;
space->source.indexed = 0;
@@ -141,9 +125,9 @@ colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *t
GST_INFO ( "source blue mask %08x", space->source.b);
GST_INFO ( "source bpp %08x", space->srcbpp);
- gst_caps_get_int (to_caps, "red_mask", &space->dest.r);
- gst_caps_get_int (to_caps, "green_mask", &space->dest.g);
- gst_caps_get_int (to_caps, "blue_mask", &space->dest.b);
+ gst_structure_get_int (to_struct, "red_mask", &space->dest.r);
+ gst_structure_get_int (to_struct, "green_mask", &space->dest.g);
+ gst_structure_get_int (to_struct, "blue_mask", &space->dest.b);
space->dest.a = 0;
space->destbpp = space->dest.bits = to_bpp;
space->dest.indexed = 0;
@@ -189,7 +173,7 @@ colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *t
case GST_MAKE_FOURCC ('R','G','B',' '):
GST_INFO ( "colorspace: YUV to RGB");
- gst_caps_get_int (to_caps, "bpp", &space->destbpp);
+ gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter = gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_COLORSPACE_YUV_RGB;
return TRUE;
@@ -224,7 +208,7 @@ colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *t
case GST_MAKE_FOURCC ('R','G','B',' '):
GST_INFO ( "colorspace: YV12 to RGB");
- gst_caps_get_int (to_caps, "bpp", &space->destbpp);
+ gst_structure_get_int (to_struct, "bpp", &space->destbpp);
space->converter = gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
space->type = GST_COLORSPACE_YUV_RGB;
return TRUE;
@@ -243,163 +227,68 @@ colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *t
}
static GstCaps*
-gst_colorspace_getcaps (GstPad *pad, GstCaps *caps)
+gst_colorspace_getcaps (GstPad *pad)
{
GstColorspace *space;
- GstCaps *result;
GstCaps *peercaps;
- GstCaps *ourcaps, *temp;
+ GstCaps *ourcaps;
space = GST_COLORSPACE (gst_pad_get_parent (pad));
/* we can do everything our peer can... */
- temp = gst_pad_get_allowed_caps (space->srcpad);
- peercaps = gst_caps_copy (temp);
- gst_caps_unref (temp);
+ peercaps = gst_pad_get_allowed_caps (space->srcpad);
/* and our own template of course */
- temp = gst_pad_get_pad_template_caps (pad);
- ourcaps = gst_caps_copy (temp);
- gst_caps_unref (temp);
+ ourcaps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
/* merge them together, we prefer the peercaps first */
- result = gst_caps_prepend (ourcaps, peercaps);
+ gst_caps_append (peercaps, ourcaps);
- return result;
+ return peercaps;
}
static GstPadLinkReturn
-gst_colorspace_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_colorspace_link (GstPad *pad, const GstCaps *caps)
{
GstColorspace *space;
- GstPad *peer;
+ GstPad *otherpad;
+ GstStructure *structure;
space = GST_COLORSPACE (gst_pad_get_parent (pad));
+ otherpad = (pad == space->sinkpad) ? space->srcpad : space->sinkpad;
- if (!GST_CAPS_IS_FIXED (caps)) {
- return GST_PAD_LINK_DELAYED;
- }
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "width", &space->width);
- gst_caps_get_int (caps, "height", &space->height);
- gst_caps_get_float (caps, "framerate", &space->fps);
+ gst_structure_get_int (structure, "width", &space->width);
+ gst_structure_get_int (structure, "height", &space->height);
+ gst_structure_get_double (structure, "framerate", &space->fps);
GST_INFO ( "size: %dx%d", space->width, space->height);
- gst_caps_replace_sink (&space->sinkcaps, caps);
-
- peer = gst_pad_get_peer (pad);
- if (peer) {
- GstCaps *allowed = gst_pad_get_allowed_caps (space->srcpad);
- if (gst_colorspace_srcconnect_func (pad, allowed, FALSE) < 1) {
- space->sinkcaps = NULL;
- gst_caps_unref (allowed);
- return GST_PAD_LINK_REFUSED;
- }
- gst_caps_unref (allowed);
+ if (pad == space->sinkpad) {
+ gst_caps_replace (&space->sinkcaps, gst_caps_copy(caps));
+ } else {
+ gst_caps_replace (&space->srccaps, gst_caps_copy(caps));
}
- return GST_PAD_LINK_OK;
-}
-
-static GstPadLinkReturn
-gst_colorspace_srcconnect (GstPad *pad, GstCaps *caps)
-{
- return gst_colorspace_srcconnect_func (pad, caps, TRUE);
-}
-
-static GstPadLinkReturn
-gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps)
-{
- GstColorspace *space;
- GstCaps *peercaps;
- GstCaps *ourcaps, *to_intersect, *try_peercaps;
- GstPadLinkReturn res = GST_PAD_LINK_REFUSED;
-
- space = GST_COLORSPACE (gst_pad_get_parent (pad));
-
- /* we cannot operate if we didn't get src caps */
- ourcaps = space->sinkcaps;
- if (!ourcaps) {
- if (newcaps)
- gst_pad_recalc_allowed_caps (space->sinkpad);
-
+#if 0
+ peer = gst_pad_get_peer (otherpad);
+ if (!peer) {
return GST_PAD_LINK_DELAYED;
}
+#endif
- /* first see if we can do the format natively by filtering the peer caps
- * with our incomming caps */
- peercaps = gst_caps_intersect (caps, ourcaps);
- if (peercaps) {
- GstCaps *trycaps;
-
- trycaps = peercaps;
- while(trycaps){
- GstCaps *caps1 = gst_caps_copy_1(trycaps);
-
- /* see if the peer likes it too, it should as the caps say so.. */
- if (gst_pad_try_set_caps (space->srcpad, caps1) > 0) {
- space->type = GST_COLORSPACE_NONE;
- space->disabled = FALSE;
- gst_caps_unref (peercaps);
- peercaps = caps1;
- res = GST_PAD_LINK_DONE;
- goto success;
- }
- trycaps = trycaps->next;
- }
- gst_caps_unref (peercaps);
- }
+ if (gst_pad_try_set_caps (otherpad, caps) >= 0) {
+ space->passthru = TRUE;
- to_intersect = gst_caps_append (
- GST_CAPS_NEW (
- "colorspace_filter",
- "video/x-raw-yuv",
- "width", GST_PROPS_INT (space->width),
- "height", GST_PROPS_INT (space->height),
- "framerate", GST_PROPS_FLOAT (space->fps)
- ), GST_CAPS_NEW (
- "colorspace_filter",
- "video/x-raw-rgb",
- "width", GST_PROPS_INT (space->width),
- "height", GST_PROPS_INT (space->height),
- "framerate", GST_PROPS_FLOAT (space->fps)
- ));
-
- /* then see what the peer has that matches the size */
- peercaps = gst_caps_intersect (caps, to_intersect);
- gst_caps_unref (to_intersect);
-
- /* we are looping over the caps, so we have to get rid of the lists */
- try_peercaps = gst_caps_normalize (peercaps);
- gst_caps_unref (peercaps);
- peercaps = try_peercaps;
-
- /* loop over all possibilities and select the first one we can convert and
- * is accepted by the peer */
- while (peercaps) {
- GstCaps *peer1 = gst_caps_copy_1(peercaps);
-
- if (colorspace_setup_converter (space, ourcaps, peer1)) {
- if (gst_pad_try_set_caps (space->srcpad, peer1) > 0) {
- space->disabled = FALSE;
- gst_caps_unref (try_peercaps);
- res = GST_PAD_LINK_DONE;
- goto success;
- }
- }
- peercaps = peercaps->next;
+ return GST_PAD_LINK_OK;
}
- gst_caps_unref (try_peercaps);
-
- /* we disable ourself here */
- space->disabled = TRUE;
- goto done;
-success:
-done:
+ if (colorspace_setup_converter (space, space->sinkcaps, space->srccaps)) {
+ return GST_PAD_LINK_OK;
+ }
- return res;
+ return GST_PAD_LINK_REFUSED;
}
GType
@@ -431,40 +320,22 @@ gst_colorspace_base_init (gpointer g_class)
GstCaps *caps;
/* create caps for templates */
- caps = gst_caps_new ("csp_templ_yuv",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("YV12")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2")))));
- caps = gst_caps_append (caps,
- gst_caps_new ("csp_templ_rgb24_32",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32_REVERSE));
- caps = gst_caps_append (caps,
- gst_caps_new ("csp_templ_rgb24_32",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32));
- caps = gst_caps_append (caps,
- gst_caps_new ("csp_templ_rgb15",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15));
- caps = gst_caps_append (caps,
- gst_caps_new ("csp_templ_rgb16",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_16));
+ caps = gst_caps_from_string (
+ GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("{ I420, YV12, YUY2 }") "; "
+ GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_32_REVERSE "; "
+ GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_32 "; "
+ GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_15 "; "
+ GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_16);
/* build templates */
srctempl = gst_pad_template_new ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- caps, NULL);
- gst_caps_ref (caps);
+ caps);
sinktempl = gst_pad_template_new ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- caps, NULL);
+ caps);
gst_element_class_add_pad_template (element_class, srctempl);
gst_element_class_add_pad_template (element_class, sinktempl);
gst_element_class_set_details (element_class, &colorspace_details);
@@ -491,22 +362,20 @@ static void
gst_colorspace_init (GstColorspace *space)
{
space->sinkpad = gst_pad_new_from_template (sinktempl, "sink");
- gst_pad_set_link_function (space->sinkpad, gst_colorspace_sinkconnect);
+ gst_pad_set_link_function (space->sinkpad, gst_colorspace_link);
gst_pad_set_getcaps_function (space->sinkpad, gst_colorspace_getcaps);
- gst_pad_set_bufferpool_function (space->sinkpad, colorspace_get_bufferpool);
gst_pad_set_chain_function(space->sinkpad,gst_colorspace_chain);
gst_element_add_pad(GST_ELEMENT(space),space->sinkpad);
space->srcpad = gst_pad_new_from_template (srctempl, "src");
gst_element_add_pad(GST_ELEMENT(space),space->srcpad);
- gst_pad_set_link_function (space->srcpad, gst_colorspace_srcconnect);
+ gst_pad_set_link_function (space->srcpad, gst_colorspace_link);
#ifdef HAVE_HERMES
space->h_handle = Hermes_ConverterInstance (0);
#endif
- space->pool = NULL;
space->converter = NULL;
- space->disabled = TRUE;
+ space->passthru = FALSE;
}
static void
@@ -516,6 +385,7 @@ gst_colorspace_chain (GstPad *pad,GstData *_data)
GstColorspace *space;
gint size;
GstBuffer *outbuf = NULL;
+ gint dest_bytes, src_bytes;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
@@ -526,74 +396,55 @@ gst_colorspace_chain (GstPad *pad,GstData *_data)
g_return_if_fail (space != NULL);
g_return_if_fail (GST_IS_COLORSPACE (space));
- if (space->disabled) {
- gst_buffer_unref (buf);
+ if (space->passthru) {
+ gst_pad_push (space->srcpad, _data);
return;
}
- if (space->type == GST_COLORSPACE_NONE) {
- outbuf = buf;
- }
- else {
- gint dest_bytes, src_bytes;
-
- size = space->width * space->height;
- dest_bytes = ((space->destbpp+7)/8);
- src_bytes = ((space->srcbpp+7)/8);
-
- if (!space->pool)
- space->pool = gst_pad_get_bufferpool (space->srcpad);
-
- if (space->pool) {
- outbuf = gst_buffer_new_from_pool (space->pool, 0, 0);
- }
-
- if (!outbuf) {
- outbuf = gst_buffer_new ();
+ size = space->width * space->height;
+ dest_bytes = ((space->destbpp+7)/8);
+ src_bytes = ((space->srcbpp+7)/8);
- GST_BUFFER_SIZE (outbuf) = (size * space->destbpp)/8;
- GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
- }
+ outbuf = gst_buffer_new_and_alloc ((size * space->destbpp)/8);
- if (space->type == GST_COLORSPACE_YUV_RGB) {
- gst_colorspace_convert (space->converter, GST_BUFFER_DATA (buf), GST_BUFFER_DATA (outbuf));
- }
+ if (space->type == GST_COLORSPACE_YUV_RGB) {
+ gst_colorspace_convert (space->converter, GST_BUFFER_DATA (buf), GST_BUFFER_DATA (outbuf));
+ }
#ifdef HAVE_HERMES
- else if (space->type == GST_COLORSPACE_HERMES) {
- Hermes_ConverterCopy (space->h_handle,
- GST_BUFFER_DATA (buf), 0, 0, space->width, space->height, space->width * src_bytes,
- GST_BUFFER_DATA (outbuf), 0, 0, space->width, space->height, space->width * dest_bytes);
- }
+ else if (space->type == GST_COLORSPACE_HERMES) {
+ Hermes_ConverterCopy (space->h_handle,
+ GST_BUFFER_DATA (buf), 0, 0, space->width, space->height, space->width * src_bytes,
+ GST_BUFFER_DATA (outbuf), 0, 0, space->width, space->height, space->width * dest_bytes);
+ }
#endif
- else if (space->type == GST_COLORSPACE_YUY2_I420) {
- gst_colorspace_yuy2_to_i420 (GST_BUFFER_DATA (buf),
- GST_BUFFER_DATA (outbuf),
- space->width,
- space->height);
- }
- else if (space->type == GST_COLORSPACE_420_SWAP) {
- gst_colorspace_i420_to_yv12 (GST_BUFFER_DATA (buf),
- GST_BUFFER_DATA (outbuf),
- space->width,
- space->height);
- }
- else if (space->type == GST_COLORSPACE_RGB32_I420) {
- gst_colorspace_rgb32_to_i420 (GST_BUFFER_DATA (buf),
- GST_BUFFER_DATA (outbuf),
- space->width,
- space->height);
- }
- else if (space->type == GST_COLORSPACE_RGB32_YV12) {
- gst_colorspace_rgb32_to_yv12 (GST_BUFFER_DATA (buf),
- GST_BUFFER_DATA (outbuf),
- space->width,
- space->height);
- }
+ else if (space->type == GST_COLORSPACE_YUY2_I420) {
+ gst_colorspace_yuy2_to_i420 (GST_BUFFER_DATA (buf),
+ GST_BUFFER_DATA (outbuf),
+ space->width,
+ space->height);
+ }
+ else if (space->type == GST_COLORSPACE_420_SWAP) {
+ gst_colorspace_i420_to_yv12 (GST_BUFFER_DATA (buf),
+ GST_BUFFER_DATA (outbuf),
+ space->width,
+ space->height);
+ }
+ else if (space->type == GST_COLORSPACE_RGB32_I420) {
+ gst_colorspace_rgb32_to_i420 (GST_BUFFER_DATA (buf),
+ GST_BUFFER_DATA (outbuf),
+ space->width,
+ space->height);
+ }
+ else if (space->type == GST_COLORSPACE_RGB32_YV12) {
+ gst_colorspace_rgb32_to_yv12 (GST_BUFFER_DATA (buf),
+ GST_BUFFER_DATA (outbuf),
+ space->width,
+ space->height);
+ }
- GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
+ GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
- gst_buffer_unref (buf);
- }
+ gst_buffer_unref (buf);
gst_pad_push (space->srcpad, GST_DATA (outbuf));
}
@@ -608,14 +459,10 @@ gst_colorspace_change_state (GstElement *element)
case GST_STATE_PAUSED_TO_PLAYING:
break;
case GST_STATE_PLAYING_TO_PAUSED:
- if (space->pool)
- gst_buffer_pool_unref (space->pool);
- space->pool = NULL;
break;
case GST_STATE_PAUSED_TO_READY:
gst_colorspace_converter_destroy (space->converter);
space->converter = NULL;
- space->disabled = TRUE;
space->type = GST_COLORSPACE_NONE;
gst_caps_replace (&space->sinkcaps, NULL);
break;
diff --git a/ext/hermes/gstcolorspace.h b/ext/hermes/gstcolorspace.h
index ef8a8bfe..0cf6f2d7 100644
--- a/ext/hermes/gstcolorspace.h
+++ b/ext/hermes/gstcolorspace.h
@@ -75,13 +75,12 @@ struct _GstColorspace {
GstColorSpaceConverterType type;
gint width, height;
- gfloat fps;
+ gdouble fps;
gint srcbpp, destbpp;
- gboolean disabled;
+ gboolean passthru;
GstCaps *sinkcaps;
-
- GstBufferPool *pool;
+ GstCaps *srccaps;
};
struct _GstColorspaceClass {
diff --git a/ext/hermes/yuv2rgb.c b/ext/hermes/yuv2rgb.c
index a1669b25..b3b1b494 100644
--- a/ext/hermes/yuv2rgb.c
+++ b/ext/hermes/yuv2rgb.c
@@ -105,22 +105,26 @@ static GstColorSpaceYUVTables * gst_colorspace_init_yuv(long depth,
long red_mask, long green_mask, long blue_mask);
GstColorSpaceConverter*
-gst_colorspace_yuv2rgb_get_converter (GstCaps *from, GstCaps *to)
+gst_colorspace_yuv2rgb_get_converter (const GstCaps *from, const GstCaps *to)
{
guint32 from_space;
GstColorSpaceConverter *new;
gint to_bpp;
+ GstStructure *struct_from, *struct_to;
GST_DEBUG ("gst_colorspace_yuv2rgb_get_converter");
new = g_malloc (sizeof (GstColorSpaceConverter));
- gst_caps_get_int (from, "width", &new->width);
- gst_caps_get_int (from, "height", &new->height);
+ struct_from = gst_caps_get_structure (from, 0);
+ struct_to = gst_caps_get_structure (to, 0);
+
+ gst_structure_get_int (struct_from, "width", &new->width);
+ gst_structure_get_int (struct_from, "height", &new->height);
new->color_tables = NULL;
- gst_caps_get_fourcc_int (from, "format", &from_space);
- gst_caps_get_int (to, "bpp", &to_bpp);
+ gst_structure_get_fourcc (struct_from, "format", &from_space);
+ gst_structure_get_int (struct_to, "bpp", &to_bpp);
/* FIXME we leak new here. */
@@ -132,9 +136,9 @@ gst_colorspace_yuv2rgb_get_converter (GstCaps *from, GstCaps *to)
gint green_mask;
gint blue_mask;
- gst_caps_get_int (to, "red_mask", &red_mask);
- gst_caps_get_int (to, "green_mask", &green_mask);
- gst_caps_get_int (to, "blue_mask", &blue_mask);
+ gst_structure_get_int (struct_to, "red_mask", &red_mask);
+ gst_structure_get_int (struct_to, "green_mask", &green_mask);
+ gst_structure_get_int (struct_to, "blue_mask", &blue_mask);
GST_INFO ( "red_mask %08x", red_mask);
GST_INFO ( "green_mask %08x", green_mask);
diff --git a/ext/hermes/yuv2rgb.h b/ext/hermes/yuv2rgb.h
index 699234a3..7edfa377 100644
--- a/ext/hermes/yuv2rgb.h
+++ b/ext/hermes/yuv2rgb.h
@@ -59,7 +59,7 @@ struct _GstColorSpaceConverter {
};
-GstColorSpaceConverter* gst_colorspace_yuv2rgb_get_converter (GstCaps *from, GstCaps *to);
+GstColorSpaceConverter* gst_colorspace_yuv2rgb_get_converter (const GstCaps *from, const GstCaps *to);
#define gst_colorspace_convert(converter, src, dest) \
(converter)->convert((converter), (src), (dest))
void gst_colorspace_converter_destroy (GstColorSpaceConverter *space);
diff --git a/ext/jack/gstjack.c b/ext/jack/gstjack.c
index 85d57658..4a987ae1 100644
--- a/ext/jack/gstjack.c
+++ b/ext/jack/gstjack.c
@@ -77,7 +77,7 @@ static GstPadTemplate* gst_jack_sink_request_pad_factory();
static GstPad* gst_jack_request_new_pad (GstElement *element, GstPadTemplate *templ,
const gchar *name);
static GstElementStateReturn gst_jack_change_state (GstElement *element);
-static GstPadLinkReturn gst_jack_link (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_jack_link (GstPad *pad, const GstCaps *caps);
static void gst_jack_loop (GstElement *element);
@@ -264,11 +264,9 @@ gst_jack_src_request_pad_factory (void)
if (!template) {
GstCaps *caps;
- caps = gst_caps_new ("src",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS);
+ caps = gst_caps_from_string (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
template = gst_pad_template_new ("%s", GST_PAD_SRC,
- GST_PAD_REQUEST, caps, NULL);
+ GST_PAD_REQUEST, caps);
}
return template;
@@ -281,11 +279,9 @@ gst_jack_sink_request_pad_factory (void)
if (!template) {
GstCaps *caps;
- caps = gst_caps_new ("sink",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS);
+ caps = gst_caps_from_string (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
template = gst_pad_template_new ("%s", GST_PAD_SINK,
- GST_PAD_REQUEST, caps, NULL);
+ GST_PAD_REQUEST, caps);
}
return template;
@@ -397,10 +393,10 @@ gst_jack_change_state (GstElement *element)
while (l) {
pad = GST_JACK_PAD (l);
caps = gst_pad_get_caps (pad->pad);
- gst_caps_set (caps, "rate", GST_PROPS_INT_TYPE,
- (gint)this->bin->rate, NULL);
- gst_caps_set (caps, "buffer-frames", GST_PROPS_INT_TYPE,
- (gint)this->bin->nframes, NULL);
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT, (int)this->bin->rate,
+ "buffer-frames", G_TYPE_INT, (gint)this->bin->nframes,
+ NULL);
if (gst_pad_try_set_caps (pad->pad, caps) <= 0)
return GST_STATE_FAILURE;
l = g_list_next (l);
@@ -421,24 +417,22 @@ gst_jack_change_state (GstElement *element)
}
static GstPadLinkReturn
-gst_jack_link (GstPad *pad, GstCaps *caps)
+gst_jack_link (GstPad *pad, const GstCaps *caps)
{
GstJack *this;
gint rate, buffer_frames;
+ GstStructure *structure;
this = GST_JACK (GST_OBJECT_PARENT (pad));
- if (GST_CAPS_IS_FIXED (caps)) {
- gst_caps_get_int (caps, "rate", &rate);
- gst_caps_get_int (caps, "buffer-frames", &buffer_frames);
- if (this->bin && (rate != this->bin->rate ||
- buffer_frames != this->bin->nframes))
- return GST_PAD_LINK_REFUSED;
-
- return GST_PAD_LINK_OK;
- }
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &rate);
+ gst_structure_get_int (structure, "buffer-frames", &buffer_frames);
+ if (this->bin && (rate != this->bin->rate ||
+ buffer_frames != this->bin->nframes))
+ return GST_PAD_LINK_REFUSED;
- return GST_PAD_LINK_DELAYED;
+ return GST_PAD_LINK_OK;
}
static void
diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c
index 6ecb3ce1..ff2711fc 100644
--- a/ext/ladspa/gstladspa.c
+++ b/ext/ladspa/gstladspa.c
@@ -37,45 +37,15 @@
#define LADSPA_VERSION "1.0"
#endif
-/* takes ownership of the name */
-static GstPadTemplate*
-ladspa_sink_factory (gchar *name)
-{
- return GST_PAD_TEMPLATE_NEW (
- name,
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "ladspa_sink",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
- );
-}
-
-/* takes ownership of the name */
-static GstPadTemplate*
-ladspa_src_factory (gchar *name)
-{
- return GST_PAD_TEMPLATE_NEW (
- name,
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "ladspa_src",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
- );
-}
+static GstStaticCaps ladspa_pad_caps =
+GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
static void gst_ladspa_class_init (GstLADSPAClass *klass);
static void gst_ladspa_base_init (GstLADSPAClass *klass);
static void gst_ladspa_init (GstLADSPA *ladspa);
static void gst_ladspa_update_int (const GValue *value, gpointer data);
-static GstPadLinkReturn gst_ladspa_link (GstPad *pad, GstCaps *caps);
-static void gst_ladspa_force_src_caps (GstLADSPA *ladspa, GstPad *pad);
+static GstPadLinkReturn gst_ladspa_link (GstPad *pad, const GstCaps *caps);
static void gst_ladspa_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_ladspa_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@@ -141,10 +111,12 @@ gst_ladspa_base_init (GstLADSPAClass *klass)
/* the factories take ownership of the name */
if (LADSPA_IS_PORT_INPUT(desc->PortDescriptors[j])) {
- templ = ladspa_sink_factory (name);
+ templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsinkpads++;
} else {
- templ = ladspa_src_factory (name);
+ templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS,
+ gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsrcpads++;
}
@@ -456,7 +428,6 @@ gst_ladspa_init (GstLADSPA *ladspa)
ladspa->buffer_frames = 0; /* should be set with caps */
ladspa->activated = FALSE;
- ladspa->bufpool = NULL;
ladspa->inplace_broken = LADSPA_IS_INPLACE_BROKEN(ladspa->descriptor->Properties);
if (sinkcount==0 && srccount == 1) {
@@ -492,52 +463,43 @@ gst_ladspa_update_int(const GValue *value, gpointer data)
}
static GstPadLinkReturn
-gst_ladspa_link (GstPad *pad, GstCaps *caps)
+gst_ladspa_link (GstPad *pad, const GstCaps *caps)
{
GstElement *element = (GstElement*)GST_PAD_PARENT (pad);
GstLADSPA *ladspa = (GstLADSPA*)element;
const GList *l = NULL;
gint rate;
+ GstStructure *structure;
- if (GST_CAPS_IS_FIXED (caps)) {
- /* if this fails in some other plugin, the graph is left in an inconsistent
- state */
- for (l=gst_element_get_pad_list (element); l; l=l->next)
- if (pad != (GstPad*)l->data)
- if (gst_pad_try_set_caps ((GstPad*)l->data, caps) <= 0)
- return GST_PAD_LINK_REFUSED;
-
- /* we assume that the ladspa plugin can handle any sample rate, so this
- check gets put last */
- gst_caps_get_int (caps, "rate", &rate);
- /* have to instantiate ladspa plugin when samplerate changes (groan) */
- if (ladspa->samplerate != rate) {
- ladspa->samplerate = rate;
- if (! gst_ladspa_instantiate(ladspa))
+ /* if this fails in some other plugin, the graph is left in an inconsistent
+ state */
+ for (l=gst_element_get_pad_list (element); l; l=l->next)
+ if (pad != (GstPad*)l->data)
+ if (gst_pad_try_set_caps ((GstPad*)l->data, caps) <= 0)
return GST_PAD_LINK_REFUSED;
- }
-
- gst_caps_get_int (caps, "buffer-frames", &ladspa->buffer_frames);
-
- if (ladspa->bufpool)
- gst_buffer_pool_unref (ladspa->bufpool);
- ladspa->bufpool = gst_buffer_pool_get_default (ladspa->buffer_frames * sizeof(gfloat),
- 3);
-
- return GST_PAD_LINK_OK;
+
+ /* we assume that the ladspa plugin can handle any sample rate, so this
+ check gets put last */
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &rate);
+ /* have to instantiate ladspa plugin when samplerate changes (groan) */
+ if (ladspa->samplerate != rate) {
+ ladspa->samplerate = rate;
+ if (! gst_ladspa_instantiate(ladspa))
+ return GST_PAD_LINK_REFUSED;
}
- return GST_PAD_LINK_DELAYED;
+ gst_structure_get_int (structure, "buffer-frames", &ladspa->buffer_frames);
+
+ return GST_PAD_LINK_OK;
}
+#if 0
static void
gst_ladspa_force_src_caps(GstLADSPA *ladspa, GstPad *pad)
{
if (!ladspa->buffer_frames) {
ladspa->buffer_frames = 256; /* 5 ms at 44100 kHz (just a default...) */
- g_return_if_fail (ladspa->bufpool == NULL);
- ladspa->bufpool =
- gst_buffer_pool_get_default (ladspa->buffer_frames * sizeof(gfloat), 3);
}
DEBUG_OBJ (ladspa, "forcing caps with rate=%d, buffer-frames=%d",
@@ -548,13 +510,14 @@ gst_ladspa_force_src_caps(GstLADSPA *ladspa, GstPad *pad)
"ladspa_src_caps",
"audio/x-raw-float",
gst_props_new (
- "width", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "rate", GST_PROPS_INT (ladspa->samplerate),
- "buffer-frames", GST_PROPS_INT (ladspa->buffer_frames),
- "channels", GST_PROPS_INT (1),
+ "width", G_TYPE_INT (32),
+ "endianness", G_TYPE_INT (G_BYTE_ORDER),
+ "rate", G_TYPE_INT (ladspa->samplerate),
+ "buffer-frames", G_TYPE_INT (ladspa->buffer_frames),
+ "channels", G_TYPE_INT (1),
NULL)));
}
+#endif
static void
gst_ladspa_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
@@ -759,11 +722,6 @@ gst_ladspa_loop (GstElement *element)
GST_BUFFER_TIMESTAMP(buffers_in[i]) = ladspa->timestamp;
}
- if (!ladspa->bufpool) {
- gst_element_error (element, "Caps were never set, bailing...");
- return;
- }
-
i=0;
if (!ladspa->inplace_broken) {
for (; i<numsrcpads && i<numsinkpads; i++) {
@@ -773,8 +731,7 @@ gst_ladspa_loop (GstElement *element)
}
}
for (; i<numsrcpads; i++) {
- /* we have to make new buffers -- at least we're taking them from a pool */
- buffers_out[i] = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
+ buffers_out[i] = gst_buffer_new_and_alloc (ladspa->buffer_frames * sizeof(gfloat));
GST_BUFFER_TIMESTAMP (buffers_out[i]) = ladspa->timestamp;
data_out[i] = (LADSPA_Data*)GST_BUFFER_DATA (buffers_out[i]);
}
@@ -850,11 +807,6 @@ gst_ladspa_chain (GstPad *pad, GstData *_data)
/* we shouldn't get events here... */
g_return_if_fail (GST_IS_BUFFER (buffer_in));
- if (!ladspa->bufpool) {
- gst_element_error ((GstElement*)ladspa, "Caps were never set, bailing...");
- return;
- }
-
/* FIXME: this function shouldn't need to malloc() anything */
if (numsrcpads > 0) {
buffers_out = g_new(GstBuffer*, numsrcpads);
@@ -870,11 +822,7 @@ gst_ladspa_chain (GstPad *pad, GstData *_data)
i++;
}
for (; i<numsrcpads; i++) {
- /* we have to make new buffers -- at least we're taking them from a pool */
- buffers_out[i] = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
- /* the size of the buffer returned from the pool is the maximum size; this
- chained buffer might be smaller */
- GST_BUFFER_SIZE (buffers_out[i]) = GST_BUFFER_SIZE (buffer_in);
+ buffers_out[i] = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(buffer_in));
DEBUG ("new %d", GST_BUFFER_SIZE (buffer_in));
GST_BUFFER_TIMESTAMP (buffers_out[i]) = ladspa->timestamp;
data_out[i] = (LADSPA_Data*)GST_BUFFER_DATA (buffers_out[i]);
@@ -932,12 +880,8 @@ gst_ladspa_get(GstPad *pad)
oclass = (GstLADSPAClass*)(G_OBJECT_GET_CLASS(ladspa));
desc = ladspa->descriptor;
- if (!ladspa->bufpool) {
- /* capsnego hasn't happened... */
- gst_ladspa_force_src_caps(ladspa, ladspa->srcpads[0]);
- }
-
- buf = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
+ /* 4096 is arbitrary */
+ buf = gst_buffer_new_and_alloc (4096);
GST_BUFFER_TIMESTAMP(buf) = ladspa->timestamp;
data = (LADSPA_Data *) GST_BUFFER_DATA(buf);
diff --git a/ext/ladspa/gstladspa.h b/ext/ladspa/gstladspa.h
index b588ffa4..f3556f74 100644
--- a/ext/ladspa/gstladspa.h
+++ b/ext/ladspa/gstladspa.h
@@ -59,8 +59,6 @@ struct _GstLADSPA {
GstPad **sinkpads,
**srcpads;
- GstBufferPool *bufpool;
-
gboolean activated;
gint samplerate, buffer_frames;
diff --git a/ext/libfame/gstlibfame.c b/ext/libfame/gstlibfame.c
index be2404d5..c68ff36b 100644
--- a/ext/libfame/gstlibfame.c
+++ b/ext/libfame/gstlibfame.c
@@ -60,54 +60,34 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "fameenc_sink_caps",
- "video/x-raw-yuv",
- "format",
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_LIST (
- GST_PROPS_FLOAT (24/1.001),
- GST_PROPS_FLOAT (24.),
- GST_PROPS_FLOAT (25.),
- GST_PROPS_FLOAT (30/1.001),
- GST_PROPS_FLOAT (30.),
- GST_PROPS_FLOAT (50.),
- GST_PROPS_FLOAT (60/1.001),
- GST_PROPS_FLOAT (60.)
- )
+ GST_STATIC_CAPS (
+ "video/x-raw-yuv, "
+ "format = (fourcc) I420, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, "
+ " 50.0, 59.940060, 60.0 }"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (src_template_factory,
+static GstStaticPadTemplate src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "fameenc_src_caps",
- "video/mpeg",
- "mpegversion", GST_PROPS_LIST (
- GST_PROPS_INT (1),
- GST_PROPS_INT (4)
- ),
- "systemstream", GST_PROPS_BOOLEAN (FALSE),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_LIST (
- GST_PROPS_FLOAT (24/1.001),
- GST_PROPS_FLOAT (24.),
- GST_PROPS_FLOAT (25.),
- GST_PROPS_FLOAT (30/1.001),
- GST_PROPS_FLOAT (30.),
- GST_PROPS_FLOAT (50.),
- GST_PROPS_FLOAT (60/1.001),
- GST_PROPS_FLOAT (60.)
- )
+ GST_STATIC_CAPS (
+ "video/mpeg, "
+ "mpegversion = (int) { 1, 4 }, "
+ "systemstream = (boolean) FALSE, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "framerate = (double) { 23.976024, 24.0, 25.0, 29.970030, 30.0, "
+ " 50.0, 59.940060, 60.0 }"
)
);
@@ -205,9 +185,9 @@ gst_fameenc_base_init (GstFameEncClass *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));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_template_factory));
+ gst_static_pad_template_get (&src_template));
gst_element_class_set_details (element_class, &gst_fameenc_details);
}
@@ -318,25 +298,24 @@ gst_fameenc_class_init (GstFameEncClass *klass)
}
static GstPadLinkReturn
-gst_fameenc_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_fameenc_sink_link (GstPad *pad, const GstCaps *caps)
{
gint width, height, fps_idx;
- gfloat fps;
+ gdouble fps;
GstFameEnc *fameenc;
+ GstStructure *structure;
fameenc = GST_FAMEENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
if (fameenc->initialized) {
GST_DEBUG ("error: fameenc encoder already initialized !");
return GST_PAD_LINK_REFUSED;
}
- gst_caps_get_int (caps, "width", &width);
- gst_caps_get_int (caps, "height", &height);
- gst_caps_get_float (caps, "framerate", &fps);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "height", &height);
+ gst_structure_get_double (structure, "framerate", &fps);
/* fameenc requires width and height to be multiples of 16 */
if (width % 16 != 0 || height % 16 != 0)
@@ -380,13 +359,13 @@ gst_fameenc_init (GstFameEnc *fameenc)
/* create the sink and src pads */
fameenc->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_template_factory), "sink");
+ gst_static_pad_template_get (&sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (fameenc), fameenc->sinkpad);
gst_pad_set_chain_function (fameenc->sinkpad, gst_fameenc_chain);
- gst_pad_set_link_function (fameenc->sinkpad, gst_fameenc_sinkconnect);
+ gst_pad_set_link_function (fameenc->sinkpad, gst_fameenc_sink_link);
fameenc->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_template_factory), "src");
+ gst_static_pad_template_get (&src_template), "src");
gst_element_add_pad (GST_ELEMENT (fameenc), fameenc->srcpad);
/* FIXME: set some more handler functions here */
diff --git a/ext/mas/massink.c b/ext/mas/massink.c
index 2b52a45a..01eed9e6 100644
--- a/ext/mas/massink.c
+++ b/ext/mas/massink.c
@@ -49,15 +49,12 @@ enum {
ARG_HOST,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink", /* the name of the pads */
- GST_PAD_SINK, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "massink_sink8", /* the name of the caps */
- "audio/x-raw-int",
- NULL
- )
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int")
);
static void gst_massink_base_init (gpointer g_class);
@@ -68,7 +65,7 @@ static gboolean gst_massink_open_audio (GstMassink *sink);
//static void gst_massink_close_audio (GstMassink *sink);
static GstElementStateReturn gst_massink_change_state (GstElement *element);
static gboolean gst_massink_sync_parms (GstMassink *massink);
-static GstPadLinkReturn gst_massink_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_massink_sinkconnect (GstPad *pad, const GstCaps *caps);
static void gst_massink_chain (GstPad *pad, GstData *_data);
@@ -130,7 +127,7 @@ gst_massink_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));
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details (element_class, &massink_details);
}
@@ -179,7 +176,7 @@ static void
gst_massink_init(GstMassink *massink)
{
massink->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(massink), massink->sinkpad);
gst_pad_set_chain_function(massink->sinkpad, GST_DEBUG_FUNCPTR(gst_massink_chain));
gst_pad_set_link_function(massink->sinkpad, gst_massink_sinkconnect);
@@ -204,15 +201,12 @@ gst_massink_sync_parms (GstMassink *massink)
}
static GstPadLinkReturn
-gst_massink_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_massink_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstMassink *massink;
massink = GST_MASSINK (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
if (gst_massink_sync_parms (massink))
return GST_PAD_LINK_OK;
diff --git a/ext/mplex/gstmplex.cc b/ext/mplex/gstmplex.cc
index c63d1801..7de9ab56 100644
--- a/ext/mplex/gstmplex.cc
+++ b/ext/mplex/gstmplex.cc
@@ -56,63 +56,54 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
+static GstStaticPadTemplate src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "src_video",
- "video/mpeg",
- "mpegversion", GST_PROPS_INT_RANGE (1, 2),
- "systemstream", GST_PROPS_BOOLEAN (TRUE)
+ GST_STATIC_CAPS ("video/mpeg, "
+ "mpegversion = (int) [ 1, 2 ], "
+ "systemstream = (boolean) true"
)
-)
+);
-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 (
- "sink_video",
- "video/mpeg",
- "mpegversion", GST_PROPS_INT_RANGE (1, 2),
- "systemstream", GST_PROPS_BOOLEAN (FALSE)
+ GST_STATIC_CAPS ("video/mpeg, "
+ "mpegversion = (int) [ 1, 2 ], "
+ "systemstream = (boolean) false"
)
-)
+);
-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 (
- "sink_audio",
- "audio/mpeg",
- "mpegversion", GST_PROPS_INT (1),
- "layer", GST_PROPS_INT_RANGE (1, 3)
+ GST_STATIC_CAPS ("audio/mpeg, "
+ "mpegversion = (int) 1, "
+ "layer = (int) [ 1, 3 ]"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (private_1_sink_factory,
+static GstStaticPadTemplate private_1_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"private_stream_1_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW (
- "sink_private1",
- "audio/x-ac3",
- NULL
- )
-)
+ GST_STATIC_CAPS ("audio/x-ac3")
+);
-GST_PAD_TEMPLATE_FACTORY (private_2_sink_factory,
+static GstStaticPadTemplate private_2_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"private_stream_2",
GST_PAD_SINK,
GST_PAD_REQUEST,
- GST_CAPS_NEW (
- "sink_private2",
- "unknown/unknown",
- NULL
- )
-)
+ GST_STATIC_CAPS_ANY
+);
#define GST_TYPE_MPLEX_MUX_FORMAT (gst_mplex_mux_format_get_type())
static GType
@@ -189,11 +180,11 @@ gst_mplex_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 (src_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (audio_sink_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (video_sink_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (private_1_sink_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (private_2_sink_factory));
+ 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 (&audio_sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&video_sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&private_1_sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&private_2_sink_factory));
gst_element_class_set_details (element_class, &gst_mplex_details);
}
@@ -247,7 +238,7 @@ static void
gst_mplex_init (GstMPlex *mplex)
{
mplex->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_factory), "src");
+ gst_static_pad_template_get (&src_factory), "src");
gst_element_add_pad (GST_ELEMENT (mplex), mplex->srcpad);
gst_element_set_loop_function (GST_ELEMENT (mplex), gst_mplex_loop);
@@ -263,20 +254,20 @@ gst_mplex_init (GstMPlex *mplex)
}
static GstPadLinkReturn
-gst_mplex_video_link (GstPad *pad, GstCaps *caps)
+gst_mplex_video_link (GstPad *pad, const GstCaps *caps)
{
GstMPlex *mplex;
gint version;
GstMPlexStream *stream;
+ GstStructure *structure;
mplex = GST_MPLEX (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
stream = (GstMPlexStream *) gst_pad_get_element_private (pad);
+
+ structure = gst_caps_get_structure (caps, 0);
- if (!gst_caps_get_int (caps, "mpegversion", &version)){
+ if (!gst_structure_get_int (structure, "mpegversion", &version)){
return GST_PAD_LINK_REFUSED;
}
diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c
index f75ee233..887b37f8 100644
--- a/ext/sdl/sdlvideosink.c
+++ b/ext/sdl/sdlvideosink.c
@@ -64,7 +64,7 @@ static void gst_sdlvideosink_destroy (GstSDLVideoSink *sdl);
static GstPadLinkReturn
gst_sdlvideosink_sinkconnect (GstPad *pad,
- GstCaps *caps);
+ const GstCaps *caps);
static void gst_sdlvideosink_chain (GstPad *pad,
GstData *data);
@@ -80,7 +80,6 @@ static GstElementStateReturn
gst_sdlvideosink_change_state (GstElement *element);
-static GstCaps *capslist = NULL;
static GstPadTemplate *sink_template;
static GstElementClass *parent_class = NULL;
@@ -129,7 +128,7 @@ static void
gst_sdlvideosink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstCaps *caps;
+ GstCaps *capslist;
gint i;
gulong format[6] = { GST_MAKE_FOURCC('I','4','2','0'),
GST_MAKE_FOURCC('Y','V','1','2'),
@@ -139,23 +138,21 @@ gst_sdlvideosink_base_init (gpointer g_class)
};
/* make a list of all available caps */
+ capslist = gst_caps_new_empty();
for (i = 0; i < 5; i++) {
- caps = gst_caps_new ("sdlvideosink_caps",
- "video/x-raw-yuv",
- gst_props_new (
- "format", GST_PROPS_FOURCC(format[i]),
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- NULL )
- );
- capslist = gst_caps_append(capslist, caps);
+ gst_caps_append_structure (capslist,
+ gst_structure_new ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, format[i],
+ "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+ "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL));
}
sink_template = gst_pad_template_new ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- capslist, NULL);
+ capslist);
gst_element_class_add_pad_template (element_class, sink_template);
gst_element_class_set_details (element_class, &gst_sdlvideosink_details);
@@ -194,6 +191,8 @@ gst_sdlvideosink_class_init (GstSDLVideoSinkClass *klass)
gstvs_class->set_geometry = gst_sdlvideosink_set_geometry;*/
}
+#if 0
+/* FIXME */
static GstBuffer *
gst_sdlvideosink_buffer_new (GstBufferPool *pool,
gint64 location,
@@ -253,14 +252,13 @@ gst_sdlvideosink_get_bufferpool (GstPad *pad)
return NULL;
}
+#endif
static void
gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
{
GST_VIDEOSINK_PAD (sdlvideosink) = gst_pad_new_from_template (sink_template,
"sink");
- gst_pad_set_bufferpool_function (GST_VIDEOSINK_PAD (sdlvideosink),
- gst_sdlvideosink_get_bufferpool);
gst_element_add_pad (GST_ELEMENT (sdlvideosink),
GST_VIDEOSINK_PAD (sdlvideosink));
@@ -277,12 +275,13 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
sdlvideosink->xwindow_id = 0;
- sdlvideosink->capslist = capslist;
+ //sdlvideosink->capslist = capslist;
sdlvideosink->init = FALSE;
sdlvideosink->lock = g_mutex_new ();
+#if 0
sdlvideosink->bufferpool = gst_buffer_pool_new (
NULL, /* free */
NULL, /* copy */
@@ -290,6 +289,7 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
NULL, /* buffer copy, the default is fine */
(GstBufferPoolBufferFreeFunction) gst_sdlvideosink_buffer_free,
sdlvideosink);
+#endif
GST_FLAG_SET(sdlvideosink, GST_ELEMENT_THREAD_SUGGESTED);
GST_FLAG_SET(sdlvideosink, GST_ELEMENT_EVENT_AWARE);
@@ -509,37 +509,25 @@ gst_sdlvideosink_create (GstSDLVideoSink *sdlvideosink)
static GstPadLinkReturn
gst_sdlvideosink_sinkconnect (GstPad *pad,
- GstCaps *vscapslist)
+ const GstCaps *vscapslist)
{
GstSDLVideoSink *sdlvideosink;
- GstCaps *caps;
+ guint32 format;
+ GstStructure *structure;
sdlvideosink = GST_SDLVIDEOSINK (gst_pad_get_parent (pad));
- /* we are not going to act on variable caps */
- if (!GST_CAPS_IS_FIXED (vscapslist))
- return GST_PAD_LINK_DELAYED;
-
- for (caps = vscapslist; caps != NULL; caps = vscapslist = vscapslist->next)
- {
- guint32 format;
+ structure = gst_caps_get_structure (vscapslist, 0);
+ gst_structure_get_fourcc (structure, "format", &format);
+ sdlvideosink->format =
+ gst_sdlvideosink_get_sdl_from_fourcc (sdlvideosink, format);
+ gst_structure_get_int (structure, "width", &sdlvideosink->width);
+ gst_structure_get_int (structure, "height", &sdlvideosink->height);
- gst_caps_get_fourcc_int(caps, "format", &format);
- sdlvideosink->format =
- gst_sdlvideosink_get_sdl_from_fourcc (sdlvideosink, format);
- gst_caps_get_int(caps, "width", &sdlvideosink->width);
- gst_caps_get_int(caps, "height", &sdlvideosink->height);
-
- /* try it out */
- if (!sdlvideosink->format ||
- !gst_sdlvideosink_create(sdlvideosink))
- continue;
-
- return GST_PAD_LINK_OK;
- }
+ if (!sdlvideosink->format || !gst_sdlvideosink_create(sdlvideosink))
+ return GST_PAD_LINK_REFUSED;
- /* if we got here - it's not good */
- return GST_PAD_LINK_REFUSED;
+ return GST_PAD_LINK_OK;
}
diff --git a/ext/sdl/sdlvideosink.h b/ext/sdl/sdlvideosink.h
index 96b2aecb..e4e0df0c 100644
--- a/ext/sdl/sdlvideosink.h
+++ b/ext/sdl/sdlvideosink.h
@@ -55,14 +55,11 @@ struct _GstSDLVideoSink {
gboolean init;
- GstCaps *capslist;
-
SDL_Surface *screen;
SDL_Overlay *overlay;
SDL_Rect rect;
GMutex *lock;
- GstBufferPool *bufferpool;
};
struct _GstSDLVideoSinkClass {
diff --git a/ext/snapshot/gstsnapshot.c b/ext/snapshot/gstsnapshot.c
index 36d5e815..eff6567a 100644
--- a/ext/snapshot/gstsnapshot.c
+++ b/ext/snapshot/gstsnapshot.c
@@ -36,36 +36,21 @@ static GstElementDetails snapshot_details = {
"Jeremy SIMON <jsimon13@yahoo.fr>",
};
-GST_PAD_TEMPLATE_FACTORY (snapshot_src_factory,
+static GstStaticPadTemplate snapshot_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "snapshot_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
- ))
- )
-)
-
-GST_PAD_TEMPLATE_FACTORY (snapshot_sink_factory,
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("{ I420, YUY2 }"))
+);
+
+static GstStaticPadTemplate snapshot_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "snapshot_src",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- GST_PROPS_FOURCC (GST_STR_FOURCC ("YUY2"))
- ))
- )
-)
-
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("{ I420, YUY2 }"))
+);
/* Snapshot signals and args */
enum {
@@ -133,8 +118,8 @@ gst_snapshot_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 (snapshot_sink_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (snapshot_src_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&snapshot_sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&snapshot_src_factory));
gst_element_class_set_details (element_class, &snapshot_details);
}
@@ -179,48 +164,43 @@ snapshot_handler(GstElement *element)
static gboolean
-gst_snapshot_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_snapshot_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstSnapshot *filter;
GstCaps *from_caps, *to_caps;
- gfloat fps;
+ gdouble fps;
+ GstStructure *structure;
filter = GST_SNAPSHOT (gst_pad_get_parent (pad));
- 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_caps_get_float (caps, "framerate", &fps);
- gst_caps_get_fourcc_int (caps, "format", &filter->format);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
+ gst_structure_get_double (structure, "framerate", &fps);
+ gst_structure_get_fourcc (structure, "format", &filter->format);
filter->to_bpp = 24;
- to_caps = GST_CAPS_NEW (
- "snapshot_conversion",
- "video/x-raw-rgb",
- "width", GST_PROPS_INT( filter->width ),
- "height", GST_PROPS_INT( filter->height ),
- "red_mask", GST_PROPS_INT (0x0000FF),
- "green_mask", GST_PROPS_INT (0x00FF00),
- "blue_mask", GST_PROPS_INT (0xFF0000),
- "bpp", GST_PROPS_INT( 24 ),
- "framerate", GST_PROPS_FLOAT (fps)
- );
+ to_caps = gst_caps_new_simple ("video/x-raw-rgb",
+ "width", G_TYPE_INT, filter->width,
+ "height", G_TYPE_INT, filter->height,
+ "red_mask", G_TYPE_INT, 0x0000FF,
+ "green_mask", G_TYPE_INT, 0x00FF00,
+ "blue_mask", G_TYPE_INT, 0xFF0000,
+ "bpp", G_TYPE_INT, 24,
+ "framerate", G_TYPE_DOUBLE, fps,
+ NULL);
switch ( filter->format )
{
case GST_MAKE_FOURCC('Y','U','Y','2'):
case GST_MAKE_FOURCC('I','4','2','0'):
- from_caps = GST_CAPS_NEW (
- "snapshot_from",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
- "width", GST_PROPS_INT( filter->width ),
- "height", GST_PROPS_INT( filter->height ),
- "framerate", GST_PROPS_FLOAT (fps)
- );
+ from_caps = gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, GST_STR_FOURCC ("I420"),
+ "width", G_TYPE_INT, filter->width,
+ "height", G_TYPE_INT, filter->height,
+ "framerate", G_TYPE_DOUBLE, fps,
+ NULL);
filter->converter = gst_colorspace_yuv2rgb_get_converter ( from_caps, to_caps );
break;
@@ -246,12 +226,12 @@ gst_snapshot_sinkconnect (GstPad *pad, GstCaps *caps)
static void
gst_snapshot_init (GstSnapshot *snapshot)
{
- snapshot->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (snapshot_sink_factory), "sink");
+ snapshot->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&snapshot_sink_factory), "sink");
gst_pad_set_link_function (snapshot->sinkpad, gst_snapshot_sinkconnect);
gst_pad_set_chain_function (snapshot->sinkpad, gst_snapshot_chain);
gst_element_add_pad (GST_ELEMENT (snapshot), snapshot->sinkpad);
- snapshot->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (snapshot_src_factory), "src");
+ snapshot->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (&snapshot_src_factory), "src");
gst_element_add_pad (GST_ELEMENT (snapshot), snapshot->srcpad);
snapshot->cur_frame = 0;
diff --git a/ext/sndfile/gstsf.c b/ext/sndfile/gstsf.c
index 34a8b60f..b9c630c9 100644
--- a/ext/sndfile/gstsf.c
+++ b/ext/sndfile/gstsf.c
@@ -53,26 +53,20 @@ enum {
ARG_CREATE_PADS
};
-GST_PAD_TEMPLATE_FACTORY (sf_src_factory,
+static GstStaticPadTemplate sf_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
- gst_caps_new (
- "sf_src",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
+ GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
);
-GST_PAD_TEMPLATE_FACTORY (sf_sink_factory,
+static GstStaticPadTemplate sf_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- gst_caps_new (
- "sf_sink",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
+ GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
);
#define GST_TYPE_SF_MAJOR_TYPES (gst_sf_major_types_get_type())
@@ -162,7 +156,7 @@ static GstPad* gst_sf_request_new_pad (GstElement *element, GstPadTemplate *tem
static void gst_sf_release_request_pad (GstElement *element, GstPad *pad);
static GstElementStateReturn gst_sf_change_state (GstElement *element);
-static GstPadLinkReturn gst_sf_link (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_sf_link (GstPad *pad, const GstCaps *caps);
static void gst_sf_loop (GstElement *element);
@@ -249,7 +243,7 @@ gst_sfsrc_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 (sf_src_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sf_src_factory));
gst_element_class_set_details (element_class, &sfsrc_details);
}
@@ -258,7 +252,7 @@ gst_sfsink_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 (sf_sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sf_sink_factory));
gst_element_class_set_details (element_class, &sfsink_details);
}
@@ -530,28 +524,27 @@ gst_sf_release_request_pad (GstElement *element, GstPad *pad)
}
static GstPadLinkReturn
-gst_sf_link (GstPad *pad, GstCaps *caps)
+gst_sf_link (GstPad *pad, const GstCaps *caps)
{
GstSF *this = (GstSF*)GST_OBJECT_PARENT (pad);
+ GstStructure *structure;
+
+ structure = gst_caps_get_structure (caps, 0);
- if (GST_CAPS_IS_FIXED (caps)) {
- gst_caps_get_int (caps, "rate", &this->rate);
- gst_caps_get_int (caps, "buffer-frames", &this->buffer_frames);
-
- INFO_OBJ (this, "linked pad %s:%s with fixed caps, frames=%d, rate=%d",
- GST_DEBUG_PAD_NAME (pad), this->rate, this->buffer_frames);
-
- if (this->numchannels) {
- /* we can go ahead and allocate our buffer */
- if (this->buffer)
- g_free (this->buffer);
- this->buffer = g_malloc (this->numchannels * this->buffer_frames * sizeof (float));
- memset (this->buffer, 0, this->numchannels * this->buffer_frames * sizeof (float));
- }
- return GST_PAD_LINK_OK;
+ gst_structure_get_int (structure, "rate", &this->rate);
+ gst_structure_get_int (structure, "buffer-frames", &this->buffer_frames);
+
+ INFO_OBJ (this, "linked pad %s:%s with fixed caps, frames=%d, rate=%d",
+ GST_DEBUG_PAD_NAME (pad), this->rate, this->buffer_frames);
+
+ if (this->numchannels) {
+ /* we can go ahead and allocate our buffer */
+ if (this->buffer)
+ g_free (this->buffer);
+ this->buffer = g_malloc (this->numchannels * this->buffer_frames * sizeof (float));
+ memset (this->buffer, 0, this->numchannels * this->buffer_frames * sizeof (float));
}
-
- return GST_PAD_LINK_DELAYED;
+ return GST_PAD_LINK_OK;
}
static gboolean
@@ -706,8 +699,10 @@ gst_sf_loop (GstElement *element)
if (!caps)
caps = gst_caps_copy
(GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (GST_SF_CHANNEL (l)->pad)));
- gst_caps_set (caps, "rate", GST_PROPS_INT (this->rate), NULL);
- gst_caps_set (caps, "buffer-frames", GST_PROPS_INT (this->buffer_frames), NULL);
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT, this->rate,
+ "buffer-frames", G_TYPE_INT, this->buffer_frames,
+ NULL);
if (!gst_pad_try_set_caps (GST_SF_CHANNEL (l)->pad, caps)) {
gst_element_error (GST_ELEMENT (this),
g_strdup_printf ("Opened file with sample rate %d, but could not set caps",
diff --git a/ext/swfdec/gstswfdec.c b/ext/swfdec/gstswfdec.c
index 9e97ad1e..6e42c4fa 100644
--- a/ext/swfdec/gstswfdec.c
+++ b/ext/swfdec/gstswfdec.c
@@ -23,6 +23,7 @@
#endif
#include "gstswfdec.h"
#include <string.h>
+#include <gst/video/video.h>
/* elementfactory information */
static GstElementDetails gst_swfdec_details = GST_ELEMENT_DETAILS (
@@ -43,50 +44,35 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (video_template_factory,
+static GstStaticPadTemplate video_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"video_00",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "swfdec_videosrc",
- "video/x-raw-rgb",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "bpp", GST_PROPS_INT (24),
- "depth", GST_PROPS_INT (24),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (0xff0000),
- "green_mask", GST_PROPS_INT (0x00ff00),
- "blue_mask", GST_PROPS_INT (0x0000ff),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
+ GST_STATIC_CAPS (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24)
);
-GST_PAD_TEMPLATE_FACTORY (audio_template_factory,
+static GstStaticPadTemplate audio_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"audio_00",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "swfdec_audiosrc",
- "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(44100),
- "channels", GST_PROPS_INT(2)
- )
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) 44100, "
+ "channels = (int) 2, "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "signed = (boolean) true, "
+ "buffer-frames = (int) [ 1, MAX ]")
);
-GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
+static GstStaticPadTemplate sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "swfdec_sink",
- "application/x-shockwave-flash",
- NULL
- )
+ GST_STATIC_CAPS ( "application/x-shockwave-flash")
);
static void gst_swfdec_base_init (gpointer g_class);
@@ -148,11 +134,11 @@ gst_swfdec_base_init(gpointer g_class)
gst_element_class_set_details (element_class, &gst_swfdec_details);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (video_template_factory));
+ gst_static_pad_template_get (&video_template_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (audio_template_factory));
+ gst_static_pad_template_get (&audio_template_factory));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_template_factory));
+ gst_static_pad_template_get (&sink_template_factory));
}
static void
gst_swfdec_class_init(GstSwfdecClass *klass)
@@ -172,33 +158,25 @@ gst_swfdec_class_init(GstSwfdecClass *klass)
gstelement_class->change_state = gst_swfdec_change_state;
}
-static GstCaps *gst_swfdec_videosrc_getcaps(GstPad *pad, GstCaps *caps)
+static GstCaps *gst_swfdec_videosrc_getcaps(GstPad *pad)
{
GstSwfdec *swfdec;
- GstCaps *c;
+ GstCaps *caps;
swfdec = GST_SWFDEC (gst_pad_get_parent (pad));
- c = GST_CAPS_NEW (
- "swfdec_videosrc",
- "video/x-raw-rgb",
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "bpp", GST_PROPS_INT (24),
- "depth", GST_PROPS_INT (24),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (0xff0000),
- "green_mask", GST_PROPS_INT (0x00ff00),
- "blue_mask", GST_PROPS_INT (0x0000ff),
- "framerate", GST_PROPS_FLOAT (swfdec->frame_rate)
- );
-
- if(swfdec->height){
- gst_caps_set(c,"height",GST_PROPS_INT(swfdec->height));
- gst_caps_set(c,"width",GST_PROPS_INT(swfdec->width));
+ caps = gst_caps_copy (gst_pad_template_get_caps (
+ gst_static_pad_template_get (&video_template_factory)));
+
+ if (swfdec->height) {
+ gst_caps_set_simple (caps,
+ "framerate", G_TYPE_DOUBLE, swfdec->frame_rate,
+ "height",G_TYPE_INT,swfdec->height,
+ "width",G_TYPE_INT,swfdec->width,
+ NULL);
}
- return c;
+ return caps;
}
static void
@@ -244,9 +222,9 @@ gst_swfdec_loop(GstElement *element)
swfdec_decoder_get_rate(swfdec->state, &swfdec->rate);
swfdec->interval = GST_SECOND / swfdec->rate;
- gst_caps_debug(gst_swfdec_videosrc_getcaps(swfdec->videopad,NULL),"ack");
+ GST_DEBUG_CAPS ("caps", gst_swfdec_videosrc_getcaps(swfdec->videopad));
gst_pad_try_set_caps(swfdec->videopad,
- gst_swfdec_videosrc_getcaps(swfdec->videopad,NULL));
+ gst_swfdec_videosrc_getcaps(swfdec->videopad));
return;
}
@@ -294,11 +272,11 @@ gst_swfdec_init (GstSwfdec *swfdec)
{
/* create the sink and src pads */
swfdec->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_template_factory), "sink");
+ gst_static_pad_template_get (&sink_template_factory), "sink");
gst_element_add_pad (GST_ELEMENT (swfdec), swfdec->sinkpad);
swfdec->videopad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(video_template_factory),
+ gst_static_pad_template_get (&video_template_factory),
"video_00");
gst_pad_set_query_function (swfdec->videopad,
GST_DEBUG_FUNCPTR (gst_swfdec_src_query));
@@ -307,7 +285,7 @@ gst_swfdec_init (GstSwfdec *swfdec)
gst_element_add_pad(GST_ELEMENT(swfdec), swfdec->videopad);
swfdec->audiopad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(audio_template_factory),
+ gst_static_pad_template_get (&audio_template_factory),
"audio_00");
gst_pad_set_query_function (swfdec->audiopad,
GST_DEBUG_FUNCPTR (gst_swfdec_src_query));
@@ -563,7 +541,6 @@ gst_swfdec_change_state (GstElement *element)
//swfdec->decoder->is_sequence_needed = 1;
//swfdec->decoder->frame_rate_code = 0;
swfdec->timestamp = 0;
- swfdec->pool = NULL;
swfdec->closed = FALSE;
/* reset the initial video state */
@@ -574,19 +551,8 @@ gst_swfdec_change_state (GstElement *element)
break;
}
case GST_STATE_PAUSED_TO_PLAYING:
- /* try to get a bufferpool */
-#if 0
- swfdec->pool = gst_pad_get_bufferpool (swfdec->videopad);
- if (swfdec->pool)
- GST_INFO ( "got pool %p", swfdec->pool);
-#endif
break;
case GST_STATE_PLAYING_TO_PAUSED:
- /* need to clear things we get from other plugins, since we could be reconnected */
- if (swfdec->pool) {
- gst_buffer_pool_unref (swfdec->pool);
- swfdec->pool = NULL;
- }
break;
case GST_STATE_PAUSED_TO_READY:
/* if we are not closed by an EOS event do so now, this cen send a few frames but
diff --git a/ext/swfdec/gstswfdec.h b/ext/swfdec/gstswfdec.h
index 8aa3ce3a..5ee2a3b5 100644
--- a/ext/swfdec/gstswfdec.h
+++ b/ext/swfdec/gstswfdec.h
@@ -51,7 +51,6 @@ struct _GstSwfdec {
GstPad *sinkpad;
GstPad *videopad;
GstPad *audiopad;
- GstBufferPool *pool;
SwfdecDecoder *state;
gboolean closed;
diff --git a/ext/xvid/gstxviddec.c b/ext/xvid/gstxviddec.c
index 3cfdfaa7..84af838d 100644
--- a/ext/xvid/gstxviddec.c
+++ b/ext/xvid/gstxviddec.c
@@ -33,45 +33,30 @@ GstElementDetails gst_xviddec_details = {
"Ronald Bultje <rbultje@ronald.bitfreak.net>",
};
-GST_PAD_TEMPLATE_FACTORY(sink_template,
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW("xviddec_sink",
- "video/x-xvid",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT))
-)
-
-GST_PAD_TEMPLATE_FACTORY(src_template,
+ GST_STATIC_CAPS (
+ "video/x-xvid, "
+ "width = (int) [ 0, MAX ], "
+ "height = (int) [ 0, MAX ], "
+ "framerate = (double) [ 0, MAX ]"
+ )
+);
+
+static GstStaticPadTemplate src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new(
- "xviddec_sink",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- 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')),
- GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','Y','U')),
- GST_PROPS_FOURCC(GST_MAKE_FOURCC('U','Y','V','Y'))
- )
- )
- ),
- gst_caps_new(
- "xviddec_sink_rgb24_32",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32
- ),
- gst_caps_new(
- "xviddec_sink_rgb15_16",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15_16
+ GST_STATIC_CAPS (
+ GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("{ I420, YUY2, YV12, YVYU, UYVY }") "; "
+ GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_32 "; "
+ GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_15_16
)
-)
+);
/* XvidDec signals and args */
@@ -91,9 +76,9 @@ static void gst_xviddec_init (GstXvidDec *xviddec);
static void gst_xviddec_dispose (GObject *object);
static void gst_xviddec_chain (GstPad *pad,
GstData *data);
-static GstPadLinkReturn gst_xviddec_connect (GstPad *pad,
- GstCaps *vscapslist);
-static GstPadLinkReturn gst_xviddec_negotiate (GstXvidDec *xviddec);
+static GstPadLinkReturn gst_xviddec_link (GstPad *pad,
+ const GstCaps *vscapslist);
+static GstPadLinkReturn gst_xviddec_negotiate (GstXvidDec *xviddec);
static GstElementClass *parent_class = NULL;
/* static guint gst_xviddec_signals[LAST_SIGNAL] = { 0 }; */
@@ -129,8 +114,10 @@ gst_xviddec_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_template));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_template));
gst_element_class_set_details (element_class, &gst_xviddec_details);
}
@@ -153,16 +140,16 @@ gst_xviddec_init (GstXvidDec *xviddec)
{
/* create the sink pad */
xviddec->sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(sink_template),
+ gst_static_pad_template_get (&sink_template),
"sink");
gst_element_add_pad(GST_ELEMENT(xviddec), xviddec->sinkpad);
gst_pad_set_chain_function(xviddec->sinkpad, gst_xviddec_chain);
- gst_pad_set_link_function(xviddec->sinkpad, gst_xviddec_connect);
+ gst_pad_set_link_function(xviddec->sinkpad, gst_xviddec_link);
/* create the src pad */
xviddec->srcpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(src_template),
+ gst_static_pad_template_get (&src_template),
"src");
gst_element_add_pad(GST_ELEMENT(xviddec), xviddec->srcpad);
@@ -309,36 +296,36 @@ gst_xviddec_negotiate (GstXvidDec *xviddec)
break;
case 16:
endianness = G_BYTE_ORDER;
- r_mask = 0xf800; g_mask = 0x07e0; b_mask = 0x001f;
+ r_mask = R_MASK_16_INT; g_mask = G_MASK_16_INT; b_mask = B_MASK_16_INT;
break;
case 24:
endianness = G_BIG_ENDIAN;
- r_mask = R_MASK_24; g_mask = G_MASK_24; b_mask = B_MASK_24;
+ r_mask = R_MASK_24_INT; g_mask = G_MASK_24_INT; b_mask = B_MASK_24_INT;
break;
case 32:
endianness = G_BIG_ENDIAN;
- r_mask = R_MASK_32; g_mask = G_MASK_32; b_mask = B_MASK_32;
+ r_mask = R_MASK_32_INT; g_mask = G_MASK_32_INT; b_mask = B_MASK_32_INT;
break;
}
- caps = GST_CAPS_NEW("xviddec_src_pad_rgb",
+ caps = gst_caps_new_simple (
"video/x-raw-rgb",
- "width", GST_PROPS_INT(xviddec->width),
- "height", GST_PROPS_INT(xviddec->height),
- "depth", GST_PROPS_INT(fmt_list[i].depth),
- "bpp", GST_PROPS_INT(fmt_list[i].bpp),
- "endianness", GST_PROPS_INT(endianness),
- "red_mask", GST_PROPS_INT(r_mask),
- "green_mask", GST_PROPS_INT(g_mask),
- "blue_mask", GST_PROPS_INT(b_mask),
- "framerate", GST_PROPS_FLOAT(xviddec->fps),
+ "width", G_TYPE_INT, xviddec->width,
+ "height", G_TYPE_INT, xviddec->height,
+ "depth", G_TYPE_INT, fmt_list[i].depth,
+ "bpp", G_TYPE_INT, fmt_list[i].bpp,
+ "endianness", G_TYPE_INT, endianness,
+ "red_mask", G_TYPE_INT, r_mask,
+ "green_mask", G_TYPE_INT, g_mask,
+ "blue_mask", G_TYPE_INT, b_mask,
+ "framerate", G_TYPE_DOUBLE, xviddec->fps,
NULL);
} else {
- caps = GST_CAPS_NEW("xviddec_src_pad_yuv",
+ caps = gst_caps_new_simple (
"video/x-raw-yuv",
- "width", GST_PROPS_INT(xviddec->width),
- "height", GST_PROPS_INT(xviddec->height),
- "format", GST_PROPS_FOURCC(fmt_list[i].fourcc),
- "framerate", GST_PROPS_FLOAT(xviddec->fps),
+ "width", G_TYPE_INT, xviddec->width,
+ "height", G_TYPE_INT, xviddec->height,
+ "format", GST_TYPE_FOURCC, fmt_list[i].fourcc,
+ "framerate", G_TYPE_DOUBLE, xviddec->fps,
NULL);
}
@@ -358,10 +345,11 @@ gst_xviddec_negotiate (GstXvidDec *xviddec)
static GstPadLinkReturn
-gst_xviddec_connect (GstPad *pad,
- GstCaps *vscaps)
+gst_xviddec_link (GstPad *pad,
+ const GstCaps *vscaps)
{
GstXvidDec *xviddec;
+ GstStructure *structure;
xviddec = GST_XVIDDEC(gst_pad_get_parent (pad));
@@ -370,15 +358,12 @@ gst_xviddec_connect (GstPad *pad,
gst_xviddec_unset(xviddec);
}
- /* we are not going to act on variable caps */
- if (!GST_CAPS_IS_FIXED(vscaps))
- return GST_PAD_LINK_DELAYED;
-
/* if we get here, we know the input is xvid. we
* only need to bother with the output colorspace */
- gst_caps_get_int(vscaps, "width", &xviddec->width);
- gst_caps_get_int(vscaps, "height", &xviddec->height);
- gst_caps_get_float(vscaps, "framerate", &xviddec->fps);
+ structure = gst_caps_get_structure (vscaps, 0);
+ gst_structure_get_int(structure, "width", &xviddec->width);
+ gst_structure_get_int(structure, "height", &xviddec->height);
+ gst_structure_get_double(structure, "framerate", &xviddec->fps);
return gst_xviddec_negotiate(xviddec);
}
diff --git a/ext/xvid/gstxviddec.h b/ext/xvid/gstxviddec.h
index 76fc6d89..a614bd81 100644
--- a/ext/xvid/gstxviddec.h
+++ b/ext/xvid/gstxviddec.h
@@ -53,9 +53,9 @@ struct _GstXvidDec {
void *handle;
/* video (output) settings */
- int csp, bpp;
- int width, height;
- float fps;
+ gint csp, bpp;
+ gint width, height;
+ double fps;
};
struct _GstXvidDecClass {
diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c
index f526df5a..ce2e71e9 100644
--- a/ext/xvid/gstxvidenc.c
+++ b/ext/xvid/gstxvidenc.c
@@ -34,45 +34,30 @@ GstElementDetails gst_xvidenc_details = {
"Ronald Bultje <rbultje@ronald.bitfreak.net>",
};
-GST_PAD_TEMPLATE_FACTORY(sink_template,
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new(
- "xvidenc_sink",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- 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')),
- GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','Y','U')),
- GST_PROPS_FOURCC(GST_MAKE_FOURCC('U','Y','V','Y'))
- )
- )
- ),
- gst_caps_new(
- "xvidenc_sink_rgb24_32",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32
- ),
- gst_caps_new(
- "xvidenc_sink_rgb15_16",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15_16
+ GST_STATIC_CAPS (
+ GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("{ I420, YUY2, YV12, YVYU, UYVY }") "; "
+ GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_32 "; "
+ GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_15_16
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY(src_template,
+static GstStaticPadTemplate src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW("xvidenc_src",
- "video/x-xvid",
- "width", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE (0, G_MAXINT),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT))
-)
+ GST_STATIC_CAPS (
+ "video/x-xvid, "
+ "width = (int) [ 0, MAX ], "
+ "height = (int) [ 0, MAX ], "
+ "framerate = (double) [ 0.0, MAX ]"
+ )
+);
/* XvidEnc signals and args */
@@ -93,8 +78,8 @@ static void gst_xvidenc_class_init (GstXvidEncClass *klass);
static void gst_xvidenc_init (GstXvidEnc *xvidenc);
static void gst_xvidenc_chain (GstPad *pad,
GstData *data);
-static GstPadLinkReturn gst_xvidenc_connect (GstPad *pad,
- GstCaps *vscapslist);
+static GstPadLinkReturn gst_xvidenc_link (GstPad *pad,
+ const GstCaps *vscapslist);
/* properties */
static void gst_xvidenc_set_property (GObject *object,
@@ -140,8 +125,8 @@ gst_xvidenc_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_template));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (src_template));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_template));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_template));
gst_element_class_set_details (element_class, &gst_xvidenc_details);
}
@@ -190,16 +175,16 @@ gst_xvidenc_init (GstXvidEnc *xvidenc)
{
/* create the sink pad */
xvidenc->sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(sink_template),
+ gst_static_pad_template_get (&sink_template),
"sink");
gst_element_add_pad(GST_ELEMENT(xvidenc), xvidenc->sinkpad);
gst_pad_set_chain_function(xvidenc->sinkpad, gst_xvidenc_chain);
- gst_pad_set_link_function(xvidenc->sinkpad, gst_xvidenc_connect);
+ gst_pad_set_link_function(xvidenc->sinkpad, gst_xvidenc_link);
/* create the src pad */
xvidenc->srcpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(src_template),
+ gst_static_pad_template_get (&src_template),
"src");
gst_element_add_pad(GST_ELEMENT(xvidenc), xvidenc->srcpad);
@@ -312,11 +297,15 @@ gst_xvidenc_chain (GstPad *pad,
static GstPadLinkReturn
-gst_xvidenc_connect (GstPad *pad,
- GstCaps *vscaps)
+gst_xvidenc_link (GstPad *pad,
+ const GstCaps *vscaps)
{
GstXvidEnc *xvidenc;
- GstCaps *caps;
+ GstStructure *structure;
+ gint w,h,d;
+ double fps;
+ guint32 fourcc;
+ gint xvid_cs = -1;
xvidenc = GST_XVIDENC(gst_pad_get_parent (pad));
@@ -326,95 +315,81 @@ gst_xvidenc_connect (GstPad *pad,
xvidenc->handle = NULL;
}
- /* we are not going to act on variable caps */
- if (!GST_CAPS_IS_FIXED(vscaps))
- return GST_PAD_LINK_DELAYED;
+ g_return_val_if_fail (gst_caps_get_size (vscaps) == 1, GST_PAD_LINK_REFUSED);
+ structure = gst_caps_get_structure (vscaps, 0);
+
+ gst_structure_get_int (structure, "width", &w);
+ gst_structure_get_int (structure, "height", &h);
+ gst_structure_get_double (structure, "framerate", &fps);
+ if (gst_structure_has_field_typed (structure, "format", GST_TYPE_FOURCC))
+ gst_structure_get_fourcc (structure, "format", &fourcc);
+ else
+ fourcc = GST_MAKE_FOURCC('R','G','B',' ');
- for (caps = vscaps; caps != NULL; caps = caps->next)
+ switch (fourcc)
{
- int w,h,d;
- float fps;
- guint32 fourcc;
- gint xvid_cs;
-
- gst_caps_get_int(caps, "width", &w);
- gst_caps_get_int(caps, "height", &h);
- gst_caps_get_float(caps, "framerate", &fps);
- if (gst_caps_has_property(caps, "format"))
- gst_caps_get_fourcc_int(caps, "format", &fourcc);
- else
- fourcc = GST_MAKE_FOURCC('R','G','B',' ');
-
- switch (fourcc)
- {
- case GST_MAKE_FOURCC('I','4','2','0'):
- case GST_MAKE_FOURCC('I','Y','U','V'):
- xvid_cs = XVID_CSP_I420;
- break;
- case GST_MAKE_FOURCC('Y','U','Y','2'):
- xvid_cs = XVID_CSP_YUY2;
- break;
- case GST_MAKE_FOURCC('Y','V','1','2'):
- xvid_cs = XVID_CSP_YV12;
- break;
- case GST_MAKE_FOURCC('U','Y','V','Y'):
- xvid_cs = XVID_CSP_UYVY;
- break;
- case GST_MAKE_FOURCC('Y','V','Y','U'):
- xvid_cs = XVID_CSP_YVYU;
- break;
- case GST_MAKE_FOURCC('R','G','B',' '):
- gst_caps_get_int(caps, "depth", &d);
- switch (d) {
- case 15:
- xvid_cs = XVID_CSP_RGB555;
- break;
- case 16:
- xvid_cs = XVID_CSP_RGB565;
- break;
- case 24:
- xvid_cs = XVID_CSP_RGB24;
- break;
- case 32:
- xvid_cs = XVID_CSP_RGB32;
- break;
- default:
- goto trynext;
- }
- break;
- default:
- goto trynext;
- }
+ case GST_MAKE_FOURCC('I','4','2','0'):
+ case GST_MAKE_FOURCC('I','Y','U','V'):
+ xvid_cs = XVID_CSP_I420;
+ break;
+ case GST_MAKE_FOURCC('Y','U','Y','2'):
+ xvid_cs = XVID_CSP_YUY2;
+ break;
+ case GST_MAKE_FOURCC('Y','V','1','2'):
+ xvid_cs = XVID_CSP_YV12;
+ break;
+ case GST_MAKE_FOURCC('U','Y','V','Y'):
+ xvid_cs = XVID_CSP_UYVY;
+ break;
+ case GST_MAKE_FOURCC('Y','V','Y','U'):
+ xvid_cs = XVID_CSP_YVYU;
+ break;
+ case GST_MAKE_FOURCC('R','G','B',' '):
+ gst_structure_get_int(structure, "depth", &d);
+ switch (d) {
+ case 15:
+ xvid_cs = XVID_CSP_RGB555;
+ break;
+ case 16:
+ xvid_cs = XVID_CSP_RGB565;
+ break;
+ case 24:
+ xvid_cs = XVID_CSP_RGB24;
+ break;
+ case 32:
+ xvid_cs = XVID_CSP_RGB32;
+ break;
+ }
+ break;
+ }
- xvidenc->csp = xvid_cs;
- xvidenc->width = w;
- xvidenc->height = h;
- xvidenc->fps = fps;
+ g_return_val_if_fail (xvid_cs != -1, GST_PAD_LINK_REFUSED);
- if (gst_xvidenc_setup(xvidenc)) {
- GstPadLinkReturn ret;
- GstCaps *new_caps;
+ xvidenc->csp = xvid_cs;
+ xvidenc->width = w;
+ xvidenc->height = h;
+ xvidenc->fps = fps;
- new_caps = GST_CAPS_NEW("xvidenc_src_caps",
- "video/x-xvid",
- "width", GST_PROPS_INT(w),
- "height", GST_PROPS_INT(h),
- "framerate", GST_PROPS_FLOAT (fps));
+ if (gst_xvidenc_setup(xvidenc)) {
+ GstPadLinkReturn ret;
+ GstCaps *new_caps;
- ret = gst_pad_try_set_caps(xvidenc->srcpad, new_caps);
+ new_caps = gst_caps_new_simple(
+ "video/x-xvid",
+ "width", G_TYPE_INT, w,
+ "height", G_TYPE_INT, h,
+ "framerate", G_TYPE_DOUBLE, fps);
- if (ret <= 0) {
- if (xvidenc->handle) {
- xvid_encore(xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
- xvidenc->handle = NULL;
- }
- }
+ ret = gst_pad_try_set_caps(xvidenc->srcpad, new_caps);
- return ret;
+ if (ret <= 0) {
+ if (xvidenc->handle) {
+ xvid_encore(xvidenc->handle, XVID_ENC_DESTROY, NULL, NULL);
+ xvidenc->handle = NULL;
+ }
}
-trynext:
- continue;
+ return ret;
}
/* if we got here - it's not good */
diff --git a/ext/xvid/gstxvidenc.h b/ext/xvid/gstxvidenc.h
index 7597e196..12f4d2fd 100644
--- a/ext/xvid/gstxvidenc.h
+++ b/ext/xvid/gstxvidenc.h
@@ -59,9 +59,9 @@ struct _GstXvidEnc {
/* xvid handle */
void *handle;
- int csp;
- int width, height;
- float fps;
+ gint csp;
+ gint width, height;
+ double fps;
};
struct _GstXvidEncClass {