summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-03-25 13:17:20 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-03-25 13:17:20 +0000
commit4e943eedd4a8cecf5926ded3ea8e9054b53cc26d (patch)
tree5ff01b958cea0e8b4cae5992469b6262ab011c08
parent02f1a32e5fb7f13b2f706f7d3efa125f2b100ead (diff)
downloadxine-lib-4e943eedd4a8cecf5926ded3ea8e9054b53cc26d.tar.gz
xine-lib-4e943eedd4a8cecf5926ded3ea8e9054b53cc26d.tar.bz2
sync to cvs of libdvdnav
* optional PGC based seeking * new event on cell changes for timing info (currently not used by xine-lib) CVS patchset: 4480 CVS date: 2003/03/25 13:17:20
-rw-r--r--src/input/libdvdnav/dvdnav.c97
-rw-r--r--src/input/libdvdnav/dvdnav.h24
-rw-r--r--src/input/libdvdnav/dvdnav_events.h14
-rw-r--r--src/input/libdvdnav/dvdnav_internal.h3
-rw-r--r--src/input/libdvdnav/navigation.c4
-rw-r--r--src/input/libdvdnav/searching.c84
-rw-r--r--src/input/libdvdnav/settings.c22
-rw-r--r--src/input/libdvdnav/vm.c15
-rw-r--r--src/input/libdvdnav/vm.h6
9 files changed, 186 insertions, 83 deletions
diff --git a/src/input/libdvdnav/dvdnav.c b/src/input/libdvdnav/dvdnav.c
index a86002169..89b965fe3 100644
--- a/src/input/libdvdnav/dvdnav.c
+++ b/src/input/libdvdnav/dvdnav.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dvdnav.c,v 1.18 2003/03/21 22:13:37 mroi Exp $
+ * $Id: dvdnav.c,v 1.19 2003/03/25 13:17:20 mroi Exp $
*
*/
@@ -205,6 +205,27 @@ const char* dvdnav_err_to_string(dvdnav_t *this) {
return this->err_str;
}
+/* converts a dvd_time_t to PTS ticks */
+static int64_t dvdnav_convert_time(dvd_time_t *time) {
+ int64_t result;
+ int frames;
+
+ result = (time->hour & 0xf0) * 10 * 60 * 60 * 90000;
+ result += (time->hour & 0x0f) * 60 * 60 * 90000;
+ result += (time->minute & 0xf0) * 10 * 60 * 90000;
+ result += (time->minute & 0x0f) * 60 * 90000;
+ result += (time->second & 0xf0) * 10 * 90000;
+ result += (time->second & 0x0f) * 90000;
+ frames = (time->frame_u & 0x30) * 10 ;
+ frames += (time->frame_u & 0x0f) ;
+ if (time->frame_u & 0x80)
+ result += frames * 3000;
+ else
+ result += frames * 3600;
+
+ return result;
+}
+
/*
* Returns 1 if block contains NAV packet, 0 otherwise.
* Precesses said NAV packet if present.
@@ -458,16 +479,15 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
/* Check the HIGHLIGHT flag */
if(this->position_current.button != this->position_next.button) {
- dvdnav_highlight_event_t hevent;
+ dvdnav_highlight_event_t *hevent = (dvdnav_highlight_event_t *)*buf;
(*event) = DVDNAV_HIGHLIGHT;
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: HIGHLIGHT\n");
#endif
- (*len) = sizeof(hevent);
- hevent.display = 1;
- hevent.buttonN = this->position_next.button;
- memcpy(*buf, &(hevent), sizeof(hevent));
+ (*len) = sizeof(dvdnav_highlight_event_t);
+ hevent->display = 1;
+ hevent->buttonN = this->position_next.button;
this->position_current.button = this->position_next.button;
pthread_mutex_unlock(&this->vm_lock);
return S_OK;
@@ -489,15 +509,15 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
(this->position_current.domain != this->position_next.domain)) {
dvd_read_domain_t domain;
int vtsN;
- dvdnav_vts_change_event_t vts_event;
+ dvdnav_vts_change_event_t *vts_event = (dvdnav_vts_change_event_t *)*buf;
if(this->file) {
DVDCloseFile(this->file);
this->file = NULL;
}
- vts_event.old_vtsN = this->open_vtsN;
- vts_event.old_domain = this->open_domain;
+ vts_event->old_vtsN = this->open_vtsN;
+ vts_event->old_domain = this->open_domain;
/* Use the DOMAIN to find whether to open menu or title VOBs */
switch(this->position_next.domain) {
@@ -524,8 +544,8 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
this->position_current.domain = this->position_next.domain;
dvdnav_read_cache_clear(this->cache);
this->file = DVDOpenFile(vm_get_dvd_reader(this->vm), vtsN, domain);
- vts_event.new_vtsN = this->position_next.vts;
- vts_event.new_domain = this->position_next.domain;
+ vts_event->new_vtsN = this->position_next.vts;
+ vts_event->new_domain = this->position_next.domain;
/* If couldn't open the file for some reason, moan */
if(this->file == NULL) {
@@ -539,8 +559,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: VTS_CHANGE\n");
#endif
- (*len) = sizeof(vts_event);
- memcpy(*buf, &(vts_event), sizeof(vts_event));
+ (*len) = sizeof(dvdnav_vts_change_event_t);
this->spu_clut_changed = 1;
this->position_current.cell = -1; /* Force an update */
@@ -555,12 +574,32 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
if( (this->position_current.cell != this->position_next.cell) ||
(this->position_current.cell_restart != this->position_next.cell_restart) ||
(this->position_current.cell_start != this->position_next.cell_start) ) {
+ dvdnav_cell_change_event_t *cell_event = (dvdnav_cell_change_event_t *)*buf;
+ int first_cell_nr, last_cell_nr, i;
+ dvd_state_t *state = &this->vm->state;
(*event) = DVDNAV_CELL_CHANGE;
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: CELL_CHANGE\n");
#endif
- (*len) = 0;
+ (*len) = sizeof(dvdnav_cell_change_event_t);
+
+ cell_event->cellN = state->cellN;
+ cell_event->pgN = state->pgN;
+ cell_event->cell_length =
+ dvdnav_convert_time(&state->pgc->cell_playback[state->cellN-1].playback_time);
+ cell_event->pg_length = 0;
+ /* 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;
+ for (i = first_cell_nr; i <= last_cell_nr; i++)
+ cell_event->pg_length +=
+ dvdnav_convert_time(&state->pgc->cell_playback[i - 1].playback_time);
+ cell_event->pgc_length = dvdnav_convert_time(&state->pgc->playback_time);
this->position_current.cell = this->position_next.cell;
this->position_current.cell_restart = this->position_next.cell_restart;
@@ -598,26 +637,25 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
/* has the SPU channel changed? */
if(this->position_current.spu_channel != this->position_next.spu_channel) {
- dvdnav_spu_stream_change_event_t stream_change;
+ dvdnav_spu_stream_change_event_t *stream_change = (dvdnav_spu_stream_change_event_t *)*buf;
(*event) = DVDNAV_SPU_STREAM_CHANGE;
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE\n");
#endif
(*len) = sizeof(dvdnav_spu_stream_change_event_t);
- stream_change.physical_wide = vm_get_subp_active_stream(this->vm, 0);
- stream_change.physical_letterbox = vm_get_subp_active_stream(this->vm, 1);
- stream_change.physical_pan_scan = vm_get_subp_active_stream(this->vm, 2);
- memcpy(*buf, &(stream_change), sizeof(dvdnav_spu_stream_change_event_t));
+ stream_change->physical_wide = vm_get_subp_active_stream(this->vm, 0);
+ stream_change->physical_letterbox = vm_get_subp_active_stream(this->vm, 1);
+ stream_change->physical_pan_scan = vm_get_subp_active_stream(this->vm, 2);
this->position_current.spu_channel = this->position_next.spu_channel;
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE stream_id_wide=%d\n",stream_change.physical_wide);
fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE stream_id_letterbox=%d\n",stream_change.physical_letterbox);
fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE stream_id_pan_scan=%d\n",stream_change.physical_pan_scan);
#endif
- if (stream_change.physical_wide != -1 &&
- stream_change.physical_letterbox != -1 &&
- stream_change.physical_pan_scan != -1) {
+ if (stream_change->physical_wide != -1 &&
+ stream_change->physical_letterbox != -1 &&
+ stream_change->physical_pan_scan != -1) {
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE returning S_OK\n");
#endif
@@ -628,15 +666,14 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
/* has the audio channel changed? */
if(this->position_current.audio_channel != this->position_next.audio_channel) {
- dvdnav_audio_stream_change_event_t stream_change;
+ dvdnav_audio_stream_change_event_t *stream_change = (dvdnav_audio_stream_change_event_t *)*buf;
(*event) = DVDNAV_AUDIO_STREAM_CHANGE;
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: AUDIO_STREAM_CHANGE\n");
#endif
(*len) = sizeof(dvdnav_audio_stream_change_event_t);
- stream_change.physical = vm_get_audio_active_stream( this->vm );
- memcpy(*buf, &(stream_change), sizeof( dvdnav_audio_stream_change_event_t));
+ stream_change->physical = vm_get_audio_active_stream( this->vm );
this->position_current.audio_channel = this->position_next.audio_channel;
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: AUDIO_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change.physical);
@@ -647,15 +684,14 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
/* Check the STILLFRAME flag */
if(this->position_current.still != 0) {
- dvdnav_still_event_t still_event;
+ dvdnav_still_event_t *still_event = (dvdnav_still_event_t *)*buf;
(*event) = DVDNAV_STILL_FRAME;
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: STILL_FRAME\n");
#endif
(*len) = sizeof(dvdnav_still_event_t);
- still_event.length = this->position_current.still;
- memcpy(*buf, &(still_event), sizeof(dvdnav_still_event_t));
+ still_event->length = this->position_current.still;
pthread_mutex_unlock(&this->vm_lock);
return S_OK;
}
@@ -980,6 +1016,11 @@ uint32_t dvdnav_get_next_still_flag(dvdnav_t *this) {
/*
* $Log: dvdnav.c,v $
+ * Revision 1.19 2003/03/25 13:17:20 mroi
+ * sync to cvs of libdvdnav
+ * * optional PGC based seeking
+ * * new event on cell changes for timing info (currently not used by xine-lib)
+ *
* Revision 1.18 2003/03/21 22:13:37 mroi
* sync to libdvdnav cvs
* * method to try-run VM operations, now used for safer chapter skipping and menu jumps
diff --git a/src/input/libdvdnav/dvdnav.h b/src/input/libdvdnav/dvdnav.h
index 69f2367cc..fb8aa866e 100644
--- a/src/input/libdvdnav/dvdnav.h
+++ b/src/input/libdvdnav/dvdnav.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dvdnav.h,v 1.7 2003/03/21 22:13:37 mroi Exp $
+ * $Id: dvdnav.h,v 1.8 2003/03/25 13:17:21 mroi Exp $
*
*/
@@ -171,6 +171,28 @@ dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *self, int use_readahead);
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);
+
+/**
* @}
*/
diff --git a/src/input/libdvdnav/dvdnav_events.h b/src/input/libdvdnav/dvdnav_events.h
index 99bca02c6..95f1e23ad 100644
--- a/src/input/libdvdnav/dvdnav_events.h
+++ b/src/input/libdvdnav/dvdnav_events.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dvdnav_events.h,v 1.7 2003/03/08 14:36:13 mroi Exp $
+ * $Id: dvdnav_events.h,v 1.8 2003/03/25 13:17:21 mroi Exp $
*
*/
@@ -90,17 +90,19 @@ typedef struct {
dvd_read_domain_t new_domain; /*!< The new domain */
} dvdnav_vts_change_event_t;
-/* FIXME: These are unused. */
-#if 0
/**
* Structure providing information on DVDNAV_CELL_CHANGE events.
*/
typedef struct {
- cell_playback_t *old_cell; /*!< The old cell (or NULL if this is
- the first cell) */
- cell_playback_t *new_cell; /*!< The cell_playback_t for the new cell */
+ int cellN; /*!< The new cell number */
+ int pgN; /*!< The current program number */
+ int64_t cell_length; /*!< The length of the current cell in PTS ticks */
+ int64_t pg_length; /*!< The length of the current program in PTS ticks */
+ int64_t pgc_length; /*!< The length of the current program chain in PTS ticks */
} dvdnav_cell_change_event_t;
+/* FIXME: These are unused. */
+#if 0
/**
* Structure providing information on DVDNAV_NAV_PACKET events.
*/
diff --git a/src/input/libdvdnav/dvdnav_internal.h b/src/input/libdvdnav/dvdnav_internal.h
index 47d4a8d0b..f4e6a2841 100644
--- a/src/input/libdvdnav/dvdnav_internal.h
+++ b/src/input/libdvdnav/dvdnav_internal.h
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dvdnav_internal.h,v 1.7 2003/02/26 20:44:14 mroi Exp $
+ * $Id: dvdnav_internal.h,v 1.8 2003/03/25 13:17:22 mroi Exp $
*
*/
@@ -147,6 +147,7 @@ struct dvdnav_s {
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;
diff --git a/src/input/libdvdnav/navigation.c b/src/input/libdvdnav/navigation.c
index fbf41e04a..97b988fc6 100644
--- a/src/input/libdvdnav/navigation.c
+++ b/src/input/libdvdnav/navigation.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: navigation.c,v 1.5 2003/02/26 20:44:15 mroi Exp $
+ * $Id: navigation.c,v 1.6 2003/03/25 13:17:22 mroi Exp $
*
*/
@@ -156,6 +156,8 @@ dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int title, int part) {
return S_ERR;
}
retval = vm_jump_title_part(this->vm, title, part);
+ if (retval)
+ this->vm->hop_channel++;
pthread_mutex_unlock(&this->vm_lock);
return retval ? S_OK : S_ERR;
diff --git a/src/input/libdvdnav/searching.c b/src/input/libdvdnav/searching.c
index 195ee9705..89b5c86e7 100644
--- a/src/input/libdvdnav/searching.c
+++ b/src/input/libdvdnav/searching.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: searching.c,v 1.11 2003/03/21 22:13:38 mroi Exp $
+ * $Id: searching.c,v 1.12 2003/03/25 13:17:22 mroi Exp $
*
*/
@@ -77,7 +77,7 @@ static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int32_t domain, int32_t
int found = 0;
/* Search through ADMAP for best sector */
- vobu_start = 0x3fffffff;
+ vobu_start = SRI_END_OF_CELL;
/* FIXME: Implement a faster search algorithm */
while((!found) && ((address<<2) < admap->last_byte)) {
next_vobu = admap->vobu_start_sectors[address];
@@ -120,10 +120,6 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
}
result = dvdnav_get_position(this, &target, &length);
-#ifdef LOG_DEBUG
- fprintf(MSG_OUT, "libdvdnav: seeking to offset=%lu pos=%u length=%u\n", offset, target, length);
- fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN);
-#endif
if(!result) {
return S_ERR;
}
@@ -135,6 +131,10 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
pthread_mutex_unlock(&this->vm_lock);
return S_ERR;
}
+#ifdef LOG_DEBUG
+ fprintf(MSG_OUT, "libdvdnav: seeking to offset=%lu pos=%u length=%u\n", offset, target, length);
+ fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN);
+#endif
switch(origin) {
case SEEK_SET:
@@ -167,15 +167,20 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
pthread_mutex_unlock(&this->vm_lock);
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;
- } else {
+
+ if (this->pgc_based) {
+ first_cell_nr = 1;
last_cell_nr = state->pgc->nr_of_cells;
+ } else {
+ /* 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]);
@@ -191,31 +196,27 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
}
if(found) {
- int32_t vobu, start;
+ int32_t vobu;
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: Seeking to cell %i from choice of %i to %i\n",
cell_nr, first_cell_nr, last_cell_nr);
#endif
- dvdnav_scan_admap(this, state->domain, target, &vobu);
-
- start = state->pgc->cell_playback[cell_nr-1].first_sector;
- state->blockN = vobu - start;
- state->cellN = cell_nr;
- state->cell_restart++;
+ if (dvdnav_scan_admap(this, state->domain, target, &vobu) == S_OK) {
+ int32_t start = state->pgc->cell_playback[cell_nr-1].first_sector;
+
+ if (vm_jump_cell_block(this->vm, cell_nr, vobu - start)) {
#ifdef LOG_DEBUG
- fprintf(MSG_OUT, "libdvdnav: After cellN=%u blockN=%u target=%x vobu=%x start=%x\n" ,
- state->cellN,
- state->blockN,
- target,
- vobu,
- start);
+ fprintf(MSG_OUT, "libdvdnav: After cellN=%u blockN=%u target=%x vobu=%x start=%x\n" ,
+ state->cellN, state->blockN, target, vobu, start);
#endif
- this->vm->hop_channel += HOP_SEEK;
- pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ this->vm->hop_channel += HOP_SEEK;
+ pthread_mutex_unlock(&this->vm_lock);
+ return S_OK;
+ }
+ }
}
- fprintf(MSG_OUT, "libdvdnav: Error when seeking, asked to seek outside program\n");
+ fprintf(MSG_OUT, "libdvdnav: Error when seeking\n");
fprintf(MSG_OUT, "libdvdnav: FIXME: Implement seeking to location %u\n", target);
printerr("Error when seeking.");
pthread_mutex_unlock(&this->vm_lock);
@@ -382,8 +383,6 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos,
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 +405,19 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos,
/* 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;
- } else {
+ if (this->pgc_based) {
+ first_cell_nr = 1;
last_cell_nr = state->pgc->nr_of_cells;
+ } else {
+ /* 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++) {
diff --git a/src/input/libdvdnav/settings.c b/src/input/libdvdnav/settings.c
index bc5cc9e70..d091e57e2 100644
--- a/src/input/libdvdnav/settings.c
+++ b/src/input/libdvdnav/settings.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: settings.c,v 1.3 2003/02/20 16:02:01 mroi Exp $
+ * $Id: settings.c,v 1.4 2003/03/25 13:17:22 mroi Exp $
*
*/
@@ -101,3 +101,23 @@ dvdnav_status_t dvdnav_audio_language_select(dvdnav_t *this, char *code) {
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;
+}
diff --git a/src/input/libdvdnav/vm.c b/src/input/libdvdnav/vm.c
index 0248292b6..fe07b76be 100644
--- a/src/input/libdvdnav/vm.c
+++ b/src/input/libdvdnav/vm.c
@@ -19,7 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: vm.c,v 1.14 2003/03/21 22:13:38 mroi Exp $
+ * $Id: vm.c,v 1.15 2003/03/25 13:17:22 mroi Exp $
*
*/
@@ -471,6 +471,13 @@ int vm_jump_pg(vm_t *vm, int pg) {
return 1;
}
+int vm_jump_cell_block(vm_t *vm, int cell, int block) {
+ (vm->state).cellN = cell;
+ process_command(vm, play_Cell(vm));
+ (vm->state).blockN = block;
+ return 1;
+}
+
int vm_jump_title_part(vm_t *vm, int title, int part) {
int vtsN;
@@ -479,7 +486,6 @@ int vm_jump_title_part(vm_t *vm, int title, int part) {
if(!set_VTS_PTT(vm, vtsN, title, part))
return 0;
process_command(vm, play_PGC_PG(vm, (vm->state).pgN));
- vm->hop_channel++;
return 1;
}
@@ -1799,6 +1805,11 @@ void vm_position_print(vm_t *vm, vm_position_t *position) {
/*
* $Log: vm.c,v $
+ * Revision 1.15 2003/03/25 13:17:22 mroi
+ * sync to cvs of libdvdnav
+ * * optional PGC based seeking
+ * * new event on cell changes for timing info (currently not used by xine-lib)
+ *
* Revision 1.14 2003/03/21 22:13:38 mroi
* sync to libdvdnav cvs
* * method to try-run VM operations, now used for safer chapter skipping and menu jumps
diff --git a/src/input/libdvdnav/vm.h b/src/input/libdvdnav/vm.h
index ee5e4d16f..e56001d2d 100644
--- a/src/input/libdvdnav/vm.h
+++ b/src/input/libdvdnav/vm.h
@@ -19,7 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: vm.h,v 1.5 2003/03/21 22:13:39 mroi Exp $
+ * $Id: vm.h,v 1.6 2003/03/25 13:17:23 mroi Exp $
*
*/
@@ -69,8 +69,11 @@ typedef struct vm_position_s {
int32_t angle_channel; /* angle channel to use */
int32_t audio_channel; /* audio channel to use */
int32_t hop_channel; /* channel hopping. E.g menu button pressed */
+#if 0
+ /* currently unused */
int32_t title; /* title number */
int32_t chapter; /* chapter number */
+#endif
int32_t cell; /* cell number */
int32_t cell_restart; /* get cell to restart */
int32_t cell_start; /* sector number of start of current cell in use */
@@ -139,6 +142,7 @@ void vm_get_next_cell(vm_t *vm);
/* Jumping - all these return 1, if a hop has been performed */
int vm_jump_pg(vm_t *vm, int pg);
+int vm_jump_cell_block(vm_t *vm, int cell, int block);
int vm_jump_title_part(vm_t *vm, int title, int part);
int vm_jump_top_pg(vm_t *vm);
int vm_jump_next_pg(vm_t *vm);