Add comments about which Source/Sink methods are called from which threads

Source::get_size() / ::is_seekable() implementations need to be made
thread-safe still.
This commit is contained in:
Sebastian Dröge 2016-05-23 21:15:43 +03:00
parent 8514d46092
commit 5cc890cc04
2 changed files with 9 additions and 1 deletions

View file

@ -24,8 +24,11 @@ use std::ptr;
use utils::*;
pub trait Sink: Sync + Send {
// Called from any thread at any time
fn set_uri(&mut self, uri_str: Option<&str>) -> bool;
fn get_uri(&self) -> Option<String>;
// Called from the streaming thread only
fn start(&mut self) -> bool;
fn stop(&mut self) -> bool;
fn render(&mut self, data: &[u8]) -> GstFlowReturn;

View file

@ -23,14 +23,19 @@ use std::ptr;
use utils::*;
pub trait Source: Sync + Send {
// Called from any thread at any time
fn set_uri(&mut self, uri_str: Option<&str>) -> bool;
fn get_uri(&self) -> Option<String>;
// Called from any thread between start/stop
fn is_seekable(&self) -> bool;
fn get_size(&self) -> u64;
// Called from the streaming thread only
fn start(&mut self) -> bool;
fn stop(&mut self) -> bool;
fn fill(&mut self, offset: u64, data: &mut [u8]) -> Result<usize, GstFlowReturn>;
fn do_seek(&mut self, start: u64, stop: u64) -> bool;
fn get_size(&self) -> u64;
}
#[no_mangle]