mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 14:13:01 -04:00
fixes
This commit is contained in:
parent
ad68c06975
commit
d31d87fa87
2 changed files with 80 additions and 0 deletions
76
src/equicordplugins/streamingCodecDisabler/index.ts
Normal file
76
src/equicordplugins/streamingCodecDisabler/index.ts
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2025 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { definePluginSettings, Settings } from "@api/Settings";
|
||||||
|
import { EquicordDevs } from "@utils/constants";
|
||||||
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
import { findStoreLazy } from "@webpack";
|
||||||
|
|
||||||
|
let mediaEngine = findStoreLazy("MediaEngineStore");
|
||||||
|
|
||||||
|
let originalCodecStatuses: {
|
||||||
|
AV1: boolean,
|
||||||
|
H265: boolean,
|
||||||
|
H264: boolean;
|
||||||
|
} = {
|
||||||
|
AV1: true,
|
||||||
|
H265: true,
|
||||||
|
H264: true
|
||||||
|
};
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "StreamingCodecDisabler",
|
||||||
|
description: "Disable codecs for streaming of your choice! (for multi-gpu setups and forcing encoding on a non-primary (and less capable) gpu)",
|
||||||
|
authors: [EquicordDevs.davidkra230],
|
||||||
|
settings: definePluginSettings({
|
||||||
|
disableAv1Codec: {
|
||||||
|
description: "Make Discord not consider using AV1 for streaming.",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
disableH265Codec: {
|
||||||
|
description: "Make Discord not consider using H265 for streaming.",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
disableH264Codec: {
|
||||||
|
description: "Make Discord not consider using H264 for streaming.",
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: "setVideoBroadcast(this.shouldConnectionBroadcastVideo",
|
||||||
|
replacement: {
|
||||||
|
match: /setGoLiveSource\(.,.\)\{/,
|
||||||
|
replace: "$&$self.updateDisabledCodecs();"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
async updateDisabledCodecs() {
|
||||||
|
mediaEngine.setAv1Enabled(originalCodecStatuses.AV1 && !Settings.plugins.StreamingCodecDisabler.disableAV1Codec);
|
||||||
|
mediaEngine.setH265Enabled(originalCodecStatuses.H265 && !Settings.plugins.StreamingCodecDisabler.disableH265Codec);
|
||||||
|
mediaEngine.setH264Enabled(originalCodecStatuses.H264 && !Settings.plugins.StreamingCodecDisabler.disableH264Codec);
|
||||||
|
},
|
||||||
|
|
||||||
|
async start() {
|
||||||
|
mediaEngine = mediaEngine.getMediaEngine();
|
||||||
|
let options = Object.keys(originalCodecStatuses);
|
||||||
|
// [{"codec":"","decode":false,"encode":false}]
|
||||||
|
let CodecCapabilities = JSON.parse(await new Promise((res) => mediaEngine.getCodecCapabilities(res)));
|
||||||
|
CodecCapabilities.forEach((codec: { codec: string; encode: boolean; }) => {
|
||||||
|
if (options.includes(codec.codec)) {
|
||||||
|
originalCodecStatuses[codec.codec] = codec.encode;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async stop() {
|
||||||
|
mediaEngine.setAv1Enabled(originalCodecStatuses.AV1);
|
||||||
|
mediaEngine.setH265Enabled(originalCodecStatuses.H265);
|
||||||
|
mediaEngine.setH264Enabled(originalCodecStatuses.H264);
|
||||||
|
}
|
||||||
|
});
|
|
@ -1078,6 +1078,10 @@ export const EquicordDevs = Object.freeze({
|
||||||
name: "bbgaming25k",
|
name: "bbgaming25k",
|
||||||
id: 851222385528274964n,
|
id: 851222385528274964n,
|
||||||
},
|
},
|
||||||
|
davidkra230: {
|
||||||
|
name: "davidkra230",
|
||||||
|
id: 652699312631054356n,
|
||||||
|
},
|
||||||
} satisfies Record<string, Dev>);
|
} satisfies Record<string, Dev>);
|
||||||
|
|
||||||
// iife so #__PURE__ works correctly
|
// iife so #__PURE__ works correctly
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue