-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8c52a1
commit 4b3adec
Showing
4 changed files
with
110 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Error.swift | ||
// Pods-SCNVideoWriter_Example | ||
// | ||
// Created by Tomoya Hirano on 2017/08/20. | ||
// | ||
|
||
import UIKit | ||
|
||
extension SCNVideoWriter { | ||
public struct VideoSizeError: Error {} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// Options.swift | ||
// Pods-SCNVideoWriter_Example | ||
// | ||
// Created by Tomoya Hirano on 2017/08/20. | ||
// | ||
|
||
import UIKit | ||
import AVFoundation | ||
|
||
extension SCNVideoWriter { | ||
public struct Options { | ||
public var timeScale: Int32 | ||
public var renderSize: CGSize | ||
public var videoSize: CGSize | ||
public var fps: Int | ||
public var outputUrl: URL | ||
public var fileType: String | ||
public var codec: String | ||
public var deleteFileIfExists: Bool | ||
|
||
public static var `default`: Options { | ||
return Options(timeScale: 600, | ||
renderSize: CGSize(width: 640, height: 640), | ||
videoSize: CGSize(width: 1280, height: 720), | ||
fps: 60, | ||
outputUrl: URL(fileURLWithPath: NSTemporaryDirectory() + "output.mp4"), | ||
fileType: AVFileTypeAppleM4V, | ||
codec: AVVideoCodecH264, | ||
deleteFileIfExists: true) | ||
} | ||
|
||
var assetWriterInputSettings: [String : Any] { | ||
return [ | ||
AVVideoCodecKey: codec, | ||
AVVideoWidthKey: videoSize.width, | ||
AVVideoHeightKey: videoSize.height | ||
] | ||
} | ||
var sourcePixelBufferAttributes: [String : Any] { | ||
return [ | ||
kCVPixelBufferPixelFormatTypeKey as String: NSNumber(value: kCVPixelFormatType_32ARGB), | ||
kCVPixelBufferWidthKey as String: videoSize.width, | ||
kCVPixelBufferHeightKey as String: videoSize.height, | ||
] | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters