1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #109844 from nikitalita/invalid-ogg-comment

AudioStreamOggVorbis: only show invalid comment warning in Editor builds
This commit is contained in:
Thaddeus Crews
2025-10-27 10:01:33 -05:00

View File

@@ -460,14 +460,19 @@ void AudioStreamOggVorbis::maybe_update_info() {
} }
Dictionary dictionary; Dictionary dictionary;
// Comments are required by the Vorbis spec to be structured like env vars, i.e. VAR=VALUE.
// This is how tags are stored (artist, album, etc.), and we parse them out for display.
// See https://xiph.org/vorbis/doc/v-comment.html
for (int i = 0; i < comment.comments; i++) { for (int i = 0; i < comment.comments; i++) {
String c = String::utf8(comment.user_comments[i]); String c = String::utf8(comment.user_comments[i]);
int equals = c.find_char('='); int equals = c.find_char('=');
#ifdef TOOLS_ENABLED
if (equals == -1) { if (equals == -1) {
WARN_PRINT(vformat(R"(Invalid comment in Ogg Vorbis file "%s", should contain '=': "%s".)", get_path(), c)); WARN_PRINT(vformat(R"(Invalid comment in Ogg Vorbis file "%s", should contain '=': "%s".)", get_path(), c));
continue; continue;
} }
#endif
String tag = c.substr(0, equals); String tag = c.substr(0, equals);
String tag_value = c.substr(equals + 1); String tag_value = c.substr(equals + 1);