Add Rust_scaleVideoFrameBuffer

This commit is contained in:
Rashad Sookram 2023-07-14 15:05:31 -04:00 committed by GitHub
parent 0734fdad69
commit ff4a9d3e8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -91,6 +91,10 @@ RUSTEXPORT void Rust_convertVideoFrameBufferToRgba(
RUSTEXPORT const uint8_t *Rust_getVideoFrameBufferAsI420( RUSTEXPORT const uint8_t *Rust_getVideoFrameBufferAsI420(
const webrtc::VideoFrameBuffer* buffer); const webrtc::VideoFrameBuffer* buffer);
// See VideoFrameBuffer::Scale. Output will be in I420.
RUSTEXPORT webrtc::VideoFrameBuffer* Rust_scaleVideoFrameBuffer(
webrtc::VideoFrameBuffer* buffer_borrowed_rc, int width, int height);
// RGBA => I420 // RGBA => I420
RUSTEXPORT webrtc::VideoFrameBuffer* Rust_copyAndRotateVideoFrameBuffer( RUSTEXPORT webrtc::VideoFrameBuffer* Rust_copyAndRotateVideoFrameBuffer(
const webrtc::VideoFrameBuffer* buffer_borrowed_rc, webrtc::VideoRotation rotation); const webrtc::VideoFrameBuffer* buffer_borrowed_rc, webrtc::VideoRotation rotation);

View file

@ -201,6 +201,12 @@ RUSTEXPORT const uint8_t *Rust_getVideoFrameBufferAsI420(const VideoFrameBuffer*
return dataY; return dataY;
} }
// Returns an owned RC.
RUSTEXPORT VideoFrameBuffer* Rust_scaleVideoFrameBuffer(
VideoFrameBuffer* buffer_borrowed_rc, int width, int height) {
return take_rc(buffer_borrowed_rc->Scale(width, height));
}
// Returns an owned RC. // Returns an owned RC.
RUSTEXPORT VideoFrameBuffer* Rust_copyAndRotateVideoFrameBuffer( RUSTEXPORT VideoFrameBuffer* Rust_copyAndRotateVideoFrameBuffer(
const VideoFrameBuffer* buffer_borrowed_rc, VideoRotation rotation) { const VideoFrameBuffer* buffer_borrowed_rc, VideoRotation rotation) {