[0.11] gst-plugins-bad: dts: Use new audio encoder/ decoder base class API for srcpad caps

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Feb 1 07:27:56 PST 2012


Module: gst-plugins-bad
Branch: 0.11
Commit: 73f50c5efa5a7b680d1451efeb4f0a5e2489b9a3
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=73f50c5efa5a7b680d1451efeb4f0a5e2489b9a3

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Wed Feb  1 16:25:19 2012 +0100

dts: Use new audio encoder/decoder base class API for srcpad caps

---

 ext/dts/gstdtsdec.c |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/ext/dts/gstdtsdec.c b/ext/dts/gstdtsdec.c
index 11fa3b2..07335d8 100644
--- a/ext/dts/gstdtsdec.c
+++ b/ext/dts/gstdtsdec.c
@@ -88,12 +88,15 @@ typedef struct dts_state_s dca_state_t;
 #if defined(LIBDTS_FIXED) || defined(LIBDCA_FIXED)
 #define SAMPLE_WIDTH 16
 #define SAMPLE_FORMAT GST_AUDIO_NE(S16)
+#define SAMPLE_TYPE GST_AUDIO_FORMAT_S16
 #elif defined (LIBDTS_DOUBLE) || defined(LIBDCA_DOUBLE)
 #define SAMPLE_WIDTH 64
 #define SAMPLE_FORMAT GST_AUDIO_NE(F64)
+#define SAMPLE_TYPE GST_AUDIO_FORMAT_F64
 #else
 #define SAMPLE_WIDTH 32
 #define SAMPLE_FORMAT GST_AUDIO_NE(F32)
+#define SAMPLE_TYPE GST_AUDIO_FORMAT_F32
 #endif
 
 GST_DEBUG_CATEGORY_STATIC (dtsdec_debug);
@@ -403,9 +406,9 @@ static gboolean
 gst_dtsdec_renegotiate (GstDtsDec * dts)
 {
   gint channels;
-  GstCaps *caps = NULL;
   gboolean result = FALSE;
   GstAudioChannelPosition from[6], to[6];
+  GstAudioInfo info;
 
   channels = gst_dtsdec_channels (dts->using_channels, from);
 
@@ -420,29 +423,17 @@ gst_dtsdec_renegotiate (GstDtsDec * dts)
   gst_audio_get_channel_reorder_map (channels, from, to,
       dts->channel_reorder_map);
 
-  caps = gst_caps_new_simple ("audio/x-raw",
-      "format", G_TYPE_STRING, SAMPLE_FORMAT,
-      "layout", G_TYPE_STRING, "interleaved",
-      "channels", G_TYPE_INT, channels,
-      "rate", G_TYPE_INT, dts->sample_rate, NULL);
 
-  if (channels > 1) {
-    guint64 channel_mask = 0;
+  gst_audio_info_init (&info);
+  gst_audio_info_set_format (&info,
+      SAMPLE_TYPE, dts->sample_rate, channels, (channels > 1 ? to : NULL));
 
-    gst_audio_channel_positions_to_mask (to, channels, &channel_mask);
-    gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, channel_mask,
-        NULL);
-  }
-
-  if (!gst_audio_decoder_set_outcaps (GST_AUDIO_DECODER (dts), caps))
+  if (!gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (dts), &info))
     goto done;
 
   result = TRUE;
 
 done:
-  if (caps) {
-    gst_caps_unref (caps);
-  }
   return result;
 }
 



More information about the gstreamer-commits mailing list