1use glib::translate::*;
4
5use crate::{ffi, Play};
6
7impl Play {
8 #[doc(alias = "get_config")]
9 #[doc(alias = "gst_play_get_config")]
10 pub fn config(&self) -> crate::PlayConfig {
11 unsafe { from_glib_full(ffi::gst_play_get_config(self.to_glib_none().0)) }
12 }
13
14 #[doc(alias = "gst_play_set_config")]
15 pub fn set_config(&self, config: crate::PlayConfig) -> Result<(), glib::error::BoolError> {
16 unsafe {
17 glib::result_from_gboolean!(
18 ffi::gst_play_set_config(self.to_glib_none().0, config.into_glib_ptr()),
19 "Failed to set config",
20 )
21 }
22 }
23
24 #[doc(alias = "gst_play_get_video_snapshot")]
25 #[doc(alias = "get_video_snapshot")]
26 pub fn video_snapshot(
27 &self,
28 format: crate::PlaySnapshotFormat,
29 config: Option<&gst::StructureRef>,
30 ) -> Option<gst::Sample> {
31 unsafe {
32 from_glib_full(ffi::gst_play_get_video_snapshot(
33 self.to_glib_none().0,
34 format.into_glib(),
35 mut_override(config.map(|c| c.as_ptr()).unwrap_or(std::ptr::null())),
36 ))
37 }
38 }
39}
40
41impl Default for Play {
42 fn default() -> Self {
43 Self::new(None::<crate::PlayVideoRenderer>)
44 }
45}