summaryrefslogtreecommitdiff
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2010-07-28 19:39:12 (GMT)
committer Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2010-07-30 09:32:00 (GMT)
commit093fcacc20a9a84a12e59f027a0f0921ff02d304 (patch) (side-by-side diff)
treebf1b88750371300b47ae1713a88f909a63d41280
parent5626857ac4884c1c0c50910851ce8437a36e89d8 (diff)
downloadgst-plugins-bad-093fcacc20a9a84a12e59f027a0f0921ff02d304.zip
gst-plugins-bad-093fcacc20a9a84a12e59f027a0f0921ff02d304.tar.gz
vdpau: remove GstVdpOutputSrcPad "template-caps" property
instead we do as GstVdpVideoSrcPad and use the "templ" property of GstPad, which enable us to change the signature of gst_vdp_output_src_pad_new to match gst_pad_new_from_template
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--sys/vdpau/gstvdp/gstvdpoutputsrcpad.c63
-rw-r--r--sys/vdpau/gstvdp/gstvdpoutputsrcpad.h2
-rw-r--r--sys/vdpau/gstvdp/gstvdpvideosrcpad.c2
-rw-r--r--sys/vdpau/gstvdpvideopostprocess.c4
4 files changed, 21 insertions, 50 deletions
diff --git a/sys/vdpau/gstvdp/gstvdpoutputsrcpad.c b/sys/vdpau/gstvdp/gstvdpoutputsrcpad.c
index e54f799..f2b3842 100644
--- a/sys/vdpau/gstvdp/gstvdpoutputsrcpad.c
+++ b/sys/vdpau/gstvdp/gstvdpoutputsrcpad.c
@@ -29,8 +29,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vdp_output_src_pad_debug);
enum
{
PROP_0,
- PROP_DEVICE,
- PROP_TEMPL_CAPS
+ PROP_DEVICE
};
typedef enum _GstVdpOutputSrcPadFormat GstVdpOutputSrcPadFormat;
@@ -54,7 +53,6 @@ struct _GstVdpOutputSrcPad
/* properties */
GstVdpDevice *device;
- GstCaps *templ_caps;
};
struct _GstVdpOutputSrcPadClass
@@ -318,10 +316,15 @@ gst_vdp_output_src_pad_getcaps (GstPad * pad)
{
GstVdpOutputSrcPad *vdp_pad = (GstVdpOutputSrcPad *) pad;
+ const GstCaps *templ_caps;
+
if (vdp_pad->caps)
return gst_caps_ref (vdp_pad->caps);
- return gst_caps_ref (vdp_pad->templ_caps);
+ else if ((templ_caps = gst_pad_get_pad_template_caps (pad)))
+ return gst_caps_copy (templ_caps);
+
+ return NULL;
}
static gboolean
@@ -343,29 +346,28 @@ gst_vdp_output_src_pad_activate_push (GstPad * pad, gboolean active)
}
GstVdpOutputSrcPad *
-gst_vdp_output_src_pad_new (GstCaps * templ_caps)
+gst_vdp_output_src_pad_new (GstPadTemplate * templ, const gchar * name)
{
- return g_object_new (GST_TYPE_VDP_OUTPUT_SRC_PAD, "template-caps", templ_caps,
- "direction", GST_PAD_SRC, NULL);
+ return g_object_new (GST_TYPE_VDP_OUTPUT_SRC_PAD, "name", name,
+ "template", templ, "direction", GST_PAD_SRC, NULL);
}
static void
gst_vdp_output_src_pad_update_caps (GstVdpOutputSrcPad * vdp_pad)
{
- GstCaps *allowed_caps;
-
- allowed_caps = gst_vdp_output_buffer_get_allowed_caps (vdp_pad->device);
+ GstCaps *caps;
+ const GstCaps *templ_caps;
if (vdp_pad->caps)
gst_caps_unref (vdp_pad->caps);
- if (vdp_pad->templ_caps) {
- vdp_pad->caps = gst_caps_intersect (allowed_caps, vdp_pad->templ_caps);
- gst_caps_unref (allowed_caps);
- } else
- vdp_pad->caps = allowed_caps;
+ caps = gst_vdp_output_buffer_get_allowed_caps (vdp_pad->device);
- GST_DEBUG_OBJECT (vdp_pad, "allowed caps: %" GST_PTR_FORMAT, vdp_pad->caps);
+ if ((templ_caps = gst_pad_get_pad_template_caps (GST_PAD (vdp_pad)))) {
+ vdp_pad->caps = gst_caps_intersect (caps, templ_caps);
+ gst_caps_unref (caps);
+ } else
+ vdp_pad->caps = caps;
}
static void
@@ -379,10 +381,6 @@ gst_vdp_output_src_pad_get_property (GObject * object, guint prop_id,
g_value_set_object (value, vdp_pad->device);
break;
- case PROP_TEMPL_CAPS:
- gst_value_set_caps (value, vdp_pad->templ_caps);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -403,12 +401,6 @@ gst_vdp_output_src_pad_set_property (GObject * object, guint prop_id,
gst_vdp_output_src_pad_update_caps (vdp_pad);
break;
- case PROP_TEMPL_CAPS:
- if (vdp_pad->templ_caps)
- gst_caps_unref (vdp_pad->templ_caps);
- vdp_pad->templ_caps = gst_caps_copy (gst_value_get_caps (value));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -416,17 +408,6 @@ gst_vdp_output_src_pad_set_property (GObject * object, guint prop_id,
}
static void
-gst_vdp_output_src_pad_finalize (GObject * object)
-{
- GstVdpOutputSrcPad *vdp_pad = (GstVdpOutputSrcPad *) object;
-
- if (vdp_pad->templ_caps)
- gst_caps_unref (vdp_pad->templ_caps);
-
- G_OBJECT_CLASS (gst_vdp_output_src_pad_parent_class)->finalize (object);
-}
-
-static void
gst_vdp_output_src_pad_init (GstVdpOutputSrcPad * vdp_pad)
{
GstPad *pad = GST_PAD (vdp_pad);
@@ -434,7 +415,6 @@ gst_vdp_output_src_pad_init (GstVdpOutputSrcPad * vdp_pad)
vdp_pad->caps = NULL;
vdp_pad->device = NULL;
- vdp_pad->templ_caps = NULL;
gst_pad_set_getcaps_function (pad,
GST_DEBUG_FUNCPTR (gst_vdp_output_src_pad_getcaps));
@@ -449,7 +429,6 @@ gst_vdp_output_src_pad_class_init (GstVdpOutputSrcPadClass * klass)
object_class->get_property = gst_vdp_output_src_pad_get_property;
object_class->set_property = gst_vdp_output_src_pad_set_property;
- object_class->finalize = gst_vdp_output_src_pad_finalize;
/**
* GstVdpVideoSrcPad:device:
@@ -463,10 +442,4 @@ gst_vdp_output_src_pad_class_init (GstVdpOutputSrcPadClass * klass)
"Device",
"The GstVdpDevice the pad should use",
GST_TYPE_VDP_DEVICE, G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_TEMPL_CAPS,
- g_param_spec_boxed ("template-caps", "Template caps",
- "Template caps", GST_TYPE_CAPS,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
}
diff --git a/sys/vdpau/gstvdp/gstvdpoutputsrcpad.h b/sys/vdpau/gstvdp/gstvdpoutputsrcpad.h
index c88ed15..be3f3ec 100644
--- a/sys/vdpau/gstvdp/gstvdpoutputsrcpad.h
+++ b/sys/vdpau/gstvdp/gstvdpoutputsrcpad.h
@@ -45,7 +45,7 @@ GstFlowReturn gst_vdp_output_src_pad_get_device (GstVdpOutputSrcPad *vdp_pad, Gs
gboolean gst_vdp_output_src_pad_negotiate_output (GstVdpOutputSrcPad *vdp_pad, GstCaps *video_caps);
-GstVdpOutputSrcPad *gst_vdp_output_src_pad_new (GstCaps * templ_caps);
+GstVdpOutputSrcPad *gst_vdp_output_src_pad_new (GstPadTemplate *templ, const gchar *name);
GType gst_vdp_output_src_pad_get_type (void);
G_END_DECLS
diff --git a/sys/vdpau/gstvdp/gstvdpvideosrcpad.c b/sys/vdpau/gstvdp/gstvdpvideosrcpad.c
index d2cc9bed..db2f7d9 100644
--- a/sys/vdpau/gstvdp/gstvdpvideosrcpad.c
+++ b/sys/vdpau/gstvdp/gstvdpvideosrcpad.c
@@ -238,7 +238,7 @@ gst_vdp_video_src_pad_getcaps (GstPad * pad)
const GstCaps *templ_caps;
if (vdp_pad->caps)
- return gst_caps_copy (vdp_pad->caps);
+ return gst_caps_ref (vdp_pad->caps);
else if ((templ_caps = gst_pad_get_pad_template_caps (pad)))
return gst_caps_copy (templ_caps);
diff --git a/sys/vdpau/gstvdpvideopostprocess.c b/sys/vdpau/gstvdpvideopostprocess.c
index 9f2c221..0b739b3 100644
--- a/sys/vdpau/gstvdpvideopostprocess.c
+++ b/sys/vdpau/gstvdpvideopostprocess.c
@@ -1273,9 +1273,7 @@ gst_vdp_vpp_init (GstVdpVideoPostProcess * vpp,
src_template =
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (gclass), "src");
- vpp->srcpad =
- GST_PAD (gst_vdp_output_src_pad_new (gst_pad_template_get_caps
- (src_template)));
+ vpp->srcpad = GST_PAD (gst_vdp_output_src_pad_new (src_template, "src"));
gst_element_add_pad (GST_ELEMENT (vpp), vpp->srcpad);
gst_pad_set_event_function (vpp->srcpad,