From bf3700ea8e9bebb5564cf183963f279339663f3d Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sun, 15 Oct 2023 15:00:07 +0900 Subject: [PATCH] Fix a bug that bgm did not work after movie load failed When movie_free() was called in movie_load(), mixer_stream_stop(0) was mistakenly called and the music mixer was stopped. --- src/movie_ffmpeg.c | 2 +- src/movie_plmpeg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/movie_ffmpeg.c b/src/movie_ffmpeg.c index a9f430d..59a868c 100644 --- a/src/movie_ffmpeg.c +++ b/src/movie_ffmpeg.c @@ -209,6 +209,7 @@ static int audio_callback(sts_mixer_sample_t *sample, void *data) struct movie_context *movie_load(const char *filename) { struct movie_context *mc = xcalloc(1, sizeof(struct movie_context)); + mc->voice = -1; char *path = gamedir_path(filename); int ret; if ((ret = avformat_open_input(&mc->format_ctx, path, NULL, NULL)) != 0) { @@ -257,7 +258,6 @@ struct movie_context *movie_load(const char *filename) mc->format_mutex = SDL_CreateMutex(); mc->timer_mutex = SDL_CreateMutex(); - mc->voice = -1; mc->volume = 100; preload_packets(mc); diff --git a/src/movie_plmpeg.c b/src/movie_plmpeg.c index 356e25a..9840df5 100644 --- a/src/movie_plmpeg.c +++ b/src/movie_plmpeg.c @@ -111,6 +111,7 @@ static void update_texture(GLuint unit, GLuint texture, plm_plane_t *plane) struct movie_context *movie_load(const char *filename) { struct movie_context *mc = xcalloc(1, sizeof(struct movie_context)); + mc->voice = -1; char *path = gamedir_path(filename); FILE *fp = file_open_utf8(path, "rb"); if (!fp) { @@ -142,7 +143,6 @@ struct movie_context *movie_load(const char *filename) mc->decoder_mutex = SDL_CreateMutex(); mc->timer_mutex = SDL_CreateMutex(); - mc->voice = -1; mc->volume = 100; return mc; }