From 6633d1382d9c48505f049fcc7b01f7dcbc867eb4 Mon Sep 17 00:00:00 2001 From: johns <> Date: Thu, 25 Jul 2002 22:32:58 +0000 Subject: [PATCH] Disable music and play sound only if the movie contains an audio stream. --- src/stratagus/stratagus.cpp | 2 +- src/video/movie.cpp | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/stratagus/stratagus.cpp b/src/stratagus/stratagus.cpp index 273002943..ce89447b4 100644 --- a/src/stratagus/stratagus.cpp +++ b/src/stratagus/stratagus.cpp @@ -995,7 +995,7 @@ global void MenuLoop(char* filename, WorldMap* map) NetPlayers = 0; // Start new music for menus? // FIXME: If second loop? - if( strcmp(TitleMusic,MenuMusic) ) { + if( !PlayingMusic && strcmp(TitleMusic,MenuMusic) ) { PlayMusic(MenuMusic); } EnableRedraw=RedrawMenu; diff --git a/src/video/movie.cpp b/src/video/movie.cpp index 8db42fb8e..80ba5c459 100644 --- a/src/video/movie.cpp +++ b/src/video/movie.cpp @@ -219,7 +219,10 @@ global int PlayMovie(const char *name, int flags) if (!(avi = MovieOpen(name))) { return 1; } - StopMusic(); + + if( avi->AudioStream != -1 ) { // Only if audio available + StopMusic(); + } // // Prepare video @@ -234,13 +237,18 @@ global int PlayMovie(const char *name, int flags) fprintf(stderr, "Couldn't create overlay: %s\n", SDL_GetError()); exit(1); } + if (overlay->hw_overlay) { + DebugLevel0Fn("Got a hardware overlay.\n"); + } VideoSyncSpeed = avi->FPS100 / FRAMES_PER_SECOND; SetVideoSync(); StartDecoder(&pbi, avi->Width, avi->Height); #ifdef USE_OGG - PlayAviOgg(avi); + if( avi->AudioStream != -1 ) { // Only if audio available + PlayAviOgg(avi); + } #endif callbacks.ButtonPressed=MovieCallbackKey; @@ -275,7 +283,9 @@ global int PlayMovie(const char *name, int flags) WaitEventsOneFrame(&callbacks); } - StopMusic(); + if( avi->AudioStream != -1 ) { // Only if audio available + StopMusic(); + } StopDecoder(&pbi); SDL_FreeYUVOverlay(overlay);