audiotestsrc: add support for unlimited number of channels
authorWim Taymans <wtaymans@redhat.com>
Mon, 2 Nov 2015 14:46:22 +0000 (15:46 +0100)
committerWim Taymans <wtaymans@redhat.com>
Mon, 2 Nov 2015 14:46:22 +0000 (15:46 +0100)
Raise the channel limit and set the channel-mask for > 2 channels.

gst/audiotestsrc/gstaudiotestsrc.c

index 643ef01..c5ab4c4 100644 (file)
@@ -267,6 +267,7 @@ gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
 {
   GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (bsrc);
   GstStructure *structure;
+  gint channels;
 
   caps = gst_caps_make_writable (caps);
 
@@ -282,6 +283,13 @@ gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
   /* fixate to mono unless downstream requires stereo, for backwards compat */
   gst_structure_fixate_field_nearest_int (structure, "channels", 1);
 
+  if (gst_structure_get_int (structure, "channels", &channels) && channels > 2) {
+    if (!gst_structure_has_field_typed (structure, "channel-mask",
+            GST_TYPE_BITMASK))
+      gst_structure_set (structure, "channel-mask", GST_TYPE_BITMASK, 0ULL,
+          NULL);
+  }
+
   caps = GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
 
   return caps;