From 38b97a14adf613547af9f3cad954196db2fe801b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 1 Aug 2017 13:36:39 +0100 Subject: [PATCH] Add initial, untested version of GstPlayer bindings --- Gir_GstPlayer.toml | 56 ++ gstreamer-player/src/auto/enums.rs | 254 ++++++ gstreamer-player/src/auto/flags.rs | 6 + gstreamer-player/src/auto/mod.rs | 65 ++ gstreamer-player/src/auto/player.rs | 743 ++++++++++++++++++ .../src/auto/player_audio_info.rs | 66 ++ ...player_g_main_context_signal_dispatcher.rs | 49 ++ .../src/auto/player_media_info.rs | 166 ++++ .../src/auto/player_signal_dispatcher.rs | 25 + .../src/auto/player_stream_info.rs | 66 ++ .../src/auto/player_subtitle_info.rs | 34 + .../src/auto/player_video_info.rs | 80 ++ .../player_video_overlay_video_renderer.rs | 98 +++ .../src/auto/player_video_renderer.rs | 25 + .../src/auto/player_visualization.rs | 22 + 15 files changed, 1755 insertions(+) create mode 100644 Gir_GstPlayer.toml create mode 100644 gstreamer-player/src/auto/enums.rs create mode 100644 gstreamer-player/src/auto/flags.rs create mode 100644 gstreamer-player/src/auto/mod.rs create mode 100644 gstreamer-player/src/auto/player.rs create mode 100644 gstreamer-player/src/auto/player_audio_info.rs create mode 100644 gstreamer-player/src/auto/player_g_main_context_signal_dispatcher.rs create mode 100644 gstreamer-player/src/auto/player_media_info.rs create mode 100644 gstreamer-player/src/auto/player_signal_dispatcher.rs create mode 100644 gstreamer-player/src/auto/player_stream_info.rs create mode 100644 gstreamer-player/src/auto/player_subtitle_info.rs create mode 100644 gstreamer-player/src/auto/player_video_info.rs create mode 100644 gstreamer-player/src/auto/player_video_overlay_video_renderer.rs create mode 100644 gstreamer-player/src/auto/player_video_renderer.rs create mode 100644 gstreamer-player/src/auto/player_visualization.rs diff --git a/Gir_GstPlayer.toml b/Gir_GstPlayer.toml new file mode 100644 index 000000000..f7202446b --- /dev/null +++ b/Gir_GstPlayer.toml @@ -0,0 +1,56 @@ +[options] +girs_dir = "gir-files" +library = "GstPlayer" +version = "1.0" +min_cfg_version = "1.10" +target_path = "gstreamer-player" +work_mode = "normal" +concurrency = "send+sync" +generate_safety_asserts = true + +external_libraries = [ + "GLib", + "GObject", +] + +generate = [ + "GstPlayer.Player", + "GstPlayer.PlayerAudioInfo", + "GstPlayer.PlayerColorBalanceType", + "GstPlayer.PlayerError", + "GstPlayer.PlayerGMainContextSignalDispatcher", + "GstPlayer.PlayerMediaInfo", + "GstPlayer.PlayerSignalDispatcher", + "GstPlayer.PlayerSnapshotFormat", + "GstPlayer.PlayerState", + "GstPlayer.PlayerStreamInfo", + "GstPlayer.PlayerSubtitleInfo", + "GstPlayer.PlayerVideoInfo", + "GstPlayer.PlayerVideoOverlayVideoRenderer", + "GstPlayer.PlayerVideoRenderer", + "GstPlayer.PlayerVisualization", +] + +manual = [ + "GLib.Error", + "GLib.MainContext", + "GObject.Object", + "Gst.ClockTime", + "Gst.Structure", + "Gst.Element", +] + +[[object]] +name = "Gst.Caps" +status = "manual" +ref_mode = "ref" + +[[object]] +name = "Gst.TagList" +status = "manual" +ref_mode = "ref" + +[[object]] +name = "Gst.Sample" +status = "manual" +ref_mode = "ref" diff --git a/gstreamer-player/src/auto/enums.rs b/gstreamer-player/src/auto/enums.rs new file mode 100644 index 000000000..2528e051c --- /dev/null +++ b/gstreamer-player/src/auto/enums.rs @@ -0,0 +1,254 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use ffi; +use glib_ffi; +use glib::error::ErrorDomain; +use glib::Type; +use glib::StaticType; +use glib::value::{Value, SetValue, FromValue, FromValueOptional}; +use gobject_ffi; +use glib::translate::*; +use std; + +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +pub enum PlayerColorBalanceType { + Hue, + Brightness, + Saturation, + Contrast, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for PlayerColorBalanceType { + type GlibType = ffi::GstPlayerColorBalanceType; + + fn to_glib(&self) -> ffi::GstPlayerColorBalanceType { + match *self { + PlayerColorBalanceType::Hue => ffi::GST_PLAYER_COLOR_BALANCE_HUE, + PlayerColorBalanceType::Brightness => ffi::GST_PLAYER_COLOR_BALANCE_BRIGHTNESS, + PlayerColorBalanceType::Saturation => ffi::GST_PLAYER_COLOR_BALANCE_SATURATION, + PlayerColorBalanceType::Contrast => ffi::GST_PLAYER_COLOR_BALANCE_CONTRAST, + PlayerColorBalanceType::__Unknown(value) => unsafe{std::mem::transmute(value)} + } + } +} + +#[doc(hidden)] +impl FromGlib for PlayerColorBalanceType { + fn from_glib(value: ffi::GstPlayerColorBalanceType) -> Self { + skip_assert_initialized!(); + match value as i32 { + 3 => PlayerColorBalanceType::Hue, + 0 => PlayerColorBalanceType::Brightness, + 2 => PlayerColorBalanceType::Saturation, + 1 => PlayerColorBalanceType::Contrast, + value => PlayerColorBalanceType::__Unknown(value), + } + } +} + +impl StaticType for PlayerColorBalanceType { + fn static_type() -> Type { + unsafe { from_glib(ffi::gst_player_color_balance_type_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for PlayerColorBalanceType { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for PlayerColorBalanceType { + unsafe fn from_value(value: &Value) -> Self { + from_glib(std::mem::transmute::(gobject_ffi::g_value_get_enum(value.to_glib_none().0))) + } +} + +impl SetValue for PlayerColorBalanceType { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib() as i32) + } +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +pub enum PlayerError { + Failed, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for PlayerError { + type GlibType = ffi::GstPlayerError; + + fn to_glib(&self) -> ffi::GstPlayerError { + match *self { + PlayerError::Failed => ffi::GST_PLAYER_ERROR_FAILED, + PlayerError::__Unknown(value) => unsafe{std::mem::transmute(value)} + } + } +} + +#[doc(hidden)] +impl FromGlib for PlayerError { + fn from_glib(value: ffi::GstPlayerError) -> Self { + skip_assert_initialized!(); + match value as i32 { + 0 => PlayerError::Failed, + value => PlayerError::__Unknown(value), + } + } +} + +impl ErrorDomain for PlayerError { + fn domain() -> glib_ffi::GQuark { + skip_assert_initialized!(); + unsafe { ffi::gst_player_error_quark() } + } + + fn code(self) -> i32 { + self.to_glib() as i32 + } + + fn from(code: i32) -> Option { + skip_assert_initialized!(); + match code { + 0 => Some(PlayerError::Failed), + _ => Some(PlayerError::Failed), + } + } +} + +impl StaticType for PlayerError { + fn static_type() -> Type { + unsafe { from_glib(ffi::gst_player_error_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for PlayerError { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for PlayerError { + unsafe fn from_value(value: &Value) -> Self { + from_glib(std::mem::transmute::(gobject_ffi::g_value_get_enum(value.to_glib_none().0))) + } +} + +impl SetValue for PlayerError { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib() as i32) + } +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +pub enum PlayerSnapshotFormat { + RawNative, + RawXrgb, + RawBgrx, + Jpg, + Png, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for PlayerSnapshotFormat { + type GlibType = ffi::GstPlayerSnapshotFormat; + + fn to_glib(&self) -> ffi::GstPlayerSnapshotFormat { + match *self { + PlayerSnapshotFormat::RawNative => ffi::GST_PLAYER_THUMBNAIL_RAW_NATIVE, + PlayerSnapshotFormat::RawXrgb => ffi::GST_PLAYER_THUMBNAIL_RAW_xRGB, + PlayerSnapshotFormat::RawBgrx => ffi::GST_PLAYER_THUMBNAIL_RAW_BGRx, + PlayerSnapshotFormat::Jpg => ffi::GST_PLAYER_THUMBNAIL_JPG, + PlayerSnapshotFormat::Png => ffi::GST_PLAYER_THUMBNAIL_PNG, + PlayerSnapshotFormat::__Unknown(value) => unsafe{std::mem::transmute(value)} + } + } +} + +#[doc(hidden)] +impl FromGlib for PlayerSnapshotFormat { + fn from_glib(value: ffi::GstPlayerSnapshotFormat) -> Self { + skip_assert_initialized!(); + match value as i32 { + 0 => PlayerSnapshotFormat::RawNative, + 1 => PlayerSnapshotFormat::RawXrgb, + 2 => PlayerSnapshotFormat::RawBgrx, + 3 => PlayerSnapshotFormat::Jpg, + 4 => PlayerSnapshotFormat::Png, + value => PlayerSnapshotFormat::__Unknown(value), + } + } +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +pub enum PlayerState { + Stopped, + Buffering, + Paused, + Playing, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for PlayerState { + type GlibType = ffi::GstPlayerState; + + fn to_glib(&self) -> ffi::GstPlayerState { + match *self { + PlayerState::Stopped => ffi::GST_PLAYER_STATE_STOPPED, + PlayerState::Buffering => ffi::GST_PLAYER_STATE_BUFFERING, + PlayerState::Paused => ffi::GST_PLAYER_STATE_PAUSED, + PlayerState::Playing => ffi::GST_PLAYER_STATE_PLAYING, + PlayerState::__Unknown(value) => unsafe{std::mem::transmute(value)} + } + } +} + +#[doc(hidden)] +impl FromGlib for PlayerState { + fn from_glib(value: ffi::GstPlayerState) -> Self { + skip_assert_initialized!(); + match value as i32 { + 0 => PlayerState::Stopped, + 1 => PlayerState::Buffering, + 2 => PlayerState::Paused, + 3 => PlayerState::Playing, + value => PlayerState::__Unknown(value), + } + } +} + +impl StaticType for PlayerState { + fn static_type() -> Type { + unsafe { from_glib(ffi::gst_player_state_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for PlayerState { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for PlayerState { + unsafe fn from_value(value: &Value) -> Self { + from_glib(std::mem::transmute::(gobject_ffi::g_value_get_enum(value.to_glib_none().0))) + } +} + +impl SetValue for PlayerState { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib() as i32) + } +} + diff --git a/gstreamer-player/src/auto/flags.rs b/gstreamer-player/src/auto/flags.rs new file mode 100644 index 000000000..0d24c0bba --- /dev/null +++ b/gstreamer-player/src/auto/flags.rs @@ -0,0 +1,6 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use ffi; +use glib::translate::*; + diff --git a/gstreamer-player/src/auto/mod.rs b/gstreamer-player/src/auto/mod.rs new file mode 100644 index 000000000..6b8225964 --- /dev/null +++ b/gstreamer-player/src/auto/mod.rs @@ -0,0 +1,65 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +mod player; +pub use self::player::Player; +pub use self::player::PlayerExt; + +mod player_audio_info; +pub use self::player_audio_info::PlayerAudioInfo; +pub use self::player_audio_info::PlayerAudioInfoExt; + +mod player_g_main_context_signal_dispatcher; +pub use self::player_g_main_context_signal_dispatcher::PlayerGMainContextSignalDispatcher; +pub use self::player_g_main_context_signal_dispatcher::PlayerGMainContextSignalDispatcherExt; + +mod player_media_info; +pub use self::player_media_info::PlayerMediaInfo; +pub use self::player_media_info::PlayerMediaInfoExt; + +mod player_signal_dispatcher; +pub use self::player_signal_dispatcher::PlayerSignalDispatcher; +pub use self::player_signal_dispatcher::PlayerSignalDispatcherExt; + +mod player_stream_info; +pub use self::player_stream_info::PlayerStreamInfo; +pub use self::player_stream_info::PlayerStreamInfoExt; + +mod player_subtitle_info; +pub use self::player_subtitle_info::PlayerSubtitleInfo; +pub use self::player_subtitle_info::PlayerSubtitleInfoExt; + +mod player_video_info; +pub use self::player_video_info::PlayerVideoInfo; +pub use self::player_video_info::PlayerVideoInfoExt; + +mod player_video_overlay_video_renderer; +pub use self::player_video_overlay_video_renderer::PlayerVideoOverlayVideoRenderer; +pub use self::player_video_overlay_video_renderer::PlayerVideoOverlayVideoRendererExt; + +mod player_video_renderer; +pub use self::player_video_renderer::PlayerVideoRenderer; +pub use self::player_video_renderer::PlayerVideoRendererExt; + +mod player_visualization; +pub use self::player_visualization::PlayerVisualization; + +mod enums; +pub use self::enums::PlayerColorBalanceType; +pub use self::enums::PlayerError; +pub use self::enums::PlayerSnapshotFormat; +pub use self::enums::PlayerState; + +#[doc(hidden)] +pub mod traits { + pub use super::PlayerExt; + pub use super::PlayerAudioInfoExt; + pub use super::PlayerGMainContextSignalDispatcherExt; + pub use super::PlayerMediaInfoExt; + pub use super::PlayerSignalDispatcherExt; + pub use super::PlayerStreamInfoExt; + pub use super::PlayerSubtitleInfoExt; + pub use super::PlayerVideoInfoExt; + pub use super::PlayerVideoOverlayVideoRendererExt; + pub use super::PlayerVideoRendererExt; +} diff --git a/gstreamer-player/src/auto/player.rs b/gstreamer-player/src/auto/player.rs new file mode 100644 index 000000000..e0a78e26b --- /dev/null +++ b/gstreamer-player/src/auto/player.rs @@ -0,0 +1,743 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use Error; +use PlayerAudioInfo; +use PlayerColorBalanceType; +use PlayerMediaInfo; +use PlayerSignalDispatcher; +use PlayerSnapshotFormat; +use PlayerState; +use PlayerSubtitleInfo; +use PlayerVideoInfo; +use PlayerVideoRenderer; +use PlayerVisualization; +use ffi; +use glib; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use libc; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Player(Object); + + match fn { + get_type => || ffi::gst_player_get_type(), + } +} + +impl Player { + pub fn new<'a, 'b, P: IsA + 'a, Q: Into>, R: IsA + 'b, S: Into>>(video_renderer: Q, signal_dispatcher: S) -> Player { + assert_initialized_main_thread!(); + let video_renderer = video_renderer.into(); + let video_renderer = video_renderer.to_glib_none(); + let signal_dispatcher = signal_dispatcher.into(); + let signal_dispatcher = signal_dispatcher.to_glib_none(); + unsafe { + from_glib_none(ffi::gst_player_new(video_renderer.0, signal_dispatcher.0)) + } + } + + pub fn config_get_position_update_interval(config: &gst::Structure) -> u32 { + assert_initialized_main_thread!(); + unsafe { + ffi::gst_player_config_get_position_update_interval(config.to_glib_none().0) + } + } + + pub fn config_get_seek_accurate(config: &gst::Structure) -> bool { + assert_initialized_main_thread!(); + unsafe { + from_glib(ffi::gst_player_config_get_seek_accurate(config.to_glib_none().0)) + } + } + + pub fn config_get_user_agent(config: &gst::Structure) -> Option { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::gst_player_config_get_user_agent(config.to_glib_none().0)) + } + } + + pub fn config_set_position_update_interval(config: &mut gst::Structure, interval: u32) { + assert_initialized_main_thread!(); + unsafe { + ffi::gst_player_config_set_position_update_interval(config.to_glib_none_mut().0, interval); + } + } + + pub fn config_set_user_agent(config: &mut gst::Structure, agent: &str) { + assert_initialized_main_thread!(); + unsafe { + ffi::gst_player_config_set_user_agent(config.to_glib_none_mut().0, agent.to_glib_none().0); + } + } + + pub fn get_audio_streams(info: &PlayerMediaInfo) -> Vec { + skip_assert_initialized!(); + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_audio_streams(info.to_glib_none().0)) + } + } + + pub fn get_subtitle_streams(info: &PlayerMediaInfo) -> Vec { + skip_assert_initialized!(); + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_subtitle_streams(info.to_glib_none().0)) + } + } + + pub fn get_video_streams(info: &PlayerMediaInfo) -> Vec { + skip_assert_initialized!(); + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_video_streams(info.to_glib_none().0)) + } + } + + pub fn visualizations_free(viss: &mut PlayerVisualization) { + assert_initialized_main_thread!(); + unsafe { + ffi::gst_player_visualizations_free(viss.to_glib_none_mut().0); + } + } + + pub fn visualizations_get() -> Vec { + assert_initialized_main_thread!(); + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::gst_player_visualizations_get()) + } + } +} + +unsafe impl Send for Player {} +unsafe impl Sync for Player {} + +pub trait PlayerExt { + #[cfg(feature = "v1_12")] + fn config_set_seek_accurate(&self, accurate: bool); + + fn get_audio_video_offset(&self) -> i64; + + fn get_color_balance(&self, type_: PlayerColorBalanceType) -> f64; + + fn get_config(&self) -> Option; + + fn get_current_audio_track(&self) -> Option; + + fn get_current_subtitle_track(&self) -> Option; + + fn get_current_video_track(&self) -> Option; + + fn get_current_visualization(&self) -> Option; + + fn get_duration(&self) -> gst::ClockTime; + + fn get_media_info(&self) -> Option; + + //fn get_multiview_flags(&self) -> /*Ignored*/gst_video::VideoMultiviewFlags; + + //fn get_multiview_mode(&self) -> /*Ignored*/gst_video::VideoMultiviewMode; + + fn get_mute(&self) -> bool; + + fn get_pipeline(&self) -> Option; + + fn get_position(&self) -> gst::ClockTime; + + fn get_rate(&self) -> f64; + + fn get_subtitle_uri(&self) -> Option; + + fn get_uri(&self) -> Option; + + fn get_video_snapshot<'a, P: Into>>(&self, format: PlayerSnapshotFormat, config: P) -> Option; + + fn get_volume(&self) -> f64; + + fn has_color_balance(&self) -> bool; + + fn pause(&self); + + fn play(&self); + + fn seek(&self, position: gst::ClockTime); + + fn set_audio_track(&self, stream_index: i32) -> bool; + + fn set_audio_track_enabled(&self, enabled: bool); + + fn set_audio_video_offset(&self, offset: i64); + + fn set_color_balance(&self, type_: PlayerColorBalanceType, value: f64); + + fn set_config(&self, config: &mut gst::Structure) -> bool; + + //fn set_multiview_flags(&self, flags: /*Ignored*/gst_video::VideoMultiviewFlags); + + //fn set_multiview_mode(&self, mode: /*Ignored*/gst_video::VideoMultiviewMode); + + fn set_mute(&self, val: bool); + + fn set_rate(&self, rate: f64); + + fn set_subtitle_track(&self, stream_index: i32) -> bool; + + fn set_subtitle_track_enabled(&self, enabled: bool); + + fn set_subtitle_uri(&self, uri: &str); + + fn set_uri(&self, uri: &str); + + fn set_video_track(&self, stream_index: i32) -> bool; + + fn set_video_track_enabled(&self, enabled: bool); + + fn set_visualization(&self, name: &str) -> bool; + + fn set_visualization_enabled(&self, enabled: bool); + + fn set_volume(&self, val: f64); + + fn stop(&self); + + fn get_property_suburi(&self) -> Option; + + fn set_property_suburi(&self, suburi: Option<&str>); + + //fn get_property_video_multiview_flags(&self) -> /*Ignored*/gst_video::VideoMultiviewFlags; + + //fn set_property_video_multiview_flags(&self, video_multiview_flags: /*Ignored*/gst_video::VideoMultiviewFlags); + + //fn get_property_video_multiview_mode(&self) -> /*Ignored*/gst_video::VideoMultiviewFramePacking; + + //fn set_property_video_multiview_mode(&self, video_multiview_mode: /*Ignored*/gst_video::VideoMultiviewFramePacking); + + fn connect_buffering(&self, f: F) -> u64; + + fn connect_duration_changed(&self, f: F) -> u64; + + fn connect_end_of_stream(&self, f: F) -> u64; + + fn connect_error(&self, f: F) -> u64; + + fn connect_media_info_updated(&self, f: F) -> u64; + + fn connect_mute_changed(&self, f: F) -> u64; + + fn connect_position_updated(&self, f: F) -> u64; + + fn connect_seek_done(&self, f: F) -> u64; + + fn connect_state_changed(&self, f: F) -> u64; + + fn connect_uri_loaded(&self, f: F) -> u64; + + fn connect_video_dimensions_changed(&self, f: F) -> u64; + + fn connect_volume_changed(&self, f: F) -> u64; + + fn connect_warning(&self, f: F) -> u64; +} + +impl + IsA> PlayerExt for O { + #[cfg(feature = "v1_12")] + fn config_set_seek_accurate(&self, accurate: bool) { + unsafe { + ffi::gst_player_config_set_seek_accurate(self.to_glib_none().0, accurate.to_glib()); + } + } + + fn get_audio_video_offset(&self) -> i64 { + unsafe { + ffi::gst_player_get_audio_video_offset(self.to_glib_none().0) + } + } + + fn get_color_balance(&self, type_: PlayerColorBalanceType) -> f64 { + unsafe { + ffi::gst_player_get_color_balance(self.to_glib_none().0, type_.to_glib()) + } + } + + fn get_config(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_player_get_config(self.to_glib_none().0)) + } + } + + fn get_current_audio_track(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_player_get_current_audio_track(self.to_glib_none().0)) + } + } + + fn get_current_subtitle_track(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_get_current_subtitle_track(self.to_glib_none().0)) + } + } + + fn get_current_video_track(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_player_get_current_video_track(self.to_glib_none().0)) + } + } + + fn get_current_visualization(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_player_get_current_visualization(self.to_glib_none().0)) + } + } + + fn get_duration(&self) -> gst::ClockTime { + unsafe { + ffi::gst_player_get_duration(self.to_glib_none().0) + } + } + + fn get_media_info(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_player_get_media_info(self.to_glib_none().0)) + } + } + + //fn get_multiview_flags(&self) -> /*Ignored*/gst_video::VideoMultiviewFlags { + // unsafe { TODO: call ffi::gst_player_get_multiview_flags() } + //} + + //fn get_multiview_mode(&self) -> /*Ignored*/gst_video::VideoMultiviewMode { + // unsafe { TODO: call ffi::gst_player_get_multiview_mode() } + //} + + fn get_mute(&self) -> bool { + unsafe { + from_glib(ffi::gst_player_get_mute(self.to_glib_none().0)) + } + } + + fn get_pipeline(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_player_get_pipeline(self.to_glib_none().0)) + } + } + + fn get_position(&self) -> gst::ClockTime { + unsafe { + ffi::gst_player_get_position(self.to_glib_none().0) + } + } + + fn get_rate(&self) -> f64 { + unsafe { + ffi::gst_player_get_rate(self.to_glib_none().0) + } + } + + fn get_subtitle_uri(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_player_get_subtitle_uri(self.to_glib_none().0)) + } + } + + fn get_uri(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_player_get_uri(self.to_glib_none().0)) + } + } + + fn get_video_snapshot<'a, P: Into>>(&self, format: PlayerSnapshotFormat, config: P) -> Option { + let config = config.into(); + unsafe { + from_glib_full(ffi::gst_player_get_video_snapshot(self.to_glib_none().0, format.to_glib(), config.to_glib_none_mut().0)) + } + } + + fn get_volume(&self) -> f64 { + unsafe { + ffi::gst_player_get_volume(self.to_glib_none().0) + } + } + + fn has_color_balance(&self) -> bool { + unsafe { + from_glib(ffi::gst_player_has_color_balance(self.to_glib_none().0)) + } + } + + fn pause(&self) { + unsafe { + ffi::gst_player_pause(self.to_glib_none().0); + } + } + + fn play(&self) { + unsafe { + ffi::gst_player_play(self.to_glib_none().0); + } + } + + fn seek(&self, position: gst::ClockTime) { + unsafe { + ffi::gst_player_seek(self.to_glib_none().0, position); + } + } + + fn set_audio_track(&self, stream_index: i32) -> bool { + unsafe { + from_glib(ffi::gst_player_set_audio_track(self.to_glib_none().0, stream_index)) + } + } + + fn set_audio_track_enabled(&self, enabled: bool) { + unsafe { + ffi::gst_player_set_audio_track_enabled(self.to_glib_none().0, enabled.to_glib()); + } + } + + fn set_audio_video_offset(&self, offset: i64) { + unsafe { + ffi::gst_player_set_audio_video_offset(self.to_glib_none().0, offset); + } + } + + fn set_color_balance(&self, type_: PlayerColorBalanceType, value: f64) { + unsafe { + ffi::gst_player_set_color_balance(self.to_glib_none().0, type_.to_glib(), value); + } + } + + fn set_config(&self, config: &mut gst::Structure) -> bool { + unsafe { + from_glib(ffi::gst_player_set_config(self.to_glib_none().0, config.to_glib_full())) + } + } + + //fn set_multiview_flags(&self, flags: /*Ignored*/gst_video::VideoMultiviewFlags) { + // unsafe { TODO: call ffi::gst_player_set_multiview_flags() } + //} + + //fn set_multiview_mode(&self, mode: /*Ignored*/gst_video::VideoMultiviewMode) { + // unsafe { TODO: call ffi::gst_player_set_multiview_mode() } + //} + + fn set_mute(&self, val: bool) { + unsafe { + ffi::gst_player_set_mute(self.to_glib_none().0, val.to_glib()); + } + } + + fn set_rate(&self, rate: f64) { + unsafe { + ffi::gst_player_set_rate(self.to_glib_none().0, rate); + } + } + + fn set_subtitle_track(&self, stream_index: i32) -> bool { + unsafe { + from_glib(ffi::gst_player_set_subtitle_track(self.to_glib_none().0, stream_index)) + } + } + + fn set_subtitle_track_enabled(&self, enabled: bool) { + unsafe { + ffi::gst_player_set_subtitle_track_enabled(self.to_glib_none().0, enabled.to_glib()); + } + } + + fn set_subtitle_uri(&self, uri: &str) { + unsafe { + ffi::gst_player_set_subtitle_uri(self.to_glib_none().0, uri.to_glib_none().0); + } + } + + fn set_uri(&self, uri: &str) { + unsafe { + ffi::gst_player_set_uri(self.to_glib_none().0, uri.to_glib_none().0); + } + } + + fn set_video_track(&self, stream_index: i32) -> bool { + unsafe { + from_glib(ffi::gst_player_set_video_track(self.to_glib_none().0, stream_index)) + } + } + + fn set_video_track_enabled(&self, enabled: bool) { + unsafe { + ffi::gst_player_set_video_track_enabled(self.to_glib_none().0, enabled.to_glib()); + } + } + + fn set_visualization(&self, name: &str) -> bool { + unsafe { + from_glib(ffi::gst_player_set_visualization(self.to_glib_none().0, name.to_glib_none().0)) + } + } + + fn set_visualization_enabled(&self, enabled: bool) { + unsafe { + ffi::gst_player_set_visualization_enabled(self.to_glib_none().0, enabled.to_glib()); + } + } + + fn set_volume(&self, val: f64) { + unsafe { + ffi::gst_player_set_volume(self.to_glib_none().0, val); + } + } + + fn stop(&self) { + unsafe { + ffi::gst_player_stop(self.to_glib_none().0); + } + } + + fn get_property_suburi(&self) -> Option { + let mut value = Value::from(None::<&str>); + unsafe { + gobject_ffi::g_object_get_property(self.to_glib_none().0, "suburi".to_glib_none().0, value.to_glib_none_mut().0); + } + value.get() + } + + fn set_property_suburi(&self, suburi: Option<&str>) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "suburi".to_glib_none().0, Value::from(suburi).to_glib_none().0); + } + } + + //fn get_property_video_multiview_flags(&self) -> /*Ignored*/gst_video::VideoMultiviewFlags { + // let mut value = Value::from(&0u32); + // unsafe { + // gobject_ffi::g_object_get_property(self.to_glib_none().0, "video-multiview-flags".to_glib_none().0, value.to_glib_none_mut().0); + // from_glib(transmute(value.get::().unwrap())) + // } + //} + + //fn set_property_video_multiview_flags(&self, video_multiview_flags: /*Ignored*/gst_video::VideoMultiviewFlags) { + // let video_multiview_flags = video_multiview_flags.to_glib().bits() as u32; + // unsafe { + // gobject_ffi::g_object_set_property(self.to_glib_none().0, "video-multiview-flags".to_glib_none().0, Value::from(&video_multiview_flags).to_glib_none().0); + // } + //} + + //fn get_property_video_multiview_mode(&self) -> /*Ignored*/gst_video::VideoMultiviewFramePacking { + // let mut value = Value::from(&0); + // unsafe { + // gobject_ffi::g_object_get_property(self.to_glib_none().0, "video-multiview-mode".to_glib_none().0, value.to_glib_none_mut().0); + // from_glib(transmute(value.get::().unwrap())) + // } + //} + + //fn set_property_video_multiview_mode(&self, video_multiview_mode: /*Ignored*/gst_video::VideoMultiviewFramePacking) { + // let video_multiview_mode = video_multiview_mode.to_glib() as i32; + // unsafe { + // gobject_ffi::g_object_set_property(self.to_glib_none().0, "video-multiview-mode".to_glib_none().0, Value::from(&video_multiview_mode).to_glib_none().0); + // } + //} + + fn connect_buffering(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "buffering", + transmute(buffering_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_duration_changed(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "duration-changed", + transmute(duration_changed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_end_of_stream(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "end-of-stream", + transmute(end_of_stream_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_error(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "error", + transmute(error_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_media_info_updated(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "media-info-updated", + transmute(media_info_updated_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_mute_changed(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "mute-changed", + transmute(mute_changed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_position_updated(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "position-updated", + transmute(position_updated_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_seek_done(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "seek-done", + transmute(seek_done_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_state_changed(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "state-changed", + transmute(state_changed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_uri_loaded(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "uri-loaded", + transmute(uri_loaded_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_video_dimensions_changed(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "video-dimensions-changed", + transmute(video_dimensions_changed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_volume_changed(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "volume-changed", + transmute(volume_changed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_warning(&self, f: F) -> u64 { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "warning", + transmute(warning_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn buffering_trampoline

(this: *mut ffi::GstPlayer, object: libc::c_int, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), object) +} + +unsafe extern "C" fn duration_changed_trampoline

