feat: audio analysis rescan and AAC conversion support

Audio Analysis:
- Add rescan capability by bumping cache version
- Display channel layout (stereo, 5.1, etc.) and bitrate
- Use astats filter for more accurate peak/RMS measurements
- Support more formats: mp4, ac3, eac3, mka, wv, ape, tta, aif
- Only report bit depth for codecs that store it (FLAC, ALAC, WAV)
- Validate cache for SAF content:// URIs

Conversion:
- Add AAC as conversion target format
- Recognize ALAC as lossless source
- Prevent accidental deletion when source and target URI match
- Store format and bitrate in database after conversion

Utilities:
- Add audio_conversion_utils.dart for centralized conversion logic
- Add isSameContentUri() helper for safe URI comparison
This commit is contained in:
zarzet
2026-05-14 15:46:55 +07:00
parent 2a2d817314
commit ff86869c33
8 changed files with 506 additions and 177 deletions
+11
View File
@@ -925,6 +925,8 @@ class HistoryDatabase {
String? newQuality,
int? newBitDepth,
int? newSampleRate,
int? newBitrate,
String? newFormat,
bool clearAudioSpecs = false,
}) async {
final db = await database;
@@ -935,9 +937,18 @@ class HistoryDatabase {
if (newQuality != null) {
values['quality'] = newQuality;
}
if (newFormat != null) {
values['format'] = newFormat;
}
if (newBitrate != null) {
values['bitrate'] = newBitrate;
}
if (clearAudioSpecs) {
values['bit_depth'] = null;
values['sample_rate'] = null;
if (newBitrate == null) {
values['bitrate'] = null;
}
} else {
if (newBitDepth != null) {
values['bit_depth'] = newBitDepth;