示例#1
0
        private void LateUpdate()
        {
            // Check if the receiver has returned any metadataFrames
            if (_send != null && !_send.IsClosed)
            {
                Interop.MetadataFrame recvMetadataFrame = new Interop.MetadataFrame();
                while (_send.Capture(out recvMetadataFrame, 0) == Interop.FrameType.Metadata)
                {
                    // Dispatch UnityEvent
                    onMetaDataReceived?.Invoke(Util.Utf8ToString(recvMetadataFrame.Data));

                    // Free the metadataFrame
                    _send.FreeMetadata(ref recvMetadataFrame);
                }
            }

            if (!string.IsNullOrEmpty(sendMetadataFrameData) && _enableMetadataFrames)
            {
                // Send some metadata
                Interop.MetadataFrame metadataFrame = new Interop.MetadataFrame();
                int length;
                metadataFrame.Data   = Util.StringToUtf8(sendMetadataFrameData, out length);
                metadataFrame.Length = length;
                if (_send != null && !_send.IsClosed)
                {
                    _send.SendMetadata(metadataFrame);
                }
                Marshal.FreeHGlobal(metadataFrame.Data);
                sendMetadataFrameData = null;

                // Dispatch metaData sent event
                _onMetadataSent?.Invoke();
            }
        }
示例#2
0
 void SendMetadataFrame(string data)
 {
     if (!string.IsNullOrEmpty(data))
     {
         Interop.MetadataFrame metadataFrame = new Interop.MetadataFrame();
         int length;
         metadataFrame.Data   = Util.StringToUtf8(data, out length);
         metadataFrame.Length = length;
         if (_recv != null && !_recv.IsClosed)
         {
             _recv.SendMetadata(metadataFrame);
         }
         Marshal.FreeHGlobal(metadataFrame.Data);
     }
 }
示例#3
0
文件: Recv.cs 项目: benwager/KlakNDI
 public FrameType Capture
     (out VideoFrame video, out AudioFrame audio, out MetadataFrame metadata, uint timeout)
 => _CaptureV3(this, out video, out audio, out metadata, timeout);
示例#4
0
文件: Send.cs 项目: benwager/KlakNDI
 public void FreeMetadata(ref MetadataFrame data)
 => _FreeMetadata(this, ref data);
示例#5
0
文件: Send.cs 项目: benwager/KlakNDI
 public FrameType Capture(out MetadataFrame data, uint timeout)
 => _Capture(this, out data, timeout);