From c5f56d8061794c6c9915d14a4ec6b6e47a7b2e45 Mon Sep 17 00:00:00 2001 From: Jay Moore Date: Fri, 31 Oct 2025 23:09:21 -0400 Subject: [PATCH] Shut Up Baby, I Know It! --- README.md | 13 ++++++++++++- doc/mpd-dbcreate.1.rst | 10 ++++++++++ meson.build | 5 ++++- src/ChannelMode.hxx | 16 ++++++++++++++++ src/Main.cxx | 11 +++-------- src/db/update/FilteredSongUpdate.cxx | 13 +------------ src/decoder/plugins/DvdaIsoDecoderPlugin.cxx | 10 +--------- src/decoder/plugins/SacdIsoDecoderPlugin.cxx | 10 +--------- src/lib/dvdaiso/udf/dvd_udf.cpp | 4 ++++ 9 files changed, 52 insertions(+), 40 deletions(-) create mode 100644 src/ChannelMode.hxx diff --git a/README.md b/README.md index 039dc7f..d7de82d 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,17 @@ Paths in the database are all stored relative to `--music-dir`. This means if yo It's been two months since I built the first database with an early version and I've done numerous updates since; both for new media and to test new builds. That database has never been an issue and has made mpd a joy to use since it works the way *I* want it. +As a rough benchmark: It scanned an 8000 file library of 450.3 gigs in about 6.5 minutes; this includes the delay for the numerous ISOs in the library. + +## Notes + +Please make note of the following things: + +- If you get a "simple database" error; check the path of the database you specified. +- Try to use full paths at all times. +- It looks like it hangs on ISO files when using --verbose. It's not. Just wait. I believe it's something with the plugin that I don't want to touch. +- Your music directory is root of the database. Keep this in mind if you want to scan on a different system. + ## Changes ``` 28-AUG-2025 - Initial hacking of database tool from mpd-sacd itself. Multichannel, CUE, SACD logic updates. @@ -142,7 +153,7 @@ It's been two months since I built the first database with an early version and 01-SEP-2025 - After being able to actually test DVD-Audio; modified DVD-Audio plugin to match SACD behavior for track and channel filtering. 24-SEP-2025 - Added --update-path option to update just a specific path in the database and waiting 3 weeks to getting around to testing it. 24-OCT-2025 - Removed dependencies and code not needed, like output plugins, mixers, libmpdclient, chromaprint. Internal Development Release. -31-OCT-2025 - Missed encoders and filters. Wrote documentation. Tweaked things for release builds. Milestone release: Version 1.0 equivalent. +01-NOV-2025 - Missed encoders and filters. Wrote documentation (manpage). Tweaked things for release builds. Milestone release: Version 1.0 equivalent. ``` ## Bugs & Issues diff --git a/doc/mpd-dbcreate.1.rst b/doc/mpd-dbcreate.1.rst index 86fc81c..12a3cc7 100644 --- a/doc/mpd-dbcreate.1.rst +++ b/doc/mpd-dbcreate.1.rst @@ -94,6 +94,16 @@ The MPD database can live just about anywhere on the system. The usual location The database can be moved to a different system than it was scanned on. This is helpful for scanning directly on the NAS. The database stores everything as relative to the root of the music directory. So you can scan ``/raid/music`` on your NAS, mount it as ``/mnt/music`` on your local machine, point MPD to ``/mnt/music``, and that's it. +NOTES +----- + +Please make note of the following things: + +- If you get a "simple database" error; check the path of the database you specified. +- Try to use full paths at all times. +- It looks like it hangs on ISO files when using --verbose. It's not. Just wait. I believe it's something with the plugin that I don't want to touch. +- Your music directory is root of the database. Keep this in mind if you want to scan on a different system. + SEE ALSO -------- diff --git a/meson.build b/meson.build index f0fd0d3..3d4efe1 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'mpd-dbcreate', ['c', 'cpp'], - version: '1.0', + version: 'Shut Up Baby, I Know It!', meson_version: '>= 1.2', default_options: [ 'c_std=c11', @@ -115,6 +115,9 @@ if compiler.get_id() == 'gcc' and compiler.version().version_compare('<12') elif compiler.get_id() == 'clang' and compiler.version().version_compare('<14') warning('Your clang version is too old. You need at least version 14.') endif +if get_option('b_lto') + add_project_link_arguments('-Wno-odr', language: 'cpp') +endif version_conf = configuration_data() version_conf.set_quoted('PACKAGE', meson.project_name()) diff --git a/src/ChannelMode.hxx b/src/ChannelMode.hxx new file mode 100644 index 0000000..6dcba11 --- /dev/null +++ b/src/ChannelMode.hxx @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright The Music Player Daemon Project + +#pragma once + +// Channel mode for database creation filtering +enum class ChannelMode { + STEREO, + MULTICHANNEL, + ALL +}; + +// External function to get channel mode +// Implemented in Main.cxx for mpd-dbcreate +// Note: Using extern "C" to avoid C++ name mangling so it can be called from any namespace +extern "C" ChannelMode GetChannelMode() noexcept; diff --git a/src/Main.cxx b/src/Main.cxx index 5762311..906e6f7 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -36,12 +36,7 @@ #include "event/CoarseTimerEvent.hxx" #include "util/BindMethod.hxx" -// Channel mode shared with FilteredSongUpdate -enum class ChannelMode { - STEREO, - MULTICHANNEL, - ALL -}; +#include "ChannelMode.hxx" // Helper class to check update completion with a timer class UpdateChecker { @@ -85,11 +80,11 @@ static bool verbose = false; static bool update_mode = false; static std::string update_path; -// Global instance pointer required by other MPD components +// Global instance pointer required by other MPD components // This must be defined here as we're not linking with Main.cxx Instance *global_instance = nullptr; -extern "C" __attribute__((visibility("default"))) ChannelMode GetChannelMode() noexcept { +extern "C" ChannelMode GetChannelMode() noexcept { return channel_mode; } diff --git a/src/db/update/FilteredSongUpdate.cxx b/src/db/update/FilteredSongUpdate.cxx index a7c74d4..504ad3d 100644 --- a/src/db/update/FilteredSongUpdate.cxx +++ b/src/db/update/FilteredSongUpdate.cxx @@ -7,18 +7,7 @@ #include "db/plugins/simple/Song.hxx" #include "pcm/AudioFormat.hxx" -// External function to get the channel mode -enum class ChannelMode { - STEREO, - MULTICHANNEL, - ALL -}; - -// Weak symbol allows override in DbMain -extern "C" __attribute__((weak)) ChannelMode GetChannelMode() noexcept { - // Default to ALL mode (no filtering) for normal MPD - return ChannelMode::ALL; -} +#include "ChannelMode.hxx" static bool diff --git a/src/decoder/plugins/DvdaIsoDecoderPlugin.cxx b/src/decoder/plugins/DvdaIsoDecoderPlugin.cxx index 6df165b..27becc0 100644 --- a/src/decoder/plugins/DvdaIsoDecoderPlugin.cxx +++ b/src/decoder/plugins/DvdaIsoDecoderPlugin.cxx @@ -197,15 +197,7 @@ finish() noexcept { my_av_log_set_default_callback(); } -// External function to get channel mode for database creation -enum class ChannelMode { - STEREO, - MULTICHANNEL, - ALL -}; -extern "C" __attribute__((weak)) ChannelMode GetChannelMode() noexcept { - return ChannelMode::ALL; // Default for normal MPD -} +#include "ChannelMode.hxx" static std::forward_list container_scan(Path path_fs) { diff --git a/src/decoder/plugins/SacdIsoDecoderPlugin.cxx b/src/decoder/plugins/SacdIsoDecoderPlugin.cxx index 53f0e5b..c6b993a 100644 --- a/src/decoder/plugins/SacdIsoDecoderPlugin.cxx +++ b/src/decoder/plugins/SacdIsoDecoderPlugin.cxx @@ -220,15 +220,7 @@ finish() noexcept { container_update(nullptr); } -// External function to get channel mode for database creation -enum class ChannelMode { - STEREO, - MULTICHANNEL, - ALL -}; -extern "C" __attribute__((weak)) ChannelMode GetChannelMode() noexcept { - return ChannelMode::ALL; // Default for normal MPD -} +#include "ChannelMode.hxx" static std::forward_list container_scan(Path path_fs) { diff --git a/src/lib/dvdaiso/udf/dvd_udf.cpp b/src/lib/dvdaiso/udf/dvd_udf.cpp index 89fd6bf..4f14c4e 100644 --- a/src/lib/dvdaiso/udf/dvd_udf.cpp +++ b/src/lib/dvdaiso/udf/dvd_udf.cpp @@ -64,6 +64,8 @@ static int DVDReadLBUDF( dvd_reader_t *device, uint32_t lb_number, #define NULL ((void *)0) #endif +namespace { + struct Partition { int valid; char VolumeDesc[128]; @@ -75,6 +77,8 @@ struct Partition { uint32_t Length; }; +} // anonymous namespace + struct AD { uint32_t Location; uint32_t Length;