Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Confused about the meta data API (Read 1470 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Confused about the meta data API

After trying to understand the meta data API the last couple of months with foo_midi, I'm still confused:

Consider a valid MIDI file that is not in a library path.

* metadb_index_client::transform() gets called when I add it to a playlist. However, removing the file from the playlist and re-adding it does not call transform() again; not even after closing the foobar2000 instance. How does foobar2000 know it has seen the file before? When I rename the file, transform() gets called again. So, where does the association between the file path and the hash get verified?
* Playing the file calls input_stubs::decode_get_dynamic_info() but when I set an Info tag it does not appear in the Properties panel nor does it contain a value when I display the tag in the status bar f. e.
* Using the "Tagging/Remove tags from file..." context menu item does not remove any meta data from the database (tags do not get written back to the MIDI file). How do I "reset" the tagging process and can I force foobar2000 to re-construct the meta data?

I'm not sure if the original component (pre-2.0) did it right or that I broke something along the way.

Re: Confused about the meta data API

Reply #1
I'm not an authority on these matters, but I assume metadb_index works like other metadata. foobar2000 v2.0 now caches these even for tracks outside media library and playlists.

Dynamic information is never visible in properties dialog, it's meant for stuff like dynamically changing titles for streams or realtime bitrate updates. The info returned that way works on playlists and statusbar and in any component designed to utilize dynamic info.

For your last bit normal normal tagging is not related to your metadb_index. You can force refresh your info with metadb_index_manager::dispatch_refresh.

PS: See rating.cpp in foobar2000 sample component. It calls dispatch_global_refresh() from on_init_stage() and I do the same in my component. I haven't seen issues with data being missing.

Re: Confused about the meta data API

Reply #2
Thx for the reply.

Dynamic information is never visible in properties dialog, it's meant for stuff like dynamically changing titles for streams or realtime bitrate updates. The info returned that way works on playlists and statusbar and in any component designed to utilize dynamic info.

That is the use case I'm aiming for: foo_midi sometimes uses another 'player' based on presets or specific information in the MIDI stream. Or because of a bug ;-) The dynamic info would contain the name of the used 'player'. The code gets called but the info tag is not available.

Re: Confused about the meta data API

Reply #3
It's quite possible I'm way out of my depth here but I had a quick look for decode_get_dynamic_info on your github and it appears you only set the player name/return true on the first call on each track?? Surely it needs to do that every time? Maybe getting the name only needs to be done once but using info_set/returning true needs to happen on every call.

Re: Confused about the meta data API

Reply #4
marc2k3 beat me to it. Though don't return true unless info changes. No point to waste processing power when nothing actually changes.

Re: Confused about the meta data API

Reply #5
Thx. I'll try that tonight.

Re: Confused about the meta data API

Reply #6
OK. Solved. Turns out the code was right but the test was wrong: I forgot to use the $info() titleformatting function, again.

Even setting the info tag 1 time for the first chunk works; no need to keep setting it.


Re: Confused about the meta data API

Reply #8
Why? You know 'tunnel vision' is a big problem when trying to fix a bug. Every comment from another developer puts another perspective on the problem. Thx again.