1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.ComponentModel;
8 /// <summary>Efl media playable interface</summary>
9 [IPlayableNativeInherit]
10 public interface IPlayable :
11 Efl.Eo.IWrapper, IDisposable
13 /// <summary>Get the length of play for the media file.</summary>
14 /// <returns>The length of the stream in seconds.</returns>
16 /// <summary></summary>
17 /// <returns></returns>
19 /// <summary>Get whether the media file is seekable.</summary>
20 /// <returns><c>true</c> if seekable.</returns>
22 /// <summary>Get the length of play for the media file.</summary>
23 /// <value>The length of the stream in seconds.</value>
27 /// <summary></summary>
32 /// <summary>Get whether the media file is seekable.</summary>
33 /// <value><c>true</c> if seekable.</value>
38 /// <summary>Efl media playable interface</summary>
39 sealed public class IPlayableConcrete :
44 ///<summary>Pointer to the native class description.</summary>
45 public System.IntPtr NativeClass {
47 if (((object)this).GetType() == typeof (IPlayableConcrete))
48 return Efl.IPlayableNativeInherit.GetEflClassStatic();
50 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
53 private System.IntPtr handle;
54 ///<summary>Pointer to the native instance.</summary>
55 public System.IntPtr NativeHandle {
56 get { return handle; }
58 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
59 efl_playable_interface_get();
60 ///<summary>Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
61 private IPlayableConcrete(System.IntPtr raw)
64 RegisterEventProxies();
66 ///<summary>Destructor.</summary>
71 ///<summary>Releases the underlying native instance.</summary>
72 void Dispose(bool disposing)
74 if (handle != System.IntPtr.Zero) {
75 Efl.Eo.Globals.efl_unref(handle);
76 handle = System.IntPtr.Zero;
79 ///<summary>Releases the underlying native instance.</summary>
83 GC.SuppressFinalize(this);
85 ///<summary>Verifies if the given object is equal to this one.</summary>
86 public override bool Equals(object obj)
88 var other = obj as Efl.Object;
91 return this.NativeHandle == other.NativeHandle;
93 ///<summary>Gets the hash code for this object based on the native pointer it points to.</summary>
94 public override int GetHashCode()
96 return this.NativeHandle.ToInt32();
98 ///<summary>Turns the native pointer into a string representation.</summary>
99 public override String ToString()
101 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
103 ///<summary>Register the Eo event wrappers making the bridge to C# events. Internal usage only.</summary>
104 void RegisterEventProxies()
107 /// <summary>Get the length of play for the media file.</summary>
108 /// <returns>The length of the stream in seconds.</returns>
109 public double GetLength() {
110 var _ret_var = Efl.IPlayableNativeInherit.efl_playable_length_get_ptr.Value.Delegate(this.NativeHandle);
111 Eina.Error.RaiseIfUnhandledException();
114 /// <summary></summary>
115 /// <returns></returns>
116 public bool GetPlayable() {
117 var _ret_var = Efl.IPlayableNativeInherit.efl_playable_get_ptr.Value.Delegate(this.NativeHandle);
118 Eina.Error.RaiseIfUnhandledException();
121 /// <summary>Get whether the media file is seekable.</summary>
122 /// <returns><c>true</c> if seekable.</returns>
123 public bool GetSeekable() {
124 var _ret_var = Efl.IPlayableNativeInherit.efl_playable_seekable_get_ptr.Value.Delegate(this.NativeHandle);
125 Eina.Error.RaiseIfUnhandledException();
128 /// <summary>Get the length of play for the media file.</summary>
129 /// <value>The length of the stream in seconds.</value>
130 public double Length {
131 get { return GetLength(); }
133 /// <summary></summary>
135 public bool Playable {
136 get { return GetPlayable(); }
138 /// <summary>Get whether the media file is seekable.</summary>
139 /// <value><c>true</c> if seekable.</value>
140 public bool Seekable {
141 get { return GetSeekable(); }
143 private static IntPtr GetEflClassStatic()
145 return Efl.IPlayableConcrete.efl_playable_interface_get();
148 public class IPlayableNativeInherit : Efl.Eo.NativeClass{
149 public static Efl.Eo.NativeModule _Module = new Efl.Eo.NativeModule(efl.Libs.Efl);
150 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
152 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
153 var methods = Efl.Eo.Globals.GetUserMethods(type);
154 if (efl_playable_length_get_static_delegate == null)
155 efl_playable_length_get_static_delegate = new efl_playable_length_get_delegate(length_get);
156 if (methods.FirstOrDefault(m => m.Name == "GetLength") != null)
157 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_playable_length_get"), func = Marshal.GetFunctionPointerForDelegate(efl_playable_length_get_static_delegate)});
158 if (efl_playable_get_static_delegate == null)
159 efl_playable_get_static_delegate = new efl_playable_get_delegate(playable_get);
160 if (methods.FirstOrDefault(m => m.Name == "GetPlayable") != null)
161 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_playable_get"), func = Marshal.GetFunctionPointerForDelegate(efl_playable_get_static_delegate)});
162 if (efl_playable_seekable_get_static_delegate == null)
163 efl_playable_seekable_get_static_delegate = new efl_playable_seekable_get_delegate(seekable_get);
164 if (methods.FirstOrDefault(m => m.Name == "GetSeekable") != null)
165 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_playable_seekable_get"), func = Marshal.GetFunctionPointerForDelegate(efl_playable_seekable_get_static_delegate)});
168 public override IntPtr GetEflClass()
170 return Efl.IPlayableConcrete.efl_playable_interface_get();
172 public static IntPtr GetEflClassStatic()
174 return Efl.IPlayableConcrete.efl_playable_interface_get();
178 private delegate double efl_playable_length_get_delegate(System.IntPtr obj, System.IntPtr pd);
181 public delegate double efl_playable_length_get_api_delegate(System.IntPtr obj);
182 public static Efl.Eo.FunctionWrapper<efl_playable_length_get_api_delegate> efl_playable_length_get_ptr = new Efl.Eo.FunctionWrapper<efl_playable_length_get_api_delegate>(_Module, "efl_playable_length_get");
183 private static double length_get(System.IntPtr obj, System.IntPtr pd)
185 Eina.Log.Debug("function efl_playable_length_get was called");
186 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
187 if(wrapper != null) {
188 double _ret_var = default(double);
190 _ret_var = ((IPlayable)wrapper).GetLength();
191 } catch (Exception e) {
192 Eina.Log.Warning($"Callback error: {e.ToString()}");
193 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
197 return efl_playable_length_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
200 private static efl_playable_length_get_delegate efl_playable_length_get_static_delegate;
203 [return: MarshalAs(UnmanagedType.U1)] private delegate bool efl_playable_get_delegate(System.IntPtr obj, System.IntPtr pd);
206 [return: MarshalAs(UnmanagedType.U1)] public delegate bool efl_playable_get_api_delegate(System.IntPtr obj);
207 public static Efl.Eo.FunctionWrapper<efl_playable_get_api_delegate> efl_playable_get_ptr = new Efl.Eo.FunctionWrapper<efl_playable_get_api_delegate>(_Module, "efl_playable_get");
208 private static bool playable_get(System.IntPtr obj, System.IntPtr pd)
210 Eina.Log.Debug("function efl_playable_get was called");
211 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
212 if(wrapper != null) {
213 bool _ret_var = default(bool);
215 _ret_var = ((IPlayable)wrapper).GetPlayable();
216 } catch (Exception e) {
217 Eina.Log.Warning($"Callback error: {e.ToString()}");
218 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
222 return efl_playable_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
225 private static efl_playable_get_delegate efl_playable_get_static_delegate;
228 [return: MarshalAs(UnmanagedType.U1)] private delegate bool efl_playable_seekable_get_delegate(System.IntPtr obj, System.IntPtr pd);
231 [return: MarshalAs(UnmanagedType.U1)] public delegate bool efl_playable_seekable_get_api_delegate(System.IntPtr obj);
232 public static Efl.Eo.FunctionWrapper<efl_playable_seekable_get_api_delegate> efl_playable_seekable_get_ptr = new Efl.Eo.FunctionWrapper<efl_playable_seekable_get_api_delegate>(_Module, "efl_playable_seekable_get");
233 private static bool seekable_get(System.IntPtr obj, System.IntPtr pd)
235 Eina.Log.Debug("function efl_playable_seekable_get was called");
236 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
237 if(wrapper != null) {
238 bool _ret_var = default(bool);
240 _ret_var = ((IPlayable)wrapper).GetSeekable();
241 } catch (Exception e) {
242 Eina.Log.Warning($"Callback error: {e.ToString()}");
243 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
247 return efl_playable_seekable_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
250 private static efl_playable_seekable_get_delegate efl_playable_seekable_get_static_delegate;