blob: f710cf0828c51aa38fd07cfb72c90bbf9c36d12b (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
|
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Video.DirectCapture;
namespace Tango.MachineStudio.Common.Video
{
/// <summary>
/// Represents the default implementation of <see cref="IVideoCaptureProvider"/>.
/// </summary>
/// <seealso cref="Tango.MachineStudio.Common.Video.IVideoCaptureProvider" />
public class DefaultVideoCaptureProvider : IVideoCaptureProvider
{
/// <summary>
/// Gets the available capture devices.
/// </summary>
public ObservableCollection<CaptureDevice> AvailableCaptureDevices { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="DefaultVideoCaptureProvider"/> class.
/// </summary>
public DefaultVideoCaptureProvider()
{
AvailableCaptureDevices = new ObservableCollection<CaptureDevice>();
var availableDevices = CaptureDevice.GetAvailableCaptureDevices();
for (int i = 0; i < availableDevices.Count; i++)
{
AvailableCaptureDevices.Add(new CaptureDevice() { Device = availableDevices[i] });
}
while (AvailableCaptureDevices.Count < 3)
{
AvailableCaptureDevices.Add(new CaptureDevice()
{
Device = null,
});
}
}
}
}
|