aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-multimedia/gstreamer/gst-plugins-good/0024-v4l2src-fix-RGB32-colorspace-deinitions.patch
blob: e141df974462ed4350039465d88273f21f2c9f83 (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
67
68
69
From e7782d58ed397e0f66cbb62b5c59f3adea8227c4 Mon Sep 17 00:00:00 2001
From: Kazunori Kobayashi <kkobayas@igel.co.jp>
Date: Mon, 16 Apr 2012 11:05:07 +0900
Subject: [PATCH 24/31] v4l2src: fix RGB32 colorspace deinitions

This patch makes RGB32 colorspace definitions used in the caps negotiation
suitable for actual v4l2 driver's output format.
---
 sys/v4l2/gstv4l2object.c |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index 81d1cb7..0678305 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -1208,14 +1208,16 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc)
           b_mask = 0xff0000;
           break;
         case V4L2_PIX_FMT_RGB32:
-          bpp = depth = 32;
+          bpp = 32;
+          depth = 24;
           endianness = G_BIG_ENDIAN;
-          r_mask = 0xff000000;
-          g_mask = 0x00ff0000;
-          b_mask = 0x0000ff00;
+          r_mask = 0x00ff0000;
+          g_mask = 0x0000ff00;
+          b_mask = 0x000000ff;
           break;
         case V4L2_PIX_FMT_BGR32:
-          bpp = depth = 32;
+          bpp = 32;
+          depth = 24;
           endianness = G_BIG_ENDIAN;
           r_mask = 0x000000ff;
           g_mask = 0x0000ff00;
@@ -1480,9 +1482,10 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
 #endif
     }
   } else if (!strcmp (mimetype, "video/x-raw-rgb")) {
-    gint depth, endianness, r_mask;
+    gint depth, bpp, endianness, r_mask;
 
     gst_structure_get_int (structure, "depth", &depth);
+    gst_structure_get_int (structure, "bpp", &bpp);
     gst_structure_get_int (structure, "endianness", &endianness);
     gst_structure_get_int (structure, "red_mask", &r_mask);
 
@@ -1499,10 +1502,13 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
             V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X;
         break;
       case 24:
-        fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
-        break;
       case 32:
-        fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
+        if (bpp == 24)
+          fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
+        else if (bpp == 32)
+          fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
+        else
+          GST_ERROR_OBJECT (v4l2object, "Invalid value bpp = %d", bpp);
         break;
     }
   } else if (strcmp (mimetype, "video/x-dv") == 0) {
-- 
1.7.9.5