Ejemplo n.º 1
0
        private void EnumDevices()
        {
            ClearDevices();
            _devices = new List <AVProLiveCameraDevice>(8);
            int numDevices = AVProLiveCameraPlugin.GetNumDevices();

            for (int i = 0; i < numDevices; i++)
            {
                string deviceName;
                if (!AVProLiveCameraPlugin.GetDeviceName(i, out deviceName))
                {
                    continue;
                }

                string deviceGUID;
                if (!AVProLiveCameraPlugin.GetDeviceGUID(i, out deviceGUID))
                {
                    continue;
                }

                int numModes = AVProLiveCameraPlugin.GetNumModes(i);
                if (numModes > 0)
                {
                    AVProLiveCameraDevice device = new AVProLiveCameraDevice(deviceName.ToString(), deviceGUID.ToString(), i);
                    _devices.Add(device);
                }
            }
        }
Ejemplo n.º 2
0
        /*
         * private void OnRenderObject()
         * {
         #if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1)
         *      GL.IssuePluginEvent(_renderFunc, AVProLiveCameraPlugin.PluginID | (int)AVProLiveCameraPlugin.PluginEvent.UpdateAllTextures);
         #else
         *      GL.IssuePluginEvent(AVProLiveCameraPlugin.PluginID | (int)AVProLiveCameraPlugin.PluginEvent.UpdateAllTextures);
         #endif
         * }*/

        private void AddNewDevices()
        {
            bool isDeviceAdded = false;

            int numDevices = AVProLiveCameraPlugin.GetNumDevices();

            for (int i = 0; i < numDevices; i++)
            {
                string deviceGUID;
                if (!AVProLiveCameraPlugin.GetDeviceGUID(i, out deviceGUID))
                {
                    continue;
                }

                AVProLiveCameraDevice device = FindDeviceWithGUID(deviceGUID);
                if (device == null)
                {
                    string deviceName;
                    if (!AVProLiveCameraPlugin.GetDeviceName(i, out deviceName))
                    {
                        continue;
                    }

                    int numModes = AVProLiveCameraPlugin.GetNumModes(i);
                    if (numModes > 0)
                    {
                        device = new AVProLiveCameraDevice(deviceName.ToString(), deviceGUID.ToString(), i);
                        _devices.Add(device);
                        isDeviceAdded = true;
                    }
                }
            }

            if (isDeviceAdded)
            {
                this.SendMessage("NewDeviceAdded", null, SendMessageOptions.DontRequireReceiver);
            }
        }