Added - (NSUInteger)addChapter:(MP42TextSample *)chapter to MP42Chapter.

This commit is contained in:
Damiano Galassi committed 2013-11-15 19:55:14 +01:00
1 parent 6358471ca8
commit c91c79b7a3
2 files changed
+16 -12

No files matched your search

+1
View File
@@ -18,6 +18,7 @@
- (instancetype)initWithSourceURL:(NSURL *)URL trackID:(NSInteger)trackID fileHandle:(MP42FileHandle)fileHandle;
+ (instancetype)chapterTrackFromFile:(NSURL *)URL;
- (NSUInteger)addChapter:(MP42TextSample *)chapter;
- (NSUInteger)addChapter:(NSString *)title duration:(uint64_t)timestamp;
- (NSUInteger)addChapter:(NSString *)title image:(MP42Image *)image duration:(uint64_t)timestamp;
+15 -12
View File
@@ -100,20 +100,27 @@
return [[[MP42ChapterTrack alloc] initWithTextFile:URL] autorelease];
}
- (NSUInteger)addChapter:(MP42TextSample *)chapter
{
_isEdited = YES;
_areChaptersEdited = YES;
[chapters addObject:chapter];
[chapters sortUsingSelector:@selector(compare:)];
return [chapters indexOfObject:chapter];
}
- (NSUInteger)addChapter:(NSString *)title duration:(uint64_t)timestamp
{
MP42TextSample *newChapter = [[MP42TextSample alloc] init];
newChapter.title = title;
newChapter.timestamp = timestamp;
_isEdited = YES;
_areChaptersEdited = YES;
[chapters addObject:newChapter];
[chapters sortUsingSelector:@selector(compare:)];
NSUInteger idx = [self addChapter:newChapter];
[newChapter release];
return [chapters indexOfObject:newChapter];
return idx;
}
- (NSUInteger)addChapter:(NSString *)title image:(MP42Image *)image duration:(uint64_t)timestamp {
@@ -122,14 +129,10 @@
newChapter.image = image;
newChapter.timestamp = timestamp;
_isEdited = YES;
_areChaptersEdited = YES;
[chapters addObject:newChapter];
[chapters sortUsingSelector:@selector(compare:)];
NSUInteger idx = [self addChapter:newChapter];
[newChapter release];
return [chapters indexOfObject:newChapter];
return idx;
}
- (NSUInteger)indexOfChapter:(MP42TextSample *)chapterSample {