Пример #1
0
        private void UnregisterMediaPacketPreviewCallback()
        {
            Native.UnsetMediaPacketPreviewCallback(_handle).
            ThrowIfFailed("Failed to unset media packet preview callback.");

            _mediaPacketPreviewCallback = null;
        }
Пример #2
0
        private void RegisterMediaPacketPreviewCallback()
        {
            _mediaPacketPreviewCallback = (IntPtr mediaPacket, IntPtr userData) =>
            {
                MediaPacket packet       = MediaPacket.From(mediaPacket);
                var         eventHandler = _mediaPacketPreview;

                if (eventHandler != null)
                {
                    eventHandler.Invoke(this, new MediaPacketPreviewEventArgs(packet));
                }
                else
                {
                    packet.Dispose();
                }
            };
            CameraErrorFactory.ThrowIfError(Native.SetMediaPacketPreviewCallback(_handle, _mediaPacketPreviewCallback, IntPtr.Zero),
                                            "Setting media packet preview callback failed");
        }
Пример #3
0
        private void RegisterMediaPacketPreviewCallback()
        {
            _mediaPacketPreviewCallback = (mediaPacket, _) =>
            {
                MediaPacket packet = MediaPacket.From(mediaPacket);

                var eventHandler = _mediaPacketPreview;

                if (eventHandler != null)
                {
                    eventHandler.Invoke(this, new MediaPacketPreviewEventArgs(packet));
                }

                packet.Dispose();
            };

            Native.SetMediaPacketPreviewCallback(_handle, _mediaPacketPreviewCallback).
            ThrowIfFailed("Failed to set media packet preview callback.");
        }
Пример #4
0
 private void UnregisterMediaPacketPreviewCallback()
 {
     CameraErrorFactory.ThrowIfError(Native.UnsetMediaPacketPreviewCallback(_handle),
                                     "Unsetting media packet preview callback failed");
     _mediaPacketPreviewCallback = null;
 }