mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-09-25 05:20:18 +00:00
743 lines
26 KiB
Rust
743 lines
26 KiB
Rust
// 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<ffi::GstPlayer>);
|
|
|
|
match fn {
|
|
get_type => || ffi::gst_player_get_type(),
|
|
}
|
|
}
|
|
|
|
impl Player {
|
|
pub fn new<'a, 'b, P: IsA<PlayerVideoRenderer> + 'a, Q: Into<Option<&'a P>>, R: IsA<PlayerSignalDispatcher> + 'b, S: Into<Option<&'b R>>>(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<String> {
|
|
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<PlayerAudioInfo> {
|
|
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<PlayerSubtitleInfo> {
|
|
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<PlayerVideoInfo> {
|
|
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<PlayerVisualization> {
|
|
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<gst::Structure>;
|
|
|
|
fn get_current_audio_track(&self) -> Option<PlayerAudioInfo>;
|
|
|
|
fn get_current_subtitle_track(&self) -> Option<PlayerSubtitleInfo>;
|
|
|
|
fn get_current_video_track(&self) -> Option<PlayerVideoInfo>;
|
|
|
|
fn get_current_visualization(&self) -> Option<String>;
|
|
|
|
fn get_duration(&self) -> gst::ClockTime;
|
|
|
|
fn get_media_info(&self) -> Option<PlayerMediaInfo>;
|
|
|
|
//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<gst::Element>;
|
|
|
|
fn get_position(&self) -> gst::ClockTime;
|
|
|
|
fn get_rate(&self) -> f64;
|
|
|
|
fn get_subtitle_uri(&self) -> Option<String>;
|
|
|
|
fn get_uri(&self) -> Option<String>;
|
|
|
|
fn get_video_snapshot<'a, P: Into<Option<&'a gst::Structure>>>(&self, format: PlayerSnapshotFormat, config: P) -> Option<gst::Sample>;
|
|
|
|
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<String>;
|
|
|
|
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<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_duration_changed<F: Fn(&Self, u64) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_end_of_stream<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_error<F: Fn(&Self, &Error) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_media_info_updated<F: Fn(&Self, &PlayerMediaInfo) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_mute_changed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_position_updated<F: Fn(&Self, u64) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_seek_done<F: Fn(&Self, u64) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_state_changed<F: Fn(&Self, PlayerState) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_uri_loaded<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_video_dimensions_changed<F: Fn(&Self, i32, i32) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_volume_changed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
|
|
fn connect_warning<F: Fn(&Self, &Error) + Send + Sync + 'static>(&self, f: F) -> u64;
|
|
}
|
|
|
|
impl<O: IsA<Player> + IsA<glib::object::Object>> 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<gst::Structure> {
|
|
unsafe {
|
|
from_glib_full(ffi::gst_player_get_config(self.to_glib_none().0))
|
|
}
|
|
}
|
|
|
|
fn get_current_audio_track(&self) -> Option<PlayerAudioInfo> {
|
|
unsafe {
|
|
from_glib_full(ffi::gst_player_get_current_audio_track(self.to_glib_none().0))
|
|
}
|
|
}
|
|
|
|
fn get_current_subtitle_track(&self) -> Option<PlayerSubtitleInfo> {
|
|
unsafe {
|
|
from_glib_none(ffi::gst_player_get_current_subtitle_track(self.to_glib_none().0))
|
|
}
|
|
}
|
|
|
|
fn get_current_video_track(&self) -> Option<PlayerVideoInfo> {
|
|
unsafe {
|
|
from_glib_full(ffi::gst_player_get_current_video_track(self.to_glib_none().0))
|
|
}
|
|
}
|
|
|
|
fn get_current_visualization(&self) -> Option<String> {
|
|
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<PlayerMediaInfo> {
|
|
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<gst::Element> {
|
|
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<String> {
|
|
unsafe {
|
|
from_glib_full(ffi::gst_player_get_subtitle_uri(self.to_glib_none().0))
|
|
}
|
|
}
|
|
|
|
fn get_uri(&self) -> Option<String> {
|
|
unsafe {
|
|
from_glib_full(ffi::gst_player_get_uri(self.to_glib_none().0))
|
|
}
|
|
}
|
|
|
|
fn get_video_snapshot<'a, P: Into<Option<&'a gst::Structure>>>(&self, format: PlayerSnapshotFormat, config: P) -> Option<gst::Sample> {
|
|
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<String> {
|
|
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::<u32>().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::<i32>().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<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, i32) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "buffering",
|
|
transmute(buffering_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_duration_changed<F: Fn(&Self, u64) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, u64) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "duration-changed",
|
|
transmute(duration_changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_end_of_stream<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "end-of-stream",
|
|
transmute(end_of_stream_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_error<F: Fn(&Self, &Error) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, &Error) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "error",
|
|
transmute(error_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_media_info_updated<F: Fn(&Self, &PlayerMediaInfo) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, &PlayerMediaInfo) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "media-info-updated",
|
|
transmute(media_info_updated_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_mute_changed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "mute-changed",
|
|
transmute(mute_changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_position_updated<F: Fn(&Self, u64) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, u64) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "position-updated",
|
|
transmute(position_updated_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_seek_done<F: Fn(&Self, u64) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, u64) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "seek-done",
|
|
transmute(seek_done_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_state_changed<F: Fn(&Self, PlayerState) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, PlayerState) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "state-changed",
|
|
transmute(state_changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_uri_loaded<F: Fn(&Self, &str) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, &str) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "uri-loaded",
|
|
transmute(uri_loaded_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_video_dimensions_changed<F: Fn(&Self, i32, i32) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, i32, i32) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "video-dimensions-changed",
|
|
transmute(video_dimensions_changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_volume_changed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "volume-changed",
|
|
transmute(volume_changed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
|
|
fn connect_warning<F: Fn(&Self, &Error) + Send + Sync + 'static>(&self, f: F) -> u64 {
|
|
unsafe {
|
|
let f: Box_<Box_<Fn(&Self, &Error) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
|
connect(self.to_glib_none().0, "warning",
|
|
transmute(warning_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
}
|
|
}
|
|
}
|
|
|
|
unsafe extern "C" fn buffering_trampoline<P>(this: *mut ffi::GstPlayer, object: libc::c_int, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, i32) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), object)
|
|
}
|
|
|
|
unsafe extern "C" fn duration_changed_trampoline<P>(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, u64) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), object)
|
|
}
|
|
|
|
unsafe extern "C" fn end_of_stream_trampoline<P>(this: *mut ffi::GstPlayer, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked())
|
|
}
|
|
|
|
unsafe extern "C" fn error_trampoline<P>(this: *mut ffi::GstPlayer, object: *mut glib_ffi::GError, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, &Error) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), &from_glib_none(object))
|
|
}
|
|
|
|
unsafe extern "C" fn media_info_updated_trampoline<P>(this: *mut ffi::GstPlayer, object: *mut ffi::GstPlayerMediaInfo, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, &PlayerMediaInfo) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), &from_glib_none(object))
|
|
}
|
|
|
|
unsafe extern "C" fn mute_changed_trampoline<P>(this: *mut ffi::GstPlayer, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked())
|
|
}
|
|
|
|
unsafe extern "C" fn position_updated_trampoline<P>(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, u64) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), object)
|
|
}
|
|
|
|
unsafe extern "C" fn seek_done_trampoline<P>(this: *mut ffi::GstPlayer, object: u64, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, u64) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), object)
|
|
}
|
|
|
|
unsafe extern "C" fn state_changed_trampoline<P>(this: *mut ffi::GstPlayer, object: ffi::GstPlayerState, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, PlayerState) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), from_glib(object))
|
|
}
|
|
|
|
unsafe extern "C" fn uri_loaded_trampoline<P>(this: *mut ffi::GstPlayer, object: *mut libc::c_char, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, &str) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), &String::from_glib_none(object))
|
|
}
|
|
|
|
unsafe extern "C" fn video_dimensions_changed_trampoline<P>(this: *mut ffi::GstPlayer, object: libc::c_int, p0: libc::c_int, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, i32, i32) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), object, p0)
|
|
}
|
|
|
|
unsafe extern "C" fn volume_changed_trampoline<P>(this: *mut ffi::GstPlayer, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked())
|
|
}
|
|
|
|
unsafe extern "C" fn warning_trampoline<P>(this: *mut ffi::GstPlayer, object: *mut glib_ffi::GError, f: glib_ffi::gpointer)
|
|
where P: IsA<Player> {
|
|
callback_guard!();
|
|
let f: &Box_<Fn(&P, &Error) + Send + Sync + 'static> = transmute(f);
|
|
f(&Player::from_glib_none(this).downcast_unchecked(), &from_glib_none(object))
|
|
}
|