(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), object) +} + +unsafe extern "C" fn end_of_stream_trampoline

(this: *mut ffi::GstPlayer, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked()) +} + +unsafe extern "C" fn error_trampoline

(this: *mut ffi::GstPlayer, object: *mut glib_ffi::GError, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), &from_glib_none(object)) +} + +unsafe extern "C" fn media_info_updated_trampoline

(this: *mut ffi::GstPlayer, object: *mut ffi::GstPlayerMediaInfo, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), &from_glib_none(object)) +} + +unsafe extern "C" fn mute_changed_trampoline

(this: *mut ffi::GstPlayer, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked()) +} + +unsafe extern "C" fn position_updated_trampoline

(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), object) +} + +unsafe extern "C" fn seek_done_trampoline

(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), object) +} + +unsafe extern "C" fn state_changed_trampoline

(this: *mut ffi::GstPlayer, object: ffi::GstPlayerState, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), from_glib(object)) +} + +unsafe extern "C" fn uri_loaded_trampoline

(this: *mut ffi::GstPlayer, object: *mut libc::c_char, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), &String::from_glib_none(object)) +} + +unsafe extern "C" fn video_dimensions_changed_trampoline

(this: *mut ffi::GstPlayer, object: libc::c_int, p0: libc::c_int, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), object, p0) +} + +unsafe extern "C" fn volume_changed_trampoline

