-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
24cbf06
commit b3e328c
Showing
22 changed files
with
468 additions
and
110 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
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-51.2 KB
(47%)
Gifski/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-567 Bytes
(77%)
Gifski/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-201 KB
(41%)
Gifski/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-711 KB
(44%)
Gifski/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,47 @@ | ||
import Cocoa | ||
|
||
final class SavePanelAccessoryViewController: NSViewController { | ||
@IBOutlet private weak var dimensionsSlider: NSSlider! | ||
@IBOutlet private weak var dimensionsLabel: NSTextField! | ||
@IBOutlet private weak var qualitySlider: NSSlider! | ||
@IBOutlet private weak var estimatedSizeLabel: NSTextField! | ||
var inputUrl: URL! | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
view.autoresizingMask = [.minXMargin, .maxXMargin] | ||
|
||
let formatter = ByteCountFormatter() | ||
formatter.zeroPadsFractionDigits = true | ||
|
||
/// TODO: Use KVO here | ||
|
||
let metadata = inputUrl.videoMetadata! | ||
let FPS = 24.0 | ||
let frameCount = metadata.duration * FPS | ||
var currentDimensions = metadata.dimensions | ||
|
||
func estimateFileSize() { | ||
var fileSize = (Double(currentDimensions.width) * Double(currentDimensions.height) * Double(frameCount)) / 3 | ||
fileSize = fileSize * (qualitySlider.doubleValue + 1.5) / 2.5 | ||
estimatedSizeLabel.stringValue = formatter.string(fromByteCount: Int64(fileSize)) | ||
} | ||
|
||
dimensionsSlider.onAction = { _ in | ||
currentDimensions = metadata.dimensions * self.dimensionsSlider.doubleValue | ||
self.dimensionsLabel.stringValue = "\(Int(currentDimensions.width))×\(Int(currentDimensions.height))" | ||
estimateFileSize() | ||
|
||
/// TODO: Feels hacky to do it this way. Find a better way to pass the state. | ||
self.appDelegate.choosenDimensions = currentDimensions | ||
} | ||
|
||
qualitySlider.onAction = { _ in | ||
UserDefaults.standard["outputQuality"] = self.qualitySlider.doubleValue | ||
estimateFileSize() | ||
} | ||
|
||
dimensionsSlider.triggerAction() | ||
} | ||
} |
Oops, something went wrong.