summaryrefslogtreecommitdiffstats
path: root/libhb/decmetadata.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/decmetadata.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/decmetadata.c')
-rw-r--r--libhb/decmetadata.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/libhb/decmetadata.c b/libhb/decmetadata.c
index bd848a95a..01f1b0dec 100644
--- a/libhb/decmetadata.c
+++ b/libhb/decmetadata.c
@@ -80,13 +80,25 @@ static void decmp4metadata( hb_title_t *title )
chapter = calloc( sizeof( hb_chapter_t ), 1 );
chapter->index = i;
chapter->duration = chapter_list[i-1].duration * 90;
- chapter->hours = chapter->duration / 90000 / 3600;
- chapter->minutes = ( ( chapter->duration / 90000 ) % 3600 ) / 60;
- chapter->seconds = ( chapter->duration / 90000 ) % 60;
- strcpy( chapter->title, chapter_list[i-1].title );
- hb_deep_log( 2, "Added chapter %i, name='%s', dur=%"PRId64", (%02i:%02i:%02i)", chapter->index, chapter->title,
- chapter->duration, chapter->hours,
- chapter->minutes, chapter->seconds);
+
+ int seconds = ( chapter->duration + 45000 ) / 90000;
+ chapter->hours = ( seconds / 3600 );
+ chapter->minutes = ( seconds % 3600 ) / 60;
+ chapter->seconds = ( seconds % 60 );
+
+ if( chapter_list[i-1].title )
+ {
+ strcpy( chapter->title, chapter_list[i-1].title );
+ }
+ else
+ {
+ sprintf( chapter->title, "Chapter %d", chapter->index );
+ }
+
+ hb_deep_log( 2, "Added chapter %i, name='%s', dur=%"PRId64", (%02i:%02i:%02i)",
+ chapter->index, chapter->title, chapter->duration,
+ chapter->hours, chapter->minutes, chapter->seconds);
+
hb_list_add( title->list_chapter, chapter );
i++;
}