videodecoder: Expose _negotiate function

This is to be called by decoders 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
This commit is contained in:
Edward Hervey 2012-07-18 15:34:06 +02:00
parent 1097102b20
commit 8feaebb6eb
2 changed files with 10 additions and 9 deletions

View file

@ -419,7 +419,6 @@ static void gst_video_decoder_reset (GstVideoDecoder * decoder, gboolean full);
static GstFlowReturn gst_video_decoder_decode_frame (GstVideoDecoder * decoder,
GstVideoCodecFrame * frame);
static gboolean gst_video_decoder_set_src_caps (GstVideoDecoder * decoder);
static void gst_video_decoder_release_frame (GstVideoDecoder * dec,
GstVideoCodecFrame * frame);
@ -2175,7 +2174,7 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder,
if (G_UNLIKELY (priv->output_state_changed || (priv->output_state
&& gst_pad_check_reconfigure (decoder->srcpad))))
gst_video_decoder_set_src_caps (decoder);
gst_video_decoder_negotiate (decoder);
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
@ -2671,15 +2670,15 @@ gst_video_decoder_propose_allocation_default (GstVideoDecoder * decoder,
}
/**
* gst_video_decoder_set_src_caps:
* gst_video_decoder_negotiate:
* @decoder: a #GstVideoDecoder
*
* Sets src pad caps according to currently configured #GstVideoCodecState.
* Negotiate with downstreame elements to currently configured #GstVideoCodecState.
*
* Returns: #TRUE if the caps were accepted downstream, else #FALSE.
* Returns: #TRUE if the negotiation succeeded, else #FALSE.
*/
static gboolean
gst_video_decoder_set_src_caps (GstVideoDecoder * decoder)
gboolean
gst_video_decoder_negotiate (GstVideoDecoder * decoder)
{
GstVideoCodecState *state = decoder->priv->output_state;
GstVideoDecoderClass *klass;
@ -2794,7 +2793,7 @@ gst_video_decoder_alloc_output_buffer (GstVideoDecoder * decoder)
if (G_UNLIKELY (decoder->priv->output_state_changed
|| (decoder->priv->output_state
&& gst_pad_check_reconfigure (decoder->srcpad))))
gst_video_decoder_set_src_caps (decoder);
gst_video_decoder_negotiate (decoder);
gst_buffer_pool_acquire_buffer (decoder->priv->pool, &buffer, NULL);
@ -2831,7 +2830,7 @@ gst_video_decoder_alloc_output_frame (GstVideoDecoder *
if (G_UNLIKELY (decoder->priv->output_state_changed
|| (decoder->priv->output_state
&& gst_pad_check_reconfigure (decoder->srcpad))))
gst_video_decoder_set_src_caps (decoder);
gst_video_decoder_negotiate (decoder);
GST_LOG_OBJECT (decoder, "alloc buffer size %d", num_bytes);
GST_VIDEO_DECODER_STREAM_LOCK (decoder);

View file

@ -329,6 +329,8 @@ GstVideoCodecState *gst_video_decoder_set_output_state (GstVideoDecoder *decoder
GstVideoCodecState *gst_video_decoder_get_output_state (GstVideoDecoder *decoder);
gboolean gst_video_decoder_negotiate (GstVideoDecoder * decoder);
GstClockTimeDiff gst_video_decoder_get_max_decode_time (GstVideoDecoder *decoder,
GstVideoCodecFrame *frame);