MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_system_sleep_private_disable

Function hb_system_sleep_private_disable

libhb/ports.c:1394–1429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1392}
1393
1394void 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
1431void * hb_dlopen(const char *name)
1432{

Callers 1

hb_system_sleep_preventFunction · 0.85

Calls 3

hb_errorFunction · 0.85
hb_deep_logFunction · 0.85
hb_logFunction · 0.85

Tested by

no test coverage detected