mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-28 12:30:12 +02:00
revert: fix custom camera frame rate
This commit is contained in:
parent
3718fa3e2f
commit
fcf82de988
@ -18,7 +18,6 @@ import me.rhunk.snapenhance.core.util.hook.hook
|
||||
import me.rhunk.snapenhance.core.util.ktx.setObjectField
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.nio.ByteBuffer
|
||||
import kotlin.math.abs
|
||||
|
||||
class CameraTweaks : Feature("Camera Tweaks", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) {
|
||||
|
||||
@ -92,16 +91,7 @@ class CameraTweaks : Feature("Camera Tweaks", loadParams = FeatureLoadParams.ACT
|
||||
arrayOf(CameraCharacteristics.LENS_FACING)
|
||||
) == CameraCharacteristics.LENS_FACING_FRONT
|
||||
val customFrameRate = (if (isFrontCamera) config.frontCustomFrameRate.getNullable() else config.backCustomFrameRate.getNullable())?.toIntOrNull() ?: return@hook
|
||||
val fpsRanges = param.getResult() as? Array<*> ?: return@hook
|
||||
|
||||
param.setResult(arrayOf(Range(customFrameRate, customFrameRate)))
|
||||
if (customFrameRate <= 30) return@hook
|
||||
|
||||
val closestMaxFps = fpsRanges.mapNotNull {
|
||||
(it as? Range<*>)?.upper?.toString()?.toIntOrNull()
|
||||
}.minByOrNull { abs(it - customFrameRate) } ?: return@hook
|
||||
|
||||
param.setResult(arrayOf(Range(closestMaxFps, closestMaxFps)))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user