From 05cf06cfa9e4e07fb97472650d6e7921fc291b5d Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Sun, 3 Nov 2013 17:10:49 +0100 Subject: [PATCH] Argh. --- MP42.xcodeproj/project.pbxproj | 90 ++++---- .../xcschemes/MP42.xcscheme | 8 +- MP42/MP42AACImporter.mm | 2 +- MP42/MP42AC3Importer.m | 2 +- MP42/MP42AVFImporter.m | 2 +- MP42/MP42CCImporter.m | 2 +- MP42/MP42ChapterTrack.h | 5 + MP42/MP42ChapterTrack.m | 28 ++- MP42/MP42ClosedCaptionTrack.m | 2 +- MP42/MP42File.h | 7 +- MP42/MP42File.m | 174 ++++++++++++++- MP42/MP42FileImporter.h | 6 +- MP42/MP42H264Importer.mm | 2 +- MP42/{SBLanguages.h => MP42Languages.h} | 8 +- MP42/{SBLanguages.m => MP42Languages.m} | 10 +- MP42/MP42Metadata.m | 10 +- MP42/MP42MkvImporter.m | 2 +- MP42/MP42Mp4Importer.m | 2 +- MP42/MP42OCRWrapper.mm | 2 +- MP42/MP42QTImporter.m | 2 +- MP42/{SBRatings.h => MP42Ratings.h} | 6 +- MP42/{SBRatings.m => MP42Ratings.m} | 12 +- MP42/MP42SrtImporter.m | 2 +- MP42/MP42SubtitleTrack.m | 2 +- MP42/MP42TextSample.h | 3 + MP42/MP42TextSample.m | 2 + MP42/MP42Track.m | 2 +- MP42/MP42Utilities.h | 2 + MP42/MP42Utilities.m | 22 +- MP42/MP42VobSubImporter.m | 2 +- MP42/Ratings.json | 209 ++++++++++++++++++ 31 files changed, 528 insertions(+), 102 deletions(-) rename MP42/{SBLanguages.h => MP42Languages.h} (93%) rename MP42/{SBLanguages.m => MP42Languages.m} (99%) rename MP42/{SBRatings.h => MP42Ratings.h} (86%) rename MP42/{SBRatings.m => MP42Ratings.m} (94%) create mode 100644 MP42/Ratings.json diff --git a/MP42.xcodeproj/project.pbxproj b/MP42.xcodeproj/project.pbxproj index ce2c6e2..8adc6db 100644 --- a/MP42.xcodeproj/project.pbxproj +++ b/MP42.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + A947BA9B1824F0B3004C734B /* Ratings.json in Resources */ = {isa = PBXBuildFile; fileRef = A947BA9A1824F0B3004C734B /* Ratings.json */; }; 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 */; }; @@ -14,7 +15,7 @@ A9B9C1FB182391DF00416A4E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A9B9C1F9182391DF00416A4E /* InfoPlist.strings */; }; A9B9C206182391DF00416A4E /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9B9C205182391DF00416A4E /* XCTest.framework */; }; A9B9C207182391DF00416A4E /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9B9C1F0182391DF00416A4E /* Cocoa.framework */; }; - A9B9C20A182391DF00416A4E /* MP42.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9B9C1ED182391DF00416A4E /* MP42.framework */; }; + A9B9C20A182391DF00416A4E /* MP42Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9B9C1ED182391DF00416A4E /* MP42Foundation.framework */; }; A9B9C210182391DF00416A4E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A9B9C20E182391DF00416A4E /* InfoPlist.strings */; }; A9B9C212182391DF00416A4E /* MP42Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C211182391DF00416A4E /* MP42Tests.m */; }; A9B9C2661823923200416A4E /* MP42AACImporter.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C21B1823923100416A4E /* MP42AACImporter.h */; }; @@ -46,7 +47,7 @@ A9B9C2801823923200416A4E /* MP42H264Importer.mm in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2351823923100416A4E /* MP42H264Importer.mm */; }; A9B9C2811823923200416A4E /* MP42HtmlParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2361823923100416A4E /* MP42HtmlParser.h */; }; A9B9C2821823923200416A4E /* MP42HtmlParser.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2371823923100416A4E /* MP42HtmlParser.m */; }; - A9B9C2831823923200416A4E /* MP42Image.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2381823923100416A4E /* MP42Image.h */; }; + A9B9C2831823923200416A4E /* MP42Image.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2381823923100416A4E /* MP42Image.h */; settings = {ATTRIBUTES = (Public, ); }; }; A9B9C2841823923200416A4E /* MP42Image.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2391823923100416A4E /* MP42Image.m */; }; A9B9C2851823923200416A4E /* MP42MediaFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C23A1823923100416A4E /* MP42MediaFormat.h */; settings = {ATTRIBUTES = (Public, ); }; }; A9B9C2861823923200416A4E /* MP42MediaFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C23B1823923100416A4E /* MP42MediaFormat.m */; }; @@ -92,13 +93,13 @@ A9B9C2AE1823923200416A4E /* sfifo.c in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2641823923200416A4E /* sfifo.c */; }; A9B9C2AF1823923200416A4E /* sfifo.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2651823923200416A4E /* sfifo.h */; }; A9B9C2B3182393ED00416A4E /* libmp4v2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9B9C2B2182393ED00416A4E /* libmp4v2.a */; }; - A9B9C2C41823957800416A4E /* SBLanguages.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2C21823957800416A4E /* SBLanguages.h */; }; - A9B9C2C51823957800416A4E /* SBLanguages.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2C31823957800416A4E /* SBLanguages.m */; }; + A9B9C2C41823957800416A4E /* MP42Languages.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2C21823957800416A4E /* MP42Languages.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A9B9C2C51823957800416A4E /* MP42Languages.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2C31823957800416A4E /* MP42Languages.m */; }; A9B9C2C81823962600416A4E /* UniversalDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2C71823962600416A4E /* UniversalDetector.h */; }; A9B9C2CB1823968400416A4E /* RegexKitLite.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2C91823968400416A4E /* RegexKitLite.h */; }; A9B9C2CC1823968400416A4E /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2CA1823968400416A4E /* RegexKitLite.m */; }; - A9B9C2CF182396A100416A4E /* SBRatings.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2CD182396A100416A4E /* SBRatings.h */; }; - A9B9C2D0182396A100416A4E /* SBRatings.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2CE182396A100416A4E /* SBRatings.m */; }; + A9B9C2CF182396A100416A4E /* MP42Ratings.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2CD182396A100416A4E /* MP42Ratings.h */; }; + A9B9C2D0182396A100416A4E /* MP42Ratings.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2CE182396A100416A4E /* MP42Ratings.m */; }; A9B9C2D3182396C400416A4E /* JSONKit.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2D1182396C400416A4E /* JSONKit.h */; }; A9B9C2D4182396C400416A4E /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B9C2D2182396C400416A4E /* JSONKit.m */; }; A9B9C2D6182396FB00416A4E /* baseapi.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B9C2D5182396FB00416A4E /* baseapi.h */; }; @@ -159,10 +160,11 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + A947BA9A1824F0B3004C734B /* Ratings.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Ratings.json; sourceTree = ""; }; 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; }; + A9B9C1ED182391DF00416A4E /* MP42Foundation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MP42Foundation.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; }; A9B9C1F4182391DF00416A4E /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; @@ -170,7 +172,7 @@ A9B9C1F8182391DF00416A4E /* MP42-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MP42-Info.plist"; sourceTree = ""; }; A9B9C1FA182391DF00416A4E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; A9B9C1FC182391DF00416A4E /* MP42-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MP42-Prefix.pch"; sourceTree = ""; }; - A9B9C204182391DF00416A4E /* MP42Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MP42Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + A9B9C204182391DF00416A4E /* MP42FoundationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MP42FoundationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; A9B9C205182391DF00416A4E /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; A9B9C20D182391DF00416A4E /* MP42Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MP42Tests-Info.plist"; sourceTree = ""; }; A9B9C20F182391DF00416A4E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -251,13 +253,13 @@ A9B9C2651823923200416A4E /* sfifo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sfifo.h; sourceTree = ""; }; A9B9C2B2182393ED00416A4E /* libmp4v2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmp4v2.a; path = mp4v2/libmp4v2.a; sourceTree = ""; }; A9B9C2B61823944700416A4E /* UniversalDetector.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UniversalDetector.xcodeproj; path = UniversalDetector/UniversalDetector.xcodeproj; sourceTree = ""; }; - A9B9C2C21823957800416A4E /* SBLanguages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBLanguages.h; sourceTree = ""; }; - A9B9C2C31823957800416A4E /* SBLanguages.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBLanguages.m; sourceTree = ""; }; + A9B9C2C21823957800416A4E /* MP42Languages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MP42Languages.h; sourceTree = ""; }; + A9B9C2C31823957800416A4E /* MP42Languages.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MP42Languages.m; sourceTree = ""; }; A9B9C2C71823962600416A4E /* UniversalDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UniversalDetector.h; path = UniversalDetector/UniversalDetector.h; sourceTree = SOURCE_ROOT; }; A9B9C2C91823968400416A4E /* RegexKitLite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegexKitLite.h; sourceTree = ""; }; A9B9C2CA1823968400416A4E /* RegexKitLite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RegexKitLite.m; sourceTree = ""; }; - A9B9C2CD182396A100416A4E /* SBRatings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBRatings.h; sourceTree = ""; }; - A9B9C2CE182396A100416A4E /* SBRatings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBRatings.m; sourceTree = ""; }; + A9B9C2CD182396A100416A4E /* MP42Ratings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MP42Ratings.h; sourceTree = ""; }; + A9B9C2CE182396A100416A4E /* MP42Ratings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MP42Ratings.m; sourceTree = ""; }; A9B9C2D1182396C400416A4E /* JSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONKit.h; sourceTree = ""; }; A9B9C2D2182396C400416A4E /* JSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONKit.m; sourceTree = ""; }; A9B9C2D5182396FB00416A4E /* baseapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = baseapi.h; path = Tesseract/include/tesseract/baseapi.h; sourceTree = SOURCE_ROOT; }; @@ -309,7 +311,7 @@ buildActionMask = 2147483647; files = ( A9B9C207182391DF00416A4E /* Cocoa.framework in Frameworks */, - A9B9C20A182391DF00416A4E /* MP42.framework in Frameworks */, + A9B9C20A182391DF00416A4E /* MP42Foundation.framework in Frameworks */, A9B9C206182391DF00416A4E /* XCTest.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -330,8 +332,8 @@ A9B9C1EE182391DF00416A4E /* Products */ = { isa = PBXGroup; children = ( - A9B9C1ED182391DF00416A4E /* MP42.framework */, - A9B9C204182391DF00416A4E /* MP42Tests.xctest */, + A9B9C1ED182391DF00416A4E /* MP42Foundation.framework */, + A9B9C204182391DF00416A4E /* MP42FoundationTests.xctest */, ); name = Products; sourceTree = ""; @@ -404,6 +406,7 @@ A9B9C1F7182391DF00416A4E /* Supporting Files */ = { isa = PBXGroup; children = ( + A947BA9A1824F0B3004C734B /* Ratings.json */, A9B9C1F8182391DF00416A4E /* MP42-Info.plist */, A9B9C1F9182391DF00416A4E /* InfoPlist.strings */, A9B9C1FC182391DF00416A4E /* MP42-Prefix.pch */, @@ -510,6 +513,10 @@ A989F10E1823B3B40070AD8C /* MP42TextSample.m */, A9B9C2381823923100416A4E /* MP42Image.h */, A9B9C2391823923100416A4E /* MP42Image.m */, + A9B9C2C21823957800416A4E /* MP42Languages.h */, + A9B9C2C31823957800416A4E /* MP42Languages.m */, + A9B9C2CD182396A100416A4E /* MP42Ratings.h */, + A9B9C2CE182396A100416A4E /* MP42Ratings.m */, A9B9C2521823923100416A4E /* MP42Utilities.h */, A9B9C2531823923100416A4E /* MP42Utilities.m */, A9B9C24E1823923100416A4E /* MP42SubUtilities.h */, @@ -520,14 +527,10 @@ A9B9C2371823923100416A4E /* MP42HtmlParser.m */, A9B9C2C91823968400416A4E /* RegexKitLite.h */, A9B9C2CA1823968400416A4E /* RegexKitLite.m */, - A9B9C2CD182396A100416A4E /* SBRatings.h */, - A9B9C2CE182396A100416A4E /* SBRatings.m */, A9B9C2D1182396C400416A4E /* JSONKit.h */, A9B9C2D2182396C400416A4E /* JSONKit.m */, A9B9C2D5182396FB00416A4E /* baseapi.h */, A9B9C2C71823962600416A4E /* UniversalDetector.h */, - A9B9C2C21823957800416A4E /* SBLanguages.h */, - A9B9C2C31823957800416A4E /* SBLanguages.m */, ); name = Utility; sourceTree = ""; @@ -566,6 +569,8 @@ A9B9C2781823923200416A4E /* MP42ConverterProtocol.h in Headers */, A9B9C2931823923200416A4E /* MP42Sample.h in Headers */, A989F10F1823B3B40070AD8C /* MP42TextSample.h in Headers */, + A9B9C2831823923200416A4E /* MP42Image.h in Headers */, + A9B9C2C41823957800416A4E /* MP42Languages.h in Headers */, A9B9C2911823923200416A4E /* MP42QTImporter.h in Headers */, A9B9C28F1823923200416A4E /* MP42OCRWrapper.h in Headers */, A9B9C2811823923200416A4E /* MP42HtmlParser.h in Headers */, @@ -574,12 +579,10 @@ A9B9C27D1823923200416A4E /* MP42FileImporter.h in Headers */, A9B9C26E1823923200416A4E /* MP42AVFImporter.h in Headers */, A9B9C2791823923200416A4E /* MP42Fifo.h in Headers */, - A9B9C2CF182396A100416A4E /* SBRatings.h in Headers */, - A9B9C2C41823957800416A4E /* SBLanguages.h in Headers */, + A9B9C2CF182396A100416A4E /* MP42Ratings.h in Headers */, A9B9C2A31823923200416A4E /* MP42XMLReader.h in Headers */, A9B9C2CB1823968400416A4E /* RegexKitLite.h in Headers */, A9B9C28D1823923200416A4E /* MP42Muxer.h in Headers */, - A9B9C2831823923200416A4E /* MP42Image.h in Headers */, A9B9C2AD1823923200416A4E /* mpeg4ip_bitstream.h in Headers */, A9B9C2A81823923200416A4E /* MatroskaFile.h in Headers */, A9B9C2D6182396FB00416A4E /* baseapi.h in Headers */, @@ -606,9 +609,9 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - A9B9C1EC182391DF00416A4E /* MP42 */ = { + A9B9C1EC182391DF00416A4E /* MP42Foundation */ = { isa = PBXNativeTarget; - buildConfigurationList = A9B9C215182391DF00416A4E /* Build configuration list for PBXNativeTarget "MP42" */; + buildConfigurationList = A9B9C215182391DF00416A4E /* Build configuration list for PBXNativeTarget "MP42Foundation" */; buildPhases = ( A9B9C1E8182391DF00416A4E /* Sources */, A9B9C1E9182391DF00416A4E /* Frameworks */, @@ -620,14 +623,14 @@ dependencies = ( A989F10B1823AEA90070AD8C /* PBXTargetDependency */, ); - name = MP42; + name = MP42Foundation; productName = MP42; - productReference = A9B9C1ED182391DF00416A4E /* MP42.framework */; + productReference = A9B9C1ED182391DF00416A4E /* MP42Foundation.framework */; productType = "com.apple.product-type.framework"; }; - A9B9C203182391DF00416A4E /* MP42Tests */ = { + A9B9C203182391DF00416A4E /* MP42FoundationTests */ = { isa = PBXNativeTarget; - buildConfigurationList = A9B9C218182391DF00416A4E /* Build configuration list for PBXNativeTarget "MP42Tests" */; + buildConfigurationList = A9B9C218182391DF00416A4E /* Build configuration list for PBXNativeTarget "MP42FoundationTests" */; buildPhases = ( A9B9C200182391DF00416A4E /* Sources */, A9B9C201182391DF00416A4E /* Frameworks */, @@ -638,9 +641,9 @@ dependencies = ( A9B9C209182391DF00416A4E /* PBXTargetDependency */, ); - name = MP42Tests; + name = MP42FoundationTests; productName = MP42Tests; - productReference = A9B9C204182391DF00416A4E /* MP42Tests.xctest */; + productReference = A9B9C204182391DF00416A4E /* MP42FoundationTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ @@ -677,8 +680,8 @@ ); projectRoot = ""; targets = ( - A9B9C1EC182391DF00416A4E /* MP42 */, - A9B9C203182391DF00416A4E /* MP42Tests */, + A9B9C1EC182391DF00416A4E /* MP42Foundation */, + A9B9C203182391DF00416A4E /* MP42FoundationTests */, ); }; /* End PBXProject section */ @@ -712,6 +715,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + A947BA9B1824F0B3004C734B /* Ratings.json in Resources */, A9B9C1FB182391DF00416A4E /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -742,7 +746,7 @@ A9B9C2921823923200416A4E /* MP42QTImporter.m in Sources */, A9B9C2A21823923200416A4E /* MP42VobSubImporter.m in Sources */, A9B9C28E1823923200416A4E /* MP42Muxer.m in Sources */, - A9B9C2D0182396A100416A4E /* SBRatings.m in Sources */, + A9B9C2D0182396A100416A4E /* MP42Ratings.m in Sources */, A9B9C2691823923200416A4E /* MP42AC3Importer.m in Sources */, A9B9C26F1823923200416A4E /* MP42AVFImporter.m in Sources */, A9B9C2D4182396C400416A4E /* JSONKit.m in Sources */, @@ -756,7 +760,7 @@ A9B9C2A41823923200416A4E /* MP42XMLReader.m in Sources */, A989F1101823B3B40070AD8C /* MP42TextSample.m in Sources */, A9B9C2751823923200416A4E /* MP42ChapterTrack.m in Sources */, - A9B9C2C51823957800416A4E /* SBLanguages.m in Sources */, + A9B9C2C51823957800416A4E /* MP42Languages.m in Sources */, A9B9C2841823923200416A4E /* MP42Image.m in Sources */, A9B9C29E1823923200416A4E /* MP42Utilities.m in Sources */, A9B9C28C1823923200416A4E /* MP42Mp4Importer.m in Sources */, @@ -793,7 +797,7 @@ }; A9B9C209182391DF00416A4E /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = A9B9C1EC182391DF00416A4E /* MP42 */; + target = A9B9C1EC182391DF00416A4E /* MP42Foundation */; targetProxy = A9B9C208182391DF00416A4E /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -915,9 +919,9 @@ INSTALL_PATH = "@loader_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - /Users/damians/Desktop/MP42/mp4v2, - /Users/damians/Desktop/MP42/ffmpeg/lib, - /Users/damians/Desktop/MP42/Tesseract/lib, + "$(SRCROOT)/mp4v2", + "$(SRCROOT)/ffmpeg/lib", + "$(SRCROOT)/Tesseract/lib", ); PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = framework; @@ -937,9 +941,9 @@ INSTALL_PATH = "@loader_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - /Users/damians/Desktop/MP42/mp4v2, - /Users/damians/Desktop/MP42/ffmpeg/lib, - /Users/damians/Desktop/MP42/Tesseract/lib, + "$(SRCROOT)/mp4v2", + "$(SRCROOT)/ffmpeg/lib", + "$(SRCROOT)/Tesseract/lib", ); PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = framework; @@ -998,7 +1002,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - A9B9C215182391DF00416A4E /* Build configuration list for PBXNativeTarget "MP42" */ = { + A9B9C215182391DF00416A4E /* Build configuration list for PBXNativeTarget "MP42Foundation" */ = { isa = XCConfigurationList; buildConfigurations = ( A9B9C216182391DF00416A4E /* Debug */, @@ -1007,7 +1011,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - A9B9C218182391DF00416A4E /* Build configuration list for PBXNativeTarget "MP42Tests" */ = { + A9B9C218182391DF00416A4E /* Build configuration list for PBXNativeTarget "MP42FoundationTests" */ = { isa = XCConfigurationList; buildConfigurations = ( A9B9C219182391DF00416A4E /* Debug */, diff --git a/MP42.xcodeproj/xcuserdata/damians.xcuserdatad/xcschemes/MP42.xcscheme b/MP42.xcodeproj/xcuserdata/damians.xcuserdatad/xcschemes/MP42.xcscheme index 8392600..41a39ab 100644 --- a/MP42.xcodeproj/xcuserdata/damians.xcuserdatad/xcschemes/MP42.xcscheme +++ b/MP42.xcodeproj/xcuserdata/damians.xcuserdatad/xcschemes/MP42.xcscheme @@ -15,8 +15,8 @@ @@ -33,8 +33,8 @@ diff --git a/MP42/MP42AACImporter.mm b/MP42/MP42AACImporter.mm index 1691a67..0b3bb47 100644 --- a/MP42/MP42AACImporter.mm +++ b/MP42/MP42AACImporter.mm @@ -7,7 +7,7 @@ // #import "MP42AACImporter.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MP42File.h" @implementation MP42AACImporter diff --git a/MP42/MP42AC3Importer.m b/MP42/MP42AC3Importer.m index 9bad2de..a93c27a 100644 --- a/MP42/MP42AC3Importer.m +++ b/MP42/MP42AC3Importer.m @@ -7,7 +7,7 @@ // #import "MP42AC3Importer.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MP42File.h" #import "MP42Utilities.h" #import "MP42Fifo.h" diff --git a/MP42/MP42AVFImporter.m b/MP42/MP42AVFImporter.m index 7d8f837..184f3c6 100644 --- a/MP42/MP42AVFImporter.m +++ b/MP42/MP42AVFImporter.m @@ -9,7 +9,7 @@ #if __MAC_OS_X_VERSION_MAX_ALLOWED > 1060 #import "MP42AVFImporter.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MP42File.h" #import "MP42Image.h" diff --git a/MP42/MP42CCImporter.m b/MP42/MP42CCImporter.m index e492489..60ede1b 100644 --- a/MP42/MP42CCImporter.m +++ b/MP42/MP42CCImporter.m @@ -8,7 +8,7 @@ #import "MP42CCImporter.h" #import "MP42SubUtilities.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MP42File.h" #import "RegexKitLite.h" diff --git a/MP42/MP42ChapterTrack.h b/MP42/MP42ChapterTrack.h index c5b1df2..45ea0d0 100644 --- a/MP42/MP42ChapterTrack.h +++ b/MP42/MP42ChapterTrack.h @@ -12,12 +12,17 @@ @interface MP42ChapterTrack : MP42Track { NSMutableArray *chapters; + BOOL _areChaptersEdited; } + - (instancetype)initWithSourceURL:(NSURL *)URL trackID:(NSInteger)trackID fileHandle:(MP42FileHandle)fileHandle; + (instancetype)chapterTrackFromFile:(NSURL *)URL; - (void)addChapter:(NSString *)title duration:(uint64_t)timestamp; +- (void)addChapter:(NSString *)title image:(MP42Image *)image duration:(uint64_t)timestamp; + - (void)removeChapterAtIndex:(NSUInteger)index; +- (void)removeChaptersAtIndexes:(NSIndexSet *)indexes; - (void)setTimestamp:(MP42Duration)timestamp forChapter:(MP42TextSample *)chapterSample; - (void)setTitle:(NSString*)title forChapter:(MP42TextSample *)chapterSample; diff --git a/MP42/MP42ChapterTrack.m b/MP42/MP42ChapterTrack.m index 9063347..052555c 100644 --- a/MP42/MP42ChapterTrack.m +++ b/MP42/MP42ChapterTrack.m @@ -85,6 +85,7 @@ _muxed = NO; _enabled = NO; _mediaType = MP42MediaTypeText; + _areChaptersEdited = YES; chapters = [[NSMutableArray alloc] init]; LoadChaptersFromPath([_sourceURL path], chapters); @@ -106,6 +107,21 @@ newChapter.timestamp = timestamp; _isEdited = YES; + _areChaptersEdited = YES; + + [chapters addObject:newChapter]; + [chapters sortUsingSelector:@selector(compare:)]; + [newChapter release]; +} + +- (void)addChapter:(NSString *)title image:(MP42Image *)image duration:(uint64_t)timestamp { + MP42TextSample *newChapter = [[MP42TextSample alloc] init]; + newChapter.title = title; + newChapter.image = image; + newChapter.timestamp = timestamp; + + _isEdited = YES; + _areChaptersEdited = YES; [chapters addObject:newChapter]; [chapters sortUsingSelector:@selector(compare:)]; @@ -113,14 +129,21 @@ } - (void)removeChapterAtIndex:(NSUInteger)index +{ + [self removeChaptersAtIndexes:[NSIndexSet indexSetWithIndex:index]]; +} + +- (void)removeChaptersAtIndexes:(NSIndexSet *)indexes { _isEdited = YES; - [chapters removeObjectAtIndex:index]; + _areChaptersEdited = YES; + [chapters removeObjectsAtIndexes:indexes]; } - (void)setTimestamp:(MP4Duration)timestamp forChapter:(MP42TextSample *)chapterSample { _isEdited = YES; + _areChaptersEdited = YES; [chapterSample setTimestamp:timestamp]; [chapters sortUsingSelector:@selector(compare:)]; } @@ -128,6 +151,7 @@ - (void)setTitle:(NSString *)title forChapter:(MP42TextSample *)chapterSample { _isEdited = YES; + _areChaptersEdited = YES; [chapterSample setTitle:title]; } @@ -140,7 +164,7 @@ { BOOL success = YES; - if (_isEdited) { + if (_isEdited && _areChaptersEdited) { MP4Chapter_t * fileChapters = 0; MP4Duration refTrackDuration; uint32_t chapterCount = 0; diff --git a/MP42/MP42ClosedCaptionTrack.m b/MP42/MP42ClosedCaptionTrack.m index bbab435..7eb50dc 100644 --- a/MP42/MP42ClosedCaptionTrack.m +++ b/MP42/MP42ClosedCaptionTrack.m @@ -8,7 +8,7 @@ #import "MP42ClosedCaptionTrack.h" #import "MP42MediaFormat.h" -#import "SBLanguages.h" +#import "MP42Languages.h" @implementation MP42ClosedCaptionTrack diff --git a/MP42/MP42File.h b/MP42/MP42File.h index d65e268..7671c59 100644 --- a/MP42/MP42File.h +++ b/MP42/MP42File.h @@ -18,9 +18,10 @@ #import "MP42MediaFormat.h" -extern NSString * const MP42Create64BitData; -extern NSString * const MP42Create64BitTime; -extern NSString * const MP42CreateChaptersPreviewTrack; +extern NSString * const MP4264BitData; +extern NSString * const MP4264BitTime; +extern NSString * const MP42GenerateChaptersPreviewTrack; +extern NSString * const MP42CustomChaptersPreviewTrack; extern NSString * const MP42OrganizeAlternateGroups; @protocol MP42FileDelegate diff --git a/MP42/MP42File.m b/MP42/MP42File.m index 07320ff..de71d5d 100644 --- a/MP42/MP42File.m +++ b/MP42/MP42File.m @@ -11,7 +11,7 @@ #import "MP42Muxer.h" #import "MP42SubUtilities.h" #import "MP42Utilities.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import @@ -21,9 +21,10 @@ #import "mp4v2.h" -NSString * const MP42Create64BitData = @"MP4264BitData"; -NSString * const MP42Create64BitTime = @"MP4264BitTime"; -NSString * const MP42CreateChaptersPreviewTrack = @"MP42ChaptersPreview"; +NSString * const MP4264BitData = @"MP4264BitData"; +NSString * const MP4264BitTime = @"MP4264BitTime"; +NSString * const MP42GenerateChaptersPreviewTrack = @"MP42ChaptersPreview"; +NSString * const MP42CustomChaptersPreviewTrack = @"MP42CustomChaptersPreview"; NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; @interface MP42File () { @@ -106,10 +107,11 @@ NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; _hasFileRepresentation = YES; _tracks = [[NSMutableArray alloc] init]; - int i, tracksCount = MP4GetNumberOfTracks(_fileHandle, 0, 0); + uint32_t tracksCount = MP4GetNumberOfTracks(_fileHandle, 0, 0); MP4TrackId chapterId = findChapterTrackId(_fileHandle); + MP4TrackId previewsId = 0; //findChapterPreviewTrackId(_fileHandle); - for (i=0; i< tracksCount; i++) { + for (int i = 0; i< tracksCount; i++) { id track; MP4TrackId trackId = MP4FindTrackId(_fileHandle, i, 0, 0); const char* type = MP4GetTrackType(_fileHandle, trackId); @@ -140,6 +142,12 @@ NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; [self reconnectReferences]; + for (MP42Track *track in _tracks) + if ([track.format isEqualToString:MP42VideoFormatJPEG]) + previewsId = track.Id; + + [self loadPreviewsFromTrackID:previewsId]; + _tracksToBeDeleted = [[NSMutableArray alloc] init]; _metadata = [[MP42Metadata alloc] initWithSourceURL:_fileURL fileHandle:_fileHandle]; _importers = [[NSMutableDictionary alloc] init]; @@ -166,6 +174,39 @@ NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; } } +- (void)loadPreviewsFromTrackID:(MP4TrackId) trackID { + MP42Track *track = [self trackWithTrackID:trackID]; + if (track) { + MP4SampleId sampleNum = MP4GetTrackNumberOfSamples(_fileHandle, track.Id); + + for (MP4SampleId currentSampleNum = 1; currentSampleNum <= sampleNum; currentSampleNum++) { + uint8_t *pBytes = NULL; + uint32_t numBytes = 0; + MP4Duration duration; + MP4Duration renderingOffset; + MP4Timestamp pStartTime; + bool isSyncSample; + + if (!MP4ReadSample(_fileHandle, + track.Id, + currentSampleNum, + &pBytes, &numBytes, + &pStartTime, &duration, &renderingOffset, + &isSyncSample)) { + break; + } + + NSData *frameData = [[NSData alloc] initWithBytes:pBytes length:numBytes]; + MP42Image *frame = [[MP42Image alloc] initWithData:frameData type:MP42_ART_JPEG]; + + [[self chapters] chapterAtIndex:currentSampleNum - 1].image = frame; + + [frame release]; + free(pBytes); + } + } +} + - (NSUInteger)duration { NSUInteger duration = 0; @@ -406,10 +447,10 @@ NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; uint32_t supportedBrandsCount = 0; uint32_t flags = 0; - if ([[attributes valueForKey:MP42Create64BitData] boolValue]) + if ([[attributes valueForKey:MP4264BitData] boolValue]) flags += 0x01; - if ([[attributes valueForKey:MP42Create64BitTime] boolValue]) + if ([[attributes valueForKey:MP4264BitTime] boolValue]) flags += 0x02; if ([fileExtension isEqualToString:MP42FileTypeM4V]) { @@ -545,8 +586,11 @@ NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; } // Generate previews images for chapters - if ([[attributes valueForKey:MP42CreateChaptersPreviewTrack] boolValue] && [_tracks count]) + if ([[attributes valueForKey:MP42GenerateChaptersPreviewTrack] boolValue] && [_tracks count]) { [self createChaptersPreview]; + } else if ([[attributes valueForKey:MP42CustomChaptersPreviewTrack] boolValue] && [_tracks count]) { + [self customChaptersPreview]; + } if ([_delegate respondsToSelector:@selector(endSave:)]) [_delegate performSelector:@selector(endSave:) withObject:self]; @@ -719,6 +763,118 @@ NSString * const MP42OrganizeAlternateGroups = @"MP42AlternateGroups"; return [images autorelease]; } +- (BOOL)muxChaptersPreviewTrackId:(MP4TrackId)jpegTrack withChapterTrack:(MP42ChapterTrack *)chapterTrack andRefTrack:(MP42VideoTrack *)videoTrack { + // Reopen the mp4v2 fileHandle + _fileHandle = MP4Modify([[_fileURL path] UTF8String], 0); + if (_fileHandle == MP4_INVALID_FILE_HANDLE) + return NO; + + CGFloat maxWidth = 640; + NSSize imageSize = NSMakeSize(videoTrack.trackWidth, videoTrack.trackHeight); + if (imageSize.width > maxWidth) { + imageSize.height = maxWidth / imageSize.width * imageSize.height; + imageSize.width = maxWidth; + } + NSRect rect = NSMakeRect(0.0, 0.0, imageSize.width, imageSize.height); + + if (jpegTrack ) { + MP4DeleteTrack(_fileHandle, jpegTrack); + } + + jpegTrack = MP4AddJpegVideoTrack(_fileHandle, MP4GetTrackTimeScale(_fileHandle, [chapterTrack Id]), + MP4_INVALID_DURATION, imageSize.width, imageSize.height); + + MP4SetTrackLanguage(_fileHandle, jpegTrack, lang_for_english([videoTrack.language UTF8String])->iso639_2); + MP4SetTrackIntegerProperty(_fileHandle, jpegTrack, "tkhd.layer", 1); + MP4SetTrackDisabled(_fileHandle, jpegTrack); + + NSUInteger idx = 0; + MP4Duration duration = 0; + + for (MP42TextSample *chapterT in [chapterTrack chapters]) { + duration = MP4GetSampleDuration(_fileHandle, chapterTrack.Id, idx + 1); + + NSData *imageData = chapterT.image.data; + + if (!imageData) { + // Scale the image. + NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL + pixelsWide:rect.size.width + pixelsHigh:rect.size.height + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSCalibratedRGBColorSpace + bitmapFormat:NSAlphaFirstBitmapFormat + bytesPerRow:0 + bitsPerPixel:32]; + [NSGraphicsContext saveGraphicsState]; + [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]]; + + [[NSColor blackColor] set]; + NSRectFill(rect); + + if (chapterT.image.image) + [[chapterT image].image drawInRect:rect fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; + + [NSGraphicsContext restoreGraphicsState]; + + imageData = [bitmap representationUsingType:NSJPEGFileType properties:nil]; + [bitmap release]; + } + + MP4WriteSample(_fileHandle, + jpegTrack, + [imageData bytes], + [imageData length], + duration, + 0, + true); + idx++; + } + + MP4RemoveAllTrackReferences(_fileHandle, "tref.chap", videoTrack.Id); + MP4AddTrackReference(_fileHandle, "tref.chap", chapterTrack.Id, videoTrack.Id); + MP4AddTrackReference(_fileHandle, "tref.chap", jpegTrack, videoTrack.Id); + copyTrackEditLists(_fileHandle, chapterTrack.Id, jpegTrack); + + MP4Close(_fileHandle, 0); + + return YES; +} + +- (BOOL)customChaptersPreview { + NSInteger decodable = 1; + MP42ChapterTrack *chapterTrack = nil; + MP42VideoTrack *refTrack = nil; + MP4TrackId jpegTrack = 0; + + for (MP42Track *track in _tracks) { + if ([track isMemberOfClass:[MP42ChapterTrack class]] && !chapterTrack) + chapterTrack = (MP42ChapterTrack *)track; + + if ([track isMemberOfClass:[MP42VideoTrack class]] && + ![track.format isEqualToString:MP42VideoFormatJPEG] + && !refTrack) + refTrack = (MP42VideoTrack *)track; + + if ([track.format isEqualToString:MP42VideoFormatJPEG] && !jpegTrack) + jpegTrack = track.Id; + + if ([track.format isEqualToString:MP42VideoFormatH264]) + if ((((MP42VideoTrack *)track).origProfile) == 110) + decodable = 0; + } + + if (!refTrack) + refTrack = [_tracks objectAtIndex:0]; + + [self muxChaptersPreviewTrackId:jpegTrack withChapterTrack:chapterTrack andRefTrack:refTrack]; + + return YES; +} + - (BOOL)createChaptersPreview { NSInteger decodable = 1; MP42ChapterTrack *chapterTrack = nil; diff --git a/MP42/MP42FileImporter.h b/MP42/MP42FileImporter.h index 8e0bcd8..c299237 100644 --- a/MP42/MP42FileImporter.h +++ b/MP42/MP42FileImporter.h @@ -39,8 +39,8 @@ - (instancetype)initWithURL:(NSURL *)fileURL error:(NSError **)outError; -- (BOOL)containsTrack:(MP42Track*)track; -- (MP42Track *)inputTrackWithTrackID:(MP4TrackId)trackId; +- (BOOL)containsTrack:(MP42Track *)track; +- (MP42Track *)inputTrackWithTrackID:(MP42TrackId)trackId; - (NSUInteger)timescaleForTrack:(MP42Track *)track; - (NSSize)sizeForTrack:(MP42Track *)track; @@ -59,7 +59,7 @@ - (BOOL)done; - (void)setDone:(BOOL)status; -- (BOOL)cleanUp:(MP4FileHandle) fileHandle; +- (BOOL)cleanUp:(MP42FileHandle) fileHandle; @property(readwrite, retain) MP42Metadata *metadata; @property(readonly) NSMutableArray *tracks; diff --git a/MP42/MP42H264Importer.mm b/MP42/MP42H264Importer.mm index a4044b0..156ed15 100644 --- a/MP42/MP42H264Importer.mm +++ b/MP42/MP42H264Importer.mm @@ -7,7 +7,7 @@ // #import "MP42H264Importer.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MP42File.h" #include diff --git a/MP42/SBLanguages.h b/MP42/MP42Languages.h similarity index 93% rename from MP42/SBLanguages.h rename to MP42/MP42Languages.h index 9e30fa4..eec9292 100644 --- a/MP42/SBLanguages.h +++ b/MP42/MP42Languages.h @@ -1,5 +1,5 @@ // -// SBLanguages.h +// MP42Languages.h // Subler // // Created by Damiano Galassi on 13/08/12. @@ -28,7 +28,7 @@ extern "C" { /* find language associated with ISO-639-2 language code */ iso639_lang_t * lang_for_code2( const char *code2 ); - + /* find language associated with qt language code */ iso639_lang_t * lang_for_qtcode( short code ); @@ -40,9 +40,9 @@ extern "C" { } #endif -@interface SBLanguages : NSObject +@interface MP42Languages : NSObject -+ (SBLanguages *)defaultManager; ++ (MP42Languages *)defaultManager; - (NSArray *)languages; + (NSString *)iso6391CodeFor:(NSString *)aLanguage; diff --git a/MP42/SBLanguages.m b/MP42/MP42Languages.m similarity index 99% rename from MP42/SBLanguages.m rename to MP42/MP42Languages.m index 489b4ac..368123c 100644 --- a/MP42/SBLanguages.m +++ b/MP42/MP42Languages.m @@ -1,12 +1,12 @@ // -// SBLanguages.m +// MP42Languages.m // Subler // // Created by Damiano Galassi on 13/08/12. // // -#import "SBLanguages.h" +#import "MP42Languages.h" #include #include @@ -600,12 +600,12 @@ iso639_lang_t * lang_for_english( const char * english ) return (iso639_lang_t*) languages; } -@implementation SBLanguages +@implementation MP42Languages -+ (SBLanguages *)defaultManager ++ (MP42Languages *)defaultManager { static dispatch_once_t pred; - static SBLanguages *sharedLanguagesManager = nil; + static MP42Languages *sharedLanguagesManager = nil; dispatch_once(&pred, ^{ sharedLanguagesManager = [[self alloc] init]; }); return sharedLanguagesManager; diff --git a/MP42/MP42Metadata.m b/MP42/MP42Metadata.m index af431e9..227803a 100644 --- a/MP42/MP42Metadata.m +++ b/MP42/MP42Metadata.m @@ -11,7 +11,7 @@ #import "MP42XMLReader.h" #import "MP42Image.h" #import "RegexKitLite.h" -#import "SBRatings.h" +#import "MP42Ratings.h" typedef struct mediaKind_t { @@ -939,7 +939,7 @@ static const genreType_t genreType_strings[] = { else ratingiTunesCode = nil; - [tagsDict setObject:[NSNumber numberWithUnsignedInteger:[[SBRatings defaultManager] ratingIndexForiTunesCode:ratingiTunesCode]] forKey:@"Rating"]; + [tagsDict setObject:[NSNumber numberWithUnsignedInteger:[[MP42Ratings defaultManager] ratingIndexForiTunesCode:ratingiTunesCode]] forKey:@"Rating"]; if ([ratingItems count] >= 4) [tagsDict setObject:[ratingItems objectAtIndex:3] forKey:@"Rating Annotation"]; } @@ -1280,12 +1280,12 @@ static const genreType_t genreType_strings[] = { MP4ItmfData* data = &newItem->dataList.elements[0]; if (![[tagsDict valueForKey:@"Rating"] isKindOfClass:[NSNumber class]] || - [[tagsDict valueForKey:@"Rating"] unsignedIntegerValue] == [[SBRatings defaultManager] unknownIndex]) { + [[tagsDict valueForKey:@"Rating"] unsignedIntegerValue] == [[MP42Ratings defaultManager] unknownIndex]) { if (!ratingiTunesCode) { - ratingiTunesCode = [[[SBRatings defaultManager] iTunesCodes] objectAtIndex:[[SBRatings defaultManager] unknownIndex]]; + ratingiTunesCode = [[[MP42Ratings defaultManager] iTunesCodes] objectAtIndex:[[MP42Ratings defaultManager] unknownIndex]]; } } else { - ratingiTunesCode = [[[SBRatings defaultManager] iTunesCodes] objectAtIndex:[[tagsDict valueForKey:@"Rating"] unsignedIntegerValue]]; + ratingiTunesCode = [[[MP42Ratings defaultManager] iTunesCodes] objectAtIndex:[[tagsDict valueForKey:@"Rating"] unsignedIntegerValue]]; } NSString *ratingString = ratingiTunesCode; if ([[tagsDict valueForKey:@"Rating Annotation"] length] && [ratingString length]) { diff --git a/MP42/MP42MkvImporter.m b/MP42/MP42MkvImporter.m index d0c2556..4ac67c6 100644 --- a/MP42/MP42MkvImporter.m +++ b/MP42/MP42MkvImporter.m @@ -10,7 +10,7 @@ #import "MP42File.h" #import "MP42SubUtilities.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MatroskaParser.h" #import "MatroskaFile.h" diff --git a/MP42/MP42Mp4Importer.m b/MP42/MP42Mp4Importer.m index db64d2c..f7a68bf 100644 --- a/MP42/MP42Mp4Importer.m +++ b/MP42/MP42Mp4Importer.m @@ -7,7 +7,7 @@ // #import "MP42Mp4Importer.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MP42Sample.h" @interface MP4DemuxkHelper : NSObject { diff --git a/MP42/MP42OCRWrapper.mm b/MP42/MP42OCRWrapper.mm index 14e0327..32df44c 100644 --- a/MP42/MP42OCRWrapper.mm +++ b/MP42/MP42OCRWrapper.mm @@ -7,7 +7,7 @@ // #import "MP42OCRWrapper.h" -#import "SBLanguages.h" +#import "MP42Languages.h" // Tesseract OCR #include "baseapi.h" diff --git a/MP42/MP42QTImporter.m b/MP42/MP42QTImporter.m index cb297f4..81f682a 100644 --- a/MP42/MP42QTImporter.m +++ b/MP42/MP42QTImporter.m @@ -12,7 +12,7 @@ #import "MP42Image.h" #import #import -#import "SBLanguages.h" +#import "MP42Languages.h" #import "QTKitDecrap.h" #include "avcodec.h" diff --git a/MP42/SBRatings.h b/MP42/MP42Ratings.h similarity index 86% rename from MP42/SBRatings.h rename to MP42/MP42Ratings.h index 07d6438..549ea54 100644 --- a/MP42/SBRatings.h +++ b/MP42/MP42Ratings.h @@ -1,5 +1,5 @@ // -// SBRatings.h +// MP42Ratings.h // Subler // // Created by Douglas Stebila on 2013-06-02. @@ -8,7 +8,7 @@ #import -@interface SBRatings : NSObject { +@interface MP42Ratings : NSObject { NSMutableArray *ratingsDictionary; NSMutableArray *ratings; NSMutableArray *iTunesCodes; @@ -17,7 +17,7 @@ @property(readonly) NSMutableArray *ratings; @property(readonly) NSMutableArray *iTunesCodes; -+ (SBRatings *) defaultManager; ++ (MP42Ratings *) defaultManager; - (void)updateRatingsCountry; - (NSArray *) ratingsCountries; diff --git a/MP42/SBRatings.m b/MP42/MP42Ratings.m similarity index 94% rename from MP42/SBRatings.m rename to MP42/MP42Ratings.m index a031b86..3e2e38a 100644 --- a/MP42/SBRatings.m +++ b/MP42/MP42Ratings.m @@ -1,30 +1,30 @@ // -// SBRatings.m +// MP42Ratings.m // Subler // // Created by Douglas Stebila on 2013-06-02. // // -#import "SBRatings.h" +#import "MP42Ratings.h" #import "JSONKit.h" -@implementation SBRatings +@implementation MP42Ratings @synthesize ratings; @synthesize iTunesCodes; -+ (SBRatings *) defaultManager { ++ (MP42Ratings *) defaultManager { static dispatch_once_t sharedRatingsPred; - static SBRatings *sharedRatingsManager = nil; + static MP42Ratings *sharedRatingsManager = nil; dispatch_once(&sharedRatingsPred, ^{ sharedRatingsManager = [[self alloc] init]; }); return sharedRatingsManager; } - (id) init { if (self = [super init]) { - NSString* ratingsJSON = [[NSBundle mainBundle] pathForResource:@"Ratings" ofType:@"json"]; + NSString* ratingsJSON = [[NSBundle bundleForClass:[MP42Ratings class]] pathForResource:@"Ratings" ofType:@"json"]; if (!ratingsJSON) { [self release]; return nil; diff --git a/MP42/MP42SrtImporter.m b/MP42/MP42SrtImporter.m index 9bbffd6..08195b2 100644 --- a/MP42/MP42SrtImporter.m +++ b/MP42/MP42SrtImporter.m @@ -10,7 +10,7 @@ #import "MP42File.h" #import "MP42SubUtilities.h" -#import "SBLanguages.h" +#import "MP42Languages.h" @implementation MP42SrtImporter diff --git a/MP42/MP42SubtitleTrack.m b/MP42/MP42SubtitleTrack.m index de743a8..9baccc2 100644 --- a/MP42/MP42SubtitleTrack.m +++ b/MP42/MP42SubtitleTrack.m @@ -10,7 +10,7 @@ #import "MP42Utilities.h" #import "MP42MediaFormat.h" #import "MP42HtmlParser.h" -#import "SBLanguages.h" +#import "MP42Languages.h" @implementation MP42SubtitleTrack diff --git a/MP42/MP42TextSample.h b/MP42/MP42TextSample.h index b3ae4d1..edf0e7a 100644 --- a/MP42/MP42TextSample.h +++ b/MP42/MP42TextSample.h @@ -8,13 +8,16 @@ #import #import "MP42MediaFormat.h" +#import "MP42Image.h" @interface MP42TextSample : NSObject { MP42Duration timestamp; + MP42Image *image; NSString *title; } @property(readwrite, retain) NSString *title; +@property(readwrite, retain) MP42Image *image; @property(readwrite) MP42Duration timestamp; @end diff --git a/MP42/MP42TextSample.m b/MP42/MP42TextSample.m index d7354a2..44a6692 100644 --- a/MP42/MP42TextSample.m +++ b/MP42/MP42TextSample.m @@ -24,12 +24,14 @@ -(void) dealloc { + [image release]; [title release]; [super dealloc]; } @synthesize timestamp; @synthesize title; +@synthesize image; - (void)encodeWithCoder:(NSCoder *)coder { diff --git a/MP42/MP42Track.m b/MP42/MP42Track.m index 24c9e34..5ffb38c 100644 --- a/MP42/MP42Track.m +++ b/MP42/MP42Track.m @@ -11,7 +11,7 @@ #import "MP42FileImporter.h" #import "MP42Sample.h" #import "MP42Fifo.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MP42Track_Muxer.h" diff --git a/MP42/MP42Utilities.h b/MP42/MP42Utilities.h index 68b903c..b7f8c8a 100644 --- a/MP42/MP42Utilities.h +++ b/MP42/MP42Utilities.h @@ -36,6 +36,8 @@ uint64_t getTrackSize(MP4FileHandle fileHandle, MP4TrackId trackId); int isHdVideo(uint64_t width, uint64_t height); MP4TrackId findChapterTrackId(MP4FileHandle fileHandle); +MP4TrackId findChapterPreviewTrackId(MP4FileHandle fileHandle); + void removeAllChapterTrackReferences(MP4FileHandle fileHandle); MP4TrackId findFirstVideoTrack(MP4FileHandle fileHandle); diff --git a/MP42/MP42Utilities.m b/MP42/MP42Utilities.m index 2784f3b..2c35dd9 100644 --- a/MP42/MP42Utilities.m +++ b/MP42/MP42Utilities.m @@ -13,7 +13,7 @@ #include #include -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MP42MediaFormat.h" #include "intreadwrite.h" #include "avcodec.h" @@ -150,6 +150,26 @@ MP4TrackId findChapterTrackId(MP4FileHandle fileHandle) return (MP4TrackId) trackRef; } } + + return 0; +} + +MP4TrackId findChapterPreviewTrackId(MP4FileHandle fileHandle) +{ + MP4TrackId trackId = 0; + uint64_t trackRef = 0; + unsigned int i; + for (i = 0; i< MP4GetNumberOfTracks( fileHandle, 0, 0); i++ ) { + trackId = MP4FindTrackId(fileHandle, i, 0, 0); + if (MP4HaveTrackAtom(fileHandle, trackId, "tref.chap")) { + uint64_t entryCount = 0; + MP4GetTrackIntegerProperty(fileHandle, trackId, "tref.chap.entryCount", &entryCount); + if (entryCount > 1 && MP4GetTrackIntegerProperty(fileHandle, trackId, "tref.chap.entries.trackId[1]", &trackRef)) + if (trackRef > 0) + return (MP4TrackId) trackRef; + } + } + return 0; } diff --git a/MP42/MP42VobSubImporter.m b/MP42/MP42VobSubImporter.m index 143ecc9..9aef180 100644 --- a/MP42/MP42VobSubImporter.m +++ b/MP42/MP42VobSubImporter.m @@ -8,7 +8,7 @@ #import "MP42VobSubImporter.h" #import "MP42SubUtilities.h" -#import "SBLanguages.h" +#import "MP42Languages.h" #import "MP42File.h" diff --git a/MP42/Ratings.json b/MP42/Ratings.json new file mode 100644 index 0000000..7e843f1 --- /dev/null +++ b/MP42/Ratings.json @@ -0,0 +1,209 @@ +[ +{ + "country" : "Unknown", + "ratings" : [ + { "media" : "movie & TV", "prefix" : "mpaa", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "Unknown" } + ] +}, +{ + "country" : "USA", + "ratings" : [ + { "media" : "movie", "prefix" : "mpaa", "itunes-code" : "NR", "itunes-value" : "000", "description" : "NR" }, + { "media" : "movie", "prefix" : "mpaa", "itunes-code" : "G", "itunes-value" : "100", "description" : "G" }, + { "media" : "movie", "prefix" : "mpaa", "itunes-code" : "PG", "itunes-value" : "200", "description" : "PG" }, + { "media" : "movie", "prefix" : "mpaa", "itunes-code" : "PG-13", "itunes-value" : "300", "description" : "PG-13" }, + { "media" : "movie", "prefix" : "mpaa", "itunes-code" : "R", "itunes-value" : "400", "description" : "R" }, + { "media" : "movie", "prefix" : "mpaa", "itunes-code" : "NC-17", "itunes-value" : "500", "description" : "NC-17" }, + { "media" : "movie", "prefix" : "mpaa", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "Unrated" }, + { "media" : "TV", "prefix" : "us-tv", "itunes-code" : "TV-Y", "itunes-value" : "100", "description" : "TV-Y" }, + { "media" : "TV", "prefix" : "us-tv", "itunes-code" : "TV-Y7", "itunes-value" : "200", "description" : "TV-Y7" }, + { "media" : "TV", "prefix" : "us-tv", "itunes-code" : "TV-G", "itunes-value" : "300", "description" : "TV-G" }, + { "media" : "TV", "prefix" : "us-tv", "itunes-code" : "TV-PG", "itunes-value" : "400", "description" : "TV-PG" }, + { "media" : "TV", "prefix" : "us-tv", "itunes-code" : "TV-14", "itunes-value" : "500", "description" : "TV-14" }, + { "media" : "TV", "prefix" : "us-tv", "itunes-code" : "TV-MA", "itunes-value" : "600", "description" : "TV-MA" }, + { "media" : "TV", "prefix" : "us-tv", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "Unrated" } + ] +}, +{ + "country" : "Australia", + "ratings" : [ + { "media" : "movie", "prefix" : "au-movie", "itunes-code" : "G", "itunes-value" : "100", "description" : "G" }, + { "media" : "movie", "prefix" : "au-movie", "itunes-code" : "PG", "itunes-value" : "200", "description" : "PG" }, + { "media" : "movie", "prefix" : "au-movie", "itunes-code" : "M", "itunes-value" : "350", "description" : "M" }, + { "media" : "movie", "prefix" : "au-movie", "itunes-code" : "MA15+", "itunes-value" : "375", "description" : "MA15+" }, + { "media" : "movie", "prefix" : "au-movie", "itunes-code" : "R18+", "itunes-value" : "400", "description" : "R18+" }, + { "media" : "movie", "prefix" : "au-movie", "itunes-code" : "Not Rated","itunes-value" : "???", "description" : "Not Rated" }, + { "media" : "TV", "prefix" : "au-tv", "itunes-code" : "P", "itunes-value" : "100", "description" : "P" }, + { "media" : "TV", "prefix" : "au-tv", "itunes-code" : "C", "itunes-value" : "200", "description" : "C" }, + { "media" : "TV", "prefix" : "au-tv", "itunes-code" : "G", "itunes-value" : "300", "description" : "G" }, + { "media" : "TV", "prefix" : "au-tv", "itunes-code" : "PG", "itunes-value" : "400", "description" : "PG" }, + { "media" : "TV", "prefix" : "au-tv", "itunes-code" : "M", "itunes-value" : "500", "description" : "M" }, + { "media" : "TV", "prefix" : "au-tv", "itunes-code" : "MA15+", "itunes-value" : "550", "description" : "MA15+" }, + { "media" : "TV", "prefix" : "au-tv", "itunes-code" : "AV15+", "itunes-value" : "575", "description" : "AV15+" }, + { "media" : "TV", "prefix" : "au-tv", "itunes-code" : "R18+", "itunes-value" : "160", "description" : "R18+" } + ] +}, +{ + "country" : "Brasil", + "ratings" : [ + { "media" : "movie", "prefix" : "br-movie", "itunes-code" : "L", "itunes-value" : "000", "description" : "L" }, + { "media" : "movie", "prefix" : "br-movie", "itunes-code" : "12", "itunes-value" : "100", "description" : "12" }, + { "media" : "movie", "prefix" : "br-movie", "itunes-code" : "14", "itunes-value" : "300", "description" : "14" }, + { "media" : "movie", "prefix" : "br-movie", "itunes-code" : "16", "itunes-value" : "350", "description" : "16" }, + { "media" : "movie", "prefix" : "br-movie", "itunes-code" : "18", "itunes-value" : "400", "description" : "18" } + ] +}, +{ + "country" : "Canada", + "ratings" : [ + { "media" : "movie", "prefix" : "ca-movie", "itunes-code" : "G", "itunes-value" : "100", "description" : "G" }, + { "media" : "movie", "prefix" : "ca-movie", "itunes-code" : "PG", "itunes-value" : "200", "description" : "PG" }, + { "media" : "movie", "prefix" : "ca-movie", "itunes-code" : "14A", "itunes-value" : "300", "description" : "14A" }, + { "media" : "movie", "prefix" : "ca-movie", "itunes-code" : "18A", "itunes-value" : "350", "description" : "18A" }, + { "media" : "movie", "prefix" : "ca-movie", "itunes-code" : "R", "itunes-value" : "400", "description" : "R" }, + { "media" : "movie", "prefix" : "ca-movie", "itunes-code" : "A", "itunes-value" : "500", "description" : "A" }, + { "media" : "movie", "prefix" : "ca-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "Unrated" }, + { "media" : "movie", "prefix" : "ca-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "Not Rated" }, + { "media" : "TV", "prefix" : "ca-tv", "itunes-code" : "E", "itunes-value" : "000", "description" : "E" }, + { "media" : "TV", "prefix" : "ca-tv", "itunes-code" : "C", "itunes-value" : "050", "description" : "C" }, + { "media" : "TV", "prefix" : "ca-tv", "itunes-code" : "C8", "itunes-value" : "075", "description" : "C8" }, + { "media" : "TV", "prefix" : "ca-tv", "itunes-code" : "G", "itunes-value" : "100", "description" : "G" }, + { "media" : "TV", "prefix" : "ca-tv", "itunes-code" : "PG", "itunes-value" : "200", "description" : "PG" }, + { "media" : "TV", "prefix" : "ca-tv", "itunes-code" : "14+", "itunes-value" : "300", "description" : "14+" }, + { "media" : "TV", "prefix" : "ca-tv", "itunes-code" : "18+", "itunes-value" : "350", "description" : "18+" }, + { "media" : "TV", "prefix" : "ca-tv", "itunes-code" : "21+", "itunes-value" : "500", "description" : "21+" } + ] +}, +{ + "country" : "Deutschland", + "ratings" : [ + { "media" : "movie", "prefix" : "de-movie", "itunes-code" : "Ab 0 Jahren", "itunes-value" : "075", "description" : "Ab 0 Jahren" }, + { "media" : "movie", "prefix" : "de-movie", "itunes-code" : "Ab 6 Jahren", "itunes-value" : "100", "description" : "Ab 6 Jahren" }, + { "media" : "movie", "prefix" : "de-movie", "itunes-code" : "Ab 12 Jahren", "itunes-value" : "200", "description" : "Ab 12 Jahren" }, + { "media" : "movie", "prefix" : "de-movie", "itunes-code" : "Ab 16 Jahren", "itunes-value" : "500", "description" : "Ab 16 Jahren" }, + { "media" : "movie", "prefix" : "de-movie", "itunes-code" : "Ab 18 Jahren", "itunes-value" : "600", "description" : "Ab 18 Jahren" }, + { "media" : "TV", "prefix" : "de-tv", "itunes-code" : "Ab 0 Jahren", "itunes-value" : "075", "description" : "Ab 0 Jahren" }, + { "media" : "TV", "prefix" : "de-tv", "itunes-code" : "Ab 6 Jahren", "itunes-value" : "100", "description" : "Ab 6 Jahren" }, + { "media" : "TV", "prefix" : "de-tv", "itunes-code" : "Ab 12 Jahren", "itunes-value" : "200", "description" : "Ab 12 Jahren" }, + { "media" : "TV", "prefix" : "de-tv", "itunes-code" : "Ab 16 Jahren", "itunes-value" : "500", "description" : "Ab 16 Jahren" }, + { "media" : "TV", "prefix" : "de-tv", "itunes-code" : "Ab 18 Jahren", "itunes-value" : "600", "description" : "Ab 18 Jahren" } + ] +}, +{ + "country" : "France", + "ratings" : [ + { "media" : "movie & TV", "prefix" : "fr-movie", "itunes-code" : "Tout public", "itunes-value" : "000", "description" : "Tout public" }, + { "media" : "movie & TV", "prefix" : "fr-movie", "itunes-code" : "-10", "itunes-value" : "100", "description" : "-10" }, + { "media" : "movie & TV", "prefix" : "fr-movie", "itunes-code" : "-12", "itunes-value" : "300", "description" : "-12" }, + { "media" : "movie & TV", "prefix" : "fr-movie", "itunes-code" : "-16", "itunes-value" : "375", "description" : "-16" }, + { "media" : "movie & TV", "prefix" : "fr-movie", "itunes-code" : "-18", "itunes-value" : "400", "description" : "-18" }, + { "media" : "movie & TV", "prefix" : "fr-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "Unrated" } + ] +}, +{ + "country" : "Italia", + "ratings" : [ + { "media" : "movie", "prefix" : "it-movie", "itunes-code" : "T", "itunes-value" : "100", "description" : "T" }, + { "media" : "movie", "prefix" : "it-movie", "itunes-code" : "VPA", "itunes-value" : "125", "description" : "VPA" }, + { "media" : "movie", "prefix" : "it-movie", "itunes-code" : "VM10", "itunes-value" : "150", "description" : "VM10" }, + { "media" : "movie", "prefix" : "it-movie", "itunes-code" : "VM12", "itunes-value" : "200", "description" : "VM12" }, + { "media" : "movie", "prefix" : "it-movie", "itunes-code" : "VM14", "itunes-value" : "325", "description" : "VM14" }, + { "media" : "movie", "prefix" : "it-movie", "itunes-code" : "VM18", "itunes-value" : "400", "description" : "VM18" } + ] +}, +{ + "country" : "日本", + "ratings" : [ + { "media" : "movie", "prefix" : "jp-movie", "itunes-code" : "G", "itunes-value" : "100", "description" : "G" }, + { "media" : "movie", "prefix" : "jp-movie", "itunes-code" : "PG12", "itunes-value" : "200", "description" : "PG12" }, + { "media" : "movie", "prefix" : "jp-movie", "itunes-code" : "R15+", "itunes-value" : "300", "description" : "R15+" }, + { "media" : "movie", "prefix" : "jp-movie", "itunes-code" : "R18+", "itunes-value" : "400", "description" : "R18+" }, + { "media" : "movie", "prefix" : "jp-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "未審査" } + ] +}, +{ + "country" : "Nederland", + "ratings" : [ + { "media" : "movie & TV", "prefix" : "nl-movie", "itunes-code" : "AL/G", "itunes-value" : "000", "description" : "AL/G" }, + { "media" : "movie & TV", "prefix" : "nl-movie", "itunes-code" : "6", "itunes-value" : "100", "description" : "6" }, + { "media" : "movie & TV", "prefix" : "nl-movie", "itunes-code" : "9", "itunes-value" : "200", "description" : "9" }, + { "media" : "movie & TV", "prefix" : "nl-movie", "itunes-code" : "12", "itunes-value" : "300", "description" : "12" }, + { "media" : "movie & TV", "prefix" : "nl-movie", "itunes-code" : "16", "itunes-value" : "500", "description" : "16" }, + { "media" : "movie & TV", "prefix" : "nl-movie", "itunes-code" : "18", "itunes-value" : "600", "description" : "18" } + ] +}, +{ + "country" : "New Zealand", + "ratings" : [ + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "G", "itunes-value" : "100", "description" : "G" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "PG", "itunes-value" : "200", "description" : "PG" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "M", "itunes-value" : "300", "description" : "M" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "R13", "itunes-value" : "325", "description" : "R13" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "RP13", "itunes-value" : "325", "description" : "RP13" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "R15", "itunes-value" : "350", "description" : "R15" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "R16", "itunes-value" : "375", "description" : "R16" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "RP16", "itunes-value" : "375", "description" : "RP16" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "R18", "itunes-value" : "400", "description" : "R18" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "R", "itunes-value" : "500", "description" : "R" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "U", "itunes-value" : "900", "description" : "U" }, + { "media" : "movie & TV", "prefix" : "nz-movie", "itunes-code" : "Not Rated","itunes-value" : "???", "description" : "Not Rated" } + ] +}, +{ + "country" : "Sverige", + "ratings" : [ + { "media" : "movie & TV", "prefix" : "se-movie", "itunes-code" : "A", "itunes-value" : "000", "description" : "Barntillåten" }, + { "media" : "movie & TV", "prefix" : "se-movie", "itunes-code" : "7", "itunes-value" : "125", "description" : "Från 7 år" }, + { "media" : "movie & TV", "prefix" : "se-movie", "itunes-code" : "11", "itunes-value" : "225", "description" : "Från 11 år" }, + { "media" : "movie & TV", "prefix" : "se-movie", "itunes-code" : "15", "itunes-value" : "400", "description" : "Från 15 år" }, + { "media" : "movie & TV", "prefix" : "se-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "Ocensurerad" }, + { "media" : "movie & TV", "prefix" : "se-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "Inte klassificerad" } + ] +}, +{ + "country" : "Schweiz", + "ratings" : [ + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "0", "itunes-value" : "050", "description" : "0" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "6", "itunes-value" : "075", "description" : "6" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "7", "itunes-value" : "125", "description" : "7" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "10", "itunes-value" : "150", "description" : "10" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "12", "itunes-value" : "200", "description" : "12" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "14", "itunes-value" : "325", "description" : "14" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "16", "itunes-value" : "375", "description" : "16" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "18", "itunes-value" : "400", "description" : "18" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "keine alterseinstufung" } + ] +}, +{ + "country" : "Suisse", + "ratings" : [ + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "0", "itunes-value" : "050", "description" : "0" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "6", "itunes-value" : "075", "description" : "6" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "7", "itunes-value" : "125", "description" : "7" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "10", "itunes-value" : "150", "description" : "10" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "12", "itunes-value" : "200", "description" : "12" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "14", "itunes-value" : "325", "description" : "14" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "16", "itunes-value" : "375", "description" : "16" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "18", "itunes-value" : "400", "description" : "18" }, + { "media" : "movie", "prefix" : "ch-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "keine alterseinstufung" } + ] +}, +{ + "country" : "UK", + "ratings" : [ + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "NR", "itunes-value" : "000", "description" : "Not Rated" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "U", "itunes-value" : "100", "description" : "U" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "Uc", "itunes-value" : "150", "description" : "Uc" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "PG", "itunes-value" : "200", "description" : "PG" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "12", "itunes-value" : "300", "description" : "12" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "12A", "itunes-value" : "325", "description" : "12A" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "15", "itunes-value" : "350", "description" : "15" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "18", "itunes-value" : "400", "description" : "18" }, + { "media" : "TV", "prefix" : "uk-tv", "itunes-code" : "Caution", "itunes-value" : "500", "description" : "Caution" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "R18", "itunes-value" : "600", "description" : "R18" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "E", "itunes-value" : "0", "description" : "Exempt" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "Unrated" }, + { "media" : "movie & TV", "prefix" : "uk-movie", "itunes-code" : "Unrated", "itunes-value" : "???", "description" : "TBC" } + ] +} +]