diff options
author | David Schleef <ds@schleef.org> | 2003-09-14 11:25:48 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2003-09-14 11:25:48 +0000 |
commit | 6511cd71bb429f41deae76d4c828130ea51470fb (patch) | |
tree | f4cb49a731b27e310eb28af0b677f8088d63e017 | |
parent | a5755233e874dc095a24cd9d2900336d9f693ffe (diff) | |
download | gstreamer-plugins-base-6511cd71bb429f41deae76d4c828130ea51470fb.tar.gz |
Add passthru. Remove height/width parameters. Fix caps negotiation to automatically work with ranges in the output.
Original commit message from CVS:
Add passthru. Remove height/width parameters. Fix caps negotiation
to automatically work with ranges in the output.
-rw-r--r-- | gst/videoscale/gstvideoscale.c | 79 | ||||
-rw-r--r-- | gst/videoscale/gstvideoscale.h | 5 |
2 files changed, 37 insertions, 47 deletions
diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 68e1ade3b..f23b7b662 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -46,8 +46,6 @@ enum { enum { ARG_0, - ARG_WIDTH, - ARG_HEIGHT, ARG_METHOD, /* FILL ME */ }; @@ -112,12 +110,6 @@ gst_videoscale_class_init (GstVideoscaleClass *klass) gobject_class = (GObjectClass*)klass; gstelement_class = (GstElementClass*)klass; - g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_WIDTH, - g_param_spec_int("width","width","width", - G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */ - g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HEIGHT, - g_param_spec_int("height","height","height", - G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */ g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_METHOD, g_param_spec_enum("method","method","method", GST_TYPE_VIDEOSCALE_METHOD,0,G_PARAM_READWRITE)); /* CHECKME! */ @@ -290,6 +282,8 @@ gst_videoscale_src_link (GstPad *pad, GstCaps *caps) gst_caps_set(peercaps, "width", GST_PROPS_INT_RANGE (0, G_MAXINT)); gst_caps_set(peercaps, "height", GST_PROPS_INT_RANGE (0, G_MAXINT)); + g_print("setting caps to %s\n", gst_caps_to_string(peercaps)); + ret = gst_pad_try_set_caps (videoscale->srcpad, peercaps); gst_caps_unref(peercaps); @@ -311,44 +305,58 @@ gst_videoscale_sink_link (GstPad *pad, GstCaps *caps) GstVideoscale *videoscale; GstPadLinkReturn ret; GstCaps *peercaps; + GstCaps *srccaps; + GstCaps *caps1; - GST_DEBUG ("gst_videoscale_src_link"); + GST_DEBUG ("gst_videoscale_sink_link"); videoscale = GST_VIDEOSCALE (gst_pad_get_parent (pad)); if (!GST_CAPS_IS_FIXED (caps)) { return GST_PAD_LINK_DELAYED; } - videoscale->format = videoscale_find_by_caps (caps); - gst_caps_debug(caps,"ack"); g_return_val_if_fail(videoscale->format, GST_PAD_LINK_REFUSED); - gst_caps_get_int (caps, "width", &videoscale->from_width); - gst_caps_get_int (caps, "height", &videoscale->from_height); + ret = gst_pad_try_set_caps (videoscale->srcpad, gst_caps_copy(caps)); + if (ret == GST_PAD_LINK_OK || ret == GST_PAD_LINK_DONE) { + videoscale->passthru = TRUE; + return ret; + } - peercaps = gst_caps_copy(caps); + videoscale->passthru = FALSE; - if(videoscale->force_size){ - gst_caps_set(peercaps, "width", GST_PROPS_INT (videoscale->forced_width)); - gst_caps_set(peercaps, "height", GST_PROPS_INT (videoscale->forced_height)); - }else{ - gst_caps_set(peercaps, "width", GST_PROPS_INT_RANGE (0, G_MAXINT)); - gst_caps_set(peercaps, "height", GST_PROPS_INT_RANGE (0, G_MAXINT)); - } + srccaps = gst_caps_copy(caps); + gst_caps_set(srccaps, "width", GST_PROPS_INT_RANGE (0, G_MAXINT)); + gst_caps_set(srccaps, "height", GST_PROPS_INT_RANGE (0, G_MAXINT)); - ret = gst_pad_try_set_caps (videoscale->srcpad, peercaps); + peercaps = gst_pad_get_allowed_caps(videoscale->srcpad); - gst_caps_unref(peercaps); + caps1 = gst_caps_intersect(peercaps, srccaps); - if(ret==GST_PAD_LINK_OK){ - caps = gst_pad_get_caps (videoscale->srcpad); + if (!GST_CAPS_IS_FIXED (caps1)) { + /* FIXME */ + return GST_PAD_LINK_DELAYED; + } - gst_caps_get_int (caps, "width", &videoscale->to_width); - gst_caps_get_int (caps, "height", &videoscale->to_height); - gst_videoscale_setup(videoscale); + g_print("setting caps to %s\n", gst_caps_to_string(caps1)); + + ret = gst_pad_try_set_caps (videoscale->srcpad, caps1); + if (ret != GST_PAD_LINK_OK && ret != GST_PAD_LINK_DONE) { + return ret; } + gst_caps_get_int (caps1, "width", &videoscale->to_width); + gst_caps_get_int (caps1, "height", &videoscale->to_height); + + gst_caps_get_int (caps, "width", &videoscale->from_width); + gst_caps_get_int (caps, "height", &videoscale->from_height); + gst_caps_get_float (caps, "framerate", &videoscale->framerate); + + caps = gst_pad_get_caps (videoscale->srcpad); + + gst_videoscale_setup(videoscale); + return ret; } @@ -372,7 +380,6 @@ gst_videoscale_init (GstVideoscale *videoscale) gst_pad_set_getcaps_function(videoscale->srcpad,gst_videoscale_getcaps); videoscale->inited = FALSE; - videoscale->force_size = FALSE; videoscale->method = GST_VIDEOSCALE_NEAREST; /*videoscale->method = GST_VIDEOSCALE_BILINEAR; */ @@ -448,14 +455,6 @@ gst_videoscale_set_property (GObject *object, guint prop_id, const GValue *value GST_DEBUG ("gst_videoscale_set_property"); switch (prop_id) { - case ARG_WIDTH: - src->forced_width = g_value_get_int (value); - src->force_size = TRUE; - break; - case ARG_HEIGHT: - src->forced_height = g_value_get_int (value); - src->force_size = TRUE; - break; case ARG_METHOD: src->method = g_value_get_enum (value); break; @@ -474,12 +473,6 @@ gst_videoscale_get_property (GObject *object, guint prop_id, GValue *value, GPar src = GST_VIDEOSCALE(object); switch (prop_id) { - case ARG_WIDTH: - g_value_set_int (value, src->forced_width); - break; - case ARG_HEIGHT: - g_value_set_int (value, src->forced_height); - break; case ARG_METHOD: g_value_set_enum (value, src->method); break; diff --git a/gst/videoscale/gstvideoscale.h b/gst/videoscale/gstvideoscale.h index 56308fab0..1bfd5acb8 100644 --- a/gst/videoscale/gstvideoscale.h +++ b/gst/videoscale/gstvideoscale.h @@ -57,10 +57,6 @@ struct _GstVideoscale { GstPad *sinkpad,*srcpad; - gboolean force_size; - gint forced_width; - gint forced_height; - /* video state */ gboolean inited; struct videoscale_format_struct *format; @@ -69,6 +65,7 @@ struct _GstVideoscale { gint from_width; gint from_height; gboolean passthru; + float framerate; GstVideoScaleMethod method; |