Esempio n. 1
0
        private void UnregisterMediaPacketPreviewCallback()
        {
            Native.UnsetMediaPacketPreviewCallback(_handle).
            ThrowIfFailed("Failed to unset media packet preview callback.");

            _mediaPacketPreviewCallback = null;
        }
Esempio n. 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");
        }
Esempio n. 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.");
        }
Esempio n. 4
0
 private void UnregisterMediaPacketPreviewCallback()
 {
     CameraErrorFactory.ThrowIfError(Native.UnsetMediaPacketPreviewCallback(_handle),
                                     "Unsetting media packet preview callback failed");
     _mediaPacketPreviewCallback = null;
 }