summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Stadler <rene.stadler@collabora.co.uk>2012-08-18 00:33:01 +0200
committerRené Stadler <rene.stadler@collabora.co.uk>2012-08-18 00:33:47 +0200
commit13d1b6593325ae8564d1400863caf735444ec0a9 (patch)
treed9beea86ebb45ba3c58a0f6e0a6894a9e58fbe7a
parenta3800913b3ec1ef4d3aad7f5b31829a4fd9ba120 (diff)
downloadgstreamer-plugins-good-13d1b6593325ae8564d1400863caf735444ec0a9.tar.gz
v4l2: fix RGB32 and BGR32 caps
With depth=32, there is the implicit need to provide an alpha channel. Using the proper depth=24 standard caps prevents unnecessary conversions from happening in the pipeline.
-rw-r--r--sys/v4l2/gstv4l2object.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index 53fcd0073..f704edc65 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -1221,14 +1221,18 @@ gst_v4l2_object_v4l2fourcc_to_structure (guint32 fourcc)
b_mask = 0xff0000;
break;
case V4L2_PIX_FMT_RGB32:
- bpp = depth = 32;
+ /* GST_VIDEO_FORMAT_RGBx */
+ bpp = 32;
+ depth = 24;
endianness = G_BIG_ENDIAN;
r_mask = 0xff000000;
g_mask = 0x00ff0000;
b_mask = 0x0000ff00;
break;
case V4L2_PIX_FMT_BGR32:
- bpp = depth = 32;
+ /* GST_VIDEO_FORMAT_BGRx */
+ bpp = 32;
+ depth = 24;
endianness = G_BIG_ENDIAN;
r_mask = 0x0000ff00;
g_mask = 0x00ff0000;
@@ -1493,8 +1497,9 @@ 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 bpp, depth, endianness, r_mask;
+ gst_structure_get_int (structure, "bpp", &bpp);
gst_structure_get_int (structure, "depth", &depth);
gst_structure_get_int (structure, "endianness", &endianness);
gst_structure_get_int (structure, "red_mask", &r_mask);
@@ -1512,10 +1517,10 @@ 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 == 0xFF00) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
+ if (bpp == 24)
+ fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24;
+ else
+ fourcc = (r_mask == 0xFF00) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32;
break;
}
} else if (strcmp (mimetype, "video/x-dv") == 0) {