From 1c8662d291633ba4a0fde264fd548f4f39de95b9 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Mon, 2 Oct 2017 19:22:36 +0200 Subject: [PATCH] Remove dead code. --- MP42/MP42SSAImporter.m | 13 +++++----- MP42/MP42SubUtilities.h | 1 - MP42/MP42SubUtilities.m | 57 ----------------------------------------- 3 files changed, 6 insertions(+), 65 deletions(-) diff --git a/MP42/MP42SSAImporter.m b/MP42/MP42SSAImporter.m index f728512..6544d45 100644 --- a/MP42/MP42SSAImporter.m +++ b/MP42/MP42SSAImporter.m @@ -24,7 +24,6 @@ @interface MP42SSAImporter () @property (nonatomic, readonly) MP42SSAParser *parser; -@property (nonatomic, readonly) SBSubSerializer *ss; @end @@ -100,17 +99,17 @@ MP42SSAConverter *converter = [[MP42SSAConverter alloc] initWithParser:_parser]; - _ss = [[SBSubSerializer alloc] init]; - [_ss setSSA:YES]; + SBSubSerializer *ss = [[SBSubSerializer alloc] init]; + [ss setSSA:YES]; for (MP42SSALine *line in _parser.lines) { NSString *text = [converter convertLine:line]; if (text.length) { SBSubLine *sl = [[SBSubLine alloc] initWithLine:text start:line.start end: line.end]; - [_ss addLine:sl]; + [ss addLine:sl]; } } - [_ss setFinished:YES]; + [ss setFinished:YES]; for (MP42SubtitleTrack *track in self.inputTracks) { CGSize trackSize; @@ -118,8 +117,8 @@ trackSize.height = track.trackHeight; MP42SampleBuffer *sample; - while (!_ss.isEmpty && !self.isCancelled) { - SBSubLine *sl = [_ss getSerializedPacket]; + while (!ss.isEmpty && !self.isCancelled) { + SBSubLine *sl = [ss getSerializedPacket]; if ([sl->line isEqualToString:@"\n"]) { sample = copyEmptySubtitleSample(track.sourceId, sl->end_time - sl->begin_time, NO); diff --git a/MP42/MP42SubUtilities.h b/MP42/MP42SubUtilities.h index 38a2adb..417e7fd 100644 --- a/MP42/MP42SubUtilities.h +++ b/MP42/MP42SubUtilities.h @@ -54,7 +54,6 @@ int LoadSRTFromURL(NSURL *url, SBSubSerializer *ss, MP4Duration *duration); int LoadSMIFromURL(NSURL *url, SBSubSerializer *ss, int subCount); int LoadChaptersFromURL(NSURL *url, NSMutableArray *ss); -NSString *StripSSALine(NSString *line); unsigned ParseSubTime(const char *time, unsigned secondScale, BOOL hasSign); diff --git a/MP42/MP42SubUtilities.m b/MP42/MP42SubUtilities.m index d08e051..2405e6a 100644 --- a/MP42/MP42SubUtilities.m +++ b/MP42/MP42SubUtilities.m @@ -806,63 +806,6 @@ int LoadSMIFromURL(NSURL *url, SBSubSerializer *ss, int subCount) return 1; } -NSString * StripSSALine(NSString *line) -{ - NSUInteger i = 0; - - NSScanner *sc = [NSScanner scannerWithString:line]; - for (i = 0; i < 8; i++) { - [sc scanUpToString:@"," intoString:nil]; - [sc scanString:@"," intoString:nil]; - } - - line = [sc.string substringFromIndex:sc.scanLocation]; - - NSRange startRange = [line rangeOfString: @"}"]; - while (startRange.location != NSNotFound) { - NSRange endRange = [line rangeOfString: @"{"]; - if (endRange.location != NSNotFound && endRange.length != 0) { - NSString *replacement = @""; - if (endRange.location + 3 < line.length) { - unichar tag = [line characterAtIndex:endRange.location + 2]; - unichar tagState = [line characterAtIndex:endRange.location + 3]; - if (tagState == '1') { - if (tag == 'i') replacement = @""; - else if (tag == 'b') replacement = @""; - else if (tag == 'u') replacement = @""; - } - else if (tagState == '0'){ - if (tag == 'i') replacement = @""; - else if (tag == 'b') replacement = @""; - else if (tag == 'u') replacement = @""; - } - } - endRange.length = startRange.location - endRange.location +1; - line = [line stringByReplacingCharactersInRange:endRange withString:replacement]; - startRange = [line rangeOfString: @"}"]; - } - else { - break; - } - } - - startRange = [line rangeOfString: @"\\N"]; - while (startRange.location != NSNotFound) { - startRange.length = 2; - line = [line stringByReplacingCharactersInRange:startRange withString:@"\n"]; - startRange = [line rangeOfString: @"\\N"]; - } - - startRange = [line rangeOfString: @"\\n"]; - while (startRange.location != NSNotFound) { - startRange.length = 2; - line = [line stringByReplacingCharactersInRange:startRange withString:@"\n"]; - startRange = [line rangeOfString: @"\\n"]; - } - - return line; -} - u_int8_t* createStyleRecord(u_int16_t startChar, u_int16_t endChar, u_int16_t fontID, u_int8_t flags, rgba_color color, u_int8_t* style) { style[0] = (startChar >> 8) & 0xff; // startChar