From ac6b8058278dfd02601cc5bcac75caf95be54f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Wed, 1 Apr 2020 17:47:04 +0200 Subject: [PATCH] videoencoder: subclass 'set_format' should be optional Aligns documentation with the code to make the subclass 'set_format' call optional. --- gst-libs/gst/video/gstvideoencoder.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gst-libs/gst/video/gstvideoencoder.c b/gst-libs/gst/video/gstvideoencoder.c index e9576090fa..875e44c44d 100644 --- a/gst-libs/gst/video/gstvideoencoder.c +++ b/gst-libs/gst/video/gstvideoencoder.c @@ -633,13 +633,10 @@ gst_video_encoder_setcaps (GstVideoEncoder * encoder, GstCaps * caps) { GstVideoEncoderClass *encoder_class; GstVideoCodecState *state; - gboolean ret; + gboolean ret = TRUE; encoder_class = GST_VIDEO_ENCODER_GET_CLASS (encoder); - /* subclass should do something here ... */ - g_return_val_if_fail (encoder_class->set_format != NULL, FALSE); - GST_DEBUG_OBJECT (encoder, "setcaps %" GST_PTR_FORMAT, caps); GST_VIDEO_ENCODER_STREAM_LOCK (encoder); @@ -669,7 +666,9 @@ gst_video_encoder_setcaps (GstVideoEncoder * encoder, GstCaps * caps) } /* and subclass should be ready to configure format at any time around */ - ret = encoder_class->set_format (encoder, state); + if (encoder_class->set_format != NULL) + ret = encoder_class->set_format (encoder, state); + if (ret) { if (encoder->priv->input_state) gst_video_codec_state_unref (encoder->priv->input_state);