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.
This commit is contained in:
Tim-Philipp Müller 2016-02-20 11:31:43 +00:00
parent ddfe7a2808
commit a62c7bd54c
9 changed files with 37 additions and 21 deletions

View file

@ -49,8 +49,8 @@
#include <gst/video/gstvideopool.h> #include <gst/video/gstvideopool.h>
#define GST_CAT_DEFAULT theoradec_debug #define GST_CAT_DEFAULT theoradec_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); GST_DEBUG_CATEGORY_STATIC (theoradec_debug);
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE); GST_DEBUG_CATEGORY_STATIC (CAT_PERFORMANCE);
#define THEORA_DEF_TELEMETRY_MV 0 #define THEORA_DEF_TELEMETRY_MV 0
#define THEORA_DEF_TELEMETRY_MBMODE 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 */ /* 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"); "doing unavoidable video frame copy");
if (G_UNLIKELY (!gst_video_frame_map (&vframe, &dec->uncropped_info, 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 gboolean
gst_theora_dec_register (GstPlugin * plugin) gst_theora_dec_register (GstPlugin * plugin)
{ {
GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE");
return gst_element_register (plugin, "theoradec", return gst_element_register (plugin, "theoradec",
GST_RANK_PRIMARY, GST_TYPE_THEORA_DEC); GST_RANK_PRIMARY, GST_TYPE_THEORA_DEC);
} }

View file

@ -31,7 +31,21 @@
#include "video-tile.h" #include "video-tile.h"
#include "gstvideometa.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: * gst_video_frame_map_id:
@ -316,8 +330,7 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src,
} else { } else {
guint j; guint j;
GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy plane %d, w:%d h:%d ", plane, w, GST_CAT_DEBUG (CAT_PERFORMANCE, "copy plane %d, w:%d h:%d ", plane, w, h);
h);
for (j = 0; j < h; j++) { for (j = 0; j < h; j++) {
memcpy (dp, sp, w); memcpy (dp, sp, w);

View file

@ -49,7 +49,7 @@
GST_DEBUG_CATEGORY (videoconvert_debug); GST_DEBUG_CATEGORY (videoconvert_debug);
#define GST_CAT_DEFAULT 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); GType gst_video_convert_get_type (void);
@ -684,7 +684,7 @@ gst_video_convert_transform_frame (GstVideoFilter * filter,
space = GST_VIDEO_CONVERT_CAST (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", "doing colorspace conversion from %s -> to %s",
GST_VIDEO_INFO_NAME (&filter->in_info), GST_VIDEO_INFO_NAME (&filter->in_info),
GST_VIDEO_INFO_NAME (&filter->out_info)); GST_VIDEO_INFO_NAME (&filter->out_info));
@ -700,6 +700,8 @@ plugin_init (GstPlugin * plugin)
GST_DEBUG_CATEGORY_INIT (videoconvert_debug, "videoconvert", 0, GST_DEBUG_CATEGORY_INIT (videoconvert_debug, "videoconvert", 0,
"Colorspace Converter"); "Colorspace Converter");
GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE");
_colorspace_quark = g_quark_from_static_string ("colorspace"); _colorspace_quark = g_quark_from_static_string ("colorspace");
return gst_element_register (plugin, "videoconvert", return gst_element_register (plugin, "videoconvert",

View file

@ -80,7 +80,7 @@
#define GST_CAT_DEFAULT video_scale_debug #define GST_CAT_DEFAULT video_scale_debug
GST_DEBUG_CATEGORY_STATIC (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_METHOD GST_VIDEO_SCALE_BILINEAR
#define DEFAULT_PROP_ADD_BORDERS TRUE #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); gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter), TRUE);
} else { } else {
GstStructure *options; 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); gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter), FALSE);
options = gst_structure_new_empty ("videoscale"); options = gst_structure_new_empty ("videoscale");
@ -1079,7 +1079,7 @@ gst_video_scale_transform_frame (GstVideoFilter * filter,
GstVideoScale *videoscale = GST_VIDEO_SCALE_CAST (filter); GstVideoScale *videoscale = GST_VIDEO_SCALE_CAST (filter);
GstFlowReturn ret = GST_FLOW_OK; 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); 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, GST_DEBUG_CATEGORY_INIT (video_scale_debug, "videoscale", 0,
"videoscale element"); "videoscale element");
GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE");
return TRUE; return TRUE;
} }

View file

@ -25,7 +25,7 @@
GST_DEBUG_CATEGORY (gst_debug_x_image_pool); GST_DEBUG_CATEGORY (gst_debug_x_image_pool);
GST_DEBUG_CATEGORY (gst_debug_x_image_sink); GST_DEBUG_CATEGORY (gst_debug_x_image_sink);
GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE); GST_DEBUG_CATEGORY (CAT_PERFORMANCE);
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
@ -39,7 +39,7 @@ plugin_init (GstPlugin * plugin)
GST_DEBUG_CATEGORY_INIT (gst_debug_x_image_pool, "ximagepool", 0, GST_DEBUG_CATEGORY_INIT (gst_debug_x_image_pool, "ximagepool", 0,
"ximagepool object"); "ximagepool object");
GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE");
return TRUE; return TRUE;
} }

