aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-multimedia/gstreamer/gst-plugins-good/0007-videocrop-set-rowstride-capability.patch
blob: 1eef8de028f0874d14751768c114919c6cab5681 (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
From 0d5b9694fc670d489d02018d1e2d83394f299ad5 Mon Sep 17 00:00:00 2001
From: Kazunori Kobayashi <kkobayas@igel.co.jp>
Date: Thu, 10 May 2012 11:20:18 +0900
Subject: [PATCH 07/31] videocrop: set rowstride capability

This patch sets the rowstride capability if downstream plugins
can handle it.

This patch is preliminary for the zero-copy cropping.
---
 gst/videocrop/gstvideocrop.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
index b0c3a68..ae7ddaf 100644
--- a/gst/videocrop/gstvideocrop.c
+++ b/gst/videocrop/gstvideocrop.c
@@ -585,22 +585,22 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
   other_caps = gst_caps_new_empty ();
 
   for (i = 0; i < gst_caps_get_size (caps); ++i) {
-    const GValue *v;
+    const GValue *in_width, *in_height;
     GstStructure *structure, *new_structure;
     GValue w_val = { 0, }, h_val = {
     0,};
 
     structure = gst_caps_get_structure (caps, i);
 
-    v = gst_structure_get_value (structure, "width");
-    if (!gst_video_crop_transform_dimension_value (v, dx, &w_val)) {
+    in_width = gst_structure_get_value (structure, "width");
+    if (!gst_video_crop_transform_dimension_value (in_width, dx, &w_val)) {
       GST_WARNING_OBJECT (vcrop, "could not tranform width value with dx=%d"
           ", caps structure=%" GST_PTR_FORMAT, dx, structure);
       continue;
     }
 
-    v = gst_structure_get_value (structure, "height");
-    if (!gst_video_crop_transform_dimension_value (v, dy, &h_val)) {
+    in_height = gst_structure_get_value (structure, "height");
+    if (!gst_video_crop_transform_dimension_value (in_height, dy, &h_val)) {
       g_value_unset (&w_val);
       GST_WARNING_OBJECT (vcrop, "could not tranform height value with dy=%d"
           ", caps structure=%" GST_PTR_FORMAT, dy, structure);
@@ -610,6 +610,10 @@ gst_video_crop_transform_caps (GstBaseTransform * trans,
     new_structure = gst_structure_copy (structure);
     gst_structure_set_value (new_structure, "width", &w_val);
     gst_structure_set_value (new_structure, "height", &h_val);
+
+    /* set rowstride when creating output caps */
+    if (vcrop->stride_supported && (direction == GST_PAD_SINK))
+      gst_structure_set_value (new_structure, "rowstride", in_width);
     g_value_unset (&w_val);
     g_value_unset (&h_val);
     GST_LOG_OBJECT (vcrop, "transformed structure %2d: %" GST_PTR_FORMAT
-- 
1.7.9.5