[libbluray-devel] Cosmetics (changed function locations to avoid need for prototypes)

hpi1 git at videolan.org
Wed Feb 9 17:01:30 CET 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Feb  9 17:49:33 2011 +0200| [f1fcd6002ff0fd79b81061aada4986f600f5cfde] | committer: hpi1

Cosmetics (changed function locations to avoid need for prototypes)

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

 src/libbluray/decoders/graphics_controller.c |  243 +++++++++++++-------------
 1 files changed, 120 insertions(+), 123 deletions(-)

diff --git a/src/libbluray/decoders/graphics_controller.c b/src/libbluray/decoders/graphics_controller.c
index ad493c5..c9fbf80 100644
--- a/src/libbluray/decoders/graphics_controller.c
+++ b/src/libbluray/decoders/graphics_controller.c
@@ -63,9 +63,129 @@ struct graphics_controller_s {
 };
 
 /*
+ * object lookup
+ */
+
+static BD_PG_OBJECT *_find_object(PG_DISPLAY_SET *s, unsigned object_id)
+{
+    unsigned ii;
+
+    for (ii = 0; ii < s->num_object; ii++) {
+        if (s->object[ii].id == object_id) {
+            return &s->object[ii];
+        }
+    }
+
+    return NULL;
+}
+
+static BD_PG_PALETTE *_find_palette(PG_DISPLAY_SET *s, unsigned palette_id)
+{
+    unsigned ii;
+
+    for (ii = 0; ii < s->num_palette; ii++) {
+        if (s->palette[ii].id == palette_id) {
+            return &s->palette[ii];
+        }
+    }
+
+    return NULL;
+}
+
+static BD_IG_BUTTON *_find_button_bog(BD_IG_BOG *bog, unsigned button_id)
+{
+    unsigned ii;
+
+    for (ii = 0; ii < bog->num_buttons; ii++) {
+        if (bog->button[ii].id == button_id) {
+            return &bog->button[ii];
+        }
+    }
+
+    return NULL;
+}
+
+static BD_IG_BUTTON *_find_button_page(BD_IG_PAGE *page, unsigned button_id, unsigned *bog_idx)
+{
+    unsigned ii;
+
+    for (ii = 0; ii < page->num_bogs; ii++) {
+        BD_IG_BUTTON *button = _find_button_bog(&page->bog[ii], button_id);
+        if (button) {
+            if (bog_idx) {
+                *bog_idx = ii;
+            }
+            return button;
+        }
+    }
+
+    return NULL;
+}
+
+static BD_IG_PAGE *_find_page(BD_IG_INTERACTIVE_COMPOSITION *c, unsigned page_id)
+{
+    unsigned ii;
+
+    for (ii = 0; ii < c->num_pages; ii++) {
+        if (c->page[ii].id == page_id) {
+            return &c->page[ii];
+        }
+    }
+
+    return NULL;
+}
+
+enum { BTN_NORMAL, BTN_SELECTED, BTN_ACTIVATED };
+
+static BD_PG_OBJECT *_find_object_for_button(PG_DISPLAY_SET *s,
+                                             BD_IG_BUTTON *button, int state)
+{
+    BD_PG_OBJECT *object   = NULL;
+    unsigned object_id     = 0xffff;
+
+    switch (state) {
+        case BTN_NORMAL:
+            object_id = button->normal_start_object_id_ref;
+            break;
+        case BTN_SELECTED:
+            object_id = button->selected_start_object_id_ref;
+            break;
+        case BTN_ACTIVATED:
+            object_id = button->activated_start_object_id_ref;
+            break;
+    }
+
+    object = _find_object(s, object_id);
+
+    return object;
+}
+
+/*
  * util
  */
 
