summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2013-04-18 09:58:09 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2013-04-18 09:58:54 +0200
commit274f3024758fa13a59b650a97e70efc916fc94e9 (patch)
treede2183f9279af010a27a52735b0e5aeb4b06c091
parentf0c2a700af8c68eddc82ae8fb76680dc6aa020cc (diff)
videoencoder: Simply setcaps function
-rw-r--r--gst-libs/gst/video/gstvideoencoder.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/gst-libs/gst/video/gstvideoencoder.c b/gst-libs/gst/video/gstvideoencoder.c
index 616614c0e..25c96d5ea 100644
--- a/gst-libs/gst/video/gstvideoencoder.c
+++ b/gst-libs/gst/video/gstvideoencoder.c
@@ -566,7 +566,6 @@ gst_video_encoder_setcaps (GstVideoEncoder * encoder, GstCaps * caps)
GstVideoEncoderClass *encoder_class;
GstVideoCodecState *state;
gboolean ret;
- gboolean samecaps = FALSE;
encoder_class = GST_VIDEO_ENCODER_GET_CLASS (encoder);
@@ -589,29 +588,24 @@ gst_video_encoder_setcaps (GstVideoEncoder * encoder, GstCaps * caps)
if (G_UNLIKELY (!state))
goto parse_fail;
- if (encoder->priv->input_state)
- samecaps =
- gst_video_info_is_equal (&state->info,
- &encoder->priv->input_state->info);
-
- if (!samecaps) {
- /* 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);
- if (ret) {
- if (encoder->priv->input_state)
- gst_video_codec_state_unref (encoder->priv->input_state);
- encoder->priv->input_state = state;
- } else
- gst_video_codec_state_unref (state);
+ if (encoder->priv->input_state
+ && gst_video_info_is_equal (&state->info,
+ &encoder->priv->input_state->info)) {
+ gst_video_codec_state_unref (state);
+ goto caps_not_changed;
+ }
+
+ /* 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);
+ if (ret) {
+ if (encoder->priv->input_state)
+ gst_video_codec_state_unref (encoder->priv->input_state);
+ encoder->priv->input_state = state;
} else {
- /* no need to stir things up */
- GST_DEBUG_OBJECT (encoder,
- "new video format identical to configured format");
gst_video_codec_state_unref (state);
- ret = TRUE;
}
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);