From ab8b69675431e3623eac1ecaee91ad80a0786048 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 2 Jan 2004 07:09:23 +0000 Subject: Convert elements to use gst_pad_use_explicit_caps() where appropriate. Original commit message from CVS: Convert elements to use gst_pad_use_explicit_caps() where appropriate. --- ext/swfdec/gstswfdec.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'ext/swfdec') diff --git a/ext/swfdec/gstswfdec.c b/ext/swfdec/gstswfdec.c index 6e42c4fa..a7837ede 100644 --- a/ext/swfdec/gstswfdec.c +++ b/ext/swfdec/gstswfdec.c @@ -158,27 +158,6 @@ gst_swfdec_class_init(GstSwfdecClass *klass) gstelement_class->change_state = gst_swfdec_change_state; } -static GstCaps *gst_swfdec_videosrc_getcaps(GstPad *pad) -{ - GstSwfdec *swfdec; - GstCaps *caps; - - swfdec = GST_SWFDEC (gst_pad_get_parent (pad)); - - caps = gst_caps_copy (gst_pad_template_get_caps ( - gst_static_pad_template_get (&video_template_factory))); - - if (swfdec->height) { - gst_caps_set_simple (caps, - "framerate", G_TYPE_DOUBLE, swfdec->frame_rate, - "height",G_TYPE_INT,swfdec->height, - "width",G_TYPE_INT,swfdec->width, - NULL); - } - - return caps; -} - static void gst_swfdec_loop(GstElement *element) { @@ -217,14 +196,22 @@ gst_swfdec_loop(GstElement *element) } if(ret==SWF_CHANGE){ + GstCaps *caps; + swfdec_decoder_get_image_size(swfdec->state, &swfdec->width, &swfdec->height); swfdec_decoder_get_rate(swfdec->state, &swfdec->rate); swfdec->interval = GST_SECOND / swfdec->rate; - GST_DEBUG_CAPS ("caps", gst_swfdec_videosrc_getcaps(swfdec->videopad)); - gst_pad_try_set_caps(swfdec->videopad, - gst_swfdec_videosrc_getcaps(swfdec->videopad)); + caps = gst_caps_copy (gst_pad_get_pad_template_caps ( + swfdec->videopad)); + gst_caps_set_simple (caps, + "framerate", G_TYPE_DOUBLE, (double)swfdec->frame_rate, + "height",G_TYPE_INT,swfdec->height, + "width",G_TYPE_INT,swfdec->width, + NULL); + gst_pad_set_explicit_caps(swfdec->videopad, caps); + return; } @@ -280,8 +267,7 @@ gst_swfdec_init (GstSwfdec *swfdec) "video_00"); gst_pad_set_query_function (swfdec->videopad, GST_DEBUG_FUNCPTR (gst_swfdec_src_query)); - gst_pad_set_getcaps_function (swfdec->videopad, - GST_DEBUG_FUNCPTR (gst_swfdec_videosrc_getcaps)); + gst_pad_use_explicit_caps (swfdec->videopad); gst_element_add_pad(GST_ELEMENT(swfdec), swfdec->videopad); swfdec->audiopad = gst_pad_new_from_template( -- cgit v1.2.1