SHA256
41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using FFmpeg.AutoGen;
|
|
|
|
namespace ADOFAIRenderer.Data;
|
|
|
|
/// <summary>
|
|
/// Video codec of the output. The encoder implementation (hardware or software) is chosen at run time from the
|
|
/// encoders available for the codec (VideoEncoder, GPUUtil.GetPrioritizedEncoders).
|
|
/// Values: <c>H264</c> (H.264 / AVC), <c>H265</c> (H.265 / HEVC), <c>VP9</c>, <c>AV1</c>, <c>VVC</c> (H.266).
|
|
/// The audio codec paired with each value is given by CodecUtil.AudioCodecMatch.
|
|
/// </summary>
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
|
public enum Codec
|
|
{
|
|
H264, H265, VP9, AV1, VVC
|
|
}
|
|
|
|
/// <summary>Audio codec choice and supported sample rates per video codec.</summary>
|
|
internal static class CodecUtil
|
|
{
|
|
/// <summary>Audio codec encoded together with each video codec (AAC for H.264/H.265, Opus for the others).</summary>
|
|
public static readonly Dictionary<Codec, AVCodecID> AudioCodecMatch = new()
|
|
{
|
|
[Codec.H264] = AVCodecID.AV_CODEC_ID_AAC,
|
|
[Codec.H265] = AVCodecID.AV_CODEC_ID_AAC,
|
|
[Codec.VP9] = AVCodecID.AV_CODEC_ID_OPUS,
|
|
[Codec.AV1] = AVCodecID.AV_CODEC_ID_OPUS,
|
|
[Codec.VVC] = AVCodecID.AV_CODEC_ID_OPUS
|
|
};
|
|
|
|
/// <summary>
|
|
/// Output sample rates (Hz) the mod allows per audio codec. RenderManager.SetupPlay replaces a configured rate that
|
|
/// is not in the list with 48000 Hz.
|
|
/// </summary>
|
|
public static readonly Dictionary<AVCodecID, List<int>> AvailableSampleRate = new()
|
|
{
|
|
[AVCodecID.AV_CODEC_ID_AAC] = new List<int> { 44100, 48000, 96000 },
|
|
[AVCodecID.AV_CODEC_ID_OPUS] = new List<int> { 48000 }
|
|
};
|
|
} |