mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-22 01:56:28 +00:00
Move sink_render() to a more logical place
This commit is contained in:
parent
eee2653b76
commit
fa855ec2b2
1 changed files with 22 additions and 22 deletions
|
@ -143,28 +143,6 @@ pub unsafe extern "C" fn sink_get_uri(ptr: *const SinkWrapper) -> *mut c_char {
|
|||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sink_render(ptr: *mut SinkWrapper,
|
||||
data_ptr: *const u8,
|
||||
data_len: usize)
|
||||
-> GstFlowReturn {
|
||||
let wrap: &mut SinkWrapper = &mut *ptr;
|
||||
let sink = &mut wrap.sink.lock().unwrap();
|
||||
let data = slice::from_raw_parts(data_ptr, data_len);
|
||||
|
||||
match sink.render(data) {
|
||||
Ok(..) => GstFlowReturn::Ok,
|
||||
Err(flow_error) => {
|
||||
match flow_error {
|
||||
FlowError::NotNegotiated(ref msg) |
|
||||
FlowError::Error(ref msg) => msg.post(wrap.sink_raw),
|
||||
_ => (),
|
||||
}
|
||||
flow_error.to_native()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sink_start(ptr: *mut SinkWrapper) -> GBoolean {
|
||||
let wrap: &mut SinkWrapper = &mut *ptr;
|
||||
|
@ -209,3 +187,25 @@ pub unsafe extern "C" fn sink_stop(ptr: *mut SinkWrapper) -> GBoolean {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sink_render(ptr: *mut SinkWrapper,
|
||||
data_ptr: *const u8,
|
||||
data_len: usize)
|
||||
-> GstFlowReturn {
|
||||
let wrap: &mut SinkWrapper = &mut *ptr;
|
||||
let sink = &mut wrap.sink.lock().unwrap();
|
||||
let data = slice::from_raw_parts(data_ptr, data_len);
|
||||
|
||||
match sink.render(data) {
|
||||
Ok(..) => GstFlowReturn::Ok,
|
||||
Err(flow_error) => {
|
||||
match flow_error {
|
||||
FlowError::NotNegotiated(ref msg) |
|
||||
FlowError::Error(ref msg) => msg.post(wrap.sink_raw),
|
||||
_ => (),
|
||||
}
|
||||
flow_error.to_native()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue