SHA256
Add NTSC Support for FFmpegNativeEncoder
This commit is contained in:
3 files changed
+9
-3
No files matched your search
+1
-2
@@ -1,6 +1,5 @@
|
|||||||
using ADOFAIRenderer;
|
using ADOFAIRenderer;
|
||||||
using ADOFAIRenderer.Core;
|
using ADOFAIRenderer.Core;
|
||||||
using ADOFAIRenderer.Patch.Engine;
|
|
||||||
using ADOFAIRenderer.Util;
|
using ADOFAIRenderer.Util;
|
||||||
using FFmpeg.AutoGen;
|
using FFmpeg.AutoGen;
|
||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
@@ -8,7 +7,7 @@ using MelonLoader.Utils;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.0.6-INDEV-AUDIO", "ADOFAI Editor Forum")]
|
[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.0.7-INDEV", "ADOFAI Editor Forum")]
|
||||||
[assembly: MelonGame("7th Beat Games", "A Dance of Fire and Ice")]
|
[assembly: MelonGame("7th Beat Games", "A Dance of Fire and Ice")]
|
||||||
|
|
||||||
namespace ADOFAIRenderer
|
namespace ADOFAIRenderer
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace ADOFAIRenderer.Util.Audio
|
|||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
_fpsRational = RationalUtil.Double2MaxPrecisionInt(fps);
|
_fpsRational = RationalUtil.Double2MaxPrecisionInt(fps);
|
||||||
|
|
||||||
|
// NTSC
|
||||||
if (Math.Abs(fps - 29.97) < 0.001) _fpsRational = (30000, 1001);
|
if (Math.Abs(fps - 29.97) < 0.001) _fpsRational = (30000, 1001);
|
||||||
if (Math.Abs(fps - 59.94) < 0.001) _fpsRational = (60000, 1001);
|
if (Math.Abs(fps - 59.94) < 0.001) _fpsRational = (60000, 1001);
|
||||||
if (Math.Abs(fps - 23.976) < 0.001 || Math.Abs(fps - 23.98) < 0.001) _fpsRational = (24000, 1001);
|
if (Math.Abs(fps - 23.976) < 0.001 || Math.Abs(fps - 23.98) < 0.001) _fpsRational = (24000, 1001);
|
||||||
|
|||||||
@@ -436,6 +436,12 @@ namespace ADOFAIRenderer.Util.FFmpeg
|
|||||||
//
|
//
|
||||||
// 참고: https://ffmpeg.org/doxygen/trunk/structAVCodecContext.html
|
// 참고: https://ffmpeg.org/doxygen/trunk/structAVCodecContext.html
|
||||||
var fpsRational = RationalUtil.Double2MaxPrecisionInt(_settings.FPS);
|
var fpsRational = RationalUtil.Double2MaxPrecisionInt(_settings.FPS);
|
||||||
|
|
||||||
|
// NTSC
|
||||||
|
if (Math.Abs(_settings.FPS - 29.97) < 0.001) fpsRational = (30000, 1001);
|
||||||
|
if (Math.Abs(_settings.FPS - 59.94) < 0.001) fpsRational = (60000, 1001);
|
||||||
|
if (Math.Abs(_settings.FPS - 23.976) < 0.001 || Math.Abs(_settings.FPS - 23.98) < 0.001) fpsRational = (24000, 1001);
|
||||||
|
|
||||||
_pCodecContext->time_base = new AVRational
|
_pCodecContext->time_base = new AVRational
|
||||||
{ num = fpsRational.Denominator, den = fpsRational.Numerator };
|
{ num = fpsRational.Denominator, den = fpsRational.Numerator };
|
||||||
_pCodecContext->framerate = new AVRational
|
_pCodecContext->framerate = new AVRational
|
||||||
@@ -519,7 +525,7 @@ namespace ADOFAIRenderer.Util.FFmpeg
|
|||||||
var qsvReady = false;
|
var qsvReady = false;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
bool isWindows = RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
|
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||||
string childDeviceName = isWindows ? "d3d11va" : "vaapi";
|
string childDeviceName = isWindows ? "d3d11va" : "vaapi";
|
||||||
AVHWDeviceType childDeviceType = isWindows ? AVHWDeviceType.AV_HWDEVICE_TYPE_D3D11VA : AVHWDeviceType.AV_HWDEVICE_TYPE_VAAPI;
|
AVHWDeviceType childDeviceType = isWindows ? AVHWDeviceType.AV_HWDEVICE_TYPE_D3D11VA : AVHWDeviceType.AV_HWDEVICE_TYPE_VAAPI;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user