dec, GstQuery * query);
static gboolean gst_audio_decoder_propose_allocation_default (GstAudioDecoder *
dec, GstQuery * query);
+static gboolean gst_audio_decoder_negotiate_default (GstAudioDecoder * dec);
static GstElementClass *parent_class = NULL;
GST_DEBUG_FUNCPTR (gst_audio_decoder_propose_allocation_default);
audiodecoder_class->decide_allocation =
GST_DEBUG_FUNCPTR (gst_audio_decoder_decide_allocation_default);
+ audiodecoder_class->negotiate =
+ GST_DEBUG_FUNCPTR (gst_audio_decoder_negotiate_default);
}
static void
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-/**
- * gst_audio_decoder_negotiate:
- * @dec: a #GstAudioDecoder
- *
- * Negotiate with downstreame elements to currently configured #GstAudioInfo.
- *
- * Returns: #TRUE if the negotiation succeeded, else #FALSE.
- */
-gboolean
-gst_audio_decoder_negotiate (GstAudioDecoder * dec)
+static gboolean
+gst_audio_decoder_negotiate_default (GstAudioDecoder * dec)
{
GstAudioDecoderClass *klass;
gboolean res = TRUE;
klass = GST_AUDIO_DECODER_GET_CLASS (dec);
- GST_AUDIO_DECODER_STREAM_LOCK (dec);
-
GST_DEBUG_OBJECT (dec, "setting src caps %" GST_PTR_FORMAT, caps);
caps = gst_audio_info_to_caps (&dec->priv->ctx.info);
dec->priv->ctx.params = params;
done:
- GST_AUDIO_DECODER_STREAM_UNLOCK (dec);
if (query)
gst_query_unref (query);
}
}
+/**
+ * gst_audio_decoder_negotiate:
+ * @dec: a #GstAudioDecoder
+ *
+ * Negotiate with downstreame elements to currently configured #GstAudioInfo.
+ *
+ * Returns: #TRUE if the negotiation succeeded, else #FALSE.
+ */
+gboolean
+gst_audio_decoder_negotiate (GstAudioDecoder * dec)
+{
+ GstAudioDecoderClass *klass;
+ gboolean res = TRUE;
+
+ g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), FALSE);
+
+ klass = GST_AUDIO_DECODER_GET_CLASS (dec);
+
+ GST_AUDIO_DECODER_STREAM_LOCK (dec);
+ if (klass->negotiate)
+ res = klass->negotiate (dec);
+ GST_AUDIO_DECODER_STREAM_UNLOCK (dec);
+
+ return res;
+}
+
/**
* gst_audio_decoder_set_output_format:
* @dec: a #GstAudioDecoder
done:
GST_AUDIO_DECODER_STREAM_UNLOCK (dec);
- gst_caps_unref (caps);
+ if (caps)
+ gst_caps_unref (caps);
return res;
* @close: Optional.
* Called when the element changes to GST_STATE_NULL.
* Allows closing external resources.
+ * @negotiate: Optional.
+ * Negotiate with downstream and configure buffer pools, etc.
* @decide_allocation: Optional.
* Setup the allocation parameters for allocating output
* buffers. The passed in query contains the result of the
gboolean (*close) (GstAudioDecoder *dec);
+ gboolean (*negotiate) (GstAudioDecoder *dec);
+
gboolean (*decide_allocation) (GstAudioDecoder *dec, GstQuery *query);
gboolean (*propose_allocation) (GstAudioDecoder *dec,