mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 16:44:29 +02:00
feat(YouTube/Video playback): add Disable VP9 codec
setting https://github.com/inotia00/ReVanced_Extended/issues/2384
This commit is contained in:
parent
6587ba7fee
commit
753a44f67c
@ -30,6 +30,7 @@ import app.revanced.patches.youtube.video.playback.fingerprints.PlaybackSpeedCha
|
||||
import app.revanced.patches.youtube.video.playback.fingerprints.PlaybackSpeedInitializeFingerprint
|
||||
import app.revanced.patches.youtube.video.playback.fingerprints.QualityChangedFromRecyclerViewFingerprint
|
||||
import app.revanced.patches.youtube.video.playback.fingerprints.QualitySetterFingerprint
|
||||
import app.revanced.patches.youtube.video.playback.fingerprints.VP9CapabilityFingerprint
|
||||
import app.revanced.patches.youtube.video.videoid.VideoIdPatch
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.getStringInstructionIndex
|
||||
@ -72,7 +73,8 @@ object VideoPlaybackPatch : BaseBytecodePatch(
|
||||
QualityChangedFromRecyclerViewFingerprint,
|
||||
QualityMenuViewInflateFingerprint,
|
||||
QualitySetterFingerprint,
|
||||
VideoEndFingerprint
|
||||
VideoEndFingerprint,
|
||||
VP9CapabilityFingerprint
|
||||
)
|
||||
) {
|
||||
private const val PLAYBACK_SPEED_MENU_FILTER_CLASS_DESCRIPTOR =
|
||||
@ -81,6 +83,8 @@ object VideoPlaybackPatch : BaseBytecodePatch(
|
||||
"$COMPONENTS_PATH/VideoQualityMenuFilter;"
|
||||
private const val INTEGRATIONS_AV1_CODEC_CLASS_DESCRIPTOR =
|
||||
"$VIDEO_PATH/AV1CodecPatch;"
|
||||
private const val INTEGRATIONS_VP9_CODEC_CLASS_DESCRIPTOR =
|
||||
"$VIDEO_PATH/VP9CodecPatch;"
|
||||
private const val INTEGRATIONS_CUSTOM_PLAYBACK_SPEED_CLASS_DESCRIPTOR =
|
||||
"$VIDEO_PATH/CustomPlaybackSpeedPatch;"
|
||||
private const val INTEGRATIONS_HDR_VIDEO_CLASS_DESCRIPTOR =
|
||||
@ -326,6 +330,21 @@ object VideoPlaybackPatch : BaseBytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for disable VP9 codec
|
||||
|
||||
VP9CapabilityFingerprint.resultOrThrow().mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $INTEGRATIONS_VP9_CODEC_CLASS_DESCRIPTOR->disableVP9Codec()Z
|
||||
move-result v0
|
||||
if-nez v0, :default
|
||||
return v0
|
||||
""", ExternalLabel("default", getInstruction(0))
|
||||
)
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
|
@ -0,0 +1,14 @@
|
||||
package app.revanced.patches.youtube.video.playback.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object VP9CapabilityFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "Z",
|
||||
strings = listOf(
|
||||
"vp9_supported",
|
||||
"video/x-vnd.on2.vp9"
|
||||
)
|
||||
)
|
@ -1295,6 +1295,13 @@ Info:
|
||||
<string name="revanced_spoof_device_dimensions_title">Spoof device dimensions</string>
|
||||
<string name="revanced_spoof_device_dimensions_summary">"Spoofs the device dimensions to the maximum value.
|
||||
High quality may be unlocked on some videos that require high device dimensions, but not all videos."</string>
|
||||
<string name="revanced_disable_vp9_codec_title">Disable VP9 codec</string>
|
||||
<string name="revanced_disable_vp9_codec_summary_on">"VP9 codec is disabled.
|
||||
|
||||
• Maximum resolution is 1080p.
|
||||
• Video playback will use more internet data than VP9.
|
||||
• To get HDR playback, HDR video still uses the VP9 codec."</string>
|
||||
<string name="revanced_disable_vp9_codec_summary_off">VP9 codec is enabled.</string>
|
||||
<string name="revanced_replace_av1_codec_title">Replace software AV1 codec</string>
|
||||
<string name="revanced_replace_av1_codec_summary">Replaces the software AV1 codec with the VP9 codec.</string>
|
||||
<string name="revanced_reject_av1_codec_title">Reject software AV1 codec response</string>
|
||||
|
@ -590,7 +590,8 @@
|
||||
<SwitchPreference android:title="@string/revanced_enable_default_playback_speed_shorts_title" android:key="revanced_enable_default_playback_speed_shorts" android:summaryOn="@string/revanced_enable_default_playback_speed_shorts_summary_on" android:summaryOff="@string/revanced_enable_default_playback_speed_shorts_summary_off" />
|
||||
<SwitchPreference android:title="@string/revanced_skip_preloaded_buffer_title" android:key="revanced_skip_preloaded_buffer" android:summary="@string/revanced_skip_preloaded_buffer_summary" />
|
||||
<SwitchPreference android:title="@string/revanced_skip_preloaded_buffer_toast_title" android:key="revanced_skip_preloaded_buffer_toast" android:summaryOn="@string/revanced_skip_preloaded_buffer_toast_summary_on" android:summaryOff="@string/revanced_skip_preloaded_buffer_toast_summary_off" android:dependency="revanced_skip_preloaded_buffer" />
|
||||
<SwitchPreference android:title="@string/revanced_spoof_device_dimensions_title" android:key="revanced_spoof_device_dimensions" android:summary="@string/revanced_spoof_device_dimensions_summary" />PREFERENCE_SCREEN: VIDEO -->
|
||||
<SwitchPreference android:title="@string/revanced_spoof_device_dimensions_title" android:key="revanced_spoof_device_dimensions" android:summary="@string/revanced_spoof_device_dimensions_summary" />
|
||||
<SwitchPreference android:title="@string/revanced_disable_vp9_codec_title" android:key="revanced_disable_vp9_codec" android:summaryOn="@string/revanced_disable_vp9_codec_summary_on" android:summaryOff="@string/revanced_disable_vp9_codec_summary_off" />PREFERENCE_SCREEN: VIDEO -->
|
||||
|
||||
<!-- SETTINGS: REPLACE_AV1_CODEC
|
||||
<SwitchPreference android:title="@string/revanced_replace_av1_codec_title" android:key="revanced_replace_av1_codec" android:summary="@string/revanced_replace_av1_codec_summary" />SETTINGS: REPLACE_AV1_CODEC -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user