Пример #1
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");
        }
Пример #2
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.");
        }