+ gchar *codec_name = NULL;
+ gchar *type_name = NULL;
+
+#define SET_META(codec) \
+G_STMT_START { \
+ cdata->longname = "V4L2 " codec " Decoder"; \
+ cdata->description = "Decodes " codec " streams via V4L2 API"; \
+ codec_name = g_ascii_strdown (codec, -1); \
+} G_STMT_END
+
+ if (gst_structure_has_name (s, "image/jpeg")) {
+ SET_META ("JPEG");
+ } else if (gst_structure_has_name (s, "video/mpeg")) {
+ gint mpegversion = 0;
+ gst_structure_get_int (s, "mpegversion", &mpegversion);
+
+ if (mpegversion == 2) {
+ SET_META ("MPEG2");
+ } else {
+ SET_META ("MPEG4");
+ }
+ } else if (gst_structure_has_name (s, "video/x-h263")) {
+ SET_META ("H263");
+ } else if (gst_structure_has_name (s, "video/x-fwht")) {
+ SET_META ("FWHT");
+ } else if (gst_structure_has_name (s, "video/x-h264")) {
+ SET_META ("H264");
+ } else if (gst_structure_has_name (s, "video/x-h265")) {
+ SET_META ("H265");
+ } else if (gst_structure_has_name (s, "video/x-wmv")) {
+ SET_META ("VC1");
+ } else if (gst_structure_has_name (s, "video/x-vp8")) {
+ SET_META ("VP8");
+ } else if (gst_structure_has_name (s, "video/x-vp9")) {
+ SET_META ("VP9");
+ } else if (gst_structure_has_name (s, "video/x-bayer")) {
+ SET_META ("BAYER");
+ } else if (gst_structure_has_name (s, "video/x-sonix")) {
+ SET_META ("SONIX");
+ } else if (gst_structure_has_name (s, "video/x-pwc1")) {
+ SET_META ("PWC1");
+ } else if (gst_structure_has_name (s, "video/x-pwc2")) {
+ SET_META ("PWC2");
+ } else {
+ /* This code should be kept on sync with the exposed CODEC type of format
+ * from gstv4l2object.c. This warning will only occure in case we forget
+ * to also add a format here. */
+ gchar *s_str = gst_structure_to_string (s);
+ g_warning ("Missing fixed name mapping for caps '%s', this is a GStreamer "
+ "bug, please report at https://bugs.gnome.org", s_str);
+ g_free (s_str);
+ }