From dcfd02c04196280d3dbdd9e51edfba926feb41b5 Mon Sep 17 00:00:00 2001 From: Wendell Date: Wed, 10 Apr 2024 12:17:05 +0800 Subject: [PATCH 1/9] FIx build error --- Podfile | 10 +++++++++- Podfile.lock | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Podfile b/Podfile index 3cb9a7ae..dee8d590 100644 --- a/Podfile +++ b/Podfile @@ -1,4 +1,4 @@ -platform :ios, '8.0' +platform :ios, '12.0' target 'SVGAPlayer' do @@ -6,3 +6,11 @@ target 'SVGAPlayer' do pod 'Protobuf', '~> 3.4' end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "12.0" + end + end + end diff --git a/Podfile.lock b/Podfile.lock index be536f16..daf9be61 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -7,7 +7,7 @@ DEPENDENCIES: - SSZipArchive (~> 2.1.4) SPEC REPOS: - https://github.com/CocoaPods/Specs.git: + https://gitee.com/mirrors/CocoaPods-Specs.git: - Protobuf - SSZipArchive @@ -15,6 +15,6 @@ SPEC CHECKSUMS: Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5 SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322 -PODFILE CHECKSUM: 15ec3c806396baa34a298b2254638f0a6691580c +PODFILE CHECKSUM: 331625c0a4857dce7967cfecb2eea0319121bc80 -COCOAPODS: 1.9.1 +COCOAPODS: 1.15.2 From 317f45df5976045915e5c14fa26590f5c5c39c97 Mon Sep 17 00:00:00 2001 From: Wendell Date: Wed, 10 Apr 2024 12:39:21 +0800 Subject: [PATCH 2/9] Add framework target --- .gitignore | 3 +- Podfile | 5 +- Podfile.lock | 2 +- SVGA/SVGA.h | 27 ++ SVGAPlayer.xcodeproj/project.pbxproj | 354 ++++++++++++++++++++++++++- Source/SVGAImageView.h | 2 +- 6 files changed, 382 insertions(+), 11 deletions(-) create mode 100644 SVGA/SVGA.h diff --git a/.gitignore b/.gitignore index 19111e41..8b83c251 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ Pods UserInterface.xcuserstate xcuserdata/ -*.lock \ No newline at end of file +*.lock +.DS_Store diff --git a/Podfile b/Podfile index dee8d590..5b4ce6db 100644 --- a/Podfile +++ b/Podfile @@ -1,10 +1,13 @@ platform :ios, '12.0' target 'SVGAPlayer' do - pod 'SSZipArchive', '~> 2.1.4' pod 'Protobuf', '~> 3.4' +end +target 'SVGA' do + pod 'SSZipArchive', '~> 2.1.4' + pod 'Protobuf', '~> 3.4' end post_install do |installer| diff --git a/Podfile.lock b/Podfile.lock index daf9be61..4be2d0e3 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -15,6 +15,6 @@ SPEC CHECKSUMS: Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5 SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322 -PODFILE CHECKSUM: 331625c0a4857dce7967cfecb2eea0319121bc80 +PODFILE CHECKSUM: 92532bb5d6f458a6d3b6177cfc63394d466ba87c COCOAPODS: 1.15.2 diff --git a/SVGA/SVGA.h b/SVGA/SVGA.h new file mode 100644 index 00000000..a844dc7d --- /dev/null +++ b/SVGA/SVGA.h @@ -0,0 +1,27 @@ +// +// SVGA.h +// SVGA +// +// Created by Xinyu Wang on 2024/4/10. +// Copyright © 2024 UED Center. All rights reserved. +// + +#import + +//! Project version number for SVGA. +FOUNDATION_EXPORT double SVGAVersionNumber; + +//! Project version string for SVGA. +FOUNDATION_EXPORT const unsigned char SVGAVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import +#import +#import +#import +#import +#import + +@interface SVGA : NSObject + +@end + diff --git a/SVGAPlayer.xcodeproj/project.pbxproj b/SVGAPlayer.xcodeproj/project.pbxproj index 4f39f57f..2850b843 100644 --- a/SVGAPlayer.xcodeproj/project.pbxproj +++ b/SVGAPlayer.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 71A8679322B7853600176CD6 /* matteBitmap.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71A8679222B7853600176CD6 /* matteBitmap.svga */; }; 71DAA8A52355B3ED006608A1 /* Goddess.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71DAA8A42355B3ED006608A1 /* Goddess.svga */; }; 80D4C7254846B96B9C6EED83 /* libPods-SVGAPlayer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DDA5FF396660C7C932DF9B8 /* libPods-SVGAPlayer.a */; }; + 81C40174B3DD8DF684D7F1F8 /* libPods-SVGA.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D76025148DED864A0289B3A /* libPods-SVGA.a */; }; 904D41F81D223DD20085A21A /* SVGABezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 904D41F71D223DD20085A21A /* SVGABezierPath.m */; }; 9052FC631E6EB8D4007BC925 /* SVGAExporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9052FC621E6EB8D4007BC925 /* SVGAExporter.m */; }; 90A364D11E5AEC11009347F1 /* SVGABitmapLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A364D01E5AEC11009347F1 /* SVGABitmapLayer.m */; }; @@ -39,11 +40,44 @@ 90D7CA1C1F7FB114006E74F0 /* rose_1.5.0.svga in Resources */ = {isa = PBXBuildFile; fileRef = 90D7CA1A1F7FB114006E74F0 /* rose_1.5.0.svga */; }; 90D7CA1E1F7FB34E006E74F0 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */; }; 90DB59B51F96026E00894727 /* SVGAImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 90DB59B41F96026E00894727 /* SVGAImageView.m */; }; + B78833182BC64A9F000474C2 /* SVGA.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833172BC64A9F000474C2 /* SVGA.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B788331F2BC64B0C000474C2 /* Svga.pbobjc.h in Headers */ = {isa = PBXBuildFile; fileRef = B788331C2BC64B0C000474C2 /* Svga.pbobjc.h */; }; + B78833202BC64B0C000474C2 /* Svga.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = B788331D2BC64B0C000474C2 /* Svga.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + B788333C2BC64B1B000474C2 /* SVGA.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833212BC64B1B000474C2 /* SVGA.m */; }; + B788333D2BC64B1B000474C2 /* SVGAVectorLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833222BC64B1B000474C2 /* SVGAVectorLayer.m */; }; + B788333E2BC64B1B000474C2 /* SVGAVideoSpriteEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833232BC64B1B000474C2 /* SVGAVideoSpriteEntity.m */; }; + B788333F2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833242BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.h */; }; + B78833402BC64B1B000474C2 /* SVGAParser.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833252BC64B1B000474C2 /* SVGAParser.m */; }; + B78833412BC64B1B000474C2 /* SVGAImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833262BC64B1B000474C2 /* SVGAImageView.m */; }; + B78833422BC64B1B000474C2 /* SVGAExporter.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833272BC64B1B000474C2 /* SVGAExporter.m */; }; + B78833432BC64B1B000474C2 /* SVGAAudioLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833282BC64B1B000474C2 /* SVGAAudioLayer.h */; }; + B78833442BC64B1B000474C2 /* SVGAAudioLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833292BC64B1B000474C2 /* SVGAAudioLayer.m */; }; + B78833452BC64B1B000474C2 /* SVGAVideoEntity.h in Headers */ = {isa = PBXBuildFile; fileRef = B788332A2BC64B1B000474C2 /* SVGAVideoEntity.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B78833462BC64B1B000474C2 /* SVGABitmapLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B788332B2BC64B1B000474C2 /* SVGABitmapLayer.m */; }; + B78833472BC64B1B000474C2 /* SVGAVectorLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = B788332C2BC64B1B000474C2 /* SVGAVectorLayer.h */; }; + B78833482BC64B1B000474C2 /* SVGAContentLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = B788332D2BC64B1B000474C2 /* SVGAContentLayer.h */; }; + B78833492BC64B1B000474C2 /* SVGAPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B788332E2BC64B1B000474C2 /* SVGAPlayer.m */; }; + B788334A2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = B788332F2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.m */; }; + B788334B2BC64B1B000474C2 /* SVGAVideoSpriteEntity.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833302BC64B1B000474C2 /* SVGAVideoSpriteEntity.h */; }; + B788334C2BC64B1B000474C2 /* SVGAExporter.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833312BC64B1B000474C2 /* SVGAExporter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B788334D2BC64B1B000474C2 /* SVGAParser.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833322BC64B1B000474C2 /* SVGAParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B788334E2BC64B1B000474C2 /* SVGABezierPath.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833332BC64B1B000474C2 /* SVGABezierPath.h */; }; + B788334F2BC64B1B000474C2 /* SVGAAudioEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833342BC64B1B000474C2 /* SVGAAudioEntity.m */; }; + B78833502BC64B1B000474C2 /* SVGABitmapLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833352BC64B1B000474C2 /* SVGABitmapLayer.h */; }; + B78833512BC64B1B000474C2 /* SVGAAudioEntity.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833362BC64B1B000474C2 /* SVGAAudioEntity.h */; }; + B78833522BC64B1B000474C2 /* SVGABezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833372BC64B1B000474C2 /* SVGABezierPath.m */; }; + B78833532BC64B1B000474C2 /* SVGAPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833382BC64B1B000474C2 /* SVGAPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B78833542BC64B1B000474C2 /* SVGAVideoEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833392BC64B1B000474C2 /* SVGAVideoEntity.m */; }; + B78833552BC64B1B000474C2 /* SVGAImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = B788333A2BC64B1B000474C2 /* SVGAImageView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B78833562BC64B1B000474C2 /* SVGAContentLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B788333B2BC64B1B000474C2 /* SVGAContentLayer.m */; }; + B78833582BC64BE9000474C2 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B78833572BC64BE0000474C2 /* libz.tbd */; }; E83A58D9247E0E6A00D9F404 /* audio_biling.svga in Resources */ = {isa = PBXBuildFile; fileRef = E83A58D8247E0E6A00D9F404 /* audio_biling.svga */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 1DDA5FF396660C7C932DF9B8 /* libPods-SVGAPlayer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SVGAPlayer.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 4A920DC40C4E275D894059B4 /* Pods-SVGA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGA.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SVGA/Pods-SVGA.debug.xcconfig"; sourceTree = ""; }; + 4D76025148DED864A0289B3A /* libPods-SVGA.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SVGA.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 63712E6421787950001AE014 /* heartbeat.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = heartbeat.svga; sourceTree = ""; }; 63712E6621787A45001AE014 /* SVGAAudioEntity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAAudioEntity.h; sourceTree = ""; }; 63712E6721787A45001AE014 /* SVGAAudioEntity.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SVGAAudioEntity.m; sourceTree = ""; }; @@ -95,8 +129,41 @@ 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 90DB59B31F96026E00894727 /* SVGAImageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAImageView.h; sourceTree = ""; }; 90DB59B41F96026E00894727 /* SVGAImageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SVGAImageView.m; sourceTree = ""; }; + B78833152BC64A9F000474C2 /* SVGA.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SVGA.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B78833172BC64A9F000474C2 /* SVGA.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGA.h; sourceTree = ""; }; + B788331C2BC64B0C000474C2 /* Svga.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Svga.pbobjc.h; sourceTree = ""; }; + B788331D2BC64B0C000474C2 /* Svga.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Svga.pbobjc.m; sourceTree = ""; }; + B78833212BC64B1B000474C2 /* SVGA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGA.m; path = Source/SVGA.m; sourceTree = SOURCE_ROOT; }; + B78833222BC64B1B000474C2 /* SVGAVectorLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAVectorLayer.m; path = Source/SVGAVectorLayer.m; sourceTree = SOURCE_ROOT; }; + B78833232BC64B1B000474C2 /* SVGAVideoSpriteEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAVideoSpriteEntity.m; path = Source/SVGAVideoSpriteEntity.m; sourceTree = SOURCE_ROOT; }; + B78833242BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAVideoSpriteFrameEntity.h; path = Source/SVGAVideoSpriteFrameEntity.h; sourceTree = SOURCE_ROOT; }; + B78833252BC64B1B000474C2 /* SVGAParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAParser.m; path = Source/SVGAParser.m; sourceTree = SOURCE_ROOT; }; + B78833262BC64B1B000474C2 /* SVGAImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAImageView.m; path = Source/SVGAImageView.m; sourceTree = SOURCE_ROOT; }; + B78833272BC64B1B000474C2 /* SVGAExporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAExporter.m; path = Source/SVGAExporter.m; sourceTree = SOURCE_ROOT; }; + B78833282BC64B1B000474C2 /* SVGAAudioLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAAudioLayer.h; path = Source/SVGAAudioLayer.h; sourceTree = SOURCE_ROOT; }; + B78833292BC64B1B000474C2 /* SVGAAudioLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAAudioLayer.m; path = Source/SVGAAudioLayer.m; sourceTree = SOURCE_ROOT; }; + B788332A2BC64B1B000474C2 /* SVGAVideoEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAVideoEntity.h; path = Source/SVGAVideoEntity.h; sourceTree = SOURCE_ROOT; }; + B788332B2BC64B1B000474C2 /* SVGABitmapLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGABitmapLayer.m; path = Source/SVGABitmapLayer.m; sourceTree = SOURCE_ROOT; }; + B788332C2BC64B1B000474C2 /* SVGAVectorLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAVectorLayer.h; path = Source/SVGAVectorLayer.h; sourceTree = SOURCE_ROOT; }; + B788332D2BC64B1B000474C2 /* SVGAContentLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAContentLayer.h; path = Source/SVGAContentLayer.h; sourceTree = SOURCE_ROOT; }; + B788332E2BC64B1B000474C2 /* SVGAPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAPlayer.m; path = Source/SVGAPlayer.m; sourceTree = SOURCE_ROOT; }; + B788332F2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAVideoSpriteFrameEntity.m; path = Source/SVGAVideoSpriteFrameEntity.m; sourceTree = SOURCE_ROOT; }; + B78833302BC64B1B000474C2 /* SVGAVideoSpriteEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAVideoSpriteEntity.h; path = Source/SVGAVideoSpriteEntity.h; sourceTree = SOURCE_ROOT; }; + B78833312BC64B1B000474C2 /* SVGAExporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAExporter.h; path = Source/SVGAExporter.h; sourceTree = SOURCE_ROOT; }; + B78833322BC64B1B000474C2 /* SVGAParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAParser.h; path = Source/SVGAParser.h; sourceTree = SOURCE_ROOT; }; + B78833332BC64B1B000474C2 /* SVGABezierPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGABezierPath.h; path = Source/SVGABezierPath.h; sourceTree = SOURCE_ROOT; }; + B78833342BC64B1B000474C2 /* SVGAAudioEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAAudioEntity.m; path = Source/SVGAAudioEntity.m; sourceTree = SOURCE_ROOT; }; + B78833352BC64B1B000474C2 /* SVGABitmapLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGABitmapLayer.h; path = Source/SVGABitmapLayer.h; sourceTree = SOURCE_ROOT; }; + B78833362BC64B1B000474C2 /* SVGAAudioEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAAudioEntity.h; path = Source/SVGAAudioEntity.h; sourceTree = SOURCE_ROOT; }; + B78833372BC64B1B000474C2 /* SVGABezierPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGABezierPath.m; path = Source/SVGABezierPath.m; sourceTree = SOURCE_ROOT; }; + B78833382BC64B1B000474C2 /* SVGAPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAPlayer.h; path = Source/SVGAPlayer.h; sourceTree = SOURCE_ROOT; }; + B78833392BC64B1B000474C2 /* SVGAVideoEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAVideoEntity.m; path = Source/SVGAVideoEntity.m; sourceTree = SOURCE_ROOT; }; + B788333A2BC64B1B000474C2 /* SVGAImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAImageView.h; path = Source/SVGAImageView.h; sourceTree = SOURCE_ROOT; }; + B788333B2BC64B1B000474C2 /* SVGAContentLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAContentLayer.m; path = Source/SVGAContentLayer.m; sourceTree = SOURCE_ROOT; }; + B78833572BC64BE0000474C2 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayer.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayer/Pods-SVGAPlayer.release.xcconfig"; sourceTree = ""; }; E83A58D8247E0E6A00D9F404 /* audio_biling.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = audio_biling.svga; sourceTree = ""; }; + FAA02C4EB96718C5A12970B6 /* Pods-SVGA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGA.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGA/Pods-SVGA.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -109,6 +176,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B78833122BC64A9F000474C2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 81C40174B3DD8DF684D7F1F8 /* libPods-SVGA.a in Frameworks */, + B78833582BC64BE9000474C2 /* libz.tbd in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -117,6 +193,8 @@ children = ( 8AD65028FA2D122A34DC4A63 /* Pods-SVGAPlayer.debug.xcconfig */, E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */, + 4A920DC40C4E275D894059B4 /* Pods-SVGA.debug.xcconfig */, + FAA02C4EB96718C5A12970B6 /* Pods-SVGA.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -126,6 +204,7 @@ children = ( 90A676F71D13A70E008A69F3 /* Source */, 90A676DF1D13A6DF008A69F3 /* SVGAPlayer */, + B78833162BC64A9F000474C2 /* SVGA */, 90A676DE1D13A6DF008A69F3 /* Products */, 431B19F0F45A7844195F461A /* Pods */, B8EE95EA56FFE89CDEC9D8C3 /* Frameworks */, @@ -136,6 +215,7 @@ isa = PBXGroup; children = ( 90A676DD1D13A6DF008A69F3 /* SVGAPlayer.app */, + B78833152BC64A9F000474C2 /* SVGA.framework */, ); name = Products; sourceTree = ""; @@ -227,17 +307,90 @@ path = pbobjc; sourceTree = ""; }; + B78833162BC64A9F000474C2 /* SVGA */ = { + isa = PBXGroup; + children = ( + B788331E2BC64B0C000474C2 /* pbobjc */, + B78833172BC64A9F000474C2 /* SVGA.h */, + B78833212BC64B1B000474C2 /* SVGA.m */, + B78833362BC64B1B000474C2 /* SVGAAudioEntity.h */, + B78833342BC64B1B000474C2 /* SVGAAudioEntity.m */, + B78833282BC64B1B000474C2 /* SVGAAudioLayer.h */, + B78833292BC64B1B000474C2 /* SVGAAudioLayer.m */, + B78833332BC64B1B000474C2 /* SVGABezierPath.h */, + B78833372BC64B1B000474C2 /* SVGABezierPath.m */, + B78833352BC64B1B000474C2 /* SVGABitmapLayer.h */, + B788332B2BC64B1B000474C2 /* SVGABitmapLayer.m */, + B788332D2BC64B1B000474C2 /* SVGAContentLayer.h */, + B788333B2BC64B1B000474C2 /* SVGAContentLayer.m */, + B78833312BC64B1B000474C2 /* SVGAExporter.h */, + B78833272BC64B1B000474C2 /* SVGAExporter.m */, + B788333A2BC64B1B000474C2 /* SVGAImageView.h */, + B78833262BC64B1B000474C2 /* SVGAImageView.m */, + B78833322BC64B1B000474C2 /* SVGAParser.h */, + B78833252BC64B1B000474C2 /* SVGAParser.m */, + B78833382BC64B1B000474C2 /* SVGAPlayer.h */, + B788332E2BC64B1B000474C2 /* SVGAPlayer.m */, + B788332C2BC64B1B000474C2 /* SVGAVectorLayer.h */, + B78833222BC64B1B000474C2 /* SVGAVectorLayer.m */, + B788332A2BC64B1B000474C2 /* SVGAVideoEntity.h */, + B78833392BC64B1B000474C2 /* SVGAVideoEntity.m */, + B78833302BC64B1B000474C2 /* SVGAVideoSpriteEntity.h */, + B78833232BC64B1B000474C2 /* SVGAVideoSpriteEntity.m */, + B78833242BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.h */, + B788332F2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.m */, + ); + path = SVGA; + sourceTree = ""; + }; + B788331E2BC64B0C000474C2 /* pbobjc */ = { + isa = PBXGroup; + children = ( + B788331C2BC64B0C000474C2 /* Svga.pbobjc.h */, + B788331D2BC64B0C000474C2 /* Svga.pbobjc.m */, + ); + name = pbobjc; + path = Source/pbobjc; + sourceTree = SOURCE_ROOT; + }; B8EE95EA56FFE89CDEC9D8C3 /* Frameworks */ = { isa = PBXGroup; children = ( 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */, + B78833572BC64BE0000474C2 /* libz.tbd */, 1DDA5FF396660C7C932DF9B8 /* libPods-SVGAPlayer.a */, + 4D76025148DED864A0289B3A /* libPods-SVGA.a */, ); name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + B78833102BC64A9F000474C2 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + B78833472BC64B1B000474C2 /* SVGAVectorLayer.h in Headers */, + B788334D2BC64B1B000474C2 /* SVGAParser.h in Headers */, + B788334C2BC64B1B000474C2 /* SVGAExporter.h in Headers */, + B78833452BC64B1B000474C2 /* SVGAVideoEntity.h in Headers */, + B78833552BC64B1B000474C2 /* SVGAImageView.h in Headers */, + B78833532BC64B1B000474C2 /* SVGAPlayer.h in Headers */, + B788334B2BC64B1B000474C2 /* SVGAVideoSpriteEntity.h in Headers */, + B78833502BC64B1B000474C2 /* SVGABitmapLayer.h in Headers */, + B78833482BC64B1B000474C2 /* SVGAContentLayer.h in Headers */, + B788331F2BC64B0C000474C2 /* Svga.pbobjc.h in Headers */, + B788334E2BC64B1B000474C2 /* SVGABezierPath.h in Headers */, + B78833512BC64B1B000474C2 /* SVGAAudioEntity.h in Headers */, + B788333F2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.h in Headers */, + B78833432BC64B1B000474C2 /* SVGAAudioLayer.h in Headers */, + B78833182BC64A9F000474C2 /* SVGA.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ 90A676DC1D13A6DF008A69F3 /* SVGAPlayer */ = { isa = PBXNativeTarget; @@ -257,6 +410,25 @@ productReference = 90A676DD1D13A6DF008A69F3 /* SVGAPlayer.app */; productType = "com.apple.product-type.application"; }; + B78833142BC64A9F000474C2 /* SVGA */ = { + isa = PBXNativeTarget; + buildConfigurationList = B788331B2BC64A9F000474C2 /* Build configuration list for PBXNativeTarget "SVGA" */; + buildPhases = ( + D86E014333D44E49674E1F31 /* [CP] Check Pods Manifest.lock */, + B78833102BC64A9F000474C2 /* Headers */, + B78833112BC64A9F000474C2 /* Sources */, + B78833122BC64A9F000474C2 /* Frameworks */, + B78833132BC64A9F000474C2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SVGA; + productName = SVGA; + productReference = B78833152BC64A9F000474C2 /* SVGA.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -268,16 +440,20 @@ TargetAttributes = { 90A676DC1D13A6DF008A69F3 = { CreatedOnToolsVersion = 7.3; - DevelopmentTeam = S2RM275849; + DevelopmentTeam = Y47Y57GA96; + }; + B78833142BC64A9F000474C2 = { + CreatedOnToolsVersion = 15.3; + DevelopmentTeam = Y47Y57GA96; + ProvisioningStyle = Automatic; }; }; }; buildConfigurationList = 90A676D81D13A6DF008A69F3 /* Build configuration list for PBXProject "SVGAPlayer" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, Base, ); @@ -287,6 +463,7 @@ projectRoot = ""; targets = ( 90A676DC1D13A6DF008A69F3 /* SVGAPlayer */, + B78833142BC64A9F000474C2 /* SVGA */, ); }; /* End PBXProject section */ @@ -312,6 +489,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B78833132BC64A9F000474C2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -333,6 +517,28 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + D86E014333D44E49674E1F31 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-SVGA-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -361,6 +567,28 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B78833112BC64A9F000474C2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B78833562BC64B1B000474C2 /* SVGAContentLayer.m in Sources */, + B788333D2BC64B1B000474C2 /* SVGAVectorLayer.m in Sources */, + B78833522BC64B1B000474C2 /* SVGABezierPath.m in Sources */, + B78833422BC64B1B000474C2 /* SVGAExporter.m in Sources */, + B788334A2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.m in Sources */, + B78833462BC64B1B000474C2 /* SVGABitmapLayer.m in Sources */, + B788333C2BC64B1B000474C2 /* SVGA.m in Sources */, + B78833442BC64B1B000474C2 /* SVGAAudioLayer.m in Sources */, + B788333E2BC64B1B000474C2 /* SVGAVideoSpriteEntity.m in Sources */, + B78833202BC64B0C000474C2 /* Svga.pbobjc.m in Sources */, + B78833542BC64B1B000474C2 /* SVGAVideoEntity.m in Sources */, + B788334F2BC64B1B000474C2 /* SVGAAudioEntity.m in Sources */, + B78833402BC64B1B000474C2 /* SVGAParser.m in Sources */, + B78833412BC64B1B000474C2 /* SVGAImageView.m in Sources */, + B78833492BC64B1B000474C2 /* SVGAPlayer.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ @@ -471,9 +699,9 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; - DEVELOPMENT_TEAM = S2RM275849; + DEVELOPMENT_TEAM = Y47Y57GA96; INFOPLIST_FILE = SVGAPlayer/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.opensource.SVGAPlayer; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -488,9 +716,9 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; - DEVELOPMENT_TEAM = S2RM275849; + DEVELOPMENT_TEAM = Y47Y57GA96; INFOPLIST_FILE = SVGAPlayer/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.opensource.SVGAPlayer; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -499,6 +727,109 @@ }; name = Release; }; + B78833192BC64A9F000474C2 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4A920DC40C4E275D894059B4 /* Pods-SVGA.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = Y47Y57GA96; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2024 UED Center. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.tzeentch.SVGA; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + B788331A2BC64A9F000474C2 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FAA02C4EB96718C5A12970B6 /* Pods-SVGA.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = Y47Y57GA96; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2024 UED Center. All rights reserved."; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.tzeentch.SVGA; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -520,6 +851,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + B788331B2BC64A9F000474C2 /* Build configuration list for PBXNativeTarget "SVGA" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B78833192BC64A9F000474C2 /* Debug */, + B788331A2BC64A9F000474C2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 90A676D51D13A6DF008A69F3 /* Project object */; diff --git a/Source/SVGAImageView.h b/Source/SVGAImageView.h index adfd650f..951be3f1 100644 --- a/Source/SVGAImageView.h +++ b/Source/SVGAImageView.h @@ -6,7 +6,7 @@ // Copyright © 2017年 UED Center. All rights reserved. // -#import "SVGAPlayer.h" +#import @interface SVGAImageView : SVGAPlayer From 0767c290136b09b229759eaa92c119e0aa43f53c Mon Sep 17 00:00:00 2001 From: zouzelong Date: Sat, 4 Jan 2025 12:22:42 +0800 Subject: [PATCH 3/9] chore: add image resize support --- Package.swift | 70 ++++++++++++++++++++++ Podfile.lock | 2 +- SVGAPlayer.xcodeproj/project.pbxproj | 12 ++++ SVGAPlayer/ViewController.m | 1 + Source/SVGAParser.h | 1 + Source/SVGAParser.m | 2 + Source/SVGAVideoEntity.h | 1 + Source/SVGAVideoEntity.m | 39 +++++++++++- Source/UIImage+Resize.h | 18 ++++++ Source/UIImage+Resize.m | 88 ++++++++++++++++++++++++++++ 10 files changed, 230 insertions(+), 4 deletions(-) create mode 100644 Package.swift create mode 100644 Source/UIImage+Resize.h create mode 100644 Source/UIImage+Resize.m diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..2f885092 --- /dev/null +++ b/Package.swift @@ -0,0 +1,70 @@ +// +// Package.swift +// SVGAPlayer +// +// Created by smartzou on 2025/1/3. +// Copyright © 2025 UED Center. All rights reserved. +// + +// swift-tools-version:5.10 +import PackageDescription + +let package = Package( + name: "SVGAPlayer", + platforms: [ + .iOS(.v11) // CocoaPods 支持 iOS 7.0,但 SPM 最低支持 iOS 8.0,这里推荐设置为更高的版本。 + ], + products: [ + .library( + name: "SVGAPlayer", + targets: ["SVGAPlayerCore", "SVGAPlayerProtoFiles"] + ), + .library( + name: "SVGAPlayerCore", + targets: ["SVGAPlayerCore"] + ), + .library( + name: "SVGAPlayerProtoFiles", + targets: ["SVGAPlayerProtoFiles"] + ) + ], + dependencies: [ + .package(url: "https://github.com/ZipArchive/ZipArchive.git", from: "1.8.1"), + .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.0.0") + ], + targets: [ + .target( + name: "SVGAPlayerCore", + dependencies: [ + .product(name: "SSZipArchive", package: "ZipArchive"), + "SVGAPlayerProtoFiles" + ], + path: "Source", + exclude: ["pbobjc"], + sources: ["."], + publicHeadersPath: ".", // 如果有需要公开的头文件 + cSettings: [ + .headerSearchPath("."), + .define("GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS", to: "1") // 如果需要定义宏 + ], + linkerSettings: [ + .linkedLibrary("z"), + .linkedFramework("AVFoundation") + ] + ), + .target( + name: "SVGAPlayerProtoFiles", + dependencies: [ + .product(name: "SwiftProtobuf", package: "swift-protobuf") + ], + path: "Source/pbobjc", + sources: ["."], + publicHeadersPath: "." // 如果有需要公开的头文件 + ), + .testTarget( + name: "SVGAPlayerTests", + dependencies: ["SVGAPlayerCore"], + path: "Tests" + ) + ] +) diff --git a/Podfile.lock b/Podfile.lock index 4be2d0e3..dd890c98 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -17,4 +17,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 92532bb5d6f458a6d3b6177cfc63394d466ba87c -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/SVGAPlayer.xcodeproj/project.pbxproj b/SVGAPlayer.xcodeproj/project.pbxproj index 2850b843..df1e4ca6 100644 --- a/SVGAPlayer.xcodeproj/project.pbxproj +++ b/SVGAPlayer.xcodeproj/project.pbxproj @@ -72,6 +72,9 @@ B78833562BC64B1B000474C2 /* SVGAContentLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B788333B2BC64B1B000474C2 /* SVGAContentLayer.m */; }; B78833582BC64BE9000474C2 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B78833572BC64BE0000474C2 /* libz.tbd */; }; E83A58D9247E0E6A00D9F404 /* audio_biling.svga in Resources */ = {isa = PBXBuildFile; fileRef = E83A58D8247E0E6A00D9F404 /* audio_biling.svga */; }; + EFF7B0AF2D281CAD00404F60 /* UIImage+Resize.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */; }; + EFF7B0B02D281CAD00404F60 /* UIImage+Resize.h in Headers */ = {isa = PBXBuildFile; fileRef = EFF7B0AD2D281CAD00404F60 /* UIImage+Resize.h */; }; + EFF7B0B12D281CAD00404F60 /* UIImage+Resize.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -163,6 +166,9 @@ B78833572BC64BE0000474C2 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayer.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayer/Pods-SVGAPlayer.release.xcconfig"; sourceTree = ""; }; E83A58D8247E0E6A00D9F404 /* audio_biling.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = audio_biling.svga; sourceTree = ""; }; + EFF7B0AC2D27FC4D00404F60 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; + EFF7B0AD2D281CAD00404F60 /* UIImage+Resize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImage+Resize.h"; sourceTree = ""; }; + EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Resize.m"; sourceTree = ""; }; FAA02C4EB96718C5A12970B6 /* Pods-SVGA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGA.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGA/Pods-SVGA.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -202,6 +208,7 @@ 90A676D41D13A6DF008A69F3 = { isa = PBXGroup; children = ( + EFF7B0AC2D27FC4D00404F60 /* Package.swift */, 90A676F71D13A70E008A69F3 /* Source */, 90A676DF1D13A6DF008A69F3 /* SVGAPlayer */, B78833162BC64A9F000474C2 /* SVGA */, @@ -278,6 +285,8 @@ 9052FC621E6EB8D4007BC925 /* SVGAExporter.m */, 904D41F61D223DD20085A21A /* SVGABezierPath.h */, 904D41F71D223DD20085A21A /* SVGABezierPath.m */, + EFF7B0AD2D281CAD00404F60 /* UIImage+Resize.h */, + EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */, ); path = Source; sourceTree = ""; @@ -375,6 +384,7 @@ B788334D2BC64B1B000474C2 /* SVGAParser.h in Headers */, B788334C2BC64B1B000474C2 /* SVGAExporter.h in Headers */, B78833452BC64B1B000474C2 /* SVGAVideoEntity.h in Headers */, + EFF7B0B02D281CAD00404F60 /* UIImage+Resize.h in Headers */, B78833552BC64B1B000474C2 /* SVGAImageView.h in Headers */, B78833532BC64B1B000474C2 /* SVGAPlayer.h in Headers */, B788334B2BC64B1B000474C2 /* SVGAVideoSpriteEntity.h in Headers */, @@ -551,6 +561,7 @@ 90A677031D13AE19008A69F3 /* SVGAVideoEntity.m in Sources */, 90A364DA1E5AED04009347F1 /* SVGAVideoSpriteFrameEntity.m in Sources */, 63712E6821787A45001AE014 /* SVGAAudioEntity.m in Sources */, + EFF7B0AF2D281CAD00404F60 /* UIImage+Resize.m in Sources */, 63E817012178809D001D2D62 /* SVGAAudioLayer.m in Sources */, 90A364D11E5AEC11009347F1 /* SVGABitmapLayer.m in Sources */, 904D41F81D223DD20085A21A /* SVGABezierPath.m in Sources */, @@ -580,6 +591,7 @@ B788333C2BC64B1B000474C2 /* SVGA.m in Sources */, B78833442BC64B1B000474C2 /* SVGAAudioLayer.m in Sources */, B788333E2BC64B1B000474C2 /* SVGAVideoSpriteEntity.m in Sources */, + EFF7B0B12D281CAD00404F60 /* UIImage+Resize.m in Sources */, B78833202BC64B0C000474C2 /* Svga.pbobjc.m in Sources */, B78833542BC64B1B000474C2 /* SVGAVideoEntity.m in Sources */, B788334F2BC64B1B000474C2 /* SVGAAudioEntity.m in Sources */, diff --git a/SVGAPlayer/ViewController.m b/SVGAPlayer/ViewController.m index 97e52729..bb143c1e 100644 --- a/SVGAPlayer/ViewController.m +++ b/SVGAPlayer/ViewController.m @@ -27,6 +27,7 @@ - (void)viewDidLoad { self.aPlayer.loops = 1; self.aPlayer.clearsAfterStop = YES; parser = [[SVGAParser alloc] init]; + parser.targetSize = CGSizeMake(375, 375); [self onChange:nil]; } diff --git a/Source/SVGAParser.h b/Source/SVGAParser.h index 91ea6726..a7d39683 100644 --- a/Source/SVGAParser.h +++ b/Source/SVGAParser.h @@ -13,6 +13,7 @@ @interface SVGAParser : NSObject @property (nonatomic, assign) BOOL enabledMemoryCache; +@property (nonatomic, assign) CGSize targetSize; - (void)parseWithURL:(nonnull NSURL *)URL completionBlock:(void ( ^ _Nonnull )(SVGAVideoEntity * _Nullable videoItem))completionBlock diff --git a/Source/SVGAParser.m b/Source/SVGAParser.m index af7b07da..a612fda8 100644 --- a/Source/SVGAParser.m +++ b/Source/SVGAParser.m @@ -131,6 +131,7 @@ - (void)parseWithCacheKey:(nonnull NSString *)cacheKey SVGAProtoMovieEntity *protoObject = [SVGAProtoMovieEntity parseFromData:protoData error:&err]; if (!err && [protoObject isKindOfClass:[SVGAProtoMovieEntity class]]) { SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithProtoObject:protoObject cacheDir:cacheDir]; + videoItem.targetSize = self.targetSize; [videoItem resetImagesWithProtoObject:protoObject]; [videoItem resetSpritesWithProtoObject:protoObject]; [videoItem resetAudiosWithProtoObject:protoObject]; @@ -222,6 +223,7 @@ - (void)parseWithData:(nonnull NSData *)data SVGAProtoMovieEntity *protoObject = [SVGAProtoMovieEntity parseFromData:inflateData error:&err]; if (!err && [protoObject isKindOfClass:[SVGAProtoMovieEntity class]]) { SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithProtoObject:protoObject cacheDir:@""]; + videoItem.targetSize = self.targetSize; [videoItem resetImagesWithProtoObject:protoObject]; [videoItem resetSpritesWithProtoObject:protoObject]; [videoItem resetAudiosWithProtoObject:protoObject]; diff --git a/Source/SVGAVideoEntity.h b/Source/SVGAVideoEntity.h index 77498206..8fb38954 100644 --- a/Source/SVGAVideoEntity.h +++ b/Source/SVGAVideoEntity.h @@ -21,6 +21,7 @@ @property (nonatomic, readonly) NSDictionary *audiosData; @property (nonatomic, readonly) NSArray *sprites; @property (nonatomic, readonly) NSArray *audios; +@property (nonatomic, assign) CGSize targetSize; - (instancetype)initWithJSONObject:(NSDictionary *)JSONObject cacheDir:(NSString *)cacheDir; - (void)resetImagesWithJSONObject:(NSDictionary *)JSONObject; diff --git a/Source/SVGAVideoEntity.m b/Source/SVGAVideoEntity.m index cd63400a..b2219a35 100644 --- a/Source/SVGAVideoEntity.m +++ b/Source/SVGAVideoEntity.m @@ -12,6 +12,7 @@ #import "SVGAVideoSpriteEntity.h" #import "SVGAAudioEntity.h" #import "Svga.pbobjc.h" +#import "UIImage+Resize.h" #define MP3_MAGIC_NUMBER "ID3" @@ -30,6 +31,21 @@ @interface SVGAVideoEntity () @implementation SVGAVideoEntity +static inline UIImage *SVGAImageDecodeAndScaleDownUIKit(UIImage *image, CGSize destResolution) { + // See: https://developer.apple.com/documentation/uikit/uiimage/3750835-imagebypreparingthumbnailofsize + // Need CGImage-based + if (@available(iOS 15, tvOS 15, *)) { + // Calculate thumbnail point size + CGFloat scale = image.scale ?: 1; + CGSize thumbnailSize = CGSizeMake(destResolution.width / scale, destResolution.height / scale); + UIImage *decodedImage = [image imageByPreparingThumbnailOfSize:thumbnailSize]; + if (decodedImage) { + return decodedImage; + } + } + return nil; +} + static NSCache *videoCache; static NSMapTable * weakCache; static dispatch_semaphore_t videoSemaphore; @@ -135,6 +151,7 @@ - (instancetype)initWithProtoObject:(SVGAProtoMovieEntity *)protoObject cacheDir - (void)resetMovieWithProtoObject:(SVGAProtoMovieEntity *)protoObject { if (protoObject.hasParams) { self.videoSize = CGSizeMake((CGFloat)protoObject.params.viewBoxWidth, (CGFloat)protoObject.params.viewBoxHeight); + NSLog(@"videosize: %.1f, %.1f",_videoSize.width,_videoSize.height); self.FPS = (int)protoObject.params.fps; self.frames = (int)protoObject.params.frames; } @@ -152,6 +169,8 @@ - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { NSMutableDictionary *images = [[NSMutableDictionary alloc] init]; NSMutableDictionary *audiosData = [[NSMutableDictionary alloc] init]; NSDictionary *protoImages = [protoObject.images copy]; + NSInteger bytecount = 0; + NSInteger memoryCount = 0; for (NSString *key in protoImages) { NSString *fileName = [[NSString alloc] initWithData:protoImages[key] encoding:NSUTF8StringEncoding]; if (fileName != nil) { @@ -175,15 +194,29 @@ - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { // mp3 [audiosData setObject:protoImages[key] forKey:key]; } else { - UIImage *image = [[UIImage alloc] initWithData:protoImages[key] scale:2.0]; - if (image != nil) { - [images setObject:image forKey:key]; + NSData *data = protoImages[key]; + UIImage *image = [[UIImage alloc] initWithData:data scale:2.0]; + UIImage *scaledImage; + if ((self.targetSize.width > 0 && self.targetSize.height > 0) && (self.targetSize.width < image.size.width && self.targetSize.height < image.size.height)) { + scaledImage = SVGAImageDecodeAndScaleDownUIKit(image,self.targetSize); + if (!scaledImage) { + // fill + scaledImage = [image scaleToFillSize:self.targetSize mode:0 scale:image.scale?:1]; + } + }else { + scaledImage = image; + } + if (scaledImage != nil) { + [images setObject:scaledImage forKey:key]; } + memoryCount += [scaledImage costForImage]; + bytecount += data.length; } } } self.images = images; self.audiosData = audiosData; + NSLog(@"filesize: %.1f kb , memorycost: %.1f kb",bytecount/1024.0,memoryCount/1024.0); } - (void)resetSpritesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { diff --git a/Source/UIImage+Resize.h b/Source/UIImage+Resize.h new file mode 100644 index 00000000..43be438d --- /dev/null +++ b/Source/UIImage+Resize.h @@ -0,0 +1,18 @@ +// +// UIImage+Resize.h +// SVGAPlayer +// +// Created by smartzou on 2025/1/3. +// Copyright © 2025 UED Center. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface UIImage (Resize) +- (NSUInteger)costForImage; +- (UIImage *)scaleToFillSize:(CGSize)size mode:(NSInteger)mode scale:(CGFloat)scale; +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/UIImage+Resize.m b/Source/UIImage+Resize.m new file mode 100644 index 00000000..9f6adbed --- /dev/null +++ b/Source/UIImage+Resize.m @@ -0,0 +1,88 @@ +// +// UIImage+Resize.m +// SVGAPlayer +// +// Created by smartzou on 2025/1/3. +// Copyright © 2025 UED Center. All rights reserved. +// + +#import "UIImage+Resize.h" + +@implementation UIImage (Resize) + +- (NSUInteger)costForImage { + CGImageRef imageRef = self.CGImage; + if (!imageRef) { + return 0; + } + NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef); + NSUInteger frameCount = self.images.count > 0 ? self.images.count : 1; + return bytesPerFrame * frameCount; +} + +- (UIImage *)scaleToFillSize:(CGSize)size mode:(NSInteger)mode scale:(CGFloat)scale { + if (CGSizeEqualToSize(self.size, size)) { + return self; + } + + CGRect rect; + CGSize rendererSize; + + if (mode == 0) { // Assuming 0 is for .fill + BOOL isEqualRatio = (size.width / size.height) == (self.size.width / self.size.height); + if (isEqualRatio) { + rendererSize = size; + rect = CGRectMake(0, 0, size.width, size.height); + } else { + CGFloat scale = size.width / self.size.width; + CGFloat scaleHeight = scale * self.size.height; + CGFloat scaleWidth = size.width; + if (scaleHeight < size.height) { + scaleWidth = size.height / scaleHeight * size.width; + scaleHeight = size.height; + } + rendererSize = CGSizeMake(scaleWidth, scaleHeight); + rect = CGRectMake(0, 0, rendererSize.width, rendererSize.height); + } + } else { + rendererSize = size; + if (mode == 1) { // Assuming 1 is for .fit + rect = CGRectMake(0, 0, size.width, size.height); + } else { + CGFloat scale = size.width / self.size.width; + CGFloat scaleHeight = scale * self.size.height; + if (scaleHeight < size.height) { + scaleHeight = size.height; + } + rect = CGRectMake(0, -(scaleHeight - size.height) / 2, size.width, scaleHeight); + } + } + + UIGraphicsImageRendererFormat *format = [UIGraphicsImageRendererFormat defaultFormat]; + BOOL hasAlpha = [self CGImageContainsAlpha]; + format.opaque = !hasAlpha; + format.scale = scale == 0 ? self.scale : scale; + + UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:rendererSize format:format]; + UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull context) { + [self drawInRect:rect]; + }]; + + return image; +} + +- (BOOL)CGImageContainsAlpha { + if (!self.CGImage) { + return NO; + } + CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(self.CGImage); + BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone || + alphaInfo == kCGImageAlphaNoneSkipFirst || + alphaInfo == kCGImageAlphaNoneSkipLast); + return hasAlpha; +} + + + + +@end From 0b5802b3c5620a2437eeb33042d0830b0db202bf Mon Sep 17 00:00:00 2001 From: zouzelong Date: Mon, 6 Jan 2025 17:46:59 +0800 Subject: [PATCH 4/9] chore: add resize feature --- .gitignore | 1 + Package.swift | 70 ---------- Podfile | 4 +- Podfile.lock | 2 +- SVGA/SVGA.h | 4 +- SVGAPlayer.xcodeproj/project.pbxproj | 66 +++++---- .../xcschemes/SVGAPlayerDemo.xcscheme} | 45 +++--- .../xcdebugger/Breakpoints_v2.xcbkptlist | 5 - .../xcschemes/SVGAPlayer React.xcscheme | 91 ------------- .../xcschemes/xcschememanagement.plist | 32 ----- .../xcschemes/xcschememanagement.plist | 27 ---- .../xcschemes/xcschememanagement.plist | 29 ---- SVGAPlayer/ViewController.m | 5 + .../contents.xcworkspacedata | 10 ++ Source/DebugInfoView.h | 20 +++ Source/DebugInfoView.m | 58 ++++++++ Source/SVGA.h | 4 +- Source/SVGA.m | 22 +++ Source/SVGAParser.m | 3 + Source/SVGAPlayer.m | 28 ++++ Source/SVGAVideoEntity.h | 2 + Source/SVGAVideoEntity.m | 128 ++++++++++++------ build.sh | 29 ++++ 23 files changed, 329 insertions(+), 356 deletions(-) delete mode 100644 Package.swift rename SVGAPlayer.xcodeproj/{xcuserdata/cuiminghui.xcuserdatad/xcschemes/SVGAPlayer.xcscheme => xcshareddata/xcschemes/SVGAPlayerDemo.xcscheme} (65%) delete mode 100644 SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist delete mode 100644 SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/SVGAPlayer React.xcscheme delete mode 100644 SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/xcschememanagement.plist delete mode 100644 SVGAPlayer.xcodeproj/xcuserdata/errnull.xcuserdatad/xcschemes/xcschememanagement.plist delete mode 100644 SVGAPlayer.xcodeproj/xcuserdata/saiakirahui.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 SVGAPlayerDemo.xcworkspace/contents.xcworkspacedata create mode 100644 Source/DebugInfoView.h create mode 100644 Source/DebugInfoView.m create mode 100755 build.sh diff --git a/.gitignore b/.gitignore index 8b83c251..d8745765 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ UserInterface.xcuserstate xcuserdata/ *.lock .DS_Store +build diff --git a/Package.swift b/Package.swift deleted file mode 100644 index 2f885092..00000000 --- a/Package.swift +++ /dev/null @@ -1,70 +0,0 @@ -// -// Package.swift -// SVGAPlayer -// -// Created by smartzou on 2025/1/3. -// Copyright © 2025 UED Center. All rights reserved. -// - -// swift-tools-version:5.10 -import PackageDescription - -let package = Package( - name: "SVGAPlayer", - platforms: [ - .iOS(.v11) // CocoaPods 支持 iOS 7.0,但 SPM 最低支持 iOS 8.0,这里推荐设置为更高的版本。 - ], - products: [ - .library( - name: "SVGAPlayer", - targets: ["SVGAPlayerCore", "SVGAPlayerProtoFiles"] - ), - .library( - name: "SVGAPlayerCore", - targets: ["SVGAPlayerCore"] - ), - .library( - name: "SVGAPlayerProtoFiles", - targets: ["SVGAPlayerProtoFiles"] - ) - ], - dependencies: [ - .package(url: "https://github.com/ZipArchive/ZipArchive.git", from: "1.8.1"), - .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.0.0") - ], - targets: [ - .target( - name: "SVGAPlayerCore", - dependencies: [ - .product(name: "SSZipArchive", package: "ZipArchive"), - "SVGAPlayerProtoFiles" - ], - path: "Source", - exclude: ["pbobjc"], - sources: ["."], - publicHeadersPath: ".", // 如果有需要公开的头文件 - cSettings: [ - .headerSearchPath("."), - .define("GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS", to: "1") // 如果需要定义宏 - ], - linkerSettings: [ - .linkedLibrary("z"), - .linkedFramework("AVFoundation") - ] - ), - .target( - name: "SVGAPlayerProtoFiles", - dependencies: [ - .product(name: "SwiftProtobuf", package: "swift-protobuf") - ], - path: "Source/pbobjc", - sources: ["."], - publicHeadersPath: "." // 如果有需要公开的头文件 - ), - .testTarget( - name: "SVGAPlayerTests", - dependencies: ["SVGAPlayerCore"], - path: "Tests" - ) - ] -) diff --git a/Podfile b/Podfile index 5b4ce6db..7069d153 100644 --- a/Podfile +++ b/Podfile @@ -1,11 +1,11 @@ platform :ios, '12.0' -target 'SVGAPlayer' do +target 'SVGAPlayerDemo' do pod 'SSZipArchive', '~> 2.1.4' pod 'Protobuf', '~> 3.4' end -target 'SVGA' do +target 'SVGAPlayer' do pod 'SSZipArchive', '~> 2.1.4' pod 'Protobuf', '~> 3.4' end diff --git a/Podfile.lock b/Podfile.lock index dd890c98..973f4fee 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -15,6 +15,6 @@ SPEC CHECKSUMS: Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5 SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322 -PODFILE CHECKSUM: 92532bb5d6f458a6d3b6177cfc63394d466ba87c +PODFILE CHECKSUM: b5c5105cdd322486ab4cb3c2d05afe068009dc66 COCOAPODS: 1.16.2 diff --git a/SVGA/SVGA.h b/SVGA/SVGA.h index a844dc7d..81fe9f34 100644 --- a/SVGA/SVGA.h +++ b/SVGA/SVGA.h @@ -22,6 +22,8 @@ FOUNDATION_EXPORT const unsigned char SVGAVersionString[]; #import @interface SVGA : NSObject - ++ (SVGA *)shared; +- (void)setEnableDebug:(BOOL)enableDebug; +- (BOOL)enableDebug; @end diff --git a/SVGAPlayer.xcodeproj/project.pbxproj b/SVGAPlayer.xcodeproj/project.pbxproj index df1e4ca6..bdc6d746 100644 --- a/SVGAPlayer.xcodeproj/project.pbxproj +++ b/SVGAPlayer.xcodeproj/project.pbxproj @@ -15,8 +15,7 @@ 71A8679122B7785100176CD6 /* matteRect.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71A8679022B7785100176CD6 /* matteRect.svga */; }; 71A8679322B7853600176CD6 /* matteBitmap.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71A8679222B7853600176CD6 /* matteBitmap.svga */; }; 71DAA8A52355B3ED006608A1 /* Goddess.svga in Resources */ = {isa = PBXBuildFile; fileRef = 71DAA8A42355B3ED006608A1 /* Goddess.svga */; }; - 80D4C7254846B96B9C6EED83 /* libPods-SVGAPlayer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DDA5FF396660C7C932DF9B8 /* libPods-SVGAPlayer.a */; }; - 81C40174B3DD8DF684D7F1F8 /* libPods-SVGA.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D76025148DED864A0289B3A /* libPods-SVGA.a */; }; + 860B128ED6B8A53405306522 /* libPods-SVGAPlayerDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BB99F49A87B6B31DCEF63DE0 /* libPods-SVGAPlayerDemo.a */; }; 904D41F81D223DD20085A21A /* SVGABezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 904D41F71D223DD20085A21A /* SVGABezierPath.m */; }; 9052FC631E6EB8D4007BC925 /* SVGAExporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9052FC621E6EB8D4007BC925 /* SVGAExporter.m */; }; 90A364D11E5AEC11009347F1 /* SVGABitmapLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 90A364D01E5AEC11009347F1 /* SVGABitmapLayer.m */; }; @@ -75,12 +74,16 @@ EFF7B0AF2D281CAD00404F60 /* UIImage+Resize.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */; }; EFF7B0B02D281CAD00404F60 /* UIImage+Resize.h in Headers */ = {isa = PBXBuildFile; fileRef = EFF7B0AD2D281CAD00404F60 /* UIImage+Resize.h */; }; EFF7B0B12D281CAD00404F60 /* UIImage+Resize.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */; }; + EFF7B0C22D2917C200404F60 /* DebugInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF7B0C12D2917C200404F60 /* DebugInfoView.m */; }; + EFF7B0C32D2917C200404F60 /* DebugInfoView.h in Headers */ = {isa = PBXBuildFile; fileRef = EFF7B0C02D2917C200404F60 /* DebugInfoView.h */; }; + EFF7B0C42D2917C200404F60 /* DebugInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF7B0C12D2917C200404F60 /* DebugInfoView.m */; }; + FC37CEED92F70863E863D2B6 /* (null) in Frameworks */ = {isa = PBXBuildFile; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 1DDA5FF396660C7C932DF9B8 /* libPods-SVGAPlayer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SVGAPlayer.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 14714B6E44B276D74A209A31 /* Pods-SVGAPlayerDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayerDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayerDemo/Pods-SVGAPlayerDemo.debug.xcconfig"; sourceTree = ""; }; + 1B65E3B43FC8C3D598EC0B41 /* Pods-SVGAPlayerDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayerDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayerDemo/Pods-SVGAPlayerDemo.release.xcconfig"; sourceTree = ""; }; 4A920DC40C4E275D894059B4 /* Pods-SVGA.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGA.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SVGA/Pods-SVGA.debug.xcconfig"; sourceTree = ""; }; - 4D76025148DED864A0289B3A /* libPods-SVGA.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SVGA.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 63712E6421787950001AE014 /* heartbeat.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = heartbeat.svga; sourceTree = ""; }; 63712E6621787A45001AE014 /* SVGAAudioEntity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAAudioEntity.h; sourceTree = ""; }; 63712E6721787A45001AE014 /* SVGAAudioEntity.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SVGAAudioEntity.m; sourceTree = ""; }; @@ -164,11 +167,13 @@ B788333A2BC64B1B000474C2 /* SVGAImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVGAImageView.h; path = Source/SVGAImageView.h; sourceTree = SOURCE_ROOT; }; B788333B2BC64B1B000474C2 /* SVGAContentLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAContentLayer.m; path = Source/SVGAContentLayer.m; sourceTree = SOURCE_ROOT; }; B78833572BC64BE0000474C2 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; + BB99F49A87B6B31DCEF63DE0 /* libPods-SVGAPlayerDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SVGAPlayerDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayer.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayer/Pods-SVGAPlayer.release.xcconfig"; sourceTree = ""; }; E83A58D8247E0E6A00D9F404 /* audio_biling.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = audio_biling.svga; sourceTree = ""; }; - EFF7B0AC2D27FC4D00404F60 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; EFF7B0AD2D281CAD00404F60 /* UIImage+Resize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImage+Resize.h"; sourceTree = ""; }; EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Resize.m"; sourceTree = ""; }; + EFF7B0C02D2917C200404F60 /* DebugInfoView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DebugInfoView.h; sourceTree = ""; }; + EFF7B0C12D2917C200404F60 /* DebugInfoView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DebugInfoView.m; sourceTree = ""; }; FAA02C4EB96718C5A12970B6 /* Pods-SVGA.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGA.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGA/Pods-SVGA.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -178,7 +183,7 @@ buildActionMask = 2147483647; files = ( 90D7CA1E1F7FB34E006E74F0 /* libz.tbd in Frameworks */, - 80D4C7254846B96B9C6EED83 /* libPods-SVGAPlayer.a in Frameworks */, + 860B128ED6B8A53405306522 /* libPods-SVGAPlayerDemo.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -186,8 +191,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 81C40174B3DD8DF684D7F1F8 /* libPods-SVGA.a in Frameworks */, B78833582BC64BE9000474C2 /* libz.tbd in Frameworks */, + FC37CEED92F70863E863D2B6 /* (null) in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -201,6 +206,8 @@ E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */, 4A920DC40C4E275D894059B4 /* Pods-SVGA.debug.xcconfig */, FAA02C4EB96718C5A12970B6 /* Pods-SVGA.release.xcconfig */, + 14714B6E44B276D74A209A31 /* Pods-SVGAPlayerDemo.debug.xcconfig */, + 1B65E3B43FC8C3D598EC0B41 /* Pods-SVGAPlayerDemo.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -208,7 +215,6 @@ 90A676D41D13A6DF008A69F3 = { isa = PBXGroup; children = ( - EFF7B0AC2D27FC4D00404F60 /* Package.swift */, 90A676F71D13A70E008A69F3 /* Source */, 90A676DF1D13A6DF008A69F3 /* SVGAPlayer */, B78833162BC64A9F000474C2 /* SVGA */, @@ -287,6 +293,8 @@ 904D41F71D223DD20085A21A /* SVGABezierPath.m */, EFF7B0AD2D281CAD00404F60 /* UIImage+Resize.h */, EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */, + EFF7B0C02D2917C200404F60 /* DebugInfoView.h */, + EFF7B0C12D2917C200404F60 /* DebugInfoView.m */, ); path = Source; sourceTree = ""; @@ -367,8 +375,7 @@ children = ( 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */, B78833572BC64BE0000474C2 /* libz.tbd */, - 1DDA5FF396660C7C932DF9B8 /* libPods-SVGAPlayer.a */, - 4D76025148DED864A0289B3A /* libPods-SVGA.a */, + BB99F49A87B6B31DCEF63DE0 /* libPods-SVGAPlayerDemo.a */, ); name = Frameworks; sourceTree = ""; @@ -394,6 +401,7 @@ B788334E2BC64B1B000474C2 /* SVGABezierPath.h in Headers */, B78833512BC64B1B000474C2 /* SVGAAudioEntity.h in Headers */, B788333F2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.h in Headers */, + EFF7B0C32D2917C200404F60 /* DebugInfoView.h in Headers */, B78833432BC64B1B000474C2 /* SVGAAudioLayer.h in Headers */, B78833182BC64A9F000474C2 /* SVGA.h in Headers */, ); @@ -450,11 +458,11 @@ TargetAttributes = { 90A676DC1D13A6DF008A69F3 = { CreatedOnToolsVersion = 7.3; - DevelopmentTeam = Y47Y57GA96; + DevelopmentTeam = XM2VRDX92Q; }; B78833142BC64A9F000474C2 = { CreatedOnToolsVersion = 15.3; - DevelopmentTeam = Y47Y57GA96; + DevelopmentTeam = XM2VRDX92Q; ProvisioningStyle = Automatic; }; }; @@ -520,7 +528,7 @@ ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-SVGAPlayer-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-SVGAPlayerDemo-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -542,7 +550,7 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-SVGA-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-SVGAPlayer-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -564,6 +572,7 @@ EFF7B0AF2D281CAD00404F60 /* UIImage+Resize.m in Sources */, 63E817012178809D001D2D62 /* SVGAAudioLayer.m in Sources */, 90A364D11E5AEC11009347F1 /* SVGABitmapLayer.m in Sources */, + EFF7B0C22D2917C200404F60 /* DebugInfoView.m in Sources */, 904D41F81D223DD20085A21A /* SVGABezierPath.m in Sources */, 90A364D71E5AECBD009347F1 /* SVGAVideoSpriteEntity.m in Sources */, 90A676E51D13A6DF008A69F3 /* AppDelegate.m in Sources */, @@ -595,6 +604,7 @@ B78833202BC64B0C000474C2 /* Svga.pbobjc.m in Sources */, B78833542BC64B1B000474C2 /* SVGAVideoEntity.m in Sources */, B788334F2BC64B1B000474C2 /* SVGAAudioEntity.m in Sources */, + EFF7B0C42D2917C200404F60 /* DebugInfoView.m in Sources */, B78833402BC64B1B000474C2 /* SVGAParser.m in Sources */, B78833412BC64B1B000474C2 /* SVGAImageView.m in Sources */, B78833492BC64B1B000474C2 /* SVGAPlayer.m in Sources */, @@ -707,15 +717,16 @@ }; 90A676F51D13A6DF008A69F3 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8AD65028FA2D122A34DC4A63 /* Pods-SVGAPlayer.debug.xcconfig */; + baseConfigurationReference = 14714B6E44B276D74A209A31 /* Pods-SVGAPlayerDemo.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; - DEVELOPMENT_TEAM = Y47Y57GA96; + DEVELOPMENT_TEAM = XM2VRDX92Q; INFOPLIST_FILE = SVGAPlayer/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = SvgaDemo; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.opensource.SVGAPlayer; + PRODUCT_BUNDLE_IDENTIFIER = io.tzeentch.SVGA; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; TARGETED_DEVICE_FAMILY = "1,2"; @@ -724,15 +735,16 @@ }; 90A676F61D13A6DF008A69F3 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */; + baseConfigurationReference = 1B65E3B43FC8C3D598EC0B41 /* Pods-SVGAPlayerDemo.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; - DEVELOPMENT_TEAM = Y47Y57GA96; + DEVELOPMENT_TEAM = XM2VRDX92Q; INFOPLIST_FILE = SVGAPlayer/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = SvgaDemo; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.opensource.SVGAPlayer; + PRODUCT_BUNDLE_IDENTIFIER = io.tzeentch.SVGA; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; TARGETED_DEVICE_FAMILY = "1,2"; @@ -741,9 +753,10 @@ }; B78833192BC64A9F000474C2 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4A920DC40C4E275D894059B4 /* Pods-SVGA.debug.xcconfig */; + baseConfigurationReference = 8AD65028FA2D122A34DC4A63 /* Pods-SVGAPlayer.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; CLANG_ENABLE_OBJC_WEAK = YES; @@ -763,7 +776,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = Y47Y57GA96; + DEVELOPMENT_TEAM = XM2VRDX92Q; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -776,12 +789,14 @@ IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACH_O_TYPE = staticlib; MARKETING_VERSION = 1.0; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.tzeentch.SVGA; + PRODUCT_MODULE_NAME = SVGAPlayer; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; @@ -793,9 +808,10 @@ }; B788331A2BC64A9F000474C2 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FAA02C4EB96718C5A12970B6 /* Pods-SVGA.release.xcconfig */; + baseConfigurationReference = E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; CLANG_ENABLE_OBJC_WEAK = YES; @@ -815,7 +831,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = Y47Y57GA96; + DEVELOPMENT_TEAM = XM2VRDX92Q; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -828,11 +844,13 @@ IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACH_O_TYPE = staticlib; MARKETING_VERSION = 1.0; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.tzeentch.SVGA; + PRODUCT_MODULE_NAME = SVGAPlayer; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/SVGAPlayer.xcscheme b/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayerDemo.xcscheme similarity index 65% rename from SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/SVGAPlayer.xcscheme rename to SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayerDemo.xcscheme index e6d195c8..492a332c 100644 --- a/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/SVGAPlayer.xcscheme +++ b/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayerDemo.xcscheme @@ -1,10 +1,11 @@ + LastUpgradeVersion = "1620" + version = "1.7"> + buildImplicitDependencies = "YES" + buildArchitectures = "Automatic"> + BuildableName = "SVGAPlayerDemo.app" + BlueprintName = "SVGAPlayerDemo" + ReferencedContainer = "container:SVGAPlayerDemo.xcodeproj"> @@ -26,20 +27,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + shouldAutocreateTestPlan = "YES"> + BuildableName = "SVGAPlayerDemo.app" + BlueprintName = "SVGAPlayerDemo" + ReferencedContainer = "container:SVGAPlayerDemo.xcodeproj"> - - + BuildableName = "SVGAPlayerDemo.app" + BlueprintName = "SVGAPlayerDemo" + ReferencedContainer = "container:SVGAPlayerDemo.xcodeproj"> diff --git a/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b4541..00000000 --- a/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/SVGAPlayer React.xcscheme b/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/SVGAPlayer React.xcscheme deleted file mode 100644 index 04020c75..00000000 --- a/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/SVGAPlayer React.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/xcschememanagement.plist b/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 5ad4d1f1..00000000 --- a/SVGAPlayer.xcodeproj/xcuserdata/cuiminghui.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - SchemeUserState - - SVGAPlayer React.xcscheme - - orderHint - 1 - - SVGAPlayer.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 90A676DC1D13A6DF008A69F3 - - primary - - - 90CB64C91EF290F400DAA382 - - primary - - - - - diff --git a/SVGAPlayer.xcodeproj/xcuserdata/errnull.xcuserdatad/xcschemes/xcschememanagement.plist b/SVGAPlayer.xcodeproj/xcuserdata/errnull.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index d0671ccd..00000000 --- a/SVGAPlayer.xcodeproj/xcuserdata/errnull.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - SchemeUserState - - SVGAPlayer React.xcscheme_^#shared#^_ - - orderHint - 7 - - SVGAPlayer.xcscheme_^#shared#^_ - - orderHint - 5 - - - SuppressBuildableAutocreation - - 90A676DC1D13A6DF008A69F3 - - primary - - - - - diff --git a/SVGAPlayer.xcodeproj/xcuserdata/saiakirahui.xcuserdatad/xcschemes/xcschememanagement.plist b/SVGAPlayer.xcodeproj/xcuserdata/saiakirahui.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index ef983a68..00000000 --- a/SVGAPlayer.xcodeproj/xcuserdata/saiakirahui.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,29 +0,0 @@ - - - - - SchemeUserState - - SVGAPlayer React.xcscheme - - orderHint - 7 - - SVGAPlayer React.xcscheme_^#shared#^_ - - orderHint - 4 - - SVGAPlayer.xcscheme - - orderHint - 6 - - SVGAPlayer.xcscheme_^#shared#^_ - - orderHint - 3 - - - - diff --git a/SVGAPlayer/ViewController.m b/SVGAPlayer/ViewController.m index bb143c1e..76762974 100644 --- a/SVGAPlayer/ViewController.m +++ b/SVGAPlayer/ViewController.m @@ -20,9 +20,14 @@ @interface ViewController () @implementation ViewController static SVGAParser *parser; ++ (void)initialize { + [[SVGA shared] setEnableDebug: YES]; +} - (void)viewDidLoad { [super viewDidLoad]; + + self.aPlayer.delegate = self; self.aPlayer.loops = 1; self.aPlayer.clearsAfterStop = YES; diff --git a/SVGAPlayerDemo.xcworkspace/contents.xcworkspacedata b/SVGAPlayerDemo.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..03633c10 --- /dev/null +++ b/SVGAPlayerDemo.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Source/DebugInfoView.h b/Source/DebugInfoView.h new file mode 100644 index 00000000..1e0e3f12 --- /dev/null +++ b/Source/DebugInfoView.h @@ -0,0 +1,20 @@ +// +// DebugInfoView.h +// SVGAPlayer +// +// Created by smartzou on 2025/1/4. +// Copyright © 2025 UED Center. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DebugInfoView : UIView +@property (nonatomic, strong) UITextView *textView; + +- (instancetype)initWithFrame:(CGRect)frame; +- (void)updateWithText:(NSString *)text; +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/DebugInfoView.m b/Source/DebugInfoView.m new file mode 100644 index 00000000..44b2c822 --- /dev/null +++ b/Source/DebugInfoView.m @@ -0,0 +1,58 @@ +// +// DebugInfoView.m +// SVGAPlayer +// +// Created by smartzou on 2025/1/4. +// Copyright © 2025 UED Center. All rights reserved. +// + +#import "DebugInfoView.h" +#import + +@implementation DebugInfoView + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + // 设置视图背景颜色 + self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6]; + + // 初始化 UITextView + _textView = [[UITextView alloc] init]; + _textView.textColor = [UIColor whiteColor]; + _textView.backgroundColor = [UIColor clearColor]; // 背景透明 + _textView.editable = NO; // 禁止编辑 + _textView.scrollEnabled = NO; // 自动调整大小时禁用滚动 + _textView.textAlignment = NSTextAlignmentLeft; + _textView.translatesAutoresizingMaskIntoConstraints = NO; + + // 添加 UITextView 到视图中 + [self addSubview:_textView]; + + // 设置 UITextView 的约束 + [self setupConstraints]; + } + return self; +} + +- (void)setupConstraints { + // 将 UITextView 在父视图中居中 + [NSLayoutConstraint activateConstraints:@[ + [_textView.centerXAnchor constraintEqualToAnchor:self.centerXAnchor], + [_textView.centerYAnchor constraintEqualToAnchor:self.centerYAnchor], + [_textView.leadingAnchor constraintGreaterThanOrEqualToAnchor:self.leadingAnchor constant:10], + [_textView.trailingAnchor constraintLessThanOrEqualToAnchor:self.trailingAnchor constant:-10] + ]]; +} + +- (void)updateWithText:(NSString *)text { + // 更新 UITextView 的文本内容 + self.textView.text = text; + + // 调整 UITextView 的大小以适应文本 + CGSize textSize = [self.textView sizeThatFits:CGSizeMake(self.bounds.size.width - 20, CGFLOAT_MAX)]; + self.textView.bounds = CGRectMake(0, 0, textSize.width, textSize.height); +} + +@end + diff --git a/Source/SVGA.h b/Source/SVGA.h index 118ff4fd..3f90b44d 100644 --- a/Source/SVGA.h +++ b/Source/SVGA.h @@ -14,5 +14,7 @@ #import "SVGAExporter.h" @interface SVGA : NSObject - ++ (SVGA *)shared; +- (void)setEnableDebug:(BOOL)enableDebug; +- (BOOL)enableDebug; @end diff --git a/Source/SVGA.m b/Source/SVGA.m index d9e4ef35..ca4e94b4 100644 --- a/Source/SVGA.m +++ b/Source/SVGA.m @@ -8,6 +8,28 @@ #import "SVGA.h" +@interface SVGA () +@property (nonatomic,assign) BOOL deubg; +@end + + @implementation SVGA ++ (SVGA *)shared { + static SVGA *sharedInstance = nil; + static dispatch_once_t onceToken; // onceToken = 0 + dispatch_once(&onceToken, ^{ + sharedInstance = [[SVGA alloc] init]; + }); + + return sharedInstance; +} + +- (void)setEnableDebug:(BOOL)enableDebug { + _deubg = enableDebug; +} + +- (BOOL)enableDebug { + return _deubg; +} @end diff --git a/Source/SVGAParser.m b/Source/SVGAParser.m index a612fda8..c321d0d2 100644 --- a/Source/SVGAParser.m +++ b/Source/SVGAParser.m @@ -161,6 +161,7 @@ - (void)parseWithCacheKey:(nonnull NSString *)cacheKey NSDictionary *JSONObject = [NSJSONSerialization JSONObjectWithData:JSONData options:kNilOptions error:&err]; if ([JSONObject isKindOfClass:[NSDictionary class]]) { SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithJSONObject:JSONObject cacheDir:cacheDir]; + videoItem.targetSize = self.targetSize; [videoItem resetImagesWithJSONObject:JSONObject]; [videoItem resetSpritesWithJSONObject:JSONObject]; if (self.enabledMemoryCache) { @@ -282,6 +283,7 @@ - (void)parseWithData:(nonnull NSData *)data SVGAProtoMovieEntity *protoObject = [SVGAProtoMovieEntity parseFromData:protoData error:&err]; if (!err) { SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithProtoObject:protoObject cacheDir:cacheDir]; + videoItem.targetSize = self.targetSize; [videoItem resetImagesWithProtoObject:protoObject]; [videoItem resetSpritesWithProtoObject:protoObject]; if (self.enabledMemoryCache) { @@ -310,6 +312,7 @@ - (void)parseWithData:(nonnull NSData *)data NSDictionary *JSONObject = [NSJSONSerialization JSONObjectWithData:JSONData options:kNilOptions error:&err]; if ([JSONObject isKindOfClass:[NSDictionary class]]) { SVGAVideoEntity *videoItem = [[SVGAVideoEntity alloc] initWithJSONObject:JSONObject cacheDir:cacheDir]; + videoItem.targetSize = self.targetSize; [videoItem resetImagesWithJSONObject:JSONObject]; [videoItem resetSpritesWithJSONObject:JSONObject]; if (self.enabledMemoryCache) { diff --git a/Source/SVGAPlayer.m b/Source/SVGAPlayer.m index 289e09f0..10e8b234 100644 --- a/Source/SVGAPlayer.m +++ b/Source/SVGAPlayer.m @@ -15,6 +15,9 @@ #import "SVGAVectorLayer.h" #import "SVGAAudioLayer.h" #import "SVGAAudioEntity.h" +#import "SVGA.h" +#import "DebugInfoView.h" + @interface SVGAPlayer () @@ -31,6 +34,7 @@ @interface SVGAPlayer () @property (nonatomic, assign) NSRange currentRange; @property (nonatomic, assign) BOOL forwardAnimating; @property (nonatomic, assign) BOOL reversing; +@property (nonatomic, strong) DebugInfoView *infoView; @end @@ -60,6 +64,10 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { - (void)initPlayer { self.contentMode = UIViewContentModeTop; self.clearsAfterStop = YES; + if ([self enableDebug]) { + _infoView = [[DebugInfoView alloc] initWithFrame:CGRectMake(0, 0, 100, 80)]; + [self addSubview:_infoView]; + } } - (void)willMoveToSuperview:(UIView *)newSuperview { @@ -416,6 +424,8 @@ - (void)setVideoItem:(SVGAVideoEntity *)videoItem { [[NSOperationQueue mainQueue] addOperationWithBlock:^{ [self clear]; [self draw]; + [self updateInfoView]; + }]; } @@ -555,4 +565,22 @@ - (NSRunLoopMode)mainRunLoopMode { return _mainRunLoopMode; } + +- (void)updateInfoView { + if (_videoItem != nil) { + //NSLog(@"filesize: %.1f kb , memorycost: %.1f kb",self.bytecount/1024.0,self.memoryCount/1024.0); + NSString *videoSizeInfo = [NSString stringWithFormat:@"(%.0f,%.0f)",_videoItem.videoSize.width,_videoItem.videoSize.height]; + NSString *targetSizeInfo = [NSString stringWithFormat:@"(%.0f,%.0f)",_videoItem.targetSize.width,_videoItem.targetSize.height]; + NSString *fileSize = [NSString stringWithFormat:@"%.1f kb",_videoItem.bytecount/1024.0]; + NSString *mcost = [NSString stringWithFormat:@"%.1f kb",_videoItem.memoryCount/1024.0]; + NSString *text = [NSString stringWithFormat:@"%@,%@ \n %@ \n %@",videoSizeInfo,targetSizeInfo,fileSize,mcost]; + [_infoView updateWithText:text]; + [self bringSubviewToFront:_infoView]; + } + +} + +- (BOOL)enableDebug { + return [[SVGA shared] enableDebug]; +} @end diff --git a/Source/SVGAVideoEntity.h b/Source/SVGAVideoEntity.h index 8fb38954..7ab42b31 100644 --- a/Source/SVGAVideoEntity.h +++ b/Source/SVGAVideoEntity.h @@ -22,6 +22,8 @@ @property (nonatomic, readonly) NSArray *sprites; @property (nonatomic, readonly) NSArray *audios; @property (nonatomic, assign) CGSize targetSize; +@property (nonatomic,readonly) NSInteger bytecount; +@property (nonatomic,readonly) NSInteger memoryCount; - (instancetype)initWithJSONObject:(NSDictionary *)JSONObject cacheDir:(NSString *)cacheDir; - (void)resetImagesWithJSONObject:(NSDictionary *)JSONObject; diff --git a/Source/SVGAVideoEntity.m b/Source/SVGAVideoEntity.m index b2219a35..e01b2f70 100644 --- a/Source/SVGAVideoEntity.m +++ b/Source/SVGAVideoEntity.m @@ -13,7 +13,7 @@ #import "SVGAAudioEntity.h" #import "Svga.pbobjc.h" #import "UIImage+Resize.h" - +#import "SVGA.h" #define MP3_MAGIC_NUMBER "ID3" @interface SVGAVideoEntity () @@ -26,7 +26,8 @@ @interface SVGAVideoEntity () @property (nonatomic, copy) NSArray *sprites; @property (nonatomic, copy) NSArray *audios; @property (nonatomic, copy) NSString *cacheDir; - +@property (nonatomic,assign) NSInteger bytecount; +@property (nonatomic,assign) NSInteger memoryCount; @end @implementation SVGAVideoEntity @@ -109,9 +110,15 @@ - (void)resetImagesWithJSONObject:(NSDictionary *)JSONObject { NSData *imageData = [NSData dataWithContentsOfFile:filePath options:NSDataReadingMappedIfSafe error:NULL]; if (imageData != nil) { UIImage *image = [[UIImage alloc] initWithData:imageData scale:2.0]; - if (image != nil) { - [images setObject:image forKey:[key stringByDeletingPathExtension]]; + UIImage *scaledImage = [self resizeImageIfNeed:image]; + if (scaledImage != nil) { + [images setObject:scaledImage forKey:[key stringByDeletingPathExtension]]; + } + if (self.enableDebug) { + self.memoryCount += [scaledImage costForImage]; + self.bytecount += imageData.length; } + } } }]; @@ -165,60 +172,73 @@ + (BOOL)isMP3Data:(NSData *)data { return result; } + + - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { NSMutableDictionary *images = [[NSMutableDictionary alloc] init]; NSMutableDictionary *audiosData = [[NSMutableDictionary alloc] init]; NSDictionary *protoImages = [protoObject.images copy]; - NSInteger bytecount = 0; - NSInteger memoryCount = 0; + self.bytecount = 0; + self.memoryCount = 0; + dispatch_queue_t currentQueue = dispatch_get_current_queue(); + dispatch_group_t group = dispatch_group_create(); + dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); for (NSString *key in protoImages) { - NSString *fileName = [[NSString alloc] initWithData:protoImages[key] encoding:NSUTF8StringEncoding]; - if (fileName != nil) { - NSString *filePath = [self.cacheDir stringByAppendingFormat:@"/%@.png", fileName]; - if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { - filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName]; - } - if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { -// NSData *imageData = [NSData dataWithContentsOfFile:filePath]; - NSData *imageData = [NSData dataWithContentsOfFile:filePath options:NSDataReadingMappedIfSafe error:NULL]; - if (imageData != nil) { - UIImage *image = [[UIImage alloc] initWithData:imageData scale:2.0]; - if (image != nil) { - [images setObject:image forKey:key]; + dispatch_group_async(group, queue, ^{ + NSString *fileName = [[NSString alloc] initWithData:protoImages[key] encoding:NSUTF8StringEncoding]; + if (fileName != nil) { + NSString *filePath = [self.cacheDir stringByAppendingFormat:@"/%@.png", fileName]; + if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { + filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName]; + } + if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { + // NSData *imageData = [NSData dataWithContentsOfFile:filePath]; + NSData *imageData = [NSData dataWithContentsOfFile:filePath options:NSDataReadingMappedIfSafe error:NULL]; + if (imageData != nil) { + UIImage *image = [[UIImage alloc] initWithData:imageData scale:2.0]; + if (image != nil) { + @synchronized (images) { + [images setObject:image forKey:key]; + } + + } } } } - } - else if ([protoImages[key] isKindOfClass:[NSData class]]) { - if ([SVGAVideoEntity isMP3Data:protoImages[key]]) { - // mp3 - [audiosData setObject:protoImages[key] forKey:key]; - } else { - NSData *data = protoImages[key]; - UIImage *image = [[UIImage alloc] initWithData:data scale:2.0]; - UIImage *scaledImage; - if ((self.targetSize.width > 0 && self.targetSize.height > 0) && (self.targetSize.width < image.size.width && self.targetSize.height < image.size.height)) { - scaledImage = SVGAImageDecodeAndScaleDownUIKit(image,self.targetSize); - if (!scaledImage) { - // fill - scaledImage = [image scaleToFillSize:self.targetSize mode:0 scale:image.scale?:1]; + else if ([protoImages[key] isKindOfClass:[NSData class]]) { + if ([SVGAVideoEntity isMP3Data:protoImages[key]]) { + // mp3 + [audiosData setObject:protoImages[key] forKey:key]; + } else { + NSData *data = protoImages[key]; + UIImage *image = [[UIImage alloc] initWithData:data scale:2.0]; + UIImage *scaledImage = [self resizeImageIfNeed:image]; + if (scaledImage != nil) { + @synchronized (images) { + [images setObject:scaledImage forKey:key]; + } + + } + if (self.enableDebug) { + self.memoryCount += [scaledImage costForImage]; + self.bytecount += data.length; } - }else { - scaledImage = image; - } - if (scaledImage != nil) { - [images setObject:scaledImage forKey:key]; } - memoryCount += [scaledImage costForImage]; - bytecount += data.length; } - } + }); + } - self.images = images; - self.audiosData = audiosData; - NSLog(@"filesize: %.1f kb , memorycost: %.1f kb",bytecount/1024.0,memoryCount/1024.0); + dispatch_group_notify(group, currentQueue, ^{ + self.images = images; + self.audiosData = audiosData; + if (self.enableDebug) { + NSLog(@"SVGA filesize: %.1f kb , memorycost: %.1f kb", self.bytecount / 1024.0, self.memoryCount / 1024.0); + } + + }); } + - (void)resetSpritesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { NSMutableArray *sprites = [[NSMutableArray alloc] init]; NSArray *protoSprites = [protoObject.spritesArray copy]; @@ -266,6 +286,26 @@ - (void)saveWeakCache:(NSString *)cacheKey { dispatch_semaphore_signal(videoSemaphore); } + + +- (UIImage *)resizeImageIfNeed:(UIImage *)image { + UIImage *scaledImage; + if ((self.targetSize.width > 0 && self.targetSize.height > 0) && (self.targetSize.width < image.size.width && self.targetSize.height < image.size.height)) { + scaledImage = SVGAImageDecodeAndScaleDownUIKit(image,self.targetSize); + if (!scaledImage) { + // fill + scaledImage = [image scaleToFillSize:self.targetSize mode:0 scale:image.scale?:1]; + } + }else { + scaledImage = image; + } + return scaledImage; +} + +- (BOOL)enableDebug { + return [[SVGA shared] enableDebug]; +} + @end @interface SVGAVideoSpriteEntity() diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..6c3e3563 --- /dev/null +++ b/build.sh @@ -0,0 +1,29 @@ +rm -rf build + +#For iOS Device +xcodebuild clean archive \ +-workspace "SVGAPlayer.xcworkspace" \ +-scheme SVGA \ +-sdk iphoneos \ +-configuration Release \ +-destination 'generic/platform=iOS' \ +-archivePath './build/SVGAPlayer.framework-iphoneos.xcarchive' \ +SKIP_INSTALL=NO \ +BUILD_LIBRARIES_FOR_DISTRIBUTION=YES + + +xcodebuild clean archive \ +-workspace "SVGAPlayer.xcworkspace" \ +-scheme SVGA \ +-sdk iphoneos \ +-configuration Release \ +-destination 'generic/platform=iOS Simulator' \ +-archivePath './build/SVGAPlayer.framework-iphonesimulator.xcarchive' \ +SKIP_INSTALL=NO \ +BUILD_LIBRARIES_FOR_DISTRIBUTION=YES + + +xcodebuild -create-xcframework \ +-framework './build/SVGAPlayer.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/SVGA.framework' \ +-framework './build/SVGAPlayer.framework-iphoneos.xcarchive/Products/Library/Frameworks/SVGA.framework' \ +-output './build/SVGAPlayer.xcframework' From 576ee5c624928907d50ac5aec22c033efa090408 Mon Sep 17 00:00:00 2001 From: zouzelong Date: Tue, 7 Jan 2025 12:27:39 +0800 Subject: [PATCH 5/9] chore: support xcframework --- SVGAPlayer.xcodeproj/project.pbxproj | 82 +++++++++++------ .../xcschemes/SVGAPlayer.xcscheme | 35 +++---- .../xcschemes/SVGAPlayerDemo.xcscheme | 18 ++-- {SVGA => SVGAPlayer}/SVGA.h | 19 ++-- {SVGAPlayer => SVGAPlayerDemo}/AppDelegate.h | 0 {SVGAPlayer => SVGAPlayerDemo}/AppDelegate.m | 0 .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/Contents.json | 0 .../begin.imageset/Contents.json | 0 .../begin.imageset/begin@2x.png | Bin .../purse.imageset/Contents.json | 0 .../purse.imageset/purse@2x.png | Bin .../Base.lproj/LaunchScreen.storyboard | 0 .../Base.lproj/Main.storyboard | 0 {SVGAPlayer => SVGAPlayerDemo}/Info.plist | 0 .../SVGAPlayer React-Info.plist | 0 .../Samples/Goddess.svga | Bin .../Samples/Rocket.svga | Bin .../Samples/audio_biling.svga | Bin .../Samples/heartbeat.svga | Bin .../Samples/matteBitmap.svga | Bin .../Samples/matteBitmap_1.x.svga | Bin .../Samples/matteRect.svga | Bin .../Samples/mutiMatte.svga | Bin .../Samples/rose_1.5.0.svga | Bin .../Samples/rose_2.0.0.svga | Bin .../ViewController.h | 0 .../ViewController.m | 4 +- {SVGAPlayer => SVGAPlayerDemo}/main.m | 0 Source/SVGA.h | 16 +++- Source/SVGAImageView.h | 3 +- Source/SVGAPlayer+public.h | 54 +++++++++++ Source/SVGAPlayer.h | 53 +++-------- Source/SVGAPlayer.m | 3 +- Source/SVGAVideoEntity.m | 86 ++++++++---------- build.sh | 8 +- 36 files changed, 206 insertions(+), 175 deletions(-) rename {SVGA => SVGAPlayer}/SVGA.h (56%) rename {SVGAPlayer => SVGAPlayerDemo}/AppDelegate.h (100%) rename {SVGAPlayer => SVGAPlayerDemo}/AppDelegate.m (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Assets.xcassets/Contents.json (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Assets.xcassets/begin.imageset/Contents.json (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Assets.xcassets/begin.imageset/begin@2x.png (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Assets.xcassets/purse.imageset/Contents.json (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Assets.xcassets/purse.imageset/purse@2x.png (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Base.lproj/LaunchScreen.storyboard (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Base.lproj/Main.storyboard (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Info.plist (100%) rename {SVGAPlayer => SVGAPlayerDemo}/SVGAPlayer React-Info.plist (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/Goddess.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/Rocket.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/audio_biling.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/heartbeat.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/matteBitmap.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/matteBitmap_1.x.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/matteRect.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/mutiMatte.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/rose_1.5.0.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/Samples/rose_2.0.0.svga (100%) rename {SVGAPlayer => SVGAPlayerDemo}/ViewController.h (100%) rename {SVGAPlayer => SVGAPlayerDemo}/ViewController.m (98%) rename {SVGAPlayer => SVGAPlayerDemo}/main.m (100%) create mode 100644 Source/SVGAPlayer+public.h diff --git a/SVGAPlayer.xcodeproj/project.pbxproj b/SVGAPlayer.xcodeproj/project.pbxproj index bdc6d746..e753b453 100644 --- a/SVGAPlayer.xcodeproj/project.pbxproj +++ b/SVGAPlayer.xcodeproj/project.pbxproj @@ -39,7 +39,7 @@ 90D7CA1C1F7FB114006E74F0 /* rose_1.5.0.svga in Resources */ = {isa = PBXBuildFile; fileRef = 90D7CA1A1F7FB114006E74F0 /* rose_1.5.0.svga */; }; 90D7CA1E1F7FB34E006E74F0 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */; }; 90DB59B51F96026E00894727 /* SVGAImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 90DB59B41F96026E00894727 /* SVGAImageView.m */; }; - B78833182BC64A9F000474C2 /* SVGA.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833172BC64A9F000474C2 /* SVGA.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9D2D89394F3F82947CA3DE92 /* libPods-SVGAPlayer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CCE52B7C8CB296705A5E2B0E /* libPods-SVGAPlayer.a */; }; B788331F2BC64B0C000474C2 /* Svga.pbobjc.h in Headers */ = {isa = PBXBuildFile; fileRef = B788331C2BC64B0C000474C2 /* Svga.pbobjc.h */; }; B78833202BC64B0C000474C2 /* Svga.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = B788331D2BC64B0C000474C2 /* Svga.pbobjc.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; B788333C2BC64B1B000474C2 /* SVGA.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833212BC64B1B000474C2 /* SVGA.m */; }; @@ -65,12 +65,14 @@ B78833502BC64B1B000474C2 /* SVGABitmapLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833352BC64B1B000474C2 /* SVGABitmapLayer.h */; }; B78833512BC64B1B000474C2 /* SVGAAudioEntity.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833362BC64B1B000474C2 /* SVGAAudioEntity.h */; }; B78833522BC64B1B000474C2 /* SVGABezierPath.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833372BC64B1B000474C2 /* SVGABezierPath.m */; }; - B78833532BC64B1B000474C2 /* SVGAPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = B78833382BC64B1B000474C2 /* SVGAPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; B78833542BC64B1B000474C2 /* SVGAVideoEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = B78833392BC64B1B000474C2 /* SVGAVideoEntity.m */; }; B78833552BC64B1B000474C2 /* SVGAImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = B788333A2BC64B1B000474C2 /* SVGAImageView.h */; settings = {ATTRIBUTES = (Public, ); }; }; B78833562BC64B1B000474C2 /* SVGAContentLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = B788333B2BC64B1B000474C2 /* SVGAContentLayer.m */; }; B78833582BC64BE9000474C2 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B78833572BC64BE0000474C2 /* libz.tbd */; }; E83A58D9247E0E6A00D9F404 /* audio_biling.svga in Resources */ = {isa = PBXBuildFile; fileRef = E83A58D8247E0E6A00D9F404 /* audio_biling.svga */; }; + EF466E802D2C0C9C00FFBCB1 /* SVGAPlayer+public.h in Headers */ = {isa = PBXBuildFile; fileRef = EF466E7D2D2C0B6300FFBCB1 /* SVGAPlayer+public.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EF466E822D2C0DDA00FFBCB1 /* SVGA.h in Headers */ = {isa = PBXBuildFile; fileRef = 90A676F81D13A81F008A69F3 /* SVGA.h */; settings = {ATTRIBUTES = (Public, ); }; }; + EF466E832D2C10D000FFBCB1 /* SVGAPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 90A677041D13BF77008A69F3 /* SVGAPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; EFF7B0AF2D281CAD00404F60 /* UIImage+Resize.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */; }; EFF7B0B02D281CAD00404F60 /* UIImage+Resize.h in Headers */ = {isa = PBXBuildFile; fileRef = EFF7B0AD2D281CAD00404F60 /* UIImage+Resize.h */; }; EFF7B0B12D281CAD00404F60 /* UIImage+Resize.m in Sources */ = {isa = PBXBuildFile; fileRef = EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */; }; @@ -80,6 +82,19 @@ FC37CEED92F70863E863D2B6 /* (null) in Frameworks */ = {isa = PBXBuildFile; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + EF466E6F2D2BF31700FFBCB1 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 14714B6E44B276D74A209A31 /* Pods-SVGAPlayerDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayerDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayerDemo/Pods-SVGAPlayerDemo.debug.xcconfig"; sourceTree = ""; }; 1B65E3B43FC8C3D598EC0B41 /* Pods-SVGAPlayerDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayerDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayerDemo/Pods-SVGAPlayerDemo.release.xcconfig"; sourceTree = ""; }; @@ -109,7 +124,7 @@ 90A364D91E5AED04009347F1 /* SVGAVideoSpriteFrameEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGAVideoSpriteFrameEntity.m; sourceTree = ""; }; 90A364DB1E5D33F8009347F1 /* SVGAContentLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAContentLayer.h; sourceTree = ""; }; 90A364DC1E5D33F8009347F1 /* SVGAContentLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGAContentLayer.m; sourceTree = ""; }; - 90A676DD1D13A6DF008A69F3 /* SVGAPlayer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SVGAPlayer.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 90A676DD1D13A6DF008A69F3 /* SVGAPlayerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SVGAPlayerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 90A676E11D13A6DF008A69F3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 90A676E31D13A6DF008A69F3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 90A676E41D13A6DF008A69F3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -135,7 +150,7 @@ 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 90DB59B31F96026E00894727 /* SVGAImageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAImageView.h; sourceTree = ""; }; 90DB59B41F96026E00894727 /* SVGAImageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SVGAImageView.m; sourceTree = ""; }; - B78833152BC64A9F000474C2 /* SVGA.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SVGA.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B78833152BC64A9F000474C2 /* SVGAPlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SVGAPlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B78833172BC64A9F000474C2 /* SVGA.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGA.h; sourceTree = ""; }; B788331C2BC64B0C000474C2 /* Svga.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Svga.pbobjc.h; sourceTree = ""; }; B788331D2BC64B0C000474C2 /* Svga.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Svga.pbobjc.m; sourceTree = ""; }; @@ -168,8 +183,10 @@ B788333B2BC64B1B000474C2 /* SVGAContentLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SVGAContentLayer.m; path = Source/SVGAContentLayer.m; sourceTree = SOURCE_ROOT; }; B78833572BC64BE0000474C2 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; BB99F49A87B6B31DCEF63DE0 /* libPods-SVGAPlayerDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SVGAPlayerDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + CCE52B7C8CB296705A5E2B0E /* libPods-SVGAPlayer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SVGAPlayer.a"; sourceTree = BUILT_PRODUCTS_DIR; }; E02B8713B25C0283C736EE03 /* Pods-SVGAPlayer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SVGAPlayer.release.xcconfig"; path = "Pods/Target Support Files/Pods-SVGAPlayer/Pods-SVGAPlayer.release.xcconfig"; sourceTree = ""; }; E83A58D8247E0E6A00D9F404 /* audio_biling.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = audio_biling.svga; sourceTree = ""; }; + EF466E7D2D2C0B6300FFBCB1 /* SVGAPlayer+public.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SVGAPlayer+public.h"; sourceTree = ""; }; EFF7B0AD2D281CAD00404F60 /* UIImage+Resize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImage+Resize.h"; sourceTree = ""; }; EFF7B0AE2D281CAD00404F60 /* UIImage+Resize.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Resize.m"; sourceTree = ""; }; EFF7B0C02D2917C200404F60 /* DebugInfoView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DebugInfoView.h; sourceTree = ""; }; @@ -193,6 +210,7 @@ files = ( B78833582BC64BE9000474C2 /* libz.tbd in Frameworks */, FC37CEED92F70863E863D2B6 /* (null) in Frameworks */, + 9D2D89394F3F82947CA3DE92 /* libPods-SVGAPlayer.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -216,8 +234,8 @@ isa = PBXGroup; children = ( 90A676F71D13A70E008A69F3 /* Source */, - 90A676DF1D13A6DF008A69F3 /* SVGAPlayer */, - B78833162BC64A9F000474C2 /* SVGA */, + 90A676DF1D13A6DF008A69F3 /* SVGAPlayerDemo */, + B78833162BC64A9F000474C2 /* SVGAPlayer */, 90A676DE1D13A6DF008A69F3 /* Products */, 431B19F0F45A7844195F461A /* Pods */, B8EE95EA56FFE89CDEC9D8C3 /* Frameworks */, @@ -227,13 +245,13 @@ 90A676DE1D13A6DF008A69F3 /* Products */ = { isa = PBXGroup; children = ( - 90A676DD1D13A6DF008A69F3 /* SVGAPlayer.app */, - B78833152BC64A9F000474C2 /* SVGA.framework */, + 90A676DD1D13A6DF008A69F3 /* SVGAPlayerDemo.app */, + B78833152BC64A9F000474C2 /* SVGAPlayer.framework */, ); name = Products; sourceTree = ""; }; - 90A676DF1D13A6DF008A69F3 /* SVGAPlayer */ = { + 90A676DF1D13A6DF008A69F3 /* SVGAPlayerDemo */ = { isa = PBXGroup; children = ( 90D7C9FA1F7E2AA3006E74F0 /* Samples */, @@ -248,7 +266,7 @@ 90CB64F81EF297E800DAA382 /* SVGAPlayer React-Info.plist */, 90A676E01D13A6DF008A69F3 /* Supporting Files */, ); - path = SVGAPlayer; + path = SVGAPlayerDemo; sourceTree = ""; }; 90A676E01D13A6DF008A69F3 /* Supporting Files */ = { @@ -283,6 +301,7 @@ 90A364D31E5AEC1C009347F1 /* SVGAVectorLayer.m */, 63E816FF2178809D001D2D62 /* SVGAAudioLayer.h */, 63E817002178809D001D2D62 /* SVGAAudioLayer.m */, + EF466E7D2D2C0B6300FFBCB1 /* SVGAPlayer+public.h */, 90A677041D13BF77008A69F3 /* SVGAPlayer.h */, 90A677051D13BF77008A69F3 /* SVGAPlayer.m */, 90DB59B31F96026E00894727 /* SVGAImageView.h */, @@ -324,7 +343,7 @@ path = pbobjc; sourceTree = ""; }; - B78833162BC64A9F000474C2 /* SVGA */ = { + B78833162BC64A9F000474C2 /* SVGAPlayer */ = { isa = PBXGroup; children = ( B788331E2BC64B0C000474C2 /* pbobjc */, @@ -357,7 +376,7 @@ B78833242BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.h */, B788332F2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.m */, ); - path = SVGA; + path = SVGAPlayer; sourceTree = ""; }; B788331E2BC64B0C000474C2 /* pbobjc */ = { @@ -376,6 +395,7 @@ 90D7CA1D1F7FB34E006E74F0 /* libz.tbd */, B78833572BC64BE0000474C2 /* libz.tbd */, BB99F49A87B6B31DCEF63DE0 /* libPods-SVGAPlayerDemo.a */, + CCE52B7C8CB296705A5E2B0E /* libPods-SVGAPlayer.a */, ); name = Frameworks; sourceTree = ""; @@ -390,10 +410,12 @@ B78833472BC64B1B000474C2 /* SVGAVectorLayer.h in Headers */, B788334D2BC64B1B000474C2 /* SVGAParser.h in Headers */, B788334C2BC64B1B000474C2 /* SVGAExporter.h in Headers */, + EF466E802D2C0C9C00FFBCB1 /* SVGAPlayer+public.h in Headers */, + EF466E822D2C0DDA00FFBCB1 /* SVGA.h in Headers */, + EF466E832D2C10D000FFBCB1 /* SVGAPlayer.h in Headers */, B78833452BC64B1B000474C2 /* SVGAVideoEntity.h in Headers */, EFF7B0B02D281CAD00404F60 /* UIImage+Resize.h in Headers */, B78833552BC64B1B000474C2 /* SVGAImageView.h in Headers */, - B78833532BC64B1B000474C2 /* SVGAPlayer.h in Headers */, B788334B2BC64B1B000474C2 /* SVGAVideoSpriteEntity.h in Headers */, B78833502BC64B1B000474C2 /* SVGABitmapLayer.h in Headers */, B78833482BC64B1B000474C2 /* SVGAContentLayer.h in Headers */, @@ -403,34 +425,34 @@ B788333F2BC64B1B000474C2 /* SVGAVideoSpriteFrameEntity.h in Headers */, EFF7B0C32D2917C200404F60 /* DebugInfoView.h in Headers */, B78833432BC64B1B000474C2 /* SVGAAudioLayer.h in Headers */, - B78833182BC64A9F000474C2 /* SVGA.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 90A676DC1D13A6DF008A69F3 /* SVGAPlayer */ = { + 90A676DC1D13A6DF008A69F3 /* SVGAPlayerDemo */ = { isa = PBXNativeTarget; - buildConfigurationList = 90A676F41D13A6DF008A69F3 /* Build configuration list for PBXNativeTarget "SVGAPlayer" */; + buildConfigurationList = 90A676F41D13A6DF008A69F3 /* Build configuration list for PBXNativeTarget "SVGAPlayerDemo" */; buildPhases = ( CD70B01EE331E392E355CD26 /* [CP] Check Pods Manifest.lock */, 90A676D91D13A6DF008A69F3 /* Sources */, 90A676DA1D13A6DF008A69F3 /* Frameworks */, 90A676DB1D13A6DF008A69F3 /* Resources */, + EF466E6F2D2BF31700FFBCB1 /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( ); - name = SVGAPlayer; + name = SVGAPlayerDemo; productName = SVGAPlayer; - productReference = 90A676DD1D13A6DF008A69F3 /* SVGAPlayer.app */; + productReference = 90A676DD1D13A6DF008A69F3 /* SVGAPlayerDemo.app */; productType = "com.apple.product-type.application"; }; - B78833142BC64A9F000474C2 /* SVGA */ = { + B78833142BC64A9F000474C2 /* SVGAPlayer */ = { isa = PBXNativeTarget; - buildConfigurationList = B788331B2BC64A9F000474C2 /* Build configuration list for PBXNativeTarget "SVGA" */; + buildConfigurationList = B788331B2BC64A9F000474C2 /* Build configuration list for PBXNativeTarget "SVGAPlayer" */; buildPhases = ( D86E014333D44E49674E1F31 /* [CP] Check Pods Manifest.lock */, B78833102BC64A9F000474C2 /* Headers */, @@ -442,9 +464,9 @@ ); dependencies = ( ); - name = SVGA; + name = SVGAPlayer; productName = SVGA; - productReference = B78833152BC64A9F000474C2 /* SVGA.framework */; + productReference = B78833152BC64A9F000474C2 /* SVGAPlayer.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ @@ -480,8 +502,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 90A676DC1D13A6DF008A69F3 /* SVGAPlayer */, - B78833142BC64A9F000474C2 /* SVGA */, + 90A676DC1D13A6DF008A69F3 /* SVGAPlayerDemo */, + B78833142BC64A9F000474C2 /* SVGAPlayer */, ); }; /* End PBXProject section */ @@ -722,7 +744,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; DEVELOPMENT_TEAM = XM2VRDX92Q; - INFOPLIST_FILE = SVGAPlayer/Info.plist; + INFOPLIST_FILE = SVGAPlayerDemo/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = SvgaDemo; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -740,7 +762,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; DEVELOPMENT_TEAM = XM2VRDX92Q; - INFOPLIST_FILE = SVGAPlayer/Info.plist; + INFOPLIST_FILE = SVGAPlayerDemo/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = SvgaDemo; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -789,7 +811,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACH_O_TYPE = staticlib; + MACH_O_TYPE = mh_dylib; MARKETING_VERSION = 1.0; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; @@ -844,7 +866,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MACH_O_TYPE = staticlib; + MACH_O_TYPE = mh_dylib; MARKETING_VERSION = 1.0; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20"; @@ -872,7 +894,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 90A676F41D13A6DF008A69F3 /* Build configuration list for PBXNativeTarget "SVGAPlayer" */ = { + 90A676F41D13A6DF008A69F3 /* Build configuration list for PBXNativeTarget "SVGAPlayerDemo" */ = { isa = XCConfigurationList; buildConfigurations = ( 90A676F51D13A6DF008A69F3 /* Debug */, @@ -881,7 +903,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - B788331B2BC64A9F000474C2 /* Build configuration list for PBXNativeTarget "SVGA" */ = { + B788331B2BC64A9F000474C2 /* Build configuration list for PBXNativeTarget "SVGAPlayer" */ = { isa = XCConfigurationList; buildConfigurations = ( B78833192BC64A9F000474C2 /* Debug */, diff --git a/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayer.xcscheme b/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayer.xcscheme index 55f72e87..6fdd2d0a 100644 --- a/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayer.xcscheme +++ b/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayer.xcscheme @@ -1,10 +1,11 @@ + LastUpgradeVersion = "1620" + version = "1.7"> + buildImplicitDependencies = "YES" + buildArchitectures = "Automatic"> @@ -26,9 +27,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - - + shouldUseLaunchSchemeArgsEnv = "YES" + shouldAutocreateTestPlan = "YES"> - - - - - + - + diff --git a/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayerDemo.xcscheme b/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayerDemo.xcscheme index 492a332c..c2c8ce9b 100644 --- a/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayerDemo.xcscheme +++ b/SVGAPlayer.xcodeproj/xcshareddata/xcschemes/SVGAPlayerDemo.xcscheme @@ -1,11 +1,10 @@ + LastUpgradeVersion = "1100" + version = "1.3"> + buildImplicitDependencies = "YES"> + ReferencedContainer = "container:SVGAPlayer.xcodeproj"> @@ -27,8 +26,9 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES" - shouldAutocreateTestPlan = "YES"> + shouldUseLaunchSchemeArgsEnv = "YES"> + + + ReferencedContainer = "container:SVGAPlayer.xcodeproj"> @@ -64,7 +64,7 @@ BlueprintIdentifier = "90A676DC1D13A6DF008A69F3" BuildableName = "SVGAPlayerDemo.app" BlueprintName = "SVGAPlayerDemo" - ReferencedContainer = "container:SVGAPlayerDemo.xcodeproj"> + ReferencedContainer = "container:SVGAPlayer.xcodeproj"> diff --git a/SVGA/SVGA.h b/SVGAPlayer/SVGA.h similarity index 56% rename from SVGA/SVGA.h rename to SVGAPlayer/SVGA.h index 81fe9f34..d1055ec1 100644 --- a/SVGA/SVGA.h +++ b/SVGAPlayer/SVGA.h @@ -9,17 +9,18 @@ #import //! Project version number for SVGA. -FOUNDATION_EXPORT double SVGAVersionNumber; - -//! Project version string for SVGA. -FOUNDATION_EXPORT const unsigned char SVGAVersionString[]; +//FOUNDATION_EXPORT double SVGAVersionNumber; +// +////! Project version string for SVGA. +//FOUNDATION_EXPORT const unsigned char SVGAVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import -#import -#import -#import -#import -#import +//#import +//#import +//#import +//#import +//#import + @interface SVGA : NSObject + (SVGA *)shared; diff --git a/SVGAPlayer/AppDelegate.h b/SVGAPlayerDemo/AppDelegate.h similarity index 100% rename from SVGAPlayer/AppDelegate.h rename to SVGAPlayerDemo/AppDelegate.h diff --git a/SVGAPlayer/AppDelegate.m b/SVGAPlayerDemo/AppDelegate.m similarity index 100% rename from SVGAPlayer/AppDelegate.m rename to SVGAPlayerDemo/AppDelegate.m diff --git a/SVGAPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json b/SVGAPlayerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from SVGAPlayer/Assets.xcassets/AppIcon.appiconset/Contents.json rename to SVGAPlayerDemo/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/SVGAPlayer/Assets.xcassets/Contents.json b/SVGAPlayerDemo/Assets.xcassets/Contents.json similarity index 100% rename from SVGAPlayer/Assets.xcassets/Contents.json rename to SVGAPlayerDemo/Assets.xcassets/Contents.json diff --git a/SVGAPlayer/Assets.xcassets/begin.imageset/Contents.json b/SVGAPlayerDemo/Assets.xcassets/begin.imageset/Contents.json similarity index 100% rename from SVGAPlayer/Assets.xcassets/begin.imageset/Contents.json rename to SVGAPlayerDemo/Assets.xcassets/begin.imageset/Contents.json diff --git a/SVGAPlayer/Assets.xcassets/begin.imageset/begin@2x.png b/SVGAPlayerDemo/Assets.xcassets/begin.imageset/begin@2x.png similarity index 100% rename from SVGAPlayer/Assets.xcassets/begin.imageset/begin@2x.png rename to SVGAPlayerDemo/Assets.xcassets/begin.imageset/begin@2x.png diff --git a/SVGAPlayer/Assets.xcassets/purse.imageset/Contents.json b/SVGAPlayerDemo/Assets.xcassets/purse.imageset/Contents.json similarity index 100% rename from SVGAPlayer/Assets.xcassets/purse.imageset/Contents.json rename to SVGAPlayerDemo/Assets.xcassets/purse.imageset/Contents.json diff --git a/SVGAPlayer/Assets.xcassets/purse.imageset/purse@2x.png b/SVGAPlayerDemo/Assets.xcassets/purse.imageset/purse@2x.png similarity index 100% rename from SVGAPlayer/Assets.xcassets/purse.imageset/purse@2x.png rename to SVGAPlayerDemo/Assets.xcassets/purse.imageset/purse@2x.png diff --git a/SVGAPlayer/Base.lproj/LaunchScreen.storyboard b/SVGAPlayerDemo/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from SVGAPlayer/Base.lproj/LaunchScreen.storyboard rename to SVGAPlayerDemo/Base.lproj/LaunchScreen.storyboard diff --git a/SVGAPlayer/Base.lproj/Main.storyboard b/SVGAPlayerDemo/Base.lproj/Main.storyboard similarity index 100% rename from SVGAPlayer/Base.lproj/Main.storyboard rename to SVGAPlayerDemo/Base.lproj/Main.storyboard diff --git a/SVGAPlayer/Info.plist b/SVGAPlayerDemo/Info.plist similarity index 100% rename from SVGAPlayer/Info.plist rename to SVGAPlayerDemo/Info.plist diff --git a/SVGAPlayer/SVGAPlayer React-Info.plist b/SVGAPlayerDemo/SVGAPlayer React-Info.plist similarity index 100% rename from SVGAPlayer/SVGAPlayer React-Info.plist rename to SVGAPlayerDemo/SVGAPlayer React-Info.plist diff --git a/SVGAPlayer/Samples/Goddess.svga b/SVGAPlayerDemo/Samples/Goddess.svga similarity index 100% rename from SVGAPlayer/Samples/Goddess.svga rename to SVGAPlayerDemo/Samples/Goddess.svga diff --git a/SVGAPlayer/Samples/Rocket.svga b/SVGAPlayerDemo/Samples/Rocket.svga similarity index 100% rename from SVGAPlayer/Samples/Rocket.svga rename to SVGAPlayerDemo/Samples/Rocket.svga diff --git a/SVGAPlayer/Samples/audio_biling.svga b/SVGAPlayerDemo/Samples/audio_biling.svga similarity index 100% rename from SVGAPlayer/Samples/audio_biling.svga rename to SVGAPlayerDemo/Samples/audio_biling.svga diff --git a/SVGAPlayer/Samples/heartbeat.svga b/SVGAPlayerDemo/Samples/heartbeat.svga similarity index 100% rename from SVGAPlayer/Samples/heartbeat.svga rename to SVGAPlayerDemo/Samples/heartbeat.svga diff --git a/SVGAPlayer/Samples/matteBitmap.svga b/SVGAPlayerDemo/Samples/matteBitmap.svga similarity index 100% rename from SVGAPlayer/Samples/matteBitmap.svga rename to SVGAPlayerDemo/Samples/matteBitmap.svga diff --git a/SVGAPlayer/Samples/matteBitmap_1.x.svga b/SVGAPlayerDemo/Samples/matteBitmap_1.x.svga similarity index 100% rename from SVGAPlayer/Samples/matteBitmap_1.x.svga rename to SVGAPlayerDemo/Samples/matteBitmap_1.x.svga diff --git a/SVGAPlayer/Samples/matteRect.svga b/SVGAPlayerDemo/Samples/matteRect.svga similarity index 100% rename from SVGAPlayer/Samples/matteRect.svga rename to SVGAPlayerDemo/Samples/matteRect.svga diff --git a/SVGAPlayer/Samples/mutiMatte.svga b/SVGAPlayerDemo/Samples/mutiMatte.svga similarity index 100% rename from SVGAPlayer/Samples/mutiMatte.svga rename to SVGAPlayerDemo/Samples/mutiMatte.svga diff --git a/SVGAPlayer/Samples/rose_1.5.0.svga b/SVGAPlayerDemo/Samples/rose_1.5.0.svga similarity index 100% rename from SVGAPlayer/Samples/rose_1.5.0.svga rename to SVGAPlayerDemo/Samples/rose_1.5.0.svga diff --git a/SVGAPlayer/Samples/rose_2.0.0.svga b/SVGAPlayerDemo/Samples/rose_2.0.0.svga similarity index 100% rename from SVGAPlayer/Samples/rose_2.0.0.svga rename to SVGAPlayerDemo/Samples/rose_2.0.0.svga diff --git a/SVGAPlayer/ViewController.h b/SVGAPlayerDemo/ViewController.h similarity index 100% rename from SVGAPlayer/ViewController.h rename to SVGAPlayerDemo/ViewController.h diff --git a/SVGAPlayer/ViewController.m b/SVGAPlayerDemo/ViewController.m similarity index 98% rename from SVGAPlayer/ViewController.m rename to SVGAPlayerDemo/ViewController.m index 76762974..87cf2542 100644 --- a/SVGAPlayer/ViewController.m +++ b/SVGAPlayerDemo/ViewController.m @@ -7,7 +7,7 @@ // #import "ViewController.h" -#import "SVGA.h" +#import "SVGAPlayer.h" @interface ViewController () @@ -32,7 +32,7 @@ - (void)viewDidLoad { self.aPlayer.loops = 1; self.aPlayer.clearsAfterStop = YES; parser = [[SVGAParser alloc] init]; - parser.targetSize = CGSizeMake(375, 375); +// parser.targetSize = CGSizeMake(375, 375); [self onChange:nil]; } diff --git a/SVGAPlayer/main.m b/SVGAPlayerDemo/main.m similarity index 100% rename from SVGAPlayer/main.m rename to SVGAPlayerDemo/main.m diff --git a/Source/SVGA.h b/Source/SVGA.h index 3f90b44d..3b5dcd71 100644 --- a/Source/SVGA.h +++ b/Source/SVGA.h @@ -7,11 +7,17 @@ // #import -#import "SVGAParser.h" -#import "SVGAPlayer.h" -#import "SVGAImageView.h" -#import "SVGAVideoEntity.h" -#import "SVGAExporter.h" +//#import "SVGAParser.h" +//#import "SVGAPlayer.h" +//#import "SVGAImageView.h" +//#import "SVGAVideoEntity.h" +//#import "SVGAExporter.h" + +//#import +//#import +//#import +//#import +//#import @interface SVGA : NSObject + (SVGA *)shared; diff --git a/Source/SVGAImageView.h b/Source/SVGAImageView.h index 951be3f1..90905c44 100644 --- a/Source/SVGAImageView.h +++ b/Source/SVGAImageView.h @@ -6,8 +6,7 @@ // Copyright © 2017年 UED Center. All rights reserved. // -#import - +#import @interface SVGAImageView : SVGAPlayer @property (nonatomic, assign) IBInspectable BOOL autoPlay; diff --git a/Source/SVGAPlayer+public.h b/Source/SVGAPlayer+public.h new file mode 100644 index 00000000..b7dc1a5a --- /dev/null +++ b/Source/SVGAPlayer+public.h @@ -0,0 +1,54 @@ +// +// SVGAPlayer 2.h +// SVGAPlayer +// +// Created by smartzou on 2025/1/6. +// Copyright © 2025 UED Center. All rights reserved. +// + +#import +@class SVGAVideoEntity, SVGAPlayer; + +@protocol SVGAPlayerDelegate + +@optional +- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player ; + +- (void)svgaPlayer:(SVGAPlayer *)player didAnimatedToFrame:(NSInteger)frame; +- (void)svgaPlayer:(SVGAPlayer *)player didAnimatedToPercentage:(CGFloat)percentage; + +- (void)svgaPlayerDidAnimatedToFrame:(NSInteger)frame API_DEPRECATED("Use svgaPlayer:didAnimatedToFrame: instead", ios(7.0, API_TO_BE_DEPRECATED)); +- (void)svgaPlayerDidAnimatedToPercentage:(CGFloat)percentage API_DEPRECATED("Use svgaPlayer:didAnimatedToPercentage: instead", ios(7.0, API_TO_BE_DEPRECATED)); + +@end + +typedef void(^SVGAPlayerDynamicDrawingBlock)(CALayer *contentLayer, NSInteger frameIndex); + +@interface SVGAPlayer : UIView + +@property (nonatomic, weak) id delegate; +@property (nonatomic, strong) SVGAVideoEntity *videoItem; +@property (nonatomic, assign) IBInspectable int loops; +@property (nonatomic, assign) IBInspectable BOOL clearsAfterStop; +@property (nonatomic, copy) NSString *fillMode; +@property (nonatomic, copy) NSRunLoopMode mainRunLoopMode; + +- (void)startAnimation; +- (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse; +- (void)pauseAnimation; +- (void)stopAnimation; +- (void)clear; +- (void)stepToFrame:(NSInteger)frame andPlay:(BOOL)andPlay; +- (void)stepToPercentage:(CGFloat)percentage andPlay:(BOOL)andPlay; + +#pragma mark - Dynamic Object + +- (void)setImage:(UIImage *)image forKey:(NSString *)aKey; +- (void)setImageWithURL:(NSURL *)URL forKey:(NSString *)aKey; +- (void)setImage:(UIImage *)image forKey:(NSString *)aKey referenceLayer:(CALayer *)referenceLayer; // deprecated from 2.0.1 +- (void)setAttributedText:(NSAttributedString *)attributedText forKey:(NSString *)aKey; +- (void)setDrawingBlock:(SVGAPlayerDynamicDrawingBlock)drawingBlock forKey:(NSString *)aKey; +- (void)setHidden:(BOOL)hidden forKey:(NSString *)aKey; +- (void)clearDynamicObjects; + +@end diff --git a/Source/SVGAPlayer.h b/Source/SVGAPlayer.h index cdeb8ccf..4ac3eb2a 100644 --- a/Source/SVGAPlayer.h +++ b/Source/SVGAPlayer.h @@ -6,50 +6,21 @@ // Copyright © 2016年 UED Center. All rights reserved. // -#import +#import -@class SVGAVideoEntity, SVGAPlayer; -@protocol SVGAPlayerDelegate -@optional -- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player ; +//! Project version number for SVGAPlayer. +FOUNDATION_EXPORT double SVGAPlayerVersionNumber; -- (void)svgaPlayer:(SVGAPlayer *)player didAnimatedToFrame:(NSInteger)frame; -- (void)svgaPlayer:(SVGAPlayer *)player didAnimatedToPercentage:(CGFloat)percentage; +//! Project version string for SVGAPlayer. +FOUNDATION_EXPORT const unsigned char SVGAPlayerVersionString[]; -- (void)svgaPlayerDidAnimatedToFrame:(NSInteger)frame API_DEPRECATED("Use svgaPlayer:didAnimatedToFrame: instead", ios(7.0, API_TO_BE_DEPRECATED)); -- (void)svgaPlayerDidAnimatedToPercentage:(CGFloat)percentage API_DEPRECATED("Use svgaPlayer:didAnimatedToPercentage: instead", ios(7.0, API_TO_BE_DEPRECATED)); +// In this header, you should import all the public headers of your framework using statements like #import -@end - -typedef void(^SVGAPlayerDynamicDrawingBlock)(CALayer *contentLayer, NSInteger frameIndex); - -@interface SVGAPlayer : UIView - -@property (nonatomic, weak) id delegate; -@property (nonatomic, strong) SVGAVideoEntity *videoItem; -@property (nonatomic, assign) IBInspectable int loops; -@property (nonatomic, assign) IBInspectable BOOL clearsAfterStop; -@property (nonatomic, copy) NSString *fillMode; -@property (nonatomic, copy) NSRunLoopMode mainRunLoopMode; - -- (void)startAnimation; -- (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse; -- (void)pauseAnimation; -- (void)stopAnimation; -- (void)clear; -- (void)stepToFrame:(NSInteger)frame andPlay:(BOOL)andPlay; -- (void)stepToPercentage:(CGFloat)percentage andPlay:(BOOL)andPlay; - -#pragma mark - Dynamic Object - -- (void)setImage:(UIImage *)image forKey:(NSString *)aKey; -- (void)setImageWithURL:(NSURL *)URL forKey:(NSString *)aKey; -- (void)setImage:(UIImage *)image forKey:(NSString *)aKey referenceLayer:(CALayer *)referenceLayer; // deprecated from 2.0.1 -- (void)setAttributedText:(NSAttributedString *)attributedText forKey:(NSString *)aKey; -- (void)setDrawingBlock:(SVGAPlayerDynamicDrawingBlock)drawingBlock forKey:(NSString *)aKey; -- (void)setHidden:(BOOL)hidden forKey:(NSString *)aKey; -- (void)clearDynamicObjects; - -@end +#import +#import +#import +#import +#import +#import diff --git a/Source/SVGAPlayer.m b/Source/SVGAPlayer.m index 10e8b234..873f58aa 100644 --- a/Source/SVGAPlayer.m +++ b/Source/SVGAPlayer.m @@ -6,7 +6,7 @@ // Copyright © 2016年 UED Center. All rights reserved. // -#import "SVGAPlayer.h" +#import "SVGAPlayer+public.h" #import "SVGAVideoEntity.h" #import "SVGAVideoSpriteEntity.h" #import "SVGAVideoSpriteFrameEntity.h" @@ -19,6 +19,7 @@ #import "DebugInfoView.h" + @interface SVGAPlayer () @property (nonatomic, strong) CALayer *drawLayer; diff --git a/Source/SVGAVideoEntity.m b/Source/SVGAVideoEntity.m index e01b2f70..3921499f 100644 --- a/Source/SVGAVideoEntity.m +++ b/Source/SVGAVideoEntity.m @@ -180,62 +180,50 @@ - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject { NSDictionary *protoImages = [protoObject.images copy]; self.bytecount = 0; self.memoryCount = 0; - dispatch_queue_t currentQueue = dispatch_get_current_queue(); - dispatch_group_t group = dispatch_group_create(); - dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); for (NSString *key in protoImages) { - dispatch_group_async(group, queue, ^{ - NSString *fileName = [[NSString alloc] initWithData:protoImages[key] encoding:NSUTF8StringEncoding]; - if (fileName != nil) { - NSString *filePath = [self.cacheDir stringByAppendingFormat:@"/%@.png", fileName]; - if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { - filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName]; - } - if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { - // NSData *imageData = [NSData dataWithContentsOfFile:filePath]; - NSData *imageData = [NSData dataWithContentsOfFile:filePath options:NSDataReadingMappedIfSafe error:NULL]; - if (imageData != nil) { - UIImage *image = [[UIImage alloc] initWithData:imageData scale:2.0]; - if (image != nil) { - @synchronized (images) { - [images setObject:image forKey:key]; - } - - } + NSString *fileName = [[NSString alloc] initWithData:protoImages[key] encoding:NSUTF8StringEncoding]; + if (fileName != nil) { + NSString *filePath = [self.cacheDir stringByAppendingFormat:@"/%@.png", fileName]; + if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { + filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName]; + } + if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { +// NSData *imageData = [NSData dataWithContentsOfFile:filePath]; + NSData *imageData = [NSData dataWithContentsOfFile:filePath options:NSDataReadingMappedIfSafe error:NULL]; + if (imageData != nil) { + UIImage *image = [[UIImage alloc] initWithData:imageData scale:2.0]; + if (image != nil) { + [images setObject:image forKey:key]; } } } - else if ([protoImages[key] isKindOfClass:[NSData class]]) { - if ([SVGAVideoEntity isMP3Data:protoImages[key]]) { - // mp3 - [audiosData setObject:protoImages[key] forKey:key]; - } else { - NSData *data = protoImages[key]; - UIImage *image = [[UIImage alloc] initWithData:data scale:2.0]; - UIImage *scaledImage = [self resizeImageIfNeed:image]; - if (scaledImage != nil) { - @synchronized (images) { - [images setObject:scaledImage forKey:key]; - } - - } - if (self.enableDebug) { - self.memoryCount += [scaledImage costForImage]; - self.bytecount += data.length; - } + } + else if ([protoImages[key] isKindOfClass:[NSData class]]) { + if ([SVGAVideoEntity isMP3Data:protoImages[key]]) { + // mp3 + [audiosData setObject:protoImages[key] forKey:key]; + } else { + NSData *data = protoImages[key]; + UIImage *image = [[UIImage alloc] initWithData:data scale:2.0]; + UIImage *scaledImage = [self resizeImageIfNeed:image]; + if (scaledImage != nil) { + + [images setObject:scaledImage forKey:key]; + + + } + if (self.enableDebug) { + self.memoryCount += [scaledImage costForImage]; + self.bytecount += data.length; } } - }); - - } - dispatch_group_notify(group, currentQueue, ^{ - self.images = images; - self.audiosData = audiosData; - if (self.enableDebug) { - NSLog(@"SVGA filesize: %.1f kb , memorycost: %.1f kb", self.bytecount / 1024.0, self.memoryCount / 1024.0); } - - }); + } + self.images = images; + self.audiosData = audiosData; + if (self.enableDebug) { + NSLog(@"SVGA filesize: %.1f kb , memorycost: %.1f kb", self.bytecount / 1024.0, self.memoryCount / 1024.0); + } } diff --git a/build.sh b/build.sh index 6c3e3563..ea4d1a26 100755 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ rm -rf build #For iOS Device xcodebuild clean archive \ -workspace "SVGAPlayer.xcworkspace" \ --scheme SVGA \ +-scheme SVGAPlayer \ -sdk iphoneos \ -configuration Release \ -destination 'generic/platform=iOS' \ @@ -14,7 +14,7 @@ BUILD_LIBRARIES_FOR_DISTRIBUTION=YES xcodebuild clean archive \ -workspace "SVGAPlayer.xcworkspace" \ --scheme SVGA \ +-scheme SVGAPlayer \ -sdk iphoneos \ -configuration Release \ -destination 'generic/platform=iOS Simulator' \ @@ -24,6 +24,6 @@ BUILD_LIBRARIES_FOR_DISTRIBUTION=YES xcodebuild -create-xcframework \ --framework './build/SVGAPlayer.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/SVGA.framework' \ --framework './build/SVGAPlayer.framework-iphoneos.xcarchive/Products/Library/Frameworks/SVGA.framework' \ +-framework './build/SVGAPlayer.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/SVGAPlayer.framework' \ +-framework './build/SVGAPlayer.framework-iphoneos.xcarchive/Products/Library/Frameworks/SVGAPlayer.framework' \ -output './build/SVGAPlayer.xcframework' From ae11dfcd01873f88f6a6f95ae26fa4c09f49e733 Mon Sep 17 00:00:00 2001 From: zouzelong Date: Tue, 7 Jan 2025 18:02:33 +0800 Subject: [PATCH 6/9] chore: add audio mute support --- Source/SVGAPlayer+public.h | 1 + Source/SVGAPlayer.m | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Source/SVGAPlayer+public.h b/Source/SVGAPlayer+public.h index b7dc1a5a..21a372ac 100644 --- a/Source/SVGAPlayer+public.h +++ b/Source/SVGAPlayer+public.h @@ -32,6 +32,7 @@ typedef void(^SVGAPlayerDynamicDrawingBlock)(CALayer *contentLayer, NSInteger fr @property (nonatomic, assign) IBInspectable BOOL clearsAfterStop; @property (nonatomic, copy) NSString *fillMode; @property (nonatomic, copy) NSRunLoopMode mainRunLoopMode; +@property (nonatomic, assign) BOOL mute; - (void)startAnimation; - (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse; diff --git a/Source/SVGAPlayer.m b/Source/SVGAPlayer.m index 873f58aa..2fcc628c 100644 --- a/Source/SVGAPlayer.m +++ b/Source/SVGAPlayer.m @@ -160,6 +160,25 @@ - (void)clearAudios { } } +- (void)setAudiosVolums:(float)volume { + for (SVGAAudioLayer *layer in self.audioLayers) { + if (layer.audioPlaying) { + [layer.audioPlayer setVolume:volume]; + } + } +} + +- (void)setMute:(BOOL)mute { + if (_mute != mute) { + _mute = mute; + if (mute) { + [self setAudiosVolums:0.0]; + }else { + [self setAudiosVolums:1.0]; + } + } +} + - (void)stepToFrame:(NSInteger)frame andPlay:(BOOL)andPlay { if (self.videoItem == nil) { NSLog(@"videoItem could not be nil!"); @@ -356,6 +375,11 @@ - (void)update { for (SVGAAudioLayer *layer in self.audioLayers) { if (!layer.audioPlaying && layer.audioItem.startFrame <= self.currentFrame && self.currentFrame <= layer.audioItem.endFrame) { [layer.audioPlayer setCurrentTime:(NSTimeInterval)(layer.audioItem.startTime / 1000)]; + if (self.mute) { + [layer.audioPlayer setVolume:0.0]; + }else { + [layer.audioPlayer setVolume:1.0]; + } [layer.audioPlayer play]; layer.audioPlaying = YES; } From 7032ba5443708642cc979c174eabfdc866f03eca Mon Sep 17 00:00:00 2001 From: zouzelong Date: Mon, 13 Jan 2025 16:58:31 +0800 Subject: [PATCH 7/9] =?UTF-8?q?chore:=20=E5=90=8C=E6=AD=A5=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E6=B5=81=E7=A8=8B=EF=BC=8C=E9=98=B2=E6=AD=A2=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SVGAPlayer.m | 40 ++++++++++++++++++++++++++++++++++------ Source/SVGAVideoEntity.m | 2 +- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Source/SVGAPlayer.m b/Source/SVGAPlayer.m index 2fcc628c..7517fce8 100644 --- a/Source/SVGAPlayer.m +++ b/Source/SVGAPlayer.m @@ -17,8 +17,15 @@ #import "SVGAAudioEntity.h" #import "SVGA.h" #import "DebugInfoView.h" +#import - +static inline void svg_dispatch_async_on_main_queue(void (^block)(void)) { + if (pthread_main_np()) { + block(); + } else { + dispatch_async(dispatch_get_main_queue(), block); + } +} @interface SVGAPlayer () @@ -75,9 +82,30 @@ - (void)willMoveToSuperview:(UIView *)newSuperview { [super willMoveToSuperview:newSuperview]; if (newSuperview == nil) { [self stopAnimation:YES]; +#if DEBUG + NSLog(@"willMoveToSuperview stopAnimation Clear YES"); +#endif } } +- (void)willMoveToWindow:(UIWindow *)newWindow { + [super willMoveToWindow:newWindow]; + if (newWindow == nil) { + // 当前视图将从屏幕移除,停止动画 + [self pauseAnimation]; +#if DEBUG + NSLog(@"willMoveToWindow stopAnimation Clear NO"); +#endif + } else { + // 当前视图将显示在屏幕上,启动动画 + [self startAnimation]; +#if DEBUG + NSLog(@"willMoveToWindow startAnimation"); +#endif + } +} + + - (void)startAnimation { if (self.videoItem == nil) { NSLog(@"videoItem could not be nil!"); @@ -446,12 +474,12 @@ - (void)setVideoItem:(SVGAVideoEntity *)videoItem { _reversing = NO; _currentFrame = 0; _loopCount = 0; - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + + svg_dispatch_async_on_main_queue(^{ [self clear]; [self draw]; [self updateInfoView]; - - }]; + }); } #pragma mark - Dynamic Object @@ -477,9 +505,9 @@ - (void)setImageWithURL:(NSURL *)URL forKey:(NSString *)aKey { if (error == nil && data != nil) { UIImage *image = [UIImage imageWithData:data]; if (image != nil) { - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + svg_dispatch_async_on_main_queue(^{ [self setImage:image forKey:aKey]; - }]; + }); } } }] resume]; diff --git a/Source/SVGAVideoEntity.m b/Source/SVGAVideoEntity.m index 3921499f..7316738c 100644 --- a/Source/SVGAVideoEntity.m +++ b/Source/SVGAVideoEntity.m @@ -282,7 +282,7 @@ - (UIImage *)resizeImageIfNeed:(UIImage *)image { scaledImage = SVGAImageDecodeAndScaleDownUIKit(image,self.targetSize); if (!scaledImage) { // fill - scaledImage = [image scaleToFillSize:self.targetSize mode:0 scale:image.scale?:1]; + scaledImage = [image scaleToFillSize:self.targetSize mode:0 scale:image.scale?:2]; } }else { scaledImage = image; From b4a0a935bbd6bc7728f740bb64ebe71a1bc14d7f Mon Sep 17 00:00:00 2001 From: zouzelong Date: Wed, 22 Jan 2025 15:50:52 +0800 Subject: [PATCH 8/9] chore: thumbnail image scale defaut to 2 --- Source/SVGAVideoEntity.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/SVGAVideoEntity.m b/Source/SVGAVideoEntity.m index 7316738c..e944db97 100644 --- a/Source/SVGAVideoEntity.m +++ b/Source/SVGAVideoEntity.m @@ -37,7 +37,7 @@ @implementation SVGAVideoEntity // Need CGImage-based if (@available(iOS 15, tvOS 15, *)) { // Calculate thumbnail point size - CGFloat scale = image.scale ?: 1; + CGFloat scale = image.scale ?: 2; CGSize thumbnailSize = CGSizeMake(destResolution.width / scale, destResolution.height / scale); UIImage *decodedImage = [image imageByPreparingThumbnailOfSize:thumbnailSize]; if (decodedImage) { From 02b99231bf83cf29f36c806c7381f65a6afb7c4b Mon Sep 17 00:00:00 2001 From: zouzelong Date: Wed, 22 Jan 2025 16:23:24 +0800 Subject: [PATCH 9/9] chore: update svagplayer image scale to 1.0 --- Source/SVGAVideoEntity.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/SVGAVideoEntity.m b/Source/SVGAVideoEntity.m index e944db97..f99ec05a 100644 --- a/Source/SVGAVideoEntity.m +++ b/Source/SVGAVideoEntity.m @@ -37,8 +37,7 @@ @implementation SVGAVideoEntity // Need CGImage-based if (@available(iOS 15, tvOS 15, *)) { // Calculate thumbnail point size - CGFloat scale = image.scale ?: 2; - CGSize thumbnailSize = CGSizeMake(destResolution.width / scale, destResolution.height / scale); + CGSize thumbnailSize = CGSizeMake(destResolution.width, destResolution.height); UIImage *decodedImage = [image imageByPreparingThumbnailOfSize:thumbnailSize]; if (decodedImage) { return decodedImage;