summaryrefslogtreecommitdiffstats
path: root/ext/jpeg/gstjpegenc.c
diff options
context:
space:
mode:
authorMichael Smith <msmith@xiph.org>2005-11-22 23:58:14 +0000
committerMichael Smith <msmith@xiph.org>2005-11-22 23:58:14 +0000
commit8667e55c831968fa0a12619511ea17b2f94f40e7 (patch)
treeb32648f0425adce4b0280155e766971e1672d53d /ext/jpeg/gstjpegenc.c
parenta72e695a1e3721fb9b7fcbe7c6bcb036cf4c2567 (diff)
ext/jpeg/: JPEG fractiony goodness.
Original commit message from CVS: * ext/jpeg/gstjpegdec.c: (gst_jpeg_dec_setcaps), (gst_jpeg_dec_chain), (gst_jpeg_dec_change_state): * ext/jpeg/gstjpegdec.h: * ext/jpeg/gstjpegenc.c: (gst_jpegenc_setcaps): * ext/jpeg/gstjpegenc.h: * ext/jpeg/gstsmokeenc.c: (gst_smokeenc_setcaps), (gst_smokeenc_resync): * ext/jpeg/gstsmokeenc.h: JPEG fractiony goodness.
Diffstat (limited to 'ext/jpeg/gstjpegenc.c')
-rw-r--r--ext/jpeg/gstjpegenc.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/ext/jpeg/gstjpegenc.c b/ext/jpeg/gstjpegenc.c
index 9605349b..0aee1eb4 100644
--- a/ext/jpeg/gstjpegenc.c
+++ b/ext/jpeg/gstjpegenc.c
@@ -131,7 +131,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("image/jpeg, "
"width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]")
+ "height = (int) [ 16, 4096 ], " "framerate = (fraction) [ 0/1, MAX ]")
);
static void
@@ -295,19 +295,28 @@ gst_jpegenc_setcaps (GstPad * pad, GstCaps * caps)
GstCaps *othercaps;
GstPad *otherpad;
gboolean ret;
+ const GValue *framerate;
otherpad = (pad == jpegenc->srcpad) ? jpegenc->sinkpad : jpegenc->srcpad;
structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_double (structure, "framerate", &jpegenc->fps);
+ framerate = gst_structure_get_value (structure, "framerate");
gst_structure_get_int (structure, "width", &jpegenc->width);
gst_structure_get_int (structure, "height", &jpegenc->height);
othercaps = gst_caps_copy (gst_pad_get_pad_template_caps (otherpad));
- gst_caps_set_simple (othercaps,
- "width", G_TYPE_INT, jpegenc->width,
- "height", G_TYPE_INT, jpegenc->height,
- "framerate", G_TYPE_DOUBLE, jpegenc->fps, NULL);
+ if (framerate) {
+ gst_caps_set_simple (othercaps,
+ "width", G_TYPE_INT, jpegenc->width,
+ "height", G_TYPE_INT, jpegenc->height,
+ "framerate", GST_TYPE_FRACTION,
+ gst_value_get_fraction_numerator (framerate),
+ gst_value_get_fraction_denominator (framerate), NULL);
+ } else {
+ gst_caps_set_simple (othercaps,
+ "width", G_TYPE_INT, jpegenc->width,
+ "height", G_TYPE_INT, jpegenc->height, NULL);
+ }
ret = gst_pad_set_caps (jpegenc->srcpad, othercaps);
gst_caps_unref (othercaps);