dvdspu: allow debugging of render and highlight rectangles via environment variable
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Sun, 10 Jun 2012 13:29:58 +0000 (14:29 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 11 Jun 2012 08:32:43 +0000 (10:32 +0200)
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
gst/dvdspu/gstdvdspu.h
gst/dvdspu/gstspu-vobsub-render.c

index f67e5f6..b159e37 100644 (file)
@@ -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);
 }
index f46ff67..642db6d 100644 (file)
@@ -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__ */
index 0e08876..c8f7165 100644 (file)
@@ -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);
   }
 }