{
+ // Get the buffer pool
+ let pool_guard = self.buffer_pool.lock().unwrap();
+ let pool = pool_guard.as_ref().ok_or(FlowError::NotNegotiated)?;
+
+ // Activate the pool if necessary
+ if !pool.is_active() {
+ pool.set_active(true).map_err(|_| FlowError::Error)?;
+ }
+
+ // Get a buffer to fill
+ let buffer = pool.acquire_buffer(None)?;
+
+ // Get the GL memory from the buffer
let memory = buffer.get_all_memory().ok_or_else(|| {
gst_element_error!(src, CoreError::Failed, ["Failed to get memory"]);
FlowError::Error
@@ -549,6 +604,7 @@ impl BaseSrcImpl for ServoSrc {
FlowError::Error
})?;
+ // Get the data out of the memory
let gl_context = unsafe { GLContext::from_glib_borrow(gl_memory.mem.context) };
let draw_texture_id = gl_memory.tex_id;
let draw_texture_target = unsafe { gst_gl_texture_target_to_gl(gl_memory.tex_target) };
@@ -710,6 +766,6 @@ impl BaseSrcImpl for ServoSrc {
})?;
let _ = self.sender.send(ServoSrcMsg::Heartbeat);
- Ok(FlowSuccess::Ok)
+ Ok(buffer)
}
}
diff --git a/ports/gstplugin/test.html b/ports/gstplugin/test.html
index a959cd106e8..00525e0eedd 100644
--- a/ports/gstplugin/test.html
+++ b/ports/gstplugin/test.html
@@ -5,10 +5,11 @@
Start the video stream with:
- gst-launch-1.0 servosrc \
- ! queue \
- ! video/x-raw,framerate=25/1,width=512,height=512 \
- ! videoconvert \
+ gst-launch-1.0 servosrc url=https://mrdoob.neocities.org/018/ \
+ ! videorate \
+ ! video/x-raw\(memory:GLMemory\),framerate=50/1,width=512,height=256 \
+ ! glcolorconvert \
+ ! gldownload \
! videoflip video-direction=vert \
! theoraenc \
! oggmux \