diff --git a/ext/dts/gstdtsdec.c b/ext/dts/gstdtsdec.c index 11fa3b219a..07335d84aa 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; }