| 1392 | } |
| 1393 | |
| 1394 | void hb_system_sleep_private_disable(void *opaque) |
| 1395 | { |
| 1396 | #ifdef __APPLE__ |
| 1397 | if (opaque == NULL) |
| 1398 | { |
| 1399 | hb_error("hb_system_sleep: opaque is NULL"); |
| 1400 | return; |
| 1401 | } |
| 1402 | |
| 1403 | IOPMAssertionID *assertionID = (IOPMAssertionID*)opaque; |
| 1404 | if (*assertionID != -1) |
| 1405 | { |
| 1406 | // nothing to do |
| 1407 | return; |
| 1408 | } |
| 1409 | |
| 1410 | // 128 chars limit for IOPMAssertionCreateWithName |
| 1411 | CFStringRef reasonForActivity = |
| 1412 | CFSTR("HandBrake is currently scanning and/or encoding"); |
| 1413 | |
| 1414 | IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertPreventUserIdleSystemSleep, |
| 1415 | kIOPMAssertionLevelOn, |
| 1416 | reasonForActivity, |
| 1417 | assertionID); |
| 1418 | if (success == kIOReturnSuccess) |
| 1419 | { |
| 1420 | hb_deep_log(3, |
| 1421 | "hb_system_sleep: assertion %d created, sleep prevented", |
| 1422 | *assertionID); |
| 1423 | } |
| 1424 | else |
| 1425 | { |
| 1426 | hb_log("hb_system_sleep: failed to prevent system sleep"); |
| 1427 | } |
| 1428 | #endif |
| 1429 | } |
| 1430 | |
| 1431 | void * hb_dlopen(const char *name) |
| 1432 | { |
no test coverage detected