Beispiel #1
0
        public CustomProcessingBlock(FrameProcessorCallback cb)
        {
            frameProcessorCallbackHandle = GCHandle.Alloc(cb, GCHandleType.Normal);
            IntPtr cbPtr = GCHandle.ToIntPtr(frameProcessorCallbackHandle);

            object error;
            var    pb = NativeMethods.rs2_create_processing_block_fptr(fpc, cbPtr, out error);

            m_instance = new HandleRef(this, pb);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomProcessingBlock"/> class.
        /// </summary>
        /// <param name="cb">Processing function to be applied to every frame entering the block</param>
        public CustomProcessingBlock(FrameProcessorCallback cb)
        {
            frameProcessorCallbackHandle = GCHandle.Alloc(cb, GCHandleType.Normal);
            IntPtr cbPtr = GCHandle.ToIntPtr(frameProcessorCallbackHandle);
            object error;
            var    pb = NativeMethods.rs2_create_processing_block_fptr(fpc, cbPtr, out error);

            m_instance = new Base.DeleterHandle(pb, NativeMethods.rs2_delete_processing_block);
            Options    = new OptionsList(m_instance.Handle);
        }
Beispiel #3
0
        public CustomProcessingBlock(FrameProcessorCallback cb)
        {
            object error;
            frame_processor_callback cb2 = (IntPtr f, IntPtr src, IntPtr u) =>
            {
                using (var frame = new Frame(f))
                    cb(frame, new FrameSource(new HandleRef(this, src)));
            };

            m_proc_callback = cb2;
            m_instance      = new HandleRef(this, NativeMethods.rs2_create_processing_block_fptr(cb2, IntPtr.Zero, out error));
        }