summaryrefslogtreecommitdiffstats
path: root/gst/goom/gstgoom.c
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2004-01-22 03:25:17 +0000
committerDavid Schleef <ds@schleef.org>2004-01-22 03:25:17 +0000
commitff90353f7dee0c2f6946ffac78e0bd115569a035 (patch)
tree9197125d9033e34c6ee7c071741893d4c6ad619e /gst/goom/gstgoom.c
parentf2504850cd7d9912e6c5869795670b99fdd064f4 (diff)
ext/swfdec/gstswfdec.*: Fix negotiation.
Original commit message from CVS: * ext/swfdec/gstswfdec.c: (gst_swfdec_video_getcaps), (gst_swfdec_video_link), (copy_image), (gst_swfdec_loop), (gst_swfdec_init), (gst_swfdec_change_state): * ext/swfdec/gstswfdec.h: Fix negotiation. * gst/adder/gstadder.c: (gst_adder_link), (gst_adder_init), (gst_adder_request_new_pad): Fix negotiation. * gst/goom/gstgoom.c: (gst_goom_init), (gst_goom_src_fixate): Add a fixate function. * gst/intfloat/gstfloat2int.c: * gst/intfloat/gstfloat2int.h: * gst/intfloat/gstint2float.c: * gst/intfloat/gstint2float.h: Completely rewrite the negotiation. Doesn't quite work yet, due to some buffer-frames problem.
Diffstat (limited to 'gst/goom/gstgoom.c')
-rw-r--r--gst/goom/gstgoom.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gst/goom/gstgoom.c b/gst/goom/gstgoom.c
index 5aa043fe..db40a13d 100644
--- a/gst/goom/gstgoom.c
+++ b/gst/goom/gstgoom.c
@@ -114,6 +114,7 @@ static void gst_goom_chain (GstPad *pad, GstData *_data);
static GstPadLinkReturn gst_goom_sinkconnect (GstPad *pad, const GstCaps *caps);
static GstPadLinkReturn gst_goom_srcconnect (GstPad *pad, const GstCaps *caps);
+static GstCaps * gst_goom_src_fixate (GstPad *pad, const GstCaps *caps);
static GstElementClass *parent_class = NULL;
@@ -184,6 +185,7 @@ gst_goom_init (GstGOOM *goom)
gst_pad_set_link_function (goom->sinkpad, gst_goom_sinkconnect);
gst_pad_set_link_function (goom->srcpad, gst_goom_srcconnect);
+ gst_pad_set_fixate_function (goom->srcpad, gst_goom_src_fixate);
goom->width = 320;
goom->height = 200;
@@ -236,6 +238,33 @@ gst_goom_srcconnect (GstPad *pad, const GstCaps *caps)
return GST_PAD_LINK_OK;
}
+static GstCaps *
+gst_goom_src_fixate (GstPad *pad, const GstCaps *caps)
+{
+ GstCaps *newcaps;
+ GstStructure *structure;
+
+ if (!gst_caps_is_simple (caps)) return NULL;
+
+ newcaps = gst_caps_copy (caps);
+ structure = gst_caps_get_structure (newcaps, 0);
+
+ if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 320)) {
+ return newcaps;
+ }
+ if (gst_caps_structure_fixate_field_nearest_int (structure, "height", 240)) {
+ return newcaps;
+ }
+ if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
+ 30.0)) {
+ return newcaps;
+ }
+
+ /* failed to fixate */
+ gst_caps_free (newcaps);
+ return NULL;
+}
+
static void
gst_goom_chain (GstPad *pad, GstData *_data)
{