-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIDecoder.cs
34 lines (30 loc) · 1020 Bytes
/
IDecoder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
namespace VVVV.DX11.ImagePlayer
{
public enum DecoderChoice
{
Automatic, DirectX, WIC
}
public interface IDecoder : IDisposable
{
SlimDX.Direct3D11.Device Device { get; set; }
SlimDX.Direct3D11.Texture2DDescription Description { get; }
SlimDX.Direct3D11.ShaderResourceView SRV { get; }
void Load(string filename, System.Threading.CancellationToken token);
}
static class Decoder
{
public static IDecoder SelectFromFile(DecoderChoice decoderChoice, System.IO.FileInfo file, MemoryPool memPool)
{
if (decoderChoice == DecoderChoice.Automatic)
{
var ext = file.Extension.ToLower();
decoderChoice = ext.Contains(".dds") ? DecoderChoice.DirectX : DecoderChoice.WIC;
}
if (decoderChoice == DecoderChoice.DirectX)
return new GPUDecoder();
else
return new WICDecoder(memPool);
}
}
}