Skip to content
6 changes: 3 additions & 3 deletions Cabbage/Sources/Core/Audio/AudioProcessingTapHolder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public class AudioProcessingTapHolder: NSObject, NSCopying {
prepare: tapPrepare,
unprepare: tapUnprepare,
process: tapProcess)
var tap: Unmanaged<MTAudioProcessingTap>?
// Use the expected type for the Create function: MTAudioProcessingTap?
var tap: MTAudioProcessingTap?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not working on Xcode lower than 26.0.

let err = MTAudioProcessingTapCreate(kCFAllocatorDefault, &callbacks, kMTAudioProcessingTapCreationFlag_PostEffects, &tap)
if err != noErr {
Log.error("error: failed to create audioProcessingTap")
}
self.tap = tap?.takeRetainedValue()

self.tap = tap
}

// MARK: - Handler
Expand Down
7 changes: 4 additions & 3 deletions Cabbage/Sources/Core/CompositionGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public class CompositionGenerator {
return imageGenerator
}

public func buildExportSession(presetName: String) -> AVAssetExportSession? {
public func buildExportSession(presetName: String, animationTool: AVVideoCompositionCoreAnimationTool? = nil) -> AVAssetExportSession? {
let composition = buildComposition()
let exportSession = AVAssetExportSession.init(asset: composition, presetName: presetName)
exportSession?.videoComposition = buildVideoComposition()
exportSession?.videoComposition = buildVideoComposition(animationTool: animationTool)
exportSession?.audioMix = buildAudioMix()
exportSession?.outputURL = {
let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last!
Expand Down Expand Up @@ -192,7 +192,7 @@ public class CompositionGenerator {
return composition
}

public func buildVideoComposition() -> AVVideoComposition? {
public func buildVideoComposition(animationTool: AVVideoCompositionCoreAnimationTool? = nil) -> AVVideoComposition? {
if let videoComposition = self.videoComposition, !needRebuildVideoComposition {
return videoComposition
}
Expand Down Expand Up @@ -242,6 +242,7 @@ public class CompositionGenerator {
videoComposition.renderSize = self.timeline.renderSize
videoComposition.instructions = instructions
videoComposition.customVideoCompositorClass = VideoCompositor.self
videoComposition.animationTool = animationTool
self.videoComposition = videoComposition
self.needRebuildVideoComposition = false
return videoComposition
Expand Down
8 changes: 7 additions & 1 deletion Cabbage/Sources/Track/Resource/Resource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ public struct ResourceTrackInfo {
public var track: AVAssetTrack
public var selectedTimeRange: CMTimeRange
public var scaleToDuration: CMTime

public init(track: AVAssetTrack, selectedTimeRange: CMTimeRange, scaleToDuration: CMTime) {
self.track = track
self.selectedTimeRange = selectedTimeRange
self.scaleToDuration = scaleToDuration
}
}


Expand Down Expand Up @@ -99,7 +105,7 @@ open class Resource: NSObject, NSCopying, ResourceTrackInfoProvider {

// MARK: - ResourceTrackInfoProvider

public func trackInfo(for type: AVMediaType, at index: Int) -> ResourceTrackInfo {
open func trackInfo(for type: AVMediaType, at index: Int) -> ResourceTrackInfo {
let track = tracks(for: type)[index]
let emptyDuration = CMTime(value: 1, 30)
let emptyTimeRange = CMTimeRangeMake(start: CMTime.zero, duration: emptyDuration)
Expand Down
20 changes: 5 additions & 15 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import PackageDescription

let package = Package(
name: "Cabbage",
name: "SCCabbage",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "Cabbage",
targets: ["Cabbage"]),
name: "SCCabbage",
targets: ["SCCabbage"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
Expand All @@ -19,18 +19,8 @@ let package = Package(
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "Cabbage",
dependencies: [],
linkerSettings: [
.linkedFramework(
"AVFoundation",
.when(platforms: [.iOS, .macOS])
),
.linkedFramework(
"Foundation",
.when(platforms: [.iOS, .macOS])
)
]
name: "SCCabbage",
dependencies: []
)
]
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ use_frameworks!
target 'MyApp' do
# your other pod
# ...
pod 'VFCabbage'
pod 'SCCabbage', :git => 'https://github.com/kre8tv/SCCabbage'
end
```

Expand All @@ -167,7 +167,7 @@ You can
- Or add Cabbage as a submodule.

```
$ git submodule add https://github.com/VideoFlint/Cabbage.git
$ git submodule add https://github.com/kre8tv/SCCabbage
```

## Requirements
Expand Down
8 changes: 4 additions & 4 deletions VFCabbage.podspec → SCCabbage.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'VFCabbage'
s.version = '0.5.1'
s.name = 'SCCabbage'
s.version = '0.5.2'
s.summary = 'A high-level video composition framework build on top of AVFoundation. It\'s simple to use and easy to extend.'

s.description = <<-DESC
Expand All @@ -15,14 +15,14 @@ Pod::Spec.new do |s|

s.license = { :type => "MIT", :file => "LICENSE" }

s.homepage = 'https://github.com/VideoFlint/Cabbage'
s.homepage = 'https://github.com/kre8tv/SCCabbage'

s.author = { 'Vito' => 'vvitozhang@gmail.com' }

s.platform = :ios, '9.0'
s.swift_version = "4.2"

s.source = { :git => 'https://github.com/VideoFlint/Cabbage.git', :tag => s.version.to_s }
s.source = { :git => 'https://github.com/kre8tv/SCCabbage.git', :tag => s.version.to_s }
s.source_files = ['Cabbage/Sources/core/**/*.swift', 'Cabbage/Sources/**/*.swift']
s.resource_bundles = { 'Cabbage' => 'Cabbage/Sources/Resource/*.mp4' }

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.