summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2003-12-11 10:49:15 +0000
committerDavid Schleef <ds@schleef.org>2003-12-11 10:49:15 +0000
commit2e1829686d5b0fb3c35d2787e181d3155608a1a5 (patch)
tree9724a298fa8b72dcfef1b5e112eda179e8ebb1a3
parent458a99e2dd99445720e5a7c3e027a609aaa921f9 (diff)
downloadgstreamer-plugins-bad-2e1829686d5b0fb3c35d2787e181d3155608a1a5.tar.gz
Convert to new caps
Original commit message from CVS: Convert to new caps
-rw-r--r--ext/hermes/yuv2rgb.c20
-rw-r--r--ext/hermes/yuv2rgb.h2
-rw-r--r--ext/mas/massink.c26
-rw-r--r--ext/mplex/gstmplex.cc81
-rw-r--r--ext/sdl/sdlvideosink.c63
-rw-r--r--ext/sdl/sdlvideosink.h2
-rw-r--r--ext/snapshot/gstsnapshot.c94
-rw-r--r--ext/swfdec/gstswfdec.c96
8 files changed, 157 insertions, 227 deletions
diff --git a/ext/hermes/yuv2rgb.c b/ext/hermes/yuv2rgb.c
index a1669b256..512eb046b 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 GstCaps2 *from, const GstCaps2 *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_caps2_get_nth_cap (from, 0);
+ struct_to = gst_caps2_get_nth_cap (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 699234a38..8abb41cf0 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 GstCaps2 *from, const GstCaps2 *to);
#define gst_colorspace_convert(converter, src, dest) \
(converter)->convert((converter), (src), (dest))
void gst_colorspace_converter_destroy (GstColorSpaceConverter *space);
diff --git a/ext/mas/massink.c b/ext/mas/massink.c
index 3952dfe5b..67ca47b4e 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 GstCaps2 *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 GstCaps2 *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 fb15e5fea..6ef731708 100644
--- a/ext/mplex/gstmplex.cc
+++ b/ext/mplex/gstmplex.cc
@@ -56,62 +56,53 @@ 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",
- "layer", GST_PROPS_INT_RANGE (1, 3)
+ GST_STATIC_CAPS ("audio/mpeg, "
+ "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_CAPS2_ANY
+);
#define GST_TYPE_MPLEX_MUX_FORMAT (gst_mplex_mux_format_get_type())
static GType
@@ -188,11 +179,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);
}
@@ -246,7 +237,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);
@@ -262,20 +253,20 @@ gst_mplex_init (GstMPlex *mplex)
}
static GstPadLinkReturn
-gst_mplex_video_link (GstPad *pad, GstCaps *caps)
+gst_mplex_video_link (GstPad *pad, const GstCaps2 *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_caps2_get_nth_cap (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 9844914eb..f363d04e7 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 GstCaps2 *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;
+ GstCaps2 *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_caps2_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_caps2_append_cap (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, 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);
@@ -277,7 +274,7 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
sdlvideosink->xwindow_id = 0;
- sdlvideosink->capslist = capslist;
+ //sdlvideosink->capslist = capslist;
sdlvideosink->init = FALSE;
@@ -509,37 +506,25 @@ gst_sdlvideosink_create (GstSDLVideoSink *sdlvideosink)
static GstPadLinkReturn
gst_sdlvideosink_sinkconnect (GstPad *pad,
- GstCaps *vscapslist)
+ const GstCaps2 *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;
+ structure = gst_caps2_get_nth_cap (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);
- for (caps = vscapslist; caps != NULL; caps = vscapslist = vscapslist->next)
- {
- guint32 format;
-
- 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 96b2aecbc..a3725a959 100644
--- a/ext/sdl/sdlvideosink.h
+++ b/ext/sdl/sdlvideosink.h
@@ -55,8 +55,6 @@ struct _GstSDLVideoSink {
gboolean init;
- GstCaps *capslist;
-
SDL_Surface *screen;
SDL_Overlay *overlay;
SDL_Rect rect;
diff --git a/ext/snapshot/gstsnapshot.c b/ext/snapshot/gstsnapshot.c
index c6fa23dcc..8408a1503 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 GstCaps2 *caps)
{
GstSnapshot *filter;
- GstCaps *from_caps, *to_caps;
- gfloat fps;
+ GstCaps2 *from_caps, *to_caps;
+ 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_caps2_get_nth_cap (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_caps2_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_caps2_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/swfdec/gstswfdec.c b/ext/swfdec/gstswfdec.c
index e5eba8578..74a731cda 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 GstCaps2 *gst_swfdec_videosrc_getcaps(GstPad *pad)
{
GstSwfdec *swfdec;
- GstCaps *c;
+ GstCaps2 *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_caps2_copy (gst_pad_template_get_caps (
+ gst_static_pad_template_get (&video_template_factory)));
+
+ if (swfdec->height) {
+ gst_caps2_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));