has_events(MPV__Simple* ctx) CODE: int ret; int pipefd = pipes[0]; if (pipefd < 0) ret = -1; else { struct pollfd pfds[1] = { { .fd = pipefd, .events = POLLIN }, }; // Wait until there are possibly new mpv events poll(pfds,1,0); if (pfds[0].revents & POLLIN) { // Empty the pipe. Doing this before calling mpv_wait_event() // ensures that no wakeups are missed. It's not so important to // make sure the pipe is really empty (it will just cause some // additional wakeups in unlikely corner cases). char unused[256]; read(pipefd, unused, sizeof(unused)); ret = 1; } else { ret = 0; } } RETVAL = ret; OUTPUT: RETVAL