Skip to content

Commit ce21f12

Browse files
feat(audio): expand audio fallback codecs and channel layout settings (#478)
* feat(audio): expand audio fallback codecs and channel layout configuration - Replace legacy downmix and fallback stereo flags with detailed Max Audio Channels and Audio Fallback Codec target settings. - Implement native mpv audio-channels layout mapping in media_kit player backend. - Pass updated constraints to DeviceProfileBuilder across Media3, Tizen, and HTML backends. - Add and center text inside settings panel option list bubbles and provide helpful setting description subtitles. - Fix and migrate preference tests and device profile tests to reflect new API structure. * Update audio channel settings descriptions * fix(audio): address PR review comments for fallback codecs and layouts * Apply suggestions from code review Co-authored-by: Axl <103554043+RadicalMuffinMan@users.noreply.github.com> * fix(audio): address Axl's review comments on effective max channels and forceStereo --------- Co-authored-by: mattsigal <mattsigal@users.noreply.github.com> Co-authored-by: Axl <103554043+RadicalMuffinMan@users.noreply.github.com>
1 parent cade15a commit ce21f12

72 files changed

Lines changed: 3864 additions & 386 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/di/injection.dart

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ Future<void> _migrateAndroidMobileAudioDefaults(
259259
}
260260

261261
Future<void> migrateAudioPreferenceSplit(PreferenceStore store) async {
262-
const migrationKey = 'pref_audio_preference_split_v2';
262+
const migrationKey = 'pref_audio_preference_split_v3';
263263

264264
if (store.getBool(migrationKey) == true) {
265265
return;
@@ -325,7 +325,7 @@ Future<void> migrateAudioPreferenceSplit(PreferenceStore store) async {
325325
await setEnumIfMissing(
326326
UserPreferences.audioFallbackCodec,
327327
legacyStereoAacFallback
328-
? AudioFallbackCodec.aacStereo
328+
? AudioFallbackCodec.aac
329329
: AudioFallbackCodec.auto,
330330
);
331331
}
@@ -334,6 +334,19 @@ Future<void> migrateAudioPreferenceSplit(PreferenceStore store) async {
334334
await setBoolIfMissing(UserPreferences.eac3JocPassthroughEnabled, false);
335335
}
336336

337+
final savedFallbackCodec = store.getString(UserPreferences.audioFallbackCodec.key);
338+
if (savedFallbackCodec != null) {
339+
final remappedName = switch (savedFallbackCodec) {
340+
'aacStereo' => 'aac',
341+
'ac3_5_1' => 'ac3',
342+
'eac3_5_1' => 'eac3',
343+
_ => null,
344+
};
345+
if (remappedName != null) {
346+
await store.setString(UserPreferences.audioFallbackCodec.key, remappedName);
347+
}
348+
}
349+
337350
await store.setBool(migrationKey, true);
338351
}
339352

lib/l10n/app_en.arb

Lines changed: 81 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3135,6 +3135,10 @@
31353135
"@settingsAudioOutputMode": {
31363136
"description": "Setting for audio output mode"
31373137
},
3138+
"settingsAudioOutputModeDescription": "Choose how audio is decoded. AVR Passthrough sends raw Dolby/DTS streams to your receiver; Auto or Downmix decodes locally.",
3139+
"@settingsAudioOutputModeDescription": {
3140+
"description": "Description for audio output mode setting"
3141+
},
31383142
"settingsAudioOutputModeAvrPassthrough": "AVR Passthrough",
31393143
"@settingsAudioOutputModeAvrPassthrough": {
31403144
"description": "Audio output mode option for AVR passthrough"
@@ -3143,17 +3147,85 @@
31433147
"@settingsAudioFallbackCodec": {
31443148
"description": "Setting for fallback audio codec"
31453149
},
3146-
"settingsAudioFallbackAacStereo": "AAC Stereo",
3147-
"@settingsAudioFallbackAacStereo": {
3148-
"description": "Fallback codec option for AAC stereo"
3150+
"settingsAudioFallbackCodecDescription": "Select the target format to transcode multi-channel audio when the source stream cannot be direct-played or passed through.",
3151+
"@settingsAudioFallbackCodecDescription": {
3152+
"description": "Description for audio fallback codec setting"
3153+
},
3154+
"settingsAudioFallbackCodecAuto": "Auto Detect\n(Recommended)",
3155+
"@settingsAudioFallbackCodecAuto": {
3156+
"description": "Fallback codec option: Auto"
3157+
},
3158+
"settingsAudioFallbackCodecAac": "AAC\n(Default)",
3159+
"@settingsAudioFallbackCodecAac": {
3160+
"description": "Fallback codec option: AAC"
3161+
},
3162+
"settingsAudioFallbackCodecAc3": "AC3\n(Dolby Digital)",
3163+
"@settingsAudioFallbackCodecAc3": {
3164+
"description": "Fallback codec option: AC3"
3165+
},
3166+
"settingsAudioFallbackCodecEac3": "EAC3\n(Dolby Digital Plus)",
3167+
"@settingsAudioFallbackCodecEac3": {
3168+
"description": "Fallback codec option: EAC3"
3169+
},
3170+
"settingsAudioFallbackCodecTrueHd": "TrueHD\n(Lossless)",
3171+
"@settingsAudioFallbackCodecTrueHd": {
3172+
"description": "Fallback codec option: TrueHD"
3173+
},
3174+
"settingsAudioFallbackCodecMp3": "MP3\n(Stereo Only)",
3175+
"@settingsAudioFallbackCodecMp3": {
3176+
"description": "Fallback codec option: MP3"
3177+
},
3178+
"settingsAudioFallbackCodecOpus": "Opus\n(Efficient)",
3179+
"@settingsAudioFallbackCodecOpus": {
3180+
"description": "Fallback codec option: Opus"
3181+
},
3182+
"settingsAudioFallbackCodecFlac": "FLAC\n(Lossless)",
3183+
"@settingsAudioFallbackCodecFlac": {
3184+
"description": "Fallback codec option: FLAC"
3185+
},
3186+
"settingsMaxAudioChannels": "Max Audio Channels",
3187+
"@settingsMaxAudioChannels": {
3188+
"description": "Setting for maximum audio channels capability"
3189+
},
3190+
"settingsMaxAudioChannelsDescription": "Configure the maximum channels of your audio setup. Multichannel streams exceeding this limit will downmix or transcode.",
3191+
"@settingsMaxAudioChannelsDescription": {
3192+
"description": "Description for maximum audio channels setting"
3193+
},
3194+
"settingsMaxAudioChannelsAuto": "Auto Detect\n(Hardware Default)",
3195+
"@settingsMaxAudioChannelsAuto": {
3196+
"description": "Option: Auto detect channels"
3197+
},
3198+
"settingsMaxAudioChannelsMono": "1.0 Mono",
3199+
"@settingsMaxAudioChannelsMono": {
3200+
"description": "Option: Mono (1 channel)"
3201+
},
3202+
"settingsMaxAudioChannelsStereo": "2.0 Stereo",
3203+
"@settingsMaxAudioChannelsStereo": {
3204+
"description": "Option: Stereo (2 channels)"
3205+
},
3206+
"settingsMaxAudioChannels3_0": "3.0 / 2.1 Surround",
3207+
"@settingsMaxAudioChannels3_0": {
3208+
"description": "Option: 3 channels"
3209+
},
3210+
"settingsMaxAudioChannels4_0": "4.0 / 3.1 Quadraphonic",
3211+
"@settingsMaxAudioChannels4_0": {
3212+
"description": "Option: 4 channels"
3213+
},
3214+
"settingsMaxAudioChannels5_0": "5.0 / 4.1 Surround",
3215+
"@settingsMaxAudioChannels5_0": {
3216+
"description": "Option: 5 channels"
3217+
},
3218+
"settingsMaxAudioChannels5_1": "5.1 Surround",
3219+
"@settingsMaxAudioChannels5_1": {
3220+
"description": "Option: 5.1 Surround channels"
31493221
},
3150-
"settingsAudioFallbackAc35_1": "AC3 5.1",
3151-
"@settingsAudioFallbackAc35_1": {
3152-
"description": "Fallback codec option for AC3 5.1"
3222+
"settingsMaxAudioChannels6_1": "6.1 Surround",
3223+
"@settingsMaxAudioChannels6_1": {
3224+
"description": "Option: 6.1 Surround channels"
31533225
},
3154-
"settingsAudioFallbackEac35_1": "EAC3 5.1",
3155-
"@settingsAudioFallbackEac35_1": {
3156-
"description": "Fallback codec option for EAC3 5.1"
3226+
"settingsMaxAudioChannels7_1": "7.1 Surround",
3227+
"@settingsMaxAudioChannels7_1": {
3228+
"description": "Option: 7.1 Surround channels"
31573229
},
31583230
"settingsAudioPassthroughAdvanced": "Passthrough (Advanced)",
31593231
"@settingsAudioPassthroughAdvanced": {

lib/l10n/app_localizations.dart

Lines changed: 117 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4055,6 +4055,12 @@ abstract class AppLocalizations {
40554055
/// **'Audio Output Mode'**
40564056
String get settingsAudioOutputMode;
40574057

4058+
/// Description for audio output mode setting
4059+
///
4060+
/// In en, this message translates to:
4061+
/// **'Choose how audio is decoded. AVR Passthrough sends raw Dolby/DTS streams to your receiver; Auto or Downmix decodes locally.'**
4062+
String get settingsAudioOutputModeDescription;
4063+
40584064
/// Audio output mode option for AVR passthrough
40594065
///
40604066
/// In en, this message translates to:
@@ -4067,23 +4073,125 @@ abstract class AppLocalizations {
40674073
/// **'Audio Fallback Codec'**
40684074
String get settingsAudioFallbackCodec;
40694075

4070-
/// Fallback codec option for AAC stereo
4076+
/// Description for audio fallback codec setting
4077+
///
4078+
/// In en, this message translates to:
4079+
/// **'Select the target format to transcode multi-channel audio when the source stream cannot be direct-played or passed through.'**
4080+
String get settingsAudioFallbackCodecDescription;
4081+
4082+
/// Fallback codec option: Auto
4083+
///
4084+
/// In en, this message translates to:
4085+
/// **'Auto Detect\n(Recommended)'**
4086+
String get settingsAudioFallbackCodecAuto;
4087+
4088+
/// Fallback codec option: AAC
4089+
///
4090+
/// In en, this message translates to:
4091+
/// **'AAC\n(Default)'**
4092+
String get settingsAudioFallbackCodecAac;
4093+
4094+
/// Fallback codec option: AC3
4095+
///
4096+
/// In en, this message translates to:
4097+
/// **'AC3\n(Dolby Digital)'**
4098+
String get settingsAudioFallbackCodecAc3;
4099+
4100+
/// Fallback codec option: EAC3
4101+
///
4102+
/// In en, this message translates to:
4103+
/// **'EAC3\n(Dolby Digital Plus)'**
4104+
String get settingsAudioFallbackCodecEac3;
4105+
4106+
/// Fallback codec option: TrueHD
4107+
///
4108+
/// In en, this message translates to:
4109+
/// **'TrueHD\n(Lossless)'**
4110+
String get settingsAudioFallbackCodecTrueHd;
4111+
4112+
/// Fallback codec option: MP3
4113+
///
4114+
/// In en, this message translates to:
4115+
/// **'MP3\n(Stereo Only)'**
4116+
String get settingsAudioFallbackCodecMp3;
4117+
4118+
/// Fallback codec option: Opus
4119+
///
4120+
/// In en, this message translates to:
4121+
/// **'Opus\n(Efficient)'**
4122+
String get settingsAudioFallbackCodecOpus;
4123+
4124+
/// Fallback codec option: FLAC
4125+
///
4126+
/// In en, this message translates to:
4127+
/// **'FLAC\n(Lossless)'**
4128+
String get settingsAudioFallbackCodecFlac;
4129+
4130+
/// Setting for maximum audio channels capability
4131+
///
4132+
/// In en, this message translates to:
4133+
/// **'Max Audio Channels'**
4134+
String get settingsMaxAudioChannels;
4135+
4136+
/// Description for maximum audio channels setting
4137+
///
4138+
/// In en, this message translates to:
4139+
/// **'Configure the maximum channels of your audio setup. Multichannel streams exceeding this limit will downmix or transcode.'**
4140+
String get settingsMaxAudioChannelsDescription;
4141+
4142+
/// Option: Auto detect channels
4143+
///
4144+
/// In en, this message translates to:
4145+
/// **'Auto Detect\n(Hardware Default)'**
4146+
String get settingsMaxAudioChannelsAuto;
4147+
4148+
/// Option: Mono (1 channel)
4149+
///
4150+
/// In en, this message translates to:
4151+
/// **'1.0 Mono'**
4152+
String get settingsMaxAudioChannelsMono;
4153+
4154+
/// Option: Stereo (2 channels)
4155+
///
4156+
/// In en, this message translates to:
4157+
/// **'2.0 Stereo'**
4158+
String get settingsMaxAudioChannelsStereo;
4159+
4160+
/// Option: 3 channels
4161+
///
4162+
/// In en, this message translates to:
4163+
/// **'3.0 / 2.1 Surround'**
4164+
String get settingsMaxAudioChannels3_0;
4165+
4166+
/// Option: 4 channels
4167+
///
4168+
/// In en, this message translates to:
4169+
/// **'4.0 / 3.1 Quadraphonic'**
4170+
String get settingsMaxAudioChannels4_0;
4171+
4172+
/// Option: 5 channels
4173+
///
4174+
/// In en, this message translates to:
4175+
/// **'5.0 / 4.1 Surround'**
4176+
String get settingsMaxAudioChannels5_0;
4177+
4178+
/// Option: 5.1 Surround channels
40714179
///
40724180
/// In en, this message translates to:
4073-
/// **'AAC Stereo'**
4074-
String get settingsAudioFallbackAacStereo;
4181+
/// **'5.1 Surround'**
4182+
String get settingsMaxAudioChannels5_1;
40754183

4076-
/// Fallback codec option for AC3 5.1
4184+
/// Option: 6.1 Surround channels
40774185
///
40784186
/// In en, this message translates to:
4079-
/// **'AC3 5.1'**
4080-
String get settingsAudioFallbackAc35_1;
4187+
/// **'6.1 Surround'**
4188+
String get settingsMaxAudioChannels6_1;
40814189

4082-
/// Fallback codec option for EAC3 5.1
4190+
/// Option: 7.1 Surround channels
40834191
///
40844192
/// In en, this message translates to:
4085-
/// **'EAC3 5.1'**
4086-
String get settingsAudioFallbackEac35_1;
4193+
/// **'7.1 Surround'**
4194+
String get settingsMaxAudioChannels7_1;
40874195

40884196
/// Section title for advanced passthrough controls
40894197
///

lib/l10n/app_localizations_af.dart

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,20 +2227,77 @@ class AppLocalizationsAf extends AppLocalizations {
22272227
@override
22282228
String get settingsAudioOutputMode => 'Oudio-uitvoermodus';
22292229

2230+
@override
2231+
String get settingsAudioOutputModeDescription =>
2232+
'Choose how audio is decoded. AVR Passthrough sends raw Dolby/DTS streams to your receiver; Auto or Downmix decodes locally.';
2233+
22302234
@override
22312235
String get settingsAudioOutputModeAvrPassthrough => 'AVR deurlaat';
22322236

22332237
@override
22342238
String get settingsAudioFallbackCodec => 'Oudio-terugvalkodek';
22352239

22362240
@override
2237-
String get settingsAudioFallbackAacStereo => 'AAC Stereo';
2241+
String get settingsAudioFallbackCodecDescription =>
2242+
'Select the target format to transcode multi-channel audio when the source stream cannot be direct-played or passed through.';
2243+
2244+
@override
2245+
String get settingsAudioFallbackCodecAuto => 'Auto Detect\n(Recommended)';
2246+
2247+
@override
2248+
String get settingsAudioFallbackCodecAac => 'AAC\n(Default)';
2249+
2250+
@override
2251+
String get settingsAudioFallbackCodecAc3 => 'AC3\n(Dolby Digital)';
2252+
2253+
@override
2254+
String get settingsAudioFallbackCodecEac3 => 'EAC3\n(Dolby Digital Plus)';
2255+
2256+
@override
2257+
String get settingsAudioFallbackCodecTrueHd => 'TrueHD\n(Lossless)';
2258+
2259+
@override
2260+
String get settingsAudioFallbackCodecMp3 => 'MP3\n(Stereo Only)';
2261+
2262+
@override
2263+
String get settingsAudioFallbackCodecOpus => 'Opus\n(Efficient)';
2264+
2265+
@override
2266+
String get settingsAudioFallbackCodecFlac => 'FLAC\n(Lossless)';
2267+
2268+
@override
2269+
String get settingsMaxAudioChannels => 'Max Audio Channels';
2270+
2271+
@override
2272+
String get settingsMaxAudioChannelsDescription =>
2273+
'Configure the maximum channels of your audio setup. Multichannel streams exceeding this limit will downmix or transcode.';
2274+
2275+
@override
2276+
String get settingsMaxAudioChannelsAuto => 'Auto Detect\n(Hardware Default)';
2277+
2278+
@override
2279+
String get settingsMaxAudioChannelsMono => '1.0 Mono';
2280+
2281+
@override
2282+
String get settingsMaxAudioChannelsStereo => '2.0 Stereo';
2283+
2284+
@override
2285+
String get settingsMaxAudioChannels3_0 => '3.0 / 2.1 Surround';
2286+
2287+
@override
2288+
String get settingsMaxAudioChannels4_0 => '4.0 / 3.1 Quadraphonic';
2289+
2290+
@override
2291+
String get settingsMaxAudioChannels5_0 => '5.0 / 4.1 Surround';
2292+
2293+
@override
2294+
String get settingsMaxAudioChannels5_1 => '5.1 Surround';
22382295

22392296
@override
2240-
String get settingsAudioFallbackAc35_1 => 'AC3 5.1';
2297+
String get settingsMaxAudioChannels6_1 => '6.1 Surround';
22412298

22422299
@override
2243-
String get settingsAudioFallbackEac35_1 => 'EAC3 5.1';
2300+
String get settingsMaxAudioChannels7_1 => '7.1 Surround';
22442301

22452302
@override
22462303
String get settingsAudioPassthroughAdvanced => 'Deurloop (Gevorderd)';

0 commit comments

Comments
 (0)