static void _init_debug (void) { static volatile gsize _init = 0; if (g_once_init_enter (&_init)) { GST_DEBUG_CATEGORY_GET (gst_performance, "GST_PERFORMANCE"); GST_DEBUG_CATEGORY_INIT (gst_gl_debug, "gldebug", 0, "OpenGL Debugging"); GST_DEBUG_CATEGORY_GET (default_debug, "default"); g_once_init_leave (&_init, 1); } }
static gboolean plugin_init (GstPlugin * plugin) { GST_DEBUG_CATEGORY_INIT (v4l2_debug, "v4l2", 0, "V4L2 API calls"); GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); if (!gst_element_register (plugin, "v4l2src", GST_RANK_PRIMARY, GST_TYPE_V4L2SRC) || !gst_element_register (plugin, "v4l2sink", GST_RANK_NONE, GST_TYPE_V4L2SINK) || !gst_element_register (plugin, "v4l2radio", GST_RANK_NONE, GST_TYPE_V4L2RADIO) || /* !gst_element_register (plugin, "v4l2jpegsrc", */ /* GST_RANK_NONE, GST_TYPE_V4L2JPEGSRC) || */ /* !gst_element_register (plugin, "v4l2mjpegsrc", */ /* GST_RANK_NONE, GST_TYPE_V4L2MJPEGSRC) || */ /* !gst_element_register (plugin, "v4l2mjpegsink", */ /* GST_RANK_NONE, GST_TYPE_V4L2MJPEGSINK)) */ FALSE) return FALSE; #ifdef ENABLE_NLS setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); #endif /* ENABLE_NLS */ return TRUE; }
/** * gst_gl_display_x11_new_with_display: * @display: an existing, x11 display * * Creates a new display connection from a X11 Display. * * Returns: (transfer full): a new #GstGLDisplayX11 */ GstGLDisplayX11 * gst_gl_display_x11_new_with_display (Display * display) { GstGLDisplayX11 *ret; g_return_val_if_fail (display != NULL, NULL); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL); ret->name = g_strdup (DisplayString (display)); ret->display = display; ret->xcb_connection = XGetXCBConnection (ret->display); if (!ret->xcb_connection) { GST_ERROR ("Failed to open retieve XCB connection from X11 Display"); gst_object_unref (ret); return NULL; } ret->foreign_display = TRUE; return ret; }
/** * gst_gl_display_x11_new: * @name: (allow-none): a display name * * Create a new #GstGLDisplayX11 from the x11 display name. See XOpenDisplay() * for details on what is a valid name. * * Returns: (transfer full): a new #GstGLDisplayX11 or %NULL */ GstGLDisplayX11 * gst_gl_display_x11_new (const gchar * name) { GstGLDisplayX11 *ret; GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL); ret->name = g_strdup (name); ret->display = XOpenDisplay (ret->name); if (!ret->display) { GST_ERROR ("Failed to open X11 display connection with name, \'%s\'", name); gst_object_unref (ret); return NULL; } ret->xcb_connection = XGetXCBConnection (ret->display); if (!ret->xcb_connection) { GST_ERROR ("Failed to open retieve XCB connection from X11 Display"); gst_object_unref (ret); return NULL; } XSetEventQueueOwner (ret->display, XCBOwnsEventQueue); GST_GL_DISPLAY (ret)->event_source = xcb_event_source_new (ret); g_source_attach (GST_GL_DISPLAY (ret)->event_source, GST_GL_DISPLAY (ret)->main_context); return ret; }
static void gst_jpeg_dec_class_init (GstJpegDecClass * klass) { GObjectClass *gobject_class; GstElementClass *element_class; GstVideoDecoderClass *vdec_class; gobject_class = (GObjectClass *) klass; element_class = (GstElementClass *) klass; vdec_class = (GstVideoDecoderClass *) klass; parent_class = g_type_class_peek_parent (klass); gobject_class->finalize = gst_jpeg_dec_finalize; gobject_class->set_property = gst_jpeg_dec_set_property; gobject_class->get_property = gst_jpeg_dec_get_property; g_object_class_install_property (gobject_class, PROP_IDCT_METHOD, g_param_spec_enum ("idct-method", "IDCT Method", "The IDCT algorithm to use", GST_TYPE_IDCT_METHOD, JPEG_DEFAULT_IDCT_METHOD, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstJpegDec:max-errors * * Error out after receiving N consecutive decoding errors * (-1 = never error out, 0 = automatic, 1 = fail on first error, etc.) * * Since: 0.10.27 **/ g_object_class_install_property (gobject_class, PROP_MAX_ERRORS, g_param_spec_int ("max-errors", "Maximum Consecutive Decoding Errors", "Error out after receiving N consecutive decoding errors " "(-1 = never fail, 0 = automatic, 1 = fail on first error)", -1, G_MAXINT, JPEG_DEFAULT_MAX_ERRORS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_jpeg_dec_src_pad_template)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_jpeg_dec_sink_pad_template)); gst_element_class_set_details_simple (element_class, "JPEG image decoder", "Codec/Decoder/Image", "Decode images from JPEG format", "Wim Taymans <*****@*****.**>"); vdec_class->start = gst_jpeg_dec_start; vdec_class->stop = gst_jpeg_dec_stop; vdec_class->reset = gst_jpeg_dec_reset; vdec_class->parse = gst_jpeg_dec_parse; vdec_class->set_format = gst_jpeg_dec_set_format; vdec_class->handle_frame = gst_jpeg_dec_handle_frame; vdec_class->decide_allocation = gst_jpeg_dec_decide_allocation; GST_DEBUG_CATEGORY_INIT (jpeg_dec_debug, "jpegdec", 0, "JPEG decoder"); GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); }
static void _init_debug (void) { static volatile gsize _init = 0; if (g_once_init_enter (&_init)) { GST_DEBUG_CATEGORY_GET (gst_performance, "GST_PERFORMANCE"); g_once_init_leave (&_init, 1); } }
static void gst_gl_display_context_prepare (GstElement * element, GstGLDisplay ** display_ptr) { GstContext *ctxt; GstQuery *query; if (!GST_CAT_CONTEXT) GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"); /* 2a) Query downstream with GST_QUERY_CONTEXT for the context and * check if downstream already has a context of the specific type * 2b) Query upstream as above. */ ctxt = NULL; query = gst_query_new_context (GST_GL_DISPLAY_CONTEXT_TYPE); if (run_context_query (element, query, GST_PAD_SRC)) { GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element, "found context (%p) in downstream query", ctxt); gst_query_parse_context (query, &ctxt); } else if (run_context_query (element, query, GST_PAD_SINK)) { GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element, "found context (%p) in upstream query", ctxt); gst_query_parse_context (query, &ctxt); } else { /* 3) Post a GST_MESSAGE_NEED_CONTEXT message on the bus with * the required context type and afterwards check if a * usable context was set now as in 1). The message could * be handled by the parent bins of the element and the * application. */ GstMessage *msg; GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element, "posting need context message"); msg = gst_message_new_need_context (GST_OBJECT_CAST (element), GST_GL_DISPLAY_CONTEXT_TYPE); gst_element_post_message (element, msg); } /* * Whomever responds to the need-context message performs a * GstElement::set_context() with the required context in which the element * is required to update the display_ptr or call gst_gl_handle_set_context(). */ if (ctxt) { if (gst_context_has_context_type (ctxt, GST_GL_DISPLAY_CONTEXT_TYPE)) { gst_context_get_gl_display (ctxt, display_ptr); } } gst_query_unref (query); }
static void _init_debug (void) { static volatile gsize _init = 0; if (g_once_init_enter (&_init)) { GST_DEBUG_CATEGORY_INIT (gst_gl_context_debug, "glcontext", 0, "glcontext element"); GST_DEBUG_CATEGORY_GET (gst_performance, "GST_PERFORMANCE"); g_once_init_leave (&_init, 1); } }
static void _init_context_debug (void) { #ifndef GST_DISABLE_GST_DEBUG static volatile gsize _init = 0; if (g_once_init_enter (&_init)) { GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"); g_once_init_leave (&_init, 1); } #endif }
static gboolean plugin_init (GstPlugin * plugin) { GST_DEBUG_CATEGORY_INIT (videoconvert_debug, "videoconvert", 0, "Colorspace Converter"); GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE"); _colorspace_quark = g_quark_from_static_string ("colorspace"); return gst_element_register (plugin, "videoconvert", GST_RANK_NONE, GST_TYPE_VIDEO_CONVERT); }
static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "videoscale", GST_RANK_NONE, GST_TYPE_VIDEO_SCALE)) return FALSE; GST_DEBUG_CATEGORY_INIT (video_scale_debug, "videoscale", 0, "videoscale element"); GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE"); return TRUE; }
/** * gst_gl_display_egl_from_gl_display: * @display: an existing #GstGLDisplay * * Creates a EGL display connection from a native Display. * * This function will return the same value for multiple calls with the same * @display. * * Returns: (transfer full): a new #GstGLDisplayEGL * * Since: 1.12 */ GstGLDisplayEGL * gst_gl_display_egl_from_gl_display (GstGLDisplay * display) { GstGLDisplayEGL *ret; GstGLDisplayType display_type; guintptr native_display; g_return_val_if_fail (GST_IS_GL_DISPLAY (display), NULL); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); if (GST_IS_GL_DISPLAY_EGL (display)) { GST_LOG_OBJECT (display, "display %" GST_PTR_FORMAT "is already a " "GstGLDisplayEGL", display); return gst_object_ref (display); } /* try to get a previously set GstGLDisplayEGL */ ret = g_object_dup_data (G_OBJECT (display), GST_GL_DISPLAY_EGL_NAME, (GDuplicateFunc) _ref_if_set, NULL); if (ret && GST_IS_GL_DISPLAY_EGL (ret)) { GST_LOG_OBJECT (display, "display %" GST_PTR_FORMAT "already has a " "GstGLDisplayEGL %" GST_PTR_FORMAT, display, ret); return ret; } if (ret) gst_object_unref (ret); display_type = gst_gl_display_get_handle_type (display); native_display = gst_gl_display_get_handle (display); g_return_val_if_fail (native_display != 0, NULL); g_return_val_if_fail (display_type != GST_GL_DISPLAY_TYPE_NONE, NULL); ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL); ret->display = gst_gl_display_egl_get_from_native (display_type, native_display); if (!ret->display) { GST_WARNING_OBJECT (ret, "failed to get EGLDisplay from native display"); gst_object_unref (ret); return NULL; } g_object_set_data_full (G_OBJECT (display), GST_GL_DISPLAY_EGL_NAME, gst_object_ref (ret), (GDestroyNotify) gst_object_unref); return ret; }
static gboolean plugin_init (GstPlugin * plugin) { if (!gst_element_register (plugin, "xvimagesink", GST_RANK_PRIMARY, GST_TYPE_XVIMAGESINK)) return FALSE; GST_DEBUG_CATEGORY_INIT (gst_debug_xvimagesink, "xvimagesink", 0, "xvimagesink element"); GST_DEBUG_CATEGORY_INIT (gst_debug_xvimagepool, "xvimagepool", 0, "xvimagepool object"); GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); return TRUE; }
/** * gst_gl_display_egl_new: * @name: (allow-none): a display name * * Create a new #GstGLDisplayEGL from the x11 display name. See XOpenDisplay() * for details on what is a valid name. * * Returns: (transfer full): a new #GstGLDisplayEGL or %NULL */ GstGLDisplayEGL * gst_gl_display_egl_new (void) { GstGLDisplayEGL *ret; GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL); ret->display = eglGetDisplay ((EGLNativeDisplayType) EGL_DEFAULT_DISPLAY); if (!ret->display) { GST_ERROR ("Failed to open EGL display connection"); } return ret; }
/** * gst_gl_display_egl_new_with_display: * @display: an existing, x11 display * * Creates a new display connection from a X11 Display. * * Returns: (transfer full): a new #GstGLDisplayEGL */ GstGLDisplayEGL * gst_gl_display_egl_new_with_egl_display (EGLDisplay display) { GstGLDisplayEGL *ret; g_return_val_if_fail (display != NULL, NULL); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL); ret->display = display; ret->foreign_display = TRUE; return ret; }
/** * gst_gl_display_x11_new: * @name: (allow-none): a display name * * Create a new #GstGLDisplayX11 from the x11 display name. See XOpenDisplay() * for details on what is a valid name. * * Returns: (transfer full): a new #GstGLDisplayX11 or %NULL */ GstGLDisplayX11 * gst_gl_display_x11_new (const gchar * name) { GstGLDisplayX11 *ret; GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL); ret->name = g_strdup (name); ret->display = XOpenDisplay (ret->name); if (!ret->display) { GST_ERROR ("Failed to open X11 display connection with name, \'%s\'", name); } return ret; }
/** * gst_gl_display_x11_new_with_display: * @display: an existing, x11 display * * Creates a new display connection from a X11 Display. * * Returns: (transfer full): a new #GstGLDisplayX11 */ GstGLDisplayX11 * gst_gl_display_x11_new_with_display (Display * display) { GstGLDisplayX11 *ret; g_return_val_if_fail (display != NULL, NULL); GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); ret = g_object_new (GST_TYPE_GL_DISPLAY_X11, NULL); ret->name = g_strdup (DisplayString (display)); ret->display = display; ret->foreign_display = TRUE; return ret; }
/** * gst_gl_display_egl_new: * * Create a new #GstGLDisplayEGL using the default EGL_DEFAULT_DISPLAY. * * Returns: (transfer full): a new #GstGLDisplayEGL or %NULL */ GstGLDisplayEGL * gst_gl_display_egl_new (void) { GstGLDisplayEGL *ret; GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); ret = g_object_new (GST_TYPE_GL_DISPLAY_EGL, NULL); ret->display = gst_gl_display_egl_get_from_native (GST_GL_DISPLAY_TYPE_ANY, 0); if (!ret->display) { GST_ERROR ("Failed to open EGL display connection"); } return ret; }
/** * gst_vdp_video_memory_init: * * Initializes the GL Memory allocator. It is safe to call this function * multiple times. This must be called before any other GstVdpVideoMemory operation. */ void gst_vdp_video_memory_init (void) { static volatile gsize _init = 0; if (g_once_init_enter (&_init)) { _vdp_video_allocator = g_object_new (gst_vdp_video_allocator_get_type (), NULL); gst_allocator_register (GST_VDP_VIDEO_MEMORY_ALLOCATOR, gst_object_ref (_vdp_video_allocator)); GST_DEBUG_CATEGORY_INIT (gst_vdp_video_mem_debug, "vdpvideomem", 0, "VDPAU VideoSurface Memory/Allocator"); GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); g_once_init_leave (&_init, 1); } }
/** * gst_vulkan_display_xcb_new_with_connection: * @display: an existing, xcb display * * Creates a new display connection from a XCB Display. * * Returns: (transfer full): a new #GstVulkanDisplayXCB */ GstVulkanDisplayXCB * gst_vulkan_display_xcb_new_with_connection (xcb_connection_t * connection, int screen_no) { GstVulkanDisplayXCB *ret; g_return_val_if_fail (connection != NULL, NULL); GST_DEBUG_CATEGORY_GET (gst_vulkan_display_debug, "gldisplay"); ret = g_object_new (GST_TYPE_VULKAN_DISPLAY_XCB, NULL); ret->connection = connection; ret->screen = _get_screen_from_connection (connection, screen_no); ret->root_window = ret->screen->root; ret->foreign_display = TRUE; return ret; }
static void gst_gl_display_context_query (GstElement * element, GstGLDisplay ** display_ptr) { GstContext *ctxt; GstQuery *query; #ifndef GST_DISABLE_GST_DEBUG if (!GST_CAT_CONTEXT) GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"); #endif query = _gst_context_query (element, display_ptr, GST_GL_DISPLAY_CONTEXT_TYPE); gst_query_parse_context (query, &ctxt); if (ctxt && gst_context_has_context_type (ctxt, GST_GL_DISPLAY_CONTEXT_TYPE)) gst_context_get_gl_display (ctxt, display_ptr); if (*display_ptr) goto out; #if GST_GL_HAVE_WINDOW_X11 gst_query_unref (query); query = _gst_context_query (element, display_ptr, "gst.x11.display.handle"); gst_query_parse_context (query, &ctxt); if (ctxt && gst_context_has_context_type (ctxt, "gst.x11.display.handle")) { const GstStructure *s; Display *display; s = gst_context_get_structure (ctxt); if (gst_structure_get (s, "display", G_TYPE_POINTER, &display, NULL) && display) { *display_ptr = (GstGLDisplay *) gst_gl_display_x11_new_with_display (display); } } if (*display_ptr) goto out; #endif out: gst_query_unref (query); }
static void gst_gl_context_query (GstElement * element, GstGLContext ** context_ptr) { GstContext *ctxt; GstQuery *query; #ifndef GST_DISABLE_GST_DEBUG if (!GST_CAT_CONTEXT) GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT"); #endif query = _gst_context_query (element, context_ptr, "gst.gl.app_context"); gst_query_parse_context (query, &ctxt); if (ctxt && gst_context_has_context_type (ctxt, "gst.gl.app_context")) { const GstStructure *s = gst_context_get_structure (ctxt); gst_structure_get (s, "context", GST_GL_TYPE_CONTEXT, context_ptr, NULL); } gst_query_unref (query); }
/** * gst_vulkan_display_xcb_new: * @name: (allow-none): a display name * * Create a new #GstVulkanDisplayXCB from the xcb display name. See XOpenDisplay() * for details on what is a valid name. * * Returns: (transfer full): a new #GstVulkanDisplayXCB or %NULL */ GstVulkanDisplayXCB * gst_vulkan_display_xcb_new (const gchar * name) { xcb_connection_t *connection; GstVulkanDisplayXCB *ret; int screen_no = 0; GST_DEBUG_CATEGORY_GET (gst_vulkan_display_debug, "gldisplay"); connection = xcb_connect (NULL, &screen_no); if (connection == NULL || xcb_connection_has_error (connection)) { GST_ERROR ("Failed to open XCB display connection with name, \'%s\'", name); return NULL; } ret = gst_vulkan_display_xcb_new_with_connection (connection, screen_no); GST_VULKAN_DISPLAY (ret)->event_source = xcb_event_source_new (ret); g_source_attach (GST_VULKAN_DISPLAY (ret)->event_source, GST_VULKAN_DISPLAY (ret)->main_context); ret->foreign_display = FALSE; return ret; }