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.
This commit is contained in:
Wim Taymans 2004-07-27 10:33:59 +00:00
parent f6aad78c55
commit d0ab18f823
2 changed files with 49 additions and 0 deletions

View file

@ -1,3 +1,20 @@
2004-07-27 Wim Taymans <wim@fluendo.com>
* 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.
2004-07-27 Julien MOUTTE <julien@moutte.net>
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),

View file

@ -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)