-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from rodit/high-quality
High quality
- Loading branch information
Showing
11 changed files
with
280 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
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
55 changes: 55 additions & 0 deletions
55
app/src/main/java/xyz/rodit/snapmod/features/tweaks/CameraResolution.kt
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,55 @@ | ||
package xyz.rodit.snapmod.features.tweaks | ||
|
||
import xyz.rodit.snapmod.features.Feature | ||
import xyz.rodit.snapmod.features.FeatureContext | ||
import xyz.rodit.snapmod.mappings.MediaQualityLevel | ||
import xyz.rodit.snapmod.mappings.RecordingCodecConfiguration | ||
import xyz.rodit.snapmod.mappings.ScCameraSettings | ||
import xyz.rodit.snapmod.mappings.TranscodingRequest | ||
import xyz.rodit.snapmod.util.after | ||
import xyz.rodit.snapmod.util.getNonDefault | ||
import xyz.rodit.snapmod.util.getResolution | ||
|
||
class CameraResolution(context: FeatureContext) : Feature(context) { | ||
|
||
override fun performHooks() { | ||
// Override preview and picture resolution | ||
ScCameraSettings.constructors.after { | ||
val settings = ScCameraSettings.wrap(it.thisObject) | ||
context.config.getResolution("custom_video_resolution")?.let { r -> | ||
val previewResolution = settings.previewResolution | ||
if (previewResolution.isNotNull) { | ||
previewResolution.width = r.width | ||
previewResolution.height = r.height | ||
} | ||
} | ||
|
||
context.config.getResolution("custom_image_resolution")?.let { r -> | ||
val pictureResolution = settings.pictureResolution | ||
if (pictureResolution.isNotNull) { | ||
pictureResolution.width = r.width | ||
pictureResolution.height = r.height | ||
} | ||
} | ||
} | ||
|
||
// Override actual recording resolution | ||
RecordingCodecConfiguration.constructors.after { | ||
val config = RecordingCodecConfiguration.wrap(it.thisObject) | ||
context.config.getResolution("custom_video_resolution")?.let { r -> | ||
val res = config.resolution | ||
res.width = r.width | ||
res.height = r.height | ||
} | ||
|
||
context.config.getNonDefault("custom_video_bitrate")?.let { bitrate -> | ||
config.bitrate = bitrate | ||
} | ||
} | ||
|
||
// Override save/send quality level | ||
TranscodingRequest.constructors.after(context, "force_source_encoding") { | ||
TranscodingRequest.wrap(it.thisObject).qualityLevel = MediaQualityLevel.LEVEL_MAX() | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.