documentation: fixed a heap o' typos
[platform/upstream/gstreamer.git] / gst / bayer / gstbayer2rgb.c
index e159ca2..e13a5cc 100644 (file)
@@ -23,6 +23,7 @@
 
 /**
  * SECTION:element-bayer2rgb
+ * @title: bayer2rgb
  *
  * Decodes raw camera bayer (fourcc BA81) to RGB.
  */
@@ -63,7 +64,7 @@
  * "nearest neighbor" principal, with some additional complexity for the
  * calculation of the "green" element, where an "adaptive" pairing is used.
  *
- * For purposes of documentation and indentification, each element of the
+ * For purposes of documentation and identification, each element of the
  * original array can be put into one of four classes:
  *   R   A red element
  *   B   A blue element
 #include <gst/video/video.h>
 #include <string.h>
 #include <stdlib.h>
-#include <_stdint.h>
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
 #include "gstbayerorc.h"
 
 #define GST_CAT_DEFAULT gst_bayer2rgb_debug
@@ -282,42 +287,35 @@ static GstCaps *
 gst_bayer2rgb_transform_caps (GstBaseTransform * base,
     GstPadDirection direction, GstCaps * caps, GstCaps * filter)
 {
+  GstBayer2RGB *bayer2rgb;
+  GstCaps *res_caps, *tmp_caps;
   GstStructure *structure;
-  GstCaps *newcaps;
-  GstStructure *newstruct;
+  guint i, caps_size;
 
-  GST_DEBUG_OBJECT (base, "transforming caps from %" GST_PTR_FORMAT, caps);
+  bayer2rgb = GST_BAYER2RGB (base);
 
-  structure = gst_caps_get_structure (caps, 0);
-
-  if (direction == GST_PAD_SRC) {
-    newcaps = gst_caps_from_string ("video/x-bayer,"
-        "format=(string){bggr,grbg,gbrg,rggb}");
-  } else {
-    newcaps = gst_caps_new_empty_simple ("video/x-raw");
+  res_caps = gst_caps_copy (caps);
+  caps_size = gst_caps_get_size (res_caps);
+  for (i = 0; i < caps_size; i++) {
+    structure = gst_caps_get_structure (res_caps, i);
+    if (direction == GST_PAD_SINK) {
+      gst_structure_set_name (structure, "video/x-raw");
+      gst_structure_remove_field (structure, "format");
+    } else {
+      gst_structure_set_name (structure, "video/x-bayer");
+      gst_structure_remove_fields (structure, "format", "colorimetry",
+          "chroma-site", NULL);
+    }
   }
-  newstruct = gst_caps_get_structure (newcaps, 0);
-
-  gst_structure_set_value (newstruct, "width",
-      gst_structure_get_value (structure, "width"));
-  gst_structure_set_value (newstruct, "height",
-      gst_structure_get_value (structure, "height"));
-  gst_structure_set_value (newstruct, "framerate",
-      gst_structure_get_value (structure, "framerate"));
-
-  if (filter != NULL) {
-    GstCaps *icaps;
-
-    GST_DEBUG_OBJECT (base, "                filter %" GST_PTR_FORMAT, filter);
-
-    icaps = gst_caps_intersect_full (filter, newcaps, GST_CAPS_INTERSECT_FIRST);
-    gst_caps_unref (newcaps);
-    newcaps = icaps;
+  if (filter) {
+    tmp_caps = res_caps;
+    res_caps =
+        gst_caps_intersect_full (filter, tmp_caps, GST_CAPS_INTERSECT_FIRST);
+    gst_caps_unref (tmp_caps);
   }
-
-  GST_DEBUG_OBJECT (base, "                  into %" GST_PTR_FORMAT, newcaps);
-
-  return newcaps;
+  GST_DEBUG_OBJECT (bayer2rgb, "transformed %" GST_PTR_FORMAT " into %"
+      GST_PTR_FORMAT, caps, res_caps);
+  return res_caps;
 }
 
 static gboolean
@@ -473,7 +471,7 @@ gst_bayer2rgb_transform (GstBaseTransform * base, GstBuffer * inbuf,
 
   output = GST_VIDEO_FRAME_PLANE_DATA (&frame, 0);
   gst_bayer2rgb_process (filter, output, frame.info.stride[0],
-      map.data, filter->width);
+      map.data, GST_ROUND_UP_4 (filter->width));
 
   gst_video_frame_unmap (&frame);
   gst_buffer_unmap (inbuf, &map);