Skip to content

Commit

Permalink
Fix use of undeclared core debug category symbols
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tp-m committed Feb 20, 2016
1 parent ddfe7a2 commit a62c7bd
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 21 deletions.
8 changes: 5 additions & 3 deletions ext/theora/gsttheoradec.c
Expand Up @@ -49,8 +49,8 @@
#include <gst/video/gstvideopool.h>

#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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
19 changes: 16 additions & 3 deletions gst-libs/gst/video/video-frame.c
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions gst/videoconvert/gstvideoconvert.c
Expand Up @@ -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);

Expand Down Expand Up @@ -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));
Expand All @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions gst/videoscale/gstvideoscale.c
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions sys/ximage/ximage.c
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions sys/ximage/ximagesink.c
Expand Up @@ -119,7 +119,7 @@
#include <X11/XKBlib.h>

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
Expand Down Expand Up @@ -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))
Expand Down
1 change: 0 additions & 1 deletion sys/xvimage/xvcontext.c
Expand Up @@ -34,7 +34,6 @@
#include <X11/XKBlib.h>

GST_DEBUG_CATEGORY_EXTERN (gst_debug_xv_context);
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_PERFORMANCE);
#define GST_CAT_DEFAULT gst_debug_xv_context

void
Expand Down
4 changes: 2 additions & 2 deletions sys/xvimage/xvimage.c
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions sys/xvimage/xvimagesink.c
Expand Up @@ -134,7 +134,7 @@
#include <X11/XKBlib.h>

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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit a62c7bd

Please sign in to comment.