Coverage Report

Created: 2025-08-11 08:01

/src/libheif/libheif/api_structs.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * HEIF codec.
3
 * Copyright (c) 2017 Dirk Farin <dirk.farin@gmail.com>
4
 *
5
 * This file is part of libheif.
6
 *
7
 * libheif is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Lesser General Public License as
9
 * published by the Free Software Foundation, either version 3 of
10
 * the License, or (at your option) any later version.
11
 *
12
 * libheif is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public License
18
 * along with libheif.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#ifndef HEIF_API_STRUCTS_H
22
#define HEIF_API_STRUCTS_H
23
24
#include "pixelimage.h"
25
#include "context.h"
26
27
#include <memory>
28
#include <vector>
29
#include <string>
30
#include "image-items/image_item.h"
31
32
struct heif_image_handle
33
{
34
  std::shared_ptr<ImageItem> image;
35
36
  // store reference to keep the context alive while we are using the handle (issue #147)
37
  std::shared_ptr<HeifContext> context;
38
};
39
40
41
struct heif_track
42
{
43
  std::shared_ptr<Track> track;
44
45
  // store reference to keep the context alive while we are using the handle (issue #147)
46
  std::shared_ptr<HeifContext> context;
47
};
48
49
struct heif_raw_sequence_sample
50
{
51
  ~heif_raw_sequence_sample()
52
0
  {
53
0
    heif_tai_timestamp_packet_release(timestamp);
54
0
  }
55
56
  std::vector<uint8_t> data;
57
  uint32_t duration = 0;
58
59
  heif_tai_timestamp_packet* timestamp = nullptr;
60
  std::string gimi_sample_content_id;
61
};
62
63
64
struct heif_image
65
{
66
  std::shared_ptr<HeifPixelImage> image;
67
};
68
69
70
struct heif_context
71
{
72
  std::shared_ptr<HeifContext> context;
73
};
74
75
76
struct heif_encoder
77
{
78
  heif_encoder(const struct heif_encoder_plugin* plugin);
79
80
  ~heif_encoder();
81
82
  struct heif_error alloc();
83
84
  void release();
85
86
87
  const struct heif_encoder_plugin* plugin;
88
  void* encoder = nullptr;
89
};
90
91
92
struct heif_region_item
93
{
94
  std::shared_ptr<HeifContext> context;
95
  std::shared_ptr<RegionItem> region_item;
96
};
97
98
99
struct heif_region
100
{
101
  std::shared_ptr<HeifContext> context; // we need this to perform coordinate transformation
102
  //heif_item_id parent_region_item_id; // we need this to perform coordinate transformation
103
  std::shared_ptr<RegionItem> region_item;
104
  std::shared_ptr<RegionGeometry> region;
105
};
106
107
struct heif_text_item
108
{
109
  std::shared_ptr<HeifContext> context;
110
  std::shared_ptr<TextItem> text_item;
111
};
112
113
114
#endif