summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2003-12-22 01:47:09 +0000
committerDavid Schleef <ds@schleef.org>2003-12-22 01:47:09 +0000
commitce51f6173ca1c37d90f8e2e316d90316583d7755 (patch)
tree270b121765a11455f5bf8166b526d7ac336dc56c /ext
parentf43f0a9fd781bafab689e46bd936af9cb5ed2690 (diff)
Merge CAPS branch
Original commit message from CVS: Merge CAPS branch
Diffstat (limited to 'ext')
-rw-r--r--ext/aalib/gstaasink.c27
-rw-r--r--ext/dv/gstdvdec.c264
-rw-r--r--ext/dv/gstdvdec.h1
-rw-r--r--ext/esd/esdmon.c105
-rw-r--r--ext/esd/esdsink.c109
-rw-r--r--ext/flac/gstflacdec.c57
-rw-r--r--ext/flac/gstflacenc.c56
-rw-r--r--ext/flac/gstflactag.c52
-rw-r--r--ext/gdk_pixbuf/gstgdkpixbuf.c156
-rw-r--r--ext/jpeg/gstjpegdec.c71
-rw-r--r--ext/jpeg/gstjpegdec.h2
-rw-r--r--ext/jpeg/gstjpegenc.c56
-rw-r--r--ext/jpeg/gstjpegenc.h2
-rw-r--r--ext/ladspa/gstladspa.c132
-rw-r--r--ext/ladspa/gstladspa.h2
-rw-r--r--ext/libpng/gstpngenc.c47
-rw-r--r--ext/mikmod/gstmikmod.c111
-rw-r--r--ext/pango/gsttextoverlay.c95
-rw-r--r--ext/raw1394/gstdv1394src.c37
-rw-r--r--ext/raw1394/gstdv1394src.h3
-rw-r--r--ext/speex/gstspeexdec.c87
-rw-r--r--ext/speex/gstspeexenc.c90
22 files changed, 645 insertions, 917 deletions
diff --git a/ext/aalib/gstaasink.c b/ext/aalib/gstaasink.c
index 59897e55..98db71bb 100644
--- a/ext/aalib/gstaasink.c
+++ b/ext/aalib/gstaasink.c
@@ -58,17 +58,13 @@ enum {
ARG_FRAME_TIME,
};
-GST_PAD_TEMPLATE_FACTORY (sink_template,
+static GstStaticPadTemplate sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- gst_caps_new (
- "aasink_caps",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
- )
-)
+ GST_STATIC_CAPS (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"))
+);
static void gst_aasink_base_init (gpointer g_class);
static void gst_aasink_class_init (GstAASinkClass *klass);
@@ -177,7 +173,7 @@ gst_aasink_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_static_pad_template_get (&sink_template));
gst_element_class_set_details (element_class, &gst_aasink_details);
}
@@ -244,17 +240,16 @@ gst_aasink_class_init (GstAASinkClass *klass)
}
static GstPadLinkReturn
-gst_aasink_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_aasink_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstAASink *aasink;
+ GstStructure *structure;
aasink = GST_AASINK (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "width", &aasink->width);
- gst_caps_get_int (caps, "height", &aasink->height);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "width", &aasink->width);
+ gst_structure_get_int (structure, "height", &aasink->height);
/* FIXME aasink->format is never set */
@@ -279,7 +274,7 @@ static void
gst_aasink_init (GstAASink *aasink)
{
aasink->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_template), "sink");
+ gst_element_get_pad_template (GST_ELEMENT (aasink), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (aasink), aasink->sinkpad);
gst_pad_set_chain_function (aasink->sinkpad, gst_aasink_chain);
gst_pad_set_link_function (aasink->sinkpad, gst_aasink_sinkconnect);
diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c
index 094445a8..593ac65b 100644
--- a/ext/dv/gstdvdec.c
+++ b/ext/dv/gstdvdec.c
@@ -29,8 +29,11 @@
#define NTSC_HEIGHT 480
#define NTSC_BUFFER 120000
+#define NTSC_FRAMERATE 29.997
+
#define PAL_HEIGHT 576
#define PAL_BUFFER 144000
+#define PAL_FRAMERATE 25.0
/* The ElementDetails structure gives a human-readable description
* of the plugin, as well as author and version data.
@@ -68,91 +71,88 @@ enum {
* can have. They can be quite complex, but for this dvdec plugin
* they are rather simple.
*/
-GST_PAD_TEMPLATE_FACTORY (sink_temp,
- "sink",
+static GstStaticPadTemplate sink_temp =
+GST_STATIC_PAD_TEMPLATE
+(
+ "sink" ,
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "dv_dec_sink",
- "video/x-dv",
- "systemstream", GST_PROPS_BOOLEAN (TRUE)
+ GST_STATIC_CAPS (
+ "video/x-dv, systemstream = (boolean) true"
)
-)
-
+);
-GST_PAD_TEMPLATE_FACTORY (video_src_temp,
+static GstStaticPadTemplate video_src_temp =
+GST_STATIC_PAD_TEMPLATE
+(
"video",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "dv_dec_src",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
- "width", GST_PROPS_INT (720),
- "height", GST_PROPS_LIST (
- GST_PROPS_INT (NTSC_HEIGHT),
- GST_PROPS_INT (PAL_HEIGHT)
- ),
- "framerate", GST_PROPS_LIST (
- GST_PROPS_FLOAT (25.),
- GST_PROPS_FLOAT (30/1.001)
- )
- ),
- GST_CAPS_NEW (
- "dv_dec_src",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT(32),
- "depth", GST_PROPS_INT(32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT(0x000000ff),
- "green_mask", GST_PROPS_INT(0x0000ff00),
- "blue_mask", GST_PROPS_INT(0x00ff0000),
- "width", GST_PROPS_INT (720),
- "height", GST_PROPS_LIST (
- GST_PROPS_INT (NTSC_HEIGHT),
- GST_PROPS_INT (PAL_HEIGHT)
- ),
- "framerate", GST_PROPS_LIST (
- GST_PROPS_FLOAT (25.),
- GST_PROPS_FLOAT (30/1.001)
- )
- ),
- GST_CAPS_NEW (
- "dv_dec_src",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT(24),
- "depth", GST_PROPS_INT(24),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT(0x0000ff),
- "green_mask", GST_PROPS_INT(0x00ff00),
- "blue_mask", GST_PROPS_INT(0xff0000),
- "width", GST_PROPS_INT (720),
- "height", GST_PROPS_LIST (
- GST_PROPS_INT (NTSC_HEIGHT),
- GST_PROPS_INT (PAL_HEIGHT)
- ),
- "framerate", GST_PROPS_LIST (
- GST_PROPS_FLOAT (25.),
- GST_PROPS_FLOAT (30/1.001)
- )
+ GST_STATIC_CAPS (
+ "video/x-raw-yuv, "
+ "format = (fourcc) YUY2, "
+ "width = (int) 720, "
+ "height = (int) { "
+ G_STRINGIFY(NTSC_HEIGHT) ", "
+ G_STRINGIFY(PAL_HEIGHT)
+ " }, "
+ "framerate = (float) { "
+ G_STRINGIFY(PAL_FRAMERATE) ", "
+ G_STRINGIFY(NTSC_FRAMERATE)
+ " }; "
+
+ "video/x-raw-rgb, "
+ "bpp = (int) 32, "
+ "depth = (int) 32, "
+ "endianness = (int) " G_STRINGIFY(G_BIG_ENDIAN) ", "
+ "red_mask = (int) 0x000000ff, "
+ "green_mask = (int) 0x0000ff00, "
+ "blue_mask = (int) 0x00ff0000, "
+ "width = (int) 720, "
+ "height = (int) { "
+ G_STRINGIFY(NTSC_HEIGHT) ", "
+ G_STRINGIFY(PAL_HEIGHT)
+ " }, "
+ "framerate = (float) { "
+ G_STRINGIFY(PAL_FRAMERATE) ", "
+ G_STRINGIFY(NTSC_FRAMERATE)
+ " }; "
+
+ "video/x-raw-rgb, "
+ "bpp = (int) 24, "
+ "depth = (int) 24, "
+ "endianness = (int) " G_STRINGIFY(G_BIG_ENDIAN) ", "
+ "red_mask = (int) 0x000000ff, "
+ "green_mask = (int) 0x0000ff00, "
+ "blue_mask = (int) 0x00ff0000, "
+ "width = (int) 720, "
+ "height = (int) { "
+ G_STRINGIFY(NTSC_HEIGHT) ", "
+ G_STRINGIFY(PAL_HEIGHT)
+ " }, "
+ "framerate = (float) { "
+ G_STRINGIFY(PAL_FRAMERATE) ", "
+ G_STRINGIFY(NTSC_FRAMERATE)
+ " }"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY ( audio_src_temp,
+static GstStaticPadTemplate audio_src_temp =
+GST_STATIC_PAD_TEMPLATE
+(
"audio",
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),
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
- "rate", GST_PROPS_INT_RANGE (4000, 48000)
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "depth = (int) 16, "
+ "width = (int) 16, "
+ "signed = (boolean) TRUE, "
+ "channels = (int) 2, "
+ "endianness = (int) " G_STRINGIFY(G_LITTLE_ENDIAN) ", "
+ "rate = (int) [ 4000, 48000 ]"
)
-)
+);
#define GST_TYPE_DVDEC_QUALITY (gst_dvdec_quality_get_type())
GType
@@ -247,9 +247,9 @@ gst_dvdec_base_init (gpointer g_class)
* Note that the generated padtemplates are stored in static global
* variables, for the gst_dvdec_init function to use later on.
*/
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET(sink_temp));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET(video_src_temp));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET(audio_src_temp));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get(&sink_temp));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get(&video_src_temp));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get(&audio_src_temp));
gst_element_class_set_details (element_class, &dvdec_details);
}
@@ -303,13 +303,13 @@ gst_dvdec_init(GstDVDec *dvdec)
{
gint i;
- dvdec->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_temp), "sink");
+ dvdec->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&sink_temp), "sink");
gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->sinkpad);
gst_pad_set_query_function (dvdec->sinkpad, NULL);
gst_pad_set_convert_function (dvdec->sinkpad, GST_DEBUG_FUNCPTR (gst_dvdec_sink_convert));
gst_pad_set_formats_function (dvdec->sinkpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
- dvdec->videosrcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (video_src_temp), "video");
+ dvdec->videosrcpad = gst_pad_new_from_template (gst_static_pad_template_get (&video_src_temp), "video");
gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->videosrcpad);
gst_pad_set_query_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_query));
gst_pad_set_query_type_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_src_query_types));
@@ -318,7 +318,7 @@ gst_dvdec_init(GstDVDec *dvdec)
gst_pad_set_convert_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_convert));
gst_pad_set_formats_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
- dvdec->audiosrcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET(audio_src_temp), "audio");
+ dvdec->audiosrcpad = gst_pad_new_from_template (gst_static_pad_template_get (&audio_src_temp), "audio");
gst_element_add_pad(GST_ELEMENT(dvdec),dvdec->audiosrcpad);
gst_pad_set_query_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_query));
gst_pad_set_query_type_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_src_query_types));
@@ -329,7 +329,6 @@ gst_dvdec_init(GstDVDec *dvdec)
gst_element_set_loop_function (GST_ELEMENT (dvdec), gst_dvdec_loop);
- dvdec->pool = NULL;
dvdec->length = 0;
dvdec->next_ts = 0LL;
dvdec->end_position = -1LL;
@@ -706,7 +705,7 @@ gst_dvdec_loop (GstElement *element)
dvdec->PAL = dv_system_50_fields (dvdec->decoder);
dvdec->framerate = (dvdec->PAL ? 2500 : 2997);
- fps = (dvdec->PAL ? 25. : 30/1.001);
+ fps = (dvdec->PAL ? PAL_FRAMERATE : NTSC_FRAMERATE);
dvdec->height = height = (dvdec->PAL ? PAL_HEIGHT : NTSC_HEIGHT);
length = (dvdec->PAL ? PAL_BUFFER : NTSC_BUFFER);
@@ -724,43 +723,51 @@ gst_dvdec_loop (GstElement *element)
/* if we did not negotiate yet, do it now */
if (!GST_PAD_CAPS (dvdec->videosrcpad)) {
- GstCaps *allowed;
- GstCaps *trylist;
+ GstCaps *caps = NULL;
+ GstCaps *negotiated_caps = NULL;
+ GstPadTemplate *src_pad_template;
+ int i;
- /* we what we are allowed to do */
- allowed = gst_pad_get_allowed_caps (dvdec->videosrcpad);
-
/* try to fix our height */
- trylist = gst_caps_intersect (allowed, gst_caps_append (
- GST_CAPS_NEW (
- "dvdec_negotiate",
- "video/x-raw-yuv",
- "height", GST_PROPS_INT (height),
- "framerate", GST_PROPS_FLOAT (fps)
- ), GST_CAPS_NEW (
- "dvdec_negotiate",
- "video/x-raw-rgb",
- "height", GST_PROPS_INT (height),
- "framerate", GST_PROPS_FLOAT (fps)
- )));
-
- /* prepare for looping */
- trylist = gst_caps_normalize (trylist);
+ src_pad_template = gst_static_pad_template_get (&video_src_temp);
+ caps = gst_caps_copy(gst_pad_template_get_caps (src_pad_template));
+
+ for (i = 0; i < gst_caps_get_size (caps); i++)
+ {
+ GstStructure *structure = gst_caps_get_structure (caps, i);
+ gst_structure_set(structure,
+ "height", G_TYPE_INT, height,
+ "framerate", G_TYPE_INT, fps, NULL
+ );
+ }
- while (trylist) {
- GstCaps *to_try = gst_caps_copy_1 (trylist);
+ for (i=0; i < gst_caps_get_size(caps); i++) {
+ GstStructure *to_try_struct = gst_caps_get_structure (caps, i);
+ GstCaps *try_caps = gst_caps_new_full (to_try_struct);
/* try each format */
- if (gst_pad_try_set_caps (dvdec->videosrcpad, to_try) > 0) {
- guint32 fourcc;
+ if (gst_pad_try_set_caps (dvdec->videosrcpad, try_caps) > 0) {
+ negotiated_caps = try_caps;
+ break;
+ }
+
+ gst_caps_free(try_caps);
+ }
+
+ gst_caps_free (caps);
+
+ /* Check if we negotiated caps successfully */
+ if (negotiated_caps != NULL) {
+ GstStructure *structure = gst_caps_get_structure (negotiated_caps, 0);
+ guint32 fourcc;
/* it worked, try to find what it was again */
- gst_caps_get_fourcc_int (to_try, "format", &fourcc);
+ gst_structure_get_fourcc (structure, "format", &fourcc);
if (fourcc == GST_STR_FOURCC ("RGB ")) {
gint bpp;
- gst_caps_get_int (to_try, "bpp", &bpp);
+ gst_structure_get_int (structure, "bpp", &bpp);
if (bpp == 24) {
dvdec->space = e_dv_color_rgb;
dvdec->bpp = 3;
@@ -774,12 +781,7 @@ gst_dvdec_loop (GstElement *element)
dvdec->space = e_dv_color_yuv;
dvdec->bpp = 2;
}
- break;
- }
- trylist = trylist->next;
- }
- /* oops list exhausted an nothing was found... */
- if (!trylist) {
+ } else {
gst_element_error (element, "could not negotiate");
return;
}
@@ -799,15 +801,14 @@ gst_dvdec_loop (GstElement *element)
/* if we did not negotiate yet, do it now */
if (!GST_PAD_CAPS (dvdec->audiosrcpad)) {
gst_pad_try_set_caps (dvdec->audiosrcpad,
- GST_CAPS_NEW (
- "dvdec_audio_caps",
- "audio/x-raw-int",
- "rate", GST_PROPS_INT (dvdec->decoder->audio->frequency),
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "channels", GST_PROPS_INT (dvdec->decoder->audio->num_channels),
- "endianness", GST_PROPS_INT (G_LITTLE_ENDIAN)
+ gst_caps_new_simple (
+ "audio/x-raw-int",
+ "rate", G_TYPE_INT, dvdec->decoder->audio->frequency,
+ "depth", G_TYPE_INT, 16,
+ "width", G_TYPE_INT, 16,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "channels", G_TYPE_INT, dvdec->decoder->audio->num_channels,
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN
));
}
@@ -831,23 +832,7 @@ gst_dvdec_loop (GstElement *element)
guint8 *outframe_ptrs[3];
gint outframe_pitches[3];
- /* try to grab a pool */
- if (!dvdec->pool) {
- dvdec->pool = gst_pad_get_bufferpool (dvdec->videosrcpad);
- }
-
- outbuf = NULL;
- /* try to get a buffer from the pool if we have one */
- if (dvdec->pool) {
- outbuf = gst_buffer_new_from_pool (dvdec->pool, 0, 0);
- }
- /* no buffer from pool, allocate one ourselves */
- if (!outbuf) {
- outbuf = gst_buffer_new ();
-
- GST_BUFFER_SIZE (outbuf) = (720 * height) * dvdec->bpp;
- GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
- }
+ outbuf = gst_buffer_new_and_alloc ((720 * height) * dvdec->bpp);
outframe = GST_BUFFER_DATA (outbuf);
@@ -898,9 +883,6 @@ gst_dvdec_change_state (GstElement *element)
case GST_STATE_PAUSED_TO_PLAYING:
break;
case GST_STATE_PLAYING_TO_PAUSED:
- if (dvdec->pool)
- gst_buffer_pool_unref (dvdec->pool);
- dvdec->pool = NULL;
break;
case GST_STATE_PAUSED_TO_READY:
dv_decoder_free (dvdec->decoder);
diff --git a/ext/dv/gstdvdec.h b/ext/dv/gstdvdec.h
index 0ac9c49a..c360db31 100644
--- a/ext/dv/gstdvdec.h
+++ b/ext/dv/gstdvdec.h
@@ -54,7 +54,6 @@ struct _GstDVDec {
gint quality;
GstByteStream *bs;
- GstBufferPool *pool;
dv_color_space_t space;
gint bpp;
gboolean PAL;
diff --git a/ext/esd/esdmon.c b/ext/esd/esdmon.c
index 2ddb1770..e2a91ed4 100644
--- a/ext/esd/esdmon.c
+++ b/ext/esd/esdmon.c
@@ -52,38 +52,31 @@ enum {
ARG_HOST,
};
-GST_PAD_TEMPLATE_FACTORY (src_factory,
- "src", /* the name of the pads */
- GST_PAD_SRC, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "esdmon_src", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- /* Properties follow: */
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000, 96000),
- "channels", GST_PROPS_LIST (
- GST_PROPS_INT (1),
- GST_PROPS_INT (2)
- )
+static GstStaticPadTemplate src_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = [ 8000, 96000 ], "
+ "channels = [ 1, 2 ]; "
+ "audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "rate = [ 8000, 96000 ], "
+ "channels = [ 1, 2 ]"
)
);
static void gst_esdmon_base_init (gpointer g_class);
-static void gst_esdmon_class_init (GstEsdmonClass *klass);
-static void gst_esdmon_init (GstEsdmon *esdmon);
+static void gst_esdmon_class_init (gpointer g_class, gpointer class_data);
+static void gst_esdmon_init (GTypeInstance *instance, gpointer g_class);
static gboolean gst_esdmon_open_audio (GstEsdmon *src);
static void gst_esdmon_close_audio (GstEsdmon *src);
@@ -143,12 +136,12 @@ gst_esdmon_get_type (void)
sizeof(GstEsdmonClass),
gst_esdmon_base_init,
NULL,
- (GClassInitFunc)gst_esdmon_class_init,
+ gst_esdmon_class_init,
NULL,
NULL,
sizeof(GstEsdmon),
0,
- (GInstanceInitFunc)gst_esdmon_init,
+ gst_esdmon_init,
};
esdmon_type = g_type_register_static(GST_TYPE_ELEMENT, "GstEsdmon", &esdmon_info, 0);
}
@@ -160,37 +153,35 @@ gst_esdmon_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_static_pad_template_get (&src_factory));
gst_element_class_set_details (element_class, &esdmon_details);
}
static void
-gst_esdmon_class_init (GstEsdmonClass *klass)
+gst_esdmon_class_init (gpointer g_class, gpointer class_data)
{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ parent_class = g_type_class_peek_parent (g_class);
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_BYTESPERREAD,
+ g_object_class_install_property(gobject_class, ARG_BYTESPERREAD,
g_param_spec_ulong("bytes_per_read","bytes_per_read","bytes_per_read",
0,G_MAXULONG,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_CUROFFSET,
+ g_object_class_install_property(gobject_class, ARG_CUROFFSET,
g_param_spec_ulong("curoffset","curoffset","curoffset",
0,G_MAXULONG,0,G_PARAM_READABLE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_DEPTH,
+ g_object_class_install_property(gobject_class, ARG_DEPTH,
g_param_spec_enum("depth","depth","depth",
GST_TYPE_ESDMON_DEPTHS,16,G_PARAM_READWRITE)); /* CHECKME! */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_CHANNELS,
+ g_object_class_install_property(gobject_class, ARG_CHANNELS,
g_param_spec_enum("channels","channels","channels",
GST_TYPE_ESDMON_CHANNELS,2,G_PARAM_READWRITE)); /* CHECKME! */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_RATE,
+ g_object_class_install_property(gobject_class, ARG_RATE,
g_param_spec_int("frequency","frequency","frequency",
G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HOST,
+ g_object_class_install_property(gobject_class, ARG_HOST,
g_param_spec_string("host","host","host",
NULL, G_PARAM_READWRITE)); /* CHECKME */
@@ -201,10 +192,13 @@ gst_esdmon_class_init (GstEsdmonClass *klass)
}
static void
-gst_esdmon_init(GstEsdmon *esdmon)
+gst_esdmon_init(GTypeInstance *instance, gpointer g_class)
{
+ GstEsdmon *esdmon = GST_ESDMON (instance);
+
esdmon->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_factory), "src");
+ gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (esdmon), "src"),
+ "src");
gst_pad_set_get_function(esdmon->srcpad, gst_esdmon_get);
gst_element_add_pad(GST_ELEMENT(esdmon), esdmon->srcpad);
@@ -262,17 +256,16 @@ gst_esdmon_get (GstPad *pad)
if (!GST_PAD_CAPS (pad)) {
gint sign = (esdmon->depth == 8 ? FALSE : TRUE);
/* set caps on src pad */
+ /* FIXME: do this dynamically */
if (gst_pad_try_set_caps (esdmon->srcpad,
- GST_CAPS_NEW (
- "oss_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER), /*FIXME */
- "signed", GST_PROPS_BOOLEAN (sign), /*FIXME */
- "width", GST_PROPS_INT (esdmon->depth),
- "depth", GST_PROPS_INT (esdmon->depth),
- "rate", GST_PROPS_INT (esdmon->frequency),
- "channels", GST_PROPS_INT (esdmon->channels)
- )) <= 0)
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, sign,
+ "width", G_TYPE_INT, esdmon->depth,
+ "depth", G_TYPE_INT, esdmon->depth,
+ "rate", G_TYPE_INT, esdmon->frequency,
+ "channels", G_TYPE_INT, esdmon->channels
+ )) <= 0)
{
gst_element_error (GST_ELEMENT (esdmon), "could not set caps");
return NULL;
diff --git a/ext/esd/esdsink.c b/ext/esd/esdsink.c
index 219f7327..1595467a 100644
--- a/ext/esd/esdsink.c
+++ b/ext/esd/esdsink.c
@@ -50,43 +50,36 @@ enum {
ARG_FALLBACK,
};
-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 (
- "esdsink_sink", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- /* Properties follow: */
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (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 (
+ "audio/x-raw-int, "
+ "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = [ 8000, 96000 ], "
+ "channels = [ 1, 2 ]; "
+ "audio/x-raw-int, "
+ "signed = (boolean) FALSE, "
+ "width = (int) 8, "
+ "depth = (int) 8, "
+ "rate = [ 8000, 96000 ], "
+ "channels = [ 1, 2 ]"
)
);
static void gst_esdsink_base_init (gpointer g_class);
-static void gst_esdsink_class_init (GstEsdsinkClass *klass);
-static void gst_esdsink_init (GstEsdsink *esdsink);
+static void gst_esdsink_class_init (gpointer g_class, gpointer class_data);
+static void gst_esdsink_init (GTypeInstance *instance, gpointer g_class);
static gboolean gst_esdsink_open_audio (GstEsdsink *sink);
static void gst_esdsink_close_audio (GstEsdsink *sink);
static GstElementStateReturn gst_esdsink_change_state (GstElement *element);
-static GstPadLinkReturn gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_esdsink_link (GstPad *pad, const GstCaps *caps);
static GstClockTime gst_esdsink_get_time (GstClock *clock, gpointer data);
static GstClock * gst_esdsink_get_clock (GstElement *element);
@@ -111,12 +104,12 @@ gst_esdsink_get_type (void)
sizeof(GstEsdsinkClass),
gst_esdsink_base_init,
NULL,
- (GClassInitFunc)gst_esdsink_class_init,
+ gst_esdsink_class_init,
NULL,
NULL,
sizeof(GstEsdsink),
0,
- (GInstanceInitFunc)gst_esdsink_init,
+ gst_esdsink_init,
};
esdsink_type = g_type_register_static(GST_TYPE_ELEMENT, "GstEsdsink", &esdsink_info, 0);
}
@@ -128,31 +121,29 @@ gst_esdsink_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, &esdsink_details);
}
static void
-gst_esdsink_class_init (GstEsdsinkClass *klass)
+gst_esdsink_class_init (gpointer g_class, gpointer class_data)
{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ parent_class = g_type_class_peek_parent (g_class);
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_MUTE,
+ g_object_class_install_property(gobject_class, ARG_MUTE,
g_param_spec_boolean("mute","mute","mute",
TRUE,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HOST,
+ g_object_class_install_property(gobject_class, ARG_HOST,
g_param_spec_string("host","host","host",
NULL, G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SYNC,
+ g_object_class_install_property(gobject_class, ARG_SYNC,
g_param_spec_boolean("sync","sync","Synchronize output to clock",
FALSE,G_PARAM_READWRITE));
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_FALLBACK,
+ g_object_class_install_property(gobject_class, ARG_FALLBACK,
g_param_spec_boolean("fallback","fallback","Fall back to using OSS if Esound daemon is not present",
FALSE,G_PARAM_READWRITE));
@@ -165,13 +156,16 @@ gst_esdsink_class_init (GstEsdsinkClass *klass)
}
static void
-gst_esdsink_init(GstEsdsink *esdsink)
+gst_esdsink_init(GTypeInstance *instance, gpointer g_class)
{
+ GstEsdsink *esdsink = GST_ESDSINK (instance);
+
esdsink->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (instance), "sink"),
+ "sink");
gst_element_add_pad(GST_ELEMENT(esdsink), esdsink->sinkpad);
gst_pad_set_chain_function(esdsink->sinkpad, GST_DEBUG_FUNCPTR(gst_esdsink_chain));
- gst_pad_set_link_function(esdsink->sinkpad, gst_esdsink_sinkconnect);
+ gst_pad_set_link_function(esdsink->sinkpad, gst_esdsink_link);
GST_FLAG_SET (esdsink, GST_ELEMENT_EVENT_AWARE);
@@ -191,34 +185,27 @@ gst_esdsink_init(GstEsdsink *esdsink)
}
static GstPadLinkReturn
-gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_esdsink_link (GstPad *pad, const GstCaps *caps)
{
GstEsdsink *esdsink;
- gboolean sign;
+ GstStructure *structure;
esdsink = GST_ESDSINK (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "depth", &esdsink->depth);
- gst_caps_get_int (caps, "signed", &sign);
- gst_caps_get_int (caps, "channels", &esdsink->channels);
- gst_caps_get_int (caps, "rate", &esdsink->frequency);
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "signed", &esdsink->depth);
+ gst_structure_get_int (structure, "channels", &esdsink->channels);
+ gst_structure_get_int (structure, "rate", &esdsink->frequency);
esdsink->bytes_per_sample = esdsink->channels * (esdsink->depth/8);
- /* only u8/s16 */
- if ((sign == FALSE && esdsink->depth != 8) ||
- (sign == TRUE && esdsink->depth != 16)) {
- return GST_PAD_LINK_REFUSED;
- }
-
gst_esdsink_close_audio (esdsink);
if (gst_esdsink_open_audio (esdsink)) {
esdsink->negotiated = TRUE;
return GST_PAD_LINK_OK;
}
+ /* FIXME: is it supposed to be correct to have closed audio when caps nego
+ failed? */
return GST_PAD_LINK_REFUSED;
}
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index 104552d6..62b39bbc 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -124,31 +124,22 @@ flacdec_get_type(void) {
static GstCaps*
flac_caps_factory (void)
{
- return
- gst_caps_new (
- "flac_flac",
- "audio/x-flac",
- /*gst_props_new (
- "rate", GST_PROPS_INT_RANGE (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL)*/ NULL);
+ return gst_caps_new_simple ("audio/x-flac", NULL);
+ /* "rate", GST_PROPS_INT_RANGE (11025, 48000),
+ * "channels", GST_PROPS_INT_RANGE (1, 2), */
}
static GstCaps*
raw_caps_factory (void)
{
- return
- gst_caps_new (
- "flac_raw",
- "audio/x-raw-int",
- gst_props_new (
- "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 (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return 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", GST_TYPE_INT_RANGE, 11025, 48000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
static void
@@ -160,12 +151,10 @@ gst_flacdec_base_init (gpointer g_class)
raw_caps = raw_caps_factory ();
flac_caps = flac_caps_factory ();
- sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- flac_caps, NULL);
+ sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
+ GST_PAD_ALWAYS, flac_caps);
src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
+ GST_PAD_ALWAYS, raw_caps);
gst_element_class_add_pad_template (element_class, sink_template);
gst_element_class_add_pad_template (element_class, src_template);
gst_element_class_set_details (element_class, &flacdec_details);
@@ -485,16 +474,14 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder *decoder,
if (!GST_PAD_CAPS (flacdec->srcpad)) {
gst_pad_try_set_caps (flacdec->srcpad,
- GST_CAPS_NEW (
- "flac_caps",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (depth),
- "depth", GST_PROPS_INT (depth),
- "rate", GST_PROPS_INT (frame->header.sample_rate),
- "channels", GST_PROPS_INT (channels)
- ));
+ gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, depth,
+ "depth", G_TYPE_INT, depth,
+ "rate", G_TYPE_INT, frame->header.sample_rate,
+ "channels", G_TYPE_INT, channels,
+ NULL));
flacdec->depth = depth;
flacdec->channels = channels;
diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c
index 29425c95..637b8a62 100644
--- a/ext/flac/gstflacenc.c
+++ b/ext/flac/gstflacenc.c
@@ -68,7 +68,7 @@ static void gst_flacenc_class_init (FlacEncClass *klass);
static void gst_flacenc_dispose (GObject *object);
static GstPadLinkReturn
- gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps);
+ gst_flacenc_sinkconnect (GstPad *pad, const GstCaps *caps);
static void gst_flacenc_chain (GstPad *pad, GstData *_data);
static gboolean gst_flacenc_update_quality (FlacEnc *flacenc, gint quality);
@@ -179,31 +179,22 @@ gst_flacenc_quality_get_type (void)
static GstCaps*
flac_caps_factory (void)
{
- return
- gst_caps_new (
- "flac_flac",
- "audio/x-flac",
- /* gst_props_new (
- "rate", GST_PROPS_INT_RANGE (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL) */NULL);
+ return gst_caps_new_simple ("audio/x-flac", NULL);
+ /* "rate", GST_PROPS_INT_RANGE (11025, 48000),
+ * "channels", GST_PROPS_INT_RANGE (1, 2), */
}
static GstCaps*
raw_caps_factory (void)
{
- return
- gst_caps_new (
- "flac_raw",
- "audio/x-raw-int",
- gst_props_new (
- "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 (11025, 48000),
- "channels", GST_PROPS_INT_RANGE (1, 2),
- NULL));
+ return 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", GST_TYPE_INT_RANGE, 11025, 48000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2,
+ NULL);
}
static void
@@ -217,10 +208,10 @@ gst_flacenc_base_init (gpointer g_class)
sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
- raw_caps, NULL);
+ raw_caps);
src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
- flac_caps, NULL);
+ flac_caps);
gst_element_class_add_pad_template (element_class, sink_template);
gst_element_class_add_pad_template (element_class, src_template);
gst_element_class_set_details (element_class, &flacenc_details);
@@ -354,24 +345,23 @@ gst_flacenc_dispose (GObject *object)
}
static GstPadLinkReturn
-gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_flacenc_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstPadLinkReturn ret;
FlacEnc *flacenc;
+ GstStructure *structure;
flacenc = GST_FLACENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get_int (caps, "channels", &flacenc->channels);
- gst_caps_get_int (caps, "depth", &flacenc->depth);
- gst_caps_get_int (caps, "rate", &flacenc->sample_rate);
+ gst_structure_get_int (structure, "channels", &flacenc->channels);
+ gst_structure_get_int (structure, "depth", &flacenc->depth);
+ gst_structure_get_int (structure, "rate", &flacenc->sample_rate);
- caps = GST_CAPS_NEW ("flacenc_srccaps",
- "audio/x-flac",
- "channels", GST_PROPS_INT (flacenc->channels),
- "rate", GST_PROPS_INT (flacenc->sample_rate));
+ caps = gst_caps_new_simple ("audio/x-flac",
+ "channels", G_TYPE_INT, flacenc->channels,
+ "rate", G_TYPE_INT, flacenc->sample_rate, NULL);
ret = gst_pad_try_set_caps (flacenc->srcpad, caps);
if (ret <= 0) {
return ret;
diff --git a/ext/flac/gstflactag.c b/ext/flac/gstflactag.c
index 39d31729..5a155f24 100644
--- a/ext/flac/gstflactag.c
+++ b/ext/flac/gstflactag.c
@@ -100,32 +100,21 @@ enum {
/* FILL ME */
};
-GST_PAD_TEMPLATE_FACTORY (flac_tag_src_template_factory,
+static GstStaticPadTemplate flac_tag_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "flac_tag_tag_src",
- "audio/x-flac",
- NULL
- ),
- GST_CAPS_NEW (
- "flac_tag_tag_src",
- "application/x-gst-tags",
- NULL
- )
-)
-
-GST_PAD_TEMPLATE_FACTORY (flac_tag_sink_template_factory,
+ GST_STATIC_CAPS ("audio/x-flac; application/x-gst-tags")
+);
+
+static GstStaticPadTemplate flac_tag_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "flac_tag_data_sink",
- "audio/x-flac",
- NULL
- )
-)
+ GST_STATIC_CAPS ("audio/x-flac")
+);
static void gst_flac_tag_base_init (gpointer g_class);
@@ -181,9 +170,9 @@ gst_flac_tag_base_init (gpointer g_class)
gst_element_class_set_details (element_class, &gst_flac_tag_details);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (flac_tag_sink_template_factory));
+ gst_static_pad_template_get (&flac_tag_sink_template));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (flac_tag_src_template_factory));
+ gst_static_pad_template_get (&flac_tag_src_template));
}
@@ -207,25 +196,20 @@ caps_nego (GstFlacTag *tag)
{
/* do caps nego */
GstCaps *caps;
- capsnego:
- caps = GST_CAPS_NEW ("flac_tag_data_src", "audio/x-flac", NULL);
+
+ caps = gst_caps_new_simple ("audio/x-flac", NULL);
if (gst_pad_try_set_caps (tag->srcpad, caps) != GST_PAD_LINK_REFUSED) {
tag->only_output_tags = FALSE;
GST_LOG_OBJECT (tag, "normal operation, using audio/x-flac output");
} else {
- if (gst_pad_try_set_caps (tag->srcpad,
- GST_CAPS_NEW ("flac_tag_tag_src", "application/x-gst-tags", NULL))
+ if (gst_pad_try_set_caps (tag->srcpad, gst_caps_new_simple (
+ "application/x-gst-tags", NULL))
!= GST_PAD_LINK_REFUSED) {
tag->only_output_tags = TRUE;
GST_LOG_OBJECT (tag, "fast operation, just outputting tags");
printf ("output tags only\n");
} else {
- caps = gst_pad_template_get_caps (GST_PAD_TEMPLATE_GET (flac_tag_src_template_factory));
- if (gst_pad_recover_caps_error (tag->srcpad, caps)) {
- goto capsnego;
- } else {
- return FALSE;
- }
+ return FALSE;
}
}
return TRUE;
@@ -251,12 +235,12 @@ gst_flac_tag_init (GstFlacTag *tag)
{
/* create the sink and src pads */
tag->sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET (flac_tag_sink_template_factory), "sink");
+ gst_static_pad_template_get (&flac_tag_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (tag), tag->sinkpad);
gst_pad_set_chain_function (tag->sinkpad, GST_DEBUG_FUNCPTR (gst_flac_tag_chain));
tag->srcpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET (flac_tag_src_template_factory), "src");
+ gst_static_pad_template_get (&flac_tag_src_template), "src");
gst_element_add_pad (GST_ELEMENT (tag), tag->srcpad);
tag->buffer = NULL;
diff --git a/ext/gdk_pixbuf/gstgdkpixbuf.c b/ext/gdk_pixbuf/gstgdkpixbuf.c
index 749a72f7..1034de65 100644
--- a/ext/gdk_pixbuf/gstgdkpixbuf.c
+++ b/ext/gdk_pixbuf/gstgdkpixbuf.c
@@ -25,6 +25,7 @@
#endif
#include <gst/gst.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gst/video/video.h>
#include <string.h>
#include "gstgdkpixbuf.h"
@@ -47,50 +48,39 @@ enum {
ARG_SILENT
};
-GST_PAD_TEMPLATE_FACTORY (gst_gdk_pixbuf_sink_factory,
+static GstStaticPadTemplate gst_gdk_pixbuf_sink_template =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/png", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/jpeg", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/gif", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-icon", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "application/x-navi-animation", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-cmu-raster", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-sun-raster", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-pixmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/tiff", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-anymap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-bitmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-graymap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-pixmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-MS-bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/vnd.wap.wbmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-bitmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-tga", NULL)
+ GST_STATIC_CAPS (
+ "image/png; "
+ "image/jpeg; "
+ "image/gif; "
+ "image/x-icon; "
+ "application/x-navi-animation; "
+ "image/x-cmu-raster; "
+ "image/x-sun-raster; "
+ "image/x-pixmap; "
+ "image/tiff; "
+ "image/x-portable-anymap; "
+ "image/x-portable-bitmap; "
+ "image/x-portable-graymap; "
+ "image/x-portable-pixmap; "
+ "image/bmp; "
+ "image/x-bmp; "
+ "image/x-MS-bmp; "
+ "image/vnd.wap.wbmp; "
+ "image/x-bitmap; "
+ "image/x-tga")
);
-GST_PAD_TEMPLATE_FACTORY (gst_gdk_pixbuf_src_factory,
+static GstStaticPadTemplate gst_gdk_pixbuf_src_template =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW(
- "gdk_pixbuf_src",
- "video/x-raw-rgb",
- "width", GST_PROPS_INT_RANGE(1,INT_MAX),
- "height", GST_PROPS_INT_RANGE(1,INT_MAX),
- /* well, it's needed for connectivity but this
- * doesn't really make sense... */
- "framerate", GST_PROPS_FLOAT_RANGE(0, G_MAXFLOAT),
- "bpp", GST_PROPS_INT(32),
- "depth", GST_PROPS_INT(24),
- "endianness", GST_PROPS_INT(G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT(0x00ff0000),
- "green_mask", GST_PROPS_INT(0x0000ff00),
- "blue_mask", GST_PROPS_INT(0x000000ff)
- )
+ GST_STATIC_CAPS (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24)
);
static void gst_gdk_pixbuf_base_init (gpointer g_class);
@@ -110,7 +100,7 @@ static void gst_gdk_pixbuf_type_find (GstTypeFind *tf, gpointer ignore);
static GstElementClass *parent_class = NULL;
static GstPadLinkReturn
-gst_gdk_pixbuf_sink_link (GstPad *pad, GstCaps *caps)
+gst_gdk_pixbuf_sink_link (GstPad *pad, const GstCaps *caps)
{
GstGdkPixbuf *filter;
@@ -119,11 +109,6 @@ gst_gdk_pixbuf_sink_link (GstPad *pad, GstCaps *caps)
g_return_val_if_fail (GST_IS_GDK_PIXBUF (filter),
GST_PAD_LINK_REFUSED);
- if (GST_CAPS_IS_FIXED (caps))
- {
- return GST_PAD_LINK_OK;
- }
-
return GST_PAD_LINK_DELAYED;
}
@@ -134,31 +119,8 @@ gst_gdk_pixbuf_sink_link (GstPad *pad, GstCaps *caps)
* library. */
static GstCaps *gst_gdk_pixbuf_get_capslist(void)
{
- GstCaps *capslist;
-
- capslist = gst_caps_chain(
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/png", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/jpeg", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/gif", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-icon", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "application/x-navi-animation", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-cmu-raster", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-sun-raster", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-pixmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/tiff", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-anymap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-bitmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-graymap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-portable-pixmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-MS-bmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/vnd.wap.wbmp", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-bitmap", NULL),
- GST_CAPS_NEW("gdk_pixbuf_sink", "image/x-tga", NULL),
- NULL);
-
- return capslist;
+ return gst_caps_copy (gst_static_caps_get (
+ &gst_gdk_pixbuf_sink_template.static_caps));
}
#else
static GstCaps *gst_gdk_pixbuf_get_capslist(void)
@@ -168,31 +130,27 @@ static GstCaps *gst_gdk_pixbuf_get_capslist(void)
GdkPixbufFormat *pixbuf_format;
char **mimetypes;
char **mimetype;
- static GstCaps *capslist = NULL;
-
- if(capslist==NULL){
- slist0 = gdk_pixbuf_get_formats();
-
- for(slist = slist0;slist;slist=g_slist_next(slist)){
- pixbuf_format = slist->data;
- mimetypes = gdk_pixbuf_format_get_mime_types(pixbuf_format);
- for(mimetype = mimetypes; *mimetype; mimetype++){
- capslist = gst_caps_append(capslist, gst_caps_new("ack",*mimetype,NULL));
- }
- g_free(mimetypes);
- }
- gst_caps_ref(capslist);
- gst_caps_sink(capslist);
- g_slist_free(slist0);
+ GstCaps *capslist = NULL;
- g_print("%s\n",gst_caps_to_string(capslist));
+ capslist = gst_caps_new_empty ();
+ slist0 = gdk_pixbuf_get_formats();
+
+ for(slist = slist0;slist;slist=g_slist_next(slist)){
+ pixbuf_format = slist->data;
+ mimetypes = gdk_pixbuf_format_get_mime_types(pixbuf_format);
+ for(mimetype = mimetypes; *mimetype; mimetype++){
+ gst_caps_append_structure (capslist,
+ gst_structure_new (*mimetype,NULL));
+ }
+ g_free(mimetypes);
}
+ g_slist_free(slist0);
return capslist;
}
#endif
-static GstCaps *gst_gdk_pixbuf_sink_getcaps(GstPad *pad, GstCaps *caps)
+static GstCaps *gst_gdk_pixbuf_sink_getcaps(GstPad *pad)
{
GstGdkPixbuf *filter;
@@ -234,8 +192,10 @@ gst_gdk_pixbuf_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, gst_gdk_pixbuf_src_factory ());
- gst_element_class_add_pad_template (element_class, gst_gdk_pixbuf_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get( &gst_gdk_pixbuf_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get( &gst_gdk_pixbuf_sink_template));
gst_element_class_set_details (element_class, &plugin_details);
}
@@ -262,12 +222,12 @@ gst_gdk_pixbuf_class_init (GstGdkPixbufClass *klass)
static void
gst_gdk_pixbuf_init (GstGdkPixbuf *filter)
{
- filter->sinkpad = gst_pad_new_from_template (gst_gdk_pixbuf_sink_factory (),
- "sink");
+ filter->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get( &gst_gdk_pixbuf_sink_template), "sink");
gst_pad_set_link_function (filter->sinkpad, gst_gdk_pixbuf_sink_link);
gst_pad_set_getcaps_function (filter->sinkpad, gst_gdk_pixbuf_sink_getcaps);
- filter->srcpad = gst_pad_new_from_template (gst_gdk_pixbuf_src_factory (),
- "src");
+ filter->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get( &gst_gdk_pixbuf_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
@@ -285,7 +245,7 @@ gst_gdk_pixbuf_chain (GstPad *pad, GstData *_data)
GstBuffer *outbuf;
GError *error = NULL;
- g_print("gst_gdk_pixbuf_chain\n");
+ GST_DEBUG ("gst_gdk_pixbuf_chain");
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
@@ -313,9 +273,10 @@ gst_gdk_pixbuf_chain (GstPad *pad, GstData *_data)
filter->image_size = filter->rowstride * filter->height;
caps = gst_pad_get_caps(filter->srcpad);
- gst_caps_set(caps, "width", GST_PROPS_INT(filter->width));
- gst_caps_set(caps, "height", GST_PROPS_INT(filter->height));
- gst_caps_set(caps, "framerate", GST_PROPS_FLOAT(0.));
+ gst_caps_set_simple (caps,
+ "width", G_TYPE_INT, filter->width,
+ "height", G_TYPE_INT, filter->height,
+ "framerate", G_TYPE_DOUBLE, 0., NULL);
gst_pad_try_set_caps(filter->srcpad, caps);
}
@@ -399,7 +360,7 @@ gst_gdk_pixbuf_type_find (GstTypeFind *tf, gpointer ignore)
gchar **mlist = gdk_pixbuf_format_get_mime_types(format);
gst_type_find_suggest (tf, GST_TYPE_FIND_MINIMUM,
- gst_caps_new ("gdk_pixbuf_type_find", mlist[0], NULL));
+ gst_caps_new_simple (mlist[0], NULL));
}
gdk_pixbuf_loader_close (pixbuf_loader, NULL);
@@ -418,7 +379,8 @@ plugin_init (GstPlugin *plugin)
return FALSE;
gst_type_find_register (plugin, "image/*", GST_RANK_MARGINAL,
- gst_gdk_pixbuf_type_find, NULL, GST_CAPS_ANY, NULL);
+ gst_gdk_pixbuf_type_find, NULL,
+ gst_caps_copy(GST_CAPS_ANY), NULL);
/* plugin initialisation succeeded */
return TRUE;
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c
index abade583..9c9af750 100644
--- a/ext/jpeg/gstjpegdec.c
+++ b/ext/jpeg/gstjpegdec.c
@@ -54,7 +54,7 @@ static void gst_jpegdec_init (GstJpegDec *jpegdec);
static void gst_jpegdec_chain (GstPad *pad, GstData *_data);
static GstPadLinkReturn
- gst_jpegdec_link (GstPad *pad, GstCaps *caps);
+ gst_jpegdec_link (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_jpegdec_signals[LAST_SIGNAL] = { 0 }; */
@@ -83,26 +83,17 @@ gst_jpegdec_get_type(void) {
static GstCaps*
jpeg_caps_factory (void)
{
- return
- gst_caps_new (
- "jpeg_jpeg",
- "image/jpeg",
- gst_props_new (
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- NULL));
+ return gst_caps_new_simple ("image/jpeg",
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
}
static GstCaps*
raw_caps_factory (void)
{
- return
- gst_caps_new (
- "jpeg_raw",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))));
+ return gst_caps_from_string (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"));
}
static void
@@ -116,10 +107,10 @@ gst_jpegdec_base_init (gpointer g_class)
jpegdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
- jpeg_caps, NULL);
+ jpeg_caps);
jpegdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
- raw_caps, NULL);
+ raw_caps);
gst_element_class_add_pad_template (element_class, jpegdec_sink_template);
gst_element_class_add_pad_template (element_class, jpegdec_src_template);
gst_element_class_set_details (element_class, &gst_jpegdec_details);
@@ -206,26 +197,23 @@ gst_jpegdec_init (GstJpegDec *jpegdec)
}
static GstPadLinkReturn
-gst_jpegdec_link (GstPad *pad, GstCaps *caps)
+gst_jpegdec_link (GstPad *pad, const GstCaps *caps)
{
GstJpegDec *jpegdec = GST_JPEGDEC (gst_pad_get_parent (pad));
+ GstStructure *structure;
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
- gst_caps_get (caps,
- "framerate", &jpegdec->fps,
- "width", &jpegdec->width,
- "height", &jpegdec->height,
- NULL);
+ gst_structure_get_double (structure, "framerate", &jpegdec->fps);
+ gst_structure_get_int (structure, "width", &jpegdec->width);
+ gst_structure_get_int (structure, "height", &jpegdec->height);
- caps = GST_CAPS_NEW ("jpegdec_srccaps",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (
- GST_MAKE_FOURCC ('I','4','2','0')),
- "width", GST_PROPS_INT (jpegdec->width),
- "height", GST_PROPS_INT (jpegdec->height),
- "framerate", GST_PROPS_FLOAT (jpegdec->fps));
+ caps = gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I','4','2','0'),
+ "width", G_TYPE_INT, jpegdec->width,
+ "height", G_TYPE_INT, jpegdec->height,
+ "framerate", G_TYPE_DOUBLE, jpegdec->fps,
+ NULL);
return gst_pad_try_set_caps (jpegdec->srcpad, caps);
}
@@ -416,16 +404,13 @@ gst_jpegdec_chain (GstPad *pad, GstData *_data)
jpegdec->line[2] = g_realloc(jpegdec->line[2], height*sizeof(char*));
jpegdec->height = height;
- gst_pad_try_set_caps (jpegdec->srcpad,
- GST_CAPS_NEW (
- "jpegdec_caps",
- "video/x-raw-yuv",
- "format", GST_PROPS_FOURCC (
- GST_MAKE_FOURCC ('I','4','2','0')),
- "width", GST_PROPS_INT (width),
- "height", GST_PROPS_INT (height),
- "framerate", GST_PROPS_FLOAT (jpegdec->fps)
- ));
+ gst_pad_try_set_caps (jpegdec->srcpad,
+ gst_caps_new_simple ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I','4','2','0'),
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ "framerate", G_TYPE_DOUBLE, jpegdec->fps,
+ NULL));
}
/* mind the swap, jpeglib outputs blue chroma first */
diff --git a/ext/jpeg/gstjpegdec.h b/ext/jpeg/gstjpegdec.h
index 9607b01b..05187873 100644
--- a/ext/jpeg/gstjpegdec.h
+++ b/ext/jpeg/gstjpegdec.h
@@ -64,7 +64,7 @@ struct _GstJpegDec {
gint format;
gint width;
gint height;
- gfloat fps;
+ gdouble fps;
/* the size of the output buffer */
gint outsize;
/* the jpeg line buffer */
diff --git a/ext/jpeg/gstjpegenc.c b/ext/jpeg/gstjpegenc.c
index 937a308d..1be4f36a 100644
--- a/ext/jpeg/gstjpegenc.c
+++ b/ext/jpeg/gstjpegenc.c
@@ -50,8 +50,8 @@ static void gst_jpegenc_base_init (gpointer g_class);
static void gst_jpegenc_class_init (GstJpegEnc *klass);
static void gst_jpegenc_init (GstJpegEnc *jpegenc);
-static void gst_jpegenc_chain (GstPad *pad,GstData *_data);
-static GstPadLinkReturn gst_jpegenc_link (GstPad *pad, GstCaps *caps);
+static void gst_jpegenc_chain (GstPad *pad, GstData *_data);
+static GstPadLinkReturn gst_jpegenc_link (GstPad *pad, const GstCaps *caps);
static GstData *gst_jpegenc_get (GstPad *pad);
@@ -86,26 +86,17 @@ gst_jpegenc_get_type (void)
static GstCaps*
jpeg_caps_factory (void)
{
- return
- gst_caps_new (
- "jpeg_jpeg",
- "video/x-jpeg",
- gst_props_new (
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- NULL));
+ return gst_caps_new_simple ("video/x-jpeg",
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
}
static GstCaps*
raw_caps_factory (void)
{
- return
- gst_caps_new (
- "jpeg_raw",
- "video/x-raw-yuv",
- GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))));
+ return gst_caps_from_string (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420"));
}
static void
@@ -119,10 +110,10 @@ gst_jpegenc_base_init (gpointer g_class)
jpegenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
- raw_caps, NULL);
+ raw_caps);
jpegenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
- jpeg_caps, NULL);
+ jpeg_caps);
gst_element_class_add_pad_template (element_class, jpegenc_sink_template);
gst_element_class_add_pad_template (element_class, jpegenc_src_template);
@@ -202,24 +193,21 @@ gst_jpegenc_init (GstJpegEnc *jpegenc)
}
static GstPadLinkReturn
-gst_jpegenc_link (GstPad *pad, GstCaps *caps)
+gst_jpegenc_link (GstPad *pad, const GstCaps *caps)
{
GstJpegEnc *jpegenc = GST_JPEGENC (gst_pad_get_parent (pad));
+ GstStructure *structure;
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get (caps,
- "framerate", &jpegenc->fps,
- "width", &jpegenc->width,
- "height", &jpegenc->height,
- NULL);
-
- caps = GST_CAPS_NEW ("jpegdec_srccaps",
- "video/x-jpeg",
- "width", GST_PROPS_INT (jpegenc->width),
- "height", GST_PROPS_INT (jpegenc->height),
- "framerate", GST_PROPS_FLOAT (jpegenc->fps));
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_double (structure, "framerate", &jpegenc->fps);
+ gst_structure_get_int (structure, "width", &jpegenc->width);
+ gst_structure_get_int (structure, "height", &jpegenc->height);
+
+ caps = gst_caps_new_simple ("video/x-jpeg",
+ "width", G_TYPE_INT, jpegenc->width,
+ "height", G_TYPE_INT, jpegenc->height,
+ "framerate", G_TYPE_DOUBLE, jpegenc->fps,
+ NULL);
return gst_pad_try_set_caps (jpegenc->srcpad, caps);
}
diff --git a/ext/jpeg/gstjpegenc.h b/ext/jpeg/gstjpegenc.h
index 9f03e8c4..36ee578a 100644
--- a/ext/jpeg/gstjpegenc.h
+++ b/ext/jpeg/gstjpegenc.h
@@ -58,7 +58,7 @@ struct _GstJpegEnc {
gint format;
gint width;
gint height;
- gfloat fps;
+ gdouble fps;
/* the video buffer */
gint bufsize;
GstBuffer *buffer;
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/libpng/gstpngenc.c b/ext/libpng/gstpngenc.c
index c3373b19..74cb4938 100644
--- a/ext/libpng/gstpngenc.c
+++ b/ext/libpng/gstpngenc.c
@@ -93,23 +93,18 @@ GType gst_pngenc_get_type (void)
static GstCaps*
png_caps_factory (void)
{
- return gst_caps_new ( "png_png",
- "video/x-png",
- gst_props_new (
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
- NULL));
+ return gst_caps_new_simple ("video/x-png",
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096,
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE,
+ NULL);
}
static GstCaps*
raw_caps_factory (void)
{
- return gst_caps_new ( "png_raw",
- "video/x-raw-rgb",
- GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24
- );
+ return gst_caps_from_string (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24);
}
static void
@@ -123,11 +118,11 @@ gst_pngenc_base_init (gpointer g_class)
pngenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS,
- raw_caps, NULL);
+ raw_caps);
pngenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS,
- png_caps, NULL);
+ png_caps);
gst_element_class_add_pad_template (element_class, pngenc_sink_template);
gst_element_class_add_pad_template (element_class, pngenc_src_template);
@@ -148,26 +143,24 @@ gst_pngenc_class_init (GstPngEncClass *klass)
static GstPadLinkReturn
-gst_pngenc_sinklink (GstPad *pad, GstCaps *caps)
+gst_pngenc_sinklink (GstPad *pad, const GstCaps *caps)
{
GstPngEnc *pngenc;
- gfloat fps;
+ gdouble fps;
+ GstStructure *structure;
pngenc = GST_PNGENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "width", &pngenc->width);
+ gst_structure_get_int (structure, "height", &pngenc->height);
+ gst_structure_get_double (structure, "framerate", &fps);
+ gst_structure_get_int (structure, "bpp", &pngenc->bpp);
- gst_caps_get_int (caps, "width", &pngenc->width);
- gst_caps_get_int (caps, "height", &pngenc->height);
- gst_caps_get_float (caps, "framerate", &fps);
- gst_caps_get_int (caps, "bpp", &pngenc->bpp);
-
- caps = GST_CAPS_NEW ("png_src",
- "video/x-png",
- "framerate", GST_PROPS_FLOAT (fps),
- "width", GST_PROPS_INT (pngenc->width),
- "height", GST_PROPS_INT (pngenc->height));
+ caps = gst_caps_new_simple ("video/x-png",
+ "framerate", G_TYPE_DOUBLE, fps,
+ "width", G_TYPE_INT, pngenc->width,
+ "height", G_TYPE_INT, pngenc->height, NULL);
return gst_pad_try_set_caps (pngenc->srcpad, caps);
}
diff --git a/ext/mikmod/gstmikmod.c b/ext/mikmod/gstmikmod.c
index 39760c56..d624f49e 100644
--- a/ext/mikmod/gstmikmod.c
+++ b/ext/mikmod/gstmikmod.c
@@ -58,51 +58,28 @@ enum {
};
-static GstPadTemplate*
-mikmod_src_factory (void)
-{
- static GstPadTemplate *template = NULL;
-
- if (!template) {
- template = gst_pad_template_new (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "mikmod_src",
- "audio/x-raw-int",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
- ), NULL);
- }
- return template;
-}
-
-
-static GstPadTemplate*
-mikmod_sink_factory (void)
-{
- static GstPadTemplate *template = NULL;
-
- if (!template) {
- template = gst_pad_template_new (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "mikmod_sink",
- "audio/x-mod",
- NULL),NULL
- );
- }
- return template;
-}
+static GstStaticPadTemplate mikmod_src_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
+);
+
+static GstStaticPadTemplate mikmod_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-mod")
+);
static void gst_mikmod_base_init (gpointer g_class);
static void gst_mikmod_class_init (GstMikModClass *klass);
static void gst_mikmod_init (GstMikMod *filter);
static void gst_mikmod_set_property (GObject *object, guint id, const GValue *value, GParamSpec *pspec );
static void gst_mikmod_get_property (GObject *object, guint id, GValue *value, GParamSpec *pspec );
-static GstPadLinkReturn gst_mikmod_srclink (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_mikmod_srclink (GstPad *pad, const GstCaps *caps);
static void gst_mikmod_loop (GstElement *element);
static gboolean gst_mikmod_setup (GstMikMod *mikmod);
static GstElementStateReturn gst_mikmod_change_state (GstElement *element);
@@ -137,8 +114,10 @@ gst_mikmod_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, mikmod_src_factory ());
- gst_element_class_add_pad_template (element_class, mikmod_sink_factory ());
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&mikmod_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&mikmod_sink_factory));
gst_element_class_set_details (element_class, &mikmod_details);
}
@@ -205,8 +184,10 @@ gst_mikmod_class_init (GstMikModClass *klass)
static void
gst_mikmod_init (GstMikMod *filter)
{
- filter->sinkpad = gst_pad_new_from_template(mikmod_sink_factory (),"sink");
- filter->srcpad = gst_pad_new_from_template(mikmod_src_factory (),"src");
+ filter->sinkpad = gst_pad_new_from_template(
+ gst_static_pad_template_get (&mikmod_sink_factory),"sink");
+ filter->srcpad = gst_pad_new_from_template(
+ gst_static_pad_template_get (&mikmod_src_factory),"src");
gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
@@ -245,39 +226,35 @@ gst_mikmod_negotiate (GstMikMod *mikmod)
sign = FALSE;
}
- return gst_pad_try_set_caps (mikmod->srcpad,
- GST_CAPS_NEW (
- "mikmod_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (sign),
- "width", GST_PROPS_INT (width),
- "depth", GST_PROPS_INT (width),
- "rate", GST_PROPS_INT (mikmod->mixfreq),
- "channels", GST_PROPS_INT (mikmod->stereo ? 2 : 1)));
+ return gst_pad_try_set_caps (mikmod->srcpad,
+ gst_caps_new_simple ( "audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, sign,
+ "width", G_TYPE_INT, width,
+ "depth", G_TYPE_INT, width,
+ "rate", G_TYPE_INT, mikmod->mixfreq,
+ "channels", G_TYPE_INT, mikmod->stereo ? 2 : 1,
+ NULL));
}
static GstPadLinkReturn
-gst_mikmod_srclink (GstPad *pad, GstCaps *caps)
+gst_mikmod_srclink (GstPad *pad, const GstCaps *caps)
{
GstMikMod *filter;
+ GstStructure *structure;
+ gint depth;
+ gint channels;
filter = GST_MIKMOD (gst_pad_get_parent (pad));
- if (gst_caps_has_property_typed (caps, "depth", GST_PROPS_INT_TYPE)) {
- gint depth;
- gst_caps_get_int (caps, "depth", &depth);
- filter->_16bit = (depth == 16);
- }
- if (gst_caps_has_property_typed (caps, "channels", GST_PROPS_INT_TYPE)) {
- gint channels;
- gst_caps_get_int (caps, "channels", &channels);
- filter->stereo = (channels == 2);
- }
- if (gst_caps_has_property_typed (caps, "rate", GST_PROPS_INT_TYPE)) {
- gst_caps_get_int (caps, "rate", &filter->mixfreq);
- }
+ structure = gst_caps_get_structure (caps, 0);
+
+ gst_structure_get_int (structure, "depth", &depth);
+ filter->_16bit = (depth == 16);
+ gst_structure_get_int (structure, "channels", &channels);
+ filter->stereo = (channels == 2);
+ gst_structure_get_int (structure, "rate", &filter->mixfreq);
return gst_mikmod_negotiate(filter);
}
diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c
index 2605c6a3..4264e813 100644
--- a/ext/pango/gsttextoverlay.c
+++ b/ext/pango/gsttextoverlay.c
@@ -28,46 +28,35 @@ enum {
};
-GST_PAD_TEMPLATE_FACTORY(textoverlay_src_template_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW(
- "textoverlay_src",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST(
- GST_PROPS_FOURCC(GST_STR_FOURCC("I420"))
- ),
- "width", GST_PROPS_INT_RANGE(0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE(0, G_MAXINT)
- )
- )
-
-GST_PAD_TEMPLATE_FACTORY(video_sink_template_factory,
- "video_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW(
- "video_sink",
- "video/x-raw-yuv",
- "format", GST_PROPS_LIST(
- GST_PROPS_FOURCC(GST_STR_FOURCC("I420"))
- ),
- "width", GST_PROPS_INT_RANGE(0, G_MAXINT),
- "height", GST_PROPS_INT_RANGE(0, G_MAXINT)
- )
- )
-
-GST_PAD_TEMPLATE_FACTORY(text_sink_template_factory,
- "text_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW(
- "text_sink",
- "text/x-pango-markup",
- NULL
- )
- )
+static GstStaticPadTemplate textoverlay_src_template_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-raw-yuv, "
+ "format = (fourcc) I420, "
+ "width = (int) [ 1, MAX ], "
+ "height = (int) [ 1, MAX ]")
+);
+
+static GstStaticPadTemplate video_sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "video_sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-raw-yuv, "
+ "format = (fourcc) I420, "
+ "width = (int) [ 1, MAX ], "
+ "height = (int) [ 1, MAX ]")
+);
+
+static GstStaticPadTemplate text_sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "text_sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("text/x-pango-markup; text/plain")
+);
static void gst_textoverlay_base_init (gpointer g_class);
static void gst_textoverlay_class_init(GstTextOverlayClass *klass);
@@ -116,9 +105,12 @@ gst_textoverlay_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 (textoverlay_src_template_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (video_sink_template_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (text_sink_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&textoverlay_src_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&video_sink_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&text_sink_template_factory));
gst_element_class_set_details (element_class, &textoverlay_details);
}
@@ -228,18 +220,17 @@ render_text(GstTextOverlay *overlay)
static GstPadLinkReturn
-gst_textoverlay_video_sinkconnect(GstPad *pad, GstCaps *caps)
+gst_textoverlay_video_sinkconnect(GstPad *pad, const GstCaps *caps)
{
GstTextOverlay *overlay;
+ GstStructure *structure;
overlay = GST_TEXTOVERLAY(gst_pad_get_parent(pad));
- if (!GST_CAPS_IS_FIXED(caps))
- return GST_PAD_LINK_DELAYED;
-
+ structure = gst_caps_get_structure (caps, 0);
overlay->width = overlay->height = 0;
- gst_caps_get_int(caps, "width", &overlay->width);
- gst_caps_get_int(caps, "height", &overlay->height);
+ gst_structure_get_int (structure, "width", &overlay->width);
+ gst_structure_get_int (structure, "height", &overlay->height);
return gst_pad_try_set_caps(overlay->srcpad, caps);
}
@@ -514,20 +505,20 @@ gst_textoverlay_init(GstTextOverlay *overlay)
{
/* video sink */
overlay->video_sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(video_sink_template_factory), "video_sink");
+ gst_static_pad_template_get (&video_sink_template_factory), "video_sink");
/* gst_pad_set_chain_function(overlay->video_sinkpad, gst_textoverlay_video_chain); */
gst_pad_set_link_function(overlay->video_sinkpad, gst_textoverlay_video_sinkconnect);
gst_element_add_pad(GST_ELEMENT(overlay), overlay->video_sinkpad);
/* text sink */
overlay->text_sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(text_sink_template_factory), "text_sink");
+ gst_static_pad_template_get (&text_sink_template_factory), "text_sink");
/* gst_pad_set_link_function(overlay->text_sinkpad, gst_textoverlay_text_sinkconnect); */
gst_element_add_pad(GST_ELEMENT(overlay), overlay->text_sinkpad);
/* (video) source */
overlay->srcpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(textoverlay_src_template_factory), "src");
+ gst_static_pad_template_get (&textoverlay_src_template_factory), "src");
gst_element_add_pad(GST_ELEMENT(overlay), overlay->srcpad);
overlay->layout = pango_layout_new(GST_TEXTOVERLAY_GET_CLASS(overlay)->pango_context);
diff --git a/ext/raw1394/gstdv1394src.c b/ext/raw1394/gstdv1394src.c
index 6f3b8d2e..0bf5c83b 100644
--- a/ext/raw1394/gstdv1394src.c
+++ b/ext/raw1394/gstdv1394src.c
@@ -62,14 +62,14 @@ gst_dv1394src_factory (void)
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
+ GST_STATIC_CAPS (
"dv1394src",
"video/dv",
/*
gst_props_new (
"format", GST_PROPS_LIST (
- GST_PROPS_STRING ("NTSC"),
- GST_PROPS_STRING ("PAL")
+ G_TYPE_STRING ("NTSC"),
+ G_TYPE_STRING ("PAL")
),
NULL)
),
@@ -167,7 +167,6 @@ gst_dv1394src_init (GstDV1394Src *dv1394src)
/* initialized when first header received */
dv1394src->frameSize=0;
- dv1394src->pool = NULL;
dv1394src->buf = NULL;
dv1394src->frame = NULL;
@@ -237,22 +236,20 @@ int gst_dv1394src_iso_receive(raw1394handle_t handle,int channel,size_t len,quad
int dif_block = p[2];
/* if we are at the beginning of a frame,
- we set buf=frame, and get a new buffer from pool for frame
+ we set buf=frame, and alloc a new buffer for frame
*/
if (section_type == 0 && dif_sequence == 0) { // dif header
- if( dv1394src->pool == NULL ) {
+ if( !dv1394src->negotiated) {
// figure format (NTSC/PAL)
if( p[3] & 0x80 ) {
// PAL
dv1394src->frameSize = PAL_FRAMESIZE;
GST_DEBUG ("PAL data");
if (gst_pad_try_set_caps (dv1394src->srcpad,
- GST_CAPS_NEW ( "dv1394src", "video/dv",
- "format", GST_PROPS_STRING("PAL"),
- NULL)
- ) <= 0) {
+ gst_caps_new_simple ("video/dv",
+ "format", G_TYPE_STRING, "PAL", NULL)) <= 0) {
gst_element_error (GST_ELEMENT(dv1394src), "Could not set source caps for PAL");
return 0;
}
@@ -261,19 +258,13 @@ int gst_dv1394src_iso_receive(raw1394handle_t handle,int channel,size_t len,quad
dv1394src->frameSize = NTSC_FRAMESIZE;
GST_DEBUG ("NTSC data [untested] - please report success/failure to <dan@f3c.com>");
if (gst_pad_try_set_caps (dv1394src->srcpad,
- GST_CAPS_NEW ( "dv1394src", "video/dv",
- "format", GST_PROPS_STRING ("NTSC"),
- NULL)
- ) <= 0) {
+ gst_caps_new_simple ("video/dv",
+ "format", G_TYPE_STRING, "NTSC", NULL)) <= 0) {
gst_element_error (GST_ELEMENT(dv1394src), "Could not set source caps for NTSC");
return 0;
}
}
-
- dv1394src->pool = gst_buffer_pool_get_default( dv1394src->frameSize, N_BUFFERS_IN_POOL );
- if (dv1394src->pool == NULL) {
- gst_element_error (GST_ELEMENT(dv1394src), "gst_buffer_pool_get_default returned NULL");
- }
+ dv1394src->negotiated = TRUE;
}
// drop last frame when not complete
@@ -287,9 +278,9 @@ int gst_dv1394src_iso_receive(raw1394handle_t handle,int channel,size_t len,quad
dv1394src->frameSequence++;
if( dv1394src->frameSequence % (dv1394src->skip+dv1394src->consecutive) < dv1394src->consecutive ) {
- if( dv1394src->pool ) dv1394src->frame = gst_buffer_new_from_pool( dv1394src->pool, 0, dv1394src->frameSize );
- dv1394src->bytesInFrame = 0;
+ dv1394src->frame = gst_buffer_new_and_alloc (dv1394src->frameSize);
}
+ dv1394src->bytesInFrame = 0;
}
if (dv1394src->frame != NULL) {
@@ -390,10 +381,6 @@ gst_dv1394src_change_state (GstElement *element)
raw1394_stop_iso_rcv(dv1394src->handle, dv1394src->channel);
break;
case GST_STATE_READY_TO_NULL:
- if (dv1394src->pool != NULL) {
- gst_buffer_pool_unref(dv1394src->pool);
- dv1394src->pool = NULL;
- }
raw1394_destroy_handle(dv1394src->handle);
break;
default:
diff --git a/ext/raw1394/gstdv1394src.h b/ext/raw1394/gstdv1394src.h
index 72d0e192..7d384fd0 100644
--- a/ext/raw1394/gstdv1394src.h
+++ b/ext/raw1394/gstdv1394src.h
@@ -68,7 +68,8 @@ struct _GstDV1394Src {
guint frameSize;
guint bytesInFrame;
guint frameSequence;
- GstBufferPool *pool;
+
+ gboolean negotiated;
};
struct _GstDV1394SrcClass {
diff --git a/ext/speex/gstspeexdec.c b/ext/speex/gstspeexdec.c
index 7fd5dc53..5e249a73 100644
--- a/ext/speex/gstspeexdec.c
+++ b/ext/speex/gstspeexdec.c
@@ -51,7 +51,7 @@ static void gst_speexdec_class_init (GstSpeexDec *klass);
static void gst_speexdec_init (GstSpeexDec *speexdec);
static void gst_speexdec_chain (GstPad *pad, GstData *_data);
-static GstPadLinkReturn gst_speexdec_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_speexdec_sinkconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_speexdec_signals[LAST_SIGNAL] = { 0 }; */
@@ -77,45 +77,41 @@ gst_speexdec_get_type(void) {
return speexdec_type;
}
-GST_CAPS_FACTORY (speex_caps_factory,
- GST_CAPS_NEW (
- "speex_speex",
- "audio/x-speex",
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+static GstStaticPadTemplate speex_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-speex, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
-
-GST_CAPS_FACTORY (raw_caps_factory,
- GST_CAPS_NEW (
- "speex_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 speex_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_speexdec_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstCaps *raw_caps, *speex_caps;
- raw_caps = GST_CAPS_GET (raw_caps_factory);
- speex_caps = GST_CAPS_GET (speex_caps_factory);
-
- speexdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- speex_caps, NULL);
- speexdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
- gst_element_class_add_pad_template (element_class, speexdec_sink_template);
- gst_element_class_add_pad_template (element_class, speexdec_src_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&speex_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&speex_sink_template));
gst_element_class_set_details (element_class, &gst_speexdec_details);
}
@@ -147,29 +143,26 @@ gst_speexdec_init (GstSpeexDec *speexdec)
}
static GstPadLinkReturn
-gst_speexdec_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_speexdec_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstSpeexDec *speexdec;
gint rate;
+ GstStructure *structure;
speexdec = GST_SPEEXDEC (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 (speexdec->srcpad,
- GST_CAPS_NEW (
- "speex_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)
- )))
+ 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)))
{
return GST_PAD_LINK_OK;
}
diff --git a/ext/speex/gstspeexenc.c b/ext/speex/gstspeexenc.c
index c6be4aa7..14cee352 100644
--- a/ext/speex/gstspeexenc.c
+++ b/ext/speex/gstspeexenc.c
@@ -52,7 +52,7 @@ static void gst_speexenc_class_init (GstSpeexEnc *klass);
static void gst_speexenc_init (GstSpeexEnc *speexenc);
static void gst_speexenc_chain (GstPad *pad,GstData *_data);
-static GstPadLinkReturn gst_speexenc_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_speexenc_sinkconnect (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
static guint gst_speexenc_signals[LAST_SIGNAL] = { 0 };
@@ -79,45 +79,41 @@ gst_speexenc_get_type (void)
return speexenc_type;
}
-GST_CAPS_FACTORY (speex_caps_factory,
- GST_CAPS_NEW (
- "speex_speex",
- "audio/x-speex",
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+static GstStaticPadTemplate speex_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"
)
-)
-
-GST_CAPS_FACTORY (raw_caps_factory,
- GST_CAPS_NEW (
- "speex_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 speex_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-speex, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
+);
static void
gst_speexenc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstCaps *raw_caps, *speex_caps;
- raw_caps = GST_CAPS_GET (raw_caps_factory);
- speex_caps = GST_CAPS_GET (speex_caps_factory);
-
- speexenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
- speexenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- speex_caps, NULL);
- gst_element_class_add_pad_template (element_class, speexenc_sink_template);
- gst_element_class_add_pad_template (element_class, speexenc_src_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&speex_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&speex_src_template));
gst_element_class_set_details (element_class, &gst_speexenc_details);
}
@@ -160,22 +156,20 @@ gst_speexenc_init (GstSpeexEnc *speexenc)
}
static GstPadLinkReturn
-gst_speexenc_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_speexenc_sinkconnect (GstPad *pad, const GstCaps *caps)
{
GstSpeexEnc *speexenc;
+ GstStructure *structure;
speexenc = GST_SPEEXENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "rate", &speexenc->rate);
- if (gst_pad_try_set_caps (speexenc->srcpad, GST_CAPS_NEW (
- "speex_speex",
- "audio/x-speex",
- "rate", GST_PROPS_INT (speexenc->rate),
- "channels", GST_PROPS_INT (1)
- )))
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (structure, "rate", &speexenc->rate);
+ if (gst_pad_try_set_caps (speexenc->srcpad,
+ gst_caps_new_simple ("audio/x-speex",
+ "rate", G_TYPE_INT, speexenc->rate,
+ "channels", G_TYPE_INT, 1,
+ NULL)))
{
speex_init_header(&speexenc->header, speexenc->rate, 1, speexenc->mode);
speexenc->header.frames_per_packet = speexenc->n_packets;
@@ -211,12 +205,10 @@ gst_speexenc_chain (GstPad *pad, GstData *_data)
if (!GST_PAD_CAPS (speexenc->srcpad)) {
if (!gst_pad_try_set_caps (speexenc->srcpad,
- GST_CAPS_NEW (
- "speex_enc",
- "audio/x-speex",
- "rate", GST_PROPS_INT (speexenc->rate),
- "channels", GST_PROPS_INT (1)
- )))
+ gst_caps_new_simple ("audio/x-speex",
+ "rate", G_TYPE_INT, speexenc->rate,
+ "channels", G_TYPE_INT, 1,
+ NULL)))
{
gst_element_error (GST_ELEMENT (speexenc), "could not negotiate");
return;