1 /*
2    mkvmerge -- utility for splicing together matroska files
3    from component media subtypes
4 
5    Distributed under the GPL v2
6    see the file COPYING for details
7    or visit https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
8 
9    definition of functions for converting between Vorbis comments and Matroska tags
10 
11    Written by Moritz Bunkus <moritz@bunkus.org>.
12 */
13 
14 #pragma once
15 
16 #include "common/common_pch.h"
17 
18 #include "common/attachment.h"
19 #include "common/bcp47.h"
20 
21 namespace libmatroska {
22 class KaxTags;
23 }
24 
25 namespace mtx::tags {
26 
27 struct vorbis_comments_t {
28   enum class type_e {
29     Unknown,
30     Vorbis,
31     VP8,
32     VP9,
33     Opus,
34   };
35 
36   type_e m_type{type_e::Unknown};
37   std::string m_vendor;
38   std::vector<std::pair<std::string, std::string>> m_comments;
39 
validvorbis_comments_t40   bool valid() const {
41     return type_e::Unknown != m_type;
42   }
43 };
44 
45 struct converted_vorbis_comments_t {
46   std::string m_title;
47   mtx::bcp47::language_c m_language;
48   std::shared_ptr<libmatroska::KaxTags> m_track_tags, m_album_tags;
49   std::vector<std::shared_ptr<attachment_t>> m_pictures;
50 };
51 
52 converted_vorbis_comments_t from_vorbis_comments(vorbis_comments_t const &vorbis_comments);
53 
54 vorbis_comments_t parse_vorbis_comments_from_packet(memory_c const &packet);
55 memory_cptr assemble_vorbis_comments_into_packet(vorbis_comments_t const &comments);
56 
57 }
58