Disable music and play sound only if the movie contains an audio stream.
This commit is contained in:
parent
954e93a112
commit
6633d1382d
2 changed files with 14 additions and 4 deletions
src
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue