diff --git a/MP42/MP42File.m b/MP42/MP42File.m index 7357113..9e4bf7a 100644 --- a/MP42/MP42File.m +++ b/MP42/MP42File.m @@ -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]; diff --git a/MP42/MP42PrivateUtilities.m b/MP42/MP42PrivateUtilities.m index bebe4e1..3f2a637 100644 --- a/MP42/MP42PrivateUtilities.m +++ b/MP42/MP42PrivateUtilities.m @@ -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; }