Add AV1 to decoders

This commit is contained in:
patcarter883 2024-03-22 12:35:45 +00:00
parent 82796c3801
commit fa094782c7
3 changed files with 75 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import * as VideoDefault from './video/Default';
import * as VideoToolbox from './video/VideoToolbox';
import * as VP8CUVID from './video/VP8CUVID';
import * as VP9CUVID from './video/VP9CUVID';
import * as AV1NVDEC from './video/AV1NVDEC';
class Registry {
constructor(type) {
@ -112,6 +113,7 @@ const videoRegistry = new Registry('video');
videoRegistry.Register(VideoDefault);
videoRegistry.Register(VideoToolbox);
videoRegistry.Register(AV1NVDEC);
videoRegistry.Register(NVDEC);
videoRegistry.Register(H264MMAL);
videoRegistry.Register(H264CUVID);

View File

@ -0,0 +1,72 @@
import React from 'react';
import Helper from '../../helper';
function init(initialState) {
const state = {
...initialState,
};
return state;
}
function createMapping(settings, stream, skills) {
stream = Helper.InitStream(stream);
skills = Helper.InitSkills(skills);
const mapping = {
global: [],
local: ['-hwaccel', 'nvdec', '-c:v', 'av1'],
};
return mapping;
}
function Coder(props) {
const settings = init(props.settings);
const stream = Helper.InitStream(props.stream);
const skills = Helper.InitSkills(props.skills);
const handleChange = (newSettings) => {
let automatic = false;
if (!newSettings) {
newSettings = settings;
automatic = true;
}
props.onChange(newSettings, createMapping(newSettings, stream, skills), automatic);
};
React.useEffect(() => {
handleChange(null);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return null;
}
Coder.defaultProps = {
stream: {},
settings: {},
skills: {},
onChange: function (settings, mapping) {},
};
// -hwaccel nvdec
const coder = 'cuda';
const name = 'AV1 NVDEC (CUDA)';
const codecs = ['av1'];
const type = 'video';
const hwaccel = true;
function defaults(stream, skills) {
const settings = init({});
return {
settings: settings,
mapping: createMapping(settings, stream, skills),
};
}
export { coder, name, codecs, type, hwaccel, defaults, Coder as component };

View File

@ -16,7 +16,7 @@ function createMapping(settings, stream, skills) {
const mapping = {
global: [],
local: ['-hwaccel', 'cuda', '-hwaccel_output_format', 'cuda'],
local: ['-hwaccel', 'cuda', '-hwaccel_output_format', 'cuda', '-noautoscale'],
};
return mapping;