summaryrefslogtreecommitdiffstats
path: root/ext/jpeg/gstsmokeenc.c
diff options
context:
space:
mode:
authorZaheer Abbas Merali <zaheerabbas@merali.org>2006-07-29 11:22:47 +0000
committerZaheer Abbas Merali <zaheerabbas@merali.org>2006-07-29 11:22:47 +0000
commit082ddb0fc9deb578505205dff25ab4ab393d3cbf (patch)
treeb8901094a8ed450f943f824bd5bacab0c8e32a28 /ext/jpeg/gstsmokeenc.c
parent4441dc23ee2a222b947dd001d31728064ca91ad3 (diff)
ext/jpeg/gstsmokeenc.c: Set caps on buffer correctly. Fixes bug #349155.
Original commit message from CVS: 2006-07-29 Zaheer Abbas Merali <zaheerabbas at merali dot org> * ext/jpeg/gstsmokeenc.c: (gst_smokeenc_getcaps), (gst_smokeenc_setcaps), (gst_smokeenc_chain): Set caps on buffer correctly. Fixes bug #349155.
Diffstat (limited to 'ext/jpeg/gstsmokeenc.c')
-rw-r--r--ext/jpeg/gstsmokeenc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/jpeg/gstsmokeenc.c b/ext/jpeg/gstsmokeenc.c
index 186911ea..42c0b021 100644
--- a/ext/jpeg/gstsmokeenc.c
+++ b/ext/jpeg/gstsmokeenc.c
@@ -210,7 +210,7 @@ gst_smokeenc_getcaps (GstPad * pad)
otherpad = (pad == smokeenc->srcpad) ? smokeenc->sinkpad : smokeenc->srcpad;
caps = gst_pad_get_allowed_caps (otherpad);
if (pad == smokeenc->srcpad) {
- name = "image/x-smoke";
+ name = "video/x-smoke";
} else {
name = "video/x-raw-yuv";
}
@@ -242,7 +242,6 @@ gst_smokeenc_setcaps (GstPad * pad, GstCaps * caps)
const GValue *framerate;
otherpad = (pad == smokeenc->srcpad) ? smokeenc->sinkpad : smokeenc->srcpad;
-
structure = gst_caps_get_structure (caps, 0);
framerate = gst_structure_get_value (structure, "framerate");
if (framerate) {
@@ -257,13 +256,15 @@ gst_smokeenc_setcaps (GstPad * pad, GstCaps * caps)
gst_structure_get_int (structure, "height", &smokeenc->height);
othercaps = gst_caps_copy (gst_pad_get_pad_template_caps (otherpad));
+
gst_caps_set_simple (othercaps,
"width", G_TYPE_INT, smokeenc->width,
"height", G_TYPE_INT, smokeenc->height,
"framerate", GST_TYPE_FRACTION, smokeenc->fps_num, smokeenc->fps_denom,
NULL);
+ GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, othercaps);
- ret = gst_pad_set_caps (smokeenc->srcpad, othercaps);
+ ret = gst_pad_set_caps (otherpad, othercaps);
gst_caps_unref (othercaps);
if (GST_PAD_LINK_SUCCESSFUL (ret)) {
@@ -299,6 +300,7 @@ gst_smokeenc_chain (GstPad * pad, GstBuffer * buf)
GstBuffer *outbuf;
SmokeCodecFlags flags;
GstFlowReturn ret;
+ GstCaps *caps;
smokeenc = GST_SMOKEENC (GST_OBJECT_PARENT (pad));
@@ -316,7 +318,8 @@ gst_smokeenc_chain (GstPad * pad, GstBuffer * buf)
GST_BUFFER_MALLOCDATA (outbuf) = outdata;
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
-
+ caps = GST_PAD_CAPS (smokeenc->srcpad);
+ gst_buffer_set_caps (outbuf, caps);
smokecodec_encode_id (smokeenc->info, outdata, &encsize);
GST_BUFFER_SIZE (outbuf) = encsize;
@@ -334,6 +337,8 @@ gst_smokeenc_chain (GstPad * pad, GstBuffer * buf)
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
GST_BUFFER_DURATION (outbuf) =
smokeenc->fps_denom * GST_SECOND / smokeenc->fps_num;
+ caps = GST_PAD_CAPS (smokeenc->srcpad);
+ gst_buffer_set_caps (outbuf, caps);
flags = 0;
if ((smokeenc->frame % smokeenc->keyframe) == 0) {