summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/EmbeddedArt.h
blob: b752bacb6a860bf3086d6e7517bd481d82cca37a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 *  Copyright (C) 2015-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#pragma once

#include "IArchivable.h"

#include <stdint.h>
#include <string>
#include <vector>

class EmbeddedArtInfo : public IArchivable
{
public:
  EmbeddedArtInfo() = default;
  EmbeddedArtInfo(size_t size, const std::string &mime, const std::string& type = "");
  virtual ~EmbeddedArtInfo() = default;

  // implementation of IArchivable
  void Archive(CArchive& ar) override;

  void Set(size_t size, const std::string &mime, const std::string& type = "");
  void Clear();
  bool Empty() const;
  bool Matches(const EmbeddedArtInfo &right) const;
  void SetType(const std::string& type) { m_type = type; }

  size_t m_size = 0;
  std::string m_mime;
  std::string m_type;
};

class EmbeddedArt : public EmbeddedArtInfo
{
public:
  EmbeddedArt() = default;
  EmbeddedArt(const uint8_t *data, size_t size,
              const std::string &mime, const std::string& type = "");

  void Set(const uint8_t *data, size_t size,
           const std::string &mime, const std::string& type = "");

  std::vector<uint8_t> m_data;
};