+static void _reset_enabled_button(GRAPHICS_CONTROLLER *gc)
+{
+    PG_DISPLAY_SET *s       = gc->igs;
+    BD_IG_PAGE     *page    = NULL;
+    unsigned        page_id = bd_psr_read(gc->regs, PSR_MENU_PAGE_ID);
+    unsigned        ii;
+
+    page = _find_page(&s->ics->interactive_composition, page_id);
+    if (!page) {
+        ERROR("_reset_enabled_button(): unknown page #%d (have %d pages)\n",
+              page_id, s->ics->interactive_composition.num_pages);
+        return;
+    }
+
+    gc->enabled_button = realloc(gc->enabled_button,
+                                 page->num_bogs * sizeof(uint16_t));
+
+    for (ii = 0; ii < page->num_bogs; ii++) {
+        gc->enabled_button[ii] = page->bog[ii].default_valid_button_id_ref;
+    }
+}
+
 static void _gc_clear_osd(GRAPHICS_CONTROLLER *gc, int plane)
 {
     if (gc->overlay_proc) {
@@ -141,8 +261,6 @@ void gc_free(GRAPHICS_CONTROLLER **p)
  * graphics stream input
  */
 
-static void _reset_enabled_button(GRAPHICS_CONTROLLER *gc);
-
 void gc_decode_ts(GRAPHICS_CONTROLLER *gc, uint16_t pid, uint8_t *block, unsigned num_blocks, int64_t stc)
 {
     if (pid >= 0x1400 && pid < 0x1500) {
@@ -183,105 +301,6 @@ void gc_decode_ts(GRAPHICS_CONTROLLER *gc, uint16_t pid, uint8_t *block, unsigne
 }
 
 /*
- * object lookup
- */
-
-static BD_PG_OBJECT *_find_object(PG_DISPLAY_SET *s, unsigned object_id)
-{
-    unsigned ii;
-
-    for (ii = 0; ii < s->num_object; ii++) {
-        if (s->object[ii].id == object_id) {
-            return &s->object[ii];
-        }
-    }
-
-    return NULL;
-}
-
-static BD_PG_PALETTE *_find_palette(PG_DISPLAY_SET *s, unsigned palette_id)
-{
-    unsigned ii;
-
-    for (ii = 0; ii < s->num_palette; ii++) {
-        if (s->palette[ii].id == palette_id) {
-            return &s->palette[ii];
-        }
-    }
-
-    return NULL;
-}
-
-static BD_IG_BUTTON *_find_button_bog(BD_IG_BOG *bog, unsigned button_id)
-{
-    unsigned ii;
-
-    for (ii = 0; ii < bog->num_buttons; ii++) {
-        if (bog->button[ii].id == button_id) {
-            return &bog->button[ii];
-        }
-    }
-
-    return NULL;
-}
-
-static BD_IG_BUTTON *_find_button_page(BD_IG_PAGE *page, unsigned button_id, unsigned *bog_idx)
-{
-    unsigned ii;
-
-    for (ii = 0; ii < page->num_bogs; ii++) {
-        BD_IG_BUTTON *button = _find_button_bog(&page->bog[ii], button_id);
-        if (button) {
-            if (bog_idx) {
-                *bog_idx = ii;
-            }
-            return button;
-        }
-    }
-
-    return NULL;
-}
-
-static BD_IG_PAGE *_find_page(BD_IG_INTERACTIVE_COMPOSITION *c, unsigned page_id)
-{
-    unsigned ii;
-
-    for (ii = 0; ii < c->num_pages; ii++) {
-        if (c->page[ii].id == page_id) {
-            return &c->page[ii];
-        }
-    }
-
-    return NULL;
-}
-
-enum { BTN_NORMAL, BTN_SELECTED, BTN_ACTIVATED };
-
-static BD_PG_OBJECT *_find_object_for_button(PG_DISPLAY_SET *s,
-                                             BD_IG_BUTTON *button, int state)
-{
-    BD_PG_OBJECT *object   = NULL;
-    unsigned object_id     = 0xffff;
-
-    switch (state) {
-        case BTN_NORMAL:
-            object_id = button->normal_start_object_id_ref;
-            break;
-        case BTN_SELECTED:
-            object_id = button->selected_start_object_id_ref;
-            break;
-        case BTN_ACTIVATED:
-            object_id = button->activated_start_object_id_ref;
-            break;
-    }
-
-    object = _find_object(s, object_id);
-
-    return object;
-}
-
-
-/*
  * IG rendering
  */
 
@@ -480,28 +499,6 @@ static int _user_input(GRAPHICS_CONTROLLER *gc, bd_vk_key_e key, GC_NAV_CMDS *cm
     return 0;
 }
 
-static void _reset_enabled_button(GRAPHICS_CONTROLLER *gc)
-{
-    PG_DISPLAY_SET *s       = gc->igs;
-    BD_IG_PAGE     *page    = NULL;
-    unsigned        page_id = bd_psr_read(gc->regs, PSR_MENU_PAGE_ID);
-    unsigned        ii;
-
-    page = _find_page(&s->ics->interactive_composition, page_id);
-    if (!page) {
-        ERROR("_reset_enabled_button(): unknown page #%d (have %d pages)\n",
-              page_id, s->ics->interactive_composition.num_pages);
-        return;
-    }
-
-    gc->enabled_button = realloc(gc->enabled_button,
-                                 page->num_bogs * sizeof(uint16_t));
-
-    for (ii = 0; ii < page->num_bogs; ii++) {
-        gc->enabled_button[ii] = page->bog[ii].default_valid_button_id_ref;
-    }
-}
-
 static void _set_button_page(GRAPHICS_CONTROLLER *gc, uint32_t param, GC_NAV_CMDS *cmds)
 {
     unsigned page_flag   = param & 0x80000000;



More information about the libbluray-devel mailing list