Remove invalid mpv options and fix event handling
This commit is contained in:
parent
580cd1fe2b
commit
463071ae89
1 changed files with 14 additions and 4 deletions
|
|
@ -54,10 +54,8 @@ mpv_widget_on_realize(GtkWidget *widget, gpointer user_data)
|
|||
if (!self->mpv)
|
||||
return;
|
||||
|
||||
mpv_set_option_string(self->mpv, "vo", "gpu-api");
|
||||
mpv_set_option_string(self->mpv, "hwdec", "auto");
|
||||
mpv_set_option_string(self->mpv, "keep-open", "yes");
|
||||
mpv_set_option_string(self->mpv, "gpu-context", "drm");
|
||||
|
||||
if (mpv_initialize(self->mpv) < 0) {
|
||||
mpv_terminate_destroy(self->mpv);
|
||||
|
|
@ -152,8 +150,20 @@ mpv_widget_tick(gpointer user_data)
|
|||
if (!self->mpv)
|
||||
return G_SOURCE_CONTINUE;
|
||||
|
||||
mpv_event *event = mpv_wait_event(self->mpv, 0);
|
||||
(void)event;
|
||||
while (self->mpv) {
|
||||
mpv_event *event = mpv_wait_event(self->mpv, 0);
|
||||
if (event->event_id == MPV_EVENT_NONE)
|
||||
break;
|
||||
if (event->event_id == MPV_EVENT_ERROR) {
|
||||
const char *msg = "mpv playback error";
|
||||
if (event->error && event->error->string)
|
||||
msg = event->error->string;
|
||||
g_signal_emit(self, signals[SIGNAL_ERROR], 0, msg);
|
||||
}
|
||||
if (event->event_id == MPV_EVENT_END_FILE) {
|
||||
g_signal_emit(self, signals[SIGNAL_PLAYBACK_STATE_CHANGED], 0, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
double pos = 0;
|
||||
if (mpv_get_property(self->mpv, "time-pos",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue