From a62c7bd54c9361196dc6e4e9a5fefea0cb6a6893 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 20 Feb 2016 11:31:43 +0000 Subject: [PATCH] Fix use of undeclared core debug category symbols libgstreamer currently exports some debug category symbols GST_CAT_*, but those are not declared in any public headers. Some plugins and libgstvideo just use GST_DEBUG_CATEGORY_EXTERN() to declare and use those, but that's just not right at all, and it won't work on Windows with MSVC. Instead look up the categories via the API. --- ext/theora/gsttheoradec.c | 8 +++++--- gst-libs/gst/video/video-frame.c | 19 ++++++++++++++++--- gst/videoconvert/gstvideoconvert.c | 6 ++++-- gst/videoscale/gstvideoscale.c | 8 ++++---- sys/ximage/ximage.c | 4 ++-- sys/ximage/ximagesink.c | 4 ++-- sys/xvimage/xvcontext.c | 1 - sys/xvimage/xvimage.c | 4 ++-- sys/xvimage/xvimagesink.c | 4 ++-- 9 files changed, 37 insertions(+), 21 deletions(-) diff --git a/ext/theora/gsttheoradec.c b/ext/theora/gsttheoradec.c index 81589c5..0bacaba 100644 --- a/ext/theora/gsttheoradec.c +++ b/ext/theora/gsttheoradec.c @@ -49,8 +49,8 @@ #include #define GST_CAT_DEFAULT theoradec_debug -GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); -GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE); +GST_DEBUG_CATEGORY_STATIC (theoradec_debug); +GST_DEBUG_CATEGORY_STATIC (CAT_PERFORMANCE); #define THEORA_DEF_TELEMETRY_MV 0 #define THEORA_DEF_TELEMETRY_MBMODE 0 @@ -697,7 +697,7 @@ theora_handle_image (GstTheoraDec * dec, th_ycbcr_buffer buf, } /* if only libtheora would allow us to give it a destination frame */ - GST_CAT_TRACE_OBJECT (GST_CAT_PERFORMANCE, dec, + GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, dec, "doing unavoidable video frame copy"); if (G_UNLIKELY (!gst_video_frame_map (&vframe, &dec->uncropped_info, @@ -997,6 +997,8 @@ theora_dec_get_property (GObject * object, guint prop_id, gboolean gst_theora_dec_register (GstPlugin * plugin) { + GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE"); + return gst_element_register (plugin, "theoradec", GST_RANK_PRIMARY, GST_TYPE_THEORA_DEC); } diff --git a/gst-libs/gst/video/video-frame.c b/gst-libs/gst/video/video-frame.c index 9323784..3e6f70d 100644 --- a/gst-libs/gst/video/video-frame.c +++ b/gst-libs/gst/video/video-frame.c @@ -31,7 +31,21 @@ #include "video-tile.h" #include "gstvideometa.h" -GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE); +#define CAT_PERFORMANCE video_frame_get_perf_category() + +static inline GstDebugCategory * +video_frame_get_perf_category (void) +{ + static GstDebugCategory *cat = NULL; + + if (g_once_init_enter (&cat)) { + GstDebugCategory *c; + + GST_DEBUG_CATEGORY_GET (c, "GST_PERFORMANCE"); + g_once_init_leave (&cat, c); + } + return cat; +} /** * gst_video_frame_map_id: @@ -316,8 +330,7 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src, } else { guint j; - GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy plane %d, w:%d h:%d ", plane, w, - h); + GST_CAT_DEBUG (CAT_PERFORMANCE, "copy plane %d, w:%d h:%d ", plane, w, h); for (j = 0; j < h; j++) { memcpy (dp, sp, w); diff --git a/gst/videoconvert/gstvideoconvert.c b/gst/videoconvert/gstvideoconvert.c index 11d560d..66e388c 100644 --- a/gst/videoconvert/gstvideoconvert.c +++ b/gst/videoconvert/gstvideoconvert.c @@ -49,7 +49,7 @@ GST_DEBUG_CATEGORY (videoconvert_debug); #define GST_CAT_DEFAULT videoconvert_debug -GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE); +GST_DEBUG_CATEGORY_STATIC (CAT_PERFORMANCE); GType gst_video_convert_get_type (void); @@ -684,7 +684,7 @@ gst_video_convert_transform_frame (GstVideoFilter * filter, space = GST_VIDEO_CONVERT_CAST (filter); - GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, filter, + GST_CAT_DEBUG_OBJECT (CAT_PERFORMANCE, filter, "doing colorspace conversion from %s -> to %s", GST_VIDEO_INFO_NAME (&filter->in_info), GST_VIDEO_INFO_NAME (&filter->out_info)); @@ -700,6 +700,8 @@ 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", diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 871717b..b033151 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -80,7 +80,7 @@ #define GST_CAT_DEFAULT video_scale_debug GST_DEBUG_CATEGORY_STATIC (video_scale_debug); -GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE); +GST_DEBUG_CATEGORY_STATIC (CAT_PERFORMANCE); #define DEFAULT_PROP_METHOD GST_VIDEO_SCALE_BILINEAR #define DEFAULT_PROP_ADD_BORDERS TRUE @@ -517,7 +517,7 @@ gst_video_scale_set_info (GstVideoFilter * filter, GstCaps * in, gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter), TRUE); } else { GstStructure *options; - GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, filter, "setup videoscaling"); + GST_CAT_DEBUG_OBJECT (CAT_PERFORMANCE, filter, "setup videoscaling"); gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter), FALSE); options = gst_structure_new_empty ("videoscale"); @@ -1079,7 +1079,7 @@ gst_video_scale_transform_frame (GstVideoFilter * filter, GstVideoScale *videoscale = GST_VIDEO_SCALE_CAST (filter); GstFlowReturn ret = GST_FLOW_OK; - GST_CAT_DEBUG_OBJECT (GST_CAT_PERFORMANCE, filter, "doing video scaling"); + GST_CAT_DEBUG_OBJECT (CAT_PERFORMANCE, filter, "doing video scaling"); gst_video_converter_frame (videoscale->convert, in_frame, out_frame); @@ -1134,7 +1134,7 @@ plugin_init (GstPlugin * plugin) GST_DEBUG_CATEGORY_INIT (video_scale_debug, "videoscale", 0, "videoscale element"); - GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); + GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE"); return TRUE; } diff --git a/sys/ximage/ximage.c b/sys/ximage/ximage.c index 7b92601..4ccaa7f 100644 --- a/sys/ximage/ximage.c +++ b/sys/ximage/ximage.c @@ -25,7 +25,7 @@ GST_DEBUG_CATEGORY (gst_debug_x_image_pool); GST_DEBUG_CATEGORY (gst_debug_x_image_sink); -GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE); +GST_DEBUG_CATEGORY (CAT_PERFORMANCE); static gboolean plugin_init (GstPlugin * plugin) @@ -39,7 +39,7 @@ plugin_init (GstPlugin * plugin) GST_DEBUG_CATEGORY_INIT (gst_debug_x_image_pool, "ximagepool", 0, "ximagepool object"); - GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); + GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE"); return TRUE; } diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index b95be65..d2c8c81 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -119,7 +119,7 @@ #include GST_DEBUG_CATEGORY_EXTERN (gst_debug_x_image_sink); -GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE); +GST_DEBUG_CATEGORY_EXTERN (CAT_PERFORMANCE); #define GST_CAT_DEFAULT gst_debug_x_image_sink typedef struct @@ -1370,7 +1370,7 @@ gst_x_image_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf) if (res != GST_FLOW_OK) goto no_buffer; - GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, ximagesink, + GST_CAT_LOG_OBJECT (CAT_PERFORMANCE, ximagesink, "slow copy into bufferpool buffer %p", to_put); if (!gst_video_frame_map (&src, &ximagesink->info, buf, GST_MAP_READ)) diff --git a/sys/xvimage/xvcontext.c b/sys/xvimage/xvcontext.c index 6994db3..ec87cc8 100644 --- a/sys/xvimage/xvcontext.c +++ b/sys/xvimage/xvcontext.c @@ -34,7 +34,6 @@ #include GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_context); -GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE); #define GST_CAT_DEFAULT gst_debug_xv_context void diff --git a/sys/xvimage/xvimage.c b/sys/xvimage/xvimage.c index 5f2e208..66bd180 100644 --- a/sys/xvimage/xvimage.c +++ b/sys/xvimage/xvimage.c @@ -26,7 +26,7 @@ GST_DEBUG_CATEGORY (gst_debug_xv_context); GST_DEBUG_CATEGORY (gst_debug_xv_image_pool); GST_DEBUG_CATEGORY (gst_debug_xv_image_sink); -GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE); +GST_DEBUG_CATEGORY (CAT_PERFORMANCE); static gboolean plugin_init (GstPlugin * plugin) @@ -42,7 +42,7 @@ plugin_init (GstPlugin * plugin) GST_DEBUG_CATEGORY_INIT (gst_debug_xv_image_pool, "xvimagepool", 0, "xvimagepool object"); - GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); + GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE"); return TRUE; } diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index c48037e..c612076 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -134,7 +134,7 @@ #include GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_image_sink); -GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE); +GST_DEBUG_CATEGORY_EXTERN (CAT_PERFORMANCE); #define GST_CAT_DEFAULT gst_debug_xv_image_sink typedef struct @@ -956,7 +956,7 @@ gst_xv_image_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf) if (res != GST_FLOW_OK) goto no_buffer; - GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, xvimagesink, + GST_CAT_LOG_OBJECT (CAT_PERFORMANCE, xvimagesink, "slow copy buffer %p into bufferpool buffer %p", buf, to_put); if (!gst_video_frame_map (&src, &xvimagesink->info, buf, GST_MAP_READ)) -- 2.7.4