Mercurial > libdvdnav.hg
changeset 8:66708b4a1b5e src
Stop C++ bitching about some things and extend the menus example
author | richwareham |
---|---|
date | Sun, 07 Apr 2002 14:10:11 +0000 |
parents | 7fdefafa624f |
children | 058a95695876 |
files | dvdnav.c dvdnav.h searching.c |
diffstat | 3 files changed, 51 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/dvdnav.c Sat Apr 06 18:42:05 2002 +0000 +++ b/dvdnav.c Sun Apr 07 14:10:11 2002 +0000 @@ -82,7 +82,7 @@ return S_OK; } -dvdnav_status_t dvdnav_open(dvdnav_t** dest, char *path) { +dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char *path) { dvdnav_t *self; /* Create a new structure */ @@ -988,6 +988,9 @@ /* * $Log$ + * Revision 1.6 2002/04/07 14:10:11 richwareham + * Stop C++ bitching about some things and extend the menus example + * * Revision 1.5 2002/04/06 18:42:05 jcdutton * Slight correction to handle quicker menu transitions. *
--- a/dvdnav.h Sat Apr 06 18:42:05 2002 +0000 +++ b/dvdnav.h Sun Apr 07 14:10:11 2002 +0000 @@ -61,7 +61,7 @@ * dest -- Pointer to a dvdnav_t pointer to fill in. * path -- Any libdvdread acceptable path */ -dvdnav_status_t dvdnav_open(dvdnav_t** dest, char *path); +dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char *path); /** * Closes a dvdnav_t previously opened with dvdnav_open(), freeing any @@ -286,7 +286,15 @@ * part and the length (in blocks) of said part. */ dvdnav_status_t dvdnav_get_position(dvdnav_t *self, unsigned int* pos, - unsigned int *len); + unsigned int *len); + +/** + * Return the current position (in blocks) within the current + * title and the length (in blocks) of said title. + */ +dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *self, + unsigned int* pos, + unsigned int *len); /** Highlights **/
--- a/searching.c Sat Apr 06 18:42:05 2002 +0000 +++ b/searching.c Sun Apr 07 14:10:11 2002 +0000 @@ -318,3 +318,40 @@ return S_OK; } +dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *self, + unsigned int *pos, + unsigned int *len) { + uint32_t cur_sector; + uint32_t first_cell_nr; + uint32_t last_cell_nr; + cell_playback_t *first_cell; + cell_playback_t *last_cell; + dvd_state_t *state; + if((!self) || (!self->vm) ) + return S_ERR; + + state = &(self->vm->state); + if((!state) || (!state->pgc) ) + return S_ERR; + + /* Sanity check */ + if(state->pgN > state->pgc->nr_of_programs) { + return S_ERR; + } + + /* Get current sector */ + cur_sector = self->vobu_start + self->blockN; + + /* Now find first and last cells in title. */ + first_cell_nr = state->pgc->program_map[0]; + first_cell = &(state->pgc->cell_playback[first_cell_nr-1]); + last_cell_nr = state->pgc->nr_of_cells; + last_cell = &(state->pgc->cell_playback[last_cell_nr-1]); + + *pos = cur_sector - first_cell->first_sector; + *len = last_cell->last_sector - first_cell->first_sector; + + return S_OK; +} + +