(this: *mut ffi::GstPlayer, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked()) +} + +unsafe extern "C" fn warning_trampoline

(this: *mut ffi::GstPlayer, object: *mut glib_ffi::GError, f: glib_ffi::gpointer) +where P: IsA { + callback_guard!(); + let f: &Box_ = transmute(f); + f(&Player::from_glib_none(this).downcast_unchecked(), &from_glib_none(object)) +} diff --git a/gstreamer-player/src/auto/player_audio_info.rs b/gstreamer-player/src/auto/player_audio_info.rs new file mode 100644 index 000000000..1851060bd --- /dev/null +++ b/gstreamer-player/src/auto/player_audio_info.rs @@ -0,0 +1,66 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use PlayerStreamInfo; +use ffi; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerAudioInfo(Object): PlayerStreamInfo; + + match fn { + get_type => || ffi::gst_player_audio_info_get_type(), + } +} + +unsafe impl Send for PlayerAudioInfo {} +unsafe impl Sync for PlayerAudioInfo {} + +pub trait PlayerAudioInfoExt { + fn get_bitrate(&self) -> i32; + + fn get_channels(&self) -> i32; + + fn get_language(&self) -> Option; + + fn get_max_bitrate(&self) -> i32; + + fn get_sample_rate(&self) -> i32; +} + +impl> PlayerAudioInfoExt for O { + fn get_bitrate(&self) -> i32 { + unsafe { + ffi::gst_player_audio_info_get_bitrate(self.to_glib_none().0) + } + } + + fn get_channels(&self) -> i32 { + unsafe { + ffi::gst_player_audio_info_get_channels(self.to_glib_none().0) + } + } + + fn get_language(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_audio_info_get_language(self.to_glib_none().0)) + } + } + + fn get_max_bitrate(&self) -> i32 { + unsafe { + ffi::gst_player_audio_info_get_max_bitrate(self.to_glib_none().0) + } + } + + fn get_sample_rate(&self) -> i32 { + unsafe { + ffi::gst_player_audio_info_get_sample_rate(self.to_glib_none().0) + } + } +} diff --git a/gstreamer-player/src/auto/player_g_main_context_signal_dispatcher.rs b/gstreamer-player/src/auto/player_g_main_context_signal_dispatcher.rs new file mode 100644 index 000000000..4170f817d --- /dev/null +++ b/gstreamer-player/src/auto/player_g_main_context_signal_dispatcher.rs @@ -0,0 +1,49 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use PlayerSignalDispatcher; +use ffi; +use glib; +use glib::Value; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerGMainContextSignalDispatcher(Object): PlayerSignalDispatcher; + + match fn { + get_type => || ffi::gst_player_g_main_context_signal_dispatcher_get_type(), + } +} + +impl PlayerGMainContextSignalDispatcher { + pub fn new<'a, P: Into>>(application_context: P) -> Option { + assert_initialized_main_thread!(); + let application_context = application_context.into(); + let application_context = application_context.to_glib_none(); + unsafe { + from_glib_full(ffi::gst_player_g_main_context_signal_dispatcher_new(application_context.0)) + } + } +} + +unsafe impl Send for PlayerGMainContextSignalDispatcher {} +unsafe impl Sync for PlayerGMainContextSignalDispatcher {} + +pub trait PlayerGMainContextSignalDispatcherExt { + fn get_property_application_context(&self) -> Option; +} + +impl + IsA> PlayerGMainContextSignalDispatcherExt for O { + fn get_property_application_context(&self) -> Option { + let mut value = Value::from(None::<&glib::MainContext>); + unsafe { + gobject_ffi::g_object_get_property(self.to_glib_none().0, "application-context".to_glib_none().0, value.to_glib_none_mut().0); + } + value.get() + } +} diff --git a/gstreamer-player/src/auto/player_media_info.rs b/gstreamer-player/src/auto/player_media_info.rs new file mode 100644 index 000000000..d2edc403c --- /dev/null +++ b/gstreamer-player/src/auto/player_media_info.rs @@ -0,0 +1,166 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use PlayerAudioInfo; +use PlayerStreamInfo; +use PlayerSubtitleInfo; +use PlayerVideoInfo; +use ffi; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerMediaInfo(Object); + + match fn { + get_type => || ffi::gst_player_media_info_get_type(), + } +} + +unsafe impl Send for PlayerMediaInfo {} +unsafe impl Sync for PlayerMediaInfo {} + +pub trait PlayerMediaInfoExt { + fn get_audio_streams(&self) -> Vec; + + fn get_container_format(&self) -> Option; + + fn get_duration(&self) -> gst::ClockTime; + + fn get_image_sample(&self) -> Option; + + #[cfg(feature = "v1_12")] + fn get_number_of_audio_streams(&self) -> u32; + + #[cfg(feature = "v1_12")] + fn get_number_of_streams(&self) -> u32; + + #[cfg(feature = "v1_12")] + fn get_number_of_subtitle_streams(&self) -> u32; + + #[cfg(feature = "v1_12")] + fn get_number_of_video_streams(&self) -> u32; + + fn get_stream_list(&self) -> Vec; + + fn get_subtitle_streams(&self) -> Vec; + + fn get_tags(&self) -> Option; + + fn get_title(&self) -> Option; + + fn get_uri(&self) -> Option; + + fn get_video_streams(&self) -> Vec; + + fn is_live(&self) -> bool; + + fn is_seekable(&self) -> bool; +} + +impl> PlayerMediaInfoExt for O { + fn get_audio_streams(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_audio_streams(self.to_glib_none().0)) + } + } + + fn get_container_format(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_media_info_get_container_format(self.to_glib_none().0)) + } + } + + fn get_duration(&self) -> gst::ClockTime { + unsafe { + ffi::gst_player_media_info_get_duration(self.to_glib_none().0) + } + } + + fn get_image_sample(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_media_info_get_image_sample(self.to_glib_none().0)) + } + } + + #[cfg(feature = "v1_12")] + fn get_number_of_audio_streams(&self) -> u32 { + unsafe { + ffi::gst_player_media_info_get_number_of_audio_streams(self.to_glib_none().0) + } + } + + #[cfg(feature = "v1_12")] + fn get_number_of_streams(&self) -> u32 { + unsafe { + ffi::gst_player_media_info_get_number_of_streams(self.to_glib_none().0) + } + } + + #[cfg(feature = "v1_12")] + fn get_number_of_subtitle_streams(&self) -> u32 { + unsafe { + ffi::gst_player_media_info_get_number_of_subtitle_streams(self.to_glib_none().0) + } + } + + #[cfg(feature = "v1_12")] + fn get_number_of_video_streams(&self) -> u32 { + unsafe { + ffi::gst_player_media_info_get_number_of_video_streams(self.to_glib_none().0) + } + } + + fn get_stream_list(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_stream_list(self.to_glib_none().0)) + } + } + + fn get_subtitle_streams(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_subtitle_streams(self.to_glib_none().0)) + } + } + + fn get_tags(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_media_info_get_tags(self.to_glib_none().0)) + } + } + + fn get_title(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_media_info_get_title(self.to_glib_none().0)) + } + } + + fn get_uri(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_media_info_get_uri(self.to_glib_none().0)) + } + } + + fn get_video_streams(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_video_streams(self.to_glib_none().0)) + } + } + + fn is_live(&self) -> bool { + unsafe { + from_glib(ffi::gst_player_media_info_is_live(self.to_glib_none().0)) + } + } + + fn is_seekable(&self) -> bool { + unsafe { + from_glib(ffi::gst_player_media_info_is_seekable(self.to_glib_none().0)) + } + } +} diff --git a/gstreamer-player/src/auto/player_signal_dispatcher.rs b/gstreamer-player/src/auto/player_signal_dispatcher.rs new file mode 100644 index 000000000..93da41bbd --- /dev/null +++ b/gstreamer-player/src/auto/player_signal_dispatcher.rs @@ -0,0 +1,25 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use ffi; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerSignalDispatcher(Object); + + match fn { + get_type => || ffi::gst_player_signal_dispatcher_get_type(), + } +} + +unsafe impl Send for PlayerSignalDispatcher {} +unsafe impl Sync for PlayerSignalDispatcher {} + +pub trait PlayerSignalDispatcherExt {} + +impl> PlayerSignalDispatcherExt for O {} diff --git a/gstreamer-player/src/auto/player_stream_info.rs b/gstreamer-player/src/auto/player_stream_info.rs new file mode 100644 index 000000000..6bec6a766 --- /dev/null +++ b/gstreamer-player/src/auto/player_stream_info.rs @@ -0,0 +1,66 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use ffi; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerStreamInfo(Object); + + match fn { + get_type => || ffi::gst_player_stream_info_get_type(), + } +} + +unsafe impl Send for PlayerStreamInfo {} +unsafe impl Sync for PlayerStreamInfo {} + +pub trait PlayerStreamInfoExt { + fn get_caps(&self) -> Option; + + fn get_codec(&self) -> Option; + + fn get_index(&self) -> i32; + + fn get_stream_type(&self) -> Option; + + fn get_tags(&self) -> Option; +} + +impl> PlayerStreamInfoExt for O { + fn get_caps(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_stream_info_get_caps(self.to_glib_none().0)) + } + } + + fn get_codec(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_stream_info_get_codec(self.to_glib_none().0)) + } + } + + fn get_index(&self) -> i32 { + unsafe { + ffi::gst_player_stream_info_get_index(self.to_glib_none().0) + } + } + + fn get_stream_type(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_stream_info_get_stream_type(self.to_glib_none().0)) + } + } + + fn get_tags(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_stream_info_get_tags(self.to_glib_none().0)) + } + } +} diff --git a/gstreamer-player/src/auto/player_subtitle_info.rs b/gstreamer-player/src/auto/player_subtitle_info.rs new file mode 100644 index 000000000..0d7e7cfac --- /dev/null +++ b/gstreamer-player/src/auto/player_subtitle_info.rs @@ -0,0 +1,34 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use PlayerStreamInfo; +use ffi; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerSubtitleInfo(Object): PlayerStreamInfo; + + match fn { + get_type => || ffi::gst_player_subtitle_info_get_type(), + } +} + +unsafe impl Send for PlayerSubtitleInfo {} +unsafe impl Sync for PlayerSubtitleInfo {} + +pub trait PlayerSubtitleInfoExt { + fn get_language(&self) -> Option; +} + +impl> PlayerSubtitleInfoExt for O { + fn get_language(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_player_subtitle_info_get_language(self.to_glib_none().0)) + } + } +} diff --git a/gstreamer-player/src/auto/player_video_info.rs b/gstreamer-player/src/auto/player_video_info.rs new file mode 100644 index 000000000..60b1c86c8 --- /dev/null +++ b/gstreamer-player/src/auto/player_video_info.rs @@ -0,0 +1,80 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use PlayerStreamInfo; +use ffi; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerVideoInfo(Object): PlayerStreamInfo; + + match fn { + get_type => || ffi::gst_player_video_info_get_type(), + } +} + +unsafe impl Send for PlayerVideoInfo {} +unsafe impl Sync for PlayerVideoInfo {} + +pub trait PlayerVideoInfoExt { + fn get_bitrate(&self) -> i32; + + fn get_framerate(&self) -> (i32, i32); + + fn get_height(&self) -> i32; + + fn get_max_bitrate(&self) -> i32; + + fn get_pixel_aspect_ratio(&self) -> (u32, u32); + + fn get_width(&self) -> i32; +} + +impl> PlayerVideoInfoExt for O { + fn get_bitrate(&self) -> i32 { + unsafe { + ffi::gst_player_video_info_get_bitrate(self.to_glib_none().0) + } + } + + fn get_framerate(&self) -> (i32, i32) { + unsafe { + let mut fps_n = mem::uninitialized(); + let mut fps_d = mem::uninitialized(); + ffi::gst_player_video_info_get_framerate(self.to_glib_none().0, &mut fps_n, &mut fps_d); + (fps_n, fps_d) + } + } + + fn get_height(&self) -> i32 { + unsafe { + ffi::gst_player_video_info_get_height(self.to_glib_none().0) + } + } + + fn get_max_bitrate(&self) -> i32 { + unsafe { + ffi::gst_player_video_info_get_max_bitrate(self.to_glib_none().0) + } + } + + fn get_pixel_aspect_ratio(&self) -> (u32, u32) { + unsafe { + let mut par_n = mem::uninitialized(); + let mut par_d = mem::uninitialized(); + ffi::gst_player_video_info_get_pixel_aspect_ratio(self.to_glib_none().0, &mut par_n, &mut par_d); + (par_n, par_d) + } + } + + fn get_width(&self) -> i32 { + unsafe { + ffi::gst_player_video_info_get_width(self.to_glib_none().0) + } + } +} diff --git a/gstreamer-player/src/auto/player_video_overlay_video_renderer.rs b/gstreamer-player/src/auto/player_video_overlay_video_renderer.rs new file mode 100644 index 000000000..15eb17126 --- /dev/null +++ b/gstreamer-player/src/auto/player_video_overlay_video_renderer.rs @@ -0,0 +1,98 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use PlayerVideoRenderer; +use ffi; +use glib; +use glib::Value; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerVideoOverlayVideoRenderer(Object): PlayerVideoRenderer; + + match fn { + get_type => || ffi::gst_player_video_overlay_video_renderer_get_type(), + } +} + +impl PlayerVideoOverlayVideoRenderer { + //pub fn new>>(window_handle: P) -> Option { + // unsafe { TODO: call ffi::gst_player_video_overlay_video_renderer_new() } + //} + + //pub fn new_with_sink>, Q: IsA>(window_handle: P, video_sink: &Q) -> Option { + // unsafe { TODO: call ffi::gst_player_video_overlay_video_renderer_new_with_sink() } + //} +} + +unsafe impl Send for PlayerVideoOverlayVideoRenderer {} +unsafe impl Sync for PlayerVideoOverlayVideoRenderer {} + +pub trait PlayerVideoOverlayVideoRendererExt { + fn expose(&self); + + fn get_render_rectangle(&self) -> (i32, i32, i32, i32); + + //fn get_window_handle(&self) -> /*Unimplemented*/Option; + + fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32); + + //fn set_window_handle>>(&self, window_handle: P); + + fn get_property_video_sink(&self) -> Option; + + fn set_property_video_sink + IsA + glib::value::SetValueOptional>(&self, video_sink: Option<&P>); +} + +impl + IsA> PlayerVideoOverlayVideoRendererExt for O { + fn expose(&self) { + unsafe { + ffi::gst_player_video_overlay_video_renderer_expose(self.to_glib_none().0); + } + } + + fn get_render_rectangle(&self) -> (i32, i32, i32, i32) { + unsafe { + let mut x = mem::uninitialized(); + let mut y = mem::uninitialized(); + let mut width = mem::uninitialized(); + let mut height = mem::uninitialized(); + ffi::gst_player_video_overlay_video_renderer_get_render_rectangle(self.to_glib_none().0, &mut x, &mut y, &mut width, &mut height); + (x, y, width, height) + } + } + + //fn get_window_handle(&self) -> /*Unimplemented*/Option { + // unsafe { TODO: call ffi::gst_player_video_overlay_video_renderer_get_window_handle() } + //} + + fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) { + unsafe { + ffi::gst_player_video_overlay_video_renderer_set_render_rectangle(self.to_glib_none().0, x, y, width, height); + } + } + + //fn set_window_handle>>(&self, window_handle: P) { + // unsafe { TODO: call ffi::gst_player_video_overlay_video_renderer_set_window_handle() } + //} + + fn get_property_video_sink(&self) -> Option { + let mut value = Value::from(None::<&gst::Element>); + unsafe { + gobject_ffi::g_object_get_property(self.to_glib_none().0, "video-sink".to_glib_none().0, value.to_glib_none_mut().0); + } + value.get() + } + + fn set_property_video_sink + IsA + glib::value::SetValueOptional>(&self, video_sink: Option<&P>) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "video-sink".to_glib_none().0, Value::from(video_sink).to_glib_none().0); + } + } +} diff --git a/gstreamer-player/src/auto/player_video_renderer.rs b/gstreamer-player/src/auto/player_video_renderer.rs new file mode 100644 index 000000000..3ac0665cb --- /dev/null +++ b/gstreamer-player/src/auto/player_video_renderer.rs @@ -0,0 +1,25 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use ffi; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerVideoRenderer(Object); + + match fn { + get_type => || ffi::gst_player_video_renderer_get_type(), + } +} + +unsafe impl Send for PlayerVideoRenderer {} +unsafe impl Sync for PlayerVideoRenderer {} + +pub trait PlayerVideoRendererExt {} + +impl> PlayerVideoRendererExt for O {} diff --git a/gstreamer-player/src/auto/player_visualization.rs b/gstreamer-player/src/auto/player_visualization.rs new file mode 100644 index 000000000..8d118cd19 --- /dev/null +++ b/gstreamer-player/src/auto/player_visualization.rs @@ -0,0 +1,22 @@ +// This file was generated by gir (f00d658) from gir-files (???) +// DO NOT EDIT + +use ffi; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct PlayerVisualization(Boxed); + + match fn { + copy => |ptr| ffi::gst_player_visualization_copy(mut_override(ptr)), + free => |ptr| ffi::gst_player_visualization_free(ptr), + get_type => || ffi::gst_player_visualization_get_type(), + } +} + +unsafe impl Send for PlayerVisualization {} +unsafe impl Sync for PlayerVisualization {}