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

Use Gstreamer Buffer map in StreamCapture #216

Merged
merged 3 commits into from
Jan 9, 2025
Merged

Use Gstreamer Buffer map in StreamCapture #216

merged 3 commits into from
Jan 9, 2025

Conversation

edgarriba
Copy link
Member

After discussion: https://discourse.gstreamer.org/t/zero-copy-video-frames/3856/2

This pull request includes several changes to improve the functionality and reliability of the stream capture pipeline in the kornia-io crate. The most significant changes involve updating dependencies, introducing a new FrameBuffer struct, and modifying the StreamCapture implementation to use this new struct. Additionally, there are minor changes to example files to ensure proper mutability of capture objects.

Updates and Dependency Changes:

  • Updated gst and gst-app dependencies to version 0.23.4 in Cargo.toml.

Stream Capture Improvements:

  • Introduced a new FrameBuffer struct to store the frame buffer, width, and height.
  • Modified the StreamCapture struct to include a last_frame field, which is an Arc<Mutex<Option<FrameBuffer>>>.
  • Updated the StreamCapture::new method to set callbacks on appsink for capturing new samples and storing them in last_frame.
  • Changed the StreamCapture::grab method to retrieve the last frame from last_frame and convert it to an Image.
  • Refactored the extract_frame_buffer method to extract a FrameBuffer from the AppSink.

Error Handling:

  • Added a new LockError variant to the StreamCaptureError enum to handle errors when locking the last_frame mutex.

Example Code Adjustments:

  • Updated various example files to ensure capture objects are mutable by using let mut instead of let. [1] [2] [3] [4] [5]

@edgarriba edgarriba closed this Jan 9, 2025
@edgarriba edgarriba reopened this Jan 9, 2025
@edgarriba edgarriba merged commit bbc9ada into main Jan 9, 2025
19 of 23 checks passed
@edgarriba edgarriba deleted the gstreamer-map branch January 9, 2025 11:40
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