feat(YouTube): add Enable OPUS codec patch

This commit is contained in:
inotia00 2024-06-11 03:57:12 +09:00
parent 89dd62de26
commit ac6c4d885d
4 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,8 @@
package app.revanced.patches.youtube.misc.codecs
import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH
import app.revanced.patches.shared.opus.BaseOpusCodecsPatch
object OpusCodecBytecodePatch : BaseOpusCodecsPatch(
"$MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z"
)

View File

@ -0,0 +1,33 @@
package app.revanced.patches.youtube.misc.codecs
import app.revanced.patcher.data.ResourceContext
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.patch.BaseResourcePatch
@Suppress("unused")
object OpusCodecPatch : BaseResourcePatch(
name = "Enable OPUS codec",
description = "Adds an options to enable the OPUS audio codec if the player response includes.",
dependencies = setOf(
OpusCodecBytecodePatch::class,
SettingsPatch::class
),
compatiblePackages = COMPATIBLE_PACKAGE
) {
override fun execute(context: ResourceContext) {
/**
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE_CATEGORY: MISC_EXPERIMENTAL_FLAGS",
"SETTINGS: ENABLE_OPUS_CODEC"
)
)
SettingsPatch.updatePatchStatus(this)
}
}

View File

@ -1433,6 +1433,9 @@ Tap on the continue button and disable battery optimizations."</string>
<string name="revanced_disable_quic_protocol_title">Disable QUIC protocol</string> <string name="revanced_disable_quic_protocol_title">Disable QUIC protocol</string>
<string name="revanced_disable_quic_protocol_summary">"Disable CronetEngine's QUIC protocol."</string> <string name="revanced_disable_quic_protocol_summary">"Disable CronetEngine's QUIC protocol."</string>
<string name="revanced_enable_opus_codec_title">Enable OPUS codec</string>
<string name="revanced_enable_opus_codec_summary">Enable the OPUS codec if the player response includes the OPUS codec.</string>
<string name="revanced_spoof_player_parameter_title">Spoof player parameter</string> <string name="revanced_spoof_player_parameter_title">Spoof player parameter</string>
<string name="revanced_spoof_player_parameter_summary">"Spoofs player parameters to prevent playback issues. <string name="revanced_spoof_player_parameter_summary">"Spoofs player parameters to prevent playback issues.

View File

@ -599,6 +599,9 @@
<!-- PREFERENCE_CATEGORY: MISC_EXPERIMENTAL_FLAGS <!-- PREFERENCE_CATEGORY: MISC_EXPERIMENTAL_FLAGS
<PreferenceCategory android:title="@string/revanced_preference_category_experimental_flag" android:layout="@layout/revanced_settings_preferences_category"/>PREFERENCE_CATEGORY: MISC_EXPERIMENTAL_FLAGS --> <PreferenceCategory android:title="@string/revanced_preference_category_experimental_flag" android:layout="@layout/revanced_settings_preferences_category"/>PREFERENCE_CATEGORY: MISC_EXPERIMENTAL_FLAGS -->
<!-- SETTINGS: ENABLE_OPUS_CODEC
<SwitchPreference android:title="@string/revanced_enable_opus_codec_title" android:key="revanced_enable_opus_codec" android:summary="@string/revanced_enable_opus_codec_summary" />SETTINGS: ENABLE_OPUS_CODEC -->
<!-- SETTINGS: SPOOF_PLAYER_PARAMETER <!-- SETTINGS: SPOOF_PLAYER_PARAMETER
<SwitchPreference android:title="@string/revanced_spoof_player_parameter_title" android:key="revanced_spoof_player_parameter" android:summary="@string/revanced_spoof_player_parameter_summary" /> <SwitchPreference android:title="@string/revanced_spoof_player_parameter_title" android:key="revanced_spoof_player_parameter" android:summary="@string/revanced_spoof_player_parameter_summary" />
<SwitchPreference android:title="@string/revanced_spoof_player_parameter_in_feed_title" android:key="revanced_spoof_player_parameter_in_feed" android:summaryOn="@string/revanced_spoof_player_parameter_in_feed_summary_on" android:summaryOff="@string/revanced_spoof_player_parameter_in_feed_summary_off" android:dependency="revanced_spoof_player_parameter" />SETTINGS: SPOOF_PLAYER_PARAMETER --> <SwitchPreference android:title="@string/revanced_spoof_player_parameter_in_feed_title" android:key="revanced_spoof_player_parameter_in_feed" android:summaryOn="@string/revanced_spoof_player_parameter_in_feed_summary_on" android:summaryOff="@string/revanced_spoof_player_parameter_in_feed_summary_off" android:dependency="revanced_spoof_player_parameter" />SETTINGS: SPOOF_PLAYER_PARAMETER -->
@ -674,6 +677,7 @@
<Preference android:title="Enable external browser" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Enable external browser" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable minimized playback" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Enable minimized playback" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable open links directly" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Enable open links directly" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Enable OPUS codec" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Sanitize sharing links" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Sanitize sharing links" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="Spoof client" android:summary="@string/revanced_patches_excluded" android:selectable="false"/> <Preference android:title="Spoof client" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
</PreferenceCategory> </PreferenceCategory>