Click or drag to resize
CaptureDeviceMulticastProvider Class
WebcamMulticastProvider allows the reuse of capture devices by buffering retrieved frames for the duration of a picture. For clients to receive frames each CaptureDeviceMulticastProviderClient instance must add itself to the provider.
Inheritance Hierarchy
SystemObject
  StreamCoders.DevicesCaptureDeviceMulticastProvider

Namespace: StreamCoders.Devices
Assembly: MediaBase (in MediaBase.dll) Version: 2.0.5.0 (2.0.5.0)
Syntax
public class CaptureDeviceMulticastProvider

The CaptureDeviceMulticastProvider type exposes the following members.

Constructors
  NameDescription
Public methodCaptureDeviceMulticastProvider
Constructs instance of a provider. Multiple instances of CaptureDeviceMulticastProvider with the same capture device are not permitted.
Top
Properties
  NameDescription
Public propertyCaptureDevice
Gets the capture device used in this instance of the multicast provider.
Top
Methods
  NameDescription
Public methodAddClient
Adds a client to the provider.
Public methodRemoveClient
Removes a client from the provider.
Public methodStart
Starts this CaptureDeviceMulticastProvider.
Public methodStop
Stops this CaptureDeviceMulticastProvider.
Top
Extension Methods
  NameDescription
Public Extension MethodCopyOverloaded.
Creates a copy of the object.
(Defined by ObjectExtensions.)
Public Extension MethodCopy(Object)Overloaded.
Creates a deep copy of the object using the supplied object as a target for the copy operation.
(Defined by ObjectExtensions.)
Top
Examples
Example
static void Main(string[] args)
        {
            CamCapture cam = new CamCapture();
            var devices = cam.GetDeviceList();

            var metrics = cam.SelectDevice(devices[0]);

            cam.SelectMetrics(metrics[1]);

            Debug.Assert(cam.Start());

            CaptureDeviceMulticastProvider provider = new CaptureDeviceMulticastProvider(cam, metrics[1]);

            Debug.Assert(provider.Start());

            List<CaptureDeviceMulticastProviderClient> clients = new List<CaptureDeviceMulticastProviderClient>();
            clients.Add(provider.AddClient(new CaptureDeviceMulticastProviderClient()
                {
                    Width = 1024,
                    Height = 768
                }));
            clients.Add(provider.AddClient(new CaptureDeviceMulticastProviderClient()
            {
                Width = 352,
                Height = 288
            }));
            clients.Add(provider.AddClient(new CaptureDeviceMulticastProviderClient()
            {
                Width = 176,
                Height = 144
            }));

            while (true)
            {
                foreach (var client in clients)
                {
                    var pic = client.GetFrame();

                    if (pic == null)
                    {
                        Console.WriteLine("picture is null");
                    }
                    else
                        Console.WriteLine("{0}, {1}x{2}, SizeIncludingHeader: {3}, Start: {4}, End {5}", client.Id, client.Width, client.Height, pic.Buffer.Count, pic.StartTime, pic.EndTime);
                }

                Thread.Sleep(1000);
            }

        }
See Also