View file

@ -119,7 +119,7 @@
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
GST_DEBUG_CATEGORY_EXTERN (gst_debug_x_image_sink); 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 #define GST_CAT_DEFAULT gst_debug_x_image_sink
typedef struct typedef struct
@ -1370,7 +1370,7 @@ gst_x_image_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
if (res != GST_FLOW_OK) if (res != GST_FLOW_OK)
goto no_buffer; 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); "slow copy into bufferpool buffer %p", to_put);
if (!gst_video_frame_map (&src, &ximagesink->info, buf, GST_MAP_READ)) if (!gst_video_frame_map (&src, &ximagesink->info, buf, GST_MAP_READ))

View file

@ -34,7 +34,6 @@
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_context); GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_context);
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
#define GST_CAT_DEFAULT gst_debug_xv_context #define GST_CAT_DEFAULT gst_debug_xv_context
void void

View file

@ -26,7 +26,7 @@
GST_DEBUG_CATEGORY (gst_debug_xv_context); GST_DEBUG_CATEGORY (gst_debug_xv_context);
GST_DEBUG_CATEGORY (gst_debug_xv_image_pool); GST_DEBUG_CATEGORY (gst_debug_xv_image_pool);
GST_DEBUG_CATEGORY (gst_debug_xv_image_sink); GST_DEBUG_CATEGORY (gst_debug_xv_image_sink);
GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE); GST_DEBUG_CATEGORY (CAT_PERFORMANCE);
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
@ -42,7 +42,7 @@ plugin_init (GstPlugin * plugin)
GST_DEBUG_CATEGORY_INIT (gst_debug_xv_image_pool, "xvimagepool", 0, GST_DEBUG_CATEGORY_INIT (gst_debug_xv_image_pool, "xvimagepool", 0,
"xvimagepool object"); "xvimagepool object");
GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); GST_DEBUG_CATEGORY_GET (CAT_PERFORMANCE, "GST_PERFORMANCE");
return TRUE; return TRUE;
} }

View file

@ -134,7 +134,7 @@
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_image_sink); 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 #define GST_CAT_DEFAULT gst_debug_xv_image_sink
typedef struct typedef struct
@ -956,7 +956,7 @@ gst_xv_image_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
if (res != GST_FLOW_OK) if (res != GST_FLOW_OK)
goto no_buffer; 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); "slow copy buffer %p into bufferpool buffer %p", buf, to_put);
if (!gst_video_frame_map (&src, &xvimagesink->info, buf, GST_MAP_READ)) if (!gst_video_frame_map (&src, &xvimagesink->info, buf, GST_MAP_READ))