示例#1
0
        private void FinalizeSample(Sample encodedSample)
        {
            using (var buffer = encodedSample.ConvertToContiguousBuffer())
            {
                var ptr = buffer.Lock(out int cbMaxLength, out int cbCurrentLength);
                try
                {
                    if (cbCurrentLength > 0)
                    {
                        var sampleTime = encodedSample.SampleTime;
                        var timeSec    = MfTool.MfTicksToSec(sampleTime);
                        DataEncoded?.Invoke(ptr, cbCurrentLength, timeSec);

                        //byte[] buf = new byte[cbCurrentLength];
                        //Marshal.Copy(ptr, buf, 0, buf.Length);

                        //OnDataReady(buf);
                    }
                }
                finally
                {
                    buffer.Unlock();
                }
            }
        }
示例#2
0
 private void Encoder_DataEncoded(IntPtr arg1, int arg2, double arg3)
 {
     DataEncoded?.Invoke(arg1, arg2, arg3);
 }
示例#3
0
 private void OnDataReady(byte[] buf, double time)
 {
     DataEncoded?.Invoke(buf, time);
 }