12345678910111213141516171819202122232425262728293031 |
- #include <stdio.h>
- #include <stdlib.h>
- #include <mpv/client.h>
- #include "event.h"
- #include "libmpv.h"
- void
- event_handler(void)
- {
- mpv_event *event = mpv_wait_event(ctx, 0.1);
- switch (event->event_id) {
- case MPV_EVENT_IDLE:
- fprintf(stderr, "event: %s\n", mpv_event_name(event->event_id));
- break;
- case MPV_EVENT_FILE_LOADED:
- libmpv_event_file_loaded();
- break;
- case MPV_EVENT_SHUTDOWN:
- mpv_terminate_destroy(ctx);
- exit(EXIT_SUCCESS);
- break;
- }
- fflush(stdout);
- return;
- }
|