guint chroma_format_idc;
GstVideoFormat out_format;
-#ifdef HAVE_NVCODEC_GST_GL
- GstGLDisplay *gl_display;
- GstGLContext *gl_context;
- GstGLContext *other_gl_context;
-#endif
+ /* For OpenGL interop. */
+ GstObject *gl_display;
+ GstObject *gl_context;
+ GstObject *other_gl_context;
GstNvDecoderOutputType output_type;
};
goto done;
}
#ifdef HAVE_NVCODEC_GST_GL
- gst_gl_handle_set_context (element, context, &self->gl_display,
- &self->other_gl_context);
+ gst_gl_handle_set_context (element, context,
+ (GstGLDisplay **) & self->gl_display,
+ (GstGLContext **) & self->other_gl_context);
#endif
done:
}
#if HAVE_NVCODEC_GST_GL
gst_gl_ensure_element_data (GST_ELEMENT (self),
- &self->gl_display, &self->other_gl_context);
+ (GstGLDisplay **) & self->gl_display,
+ (GstGLContext **) & self->other_gl_context);
if (self->gl_display)
gst_gl_display_filter_gl_api (GST_GL_DISPLAY (self->gl_display),
SUPPORTED_GL_APIS);
gst_cuda_context_pop (NULL);
}
}
-#ifdef HAVE_NVCODEC_GST_GL
+
gst_clear_object (&self->gl_context);
gst_clear_object (&self->other_gl_context);
gst_clear_object (&self->gl_display);
-#endif
-
gst_clear_object (&self->context);
self->cuda_stream = NULL;
gst_nv_h264_dec_ensure_gl_context (GstNvH264Dec * self)
{
gboolean ret;
+ GstGLDisplay *display;
+ GstGLContext *context;
if (!self->gl_display) {
GST_DEBUG_OBJECT (self, "No available OpenGL display");
return FALSE;
}
+ display = GST_GL_DISPLAY (self->gl_display);
+
if (!gst_gl_query_local_gl_context (GST_ELEMENT (self), GST_PAD_SRC,
- &self->gl_context)) {
+ (GstGLContext **) & self->gl_context)) {
GST_INFO_OBJECT (self, "failed to query local OpenGL context");
- if (self->gl_context)
- gst_object_unref (self->gl_context);
+
+ gst_clear_object (&self->gl_context);
self->gl_context =
- gst_gl_display_get_gl_context_for_thread (self->gl_display, NULL);
+ (GstObject *) gst_gl_display_get_gl_context_for_thread (display, NULL);
if (!self->gl_context
- || !gst_gl_display_add_context (self->gl_display, self->gl_context)) {
- if (self->gl_context)
- gst_object_unref (self->gl_context);
- if (!gst_gl_display_create_context (self->gl_display,
- self->other_gl_context, &self->gl_context, NULL)) {
+ || !gst_gl_display_add_context (display,
+ GST_GL_CONTEXT (self->gl_context))) {
+ gst_clear_object (&self->gl_context);
+ if (!gst_gl_display_create_context (display,
+ (GstGLContext *) self->other_gl_context,
+ (GstGLContext **) & self->gl_context, NULL)) {
GST_ERROR_OBJECT (self, "failed to create OpenGL context");
return FALSE;
}
- if (!gst_gl_display_add_context (self->gl_display, self->gl_context)) {
+
+ if (!gst_gl_display_add_context (display,
+ (GstGLContext *) self->gl_context)) {
GST_ERROR_OBJECT (self,
"failed to add the OpenGL context to the display");
return FALSE;
}
}
- if (!gst_gl_context_check_gl_version (self->gl_context,
- SUPPORTED_GL_APIS, 3, 0)) {
+ context = GST_GL_CONTEXT (self->gl_context);
+
+ if (!gst_gl_context_check_gl_version (context, SUPPORTED_GL_APIS, 3, 0)) {
GST_WARNING_OBJECT (self, "OpenGL context could not support PBO download");
return FALSE;
}
- gst_gl_context_thread_add (self->gl_context,
+ gst_gl_context_thread_add (context,
(GstGLContextThreadFunc) gst_nv_h264_dec_check_cuda_device_from_context,
&ret);
return TRUE;
}
-
#endif
static gboolean
}
if (!pool) {
- pool = gst_gl_buffer_pool_new (self->gl_context);
+ pool = gst_gl_buffer_pool_new (GST_GL_CONTEXT (self->gl_context));
if (outcaps)
gst_video_info_from_caps (&vinfo, outcaps);
}
#ifdef HAVE_NVCODEC_GST_GL
if (gst_gl_handle_context_query (GST_ELEMENT (decoder), query,
- self->gl_display, self->gl_context, self->other_gl_context)) {
+ (GstGLDisplay *) self->gl_display,
+ (GstGLContext *) self->gl_context,
+ (GstGLContext *) self->other_gl_context)) {
if (self->gl_display)
gst_gl_display_filter_gl_api (GST_GL_DISPLAY (self->gl_display),
SUPPORTED_GL_APIS);