diff options
author | dynaflash <[email protected]> | 2008-09-19 14:55:38 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2008-09-19 14:55:38 +0000 |
commit | 587179e9ef92374b640db3fde41427557972c026 (patch) | |
tree | 467a259780d900c905ec82561294fbb1439a8951 /macosx/Controller.mm | |
parent | 4c7c7aecd71c171844a5f8d620bb17f4a1575860 (diff) |
MacGui: Custom chapter names restored (borked in 1703)
- The chapter names are now stored in the queue as the key "ChapterNames" which has an array of names as its value and are re-applied to the job when the queue goes to that encode if applicable.
- As with all things, should save some work if you use a lot of custom chapter names and you have to shut down during a long queue encode and restart later.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1730 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/Controller.mm')
-rw-r--r-- | macosx/Controller.mm | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/macosx/Controller.mm b/macosx/Controller.mm index a7d1b73c6..82f86701f 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -1669,10 +1669,8 @@ fWorkingCount = 0; hb_title_t * title = (hb_title_t *) hb_list_item( list, [fSrcTitlePopUp indexOfSelectedItem] ); hb_job_t * job = title->job; - //hb_audio_config_t * audio; - // For picture filters - //hb_job_t * job = fTitle->job; + /* We use a number system to set the encode status of the queue item * 0 == already encoded @@ -1699,7 +1697,26 @@ fWorkingCount = 0; [queueFileJob setObject:[fDstFormatPopUp titleOfSelectedItem] forKey:@"FileFormat"]; /* Chapter Markers fCreateChapterMarkers*/ [queueFileJob setObject:[NSNumber numberWithInt:[fCreateChapterMarkers state]] forKey:@"ChapterMarkers"]; - /* Allow Mpeg4 64 bit formatting +4GB file sizes */ + + /* We need to get the list of chapter names to put into an array and store + * in our queue, so they can be reapplied in prepareJob when this queue + * item comes up if Chapter Markers is set to on. + */ + int i; + NSMutableArray *ChapterNamesArray = [[NSMutableArray alloc] init]; + int chaptercount = hb_list_count( fTitle->list_chapter ); + for( i = 0; i < chaptercount; i++ ) + { + hb_chapter_t *chapter = (hb_chapter_t *) hb_list_item( fTitle->list_chapter, i ); + if( chapter != NULL ) + { + [ChapterNamesArray addObject:[NSString stringWithFormat:@"%s",chapter->title]]; + } + } + [queueFileJob setObject:[NSMutableArray arrayWithArray: ChapterNamesArray] forKey:@"ChapterNames"]; + [ChapterNamesArray autorelease]; + + /* Allow Mpeg4 64 bit formatting +4GB file sizes */ [queueFileJob setObject:[NSNumber numberWithInt:[fDstMp4LargeFileCheck state]] forKey:@"Mp4LargeFile"]; /* Mux mp4 with http optimization */ [queueFileJob setObject:[NSNumber numberWithInt:[fDstMp4HttpOptFileCheck state]] forKey:@"Mp4HttpOptimize"]; @@ -2486,6 +2503,7 @@ fWorkingCount = 0; { job->mp4_optimize = 0; } + //} /* We set the chapter marker extraction here based on the format being @@ -2493,13 +2511,39 @@ fWorkingCount = 0; if ([[queueToApply objectForKey:@"ChapterMarkers"] intValue] == 1) { job->chapter_markers = 1; + + /* now lets get our saved chapter names out the array in the queue file + * and insert them back into the title chapter list. We have it here, + * because unless we are inserting chapter markers there is no need to + * spend the overhead of iterating through the chapter names array imo + * Also, note that if for some reason we don't apply chapter names, the + * chapters just come out 001, 002, etc. etc. + */ + + NSMutableArray *ChapterNamesArray = [queueToApply objectForKey:@"ChapterNames"]; + int i = 0; + NSEnumerator *enumerator = [ChapterNamesArray objectEnumerator]; + id tempObject; + while (tempObject = [enumerator nextObject]) + { + hb_chapter_t *chapter = (hb_chapter_t *) hb_list_item( title->list_chapter, i ); + if( chapter != NULL ) + { + strncpy( chapter->title, [tempObject UTF8String], 1023); + chapter->title[1023] = '\0'; + } + i++; + } } else { job->chapter_markers = 0; } - + + + + if( job->vcodec & HB_VCODEC_X264 ) { if ([[queueToApply objectForKey:@"Mp4iPodCompatible"] intValue] == 1) |