Cosmetics.
This commit is contained in:
1 parent
1b17ce90b2
commit
b29092a153
1 file changed
+10
-11
+10
-11
@@ -48,17 +48,15 @@
|
|||||||
|
|
||||||
unsigned int i = 1;
|
unsigned int i = 1;
|
||||||
MP4Duration sum = 0;
|
MP4Duration sum = 0;
|
||||||
while (i <= chapter_count)
|
while (i <= chapter_count) {
|
||||||
{
|
|
||||||
MP42TextSample *chapter = [[MP42TextSample alloc] init];
|
MP42TextSample *chapter = [[MP42TextSample alloc] init];
|
||||||
|
|
||||||
char * title = chapter_list[i-1].title;
|
char *title = chapter_list[i-1].title;
|
||||||
if ((title[0] == '\xfe' && title[1] == '\xff') || (title[0] == '\xff' && title[1] == '\xfe')) {
|
if ((title[0] == '\xfe' && title[1] == '\xff') || (title[0] == '\xff' && title[1] == '\xfe')) {
|
||||||
chapter.title = [[[NSString alloc] initWithBytes:title
|
chapter.title = [[[NSString alloc] initWithBytes:title
|
||||||
length:chapter_list[i-1].titleLength
|
length:chapter_list[i-1].titleLength
|
||||||
encoding:NSUTF16StringEncoding] autorelease];
|
encoding:NSUTF16StringEncoding] autorelease];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
chapter.title = [NSString stringWithCString:chapter_list[i-1].title encoding: NSUTF8StringEncoding];
|
chapter.title = [NSString stringWithCString:chapter_list[i-1].title encoding: NSUTF8StringEncoding];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,14 +223,14 @@
|
|||||||
MP42TextSample * nextChapter = [chapters objectAtIndex:i+1];
|
MP42TextSample * nextChapter = [chapters objectAtIndex:i+1];
|
||||||
fileChapters[i].duration = nextChapter.timestamp - chapter.timestamp;
|
fileChapters[i].duration = nextChapter.timestamp - chapter.timestamp;
|
||||||
sum = nextChapter.timestamp;
|
sum = nextChapter.timestamp;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
fileChapters[i].duration = refTrackDuration - chapter.timestamp;
|
fileChapters[i].duration = refTrackDuration - chapter.timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
if (sum > refTrackDuration) {
|
if (sum > refTrackDuration) {
|
||||||
fileChapters[i].duration = refTrackDuration - chapter.timestamp;
|
fileChapters[i].duration = refTrackDuration - chapter.timestamp;
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,16 +241,17 @@
|
|||||||
success = _Id = findChapterTrackId(fileHandle);
|
success = _Id = findChapterTrackId(fileHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
if ( outError != NULL)
|
if (outError != NULL)
|
||||||
*outError = MP42Error(@"Failed to mux chapters into mp4 file",
|
*outError = MP42Error(@"Failed to mux chapters into mp4 file",
|
||||||
nil,
|
nil,
|
||||||
120);
|
120);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
} else if (_Id) {
|
||||||
else if (_Id)
|
|
||||||
success = [super writeToFile:fileHandle error:outError];
|
success = [super writeToFile:fileHandle error:outError];
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user