summaryrefslogtreecommitdiff
path: root/gst/fsvideoanyrate
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2012-01-27 16:50:08 +0100
committerOlivier CrĂȘte <olivier.crete@collabora.com>2012-07-31 16:08:54 +0200
commited911efc60de1538c4e24ca01f376e25c09a4124 (patch)
tree45412690737447ab5ec60c2d713fd264274ced55 /gst/fsvideoanyrate
parentfb74f736e23844bbf289011f9bff7ad91581af18 (diff)
downloadfarstream-ed911efc60de1538c4e24ca01f376e25c09a4124.tar.gz
Port to GStreamer 0.11
Diffstat (limited to 'gst/fsvideoanyrate')
-rw-r--r--gst/fsvideoanyrate/videoanyrate.c69
1 files changed, 32 insertions, 37 deletions
diff --git a/gst/fsvideoanyrate/videoanyrate.c b/gst/fsvideoanyrate/videoanyrate.c
index a6b773cc..7781332f 100644
--- a/gst/fsvideoanyrate/videoanyrate.c
+++ b/gst/fsvideoanyrate/videoanyrate.c
@@ -1,7 +1,7 @@
/*
* Farstream Voice+Video library
*
- * Copyright 2007 Collabora Ltd,
+ * Copyright 2007-2012 Collabora Ltd,
* Copyright 2007 Nokia Corporation
* @author: Olivier Crete <olivier.crete@collabora.co.uk>
*
@@ -41,15 +41,6 @@
GST_DEBUG_CATEGORY (videoanyrate_debug);
#define GST_CAT_DEFAULT (videoanyrate_debug)
-/* elementfactory information */
-static const GstElementDetails gst_videoanyrate_details =
-GST_ELEMENT_DETAILS (
- "Videoanyrate element",
- "Filter",
- "This element removes the framerate from caps",
- "Olivier Crete <olivier.crete@collabora.co.uk>");
-
-
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
@@ -76,41 +67,39 @@ enum
static GstCaps *
gst_videoanyrate_transform_caps (GstBaseTransform *trans,
GstPadDirection direction,
- GstCaps *caps);
+ GstCaps *caps,
+ GstCaps *filter);
static void
gst_videoanyrate_fixate_caps (GstBaseTransform * base,
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
-static void
-_do_init (GType type)
-{
- GST_DEBUG_CATEGORY_INIT
- (videoanyrate_debug, "fsvideoanyrate", 0, "fsvideoanyrate");
-}
+G_DEFINE_TYPE (GstVideoanyrate, gst_videoanyrate, GST_TYPE_BASE_TRANSFORM);
-GST_BOILERPLATE_FULL (GstVideoanyrate, gst_videoanyrate, GstBaseTransform,
- GST_TYPE_BASE_TRANSFORM, _do_init);
static void
-gst_videoanyrate_base_init (gpointer klass)
+gst_videoanyrate_class_init (GstVideoanyrateClass *klass)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+ GstElementClass *element_class;
+ GstBaseTransformClass *gstbasetransform_class;
+
+ element_class = GST_ELEMENT_CLASS (klass);
+ gstbasetransform_class = GST_BASE_TRANSFORM_CLASS (klass);
+
+
+ GST_DEBUG_CATEGORY_INIT
+ (videoanyrate_debug, "fsvideoanyrate", 0, "fsvideoanyrate");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sinktemplate));
- gst_element_class_set_details (element_class, &gst_videoanyrate_details);
-}
-
-static void
-gst_videoanyrate_class_init (GstVideoanyrateClass *klass)
-{
- GstBaseTransformClass *gstbasetransform_class;
-
- gstbasetransform_class = (GstBaseTransformClass *) klass;
+ gst_element_class_set_metadata (element_class,
+ "Videoanyrate element",
+ "Filter",
+ "This element removes the framerate from caps",
+ "Olivier Crete <olivier.crete@collabora.com>");
gstbasetransform_class->transform_caps =
GST_DEBUG_FUNCPTR(gst_videoanyrate_transform_caps);
@@ -119,28 +108,34 @@ gst_videoanyrate_class_init (GstVideoanyrateClass *klass)
}
static void
-gst_videoanyrate_init (GstVideoanyrate *videoanyrate,
- GstVideoanyrateClass *klass)
+gst_videoanyrate_init (GstVideoanyrate *videoanyrate)
{
}
static GstCaps *
gst_videoanyrate_transform_caps (GstBaseTransform *trans,
GstPadDirection direction,
- GstCaps *caps)
+ GstCaps *caps,
+ GstCaps *filter)
{
GstCaps *mycaps = gst_caps_copy (caps);
- GstStructure *s;
+ guint i;
if (gst_caps_get_size (mycaps) == 0)
return mycaps;
GST_DEBUG_OBJECT (trans, "Transforming caps");
- s = gst_caps_get_structure (mycaps, 0);
+ for (i = 0; i < gst_caps_get_size (mycaps); i++)
+ {
+ GstStructure *s;
- gst_structure_set (s,
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
+ s = gst_caps_get_structure (mycaps, i);
+
+ if (gst_structure_has_field (s, "framerate"))
+ gst_structure_set (s,
+ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
+ }
return mycaps;
}