Commit d2e1b64e authored by Vivia Nikolaidou's avatar Vivia Nikolaidou Committed by Sebastian Dröge
Browse files

videoencoder: Expose _negotiate function

This is to be called by encoders once they have set the output format
in order for (re)negotiation to be triggered as early as possible.

https://bugzilla.gnome.org/show_bug.cgi?id=679878
parent 65ea6dee
......@@ -1317,8 +1317,16 @@ close_failed:
}
}
static gboolean
gst_video_encoder_set_src_caps (GstVideoEncoder * encoder)
/**
* gst_video_encoder_negotiate:
* @encoder: a #GstVideoEncoder
*
* Negotiate with downstream elements to currently configured #GstVideoCodecState.
*
* Returns: #TRUE if the negotiation succeeded, else #FALSE.
*/
gboolean
gst_video_encoder_negotiate (GstVideoEncoder * encoder)
{
GstVideoEncoderClass *klass = GST_VIDEO_ENCODER_GET_CLASS (encoder);
GstAllocator *allocator;
......@@ -1422,7 +1430,7 @@ gst_video_encoder_allocate_output_buffer (GstVideoEncoder * encoder, gsize size)
if (G_UNLIKELY (encoder->priv->output_state_changed
|| (encoder->priv->output_state
&& gst_pad_check_reconfigure (encoder->srcpad))))
gst_video_encoder_set_src_caps (encoder);
gst_video_encoder_negotiate (encoder);
buffer =
gst_buffer_new_allocate (encoder->priv->allocator, size,
......@@ -1459,7 +1467,7 @@ gst_video_encoder_allocate_output_frame (GstVideoEncoder *
if (G_UNLIKELY (encoder->priv->output_state_changed
|| (encoder->priv->output_state
&& gst_pad_check_reconfigure (encoder->srcpad))))
gst_video_encoder_set_src_caps (encoder);
gst_video_encoder_negotiate (encoder);
GST_LOG_OBJECT (encoder, "alloc buffer size %d", size);
......@@ -1509,7 +1517,7 @@ gst_video_encoder_finish_frame (GstVideoEncoder * encoder,
if (G_UNLIKELY (priv->output_state_changed || (priv->output_state
&& gst_pad_check_reconfigure (encoder->srcpad))))
gst_video_encoder_set_src_caps (encoder);
gst_video_encoder_negotiate (encoder);
if (G_UNLIKELY (priv->output_state == NULL))
......
......@@ -258,6 +258,8 @@ GstVideoCodecState* gst_video_encoder_set_output_state (GstVideoEncoder * encod
GstCaps * caps,
GstVideoCodecState * reference);
gboolean gst_video_encoder_negotiate (GstVideoEncoder * encoder);
GstVideoCodecFrame* gst_video_encoder_get_frame (GstVideoEncoder *encoder,
int frame_number);
GstVideoCodecFrame* gst_video_encoder_get_oldest_frame (GstVideoEncoder *encoder);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment