Skip to content

chore: update rekordbox kaitai definitions - #13293

Merged
daschuer merged 4 commits into
mixxxdj:2.4from
Swiftb0y:chore/update-rekordbox-kaitai-definitions
Jun 9, 2024
Merged

chore: update rekordbox kaitai definitions#13293
daschuer merged 4 commits into
mixxxdj:2.4from
Swiftb0y:chore/update-rekordbox-kaitai-definitions

Conversation

@Swiftb0y

Copy link
Copy Markdown
Member

Should also fix #13291.

Lets see if this builds without updating any additional changes.

@Swiftb0y

Copy link
Copy Markdown
Member Author

Apparently not, seems like we need an updated kaitaistruct runtime. It also doesn't seem appropriate to vendor that anymore. Would ExternalProject_Add instead be an option? Can somebody help me with the required CMake legwork for that?

@JoergAtGithub

Copy link
Copy Markdown
Member

We have it in VCPKG

@Swiftb0y

Copy link
Copy Markdown
Member Author

yeah, but thats about it, its not packaged on any linux distro. https://repology.org/project/kaitai-struct-cpp-stl-runtime/versions

@daschuer

Copy link
Copy Markdown
Member

We cannot download external sources on Launchpad. So let's just update our vendored version.

@Swiftb0y
Swiftb0y force-pushed the chore/update-rekordbox-kaitai-definitions branch from ab24091 to 4ab1375 Compare May 28, 2024 20:21
@github-actions github-actions Bot added the build label May 28, 2024
@Swiftb0y
Swiftb0y force-pushed the chore/update-rekordbox-kaitai-definitions branch from 4ab1375 to 277b5c1 Compare May 28, 2024 20:21
Comment on lines +171 to +174
// workaround for https://github.com/kaitai-io/kaitai_struct_cpp_stl_runtime/issues/67
static std::string bytes_to_str(const std::string src, const std::string& enc) {
return bytes_to_str(src, enc.c_str());
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only changed I made to the kaitai files except copy-pasting in the newest commit and moving them to match the includes the kaitai-compiler generates.

Comment on lines +420 to +433
# NOTE: unmasking is disabled because the C++ backend of kaitai_struct
# doesn't seem to support typecasting as of kaitai version 0.10?
# process: 'xor(is_masked ? mask : [0])'
instances:
c:
value: len_entries
# mask:
# value: |
# [
# (0xCB+c).as<u1>, (0xE1+c).as<u1>, (0xEE+c).as<u1>, (0xFA+c).as<s1>, (0xE5+c).as<s1>, (0xEE+c).as<s1>, (0xAD+c).as<s1>, (0xEE+c).as<s1>,
# (0xE9+c).as<u1>, (0xD2+c).as<u1>, (0xE9+c).as<u1>, (0xEB+c).as<s1>, (0xE1+c).as<s1>, (0xE9+c).as<s1>, (0xF3+c).as<s1>, (0xE8+c).as<s1>,
# (0xE9+c).as<u1>, (0xF4+c).as<u1>, (0xE1+c).as<u1>
# ].as<bytes>
raw_mood:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

Comment on lines -526 to +530
for (std::vector<rekordbox_pdb_t::table_t*>::iterator table =
reckordboxDB.tables()->begin();
table != reckordboxDB.tables()->end();
++table) {
if ((*table)->type() == tableOrder[tableOrderIndex]) {
uint16_t lastIndex = (*table)->last_page()->index();
rekordbox_pdb_t::page_ref_t* currentRef = (*table)->first_page();
for (const auto& table : *rekordboxDB.tables()) {
if (table->type() == tableOrder[tableOrderIndex]) {
uint16_t lastIndex = table->last_page()->index();
rekordbox_pdb_t::page_ref_t* currentRef = table->first_page();

@Swiftb0y Swiftb0y May 28, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this didn't build anymore because the table_t* changed to a unique_ptr<table_t>. I took the liberty and modernized the loop in the same step (same below).

@Swiftb0y
Swiftb0y force-pushed the chore/update-rekordbox-kaitai-definitions branch from 277b5c1 to 7df39ab Compare May 28, 2024 20:31
@Swiftb0y
Swiftb0y marked this pull request as ready for review May 28, 2024 20:32
@Swiftb0y

Copy link
Copy Markdown
Member Author

@0xsuk can you test this PR to see whether this doesn't break anything and fixes your string-encoding issue? Thank you.

@Swiftb0y
Swiftb0y force-pushed the chore/update-rekordbox-kaitai-definitions branch 2 times, most recently from 9a05287 to c9ca71f Compare May 30, 2024 13:00
@0xsuk

0xsuk commented May 30, 2024

Copy link
Copy Markdown

Everything looks good after I changed UTF-16BE to UTF-16LE in src/library/rekordbox/rekordboxfeature.cpp line 259.

@0xsuk

0xsuk commented May 30, 2024

Copy link
Copy Markdown

image
Thank you :)

Swiftb0y added 2 commits May 30, 2024 15:29
This makes it easier to ignore warnings in the autogenerated code.
It also makes more sense since the `*.ksy` files are effectively
vendored and the generated C++ files are autogenerated. Both
something that doesn't belong in `src/`.
@Swiftb0y
Swiftb0y force-pushed the chore/update-rekordbox-kaitai-definitions branch from c9ca71f to 157feda Compare May 30, 2024 13:30
@Swiftb0y

Copy link
Copy Markdown
Member Author

whoops. good catch, I assumed kaitai would take care of the conversion automatically. Fixed

@Swiftb0y

Copy link
Copy Markdown
Member Author

Thanks for testing.

@Swiftb0y

Copy link
Copy Markdown
Member Author

Ready for review. I suggest to go through on a commit by commit basis. The PR looks bigger as it is because most of the changes are either auto-generated or artifacts because I moved files around.

@Swiftb0y

Swiftb0y commented Jun 7, 2024

Copy link
Copy Markdown
Member Author

friendly ping, would be nice if this made it into 2.4.2. I've highlighted the significant changes above.

Comment thread CMakeLists.txt
Comment on lines +2489 to 2499
add_library(rekordbox_metadata STATIC EXCLUDE_FROM_ALL
lib/rekordbox-metadata/rekordbox_pdb.cpp
lib/rekordbox-metadata/rekordbox_anlz.cpp
)
target_include_directories(rekordbox_metadata SYSTEM PUBLIC lib/rekordbox-metadata)
target_link_libraries(mixxx-lib PRIVATE rekordbox_metadata)

# Kaitai for reading Rekordbox libraries
add_library(Kaitai STATIC EXCLUDE_FROM_ALL
lib/kaitai/kaitaistream.cpp
lib/kaitai/kaitai/kaitaistream.cpp
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a lot of code quality complaints on the output of the kaitai compiler, so I moved the generated code to lib/ (first and foremost because the linters already ignore that and second because it also makes sense to treat autogenerated code that way).

@Swiftb0y
Swiftb0y requested a review from daschuer June 8, 2024 11:07
@Swiftb0y Swiftb0y added this to the 2.4.2 milestone Jun 9, 2024

@daschuer daschuer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good and I rely on the tests done by @0xsuk
Thank you.

@daschuer
daschuer merged commit bc17387 into mixxxdj:2.4 Jun 9, 2024
@daschuer

daschuer commented Jun 9, 2024

Copy link
Copy Markdown
Member

How important is the fix? Does this rectify a release?

@Swiftb0y
Swiftb0y deleted the chore/update-rekordbox-kaitai-definitions branch June 9, 2024 16:17
@Swiftb0y

Swiftb0y commented Jun 9, 2024

Copy link
Copy Markdown
Member Author

Thank you.

How important is the fix? Does this rectify a release?

Well this PR contains two fixes. First the string decoding issue reported in #13291 and the second one concerns the history playlists created by rekordbox. I don't even think we ingest those.

I don't think an extra release is warranted as only the string decoding issue is affected, judging by the delay with which this was reported, I wouldn't say its critical enough to justify the effort.

@brunchboy

Copy link
Copy Markdown

It’s not just history playlists. Any table which has had deletions over time will likely be missing a few rows at the end without the structure fix.

@brunchboy

brunchboy commented Jun 9, 2024

Copy link
Copy Markdown

And not just deletions, rows are sometimes not present in row groups for inscrutable reasons. The fact that the problem was noticed in the history playlist table shows it could happen anywhere. We need to scan the entire last row group for rows marked as present, not assume we can stop scanning based on the value of num_rows.

@brunchboy

Copy link
Copy Markdown

Which is not to say that it necessarily merits an urgent release, I have no idea how many people rely on scanning rekordbox USBs in the first place. 😄

@Swiftb0y

Swiftb0y commented Jun 9, 2024

Copy link
Copy Markdown
Member Author

Ah, thank you. In that case it would probably justify a release. Considering there is also #13309 #11373 and #10923 which all could be caused by that issue.

@brunchboy

Copy link
Copy Markdown

Hmm, those all could be impacted but they sound worse than this! Please feel free to ping me if this doesn’t fix those other issues and perhaps I can help investigate the problematic export files.

@Swiftb0y

Swiftb0y commented Jun 9, 2024

Copy link
Copy Markdown
Member Author

That would be wonderful. We can close these issues once we have a release with the fix and ask the respective issue authors to check again. In case it still happens, I would refer them to you (where exactly? crate-digger repo / deep-symmetry zulip) if thats alright for you.

@brunchboy

Copy link
Copy Markdown

Let’s start on the Zulip instance and then I can create issues as appropriate.

Swiftb0y added a commit to Swiftb0y/mixxx that referenced this pull request May 18, 2025
Swiftb0y added a commit to Swiftb0y/mixxx that referenced this pull request May 19, 2025
Swiftb0y added a commit to Swiftb0y/mixxx that referenced this pull request May 19, 2025
Swiftb0y added a commit to Swiftb0y/mixxx that referenced this pull request May 20, 2025
Fixes mixxxdj#14789

Co-authored-by: Daniel Schürmann <daschuer@mixxx.org>
Swiftb0y added a commit to Swiftb0y/mixxx that referenced this pull request May 20, 2025
Fixes mixxxdj#14789

Co-authored-by: Daniel Schürmann <daschuer@mixxx.org>
daschuer added a commit that referenced this pull request May 21, 2025
…descriptions-utf16be

fix: hotcue comments are utf-16be, regression from #13293
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants