1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.Threading;
7 using System.ComponentModel;
10 /// <summary>Efl media playable interface</summary>
11 [Efl.IPlayableConcrete.NativeMethods]
12 public interface IPlayable :
13 Efl.Eo.IWrapper, IDisposable
15 /// <summary>Get the length of play for the media file.</summary>
16 /// <returns>The length of the stream in seconds.</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>
30 /// <summary>Get whether the media file is seekable.</summary>
31 /// <value><c>true</c> if seekable.</value>
36 /// <summary>Efl media playable interface</summary>
37 sealed public class IPlayableConcrete :
42 ///<summary>Pointer to the native class description.</summary>
43 public System.IntPtr NativeClass
47 if (((object)this).GetType() == typeof(IPlayableConcrete))
49 return GetEflClassStatic();
53 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
58 private System.IntPtr handle;
59 ///<summary>Pointer to the native instance.</summary>
60 public System.IntPtr NativeHandle
62 get { return handle; }
65 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
66 efl_playable_interface_get();
67 /// <summary>Initializes a new instance of the <see cref="IPlayable"/> class.
68 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
69 private IPlayableConcrete(System.IntPtr raw)
73 ///<summary>Destructor.</summary>
79 ///<summary>Releases the underlying native instance.</summary>
80 private void Dispose(bool disposing)
82 if (handle != System.IntPtr.Zero)
87 IntPtr gcHandlePtr = IntPtr.Zero;
90 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
94 Monitor.Enter(Efl.All.InitLock);
95 if (Efl.All.MainLoopInitialized)
97 Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
100 Monitor.Exit(Efl.All.InitLock);
106 ///<summary>Releases the underlying native instance.</summary>
107 public void Dispose()
110 GC.SuppressFinalize(this);
113 /// <summary>Verifies if the given object is equal to this one.</summary>
114 /// <param name="instance">The object to compare to.</param>
115 /// <returns>True if both objects point to the same native object.</returns>
116 public override bool Equals(object instance)
118 var other = instance as Efl.Object;
123 return this.NativeHandle == other.NativeHandle;
126 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
127 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
128 public override int GetHashCode()
130 return this.NativeHandle.ToInt32();
133 /// <summary>Turns the native pointer into a string representation.</summary>
134 /// <returns>A string with the type and the native pointer for this object.</returns>
135 public override String ToString()
137 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
140 /// <summary>Get the length of play for the media file.</summary>
141 /// <returns>The length of the stream in seconds.</returns>
142 public double GetLength() {
143 var _ret_var = Efl.IPlayableConcrete.NativeMethods.efl_playable_length_get_ptr.Value.Delegate(this.NativeHandle);
144 Eina.Error.RaiseIfUnhandledException();
147 public bool GetPlayable() {
148 var _ret_var = Efl.IPlayableConcrete.NativeMethods.efl_playable_get_ptr.Value.Delegate(this.NativeHandle);
149 Eina.Error.RaiseIfUnhandledException();
152 /// <summary>Get whether the media file is seekable.</summary>
153 /// <returns><c>true</c> if seekable.</returns>
154 public bool GetSeekable() {
155 var _ret_var = Efl.IPlayableConcrete.NativeMethods.efl_playable_seekable_get_ptr.Value.Delegate(this.NativeHandle);
156 Eina.Error.RaiseIfUnhandledException();
159 /// <summary>Get the length of play for the media file.</summary>
160 /// <value>The length of the stream in seconds.</value>
161 public double Length {
162 get { return GetLength(); }
164 public bool Playable {
165 get { return GetPlayable(); }
167 /// <summary>Get whether the media file is seekable.</summary>
168 /// <value><c>true</c> if seekable.</value>
169 public bool Seekable {
170 get { return GetSeekable(); }
172 private static IntPtr GetEflClassStatic()
174 return Efl.IPlayableConcrete.efl_playable_interface_get();
176 /// <summary>Wrapper for native methods and virtual method delegates.
177 /// For internal use by generated code only.</summary>
178 public class NativeMethods : Efl.Eo.NativeClass
180 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
181 /// <summary>Gets the list of Eo operations to override.</summary>
182 /// <returns>The list of Eo operations to be overload.</returns>
183 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
185 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
186 var methods = Efl.Eo.Globals.GetUserMethods(type);
188 if (efl_playable_length_get_static_delegate == null)
190 efl_playable_length_get_static_delegate = new efl_playable_length_get_delegate(length_get);
193 if (methods.FirstOrDefault(m => m.Name == "GetLength") != null)
195 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) });
198 if (efl_playable_get_static_delegate == null)
200 efl_playable_get_static_delegate = new efl_playable_get_delegate(playable_get);
203 if (methods.FirstOrDefault(m => m.Name == "GetPlayable") != null)
205 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) });
208 if (efl_playable_seekable_get_static_delegate == null)
210 efl_playable_seekable_get_static_delegate = new efl_playable_seekable_get_delegate(seekable_get);
213 if (methods.FirstOrDefault(m => m.Name == "GetSeekable") != null)
215 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) });
220 /// <summary>Returns the Eo class for the native methods of this class.</summary>
221 /// <returns>The native class pointer.</returns>
222 public override IntPtr GetEflClass()
224 return Efl.IPlayableConcrete.efl_playable_interface_get();
227 #pragma warning disable CA1707, SA1300, SA1600
230 private delegate double efl_playable_length_get_delegate(System.IntPtr obj, System.IntPtr pd);
233 public delegate double efl_playable_length_get_api_delegate(System.IntPtr obj);
235 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");
237 private static double length_get(System.IntPtr obj, System.IntPtr pd)
239 Eina.Log.Debug("function efl_playable_length_get was called");
240 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
243 double _ret_var = default(double);
246 _ret_var = ((IPlayable)wrapper).GetLength();
250 Eina.Log.Warning($"Callback error: {e.ToString()}");
251 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
259 return efl_playable_length_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
263 private static efl_playable_length_get_delegate efl_playable_length_get_static_delegate;
265 [return: MarshalAs(UnmanagedType.U1)]
266 private delegate bool efl_playable_get_delegate(System.IntPtr obj, System.IntPtr pd);
268 [return: MarshalAs(UnmanagedType.U1)]
269 public delegate bool efl_playable_get_api_delegate(System.IntPtr obj);
271 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");
273 private static bool playable_get(System.IntPtr obj, System.IntPtr pd)
275 Eina.Log.Debug("function efl_playable_get was called");
276 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
279 bool _ret_var = default(bool);
282 _ret_var = ((IPlayable)wrapper).GetPlayable();
286 Eina.Log.Warning($"Callback error: {e.ToString()}");
287 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
295 return efl_playable_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
299 private static efl_playable_get_delegate efl_playable_get_static_delegate;
301 [return: MarshalAs(UnmanagedType.U1)]
302 private delegate bool efl_playable_seekable_get_delegate(System.IntPtr obj, System.IntPtr pd);
304 [return: MarshalAs(UnmanagedType.U1)]
305 public delegate bool efl_playable_seekable_get_api_delegate(System.IntPtr obj);
307 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");
309 private static bool seekable_get(System.IntPtr obj, System.IntPtr pd)
311 Eina.Log.Debug("function efl_playable_seekable_get was called");
312 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
315 bool _ret_var = default(bool);
318 _ret_var = ((IPlayable)wrapper).GetSeekable();
322 Eina.Log.Warning($"Callback error: {e.ToString()}");
323 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
331 return efl_playable_seekable_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
335 private static efl_playable_seekable_get_delegate efl_playable_seekable_get_static_delegate;
337 #pragma warning restore CA1707, SA1300, SA1600