Shaka Packager SDK
id3_tag.h
1 // Copyright 2018 Google LLC. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_BASE_ID3_TAG_H_
8 #define PACKAGER_MEDIA_BASE_ID3_TAG_H_
9 
10 #include <cstdint>
11 #include <string>
12 #include <vector>
13 
14 namespace shaka {
15 namespace media {
16 
17 class BufferWriter;
18 
21 class Id3Tag {
22  public:
23  Id3Tag() = default;
24  virtual ~Id3Tag() = default;
25 
30  // This function is made virtual for testing.
31  virtual void AddPrivateFrame(const std::string& owner,
32  const std::string& data);
33 
37  // This function is made virtual for testing.
38  virtual bool WriteToBuffer(BufferWriter* buffer_writer);
39 
43  // This function is made virtual for testing.
44  virtual bool WriteToVector(std::vector<uint8_t>* output);
45 
46  private:
47  Id3Tag(const Id3Tag&) = delete;
48  Id3Tag& operator=(const Id3Tag&) = delete;
49 
50  struct PrivateFrame {
51  std::string owner;
52  std::string data;
53  };
54 
55  bool WritePrivateFrame(const PrivateFrame& private_frame,
56  BufferWriter* buffer_writer);
57 
58  std::vector<PrivateFrame> private_frames_;
59 };
60 
61 } // namespace media
62 } // namespace shaka
63 
64 #endif // PACKAGER_MEDIA_BASE_ID3_TAG_H_
virtual bool WriteToBuffer(BufferWriter *buffer_writer)
Definition: id3_tag.cc:55
virtual void AddPrivateFrame(const std::string &owner, const std::string &data)
Definition: id3_tag.cc:50
virtual bool WriteToVector(std::vector< uint8_t > *output)
Definition: id3_tag.cc:68
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66