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

create VideoData #5

Closed
revilo196 opened this issue Sep 23, 2021 · 3 comments
Closed

create VideoData #5

revilo196 opened this issue Sep 23, 2021 · 3 comments

Comments

@revilo196
Copy link
Contributor

Is there a way to create a VideoData with some image data input?
currently it is only possible to create an empty frame. Is this correct or am I not seeing something.
How can I send data when I'm not able to create a Video Frame?

Could also help implementing this, but I don't know where to start.
I want to use NDI to send some generated Visuals.

@sp4ghet
Copy link
Owner

sp4ghet commented Sep 25, 2021

Ah yes, I've actually not tried sending NDI using the library either yet. I think currently you would need to set up a video frame using a bunch of unsafe pointer stuff and messing with memory directly. I can try and figure out what it expects that data to be and try to create something that's somewhat reasonable for a rust API.

It might take a bit since I'm currently moving out of my apartment but if you end up figuring it out before me feel free to send a PR!

@revilo196
Copy link
Contributor Author

a simple solution could be to make an interface to create VideoData like this...

impl VideoData {
...
    pub fn from_buffer(width: i32, height: i32, fourcc: FourCCVideoType, framerate : i32, frame_format: FrameFormatType, timecode: i64, stride:i32, buffer: &mut [u8] ) -> Self 

}

and give the user the option to create any type of video data.

A Different option would be to use an external crate like image::image, to handle the creation from ImageBuffer.
This could be a more well defined interface

@sp4ghet
Copy link
Owner

sp4ghet commented May 30, 2022

I've accepted your PR and made some changes to allow maximum flexibility to the end user.
83681c5

Like I mentioned in the PR, I'm not sure if this is too verbose and we want something to simplify creating VideoData with only modifications to the buffer, or if that's not exactly necessary right now but this at least makes it possible with the library.

@sp4ghet sp4ghet closed this as completed May 30, 2022
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

No branches or pull requests

2 participants