Fix findChapterPreviewTrackId

This commit is contained in:
Damiano Galassi committed 2017-09-01 09:09:17 +02:00
1 parent fc6b9d8a4c
commit c9a13f3b1d
2 files changed
+2 -9

No files matched your search

+1 -8
View File
@@ -205,7 +205,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
_tracks = [[NSMutableArray alloc] init];
uint32_t tracksCount = MP4GetNumberOfTracks(_fileHandle, 0, 0);
MP4TrackId chapterId = findChapterTrackId(_fileHandle);
MP4TrackId previewsId = 0; //findChapterPreviewTrackId(_fileHandle);
MP4TrackId previewsId = findChapterPreviewTrackId(_fileHandle);
for (int i = 0; i< tracksCount; i++) {
id track;
@@ -239,13 +239,6 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
// Restore the tracks references in the wrapped tracks
[self reconnectReferences];
// Ugly hack to check for the previews track
for (MP42Track *track in _tracks) {
if (track.format == kMP42VideoCodecType_JPEG) {
previewsId = track.trackId;
}
}
// Load the previews images
[self loadPreviewsFromTrackID:previewsId];
+1 -1
View File
@@ -120,7 +120,7 @@ MP4TrackId findChapterPreviewTrackId(MP4FileHandle fileHandle)
if (MP4HaveTrackAtom(fileHandle, trackId, "tref.chap")) {
uint64_t entryCount = 0;
MP4GetTrackIntegerProperty(fileHandle, trackId, "tref.chap.entryCount", &entryCount);
if (entryCount > 1 && MP4GetTrackIntegerProperty(fileHandle, trackId, "tref.chap.entries.trackId[1]", &trackRef))
if (entryCount > 1 && MP4GetTrackIntegerProperty(fileHandle, trackId, "tref.chap.entries[1].trackId", &trackRef))
if (trackRef > 0)
return (MP4TrackId) trackRef;
}