videoencoder: Simply setcaps function

This commit is contained in:
Sebastian Dröge 2013-04-18 09:58:09 +02:00
parent d537a21075
commit 9d309a3e06

View file

@ -566,7 +566,6 @@ gst_video_encoder_setcaps (GstVideoEncoder * encoder, GstCaps * caps)
GstVideoEncoderClass *encoder_class; GstVideoEncoderClass *encoder_class;
GstVideoCodecState *state; GstVideoCodecState *state;
gboolean ret; gboolean ret;
gboolean samecaps = FALSE;
encoder_class = GST_VIDEO_ENCODER_GET_CLASS (encoder); encoder_class = GST_VIDEO_ENCODER_GET_CLASS (encoder);
@ -589,29 +588,24 @@ gst_video_encoder_setcaps (GstVideoEncoder * encoder, GstCaps * caps)
if (G_UNLIKELY (!state)) if (G_UNLIKELY (!state))
goto parse_fail; goto parse_fail;
if (encoder->priv->input_state) if (encoder->priv->input_state
samecaps = && gst_video_info_is_equal (&state->info,
gst_video_info_is_equal (&state->info, &encoder->priv->input_state->info)) {
&encoder->priv->input_state->info); gst_video_codec_state_unref (state);
goto caps_not_changed;
if (!samecaps) { }
/* arrange draining pending frames */
gst_video_encoder_drain (encoder); /* arrange draining pending frames */
gst_video_encoder_drain (encoder);
/* and subclass should be ready to configure format at any time around */
ret = encoder_class->set_format (encoder, state); /* and subclass should be ready to configure format at any time around */
if (ret) { ret = encoder_class->set_format (encoder, state);
if (encoder->priv->input_state) if (ret) {
gst_video_codec_state_unref (encoder->priv->input_state); if (encoder->priv->input_state)
encoder->priv->input_state = state; gst_video_codec_state_unref (encoder->priv->input_state);
} else encoder->priv->input_state = state;
gst_video_codec_state_unref (state); } else {
} else {
/* no need to stir things up */
GST_DEBUG_OBJECT (encoder,
"new video format identical to configured format");
gst_video_codec_state_unref (state); gst_video_codec_state_unref (state);
ret = TRUE;
} }
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder); GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);