From ce51f6173ca1c37d90f8e2e316d90316583d7755 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Mon, 22 Dec 2003 01:47:09 +0000 Subject: Merge CAPS branch Original commit message from CVS: Merge CAPS branch --- ext/jpeg/gstjpegdec.c | 71 ++++++++++++++++++++------------------------------- ext/jpeg/gstjpegdec.h | 2 +- ext/jpeg/gstjpegenc.c | 56 ++++++++++++++++------------------------ ext/jpeg/gstjpegenc.h | 2 +- 4 files changed, 52 insertions(+), 79 deletions(-) (limited to 'ext/jpeg') diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c index abade583..9c9af750 100644 --- a/ext/jpeg/gstjpegdec.c +++ b/ext/jpeg/gstjpegdec.c @@ -54,7 +54,7 @@ static void gst_jpegdec_init (GstJpegDec *jpegdec); static void gst_jpegdec_chain (GstPad *pad, GstData *_data); static GstPadLinkReturn - gst_jpegdec_link (GstPad *pad, GstCaps *caps); + gst_jpegdec_link (GstPad *pad, const GstCaps *caps); static GstElementClass *parent_class = NULL; /*static guint gst_jpegdec_signals[LAST_SIGNAL] = { 0 }; */ @@ -83,26 +83,17 @@ gst_jpegdec_get_type(void) { static GstCaps* jpeg_caps_factory (void) { - return - gst_caps_new ( - "jpeg_jpeg", - "image/jpeg", - gst_props_new ( - "width", GST_PROPS_INT_RANGE (16, 4096), - "height", GST_PROPS_INT_RANGE (16, 4096), - "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT), - NULL)); + return gst_caps_new_simple ("image/jpeg", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, + NULL); } static GstCaps* raw_caps_factory (void) { - return - gst_caps_new ( - "jpeg_raw", - "video/x-raw-yuv", - GST_VIDEO_YUV_PAD_TEMPLATE_PROPS ( - GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')))); + return gst_caps_from_string (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420")); } static void @@ -116,10 +107,10 @@ gst_jpegdec_base_init (gpointer g_class) jpegdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - jpeg_caps, NULL); + jpeg_caps); jpegdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - raw_caps, NULL); + raw_caps); gst_element_class_add_pad_template (element_class, jpegdec_sink_template); gst_element_class_add_pad_template (element_class, jpegdec_src_template); gst_element_class_set_details (element_class, &gst_jpegdec_details); @@ -206,26 +197,23 @@ gst_jpegdec_init (GstJpegDec *jpegdec) } static GstPadLinkReturn -gst_jpegdec_link (GstPad *pad, GstCaps *caps) +gst_jpegdec_link (GstPad *pad, const GstCaps *caps) { GstJpegDec *jpegdec = GST_JPEGDEC (gst_pad_get_parent (pad)); + GstStructure *structure; - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; + structure = gst_caps_get_structure (caps, 0); - gst_caps_get (caps, - "framerate", &jpegdec->fps, - "width", &jpegdec->width, - "height", &jpegdec->height, - NULL); + gst_structure_get_double (structure, "framerate", &jpegdec->fps); + gst_structure_get_int (structure, "width", &jpegdec->width); + gst_structure_get_int (structure, "height", &jpegdec->height); - caps = GST_CAPS_NEW ("jpegdec_srccaps", - "video/x-raw-yuv", - "format", GST_PROPS_FOURCC ( - GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT (jpegdec->width), - "height", GST_PROPS_INT (jpegdec->height), - "framerate", GST_PROPS_FLOAT (jpegdec->fps)); + caps = 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); } @@ -416,16 +404,13 @@ 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_CAPS_NEW ( - "jpegdec_caps", - "video/x-raw-yuv", - "format", GST_PROPS_FOURCC ( - GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT (width), - "height", GST_PROPS_INT (height), - "framerate", GST_PROPS_FLOAT (jpegdec->fps) - )); + gst_pad_try_set_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, + "height", G_TYPE_INT, height, + "framerate", G_TYPE_DOUBLE, jpegdec->fps, + NULL)); } /* mind the swap, jpeglib outputs blue chroma first */ diff --git a/ext/jpeg/gstjpegdec.h b/ext/jpeg/gstjpegdec.h index 9607b01b..05187873 100644 --- a/ext/jpeg/gstjpegdec.h +++ b/ext/jpeg/gstjpegdec.h @@ -64,7 +64,7 @@ struct _GstJpegDec { gint format; gint width; gint height; - gfloat fps; + gdouble fps; /* the size of the output buffer */ gint outsize; /* the jpeg line buffer */ diff --git a/ext/jpeg/gstjpegenc.c b/ext/jpeg/gstjpegenc.c index 937a308d..1be4f36a 100644 --- a/ext/jpeg/gstjpegenc.c +++ b/ext/jpeg/gstjpegenc.c @@ -50,8 +50,8 @@ static void gst_jpegenc_base_init (gpointer g_class); static void gst_jpegenc_class_init (GstJpegEnc *klass); static void gst_jpegenc_init (GstJpegEnc *jpegenc); -static void gst_jpegenc_chain (GstPad *pad,GstData *_data); -static GstPadLinkReturn gst_jpegenc_link (GstPad *pad, GstCaps *caps); +static void gst_jpegenc_chain (GstPad *pad, GstData *_data); +static GstPadLinkReturn gst_jpegenc_link (GstPad *pad, const GstCaps *caps); static GstData *gst_jpegenc_get (GstPad *pad); @@ -86,26 +86,17 @@ gst_jpegenc_get_type (void) static GstCaps* jpeg_caps_factory (void) { - return - gst_caps_new ( - "jpeg_jpeg", - "video/x-jpeg", - gst_props_new ( - "width", GST_PROPS_INT_RANGE (16, 4096), - "height", GST_PROPS_INT_RANGE (16, 4096), - "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT), - NULL)); + return gst_caps_new_simple ("video/x-jpeg", + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, + "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, + NULL); } static GstCaps* raw_caps_factory (void) { - return - gst_caps_new ( - "jpeg_raw", - "video/x-raw-yuv", - GST_VIDEO_YUV_PAD_TEMPLATE_PROPS ( - GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')))); + return gst_caps_from_string (GST_VIDEO_YUV_PAD_TEMPLATE_CAPS ("I420")); } static void @@ -119,10 +110,10 @@ gst_jpegenc_base_init (gpointer g_class) jpegenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - raw_caps, NULL); + raw_caps); jpegenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - jpeg_caps, NULL); + jpeg_caps); gst_element_class_add_pad_template (element_class, jpegenc_sink_template); gst_element_class_add_pad_template (element_class, jpegenc_src_template); @@ -202,24 +193,21 @@ gst_jpegenc_init (GstJpegEnc *jpegenc) } static GstPadLinkReturn -gst_jpegenc_link (GstPad *pad, GstCaps *caps) +gst_jpegenc_link (GstPad *pad, const GstCaps *caps) { GstJpegEnc *jpegenc = GST_JPEGENC (gst_pad_get_parent (pad)); + GstStructure *structure; - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; - - gst_caps_get (caps, - "framerate", &jpegenc->fps, - "width", &jpegenc->width, - "height", &jpegenc->height, - NULL); - - caps = GST_CAPS_NEW ("jpegdec_srccaps", - "video/x-jpeg", - "width", GST_PROPS_INT (jpegenc->width), - "height", GST_PROPS_INT (jpegenc->height), - "framerate", GST_PROPS_FLOAT (jpegenc->fps)); + structure = gst_caps_get_structure (caps, 0); + gst_structure_get_double (structure, "framerate", &jpegenc->fps); + gst_structure_get_int (structure, "width", &jpegenc->width); + gst_structure_get_int (structure, "height", &jpegenc->height); + + caps = gst_caps_new_simple ("video/x-jpeg", + "width", G_TYPE_INT, jpegenc->width, + "height", G_TYPE_INT, jpegenc->height, + "framerate", G_TYPE_DOUBLE, jpegenc->fps, + NULL); return gst_pad_try_set_caps (jpegenc->srcpad, caps); } diff --git a/ext/jpeg/gstjpegenc.h b/ext/jpeg/gstjpegenc.h index 9f03e8c4..36ee578a 100644 --- a/ext/jpeg/gstjpegenc.h +++ b/ext/jpeg/gstjpegenc.h @@ -58,7 +58,7 @@ struct _GstJpegEnc { gint format; gint width; gint height; - gfloat fps; + gdouble fps; /* the video buffer */ gint bufsize; GstBuffer *buffer; -- cgit