From 6c1b114eed9ec1bf3ffea9a63294e927e29cc2b8 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/jpeg/gstjpegdec.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ext/jpeg') diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c index 9c9af750..1598f008 100644 --- a/ext/jpeg/gstjpegdec.c +++ b/ext/jpeg/gstjpegdec.c @@ -167,6 +167,7 @@ gst_jpegdec_init (GstJpegDec *jpegdec) gst_pad_set_chain_function(jpegdec->sinkpad,gst_jpegdec_chain); gst_pad_set_link_function(jpegdec->sinkpad, gst_jpegdec_link); jpegdec->srcpad = gst_pad_new_from_template (jpegdec_src_template, "src"); + gst_pad_use_explicit_caps (jpegdec->srcpad); gst_element_add_pad(GST_ELEMENT(jpegdec),jpegdec->srcpad); /* initialize the jpegdec decoder state */ @@ -201,6 +202,7 @@ gst_jpegdec_link (GstPad *pad, const GstCaps *caps) { GstJpegDec *jpegdec = GST_JPEGDEC (gst_pad_get_parent (pad)); GstStructure *structure; + GstCaps *srccaps; structure = gst_caps_get_structure (caps, 0); @@ -208,14 +210,18 @@ gst_jpegdec_link (GstPad *pad, const GstCaps *caps) gst_structure_get_int (structure, "width", &jpegdec->width); gst_structure_get_int (structure, "height", &jpegdec->height); - caps = gst_caps_new_simple ("video/x-raw-yuv", + srccaps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I','4','2','0'), "width", G_TYPE_INT, jpegdec->width, "height", G_TYPE_INT, jpegdec->height, "framerate", G_TYPE_DOUBLE, jpegdec->fps, NULL); - return gst_pad_try_set_caps (jpegdec->srcpad, caps); + /* at this point, we're pretty sure that this will be the output + * format, so we'll set it. */ + gst_pad_set_explicit_caps (jpegdec->srcpad, srccaps); + + return GST_PAD_LINK_OK; } /* shamelessly ripped from jpegutils.c in mjpegtools */ @@ -404,7 +410,7 @@ gst_jpegdec_chain (GstPad *pad, GstData *_data) jpegdec->line[2] = g_realloc(jpegdec->line[2], height*sizeof(char*)); jpegdec->height = height; - gst_pad_try_set_caps (jpegdec->srcpad, + gst_pad_set_explicit_caps (jpegdec->srcpad, gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I','4','2','0'), "width", G_TYPE_INT, width, -- cgit