Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 52aa1dc2 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

MOD: Fix the sdl2 module with next and prev commands.

- Fix #84
- Introduce the 'hinib' flag, raized when a next/prev command is issued
  and is decresed at each start of files. Thus, for each prev/next
  command the following end of file event will be ignored
parent 3cbf575f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!135Resolve "Lkt prev & next not working properly anymore"
Pipeline #1993 réussi
......@@ -34,6 +34,7 @@ struct module_sdl2_window {
volatile int mpv_time_pos; /* Don't write it in the database */
volatile int mpv_duration; /* Because don't need to be persistent */
volatile int state;
volatile int hinib;
/* Thread related */
struct poller_thread self;
......@@ -370,7 +371,8 @@ loop:
if (event.type == wakeup_on_mpv_events) {
lmpv_handle(&module, (mpv_handle *) sdl2->mpv, sdl2->queue,
&sdl2->mpv_time_pos, &sdl2->mpv_duration, &sdl2->state);
&sdl2->mpv_time_pos, &sdl2->mpv_duration,
&sdl2->state, &sdl2->hinib);
}
}
......@@ -475,6 +477,7 @@ module_sdl2_load_file(struct module_sdl2_window *win, const char *filepath)
bool ret = ! lmpv_load_file((mpv_handle *) win->mpv, filepath);
win->mpv_duration = 0;
win->mpv_time_pos = 0;
win->hinib += 1;
return ret;
}
......
......@@ -154,7 +154,8 @@ lmpv_toggle_pause(mpv_handle *ctx)
int
lmpv_handle(struct lkt_module *mod, mpv_handle *ctx, struct queue *queue,
volatile int *time_pos, volatile int *time_duration, volatile int *state)
volatile int *time_pos, volatile int *time_duration,
volatile int *state, volatile int *hinib)
{
size_t ao_volume;
mpv_event *event = NULL;
......@@ -186,12 +187,15 @@ loop:
return 1;
case MPV_EVENT_START_FILE:
--(*hinib);
LOG_DEBUG("WINDOW", "Start of file!");
break;
case MPV_EVENT_END_FILE:
LOG_DEBUG("WINDOW", "End of file!");
if ((*state) != STATE_STOP)
if ((*hinib) <= 0)
*hinib = 0;
if (((*state) != STATE_STOP) && (*hinib <= 0))
lkt_queue_send(queue, lkt_event_play_next, NULL);
break;
......
......@@ -14,8 +14,11 @@ mpv_handle *lmpv_prepare(volatile sqlite3 *db);
int lmpv_set_volume(mpv_handle *ctx, int vol);
int lmpv_load_file(mpv_handle *ctx, const char *file);
int lmpv_toggle_pause(mpv_handle *ctx);
/* TODO: place all pointers inside a struct */
int lmpv_handle(struct lkt_module *mod, mpv_handle *ctx, struct queue *queue,
volatile int *time_pos, volatile int *time_duration, volatile int *state);
volatile int *time_pos, volatile int *time_duration,
volatile int *state, volatile int *hinib);
enum {
STATE_STOP = 0,
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter