 +      strncpy((char*)GST_BUFFER_DATA (buffer)+48, kt->category, 15);
 +      GST_BUFFER_DATA (buffer)[63] = 0;
 +    }
++    if (kt->original_canvas_width >= 0) {
++      guint16 v = encode_canvas_size(kt->original_canvas_width);
++      GST_BUFFER_DATA (buffer)[16] = v&0xff;
++      GST_BUFFER_DATA (buffer)[17] = (v>>8)&0xff;
++    }
++    if (kt->original_canvas_height >= 0) {
++      guint16 v = encode_canvas_size(kt->original_canvas_height);
++      GST_BUFFER_DATA (buffer)[18] = v&0xff;
++      GST_BUFFER_DATA (buffer)[19] = (v>>8)&0xff;
++    }
 +  }
 +
 +  /*  rewrite the comments packet */

+gst_kate_dec_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstKateDec *kd = GST_KATE_DEC (object);
+
+  switch (prop_id) {
+    case ARG_REMOVE_MARKUP:
+      kd->remove_markup = g_value_get_boolean (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;

+    case ARG_CATEGORY:
+      g_value_set_string (value, kt->category ? kt->category : "");
+      break;
+    case ARG_ORIGINAL_CANVAS_WIDTH:
+      g_value_set_int (value, kt->original_canvas_width);
+      break;
+    case ARG_ORIGINAL_CANVAS_HEIGHT:
+      g_value_set_int (value, kt->original_canvas_height);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static guint16 encode_canvas_size(size_t size)
+{
+  size_t base=size;
+  size_t shift=0;
+  int value;
+
+  while (base&~((1<<12)-1)) {
+    /* we have a high bit we can't fit, increase shift if we wouldn't lose low bits */
+    if ((size>>shift)&1) return 0;
+    ++shift;
+    base>>=1;
+  }
+  if (shift>=16) return 0;
+
+  /* the size can be represented in our encoding */
+  value=(base<<4)|shift;
+
+  return (guint16)value;
+}
+
+static GstFlowReturn
+gst_kate_tag_parse_packet (GstKateParse * parse, GstBuffer * buffer)
