From b7e82b27be32167f40e0a5edb4827f7628bbde62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 10 Jun 2012 14:29:58 +0100 Subject: [PATCH] dvdspu: allow debugging of render and highlight rectangles via environment variable Enable debugging of rectangles via GST_DVD_SPU_DEBUG. https://bugzilla.gnome.org/show_bug.cgi?id=667223 Conflicts: gst/dvdspu/gstspu-vobsub-render.c --- gst/dvdspu/gstdvdspu.c | 15 +++++++++++++++ gst/dvdspu/gstdvdspu.h | 8 ++++++++ gst/dvdspu/gstspu-vobsub-render.c | 5 +++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gst/dvdspu/gstdvdspu.c b/gst/dvdspu/gstdvdspu.c index f67e5f6312..b159e37452 100644 --- a/gst/dvdspu/gstdvdspu.c +++ b/gst/dvdspu/gstdvdspu.c @@ -48,6 +48,8 @@ GST_DEBUG_CATEGORY (dvdspu_debug); #define GST_CAT_DEFAULT dvdspu_debug +GstDVDSPUDebugFlags dvdspu_debug_flags; + /* Filter signals and args */ enum { @@ -1201,9 +1203,22 @@ gst_dvd_spu_change_state (GstElement * element, GstStateChange transition) static gboolean gst_dvd_spu_plugin_init (GstPlugin * plugin) { + const gchar *env; + GST_DEBUG_CATEGORY_INIT (dvdspu_debug, "gstspu", 0, "Sub-picture Overlay decoder/renderer"); + env = g_getenv ("GST_DVD_SPU_DEBUG"); + + dvdspu_debug_flags = 0; + if (env != NULL) { + if (strstr (env, "render-rectangle") != NULL) + dvdspu_debug_flags |= GST_DVD_SPU_DEBUG_RENDER_RECTANGLE; + if (strstr (env, "highlight-rectangle") != NULL) + dvdspu_debug_flags |= GST_DVD_SPU_DEBUG_HIGHLIGHT_RECTANGLE; + } + GST_INFO ("debug flags : 0x%02x", dvdspu_debug_flags); + return gst_element_register (plugin, "dvdspu", GST_RANK_PRIMARY, GST_TYPE_DVD_SPU); } diff --git a/gst/dvdspu/gstdvdspu.h b/gst/dvdspu/gstdvdspu.h index f46ff6748a..642db6db27 100644 --- a/gst/dvdspu/gstdvdspu.h +++ b/gst/dvdspu/gstdvdspu.h @@ -124,6 +124,14 @@ struct _GstDVDSpuClass { GType gst_dvd_spu_get_type (void); +typedef enum { + GST_DVD_SPU_DEBUG_RENDER_RECTANGLE = (1 << 0), + GST_DVD_SPU_DEBUG_HIGHLIGHT_RECTANGLE = (1 << 1) +} GstDVDSPUDebugFlags; + +extern GstDVDSPUDebugFlags dvdspu_debug_flags; + + G_END_DECLS #endif /* __GST_DVD_SPU_H__ */ diff --git a/gst/dvdspu/gstspu-vobsub-render.c b/gst/dvdspu/gstspu-vobsub-render.c index 0e088769e2..c8f7165375 100644 --- a/gst/dvdspu/gstspu-vobsub-render.c +++ b/gst/dvdspu/gstspu-vobsub-render.c @@ -591,11 +591,12 @@ gstspu_vobsub_render (GstDVDSpu * dvdspu, GstVideoFrame * frame) } /* for debugging purposes, draw a faint rectangle at the edges of the disp_rect */ - if (FALSE) { + if ((dvdspu_debug_flags & GST_DVD_SPU_DEBUG_RENDER_RECTANGLE) != 0) { gstspu_vobsub_draw_highlight (state, frame, &state->vobsub.disp_rect); } /* For debugging purposes, draw a faint rectangle around the highlight rect */ - if (FALSE && state->vobsub.hl_rect.top != -1) { + if ((dvdspu_debug_flags & GST_DVD_SPU_DEBUG_HIGHLIGHT_RECTANGLE) != 0 + && state->vobsub.hl_rect.top != -1) { gstspu_vobsub_draw_highlight (state, frame, &state->vobsub.hl_rect); } }