Exemple #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();
            }
        }
Exemple #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);
     }
 }
Exemple #3
0
 public FrameType Capture
     (out VideoFrame video, out AudioFrame audio, out MetadataFrame metadata, uint timeout)
 => _CaptureV3(this, out video, out audio, out metadata, timeout);
Exemple #4
0
 public void FreeMetadata(ref MetadataFrame data)
 => _FreeMetadata(this, ref data);
Exemple #5
0
 public FrameType Capture(out MetadataFrame data, uint timeout)
 => _Capture(this, out data, timeout);