1
0
mirror of https://github.com/odrling/Aegisub synced 2025-04-11 22:56:02 +02:00

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

@ -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

@ -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<AudioPlayer *(*)()>::classes = NULL;

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

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

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

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

@ -37,6 +37,8 @@
#include "config.h"
#ifndef AGI_PRE
#include <sstream>
#include <wx/clipbrd.h>
#include <wx/config.h>
#include <wx/datetime.h>
@ -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();
}

@ -88,6 +88,7 @@
/>
<Tool
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
@ -234,6 +235,7 @@
/>
<Tool
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