From 84e378148e3664a763595b1346b609ca77673dcf Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 6 Apr 2012 01:55:22 +0000 Subject: [PATCH] Add platform-specific default configuration files Default to VSFilter on Windows as libass is still somewhat unstable. Set the default audio player via the platform config file rather than not doing anything with it. Originally committed to SVN as r6664. --- aegisub/configure.in | 27 ++++++++++--------- aegisub/src/audio_player.cpp | 11 -------- aegisub/src/include/aegisub/audio_player.h | 2 -- .../libresrc/default_config_platform.json.in | 5 ++++ aegisub/src/libresrc/default_config_win.json | 8 ++++++ aegisub/src/libresrc/manifest.respack | 1 + aegisub/src/main.cpp | 4 +++ aegisub/tools/common-respack.vcproj | 2 ++ 8 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 aegisub/src/libresrc/default_config_platform.json.in create mode 100644 aegisub/src/libresrc/default_config_win.json diff --git a/aegisub/configure.in b/aegisub/configure.in index 3240112f8..9e1b5eff3 100644 --- a/aegisub/configure.in +++ b/aegisub/configure.in @@ -635,23 +635,23 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", # it above. #################################################################### AC_ARG_WITH(player-audio, - AS_HELP_STRING([--with-player-audio=(alsa|openal|portaudio|pulseaudio)], + AS_HELP_STRING([--with-player-audio=(ALSA|OpenAL|PortAudio|PulseAudio|OSS)], [Default Audio Player [Linux/ALSA, Darwin/OpenAL, 1:*/OSS, 2:*/PortAudio]])) # Default audio player. AS_IF([test -z "$with_player_audio"], [ - AS_IF([test x$build_linux = xyes && test x$with_alsa = xyes], [default_player_audio="alsa"], - [test x$build_darwin = xyes && test x$with_openal = xyes], [default_player_audio="openal"], - [test x$with_portaudio = xyes], [default_player_audio="portaudio"], - [test x$with_oss = xyes], [default_player_audio="oss"], - [test x$with_alsa = xyes], [default_player_audio="alsa"], - [test x$with_openal = xyes], [default_player_audio="openal"], - [test x$with_libpulse = xyes], [default_player_audio="pulseaudio"])], - [default_player_audio="$with_player_audio"]) -AC_DEFINE_UNQUOTED([DEFAULT_PLAYER_AUDIO], ["$default_player_audio"], [Default audio player.]) + AS_IF([test x$build_linux = xyes && test x$with_alsa = xyes], [DEFAULT_PLAYER_AUDIO="ALSA"], + [test x$build_darwin = xyes && test x$with_openal = xyes], [DEFAULT_PLAYER_AUDIO="OpenAL"], + [test x$with_portaudio = xyes], [DEFAULT_PLAYER_AUDIO="PortAudio"], + [test x$with_oss = xyes], [DEFAULT_PLAYER_AUDIO="OSS"], + [test x$with_alsa = xyes], [DEFAULT_PLAYER_AUDIO="ALSA"], + [test x$with_openal = xyes], [DEFAULT_PLAYER_AUDIO="OpenAL"], + [test x$with_libpulse = xyes], [DEFAULT_PLAYER_AUDIO="PulseAudio"])], + [DEFAULT_PLAYER_AUDIO="$with_player_audio"]) +AC_SUBST(DEFAULT_PLAYER_AUDIO) # Set some friendly strings if some of the above aren't detected. -default_player_audio=${default_player_audio:-NONE} +DEFAULT_PLAYER_AUDIO=${DEFAULT_PLAYER_AUDIO:-NONE} ############### # Misc settings @@ -659,13 +659,14 @@ default_player_audio=${default_player_audio:-NONE} # Files that need substitution. AC_CONFIG_FILES([ desktop/aegisub.desktop +src/libresrc/default_config_platform.json tools/osx-bundle.sed Makefile.inc ]) AC_OUTPUT -AS_IF([test x"$default_player_audio" = xNONE], AC_MSG_NOTICE([ +AS_IF([test x"$DEFAULT_PLAYER_AUDIO" = xNONE], AC_MSG_NOTICE([ *********************************************************************** * No supported audio player interface was found on your system. @@ -707,7 +708,7 @@ Configure settings LIBS $LIBS Default Settings - Audio Player: $default_player_audio + Audio Player: $DEFAULT_PLAYER_AUDIO Scripting Engines auto4 Lua: $with_auto4_lua $lua51_disabled diff --git a/aegisub/src/audio_player.cpp b/aegisub/src/audio_player.cpp index 12a6306ab..e3e310c5e 100644 --- a/aegisub/src/audio_player.cpp +++ b/aegisub/src/audio_player.cpp @@ -102,15 +102,4 @@ void AudioPlayerFactory::RegisterProviders() { #endif } -std::string AudioPlayerFactory::GetDefault() { - std::string def = OPT_GET("Audio/Player")->GetString(); - if (!def.empty()) - return def; -#ifdef DEFAULT_PLAYER_AUDIO - return DEFAULT_PLAYER_AUDIO; -#else - return "DirectSound"; -#endif -} - template<> AudioPlayerFactory::map *FactoryBase::classes = NULL; diff --git a/aegisub/src/include/aegisub/audio_player.h b/aegisub/src/include/aegisub/audio_player.h index 08ca10340..d2d818bfe 100644 --- a/aegisub/src/include/aegisub/audio_player.h +++ b/aegisub/src/include/aegisub/audio_player.h @@ -74,8 +74,6 @@ public: class AudioPlayerFactory : public Factory0 { public: - /// Get the name of the preferred audio play - static std::string GetDefault(); static void RegisterProviders(); static AudioPlayer *GetAudioPlayer(); }; diff --git a/aegisub/src/libresrc/default_config_platform.json.in b/aegisub/src/libresrc/default_config_platform.json.in new file mode 100644 index 000000000..bdca7dd8d --- /dev/null +++ b/aegisub/src/libresrc/default_config_platform.json.in @@ -0,0 +1,5 @@ +{ + "Audio" : { + "Player" : "@DEFAULT_PLAYER_AUDIO@", + } +} diff --git a/aegisub/src/libresrc/default_config_win.json b/aegisub/src/libresrc/default_config_win.json new file mode 100644 index 000000000..7c77a032e --- /dev/null +++ b/aegisub/src/libresrc/default_config_win.json @@ -0,0 +1,8 @@ +{ + "Audio" : { + "Player" : "DirectSound" + }, + "Subtitle" : { + "Provider" : "CSRI/vsfilter_textsub" + } +} diff --git a/aegisub/src/libresrc/manifest.respack b/aegisub/src/libresrc/manifest.respack index 902629cfb..9790a9b53 100644 --- a/aegisub/src/libresrc/manifest.respack +++ b/aegisub/src/libresrc/manifest.respack @@ -1,4 +1,5 @@ default_config.json +default_config_platform.json default_hotkey.json default_menu.json default_mru.json diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index 454be077c..ff4944fab 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -37,6 +37,8 @@ #include "config.h" #ifndef AGI_PRE +#include + #include #include #include @@ -175,6 +177,8 @@ bool AegisubApp::OnInit() { try { if (!config::opt) config::opt = new agi::Options(STD_STR(StandardPaths::DecodePath("?user/config.json")), GET_DEFAULT_CONFIG(default_config)); + std::istringstream stream(GET_DEFAULT_CONFIG(default_config_platform)); + config::opt->ConfigNext(stream); } catch (agi::Exception& e) { LOG_E("config/init") << "Caught exception: " << e.GetName() << " -> " << e.GetMessage(); } diff --git a/aegisub/tools/common-respack.vcproj b/aegisub/tools/common-respack.vcproj index f6f31d6bb..e24aa52b8 100644 --- a/aegisub/tools/common-respack.vcproj +++ b/aegisub/tools/common-respack.vcproj @@ -88,6 +88,7 @@ />