Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sp4ghet committed Aug 14, 2022
1 parent 4debdf4 commit 270d09b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ndi-examples/src/data_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ fn main() {
thread::sleep(std::time::Duration::from_millis(1000));

println!("Frame received: {}x{}", frame.width(), frame.height());

unsafe {
ndi::cleanup();
}
}
6 changes: 5 additions & 1 deletion ndi-examples/src/save_recv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn main() {

let frame_vec = unsafe {
assert!(!frame.p_data().is_null());
let size = frame.width() * frame.line_stride_in_bytes().unwrap();
let size = frame.height() * frame.line_stride_in_bytes().unwrap();
std::slice::from_raw_parts(frame.p_data(), size as _)
};
let frame_vec = Vec::from_iter(frame_vec.to_owned());
Expand All @@ -39,5 +39,9 @@ fn main() {

buf.save("save_recv.png").unwrap();

unsafe {
ndi::cleanup();
}

println!("Done");
}

0 comments on commit 270d09b

Please sign in to comment.