public static void HandleError(mpv_error err, bool throwException, params string[] messages) { if (throwException) { throw new Exception(GetError(err)); } }
public static int get_property_int(IntPtr handle, string name, bool throwException = false) { mpv_error err = mpv_get_property(handle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_INT64, out IntPtr lpBuffer); if (err < 0) { HandleError(err, throwException, $"error getting property: {name}"); } return(lpBuffer.ToInt32()); }
public static double get_property_number(IntPtr handle, string name, bool throwException = false) { mpv_error err = mpv_get_property(handle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_DOUBLE, out double value); if (err < 0) { HandleError(err, throwException, $"error getting property: {name}"); } return(value); }
public static string get_property_string(IntPtr handle, string name, bool throwException = false) { mpv_error err = mpv_get_property(handle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_STRING, out IntPtr lpBuffer); if (err == 0) { string ret = ConvertFromUtf8(lpBuffer); mpv_free(lpBuffer); return(ret); } HandleError(err, throwException, $"error getting property: {name}"); return(""); }
public static extern IntPtr mpv_error_string(mpv_error error);
public static string GetError(mpv_error err) => ConvertFromUtf8(mpv_error_string(err));