mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-06-13 19:49:28 +00:00
msdk: sink context reference
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6398>
This commit is contained in:
parent
c83b69d146
commit
3b4b979ec4
|
@ -412,6 +412,7 @@ GstMsdkContext *
|
||||||
gst_msdk_context_new (gboolean hardware)
|
gst_msdk_context_new (gboolean hardware)
|
||||||
{
|
{
|
||||||
GstMsdkContext *obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
GstMsdkContext *obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
||||||
|
gst_object_ref_sink (obj);
|
||||||
|
|
||||||
if (obj && !gst_msdk_context_open (obj, hardware)) {
|
if (obj && !gst_msdk_context_open (obj, hardware)) {
|
||||||
gst_object_unref (obj);
|
gst_object_unref (obj);
|
||||||
|
@ -437,15 +438,18 @@ GstMsdkContext *
|
||||||
gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
||||||
{
|
{
|
||||||
mfxStatus status;
|
mfxStatus status;
|
||||||
GstMsdkContext *obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
GstMsdkContext *obj;
|
||||||
GstMsdkContextPrivate *priv = obj->priv;
|
GstMsdkContextPrivate *priv;
|
||||||
GstMsdkContextPrivate *parent_priv = parent->priv;
|
GstMsdkContextPrivate *parent_priv;
|
||||||
mfxVersion version;
|
mfxVersion version;
|
||||||
mfxIMPL impl;
|
mfxIMPL impl;
|
||||||
MsdkSession child_msdk_session;
|
MsdkSession child_msdk_session;
|
||||||
mfxHandleType handle_type = 0;
|
mfxHandleType handle_type = 0;
|
||||||
mfxHDL handle = NULL, hardware_handle = NULL;
|
mfxHDL handle = NULL, hardware_handle = NULL;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_MSDK_CONTEXT (parent), NULL);
|
||||||
|
|
||||||
|
parent_priv = parent->priv;
|
||||||
status = MFXQueryIMPL (parent_priv->session.session, &impl);
|
status = MFXQueryIMPL (parent_priv->session.session, &impl);
|
||||||
|
|
||||||
if (status == MFX_ERR_NONE)
|
if (status == MFX_ERR_NONE)
|
||||||
|
@ -454,7 +458,6 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
||||||
if (status != MFX_ERR_NONE) {
|
if (status != MFX_ERR_NONE) {
|
||||||
GST_ERROR ("Failed to query the session attributes (%s)",
|
GST_ERROR ("Failed to query the session attributes (%s)",
|
||||||
msdk_status_to_string (status));
|
msdk_status_to_string (status));
|
||||||
gst_object_unref (obj);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +474,6 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
||||||
if (status != MFX_ERR_NONE || !handle) {
|
if (status != MFX_ERR_NONE || !handle) {
|
||||||
GST_ERROR ("Failed to get session handle (%s)",
|
GST_ERROR ("Failed to get session handle (%s)",
|
||||||
msdk_status_to_string (status));
|
msdk_status_to_string (status));
|
||||||
gst_object_unref (obj);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,7 +490,6 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
||||||
if (status != MFX_ERR_NONE) {
|
if (status != MFX_ERR_NONE) {
|
||||||
GST_ERROR ("Failed to create a child mfx session (%s)",
|
GST_ERROR ("Failed to create a child mfx session (%s)",
|
||||||
msdk_status_to_string (status));
|
msdk_status_to_string (status));
|
||||||
gst_object_unref (obj);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +502,6 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
||||||
GST_ERROR ("Failed to set a HW handle (%s)",
|
GST_ERROR ("Failed to set a HW handle (%s)",
|
||||||
msdk_status_to_string (status));
|
msdk_status_to_string (status));
|
||||||
MFXClose (child_msdk_session.session);
|
MFXClose (child_msdk_session.session);
|
||||||
gst_object_unref (obj);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,11 +513,14 @@ gst_msdk_context_new_with_parent (GstMsdkContext * parent)
|
||||||
GST_ERROR ("Failed to join two sessions (%s)",
|
GST_ERROR ("Failed to join two sessions (%s)",
|
||||||
msdk_status_to_string (status));
|
msdk_status_to_string (status));
|
||||||
MFXClose (child_msdk_session.session);
|
MFXClose (child_msdk_session.session);
|
||||||
gst_object_unref (obj);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
||||||
|
gst_object_ref_sink (obj);
|
||||||
|
priv = obj->priv;
|
||||||
|
|
||||||
/* Set loader to NULL for child session */
|
/* Set loader to NULL for child session */
|
||||||
priv->session.loader = NULL;
|
priv->session.loader = NULL;
|
||||||
priv->session.session = child_msdk_session.session;
|
priv->session.session = child_msdk_session.session;
|
||||||
|
@ -553,6 +556,7 @@ gst_msdk_context_new_with_va_display (GstObject * display_obj,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
||||||
|
gst_object_ref_sink (obj);
|
||||||
|
|
||||||
priv = obj->priv;
|
priv = obj->priv;
|
||||||
priv->display = gst_object_ref (va_display);
|
priv->display = gst_object_ref (va_display);
|
||||||
|
@ -603,6 +607,7 @@ gst_msdk_context_new_with_d3d11_device (GstD3D11Device * device,
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
obj = g_object_new (GST_TYPE_MSDK_CONTEXT, NULL);
|
||||||
|
gst_object_ref_sink (obj);
|
||||||
|
|
||||||
priv = obj->priv;
|
priv = obj->priv;
|
||||||
priv->device = gst_object_ref (device);
|
priv->device = gst_object_ref (device);
|
||||||
|
|
Loading…
Reference in a new issue