vaapidecodebin: Misc enhancements.

- Use GST_WARNING rather than g_critical

- Replace gst_ghost_pad_new_from_template() with
  gst_ghost_pad_new() to avoid using the template.

- Declare extern variable

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1405>
This commit is contained in:
Víctor Manuel Jáquez Leal 2021-12-01 15:36:44 +01:00
parent 90df5b5ab8
commit d10ad61891

View file

@ -118,6 +118,8 @@ GST_STATIC_PAD_TEMPLATE ("src",
G_DEFINE_TYPE (GstVaapiDecodeBin, gst_vaapi_decode_bin, GST_TYPE_BIN); G_DEFINE_TYPE (GstVaapiDecodeBin, gst_vaapi_decode_bin, GST_TYPE_BIN);
extern gboolean _gst_vaapi_has_video_processing;
static gboolean gst_vaapi_decode_bin_configure (GstVaapiDecodeBin * self); static gboolean gst_vaapi_decode_bin_configure (GstVaapiDecodeBin * self);
static void static void
@ -409,30 +411,30 @@ gst_vaapi_decode_bin_init (GstVaapiDecodeBin * vaapidecbin)
g_assert (vaapidecbin->decoder); g_assert (vaapidecbin->decoder);
/* create the queue */ /* create the queue */
vaapidecbin->queue = gst_element_factory_make ("queue", "vaapi-queue"); vaapidecbin->queue = gst_element_factory_make ("queue", NULL);
if (!vaapidecbin->queue) { g_assert (vaapidecbin->queue);
gst_clear_object (&vaapidecbin->decoder);
post_missing_element_message (vaapidecbin, "queue");
return;
}
gst_bin_add_many (GST_BIN (vaapidecbin), vaapidecbin->decoder, gst_bin_add_many (GST_BIN (vaapidecbin), vaapidecbin->decoder,
vaapidecbin->queue, NULL); vaapidecbin->queue, NULL);
if (!gst_element_link (vaapidecbin->decoder, vaapidecbin->queue)) { if (!gst_element_link (vaapidecbin->decoder, vaapidecbin->queue)) {
gst_clear_object (&vaapidecbin->decoder); GST_WARNING_OBJECT (vaapidecbin, "Failed to link decoder and queue");
gst_clear_object (&vaapidecbin->queue);
g_critical ("failed to link decoder and queue");
return; return;
} }
/* create ghost pad sink */ /* create ghost pad sink */
pad = gst_element_get_static_pad (vaapidecbin->decoder, "sink"); pad = gst_element_get_static_pad (vaapidecbin->decoder, "sink");
ghostpad = gst_ghost_pad_new_from_template ("sink", pad, if (!pad) {
GST_PAD_PAD_TEMPLATE (pad)); GST_WARNING_OBJECT (vaapidecbin, "Failed to get decoder sink pad");
return;
}
ghostpad = gst_ghost_pad_new ("sink", pad);
gst_object_unref (pad); gst_object_unref (pad);
if (!gst_element_add_pad (GST_ELEMENT (vaapidecbin), ghostpad)) if (!gst_element_add_pad (GST_ELEMENT (vaapidecbin), ghostpad)) {
g_critical ("failed to add decoder sink pad to bin"); GST_WARNING_OBJECT (vaapidecbin, "Failed to add decoder sink pad to bin");
return;
}
/* create ghost pad src */ /* create ghost pad src */
pad = gst_element_get_static_pad (GST_ELEMENT (vaapidecbin->queue), "src"); pad = gst_element_get_static_pad (GST_ELEMENT (vaapidecbin->queue), "src");
@ -440,5 +442,5 @@ gst_vaapi_decode_bin_init (GstVaapiDecodeBin * vaapidecbin)
GST_PAD_PAD_TEMPLATE (pad)); GST_PAD_PAD_TEMPLATE (pad));
gst_object_unref (pad); gst_object_unref (pad);
if (!gst_element_add_pad (GST_ELEMENT (vaapidecbin), ghostpad)) if (!gst_element_add_pad (GST_ELEMENT (vaapidecbin), ghostpad))
g_critical ("failed to add queue source pad to bin"); GST_WARNING_OBJECT (vaapidecbin, "Failed to add queue source pad to bin");
} }