From 077f0ff2f64f27f038add54a9b76939cab2e803d Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Fri, 1 Nov 2013 11:07:35 +0100 Subject: [PATCH] Public MP42TextSample --- MP42.xcodeproj/project.pbxproj | 31 +++++++++++++++++++-- MP42/MP42AudioConverter.m | 2 ++ MP42/MP42CCImporter.m | 8 +++--- MP42/MP42ChapterTrack.h | 9 +++--- MP42/MP42ChapterTrack.m | 20 +++++++------- MP42/MP42File.m | 6 ++-- MP42/MP42FileImporter.h | 2 ++ MP42/MP42FileImporter.m | 2 ++ MP42/MP42SubUtilities.h | 11 +------- MP42/MP42SubUtilities.m | 45 ++---------------------------- MP42/MP42TextSample.h | 21 ++++++++++++++ MP42/MP42TextSample.m | 50 ++++++++++++++++++++++++++++++++++ MP42/MP42Track.h | 15 ---------- MP42/MP42Track.m | 11 ++++++-- MP42/MP42Track_Muxer.h | 30 ++++++++++++++++++++ 15 files changed, 169 insertions(+), 94 deletions(-) create mode 100644 MP42/MP42TextSample.h create mode 100644 MP42/MP42TextSample.m create mode 100644 MP42/MP42Track_Muxer.h diff --git a/MP42.xcodeproj/project.pbxproj b/MP42.xcodeproj/project.pbxproj index 15da830..ce2c6e2 100644 --- a/MP42.xcodeproj/project.pbxproj +++ b/MP42.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + A989F1001823AB2E0070AD8C /* MP42Track_Muxer.h in Headers */ = {isa = PBXBuildFile; fileRef = A989F0FF1823AB2E0070AD8C /* MP42Track_Muxer.h */; }; + A989F10F1823B3B40070AD8C /* MP42TextSample.h in Headers */ = {isa = PBXBuildFile; fileRef = A989F10D1823B3B40070AD8C /* MP42TextSample.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A989F1101823B3B40070AD8C /* MP42TextSample.m in Sources */ = {isa = PBXBuildFile; fileRef = A989F10E1823B3B40070AD8C /* MP42TextSample.m */; }; A9B9C1F1182391DF00416A4E /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9B9C1F0182391DF00416A4E /* Cocoa.framework */; }; A9B9C1FB182391DF00416A4E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A9B9C1F9182391DF00416A4E /* InfoPlist.strings */; }; A9B9C206182391DF00416A4E /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9B9C205182391DF00416A4E /* XCTest.framework */; }; @@ -118,6 +121,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + A989F10A1823AEA90070AD8C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A9B9C2B61823944700416A4E /* UniversalDetector.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 3DBF4F560BCD396800DA401A; + remoteInfo = universaldetector; + }; A9B9C208182391DF00416A4E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A9B9C1E4182391DF00416A4E /* Project object */; @@ -149,6 +159,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + A989F0FF1823AB2E0070AD8C /* MP42Track_Muxer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MP42Track_Muxer.h; sourceTree = ""; }; + A989F10D1823B3B40070AD8C /* MP42TextSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MP42TextSample.h; sourceTree = ""; }; + A989F10E1823B3B40070AD8C /* MP42TextSample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MP42TextSample.m; sourceTree = ""; }; A9B9C1ED182391DF00416A4E /* MP42.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MP42.framework; sourceTree = BUILT_PRODUCTS_DIR; }; A9B9C1F0182391DF00416A4E /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; A9B9C1F3182391DF00416A4E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -448,6 +461,7 @@ children = ( A9B9C2421823923100416A4E /* MP42Muxer.h */, A9B9C2431823923100416A4E /* MP42Muxer.m */, + A989F0FF1823AB2E0070AD8C /* MP42Track_Muxer.h */, A9B9C2481823923100416A4E /* MP42Sample.h */, A9B9C2491823923100416A4E /* MP42Sample.m */, A9B9C22D1823923100416A4E /* MP42ConverterProtocol.h */, @@ -492,6 +506,10 @@ A9B9C4A418239B7E00416A4E /* Utility */ = { isa = PBXGroup; children = ( + A989F10D1823B3B40070AD8C /* MP42TextSample.h */, + A989F10E1823B3B40070AD8C /* MP42TextSample.m */, + A9B9C2381823923100416A4E /* MP42Image.h */, + A9B9C2391823923100416A4E /* MP42Image.m */, A9B9C2521823923100416A4E /* MP42Utilities.h */, A9B9C2531823923100416A4E /* MP42Utilities.m */, A9B9C24E1823923100416A4E /* MP42SubUtilities.h */, @@ -500,8 +518,6 @@ A9B9C2591823923200416A4E /* MP42XMLReader.m */, A9B9C2361823923100416A4E /* MP42HtmlParser.h */, A9B9C2371823923100416A4E /* MP42HtmlParser.m */, - A9B9C2381823923100416A4E /* MP42Image.h */, - A9B9C2391823923100416A4E /* MP42Image.m */, A9B9C2C91823968400416A4E /* RegexKitLite.h */, A9B9C2CA1823968400416A4E /* RegexKitLite.m */, A9B9C2CD182396A100416A4E /* SBRatings.h */, @@ -549,6 +565,7 @@ A9B9C2851823923200416A4E /* MP42MediaFormat.h in Headers */, A9B9C2781823923200416A4E /* MP42ConverterProtocol.h in Headers */, A9B9C2931823923200416A4E /* MP42Sample.h in Headers */, + A989F10F1823B3B40070AD8C /* MP42TextSample.h in Headers */, A9B9C2911823923200416A4E /* MP42QTImporter.h in Headers */, A9B9C28F1823923200416A4E /* MP42OCRWrapper.h in Headers */, A9B9C2811823923200416A4E /* MP42HtmlParser.h in Headers */, @@ -578,6 +595,7 @@ A9B9C29D1823923200416A4E /* MP42Utilities.h in Headers */, A9B9C2661823923200416A4E /* MP42AACImporter.h in Headers */, A9B9C2681823923200416A4E /* MP42AC3Importer.h in Headers */, + A989F1001823AB2E0070AD8C /* MP42Track_Muxer.h in Headers */, A9B9C26A1823923200416A4E /* MP42AudioConverter.h in Headers */, A9B9C2A11823923200416A4E /* MP42VobSubImporter.h in Headers */, A9B9C2AC1823923200416A4E /* mbs.h in Headers */, @@ -600,6 +618,7 @@ buildRules = ( ); dependencies = ( + A989F10B1823AEA90070AD8C /* PBXTargetDependency */, ); name = MP42; productName = MP42; @@ -735,6 +754,7 @@ A9B9C2821823923200416A4E /* MP42HtmlParser.m in Sources */, A9B9C2861823923200416A4E /* MP42MediaFormat.m in Sources */, A9B9C2A41823923200416A4E /* MP42XMLReader.m in Sources */, + A989F1101823B3B40070AD8C /* MP42TextSample.m in Sources */, A9B9C2751823923200416A4E /* MP42ChapterTrack.m in Sources */, A9B9C2C51823957800416A4E /* SBLanguages.m in Sources */, A9B9C2841823923200416A4E /* MP42Image.m in Sources */, @@ -766,6 +786,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + A989F10B1823AEA90070AD8C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = universaldetector; + targetProxy = A989F10A1823AEA90070AD8C /* PBXContainerItemProxy */; + }; A9B9C209182391DF00416A4E /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = A9B9C1EC182391DF00416A4E /* MP42 */; @@ -887,6 +912,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MP42/MP42-Prefix.pch"; INFOPLIST_FILE = "MP42/MP42-Info.plist"; + INSTALL_PATH = "@loader_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", /Users/damians/Desktop/MP42/mp4v2, @@ -908,6 +934,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MP42/MP42-Prefix.pch"; INFOPLIST_FILE = "MP42/MP42-Info.plist"; + INSTALL_PATH = "@loader_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", /Users/damians/Desktop/MP42/mp4v2, diff --git a/MP42/MP42AudioConverter.m b/MP42/MP42AudioConverter.m index b0db92c..0201ea8 100644 --- a/MP42/MP42AudioConverter.m +++ b/MP42/MP42AudioConverter.m @@ -14,6 +14,8 @@ #import "MP42Fifo.h" #import "MP42Utilities.h" +#import "MP42Track_Muxer.h" + #define FIFO_DURATION (0.5f) NSString * const SBMonoMixdown = @"SBMonoMixdown"; diff --git a/MP42/MP42CCImporter.m b/MP42/MP42CCImporter.m index ebb653e..e492489 100644 --- a/MP42/MP42CCImporter.m +++ b/MP42/MP42CCImporter.m @@ -143,14 +143,14 @@ static int ParseByte(const char *string, UInt8 *byte, Boolean hex) continue; startTime = ParseTimeCode([[lineArray objectAtIndex:0] UTF8String], 30000, NO, &dropFrame); - SBTextSample *sample = [[SBTextSample alloc] init]; + MP42TextSample *sample = [[MP42TextSample alloc] init]; sample.timestamp = startTime; sample.title = [lineArray lastObject]; [sampleArray addObject:[sample autorelease]]; } - for (SBTextSample *ccSample in sampleArray) { + for (MP42TextSample *ccSample in sampleArray) { if (_cancelled) break; @@ -177,7 +177,7 @@ static int ParseByte(const char *string, UInt8 *byte, Boolean hex) } if (firstSample && ccSample.timestamp != 0 && i == 0) { - SBTextSample *boh = [sampleArray objectAtIndex:1]; + MP42TextSample *boh = [sampleArray objectAtIndex:1]; sampleDuration = boh.timestamp - ccSample.timestamp; firstSample = NO; u_int8_t *emptyBuffer = malloc(sizeof(u_int8_t)*8); @@ -200,7 +200,7 @@ static int ParseByte(const char *string, UInt8 *byte, Boolean hex) minutesDrop += frameDrop; } else if (i+1 < [sampleArray count]) { - SBTextSample *boh = [sampleArray objectAtIndex:i+1]; + MP42TextSample *boh = [sampleArray objectAtIndex:i+1]; sampleDuration = boh.timestamp - ccSample.timestamp; frameDrop += sampleDuration; minutesDrop += sampleDuration; diff --git a/MP42/MP42ChapterTrack.h b/MP42/MP42ChapterTrack.h index 879a8a1..c5b1df2 100644 --- a/MP42/MP42ChapterTrack.h +++ b/MP42/MP42ChapterTrack.h @@ -8,8 +8,7 @@ #import #import "MP42Track.h" - -@class SBTextSample; +#import "MP42TextSample.h" @interface MP42ChapterTrack : MP42Track { NSMutableArray *chapters; @@ -20,10 +19,10 @@ - (void)addChapter:(NSString *)title duration:(uint64_t)timestamp; - (void)removeChapterAtIndex:(NSUInteger)index; -- (void)setTimestamp:(MP42Duration)timestamp forChapter:(SBTextSample *)chapterSample; -- (void)setTitle:(NSString*)title forChapter:(SBTextSample *)chapterSample; +- (void)setTimestamp:(MP42Duration)timestamp forChapter:(MP42TextSample *)chapterSample; +- (void)setTitle:(NSString*)title forChapter:(MP42TextSample *)chapterSample; -- (SBTextSample *)chapterAtIndex:(NSUInteger)index; +- (MP42TextSample *)chapterAtIndex:(NSUInteger)index; - (NSInteger)chapterCount; diff --git a/MP42/MP42ChapterTrack.m b/MP42/MP42ChapterTrack.m index 60b0f3e..9063347 100644 --- a/MP42/MP42ChapterTrack.m +++ b/MP42/MP42ChapterTrack.m @@ -50,7 +50,7 @@ MP4Duration sum = 0; while (i <= chapter_count) { - SBTextSample *chapter = [[SBTextSample alloc] init]; + MP42TextSample *chapter = [[MP42TextSample alloc] init]; char * title = chapter_list[i-1].title; if ((title[0] == '\xfe' && title[1] == '\xff') || (title[0] == '\xff' && title[1] == '\xfe')) { @@ -101,7 +101,7 @@ - (void)addChapter:(NSString *)title duration:(uint64_t)timestamp { - SBTextSample *newChapter = [[SBTextSample alloc] init]; + MP42TextSample *newChapter = [[MP42TextSample alloc] init]; newChapter.title = title; newChapter.timestamp = timestamp; @@ -118,20 +118,20 @@ [chapters removeObjectAtIndex:index]; } -- (void)setTimestamp:(MP4Duration)timestamp forChapter:(SBTextSample *)chapterSample +- (void)setTimestamp:(MP4Duration)timestamp forChapter:(MP42TextSample *)chapterSample { _isEdited = YES; [chapterSample setTimestamp:timestamp]; [chapters sortUsingSelector:@selector(compare:)]; } -- (void)setTitle:(NSString *)title forChapter:(SBTextSample *)chapterSample +- (void)setTitle:(NSString *)title forChapter:(MP42TextSample *)chapterSample { _isEdited = YES; [chapterSample setTitle:title]; } -- (SBTextSample *)chapterAtIndex:(NSUInteger)index +- (MP42TextSample *)chapterAtIndex:(NSUInteger)index { return [chapters objectAtIndex:index]; } @@ -161,9 +161,9 @@ if (chapterCount) { // Insert a chapter at time 0 if there isn't one - SBTextSample * chapter = [chapters objectAtIndex:0]; + MP42TextSample * chapter = [chapters objectAtIndex:0]; if (chapter.timestamp != 0) { - SBTextSample *st = [[SBTextSample alloc] init]; + MP42TextSample *st = [[MP42TextSample alloc] init]; st.timestamp = 0; st.title = @"Chapter 0"; [chapters insertObject:st atIndex:0]; @@ -182,12 +182,12 @@ refTrackDuration = moovDuration; for (i = 0; i < chapterCount; i++) { - SBTextSample * chapter = [chapters objectAtIndex:i]; + MP42TextSample * chapter = [chapters objectAtIndex:i]; if ([[chapter title] UTF8String]) strcpy(fileChapters[i].title, [[chapter title] UTF8String]); if (i + 1 < chapterCount && sum < refTrackDuration) { - SBTextSample * nextChapter = [chapters objectAtIndex:i+1]; + MP42TextSample * nextChapter = [chapters objectAtIndex:i+1]; fileChapters[i].duration = nextChapter.timestamp - chapter.timestamp; sum = nextChapter.timestamp; } @@ -232,7 +232,7 @@ NSMutableString* file = [[[NSMutableString alloc] init] autorelease]; NSUInteger x = 0; - for (SBTextSample * chapter in chapters) { + for (MP42TextSample * chapter in chapters) { [file appendFormat:@"CHAPTER%02lu=%@\nCHAPTER%02luNAME=%@\n", (unsigned long)x, SRTStringFromTime([chapter timestamp], 1000, '.'), (unsigned long)x, [chapter title]]; x++; } diff --git a/MP42/MP42File.m b/MP42/MP42File.m index f360647..07320ff 100644 --- a/MP42/MP42File.m +++ b/MP42/MP42File.m @@ -660,7 +660,7 @@ NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; NSDictionary *attributes = [NSDictionary dictionaryWithObject:QTMovieFrameImageTypeNSImage forKey:QTMovieFrameImageType]; NSMutableArray *images = [[NSMutableArray alloc] initWithCapacity:[chapters count]]; - for (SBTextSample *chapter in chapters) { + for (MP42TextSample *chapter in chapters) { QTTime chapterTime = { [chapter timestamp] + 1500, // Add a short offset, hopefully we will get a better image 1000, // if there is a fade @@ -700,7 +700,7 @@ NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; generator.requestedTimeToleranceBefore = kCMTimeZero; generator.requestedTimeToleranceAfter = kCMTimeZero; - for (SBTextSample * chapter in chapters) { + for (MP42TextSample * chapter in chapters) { CMTime time = CMTimeMake([chapter timestamp] + 1800, 1000); CGImageRef imgRef = [generator copyCGImageAtTime:time actualTime:NULL error:NULL]; if (imgRef) { @@ -783,7 +783,7 @@ NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; NSUInteger idx = 0; MP4Duration duration = 0; - for (SBTextSample *chapterT in [chapterTrack chapters]) { + for (MP42TextSample *chapterT in [chapterTrack chapters]) { duration = MP4GetSampleDuration(_fileHandle, chapterTrack.Id, idx + 1); // Scale the image. diff --git a/MP42/MP42FileImporter.h b/MP42/MP42FileImporter.h index 92dfd6c..8e0bcd8 100644 --- a/MP42/MP42FileImporter.h +++ b/MP42/MP42FileImporter.h @@ -14,6 +14,8 @@ #import "mp4v2.h" +#import "MP42Track_Muxer.h" + @class MP42Sample; @class MP42Metadata; @class MP42Track; diff --git a/MP42/MP42FileImporter.m b/MP42/MP42FileImporter.m index 23b8e77..187de36 100644 --- a/MP42/MP42FileImporter.m +++ b/MP42/MP42FileImporter.m @@ -18,6 +18,8 @@ #import "MP42Track.h" #import "MP42Fifo.h" +#import "MP42Track_Muxer.h" + #if !__LP64__ #import "MP42QTImporter.h" #endif diff --git a/MP42/MP42SubUtilities.h b/MP42/MP42SubUtilities.h index add21c6..4bde7a6 100644 --- a/MP42/MP42SubUtilities.h +++ b/MP42/MP42SubUtilities.h @@ -8,18 +8,9 @@ #import #import +#import "MP42TextSample.h" #import "mp4v2.h" -@interface SBTextSample : NSObject { - MP4Duration timestamp; - NSString *title; -} - -@property(readwrite, retain) NSString *title; -@property(readwrite) MP4Duration timestamp; - -@end - @interface SBSubLine : NSObject { @public diff --git a/MP42/MP42SubUtilities.m b/MP42/MP42SubUtilities.m index 7f860d0..4d1f4b9 100644 --- a/MP42/MP42SubUtilities.m +++ b/MP42/MP42SubUtilities.m @@ -12,47 +12,6 @@ #import "RegexKitLite.h" -@implementation SBTextSample - --(NSComparisonResult)compare:(SBTextSample *)otherObject -{ - MP4Duration otherTimestamp = [otherObject timestamp]; - - if (timestamp < otherTimestamp) - return NSOrderedAscending; - else if (timestamp > otherTimestamp) - return NSOrderedDescending; - - return NSOrderedSame; -} - --(void) dealloc -{ - [title release]; - [super dealloc]; -} - -@synthesize timestamp; -@synthesize title; - -- (void)encodeWithCoder:(NSCoder *)coder -{ - [coder encodeInt64:timestamp forKey:@"timestamp"]; - [coder encodeObject:title forKey:@"title"]; -} - -- (id)initWithCoder:(NSCoder *)decoder -{ - self = [super init]; - - timestamp = [decoder decodeInt64ForKey:@"timestamp"]; - title = [[decoder decodeObjectForKey:@"title"] retain]; - - return self; -} - -@end - @implementation SBSubSerializer -(id)init { @@ -518,7 +477,7 @@ int LoadChaptersFromPath(NSString *path, NSMutableArray *ss) res = [NSString stringWithFormat:@"Chapter %d", count]; [sc scanString:@"\n" intoString:nil]; - SBTextSample *chapter = [[SBTextSample alloc] init]; + MP42TextSample *chapter = [[MP42TextSample alloc] init]; chapter.timestamp = time; chapter.title = res; @@ -548,7 +507,7 @@ int LoadChaptersFromPath(NSString *path, NSMutableArray *ss) [sc scanString:@"\n" intoString:nil]; - SBTextSample *chapter = [[SBTextSample alloc] init]; + MP42TextSample *chapter = [[MP42TextSample alloc] init]; chapter.timestamp = time; chapter.title = res; diff --git a/MP42/MP42TextSample.h b/MP42/MP42TextSample.h new file mode 100644 index 0000000..b3ae4d1 --- /dev/null +++ b/MP42/MP42TextSample.h @@ -0,0 +1,21 @@ +// +// SBTextSample.h +// MP42 +// +// Created by Damiano Galassi on 01/11/13. +// Copyright (c) 2013 Damiano Galassi. All rights reserved. +// + +#import +#import "MP42MediaFormat.h" + +@interface MP42TextSample : NSObject { + MP42Duration timestamp; + NSString *title; +} + +@property(readwrite, retain) NSString *title; +@property(readwrite) MP42Duration timestamp; + +@end + diff --git a/MP42/MP42TextSample.m b/MP42/MP42TextSample.m new file mode 100644 index 0000000..d7354a2 --- /dev/null +++ b/MP42/MP42TextSample.m @@ -0,0 +1,50 @@ +// +// SBTextSample.m +// MP42 +// +// Created by Damiano Galassi on 01/11/13. +// Copyright (c) 2013 Damiano Galassi. All rights reserved. +// + +#import "MP42TextSample.h" + +@implementation MP42TextSample + +-(NSComparisonResult)compare:(MP42TextSample *)otherObject +{ + MP42Duration otherTimestamp = [otherObject timestamp]; + + if (timestamp < otherTimestamp) + return NSOrderedAscending; + else if (timestamp > otherTimestamp) + return NSOrderedDescending; + + return NSOrderedSame; +} + +-(void) dealloc +{ + [title release]; + [super dealloc]; +} + +@synthesize timestamp; +@synthesize title; + +- (void)encodeWithCoder:(NSCoder *)coder +{ + [coder encodeInt64:timestamp forKey:@"timestamp"]; + [coder encodeObject:title forKey:@"title"]; +} + +- (id)initWithCoder:(NSCoder *)decoder +{ + self = [super init]; + + timestamp = [decoder decodeInt64ForKey:@"timestamp"]; + title = [[decoder decodeObjectForKey:@"title"] retain]; + + return self; +} + +@end diff --git a/MP42/MP42Track.h b/MP42/MP42Track.h index 082942b..ff91b51 100644 --- a/MP42/MP42Track.h +++ b/MP42/MP42Track.h @@ -14,18 +14,6 @@ @class MP42SampleBuffer; @class MP42Fifo; -typedef struct muxer_helper { - // Input helpers - MP42FileImporter *importer; - id demuxer_context; - - // Output helpers - id converter; - MP42Fifo *fifo; - - BOOL done; -} muxer_helper; - @interface MP42Track : NSObject { MP42TrackId _Id; MP42TrackId _sourceId; @@ -52,7 +40,6 @@ typedef struct muxer_helper { MP42Duration _duration; NSMutableDictionary *_updatedProperty; - muxer_helper *_helper; } - (instancetype)initWithSourceURL:(NSURL *)URL trackID:(NSInteger)trackID fileHandle:(MP42FileHandle)fileHandle; @@ -88,6 +75,4 @@ typedef struct muxer_helper { @property(nonatomic, readwrite) uint64_t dataLength; -@property(nonatomic, readonly) muxer_helper *muxer_helper; - @end diff --git a/MP42/MP42Track.m b/MP42/MP42Track.m index 122fcb4..24c9e34 100644 --- a/MP42/MP42Track.m +++ b/MP42/MP42Track.m @@ -13,6 +13,15 @@ #import "MP42Fifo.h" #import "SBLanguages.h" +#import "MP42Track_Muxer.h" + +@interface MP42Track () { + + muxer_helper *_helper; +} + +@end + @implementation MP42Track - (instancetype)init @@ -333,8 +342,6 @@ @synthesize dataLength = _size; @synthesize mediaType = _mediaType; -@synthesize muxer_helper = _helper; - - (muxer_helper *)muxer_helper { if (_helper == NULL) diff --git a/MP42/MP42Track_Muxer.h b/MP42/MP42Track_Muxer.h new file mode 100644 index 0000000..43cbfba --- /dev/null +++ b/MP42/MP42Track_Muxer.h @@ -0,0 +1,30 @@ +// +// MP42Track_MP42Track_Muxer.h +// MP42 +// +// Created by Damiano Galassi on 01/11/13. +// Copyright (c) 2013 Damiano Galassi. All rights reserved. +// + +#import "MP42Track.h" +#import "MP42FileImporter.h" +#import "MP42Fifo.h" +#import "MP42ConverterProtocol.h" + +typedef struct muxer_helper { + // Input helpers + MP42FileImporter *importer; + id demuxer_context; + + // Output helpers + id converter; + MP42Fifo *fifo; + + BOOL done; +} muxer_helper; + +@interface MP42Track (MP42TrackMuxerExtentions) + +@property(nonatomic, readonly) muxer_helper *muxer_helper; + +@end