aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-multimedia/gstreamer/gst-plugins-good/0014-videocrop-don-t-set-rowstride-only-when-the-color-sp.patch
blob: 3ae31e12b1cc45cd53c0a64ed98646aa36bbcac1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From 61154856964b78b3c601e687d6f081e666f94958 Mon Sep 17 00:00:00 2001
From: Kazunori Kobayashi <kkobayas@igel.co.jp>
Date: Thu, 4 Oct 2012 11:08:56 +0900
Subject: [PATCH 14/31] videocrop: don't set rowstride only when the color
 space is the planar

videocrop wouldn't support zero-copy cropping in the planar format.
Therefore, rowstride shouldn't set only when the color space is the planar.
---
 gst/videocrop/gstvideocrop.c |   30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
index 9c5df28..f2d2949 100644
--- a/gst/videocrop/gstvideocrop.c
+++ b/gst/videocrop/gstvideocrop.c
@@ -610,6 +610,8 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
     GstStructure *structure, *new_structure;
     GValue w_val = { 0, }, h_val = {
     0,};
+    GstVideoCropImageDetails img_details = { 0, };
+    guint rowstride;
 
     structure = gst_caps_get_structure (caps, i);
 
@@ -633,17 +635,29 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
     gst_structure_set_value (new_structure, "height", &h_val);
 
     /* set rowstride when creating output caps */
-    if (vcrop->stride_supported && (direction == GST_PAD_SINK)) {
-      GstVideoCropImageDetails img_details = { 0, };
-
-      if (!GST_VALUE_HOLDS_INT_RANGE (&w_val) &&
-          !GST_VALUE_HOLDS_INT_RANGE (&h_val) &&
-          gst_video_crop_get_image_details_from_structure (vcrop, &img_details,
+    if (!GST_VALUE_HOLDS_INT_RANGE (&w_val) &&
+        !GST_VALUE_HOLDS_INT_RANGE (&h_val)) {
+      if (!gst_video_crop_get_image_details_from_structure (vcrop, &img_details,
               structure)) {
-        gst_structure_set (new_structure, "rowstride", G_TYPE_INT,
-            (gint) img_details.stride, NULL);
+        GST_ERROR_OBJECT (vcrop, "couldn't get image details from structure");
+        goto add_structure;
       }
+    } else {
+      GST_LOG_OBJECT (vcrop, "go through setting rowstride");
+      goto add_structure;
     }
+
+    if (img_details.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_SIMPLE ||
+        img_details.packing == VIDEO_CROP_PIXEL_FORMAT_PACKED_COMPLEX)
+      rowstride = img_details.stride;
+    else
+      rowstride = 0;
+
+    if (vcrop->stride_supported && (direction == GST_PAD_SINK) && rowstride)
+      gst_structure_set (new_structure, "rowstride", G_TYPE_INT,
+          (gint) rowstride, NULL);
+
+  add_structure:
     g_value_unset (&w_val);
     g_value_unset (&h_val);
     GST_LOG_OBJECT (vcrop, "transformed structure %2d: %" GST_PTR_FORMAT
-- 
1.7.9.5