summaryrefslogtreecommitdiff
path: root/gst/pnm/gstpnmdec.c
diff options
context:
space:
mode:
authorLutz Mueller <lutz@topfrose.de>2009-09-16 08:22:19 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-09-16 08:23:37 +0200
commitf270259cc8b08c0123b76f7e235ae9a24dbafb81 (patch)
tree5c43e894279da1e55f86c81fc91d1bf548cdd2d7 /gst/pnm/gstpnmdec.c
parent50d08ce73286348e33fbd8cf0a5cd054848be56c (diff)
downloadgstreamer-plugins-bad-f270259cc8b08c0123b76f7e235ae9a24dbafb81.tar.gz
pnm: Support ASCII format for encoding and handle unsupported formats better in the decoder
Fixes bug #595215.
Diffstat (limited to 'gst/pnm/gstpnmdec.c')
-rw-r--r--gst/pnm/gstpnmdec.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/gst/pnm/gstpnmdec.c b/gst/pnm/gstpnmdec.c
index 4b6b15f04..bd28eaea7 100644
--- a/gst/pnm/gstpnmdec.c
+++ b/gst/pnm/gstpnmdec.c
@@ -68,8 +68,7 @@ gst_pnmdec_push (GstPnmdec * s, GstPad * src, GstBuffer * buf)
GstBuffer *obuf;
guint i;
- if (s->mngr.info.type == GST_PNM_TYPE_PIXMAP_RAW ||
- s->mngr.info.type == GST_PNM_TYPE_PIXMAP_ASCII) {
+ if (s->mngr.info.type == GST_PNM_TYPE_PIXMAP) {
i_rowstride = 3 * s->mngr.info.width;
o_rowstride = GST_ROUND_UP_4 (i_rowstride);
} else {
@@ -115,17 +114,25 @@ gst_pnmdec_chain (GstPad * pad, GstBuffer * data)
goto out;
case GST_PNM_INFO_MNGR_RESULT_FINISHED:
offset = s->mngr.data_offset;
+ if (s->mngr.info.encoding == GST_PNM_ENCODING_ASCII) {
+ GST_DEBUG_OBJECT (s, "FIXME: ASCII encoding not implemented!");
+ gst_buffer_unref (data);
+ r = GST_FLOW_ERROR;
+ goto out;
+ }
caps = gst_caps_copy (gst_pad_get_pad_template_caps (src));
switch (s->mngr.info.type) {
- case GST_PNM_TYPE_BITMAP_RAW:
- case GST_PNM_TYPE_BITMAP_ASCII:
- case GST_PNM_TYPE_GRAYMAP_RAW:
- case GST_PNM_TYPE_GRAYMAP_ASCII:
+ case GST_PNM_TYPE_BITMAP:
+ GST_DEBUG_OBJECT (s, "FIXME: BITMAP format not implemented!");
+ gst_caps_unref (caps);
+ gst_buffer_unref (data);
+ r = GST_FLOW_ERROR;
+ goto out;
+ case GST_PNM_TYPE_GRAYMAP:
gst_caps_remove_structure (caps, 0);
s->size = s->mngr.info.width * s->mngr.info.height * 1;
break;
- case GST_PNM_TYPE_PIXMAP_RAW:
- case GST_PNM_TYPE_PIXMAP_ASCII:
+ case GST_PNM_TYPE_PIXMAP:
gst_caps_remove_structure (caps, 1);
s->size = s->mngr.info.width * s->mngr.info.height * 3;
break;
@@ -136,6 +143,7 @@ gst_pnmdec_chain (GstPad * pad, GstBuffer * data)
GST_TYPE_FRACTION, 0, 1, NULL);
if (!gst_pad_set_caps (src, caps)) {
gst_caps_unref (caps);
+ gst_buffer_unref (data);
r = GST_FLOW_ERROR;
goto out;
}
@@ -144,6 +152,7 @@ gst_pnmdec_chain (GstPad * pad, GstBuffer * data)
}
if (offset == GST_BUFFER_SIZE (data)) {
+ gst_buffer_unref (data);
r = GST_FLOW_OK;
goto out;
}