Skip to content

Commit

Permalink
fix color, fix hdr bit depth, fix video trimmer
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyun6 committed Feb 4, 2025
1 parent cf73c8c commit a312164
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 38 deletions.
8 changes: 4 additions & 4 deletions QuickRecorder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@
CODE_SIGN_ENTITLEMENTS = QuickRecorder/QuickRecorder.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 164;
CURRENT_PROJECT_VERSION = 165;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"QuickRecorder/Preview Content\"";
DEVELOPMENT_TEAM = L4T783637F;
Expand All @@ -505,7 +505,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.3;
MARKETING_VERSION = 1.6.4;
MARKETING_VERSION = 1.6.5;
PRODUCT_BUNDLE_IDENTIFIER = com.lihaoyun6.QuickRecorder;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -521,7 +521,7 @@
CODE_SIGN_ENTITLEMENTS = QuickRecorder/QuickRecorder.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 164;
CURRENT_PROJECT_VERSION = 165;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"QuickRecorder/Preview Content\"";
DEVELOPMENT_TEAM = L4T783637F;
Expand All @@ -539,7 +539,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.3;
MARKETING_VERSION = 1.6.4;
MARKETING_VERSION = 1.6.5;
PRODUCT_BUNDLE_IDENTIFIER = com.lihaoyun6.QuickRecorder;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
4 changes: 2 additions & 2 deletions QuickRecorder/QuickRecorderApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, SCStreamDelegate, SCStreamOu
let w1 = NSApp.windows.filter({ !$0.title.contains("Item-0") && !$0.title.isEmpty && $0.isVisible })
let w2 = w1.filter({ !$0.title.contains(".qma") })
if (!w1.isEmpty && w2.isEmpty) || w1.isEmpty {
let offset = (!showOnDock && !showMenubar) ? 128 : 0
let width = isMacOS12 ? 800 : 927
let offset = (!showOnDock && !showMenubar) ? 127 : 0
let width = isMacOS12 ? 800 : 928
let mainPanel = EscPanel(contentRect: NSRect(x: 0, y: 0, width: width + offset, height: 100), styleMask: [.fullSizeContentView, .nonactivatingPanel], backing: .buffered, defer: false)
mainPanel.contentView = NSHostingView(rootView: ContentView())
mainPanel.title = "QuickRecorder".local
Expand Down
7 changes: 4 additions & 3 deletions QuickRecorder/RecordEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ extension AppDelegate {
conf.showsCursor = showMouse || fastStart
if background.rawValue != BackgroundType.wallpaper.rawValue { conf.backgroundColor = SCContext.getBackgroundColor() }
if !recordHDR {
conf.pixelFormat = kCVPixelFormatType_32BGRA
conf.colorSpaceName = CGColorSpace.sRGB
if withAlpha { conf.pixelFormat = kCVPixelFormatType_32BGRA }
//if withAlpha { conf.pixelFormat = kCVPixelFormatType_32BGRA }
}
}

Expand Down Expand Up @@ -311,7 +312,7 @@ extension AppDelegate {
default: qualityMultiplier = 1.0
}
let h264Level = AVVideoProfileLevelH264HighAutoLevel
let h265Level = kVTProfileLevel_HEVC_Main_AutoLevel as String
let h265Level = (recordHDR ? kVTProfileLevel_HEVC_Main10_AutoLevel : kVTProfileLevel_HEVC_Main_AutoLevel) as String
let targetBitrate = resolution * fpsMultiplier * encoderMultiplier * qualityMultiplier
var videoSettings: [String: Any] = [
AVVideoCodecKey: encoderIsH265 ? ((withAlpha && !recordHDR) ? AVVideoCodecType.hevcWithAlpha : AVVideoCodecType.hevc) : AVVideoCodecType.h264,
Expand All @@ -329,7 +330,7 @@ extension AppDelegate {
videoSettings[AVVideoColorPropertiesKey] = [
AVVideoTransferFunctionKey: AVVideoTransferFunction_ITU_R_709_2,
AVVideoColorPrimariesKey: AVVideoColorPrimaries_ITU_R_709_2,
AVVideoYCbCrMatrixKey: AVVideoYCbCrMatrix_ITU_R_709_2 ] as [String : Any]
AVVideoYCbCrMatrixKey: AVVideoYCbCrMatrix_ITU_R_709_2] as [String : Any]
}

SCContext.vwInput = AVAssetWriterInput(mediaType: AVMediaType.video, outputSettings: videoSettings)
Expand Down
45 changes: 16 additions & 29 deletions QuickRecorder/ViewModel/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct ContentView: View {
@State private var infoGlowing = false
@State private var micGlowing = false
@State private var isPopoverShowing = false
@State private var isPopoverShowing2 = false
@State private var micList = SCContext.getMicrophone()
@AppStorage("enableAEC") private var enableAEC: Bool = false
@AppStorage("recordMic") private var recordMic: Bool = false
Expand Down Expand Up @@ -195,15 +196,26 @@ struct ContentView: View {
}, label: {
SelectorView(title: "Window".local, symbol: "macwindow").cornerRadius(8)
}).buttonStyle(.plain)
/*Divider().frame(height: 70)
Button(action: {
isPopoverShowing2 = true
}, label: {
SelectorView(title: "Camera".local, symbol: "camera").cornerRadius(8)
})
.buttonStyle(.plain)
.popover(isPresented: $isPopoverShowing2, arrowEdge: .bottom) {
CameraPopoverView(closePopover: { isPopoverShowing2 = false })
}*/
Divider().frame(height: 70)
Button(action: {
isPopoverShowing = true
}, label: {
SelectorView(title: "Mobile Device".local, symbol: "apps.ipad").cornerRadius(8)
}).buttonStyle(.plain)
.popover(isPresented: $isPopoverShowing, arrowEdge: .bottom) {
iDevicePopoverView(closePopover: { isPopoverShowing = false })
}
})
.buttonStyle(.plain)
.popover(isPresented: $isPopoverShowing, arrowEdge: .bottom) {
iDevicePopoverView(closePopover: { isPopoverShowing = false })
}
Divider().frame(height: 70)
Button(action: {
closeMainWindow()
Expand Down Expand Up @@ -239,31 +251,6 @@ struct ContentView: View {
}
}.focusable(false)
}

