pub struct GStreamerPlayer {
id: usize,
context_id: ClientContextId,
backend_chan: Arc<Mutex<Sender<BackendMsg>>>,
inner: RefCell<Option<Arc<Mutex<PlayerInner>>>>,
observer: Arc<Mutex<IpcSender<PlayerEvent>>>,
audio_renderer: Option<Arc<Mutex<dyn AudioRenderer>>>,
video_renderer: Option<Arc<Mutex<dyn VideoFrameRenderer>>>,
is_ready: Arc<Once>,
stream_type: StreamType,
render: Arc<Mutex<GStreamerRender>>,
}
Fields§
§id: usize
The player unique ID.
context_id: ClientContextId
The ID of the client context this player belongs to.
backend_chan: Arc<Mutex<Sender<BackendMsg>>>
Channel to communicate with the owner GStreamerBackend instance.
inner: RefCell<Option<Arc<Mutex<PlayerInner>>>>
§observer: Arc<Mutex<IpcSender<PlayerEvent>>>
§audio_renderer: Option<Arc<Mutex<dyn AudioRenderer>>>
§video_renderer: Option<Arc<Mutex<dyn VideoFrameRenderer>>>
§is_ready: Arc<Once>
Indicates whether the setup was succesfully performed and we are ready to consume a/v data.
stream_type: StreamType
Indicates whether the type of media stream to be played is a live stream.
render: Arc<Mutex<GStreamerRender>>
Decorator used to setup the video sink and process the produced frames.
Implementations§
source§impl GStreamerPlayer
impl GStreamerPlayer
pub fn new( id: usize, context_id: &ClientContextId, backend_chan: Arc<Mutex<Sender<BackendMsg>>>, stream_type: StreamType, observer: IpcSender<PlayerEvent>, video_renderer: Option<Arc<Mutex<dyn VideoFrameRenderer>>>, audio_renderer: Option<Arc<Mutex<dyn AudioRenderer>>>, gl_context: Box<dyn PlayerGLContext>, ) -> GStreamerPlayer
fn setup(&self) -> Result<(), PlayerError>
Trait Implementations§
source§impl Drop for GStreamerPlayer
impl Drop for GStreamerPlayer
source§impl MediaInstance for GStreamerPlayer
impl MediaInstance for GStreamerPlayer
source§impl Player for GStreamerPlayer
impl Player for GStreamerPlayer
fn play(&self) -> Result<(), PlayerError>
fn pause(&self) -> Result<(), PlayerError>
fn stop(&self) -> Result<(), PlayerError>
fn end_of_stream(&self) -> Result<(), PlayerError>
fn set_input_size(&self, size: u64) -> Result<(), PlayerError>
fn set_mute(&self, val: bool) -> Result<(), PlayerError>
fn set_rate(&self, rate: f64) -> Result<(), PlayerError>
fn push_data(&self, data: Vec<u8>) -> Result<(), PlayerError>
fn seek(&self, time: f64) -> Result<(), PlayerError>
fn set_volume(&self, value: f64) -> Result<(), PlayerError>
source§fn buffered(&self) -> Result<Vec<Range<f64>>, PlayerError>
fn buffered(&self) -> Result<Vec<Range<f64>>, PlayerError>
Get the list of time ranges in seconds that have been buffered.
source§fn render_use_gl(&self) -> bool
fn render_use_gl(&self) -> bool
If player’s rendering draws using GL textures
source§fn set_stream(
&self,
stream: &MediaStreamId,
only_stream: bool,
) -> Result<(), PlayerError>
fn set_stream( &self, stream: &MediaStreamId, only_stream: bool, ) -> Result<(), PlayerError>
Set the stream to be played by the player.
Only a single stream of the same type (audio or video) can be set.
Subsequent calls with a stream of the same type will override the previously
set stream.
This method requires the player to be constructed with StreamType::Stream.
It is important to give the correct value of
only_stream
indicating
that the audio or video stream being set is the only one expected.
Subsequent calls to set_stream
after the only_stream
flag has been
set to true will fail.fn set_audio_track( &self, stream_index: i32, enabled: bool, ) -> Result<(), PlayerError>
fn set_video_track( &self, stream_index: i32, enabled: bool, ) -> Result<(), PlayerError>
Auto Trait Implementations§
impl !Freeze for GStreamerPlayer
impl !RefUnwindSafe for GStreamerPlayer
impl Send for GStreamerPlayer
impl !Sync for GStreamerPlayer
impl Unpin for GStreamerPlayer
impl UnwindSafe for GStreamerPlayer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more