Skip to content

Commit

Permalink
Added send_frame_buffer 🐳
Browse files Browse the repository at this point in the history
  • Loading branch information
NiiightmareXD committed Apr 21, 2024
1 parent 2bf860b commit 1c06e69
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "windows-capture"
version = "1.1.4"
version = "1.1.7"
authors = ["NiiightmareXD"]
edition = "2021"
description = "Fastest Windows Screen Capture Library For Rust 🔥"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Add this library to your `Cargo.toml`:

```toml
[dependencies]
windows-capture = "1.1.4"
windows-capture = "1.1.7"
```
or run this command

Expand Down
13 changes: 12 additions & 1 deletion src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ impl VideoEncoder {
/// # Arguments
///
/// * `buffer` - A reference to the byte slice to be encoded Windows API expect this to be Bgra and bottom-top.
/// * `timespan` - The timespan that correlates to the frame buffer.
///
/// # Returns
///
Expand All @@ -581,7 +582,17 @@ impl VideoEncoder {
buffer: &[u8],
timespan: i64,
) -> Result<(), VideoEncoderError> {
let timespan = TimeSpan { Duration: timespan };
let frame_timespan = timespan;
let timespan = match self.first_timespan {
Some(timespan) => TimeSpan {
Duration: frame_timespan - timespan.Duration,
},
None => {
let timespan = frame_timespan;
self.first_timespan = Some(TimeSpan { Duration: timespan });
TimeSpan { Duration: 0 }
}
};

self.frame_sender.send(Some((
VideoEncoderSource::Buffer((SendDirectX::new(buffer.as_ptr()), buffer.len())),
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//!
//! ```toml
//! [dependencies]
//! windows-capture = "1.1.4"
//! windows-capture = "1.1.7"
//! ```
//! or run this command
//!
Expand Down
2 changes: 1 addition & 1 deletion windows-capture-python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "windows-capture-python"
version = "1.1.4"
version = "1.1.7"
authors = ["NiiightmareXD"]
edition = "2021"
description = "Fastest Windows Screen Capture Library For Python 🔥"
Expand Down
2 changes: 1 addition & 1 deletion windows-capture-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "windows-capture"
version = "1.1.4"
version = "1.1.7"
description = "Fastest Windows Screen Capture Library For Python 🔥"
readme = "README.md"
requires-python = ">=3.9"
Expand Down

0 comments on commit 1c06e69

Please sign in to comment.