struct FlakeView: View {
var emoji: String
var width: CGFloat = 1100
@State private var opacity: CGFloat = Double.random(in: 0.1...0.9)
@State private var flakeYPosition: CGFloat = -30
@State private var flakeXPosition: CGFloat = CGFloat.random(in: 0...1050)
private let flakeSize: CGFloat = CGFloat.random(in: 12...30)
private let animationDuration: Double = Double.random(in: 4...12)

var body: some View {
Text(emoji)
.font(.system(size: flakeSize))
.opacity(opacity)
.rotationEffect(Angle(degrees: Double.random(in: 0...359)))
.position(x: flakeXPosition, y: flakeYPosition)
.onAppear {
withAnimation(Animation.linear(duration: animationDuration).repeatForever(autoreverses: false)) {
opacity -= 0.5
flakeYPosition = 130
flakeXPosition += CGFloat.random(in: -70...70)
}
}
}
}
}

struct SelectorView: View {
Expand Down
1 change: 1 addition & 0 deletions QuickRecorder/ViewModel/VideoEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ struct VideoTrimmerView: View {
}
.padding(.top, -22)
.background(WindowAccessor(onWindowOpen: { window in
window?.styleMask.insert(.resizable)
playerViewModel.nsWindow = window
SCContext.trimingList.append(videoURL)
}, onWindowClose: {
Expand Down
1 change: 1 addition & 0 deletions QuickRecorder/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Screen" = "录制全屏画面";
"Application" = "录制应用程序";
"Window" = "录制窗口内容";
//"Camera" = "录制摄像头";
"Mobile Device" = "录制移动设备";
"Preferences" = "偏好设置";
"No Title" = "无标题";
Expand Down
1 change: 1 addition & 0 deletions QuickRecorder/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Screen" = "錄製整個螢幕";
"Application" = "錄製應用程式";
"Window" = "錄製視窗內容";
//"Camera" = "網路攝影機";
"Mobile Device" = "錄製行動裝置";
"Preferences" = "偏好設定";
"No Title" = "無標題";
Expand Down

0 comments on commit a312164

Please sign in to comment.