v4l2videoenc: Don't leak VideoCodecState
[platform/upstream/gst-plugins-good.git] / sys / v4l2 / gstv4l2videoenc.c
index f66744b..e0e8e00 100644 (file)
@@ -305,6 +305,7 @@ gst_v4l2_video_enc_set_format (GstVideoEncoder * encoder,
   GstV4l2VideoEnc *self = GST_V4L2_VIDEO_ENC (encoder);
   GstV4l2Error error = GST_V4L2_ERROR_INIT;
   GstCaps *outcaps;
+  GstVideoCodecState *output;
 
   GST_DEBUG_OBJECT (self, "Setting format: %" GST_PTR_FORMAT, state->caps);
 
@@ -323,7 +324,8 @@ gst_v4l2_video_enc_set_format (GstVideoEncoder * encoder,
 
   outcaps = gst_pad_get_pad_template_caps (encoder->srcpad);
   outcaps = gst_caps_make_writable (outcaps);
-  gst_video_encoder_set_output_state (encoder, outcaps, state);
+  output = gst_video_encoder_set_output_state (encoder, outcaps, state);
+  gst_video_codec_state_unref (output);
 
   if (!gst_video_encoder_negotiate (encoder))
     return FALSE;
@@ -898,18 +900,6 @@ gst_v4l2_video_enc_subclass_init (gpointer g_class, gpointer data)
 
 /* Probing functions */
 gboolean
-gst_v4l2_is_video_enc (GstCaps * sink_caps, GstCaps * src_caps)
-{
-  gboolean ret = FALSE;
-
-  if (gst_caps_is_subset (sink_caps, gst_v4l2_object_get_raw_caps ())
-      && gst_caps_is_subset (src_caps, gst_v4l2_object_get_codec_caps ()))
-    ret = TRUE;
-
-  return ret;
-}
-
-gboolean
 gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
     const char *codec, const gchar * basename, const gchar * device_path,
     GstCaps * sink_caps, GstCaps * codec_caps, GstCaps * src_caps)