pad-monitor: Check if channel-mask is present only if channels > 2
authorThibault Saunier <thibault.saunier@collabora.com>
Fri, 20 Sep 2013 22:23:17 +0000 (00:23 +0200)
committerThibault Saunier <thibault.saunier@collabora.com>
Fri, 20 Sep 2013 22:34:05 +0000 (00:34 +0200)
As it is not a mandatory field otherwize

https://bugzilla.gnome.org/show_bug.cgi?id=708499

validate/gst/validate/gst-validate-pad-monitor.c

index 0f9b6cc..dbc61fe 100644 (file)
@@ -210,6 +210,7 @@ static void
 gst_validate_pad_monitor_check_raw_audio_caps_complete (GstValidatePadMonitor *
     monitor, GstStructure * structure)
 {
+  gint channels;
   _check_field_type (monitor, structure, "format", G_TYPE_STRING, GST_TYPE_LIST,
       0);
   _check_field_type (monitor, structure, "layout", G_TYPE_STRING, GST_TYPE_LIST,
@@ -218,8 +219,11 @@ gst_validate_pad_monitor_check_raw_audio_caps_complete (GstValidatePadMonitor *
       GST_TYPE_INT_RANGE, 0);
   _check_field_type (monitor, structure, "channels", G_TYPE_INT, GST_TYPE_LIST,
       GST_TYPE_INT_RANGE, 0);
-  _check_field_type (monitor, structure, "channel-mask", GST_TYPE_BITMASK,
-      GST_TYPE_LIST, 0);
+  if (gst_structure_get_int(structure, "channels", &channels)) {
+    if (channels > 2)
+      _check_field_type (monitor, structure, "channel-mask", GST_TYPE_BITMASK,
+          GST_TYPE_LIST, 0);
+  }
 }
 
 static void