Mercurial > libdvdnav.hg
changeset 132:f22458f928b8 src
PGC based positioning
author | mroi |
---|---|
date | Sun, 23 Mar 2003 15:24:31 +0000 |
parents | ada79e606d8d |
children | d09a81cf65ce |
files | dvdnav.h dvdnav_internal.h.in searching.c settings.c |
diffstat | 4 files changed, 65 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/dvdnav.h Fri Mar 21 18:06:44 2003 +0000 +++ b/dvdnav.h Sun Mar 23 15:24:31 2003 +0000 @@ -171,6 +171,28 @@ dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *self, int* flag); /** + * Specify whether the positioning works PGC or PG based. + * Programs (PGs) on DVDs are similar to Chapters and the program chain (PGC) + * usually covers a whole feature. This affects the behaviour of the + * functions dvdnav_get_position() and dvdnav_sector_search(). + * Default is PG based positioning. + * + * \param self Pointer to dvdnav_t associated with this operation. + * \param pgc 0 - PG based, 1 - PGC based + */ +dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *self, int pgc); + +/** + * Query whether positioning is PG or PGC based. + * + * \param self Pointer to dvdnav_t associated with this operation. + * \param flag Pointer to int to recieve flag value. + * + * \sa dvdnav_set_PGC_positioning_flag() + */ +dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *self, int *flag); + +/** * @} */
--- a/dvdnav_internal.h.in Fri Mar 21 18:06:44 2003 +0000 +++ b/dvdnav_internal.h.in Sun Mar 23 15:24:31 2003 +0000 @@ -146,6 +146,7 @@ int spu_clut_changed; /* The SPU CLUT changed */ int started; /* vm_start has been called? */ int use_read_ahead; /* 1 - use read-ahead cache, 0 - don't */ + int pgc_based; /* positioning works PGC based instead of PG based */ /* VM */ vm_t *vm;
--- a/searching.c Fri Mar 21 18:06:44 2003 +0000 +++ b/searching.c Sun Mar 23 15:24:31 2003 +0000 @@ -168,14 +168,19 @@ return S_ERR; } - /* First find closest cell number in program */ - first_cell_nr = state->pgc->program_map[state->pgN-1]; - if(state->pgN < state->pgc->nr_of_programs) { - last_cell_nr = state->pgc->program_map[state->pgN] - 1; + if (this->pgc_based) { + first_cell_nr = 1; + last_cell_nr = state->pgc->nr_of_cells; } else { - last_cell_nr = state->pgc->nr_of_cells; + /* Find start cell of program. */ + first_cell_nr = state->pgc->program_map[state->pgN-1]; + /* Find end cell of program */ + if(state->pgN < state->pgc->nr_of_programs) + last_cell_nr = state->pgc->program_map[state->pgN] - 1; + else + last_cell_nr = state->pgc->nr_of_cells; } - + found = 0; for(cell_nr = first_cell_nr; (cell_nr <= last_cell_nr) && !found; cell_nr ++) { cell = &(state->pgc->cell_playback[cell_nr-1]); @@ -382,8 +387,6 @@ uint32_t first_cell_nr; uint32_t last_cell_nr; cell_playback_t *cell; - cell_playback_t *first_cell; - cell_playback_t *last_cell; dvd_state_t *state; if(!this || !pos || !len) { @@ -406,18 +409,19 @@ /* Get current sector */ cur_sector = this->vobu.vobu_start + this->vobu.blockN; - /* Find start cell of program. */ - first_cell_nr = state->pgc->program_map[state->pgN-1]; - first_cell = &(state->pgc->cell_playback[first_cell_nr-1]); - - /* Find end cell of program */ - if(state->pgN < state->pgc->nr_of_programs) { - last_cell_nr = state->pgc->program_map[state->pgN] - 1; + if (this->pgc_based) { + first_cell_nr = 1; + last_cell_nr = state->pgc->nr_of_cells; } else { - last_cell_nr = state->pgc->nr_of_cells; + /* Find start cell of program. */ + first_cell_nr = state->pgc->program_map[state->pgN-1]; + /* Find end cell of program */ + if(state->pgN < state->pgc->nr_of_programs) + last_cell_nr = state->pgc->program_map[state->pgN] - 1; + else + last_cell_nr = state->pgc->nr_of_cells; } - last_cell = &(state->pgc->cell_playback[last_cell_nr-1]); - + *pos = -1; *len = 0; for (cell_nr = first_cell_nr; cell_nr <= last_cell_nr; cell_nr++) {
--- a/settings.c Fri Mar 21 18:06:44 2003 +0000 +++ b/settings.c Sun Mar 23 15:24:31 2003 +0000 @@ -101,3 +101,23 @@ dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) { return set_language_register(this, code, 18); } + +dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *this, int pgc) { + if(!this) { + printerr("Passed a NULL this pointer."); + return S_ERR; + } + + this->pgc_based = pgc; + return S_OK; +} + +dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *this, int *flag) { + if(!this || !flag) { + printerr("Passed a NULL this pointer."); + return S_ERR; + } + + (*flag) = this->pgc_based; + return S_OK; +}