- /* Set up the sink's capabilities. */
- for(i = 0; i < N(widths); i++) {
- c = gst_caps_new_simple("audio/x-raw-int",
- "width", G_TYPE_INT, widths[i],
- "depth", G_TYPE_INT, widths[i],
- "channels", GST_TYPE_INT_RANGE, 1, 2,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "rate", GST_TYPE_INT_RANGE, 100, 1000000,
- END);
- gst_caps_append(caps, c);
+ /* Configure the resampler and converter. Leave things as their defaults
+ * if the user hasn't made an explicit request.
+ */
+ if(quality >= 0) g_object_set(resample, "quality", quality, END);
+ if(dither >= 0) g_object_set(convert, "dithering", dither, END);
+ if(shape >= 0) g_object_set(convert, "noise-shaping", shape, END);
+
+ /* Set up the sink's capabilities from the configuration. */
+#ifdef HAVE_GSTREAMER_0_10
+ caps = gst_caps_new_simple("audio/x-raw-int",
+ "width", G_TYPE_INT, fmt->bits,
+ "depth", G_TYPE_INT, fmt->bits,
+ "channels", G_TYPE_INT, fmt->channels,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "rate", G_TYPE_INT, fmt->rate,
+ "endianness", G_TYPE_INT,
+ fmt->endian == ENDIAN_BIG ?
+ G_BIG_ENDIAN : G_LITTLE_ENDIAN,
+ END);
+#else
+ for (ft = fmttab; ft->fmt; ft++)
+ if (ft->bits == fmt->bits && ft->endian == fmt->endian) break;
+ if(!ft->fmt) {
+ disorder_fatal(0, "unsupported sample format: bits=%"PRIu32", endian=%u",
+ fmt->bits, fmt->endian);