diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2004-07-27 10:33:59 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2004-07-27 10:33:59 +0000 |
commit | d0ab18f823217969b0058f7f88f4f44ab03e57f4 (patch) | |
tree | fcaa4da2ee06d68e76d0ed3214f6fb491fdffc9c /gst/videomixer | |
parent | f6aad78c559d0630826087d6318abd954c196bae (diff) |
gst/videomixer/videomixer.c: Be a nicer negotiation citizen and provide a getcaps function on the srcpad. This also f...
Original commit message from CVS:
* gst/videomixer/videomixer.c: (gst_videomixer_pad_get_type),
(gst_videomixer_pad_class_init), (gst_videomixer_pad_get_property),
(gst_videomixer_pad_set_property),
(gst_videomixer_pad_sinkconnect), (gst_videomixer_pad_init),
(gst_video_mixer_background_get_type), (gst_videomixer_get_type),
(gst_videomixer_class_init), (gst_videomixer_init),
(gst_videomixer_getcaps), (gst_videomixer_request_new_pad),
(gst_videomixer_blend_ayuv_i420), (pad_zorder_compare),
(gst_videomixer_sort_pads), (gst_videomixer_fill_checker),
(gst_videomixer_fill_color), (gst_videomixer_fill_queues),
(gst_videomixer_blend_buffers), (gst_videomixer_update_queues),
(gst_videomixer_loop), (plugin_init):
Be a nicer negotiation citizen and provide a getcaps function on
the srcpad. This also fixes a crash when resizing.
Diffstat (limited to 'gst/videomixer')
-rw-r--r-- | gst/videomixer/videomixer.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gst/videomixer/videomixer.c b/gst/videomixer/videomixer.c index adcb6bcc..685cd25e 100644 --- a/gst/videomixer/videomixer.c +++ b/gst/videomixer/videomixer.c @@ -400,6 +400,8 @@ static void gst_videomixer_base_init (gpointer g_class); static void gst_videomixer_class_init (GstVideoMixerClass * klass); static void gst_videomixer_init (GstVideoMixer * videomixer); +static GstCaps *gst_videomixer_getcaps (GstPad * pad); + static void gst_videomixer_loop (GstElement * element); static gboolean gst_videomixer_handle_src_event (GstPad * pad, GstEvent * event); @@ -485,6 +487,7 @@ gst_videomixer_init (GstVideoMixer * mix) mix->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, "src"), "src"); + gst_pad_set_getcaps_function (GST_PAD (mix->srcpad), gst_videomixer_getcaps); gst_pad_set_event_function (mix->srcpad, gst_videomixer_handle_src_event); gst_element_add_pad (GST_ELEMENT (mix), mix->srcpad); @@ -500,6 +503,35 @@ gst_videomixer_init (GstVideoMixer * mix) gst_element_set_loop_function (GST_ELEMENT (mix), gst_videomixer_loop); } +static GstCaps * +gst_videomixer_getcaps (GstPad * pad) +{ + GstVideoMixer *mix; + GstCaps *caps; + GstPadTemplate *src_pad_template; + GstStructure *structure; + + + mix = GST_VIDEO_MIXER (gst_pad_get_parent (pad)); + src_pad_template = gst_static_pad_template_get (&src_factory); + caps = gst_caps_copy (gst_pad_template_get_caps (src_pad_template)); + + structure = gst_caps_get_structure (caps, 0); + + if (mix->out_width != 0) { + gst_structure_set (structure, "width", G_TYPE_INT, mix->out_width, NULL); + } + if (mix->out_height != 0) { + gst_structure_set (structure, "height", G_TYPE_INT, mix->out_height, NULL); + } + if (mix->in_framerate != 0) { + gst_structure_set (structure, + "framerate", G_TYPE_DOUBLE, mix->in_framerate, NULL); + } + + return caps; +} + static GstPad * gst_videomixer_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * req_name) |