feat(camera): custom frame rate

- experimental disable cameras
This commit is contained in:
rhunk
2024-01-14 00:35:55 +01:00
parent 1f4eb18aa8
commit 2905fe6e2d
3 changed files with 64 additions and 26 deletions

View File

@ -532,9 +532,9 @@
"name": "Camera",
"description": "Adjust the right settings for the perfect snap",
"properties": {
"disable_camera": {
"name": "Disable Camera",
"description": "Prevents Snapchat from using the cameras available on your device"
"disable_cameras": {
"name": "Disable Cameras",
"description": "Prevents Snapchat from using the selected cameras"
},
"black_photos": {
"name": "Black Photos",
@ -556,9 +556,13 @@
"name": "Custom Resolution",
"description": "Sets a custom camera resolution, width x height (e.g. 1920x1080).\nThe custom resolution must be supported by your device"
},
"custom_frame_rate": {
"name": "Custom Frame Rate",
"description": "Overrides the camera frame rate"
"front_custom_frame_rate": {
"name": "Front Custom Frame Rate",
"description": "Overrides the front camera frame rate"
},
"back_custom_frame_rate": {
"name": "Back Custom Frame Rate",
"description": "Overrides the back camera frame rate"
},
"force_camera_source_encoding": {
"name": "Force Camera Source Encoding",
@ -866,6 +870,10 @@
"friends": "Friends",
"following": "Following",
"discover": "Discover"
},
"disable_cameras":{
"front": "Front Camera",
"back": "Back Camera"
}
}
},

View File

@ -13,6 +13,7 @@ import me.rhunk.snapenhance.common.logger.AbstractLogger
class Camera : ConfigContainer() {
companion object {
private val defaultResolutions = listOf("3264x2448", "3264x1840", "3264x1504", "2688x1512", "2560x1920", "2448x2448", "2340x1080", "2160x1080", "1920x1440", "1920x1080", "1600x1200", "1600x960", "1600x900", "1600x736", "1600x720", "1560x720", "1520x720", "1440x1080", "1440x720", "1280x720", "1080x1080", "1080x720", "960x720", "720x720", "720x480", "640x480", "352x288", "320x240", "176x144").toTypedArray()
private val customFrameRates = arrayOf("5", "10", "20", "25", "30", "48", "60", "90", "120")
}
private lateinit var _overrideFrontResolution: PropertyValue<String>
@ -49,13 +50,12 @@ class Camera : ConfigContainer() {
{ addFlags(ConfigFlag.NO_TRANSLATE) }
}
val disable = boolean("disable_camera")
val disableCameras = multiple("disable_cameras", "front", "back") { addNotices(FeatureNotice.INTERNAL_BEHAVIOR); requireRestart() }
val immersiveCameraPreview = boolean("immersive_camera_preview") { addNotices(FeatureNotice.UNSTABLE) }
val blackPhotos = boolean("black_photos")
val customFrameRate = unique("custom_frame_rate",
"5", "10", "20", "25", "30", "48", "60", "90", "120"
) { addNotices(FeatureNotice.UNSTABLE); addFlags(ConfigFlag.NO_TRANSLATE) }
val hevcRecording = boolean("hevc_recording") { requireRestart(); addNotices(FeatureNotice.UNSTABLE) }
val frontCustomFrameRate = unique("front_custom_frame_rate", *customFrameRates) { requireRestart(); addFlags(ConfigFlag.NO_TRANSLATE) }
val backCustomFrameRate = unique("back_custom_frame_rate", *customFrameRates) { requireRestart(); addFlags(ConfigFlag.NO_TRANSLATE) }
val hevcRecording = boolean("hevc_recording") { requireRestart() }
val forceCameraSourceEncoding = boolean("force_camera_source_encoding")
val overrideFrontResolution get() = _overrideFrontResolution
val overrideBackResolution get() = _overrideBackResolution