Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support opening a pipeline via frame callback #17

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

w-utter
Copy link

@w-utter w-utter commented Apr 19, 2024

This would add the ability to open a pipeline by providing a callback by using the rs2_pipeline_start_with_callback sys fn. Its usage would look something along the lines of

use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;

let context = Context::new().unwrap();
let pipeline = InactivePipeline::try_from(&context).unwrap();

let frame_count = Arc::new(AtomicUsize::new(0));

let stream_handle = pipeline.start_streaming(move |frame| {
    let frame_count = frame_count.clone();
    frame_count.fetch_add(1, Ordering::Relaxed);
    let _frame = frame.of_type::<CompositeFrame>().unwrap();
})

@w-utter w-utter marked this pull request as draft April 20, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant