# HG changeset patch # User mroi # Date 1050931086 0 # Node ID 3bfaec0c1288382205c284094d0704c8ce038293 # Parent 4e5ebc1491d52a2f1f0fec89e0de5825167e0edb * fix warnings with gcc 3.3 * some menu sanity checking in highlight.c (the button functions should do nothing, when called outside a menu) * escape should take us to the Root menu, not the Title menu, since this is what the standard "Menu" button on a DVD player does diff -r 4e5ebc1491d5 -r 3bfaec0c1288 decoder.c --- a/decoder.c Tue Apr 08 13:51:55 2003 +0000 +++ b/decoder.c Mon Apr 21 13:18:06 2003 +0000 @@ -36,10 +36,10 @@ uint32_t vm_getbits(command_t *command, int start, int count) { uint64_t result = 0; - uint64_t bit_mask=0xffffffffffffffff; /* I could put -1 instead */ + uint64_t bit_mask = 0; uint64_t examining = 0; int32_t bits; - + if (count == 0) return 0; if ( ((start - count) < -1) || @@ -50,6 +50,8 @@ fprintf(MSG_OUT, "libdvdnav: Bad call to vm_getbits. Parameter out of range\n"); assert(0); } + /* all ones, please */ + bit_mask = ~bit_mask; bit_mask >>= 63 - start; bits = start + 1 - count; examining = ((bit_mask >> bits) << bits ); diff -r 4e5ebc1491d5 -r 3bfaec0c1288 dvd_types.h --- a/dvd_types.h Tue Apr 08 13:51:55 2003 +0000 +++ b/dvd_types.h Mon Apr 21 13:18:06 2003 +0000 @@ -37,7 +37,7 @@ * (see dvdnav_menu_call()) */ typedef enum { - /* When used in VTS domain, DVD_MENU_Escape behaves like DVD_MENU_Title, + /* When used in VTS domain, DVD_MENU_Escape behaves like DVD_MENU_Root, * but from within a menu domain, DVD_MENU_Escape resumes playback. */ DVD_MENU_Escape = 0, DVD_MENU_Title = 2, diff -r 4e5ebc1491d5 -r 3bfaec0c1288 highlight.c --- a/highlight.c Tue Apr 08 13:51:55 2003 +0000 +++ b/highlight.c Mon Apr 21 13:18:06 2003 +0000 @@ -175,7 +175,9 @@ fprintf(MSG_OUT, "libdvdnav: %02x ", btni->cmd.bytes[k]); } fprintf(MSG_OUT, "| "); +#ifdef TRACE vm_print_mnemonic(&btni->cmd); +#endif fprintf(MSG_OUT, "\n"); } } @@ -223,10 +225,14 @@ printerr("Passed a NULL pointer."); return S_ERR; } + if(!pci->hli.hl_gi.hli_ss) { + printerr("Not in a menu."); + return S_ERR; + } button = this->vm->state.HL_BTNN_REG >> 10; #ifdef BUTTON_TESTING - nav_print_PCI(&(this->pci)); + nav_print_PCI(pci); #endif return &(pci->hli.btnit[button-1]); @@ -312,10 +318,13 @@ #ifdef BUTTON_TESTING fprintf(MSG_OUT, "libdvdnav: Button get_highlight_area %i\n", button); #endif - + + if(!nav_pci->hli.hl_gi.hli_ss) + return S_ERR; if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns)) return S_ERR; + button_ptr = &nav_pci->hli.btnit[button-1]; highlight->sx = button_ptr->x_start; @@ -348,6 +357,10 @@ printerr("Passed a NULL pointer."); return S_ERR; } + if(!pci->hli.hl_gi.hli_ss) { + printerr("Not in a menu."); + return S_ERR; + } pthread_mutex_lock(&this->vm_lock); @@ -355,12 +368,12 @@ if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) { /* Special code to handle still menus with no buttons. - * the navigation is expected to report to the appicatino that a STILL is + * The navigation is expected to report to the application that a STILL is * underway. In turn, the application is supposed to report to the user - * that the playback is pause. The user is then expected to undo the pause. + * that the playback is paused. The user is then expected to undo the pause, * ie: hit play. At that point, the navigation should release the still and * go to the next Cell. - * Explanation by Mathieu Lavage + * Explanation by Mathieu Lacage * Code added by jcdutton. */ if (this->position_current.still != 0) { @@ -426,6 +439,10 @@ printerr("Passed a NULL pointer."); return S_ERR; } + if(!pci->hli.hl_gi.hli_ss) { + printerr("Not in a menu."); + return S_ERR; + } #ifdef BUTTON_TESTING fprintf(MSG_OUT, "libdvdnav: Button select %i\n", button); @@ -452,13 +469,17 @@ dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, pci_t *pci, int x, int y) { int button, cur_button; - uint32_t best,dist; - int mx,my,dx,dy,d; + int best,dist,d; + int mx,my,dx,dy; if(!this) { printerr("Passed a NULL pointer."); return S_ERR; } + if(!pci->hli.hl_gi.hli_ss) { + printerr("Not in a menu."); + return S_ERR; + } cur_button = this->vm->state.HL_BTNN_REG >> 10; diff -r 4e5ebc1491d5 -r 3bfaec0c1288 read_cache.c --- a/read_cache.c Tue Apr 08 13:51:55 2003 +0000 +++ b/read_cache.c Mon Apr 21 13:18:06 2003 +0000 @@ -90,7 +90,7 @@ read_cache_chunk_t chunk[READ_CACHE_CHUNKS]; int current; int freeing; /* is set to one when we are about to dispose the cache */ - int read_ahead_size; + uint32_t read_ahead_size; int read_ahead_incr; int last_sector; pthread_mutex_t lock; diff -r 4e5ebc1491d5 -r 3bfaec0c1288 searching.c --- a/searching.c Tue Apr 08 13:51:55 2003 +0000 +++ b/searching.c Mon Apr 21 13:18:06 2003 +0000 @@ -44,7 +44,7 @@ /* Return placed in vobu. */ /* Returns error status */ /* FIXME: Maybe need to handle seeking outside current cell. */ -static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int32_t domain, int32_t seekto_block, int32_t *vobu) { +static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int domain, uint32_t seekto_block, uint32_t *vobu) { vobu_admap_t *admap = NULL; #ifdef LOG_DEBUG @@ -69,8 +69,8 @@ fprintf(MSG_OUT, "libdvdnav: Error: Unknown domain for seeking.\n"); } if(admap) { - int32_t address = 0; - int32_t vobu_start, next_vobu; + uint32_t address = 0; + uint32_t vobu_start, next_vobu; int found = 0; /* Search through ADMAP for best sector */ @@ -369,7 +369,7 @@ return S_OK; } } - if (menu == DVD_MENU_Escape) menu = DVD_MENU_Title; + if (menu == DVD_MENU_Escape) menu = DVD_MENU_Root; if (vm_jump_menu(try_vm, menu) && !try_vm->stopped) { /* merge changes on success */ @@ -390,9 +390,7 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos, unsigned int *len) { uint32_t cur_sector; - uint32_t cell_nr; - uint32_t first_cell_nr; - uint32_t last_cell_nr; + int cell_nr, first_cell_nr, last_cell_nr; cell_playback_t *cell; dvd_state_t *state; @@ -441,7 +439,7 @@ *len += cell->last_sector - cell->first_sector + 1; } - assert(*pos != -1); + assert((signed)*pos != -1); pthread_mutex_unlock(&this->vm_lock);