decoder, GstQuery * query);
static gboolean gst_video_decoder_propose_allocation_default (GstVideoDecoder *
decoder, GstQuery * query);
+static gboolean gst_video_decoder_negotiate_default (GstVideoDecoder * decoder);
/* we can't use G_DEFINE_ABSTRACT_TYPE because we need the klass in the _init
* method to get to the padtemplates */
klass->src_event = gst_video_decoder_src_event_default;
klass->decide_allocation = gst_video_decoder_decide_allocation_default;
klass->propose_allocation = gst_video_decoder_propose_allocation_default;
+ klass->negotiate = gst_video_decoder_negotiate_default;
}
static void
return TRUE;
}
-/**
- * gst_video_decoder_negotiate:
- * @decoder: a #GstVideoDecoder
- *
- * Negotiate with downstreame elements to currently configured #GstVideoCodecState.
- *
- * Returns: #TRUE if the negotiation succeeded, else #FALSE.
- */
-gboolean
-gst_video_decoder_negotiate (GstVideoDecoder * decoder)
+static gboolean
+gst_video_decoder_negotiate_default (GstVideoDecoder * decoder)
{
GstVideoCodecState *state = decoder->priv->output_state;
GstVideoDecoderClass *klass;
g_return_val_if_fail (GST_VIDEO_INFO_WIDTH (&state->info) != 0, FALSE);
g_return_val_if_fail (GST_VIDEO_INFO_HEIGHT (&state->info) != 0, FALSE);
- GST_VIDEO_DECODER_STREAM_LOCK (decoder);
-
klass = GST_VIDEO_DECODER_GET_CLASS (decoder);
GST_DEBUG_OBJECT (decoder, "output_state par %d/%d fps %d/%d",
if (query)
gst_query_unref (query);
- GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
-
return ret;
/* Errors */
}
/**
+ * gst_video_decoder_negotiate:
+ * @decoder: a #GstVideoDecoder
+ *
+ * Negotiate with downstreame elements to currently configured #GstVideoCodecState.
+ *
+ * Returns: #TRUE if the negotiation succeeded, else #FALSE.
+ */
+gboolean
+gst_video_decoder_negotiate (GstVideoDecoder * decoder)
+{
+ GstVideoDecoderClass *klass;
+ gboolean ret = TRUE;
+
+ g_return_val_if_fail (GST_IS_VIDEO_DECODER (decoder), FALSE);
+
+ klass = GST_VIDEO_DECODER_GET_CLASS (decoder);
+
+ GST_VIDEO_DECODER_STREAM_LOCK (decoder);
+ if (klass->negotiate)
+ ret = klass->negotiate (decoder);
+ GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
+
+ return ret;
+}
+
+/**
* gst_video_decoder_allocate_output_buffer:
* @decoder: a #GstVideoDecoder
*
* Event handler on the source pad. This function should return
* TRUE if the event was handled and should be discarded
* (i.e. not unref'ed).
+ * @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 (*src_event) (GstVideoDecoder *decoder,
GstEvent *event);
+ gboolean (*negotiate) (GstVideoDecoder *decoder);
+
gboolean (*decide_allocation) (GstVideoDecoder *decoder, GstQuery *query);
gboolean (*propose_allocation) (GstVideoDecoder *decoder, GstQuery * query);