[libbluray-devel] commit: Splitted gc_free() (hpi1 )

git at videolan.org git at videolan.org
Thu Oct 14 15:57:19 CEST 2010


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Oct 14 16:56:37 2010 +0300| [b622ec9ecc640ca787200244c1b7e6af226e1918] | committer: hpi1 

Splitted gc_free()

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=b622ec9ecc640ca787200244c1b7e6af226e1918
---

 src/libbluray/decoders/graphics_controller.c |   46 ++++++++++++++++++--------
 1 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/src/libbluray/decoders/graphics_controller.c b/src/libbluray/decoders/graphics_controller.c
index 0d219f6..35de63f 100644
--- a/src/libbluray/decoders/graphics_controller.c
+++ b/src/libbluray/decoders/graphics_controller.c
@@ -72,22 +72,44 @@ GRAPHICS_CONTROLLER *gc_init(BD_REGISTERS *regs, void *handle, gc_overlay_proc_f
     return p;
 }
 
+static void _gc_clear_osd(GRAPHICS_CONTROLLER *gc, int plane)
+{
+    if (gc->overlay_proc) {
+        /* clear plane */
+        BD_OVERLAY ov = { -1, plane, 0, 0, 1920, 1080, NULL, NULL };
+        gc->overlay_proc(gc->overlay_proc_handle, &ov);
+    }
+
+    if (plane) {
+        gc->ig_drawn      = 0;
+        gc->popup_visible = 0;
+    } else {
+        gc->pg_drawn      = 0;
+    }
+}
+
+static void _gc_reset(GRAPHICS_CONTROLLER *gc)
+{
+    _gc_clear_osd(gc, 0);
+    _gc_clear_osd(gc, 1);
+
+    graphics_processor_free(&gc->igp);
+    graphics_processor_free(&gc->pgp);
+
+    pg_display_set_free(&gc->pgs);
+    pg_display_set_free(&gc->igs);
+}
+
 void gc_free(GRAPHICS_CONTROLLER **p)
 {
     if (p && *p) {
 
-        GRAPHICS_CONTROLLER *gc = *p;
+        _gc_reset(*p);
 
-        if (gc->overlay_proc) {
-            gc->overlay_proc((*p)->overlay_proc_handle, NULL);
+        if ((*p)->overlay_proc) {
+            (*p)->overlay_proc((*p)->overlay_proc_handle, NULL);
         }
 
-        graphics_processor_free(&gc->igp);
-        graphics_processor_free(&gc->pgp);
-
-        pg_display_set_free(&gc->pgs);
-        pg_display_set_free(&gc->igs);
-
         X_FREE(*p);
     }
 }
@@ -260,11 +282,7 @@ static void _render_page(GRAPHICS_CONTROLLER *gc,
     if (s->ics->interactive_composition.ui_model == 1 && !gc->popup_visible) {
         TRACE("_render_page(): popup menu not visible\n");
 
-        if (gc->overlay_proc) {
-            /* clear IG plane */
-            BD_OVERLAY ov = { -1, 1, 0, 0, 1920, 1080, NULL, NULL };
-            gc->overlay_proc(gc->overlay_proc_handle, &ov);
-        }
+        _gc_clear_osd(gc, 1);
 
         return;
     }



More information about the libbluray-devel mailing list