next/previous chapter.

This commit is contained in:
Damiano Galassi committed 2013-11-04 09:47:22 +01:00
1 parent 05cf06cfa9
commit 22afab8481
2 files changed
+14 -4

No files matched your search

+4 -2
View File
@@ -18,12 +18,14 @@
- (instancetype)initWithSourceURL:(NSURL *)URL trackID:(NSInteger)trackID fileHandle:(MP42FileHandle)fileHandle; - (instancetype)initWithSourceURL:(NSURL *)URL trackID:(NSInteger)trackID fileHandle:(MP42FileHandle)fileHandle;
+ (instancetype)chapterTrackFromFile:(NSURL *)URL; + (instancetype)chapterTrackFromFile:(NSURL *)URL;
- (void)addChapter:(NSString *)title duration:(uint64_t)timestamp; - (NSUInteger)addChapter:(NSString *)title duration:(uint64_t)timestamp;
- (void)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;
- (void)removeChaptersAtIndexes:(NSIndexSet *)indexes; - (void)removeChaptersAtIndexes:(NSIndexSet *)indexes;
- (NSUInteger)indexOfChapter:(MP42TextSample *)chapterSample;
- (void)setTimestamp:(MP42Duration)timestamp forChapter:(MP42TextSample *)chapterSample; - (void)setTimestamp:(MP42Duration)timestamp forChapter:(MP42TextSample *)chapterSample;
- (void)setTitle:(NSString*)title forChapter:(MP42TextSample *)chapterSample; - (void)setTitle:(NSString*)title forChapter:(MP42TextSample *)chapterSample;
+10 -2
View File
@@ -100,7 +100,7 @@
return [[[MP42ChapterTrack alloc] initWithTextFile:URL] autorelease]; return [[[MP42ChapterTrack alloc] initWithTextFile:URL] autorelease];
} }
- (void)addChapter:(NSString *)title duration:(uint64_t)timestamp - (NSUInteger)addChapter:(NSString *)title duration:(uint64_t)timestamp
{ {
MP42TextSample *newChapter = [[MP42TextSample alloc] init]; MP42TextSample *newChapter = [[MP42TextSample alloc] init];
newChapter.title = title; newChapter.title = title;
@@ -112,9 +112,11 @@
[chapters addObject:newChapter]; [chapters addObject:newChapter];
[chapters sortUsingSelector:@selector(compare:)]; [chapters sortUsingSelector:@selector(compare:)];
[newChapter release]; [newChapter release];
return [chapters indexOfObject:newChapter];
} }
- (void)addChapter:(NSString *)title image:(MP42Image *)image duration:(uint64_t)timestamp { - (NSUInteger)addChapter:(NSString *)title image:(MP42Image *)image duration:(uint64_t)timestamp {
MP42TextSample *newChapter = [[MP42TextSample alloc] init]; MP42TextSample *newChapter = [[MP42TextSample alloc] init];
newChapter.title = title; newChapter.title = title;
newChapter.image = image; newChapter.image = image;
@@ -126,6 +128,12 @@
[chapters addObject:newChapter]; [chapters addObject:newChapter];
[chapters sortUsingSelector:@selector(compare:)]; [chapters sortUsingSelector:@selector(compare:)];
[newChapter release]; [newChapter release];
return [chapters indexOfObject:newChapter];
}
- (NSUInteger)indexOfChapter:(MP42TextSample *)chapterSample {
return [chapters indexOfObject:chapterSample];
} }
- (void)removeChapterAtIndex:(NSUInteger)index - (void)removeChapterAtIndex:(NSUInteger)index