mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
feat(youtube): add force-opus-codec
patch
This commit is contained in:
@ -0,0 +1,41 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.forceopus.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.shared.patch.opus.AbstractOpusCodecsPatch
|
||||||
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.integrations.Constants.MISC_PATH
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("force-opus-codec")
|
||||||
|
@Description("Forces the opus codec for audios.")
|
||||||
|
@DependsOn([SettingsPatch::class])
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class ForceOpusCodecPatch : AbstractOpusCodecsPatch(
|
||||||
|
"$MISC_PATH/CodecOverridePatch;->shouldForceOpus()Z"
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
super.execute(context)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings
|
||||||
|
*/
|
||||||
|
SettingsPatch.addPreference(
|
||||||
|
arrayOf(
|
||||||
|
"SETTINGS: ENABLE_OPUS_CODEC"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
SettingsPatch.updatePatchStatus("force-opus-codec")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user