mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-03 14:02:01 +00:00
lazy initialization
This commit is contained in:
parent
83d6e4118b
commit
f675d26a5d
1 changed files with 7 additions and 1 deletions
|
@ -4,11 +4,14 @@ using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Nvdec.H264
|
namespace Ryujinx.Graphics.Nvdec.H264
|
||||||
{
|
{
|
||||||
unsafe class FFmpegContext : IDisposable
|
unsafe class FFmpegContext : IDisposable
|
||||||
{
|
{
|
||||||
|
private static int _isInitialized;
|
||||||
|
|
||||||
private readonly av_log_set_callback_callback _logFunc;
|
private readonly av_log_set_callback_callback _logFunc;
|
||||||
private readonly AVCodec* _codec;
|
private readonly AVCodec* _codec;
|
||||||
private AVPacket* _packet;
|
private AVPacket* _packet;
|
||||||
|
@ -31,9 +34,12 @@ namespace Ryujinx.Graphics.Nvdec.H264
|
||||||
}
|
}
|
||||||
|
|
||||||
static FFmpegContext()
|
static FFmpegContext()
|
||||||
|
{
|
||||||
|
if (Interlocked.Exchange(ref _isInitialized, 1) == 0)
|
||||||
{
|
{
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void SetRootPath()
|
private static void SetRootPath()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue