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.
This commit is contained in:
Thomas Goyne 2012-04-06 01:55:22 +00:00
parent 0d4846d012
commit 84e378148e
8 changed files with 34 additions and 26 deletions

View file

@ -635,23 +635,23 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
# it above. # it above.
#################################################################### ####################################################################
AC_ARG_WITH(player-audio, 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 [Linux/ALSA, Darwin/OpenAL, 1:*/OSS, 2:*/PortAudio]]))
# Default audio player. # Default audio player.
AS_IF([test -z "$with_player_audio"], [ AS_IF([test -z "$with_player_audio"], [
AS_IF([test x$build_linux = xyes && test x$with_alsa = xyes], [default_player_audio="alsa"], 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$build_darwin = xyes && test x$with_openal = xyes], [DEFAULT_PLAYER_AUDIO="OpenAL"],
[test x$with_portaudio = xyes], [default_player_audio="portaudio"], [test x$with_portaudio = xyes], [DEFAULT_PLAYER_AUDIO="PortAudio"],
[test x$with_oss = xyes], [default_player_audio="oss"], [test x$with_oss = xyes], [DEFAULT_PLAYER_AUDIO="OSS"],
[test x$with_alsa = xyes], [default_player_audio="alsa"], [test x$with_alsa = xyes], [DEFAULT_PLAYER_AUDIO="ALSA"],
[test x$with_openal = xyes], [default_player_audio="openal"], [test x$with_openal = xyes], [DEFAULT_PLAYER_AUDIO="OpenAL"],
[test x$with_libpulse = xyes], [default_player_audio="pulseaudio"])], [test x$with_libpulse = xyes], [DEFAULT_PLAYER_AUDIO="PulseAudio"])],
[default_player_audio="$with_player_audio"]) [DEFAULT_PLAYER_AUDIO="$with_player_audio"])
AC_DEFINE_UNQUOTED([DEFAULT_PLAYER_AUDIO], ["$default_player_audio"], [Default audio player.]) AC_SUBST(DEFAULT_PLAYER_AUDIO)
# Set some friendly strings if some of the above aren't detected. # 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 # Misc settings
@ -659,13 +659,14 @@ default_player_audio=${default_player_audio:-NONE}
# Files that need substitution. # Files that need substitution.
AC_CONFIG_FILES([ AC_CONFIG_FILES([
desktop/aegisub.desktop desktop/aegisub.desktop
src/libresrc/default_config_platform.json
tools/osx-bundle.sed tools/osx-bundle.sed
Makefile.inc Makefile.inc
]) ])
AC_OUTPUT 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. * No supported audio player interface was found on your system.
@ -707,7 +708,7 @@ Configure settings
LIBS $LIBS LIBS $LIBS
Default Settings Default Settings
Audio Player: $default_player_audio Audio Player: $DEFAULT_PLAYER_AUDIO
Scripting Engines Scripting Engines
auto4 Lua: $with_auto4_lua $lua51_disabled auto4 Lua: $with_auto4_lua $lua51_disabled

View file

@ -102,15 +102,4 @@ void AudioPlayerFactory::RegisterProviders() {
#endif #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<AudioPlayer *(*)()>::classes = NULL; template<> AudioPlayerFactory::map *FactoryBase<AudioPlayer *(*)()>::classes = NULL;

View file

@ -74,8 +74,6 @@ public:
class AudioPlayerFactory : public Factory0<AudioPlayer> { class AudioPlayerFactory : public Factory0<AudioPlayer> {
public: public:
/// Get the name of the preferred audio play
static std::string GetDefault();
static void RegisterProviders(); static void RegisterProviders();
static AudioPlayer *GetAudioPlayer(); static AudioPlayer *GetAudioPlayer();
}; };

View file

@ -0,0 +1,5 @@
{
"Audio" : {
"Player" : "@DEFAULT_PLAYER_AUDIO@",
}
}

View file

@ -0,0 +1,8 @@
{
"Audio" : {
"Player" : "DirectSound"
},
"Subtitle" : {
"Provider" : "CSRI/vsfilter_textsub"
}
}

View file

@ -1,4 +1,5 @@
default_config.json default_config.json
default_config_platform.json
default_hotkey.json default_hotkey.json
default_menu.json default_menu.json
default_mru.json default_mru.json

View file

@ -37,6 +37,8 @@
#include "config.h" #include "config.h"
#ifndef AGI_PRE #ifndef AGI_PRE
#include <sstream>
#include <wx/clipbrd.h> #include <wx/clipbrd.h>
#include <wx/config.h> #include <wx/config.h>
#include <wx/datetime.h> #include <wx/datetime.h>
@ -175,6 +177,8 @@ bool AegisubApp::OnInit() {
try { try {
if (!config::opt) if (!config::opt)
config::opt = new agi::Options(STD_STR(StandardPaths::DecodePath("?user/config.json")), GET_DEFAULT_CONFIG(default_config)); 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) { } catch (agi::Exception& e) {
LOG_E("config/init") << "Caught exception: " << e.GetName() << " -> " << e.GetMessage(); LOG_E("config/init") << "Caught exception: " << e.GetName() << " -> " << e.GetMessage();
} }

View file

@ -88,6 +88,7 @@
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(ProjectDir)..\src\libresrc\default_config_win.json&quot; &quot;$(ProjectDir)..\src\libresrc\default_config_platform.json&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; &quot;$(ProjectDir)../src/libresrc/manifest.respack&quot; &quot;$(ProjectDir)../src/libresrc/default_config.cpp&quot; &quot;$(ProjectDir)../src/libresrc/default_config.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; &quot;$(ProjectDir)../src/bitmaps/manifest.respack&quot; &quot;$(ProjectDir)../src/libresrc/bitmap.cpp&quot; &quot;$(ProjectDir)../src/libresrc/bitmap.h&quot;"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
@ -234,6 +235,7 @@
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(ProjectDir)..\src\libresrc\default_config_win.json&quot; &quot;$(ProjectDir)..\src\libresrc\default_config_platform.json&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; &quot;$(ProjectDir)../src/libresrc/manifest.respack&quot; &quot;$(ProjectDir)../src/libresrc/default_config.cpp&quot; &quot;$(ProjectDir)../src/libresrc/default_config.h&quot;&#x0D;&#x0A;&quot;$(TargetPath)&quot; &quot;$(ProjectDir)../src/bitmaps/manifest.respack&quot; &quot;$(ProjectDir)../src/libresrc/bitmap.cpp&quot; &quot;$(ProjectDir)../src/libresrc/bitmap.h&quot;"
/> />
</Configuration> </Configuration>
<Configuration <Configuration