summaryrefslogtreecommitdiffstats
path: root/libhb/dvd.c
diff options
context:
space:
mode:
authorRodeo <[email protected]>2012-05-03 16:04:28 +0000
committerRodeo <[email protected]>2012-05-03 16:04:28 +0000
commit4aeadc9bc63d200d6c0b709eba7e25c4f3afe24c (patch)
tree4d73da1a557826fd4b553172180f6cd455b5ecbb /libhb/dvd.c
parent9b3507211cff2ddf6bec9072d7767e461bdc0fa7 (diff)
libhb: if no source chapter name information is available, set default chapters names explicitly (rather than leaving it to the interfaces).
Standardize calculation of chapter->hours, chapter->minutes and chapter->seconds across all sources. Get rid of an unused variable in libhb/dvd.c Ignore chapter names set by MakeMKV. "Chapter 1" is just as good as, if not better than "Chapter 01" or even "Chapter 00". git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4636 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/dvd.c')
-rw-r--r--libhb/dvd.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/libhb/dvd.c b/libhb/dvd.c
index 5dbe85072..f4260d5fc 100644
--- a/libhb/dvd.c
+++ b/libhb/dvd.c
@@ -170,7 +170,6 @@ static hb_title_t * hb_dvdread_title_scan( hb_dvd_t * e, int t, uint64_t min_dur
ifo_handle_t * vts = NULL;
int pgc_id, pgn, i;
hb_chapter_t * chapter;
- int c;
uint64_t duration;
float duration_correction;
unsigned char unused[1024];
@@ -562,12 +561,14 @@ static hb_title_t * hb_dvdread_title_scan( hb_dvd_t * e, int t, uint64_t min_dur
/* Chapters */
hb_log( "scan: title %d has %d chapters", t,
vts->vts_ptt_srpt->title[title->ttn-1].nr_of_ptts );
- for( i = 0, c = 1;
+ for( i = 0;
i < vts->vts_ptt_srpt->title[title->ttn-1].nr_of_ptts; i++ )
{
chapter = calloc( sizeof( hb_chapter_t ), 1 );
+
/* remember the on-disc chapter number */
chapter->index = i + 1;
+ sprintf( chapter->title, "Chapter %d", chapter->index );
pgc_id = vts->vts_ptt_srpt->title[title->ttn-1].ptt[i].pgcn;
pgn = vts->vts_ptt_srpt->title[title->ttn-1].ptt[i].pgn;
@@ -605,8 +606,8 @@ static hb_title_t * hb_dvdread_title_scan( hb_dvd_t * e, int t, uint64_t min_dur
FindNextCell( d );
d->cell_cur = d->cell_next;
}
+
hb_list_add( title->list_chapter, chapter );
- c++;
}
/* The durations we get for chapters aren't precise. Scale them so
@@ -620,13 +621,13 @@ static hb_title_t * hb_dvdread_title_scan( hb_dvd_t * e, int t, uint64_t min_dur
duration_correction = (float) title->duration / (float) duration;
for( i = 0; i < hb_list_count( title->list_chapter ); i++ )
{
- int seconds;
- chapter = hb_list_item( title->list_chapter, i );
- chapter->duration = duration_correction * chapter->duration;
- seconds = ( chapter->duration + 45000 ) / 90000;
- chapter->hours = seconds / 3600;
- chapter->minutes = ( seconds % 3600 ) / 60;
- chapter->seconds = seconds % 60;
+ chapter = hb_list_item( title->list_chapter, i );
+ chapter->duration = duration_correction * chapter->duration;
+
+ int seconds = ( chapter->duration + 45000 ) / 90000;
+ chapter->hours = ( seconds / 3600 );
+ chapter->minutes = ( seconds % 3600 ) / 60;
+ chapter->seconds = ( seconds % 60 );
hb_log( "scan: chap %d c=%d->%d, b=%"PRIu64"->%"PRIu64" (%"PRIu64"), %"PRId64" ms",
chapter->index, chapter->cell_start, chapter->cell_end,