enc, GstQuery * query);
static gboolean gst_audio_encoder_propose_allocation_default (GstAudioEncoder *
enc, GstQuery * query);
+static gboolean gst_audio_encoder_negotiate_default (GstAudioEncoder * enc);
static void
gst_audio_encoder_class_init (GstAudioEncoderClass * klass)
klass->src_event = gst_audio_encoder_src_event_default;
klass->propose_allocation = gst_audio_encoder_propose_allocation_default;
klass->decide_allocation = gst_audio_encoder_decide_allocation_default;
+ klass->negotiate = gst_audio_encoder_negotiate_default;
}
static void
GST_OBJECT_UNLOCK (enc);
}
-/**
- * gst_audio_encoder_negotiate:
- * @dec: a #GstAudioEncoder
- *
- * Negotiate with downstreame elements to currently configured #GstCaps.
- *
- * Returns: #TRUE if the negotiation succeeded, else #FALSE.
- */
-gboolean
-gst_audio_encoder_negotiate (GstAudioEncoder * enc)
+static gboolean
+gst_audio_encoder_negotiate_default (GstAudioEncoder * enc)
{
GstAudioEncoderClass *klass;
gboolean res = FALSE;
klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
- GST_AUDIO_ENCODER_STREAM_LOCK (enc);
-
caps = enc->priv->ctx.caps;
GST_DEBUG_OBJECT (enc, "Setting srcpad caps %" GST_PTR_FORMAT, caps);
if (query)
gst_query_unref (query);
- GST_AUDIO_ENCODER_STREAM_UNLOCK (enc);
-
return res;
/* ERRORS */
}
}
+/**
+ * gst_audio_encoder_negotiate:
+ * @dec: a #GstAudioEncoder
+ *
+ * Negotiate with downstreame elements to currently configured #GstCaps.
+ *
+ * Returns: #TRUE if the negotiation succeeded, else #FALSE.
+ */
+gboolean
+gst_audio_encoder_negotiate (GstAudioEncoder * enc)
+{
+ GstAudioEncoderClass *klass;
+ gboolean ret = TRUE;
+
+ g_return_val_if_fail (GST_IS_AUDIO_ENCODER (enc), FALSE);
+
+ klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
+
+ GST_AUDIO_ENCODER_STREAM_LOCK (enc);
+ if (klass->negotiate)
+ ret = klass->negotiate (enc);
+ GST_AUDIO_ENCODER_STREAM_UNLOCK (enc);
+
+ return ret;
+}
+
/*
* gst_audio_encoder_set_output_format:
* @enc: a #GstAudioEncoder
* @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) (GstAudioEncoder *enc);
+ gboolean (*negotiate) (GstAudioEncoder *enc);
+
gboolean (*decide_allocation) (GstAudioEncoder *enc, GstQuery *query);
gboolean (*propose_allocation) (GstAudioEncoder * enc,