diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/audiofile/gstafparse.c | 3 | ||||
-rw-r--r-- | ext/audiofile/gstafsrc.c | 4 | ||||
-rw-r--r-- | ext/mpeg2enc/gstmpeg2enc.cc | 19 | ||||
-rw-r--r-- | ext/swfdec/gstswfdec.c | 38 |
4 files changed, 18 insertions, 46 deletions
diff --git a/ext/audiofile/gstafparse.c b/ext/audiofile/gstafparse.c index f61d64f4..179dd849 100644 --- a/ext/audiofile/gstafparse.c +++ b/ext/audiofile/gstafparse.c @@ -150,6 +150,7 @@ gst_afparse_init (GstAFParse *afparse) { afparse->srcpad = gst_pad_new_from_template ( gst_element_get_pad_template (GST_ELEMENT (afparse), "src"), "src"); + gst_pad_use_explicit_caps (afparse->srcpad); gst_element_add_pad (GST_ELEMENT (afparse), afparse->srcpad); afparse->sinkpad = gst_pad_new_from_template ( @@ -381,7 +382,7 @@ gst_afparse_open_file (GstAFParse *afparse) /* set caps on src */ /*FIXME: add all the possible formats, especially float ! */ - gst_pad_try_set_caps (afparse->srcpad, + gst_pad_set_explicit_caps (afparse->srcpad, gst_caps_new_simple ( "audio/x-raw-int", "endianness", G_TYPE_INT, G_BYTE_ORDER, diff --git a/ext/audiofile/gstafsrc.c b/ext/audiofile/gstafsrc.c index 0520463d..7d477ab2 100644 --- a/ext/audiofile/gstafsrc.c +++ b/ext/audiofile/gstafsrc.c @@ -179,6 +179,7 @@ gst_afsrc_init (GstAFSrc *afsrc) afsrc->srcpad = gst_pad_new_from_template ( gst_element_get_pad_template (GST_ELEMENT (afsrc), "src"), "src"); gst_element_add_pad (GST_ELEMENT (afsrc), afsrc->srcpad); + gst_pad_use_explicit_caps (afsrc->srcpad); gst_pad_set_get_function (afsrc->srcpad, gst_afsrc_get); afsrc->bytes_per_read = 4096; @@ -339,8 +340,7 @@ gst_afsrc_open_file (GstAFSrc *src) } /* set caps on src */ - /*FIXME: add all the possible formats, especially float ! */ - gst_pad_try_set_caps (src->srcpad, + gst_pad_set_explicit_caps (src->srcpad, gst_caps_new_simple ("audio/x-raw-int", "endianness", G_TYPE_INT, G_BYTE_ORDER, "signed", G_TYPE_BOOLEAN, src->is_signed, diff --git a/ext/mpeg2enc/gstmpeg2enc.cc b/ext/mpeg2enc/gstmpeg2enc.cc index bee6a9b0..a435829e 100644 --- a/ext/mpeg2enc/gstmpeg2enc.cc +++ b/ext/mpeg2enc/gstmpeg2enc.cc @@ -106,8 +106,6 @@ static void gst_mpeg2enc_loop (GstElement *element); static GstPadLinkReturn gst_mpeg2enc_sink_link (GstPad *pad, const GstCaps *caps); -static GstCaps * - gst_mpeg2enc_src_getcaps (GstPad *pad); static GstElementStateReturn gst_mpeg2enc_change_state (GstElement *element); @@ -214,7 +212,7 @@ gst_mpeg2enc_init (GstMpeg2enc *enc) enc->srcpad = gst_pad_new_from_template ( gst_element_class_get_pad_template (klass, "src"), "src"); - gst_pad_set_getcaps_function (enc->srcpad, gst_mpeg2enc_src_getcaps); + gst_pad_use_explicit_caps (enc->srcpad); gst_element_add_pad (element, enc->srcpad); enc->options = new GstMpeg2EncOptions (); @@ -249,7 +247,7 @@ gst_mpeg2enc_loop (GstElement *element) /* and set caps on other side */ caps = enc->encoder->getFormat (); - if (gst_pad_try_set_caps (enc->srcpad, caps) <= 0) { + if (gst_pad_set_explicit_caps (enc->srcpad, caps) <= 0) { gst_element_error (element, "Failed to set up encoder properly"); delete enc->encoder; @@ -278,19 +276,6 @@ gst_mpeg2enc_sink_link (GstPad *pad, return GST_PAD_LINK_OK; } -static GstCaps * -gst_mpeg2enc_src_getcaps (GstPad *pad) -{ - GstMpeg2enc *enc = GST_MPEG2ENC (gst_pad_get_parent (pad)); - - if (enc->encoder) { - return enc->encoder->getFormat (); - } - - return gst_caps_copy (gst_pad_template_get_caps ( - gst_element_get_pad_template (gst_pad_get_parent (pad), "src"))); -} - static void gst_mpeg2enc_get_property (GObject *object, guint prop_id, 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( |