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

Using async mpv commands

parent 818ddb0a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!57Resolve "SDL2 module"
...@@ -116,25 +116,6 @@ error: ...@@ -116,25 +116,6 @@ error:
return NULL; return NULL;
} }
int
lmpv_is_paused(mpv_handle *ctx, int *ret)
{
int status;
if (!ctx) {
fprintf(stderr, " ! lmpv_is_paused: failed due to missing mpv ctx\n");
return 1;
}
if ((status = mpv_get_property(ctx, "pause", MPV_FORMAT_FLAG, ret)) < 0) {
fprintf(stderr, "lmpv_is_paused: Failed to get pause property: %s\n",
mpv_error_string(status));
return 1;
}
return 0;
}
int int
lmpv_set_volume(mpv_handle *ctx, int vol) lmpv_set_volume(mpv_handle *ctx, int vol)
{ {
...@@ -149,7 +130,7 @@ lmpv_set_volume(mpv_handle *ctx, int vol) ...@@ -149,7 +130,7 @@ lmpv_set_volume(mpv_handle *ctx, int vol)
snprintf(str, 4, "%d", vol); snprintf(str, 4, "%d", vol);
const char *cmd[] = {"set", "ao-volume", str, NULL}; const char *cmd[] = {"set", "ao-volume", str, NULL};
if ((status = mpv_command(ctx, cmd)) < 0) { if ((status = mpv_command_async(ctx, 0, cmd)) < 0) {
fprintf(stderr, " ! lmpv_set_volume: Failed to execute command: %s\n", fprintf(stderr, " ! lmpv_set_volume: Failed to execute command: %s\n",
mpv_error_string(status)); mpv_error_string(status));
return 1; return 1;
...@@ -173,7 +154,7 @@ lmpv_load_file(mpv_handle *ctx, const char *file) ...@@ -173,7 +154,7 @@ lmpv_load_file(mpv_handle *ctx, const char *file)
const char *cmd[] = {"loadfile", file, "replace", NULL}; const char *cmd[] = {"loadfile", file, "replace", NULL};
int status; int status;
if ((status = mpv_command(ctx, cmd)) < 0) { if ((status = mpv_command_async(ctx, 0, cmd)) < 0) {
fprintf(stderr, " ! lmpv_load_file: Failed to add '%s': %s\n", fprintf(stderr, " ! lmpv_load_file: Failed to add '%s': %s\n",
file, mpv_error_string(status)); file, mpv_error_string(status));
return 1; return 1;
...@@ -192,7 +173,7 @@ lmpv_toggle_pause(mpv_handle *ctx) ...@@ -192,7 +173,7 @@ lmpv_toggle_pause(mpv_handle *ctx)
const char *cmd[] = {"cycle", "pause", "up", NULL}; const char *cmd[] = {"cycle", "pause", "up", NULL};
int status; int status;
if ((status = mpv_command(ctx, cmd)) < 0) { if ((status = mpv_command_async(ctx, 0, cmd)) < 0) {
fprintf(stderr, "lmpv_toggle_pause: Failed issue command: %s\n", fprintf(stderr, "lmpv_toggle_pause: Failed issue command: %s\n",
mpv_error_string(status)); mpv_error_string(status));
return 1; return 1;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter