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