mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 22:23:17 -05:00
[xcode] Go back to wav as default format for RSP/DAAP transcoding
But add "prefer_format" config option for mp3, incl. a check for an encoder. The config option is currently not added to owntone.conf.in, so is undocumented until decided what to do about possible alac support.
This commit is contained in:
parent
2871a03aa8
commit
b6ad73e1fa
@ -111,6 +111,7 @@ static cfg_opt_t sec_library[] =
|
||||
CFG_BOOL("itunes_smartpl", cfg_false, CFGF_NONE),
|
||||
CFG_STR_LIST("no_decode", NULL, CFGF_NONE),
|
||||
CFG_STR_LIST("force_decode", NULL, CFGF_NONE),
|
||||
CFG_STR("prefer_format", NULL, CFGF_NONE),
|
||||
CFG_BOOL("pipe_autostart", cfg_true, CFGF_NONE),
|
||||
CFG_INT("pipe_sample_rate", 44100, CFGF_NONE),
|
||||
CFG_INT("pipe_bits_per_sample", 16, CFGF_NONE),
|
||||
|
@ -1804,9 +1804,12 @@ transcode_decode_setup_raw(enum transcode_profile profile, struct media_quality
|
||||
enum transcode_profile
|
||||
transcode_needed(const char *user_agent, const char *client_codecs, char *file_codectype)
|
||||
{
|
||||
char *codectype;
|
||||
const char *codectype;
|
||||
const char *prefer_format;
|
||||
cfg_t *lib;
|
||||
bool force_xcode;
|
||||
bool supports_mpeg;
|
||||
bool supports_wav;
|
||||
int count;
|
||||
int i;
|
||||
|
||||
@ -1862,10 +1865,25 @@ transcode_needed(const char *user_agent, const char *client_codecs, char *file_c
|
||||
|
||||
if (!force_xcode && strstr(client_codecs, file_codectype))
|
||||
return XCODE_NONE;
|
||||
else if (strstr(client_codecs, "mpeg"))
|
||||
return XCODE_MP3;
|
||||
else if (strstr(client_codecs, "wav"))
|
||||
|
||||
supports_mpeg = strstr(client_codecs, "mpeg") && avcodec_find_encoder(AV_CODEC_ID_MP3);
|
||||
supports_wav = strstr(client_codecs, "wav");
|
||||
|
||||
prefer_format = cfg_getstr(lib, "prefer_format");
|
||||
if (prefer_format)
|
||||
{
|
||||
if (strcmp(prefer_format, "wav") == 0 && supports_wav)
|
||||
return XCODE_WAV;
|
||||
else if (strcmp(prefer_format, "mpeg") == 0 && supports_mpeg)
|
||||
return XCODE_MP3;
|
||||
}
|
||||
|
||||
// This order determines the default if user didn't configure a preference.
|
||||
// The lossless formats are given highest preference.
|
||||
if (supports_wav)
|
||||
return XCODE_WAV;
|
||||
else if (supports_mpeg)
|
||||
return XCODE_MP3;
|
||||
else
|
||||
return XCODE_UNKNOWN;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user