Commit 38b97a14 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Add initial, untested version of GstPlayer bindings

parent 440ff3d3
[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"
// 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<ffi::GstPlayerColorBalanceType> 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<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for PlayerColorBalanceType {
unsafe fn from_value(value: &Value) -> Self {
from_glib(std::mem::transmute::<i32, ffi::GstPlayerColorBalanceType>(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<ffi::GstPlayerError> 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<Self> {
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<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for PlayerError {
unsafe fn from_value(value: &Value) -> Self {
from_glib(std::mem::transmute::<i32, ffi::GstPlayerError>(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<ffi::GstPlayerSnapshotFormat> 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<ffi::GstPlayerState> 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<Self> {
Some(FromValue::from_value(value))
}
}
impl<'a> FromValue<'a> for PlayerState {
unsafe fn from_value(value: &Value) -> Self {
from_glib(std::mem::transmute::<i32, ffi::GstPlayerState>(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)
}
}
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::translate::*;
// 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;
}
This diff is collapsed.
// 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<ffi::GstPlayerAudioInfo>): 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<String>;
fn get_max_bitrate(&self) -> i32;
fn get_sample_rate(&self) -> i32;
}
impl<O: IsA<PlayerAudioInfo>> 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<String> {
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)
}
}
}
// 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<ffi::GstPlayerGMainContextSignalDispatcher>): PlayerSignalDispatcher;
match fn {
get_type => || ffi::gst_player_g_main_context_signal_dispatcher_get_type(),
}
}
impl PlayerGMainContextSignalDispatcher {
pub fn new<'a, P: Into<Option<&'a glib::MainContext>>>(application_context: P) -> Option<PlayerSignalDispatcher> {
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<glib::MainContext>;
}
impl<O: IsA<PlayerGMainContextSignalDispatcher> + IsA<glib::object::Object>> PlayerGMainContextSignalDispatcherExt for O {
fn get_property_application_context(&self) -> Option<glib::MainContext> {
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()
}
}
// 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<ffi::GstPlayerMediaInfo>);
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<PlayerAudioInfo>;
fn get_container_format(&self) -> Option<String>;
fn get_duration(&self) -> gst::ClockTime;
fn get_image_sample(&self) -> Option<gst::Sample>;
#[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<PlayerStreamInfo>;
fn get_subtitle_streams(&self) -> Vec<PlayerSubtitleInfo>;
fn get_tags(&self) -> Option<gst::TagList>;
fn get_title(&self) -> Option<String>;
fn get_uri(&self) -> Option<String>;
fn get_video_streams(&self) -> Vec<PlayerVideoInfo>;
fn is_live(&self) -> bool;
fn is_seekable(&self) -> bool;
}
impl<O: IsA<PlayerMediaInfo>> PlayerMediaInfoExt for O {
fn get_audio_streams(&self) -> Vec<PlayerAudioInfo> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_audio_streams(self.to_glib_none().0))
}
}
fn get_container_format(&self) -> Option<String> {
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<gst::Sample> {
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<PlayerStreamInfo> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_stream_list(self.to_glib_none().0))
}
}
fn get_subtitle_streams(&self) -> Vec<PlayerSubtitleInfo> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_subtitle_streams(self.to_glib_none().0))
}
}
fn get_tags(&self) -> Option<gst::TagList> {
unsafe {
from_glib_none(ffi::gst_player_media_info_get_tags(self.to_glib_none().0))
}
}
fn get_title(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_player_media_info_get_title(self.to_glib_none().0))
}
}
fn get_uri(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gst_player_media_info_get_uri(self.to_glib_none().0))
}
}
fn get_video_streams(&self) -> Vec<PlayerVideoInfo> {
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))
}
}
}
// 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<ffi::GstPlayerSignalDispatcher>);
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<O: IsA<PlayerSignalDispatcher>> PlayerSignalDispatcherExt for O {}
// 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<ffi::GstPlayerStreamInfo>);