Make a MP42Chapter method clearer
This commit is contained in:
4 files changed
+5
-5
No files matched your search
@@ -106,7 +106,7 @@ MP42_OBJC_DIRECT_MEMBERS
|
|||||||
for (AVMetadataItem *item in chapterData.items) {
|
for (AVMetadataItem *item in chapterData.items) {
|
||||||
CMTime time = item.time;
|
CMTime time = item.time;
|
||||||
NSString *title = item.stringValue ? item.stringValue : @"";
|
NSString *title = item.stringValue ? item.stringValue : @"";
|
||||||
[chapters addChapter:title duration:time.value * time.timescale / 1000];
|
[chapters addChapter:title timestamp:time.value * time.timescale / 1000];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
+ (instancetype)chapterTrackFromFile:(NSURL *)URL;
|
+ (instancetype)chapterTrackFromFile:(NSURL *)URL;
|
||||||
|
|
||||||
- (NSUInteger)addChapter:(MP42TextSample *)chapter;
|
- (NSUInteger)addChapter:(MP42TextSample *)chapter;
|
||||||
- (NSUInteger)addChapter:(NSString *)title duration:(uint64_t)timestamp;
|
- (NSUInteger)addChapter:(NSString *)title timestamp:(uint64_t)timestamp;
|
||||||
- (NSUInteger)addChapter:(NSString *)title image:(MP42Image *)image duration:(uint64_t)timestamp;
|
- (NSUInteger)addChapter:(NSString *)title image:(MP42Image *)image duration:(uint64_t)timestamp;
|
||||||
|
|
||||||
- (void)removeChapterAtIndex:(NSUInteger)index;
|
- (void)removeChapterAtIndex:(NSUInteger)index;
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ MP42_OBJC_DIRECT_MEMBERS
|
|||||||
return [_chapters indexOfObject:chapter];
|
return [_chapters indexOfObject:chapter];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger)addChapter:(NSString *)title duration:(uint64_t)timestamp
|
- (NSUInteger)addChapter:(NSString *)title timestamp:(uint64_t)timestamp
|
||||||
{
|
{
|
||||||
MP42TextSample *newChapter = [[MP42TextSample alloc] init];
|
MP42TextSample *newChapter = [[MP42TextSample alloc] init];
|
||||||
newChapter.title = title;
|
newChapter.title = title;
|
||||||
|
|||||||
@@ -323,10 +323,10 @@ MP42_OBJC_DIRECT_MEMBERS
|
|||||||
}
|
}
|
||||||
if (chapters->Children[xi].Display && strlen(chapters->Children[xi].Display->String)) {
|
if (chapters->Children[xi].Display && strlen(chapters->Children[xi].Display->String)) {
|
||||||
[newTrack addChapter:[NSString stringWithUTF8String:chapters->Children[xi].Display->String]
|
[newTrack addChapter:[NSString stringWithUTF8String:chapters->Children[xi].Display->String]
|
||||||
duration:timestamp];
|
timestamp:timestamp];
|
||||||
} else {
|
} else {
|
||||||
[newTrack addChapter:[NSString stringWithFormat:@"Chapter %d", xi+1]
|
[newTrack addChapter:[NSString stringWithFormat:@"Chapter %d", xi+1]
|
||||||
duration:timestamp];
|
timestamp:timestamp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[self addTrack:newTrack];
|
[self addTrack:newTrack];
|
||||||
|
|||||||
Reference in new issue
Block a user