Add AV1 to decoders
This commit is contained in:
parent
82796c3801
commit
fa094782c7
@ -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);
|
||||
|
||||
72
src/misc/coders/Decoders/video/AV1NVDEC.js
Normal file
72
src/misc/coders/Decoders/video/AV1NVDEC.js
Normal 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 };
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user