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

build pipeline config from args #26

Open
github-actions bot opened this issue Mar 14, 2024 · 0 comments
Open

build pipeline config from args #26

github-actions bot opened this issue Mar 14, 2024 · 0 comments
Assignees
Labels

Comments

@github-actions
Copy link

// TODO: build pipeline config from args

}


fn automatic_recording(
    mut commands: Commands,
    time: Res<Time>,
    mut ev_person: EventReader<PersonDetectedEvent>,
    stream_manager: Res<RtspStreamManager>,
    mut live_session: ResMut<LiveSession>,
    mut person_timeout: Local<Stopwatch>,
) {
    if live_session.0.is_some() {
        if person_timeout.elapsed_secs() > 3.0 {
            person_timeout.reset();

            println!("no person detected for 3 seconds, stopping recording");

            let session_entity = live_session.0.take().unwrap();
            let raw_streams = stream_manager.stop_recording();

            commands.entity(session_entity)
                .insert(RawStreams {
                    streams: raw_streams,
                });
        }

        person_timeout.tick(time.delta());

        for _ev in ev_person.read() {
            person_timeout.reset();
        }

        return;
    }

    for ev in ev_person.read() {
        println!("person detected: {:?}", ev);

        // TODO: deduplicate start recording logic
        let session = Session::new("capture".to_string());

        stream_manager.start_recording(
            &session,
        );

        // TODO: build pipeline config from args
        let entity = commands.spawn(
            StreamSessionBundle {
                session: session,
                raw_streams: RawStreams::default(),
                config: PipelineConfig::default(),
            },
        ).id();
        live_session.0 = Some(entity);

        break;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant