/* * Copyright (c) 2023, kleines Filmröllchen * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Audio { struct Person { enum class Role { Artist, Performer, Lyricist, Conductor, Publisher, Engineer, Composer, }; Role role; String name; // Whether this person has creative involvement with the song (so not only Role::Artist!). // This list is subjective and is intended to keep the artist display text in applications relevant. // It is used for first_artist and all_artists in Metadata. bool is_artist() const; Optional name_for_role() const; }; // Audio metadata of the original format must be equivalently reconstructible from this struct. // That means, (if the format allows it) fields can appear in a different order, but all fields must be present with the original values, // including duplicate fields where allowed by the format. struct Metadata { using Year = unsigned; void replace_encoder_with_serenity(); ErrorOr add_miscellaneous(String const& field, String value); ErrorOr add_person(Person::Role role, String name); Optional first_artist() const; ErrorOr> all_artists(StringView concatenate_with = ", "sv) const; Optional title; Optional subtitle; Optional track_number; Optional album; Optional genre; Optional comment; Optional isrc; Optional encoder; Optional copyright; Optional bpm; // FIXME: Until the time data structure situation is solved in a good way, we don't parse ISO 8601 time specifications. Optional unparsed_time; Vector people; // Any other metadata, using the format-specific field names. This ensures reproducibility. HashMap> miscellaneous; }; }