[libdvdnav-devel] events: Clarify which fields are time and which are offsets

Luca Barbato git at videolan.org
Wed Dec 3 17:49:42 CET 2014


libdvdnav | branch: master | Luca Barbato <lu_zero at gentoo.org> | Mon Dec  1 16:20:39 2014 +0100| [eaf2c44e8ab8fbd98194be28710b8ad70335b316] | committer: Jean-Baptiste Kempf

events: Clarify which fields are time and which are offsets

cell_length and cell_start are glaringly offsets,
pg_length and pg_start seem the same but I'm not sure
pgc_length seems rightfully a time.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/dvdnav.c               |    9 +++++----
 src/dvdnav/dvdnav_events.h |    8 ++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/dvdnav.c b/src/dvdnav.c
index a5fac25..69bc4f8 100644
--- a/src/dvdnav.c
+++ b/src/dvdnav.c
@@ -688,7 +688,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
     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);
+        (state->pgc->cell_playback[state->cellN - 1].last_sector + 1);
 
     cell_event->pg_length = 0;
     /* Find start cell of program. */
@@ -700,18 +700,19 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
       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);
+        (state->pgc->cell_playback[i - 1].last_sector + 1);
+
     cell_event->pgc_length = dvdnav_convert_time(&state->pgc->playback_time);
 
     cell_event->cell_start = 0;
     for (i = 1; i < state->cellN; i++)
       cell_event->cell_start +=
-        dvdnav_convert_time(&state->pgc->cell_playback[i - 1].playback_time);
+          (state->pgc->cell_playback[i - 1].last_sector + 1);
 
     cell_event->pg_start = 0;
     for (i = 1; i < state->pgc->program_map[state->pgN-1]; i++)
       cell_event->pg_start +=
-        dvdnav_convert_time(&state->pgc->cell_playback[i - 1].playback_time);
+        (state->pgc->cell_playback[i - 1].last_sector + 1);
 
     this->position_current.cell         = this->position_next.cell;
     this->position_current.cell_restart = this->position_next.cell_restart;
diff --git a/src/dvdnav/dvdnav_events.h b/src/dvdnav/dvdnav_events.h
index b912c54..0a9b373 100644
--- a/src/dvdnav/dvdnav_events.h
+++ b/src/dvdnav/dvdnav_events.h
@@ -139,11 +139,11 @@ typedef struct {
 typedef struct {
   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 cell_length; /* the length of the current cell in sectors */
+  int64_t pg_length;   /* the length of the current program in sectors */
   int64_t pgc_length;  /* the length of the current program chain in PTS ticks */
-  int64_t cell_start;  /* the start time of the current cell relatively to the PGC in PTS ticks */
-  int64_t pg_start;    /* the start time of the current PG relatively to the PGC in PTS ticks */
+  int64_t cell_start;  /* the start offset of the current cell relatively to the PGC in sectors */
+  int64_t pg_start;    /* the start offset of the current PG relatively to the PGC in sectors */
 } dvdnav_cell_change_event_t;
 
 



More information about the libdvdnav-devel mailing list