mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
eglglessink: Use gst_element_get_context() wherever possible
This commit is contained in:
parent
68c0d16b2c
commit
95f819109f
1 changed files with 23 additions and 4 deletions
|
@ -1542,9 +1542,17 @@ gst_eglglessink_init_egl_display (GstEglGlesSink * eglglessink)
|
|||
|
||||
GST_OBJECT_LOCK (eglglessink);
|
||||
if (eglglessink->eglglesctx.set_display) {
|
||||
GstContext * context;
|
||||
|
||||
eglglessink->eglglesctx.display =
|
||||
gst_egl_display_ref (eglglessink->eglglesctx.set_display);
|
||||
GST_OBJECT_UNLOCK (eglglessink);
|
||||
context = gst_element_get_context (GST_ELEMENT_CAST (eglglessink));
|
||||
if (!context)
|
||||
context = gst_context_new ();
|
||||
context = gst_context_make_writable (context);
|
||||
gst_context_set_egl_display (context, eglglessink->eglglesctx.display);
|
||||
gst_element_set_context (GST_ELEMENT_CAST (eglglessink), context);
|
||||
} else {
|
||||
GstContext *context;
|
||||
|
||||
|
@ -1562,6 +1570,13 @@ gst_eglglessink_init_egl_display (GstEglGlesSink * eglglessink)
|
|||
|
||||
msg = gst_message_new_have_context (GST_OBJECT (eglglessink), context);
|
||||
gst_element_post_message (GST_ELEMENT_CAST (eglglessink), msg);
|
||||
|
||||
context = gst_element_get_context (GST_ELEMENT_CAST (eglglessink));
|
||||
if (!context)
|
||||
context = gst_context_new ();
|
||||
context = gst_context_make_writable (context);
|
||||
gst_context_set_egl_display (context, eglglessink->eglglesctx.display);
|
||||
gst_element_set_context (GST_ELEMENT_CAST (eglglessink), context);
|
||||
}
|
||||
|
||||
if (!eglInitialize (gst_egl_display_get (eglglessink->eglglesctx.display),
|
||||
|
@ -2618,20 +2633,24 @@ static void
|
|||
gst_eglglessink_set_context (GstElement * element, GstContext * context)
|
||||
{
|
||||
GstEglGlesSink *eglglessink;
|
||||
GstStructure *s;
|
||||
GstEGLDisplay *display = NULL;
|
||||
|
||||
eglglessink = GST_EGLGLESSINK (element);
|
||||
|
||||
s = (GstStructure *) gst_context_get_structure (context);
|
||||
if (gst_structure_get (s, GST_EGL_DISPLAY_CONTEXT_TYPE, GST_TYPE_EGL_DISPLAY,
|
||||
&display, NULL)) {
|
||||
if (gst_context_get_egl_display (context, &display)) {
|
||||
GST_OBJECT_LOCK (eglglessink);
|
||||
if (eglglessink->eglglesctx.set_display)
|
||||
gst_egl_display_unref (eglglessink->eglglesctx.set_display);
|
||||
eglglessink->eglglesctx.set_display = display;
|
||||
GST_OBJECT_UNLOCK (eglglessink);
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (eglglessink);
|
||||
context = gst_context_make_writable (context);
|
||||
gst_context_set_egl_display (context, eglglessink->eglglesctx.display);
|
||||
GST_OBJECT_UNLOCK (eglglessink);
|
||||
|
||||
GST_ELEMENT_CLASS (parent_class)->set_context (element, context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue