summaryrefslogtreecommitdiffstats
path: root/ext/jpeg
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-07-06 20:49:52 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-07-06 20:49:52 +0000
commit292fec2a0bd1f221a46ad69c5100995d04c01057 (patch)
tree658db299e0e03b2454ff840730569d79539e67c4 /ext/jpeg
parenta8183e9a3fa87cf4247c7df16207f440ea4069c0 (diff)
New mimetypes gone into effect today - this commit changes all old mimetypes over to the new mimetypes spec as descri...
Original commit message from CVS: New mimetypes gone into effect today - this commit changes all old mimetypes over to the new mimetypes spec as described in the previous commit's document. Note: some plugins will break, some pipelines will break, expect HEAD to be broken or at least not 100% working for a few days, but don't forget to report bugs
Diffstat (limited to 'ext/jpeg')
-rw-r--r--ext/jpeg/gstjpeg.c20
-rw-r--r--ext/jpeg/gstjpegdec.c38
-rw-r--r--ext/jpeg/gstjpegdec.h1
-rw-r--r--ext/jpeg/gstjpegenc.c26
-rw-r--r--ext/jpeg/gstjpegenc.h1
5 files changed, 72 insertions, 14 deletions
diff --git a/ext/jpeg/gstjpeg.c b/ext/jpeg/gstjpeg.c
index 96c3b584..48cfaaf5 100644
--- a/ext/jpeg/gstjpeg.c
+++ b/ext/jpeg/gstjpeg.c
@@ -20,6 +20,7 @@
#include "gstjpegdec.h"
#include "gstjpegenc.h"
+#include <gst/video/video.h>
/* elementfactory information */
extern GstElementDetails gst_jpegdec_details;
@@ -34,8 +35,12 @@ jpeg_caps_factory (void)
return
gst_caps_new (
"jpeg_jpeg",
- "video/jpeg",
- NULL);
+ "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));
}
static GstCaps*
@@ -44,14 +49,9 @@ raw_caps_factory (void)
return
gst_caps_new (
"jpeg_raw",
- "video/raw",
- gst_props_new (
- "format", GST_PROPS_LIST (
- GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))
- ),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- NULL));
+ "video/x-raw-yuv",
+ GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
+ GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))));
}
static gboolean
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c
index 0e499043..a8ee30cd 100644
--- a/ext/jpeg/gstjpegdec.c
+++ b/ext/jpeg/gstjpegdec.c
@@ -54,6 +54,8 @@ static void gst_jpegdec_class_init (GstJpegDec *klass);
static void gst_jpegdec_init (GstJpegDec *jpegdec);
static void gst_jpegdec_chain (GstPad *pad, GstBuffer *buf);
+static GstPadLinkReturn
+ gst_jpegdec_link (GstPad *pad, GstCaps *caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_jpegdec_signals[LAST_SIGNAL] = { 0 }; */
@@ -127,6 +129,7 @@ gst_jpegdec_init (GstJpegDec *jpegdec)
jpegdec->sinkpad = gst_pad_new_from_template (jpegdec_sink_template, "sink");
gst_element_add_pad(GST_ELEMENT(jpegdec),jpegdec->sinkpad);
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_element_add_pad(GST_ELEMENT(jpegdec),jpegdec->srcpad);
@@ -157,6 +160,31 @@ gst_jpegdec_init (GstJpegDec *jpegdec)
}
+static GstPadLinkReturn
+gst_jpegdec_link (GstPad *pad, GstCaps *caps)
+{
+ GstJpegDec *jpegdec = GST_JPEGDEC (gst_pad_get_parent (pad));
+
+ if (!GST_CAPS_IS_FIXED (caps))
+ return GST_PAD_LINK_DELAYED;
+
+ gst_caps_get (caps,
+ "framerate", &jpegdec->fps,
+ "width", &jpegdec->width,
+ "height", &jpegdec->height,
+ NULL);
+
+ 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));
+
+ return gst_pad_try_set_caps (jpegdec->srcpad, caps);
+}
+
/* shamelessly ripped from jpegutils.c in mjpegtools */
static void add_huff_table (j_decompress_ptr dinfo,
JHUFF_TBL **htblptr,
@@ -345,10 +373,12 @@ gst_jpegdec_chain (GstPad *pad, GstBuffer *buf)
gst_pad_try_set_caps (jpegdec->srcpad,
GST_CAPS_NEW (
"jpegdec_caps",
- "video/raw",
- "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
- "width", GST_PROPS_INT (width),
- "height", GST_PROPS_INT (height)
+ "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)
));
}
diff --git a/ext/jpeg/gstjpegdec.h b/ext/jpeg/gstjpegdec.h
index c497f8e5..9607b01b 100644
--- a/ext/jpeg/gstjpegdec.h
+++ b/ext/jpeg/gstjpegdec.h
@@ -64,6 +64,7 @@ struct _GstJpegDec {
gint format;
gint width;
gint height;
+ gfloat 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 b2a8fc1d..ccd5bbce 100644
--- a/ext/jpeg/gstjpegenc.c
+++ b/ext/jpeg/gstjpegenc.c
@@ -52,6 +52,8 @@ static void gst_jpegenc_class_init (GstJpegEnc *klass);
static void gst_jpegenc_init (GstJpegEnc *jpegenc);
static void gst_jpegenc_chain (GstPad *pad,GstBuffer *buf);
+static GstPadLinkReturn gst_jpegenc_link (GstPad *pad, GstCaps *caps);
+
static GstBuffer *gst_jpegenc_get (GstPad *pad);
static void gst_jpegenc_resync (GstJpegEnc *jpegenc);
@@ -123,6 +125,7 @@ gst_jpegenc_init (GstJpegEnc *jpegenc)
jpegenc->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
gst_element_add_pad(GST_ELEMENT(jpegenc),jpegenc->sinkpad);
gst_pad_set_chain_function(jpegenc->sinkpad,gst_jpegenc_chain);
+ gst_pad_set_link_function(jpegenc->sinkpad, gst_jpegenc_link);
gst_pad_set_get_function(jpegenc->sinkpad,gst_jpegenc_get);
jpegenc->srcpad = gst_pad_new("src",GST_PAD_SRC);
gst_element_add_pad(GST_ELEMENT(jpegenc),jpegenc->srcpad);
@@ -151,6 +154,29 @@ gst_jpegenc_init (GstJpegEnc *jpegenc)
}
+static GstPadLinkReturn
+gst_jpegenc_link (GstPad *pad, GstCaps *caps)
+{
+ GstJpegEnc *jpegenc = GST_JPEGENC (gst_pad_get_parent (pad));
+
+ 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));
+
+ return gst_pad_try_set_caps (jpegenc->srcpad, caps);
+}
+
static void
gst_jpegenc_resync (GstJpegEnc *jpegenc)
{
diff --git a/ext/jpeg/gstjpegenc.h b/ext/jpeg/gstjpegenc.h
index a31b3145..9f03e8c4 100644
--- a/ext/jpeg/gstjpegenc.h
+++ b/ext/jpeg/gstjpegenc.h
@@ -58,6 +58,7 @@ struct _GstJpegEnc {
gint format;
gint width;
gint height;
+ gfloat fps;
/* the video buffer */
gint bufsize;
GstBuffer *buffer;