digiKam
heif_cxx.h
Go to the documentation of this file.
1 /*
2  * C++ interface to libheif
3  * Copyright (c) 2018 struktur AG, Dirk Farin <farin@struktur.de>
4  *
5  * This file is part of libheif.
6  *
7  * heif is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * heif 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 General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with heif. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef LIBHEIF_HEIF_CXX_H
22 #define LIBHEIF_HEIF_CXX_H
23 
24 #include <memory>
25 #include <string>
26 #include <vector>
27 
28 extern "C" {
29 #include <libheif/heif.h>
30 }
31 
32 
33 namespace heif {
34 
35  class Error
36  {
37  public:
38  Error() {
39  m_code = heif_error_Ok;
40  m_subcode = heif_suberror_Unspecified;
41  m_message = "Ok";
42  }
43 
44  Error(const heif_error& err) {
45  m_code = err.code;
46  m_subcode = err.subcode;
47  m_message = err.message;
48  }
49 
50  std::string get_message() const { return m_message; }
51 
52  heif_error_code get_code() const { return m_code; }
53 
54  heif_suberror_code get_subcode() const { return m_subcode; }
55 
56  operator bool() const { return m_code != heif_error_Ok; }
57 
58  private:
59  heif_error_code m_code;
60  heif_suberror_code m_subcode;
61  std::string m_message;
62  };
63 
64 
65  class ImageHandle;
66  class Image;
67 
68  class Encoder;
69  class EncoderParameter;
70  class EncoderDescriptor;
71 
72 
73  class Context
74  {
75  public:
76  Context();
77 
78  class ReadingOptions { };
79 
80  // throws Error
81  void read_from_file(std::string filename, const ReadingOptions& opts = ReadingOptions());
82 
83  // DEPRECATED. Use read_from_memory_without_copy() instead.
84  // throws Error
85  void read_from_memory(const void* mem, size_t size, const ReadingOptions& opts = ReadingOptions());
86 
87  // throws Error
88  void read_from_memory_without_copy(const void* mem, size_t size, const ReadingOptions& opts = ReadingOptions());
89 
90  class Reader {
91  public:
92  virtual ~Reader() { }
93 
94  virtual int64_t get_position() const = 0;
95  virtual int read(void* data, size_t size) = 0;
96  virtual int seek(int64_t position) = 0;
97  virtual heif_reader_grow_status wait_for_file_size(int64_t target_size) = 0;
98  };
99 
100  // throws Error
101  void read_from_reader(Reader&, const ReadingOptions& opts = ReadingOptions());
102 
103  int get_number_of_top_level_images() const noexcept;
104 
105  bool is_top_level_image_ID(heif_item_id id) const noexcept;
106 
107  std::vector<heif_item_id> get_list_of_top_level_image_IDs() const noexcept;
108 
109  // throws Error
111 
112  // throws Error
114 
116 
117 
118 
120  public:
121  EncodingOptions();
122  };
123 
124  // throws Error
125  ImageHandle encode_image(const Image& img, Encoder& encoder,
126  const EncodingOptions& options = EncodingOptions());
127 
128  // throws Error
129  void set_primary_image(ImageHandle& new_primary_image_handle);
130 
131  // throws Error
132  ImageHandle encode_thumbnail(const Image& image,
133  const ImageHandle& master_image,
134  Encoder& encoder,
135  const EncodingOptions&,
136  int bbox_size);
137 
138  // throws Error
139  void assign_thumbnail(const ImageHandle& thumbnail_image,
140  const ImageHandle& master_image);
141 
142  // throws Error
143  void add_exif_metadata(const ImageHandle& master_image,
144  const void* data, int size);
145 
146  // throws Error
147  void add_XMP_metadata(const ImageHandle& master_image,
148  const void* data, int size);
149 
150  class Writer {
151  public:
152  virtual ~Writer() { }
153 
154  virtual heif_error write(const void* data, size_t size) = 0;
155  };
156 
157  // throws Error
158  void write(Writer&);
159 
160  // throws Error
161  void write_to_file(std::string filename) const;
162 
163  private:
164  std::shared_ptr<heif_context> m_context;
165 
166  friend struct ::heif_error heif_writer_trampoline_write(struct heif_context* ctx,
167  const void* data,
168  size_t size,
169  void* userdata);
170 
171  //static Context wrap_without_releasing(heif_context*); // internal use in friend function only
172  };
173 
174 
175 
177  {
178  public:
180 
182 
183  bool empty() const noexcept { return !m_image_handle; }
184 
185  bool is_primary_image() const noexcept;
186 
187  int get_width() const noexcept;
188 
189  int get_height() const noexcept;
190 
191  bool has_alpha_channel() const noexcept;
192 
193  // ------------------------- depth images -------------------------
194 
195  // TODO
196 
197  // ------------------------- thumbnails -------------------------
198 
199  int get_number_of_thumbnails() const noexcept;
200 
201  std::vector<heif_item_id> get_list_of_thumbnail_IDs() const noexcept;
202 
203  // throws Error
205 
206  // ------------------------- metadata (Exif / XMP) -------------------------
207 
208  // Can optionally be filtered by type ("Exif" / "XMP")
209  std::vector<heif_item_id> get_list_of_metadata_block_IDs(const char* type_filter = nullptr) const noexcept;
210 
211  std::string get_metadata_type(heif_item_id metadata_id) const noexcept;
212 
213  std::string get_metadata_content_type(heif_item_id metadata_id) const noexcept;
214 
215  // throws error
216  std::vector<uint8_t> get_metadata(heif_item_id) const;
217 
218 
219  class DecodingOptions { };
220 
221  // throws Error
222  Image decode_image(heif_colorspace colorspace, heif_chroma chroma,
223  const DecodingOptions& options = DecodingOptions());
224 
225 
226  heif_image_handle* get_raw_image_handle() noexcept { return m_image_handle.get(); }
227  const heif_image_handle* get_raw_image_handle() const noexcept { return m_image_handle.get(); }
228 
229  private:
230  std::shared_ptr<heif_image_handle> m_image_handle;
231  };
232 
233 
234  class Image
235  {
236  public:
237  Image() { }
238  Image(heif_image* image);
239 
240 
241  // throws Error
242  void create(int width, int height,
243  enum heif_colorspace colorspace,
244  enum heif_chroma chroma);
245 
246  // throws Error
247  void add_plane(enum heif_channel channel,
248  int width, int height, int bit_depth);
249 
250  heif_colorspace get_colorspace() const noexcept;
251 
252  heif_chroma get_chroma_format() const noexcept;
253 
254  int get_width(enum heif_channel channel) const noexcept;
255 
256  int get_height(enum heif_channel channel) const noexcept;
257 
258  int get_bits_per_pixel(enum heif_channel channel) const noexcept;
259 
260  bool has_channel(enum heif_channel channel) const noexcept;
261 
262  const uint8_t* get_plane(enum heif_channel channel, int* out_stride) const noexcept;
263 
264  uint8_t* get_plane(enum heif_channel channel, int* out_stride) noexcept;
265 
266  class ScalingOptions { };
267 
268  // throws Error
269  Image scale_image(int width, int height,
270  const ScalingOptions& options = ScalingOptions()) const;
271 
272  private:
273  std::shared_ptr<heif_image> m_image;
274 
275  friend class Context;
276  };
277 
278 
279 
281  {
282  public:
283  static std::vector<EncoderDescriptor>
285  const char* name_filter) noexcept;
286 
287  std::string get_name() const noexcept;
288 
289  std::string get_id_name() const noexcept;
290 
291  enum heif_compression_format get_compression_format() const noexcept;
292 
293  bool supportes_lossy_compression() const noexcept;
294 
295  bool supportes_lossless_compression() const noexcept;
296 
297 
298  // throws Error
299  Encoder get_encoder() const;
300 
301 
302  private:
303  EncoderDescriptor(const struct heif_encoder_descriptor* descr) : m_descriptor(descr) { }
304 
305  const struct heif_encoder_descriptor* m_descriptor = nullptr;
306  };
307 
308 
309 
311  {
312  public:
313  std::string get_name() const noexcept;
314 
315  enum heif_encoder_parameter_type get_type() const noexcept;
316 
317  bool is_integer() const noexcept;
318  // Returns 'true' if the integer range is limited.
319  bool get_valid_integer_range(int& out_minimum, int& out_maximum);
320 
321  bool is_boolean() const noexcept;
322 
323  bool is_string() const noexcept;
324  std::vector<std::string> get_valid_string_values() const;
325 
326  private:
328 
329  const struct heif_encoder_parameter* m_parameter;
330 
331  friend class Encoder;
332  };
333 
334 
335  class Encoder
336  {
337  public:
338  // throws Error
339  Encoder(enum heif_compression_format format);
340 
341  // throws Error
342  void set_lossy_quality(int quality);
343 
344  // throws Error
345  void set_lossless(bool enable_lossless);
346 
347  std::vector<EncoderParameter> list_parameters() const noexcept;
348 
349  void set_integer_parameter(std::string parameter_name, int value);
350  int get_integer_parameter(std::string parameter_name) const;
351 
352  void set_boolean_parameter(std::string parameter_name, bool value);
353  bool get_boolean_parameter(std::string parameter_name) const;
354 
355  void set_string_parameter(std::string parameter_name, std::string value);
356  std::string get_string_parameter(std::string parameter_name) const;
357 
358  void set_parameter(std::string parameter_name, std::string parameter_value);
359  std::string get_parameter(std::string parameter_name) const;
360 
361  private:
362  Encoder(struct heif_encoder*) noexcept;
363 
364  std::shared_ptr<heif_encoder> m_encoder;
365 
366  friend class EncoderDescriptor;
367  friend class Context;
368  };
369 
370 
371  // ==========================================================================================
372  // IMPLEMENTATION
373  // ==========================================================================================
374 
375  inline Context::Context() {
377  m_context = std::shared_ptr<heif_context>(ctx,
378  [] (heif_context* c) { heif_context_free(c); });
379  }
380 
381  inline void Context::read_from_file(std::string filename, const ReadingOptions& /*opts*/) {
382  Error err = Error(heif_context_read_from_file(m_context.get(), filename.c_str(), NULL));
383  if (err) {
384  throw err;
385  }
386  }
387 
388  inline void Context::read_from_memory(const void* mem, size_t size, const ReadingOptions& /*opts*/) {
389  Error err = Error(heif_context_read_from_memory(m_context.get(), mem, size, NULL));
390  if (err) {
391  throw err;
392  }
393  }
394 
395  inline void Context::read_from_memory_without_copy(const void* mem, size_t size, const ReadingOptions& /*opts*/) {
396  Error err = Error(heif_context_read_from_memory_without_copy(m_context.get(), mem, size, NULL));
397  if (err) {
398  throw err;
399  }
400  }
401 
402 
403  inline int64_t heif_reader_trampoline_get_position(void* userdata) {
404  Context::Reader* reader = (Context::Reader*)userdata;
405  return reader->get_position();
406  }
407 
408  inline int heif_reader_trampoline_read(void* data, size_t size, void* userdata) {
409  Context::Reader* reader = (Context::Reader*)userdata;
410  return reader->read(data,size);
411  }
412 
413  inline int heif_reader_trampoline_seek(int64_t position, void* userdata) {
414  Context::Reader* reader = (Context::Reader*)userdata;
415  return reader->seek(position);
416  }
417 
418  inline heif_reader_grow_status heif_reader_trampoline_wait_for_file_size(int64_t target_size, void* userdata) {
419  Context::Reader* reader = (Context::Reader*)userdata;
420  return reader->wait_for_file_size(target_size);
421  }
422 
423 
424  static struct heif_reader heif_reader_trampoline =
425  {
426  1,
431  };
432 
433  inline void Context::read_from_reader(Reader& reader, const ReadingOptions& /*opts*/) {
434  Error err = Error(heif_context_read_from_reader(m_context.get(), &heif_reader_trampoline,
435  &reader, NULL));
436  if (err) {
437  throw err;
438  }
439  }
440 
441 
442  inline int Context::get_number_of_top_level_images() const noexcept {
443  return heif_context_get_number_of_top_level_images(m_context.get());
444  }
445 
446  inline bool Context::is_top_level_image_ID(heif_item_id id) const noexcept {
447  return heif_context_is_top_level_image_ID(m_context.get(), id);
448  }
449 
450  inline std::vector<heif_item_id> Context::get_list_of_top_level_image_IDs() const noexcept {
451  int num = get_number_of_top_level_images();
452  std::vector<heif_item_id> IDs(num);
453  heif_context_get_list_of_top_level_image_IDs(m_context.get(), IDs.data(), num);
454  return IDs;
455  }
456 
458  heif_item_id id;
459  Error err = Error(heif_context_get_primary_image_ID(m_context.get(), &id));
460  if (err) {
461  throw err;
462  }
463  return id;
464  }
465 
467  heif_image_handle* handle;
468  Error err = Error(heif_context_get_primary_image_handle(m_context.get(), &handle));
469  if (err) {
470  throw err;
471  }
472 
473  return ImageHandle(handle);
474  }
475 
477  struct heif_image_handle* handle;
478  Error err = Error(heif_context_get_image_handle(m_context.get(), id, &handle));
479  if (err) {
480  throw err;
481  }
482  return ImageHandle(handle);
483  }
484 
485 #if 0
486  inline Context Context::wrap_without_releasing(heif_context* ctx) {
488  context.m_context = std::shared_ptr<heif_context>(ctx,
489  [] (heif_context*) { /* NOP */ });
490  return context;
491  }
492 #endif
493 
494  inline struct ::heif_error heif_writer_trampoline_write(struct heif_context* ctx,
495  const void* data,
496  size_t size,
497  void* userdata) {
498  Context::Writer* writer = (Context::Writer*)userdata;
499 
500  (void)ctx;
501 
502  //Context context = Context::wrap_without_releasing(ctx);
503  //return writer->write(context, data, size);
504  return writer->write(data, size);
505  }
506 
507  static struct heif_writer heif_writer_trampoline =
508  {
509  1,
511  };
512 
513  inline void Context::write(Writer& writer) {
514  Error err = Error(heif_context_write(m_context.get(), &heif_writer_trampoline, &writer));
515  if (err) {
516  throw err;
517  }
518  }
519 
520  inline void Context::write_to_file(std::string filename) const {
521  Error err = Error(heif_context_write_to_file(m_context.get(), filename.c_str()));
522  if (err) {
523  throw err;
524  }
525  }
526 
527 
528 
530  if (handle != nullptr) {
531  m_image_handle = std::shared_ptr<heif_image_handle>(handle,
533  }
534  }
535 
536  inline bool ImageHandle::is_primary_image() const noexcept {
537  return heif_image_handle_is_primary_image(m_image_handle.get()) != 0;
538  }
539 
540  inline int ImageHandle::get_width() const noexcept {
541  return heif_image_handle_get_width(m_image_handle.get());
542  }
543 
544  inline int ImageHandle::get_height() const noexcept {
545  return heif_image_handle_get_height(m_image_handle.get());
546  }
547 
548  inline bool ImageHandle::has_alpha_channel() const noexcept {
549  return heif_image_handle_has_alpha_channel(m_image_handle.get()) != 0;
550  }
551 
552  // ------------------------- depth images -------------------------
553 
554  // TODO
555 
556  // ------------------------- thumbnails -------------------------
557 
558  inline int ImageHandle::get_number_of_thumbnails() const noexcept {
559  return heif_image_handle_get_number_of_thumbnails(m_image_handle.get());
560  }
561 
562  inline std::vector<heif_item_id> ImageHandle::get_list_of_thumbnail_IDs() const noexcept {
563  int num = get_number_of_thumbnails();
564  std::vector<heif_item_id> IDs(num);
565  heif_image_handle_get_list_of_thumbnail_IDs(m_image_handle.get(), IDs.data(), num);
566  return IDs;
567  }
568 
570  heif_image_handle* handle;
571  Error err = Error(heif_image_handle_get_thumbnail(m_image_handle.get(), id, &handle));
572  if (err) {
573  throw err;
574  }
575 
576  return ImageHandle(handle);
577  }
578 
580  const DecodingOptions& /*options*/) {
581  heif_image* out_img;
582  Error err = Error(heif_decode_image(m_image_handle.get(),
583  &out_img,
584  colorspace,
585  chroma,
586  nullptr)); //const struct heif_decoding_options* options);
587  if (err) {
588  throw err;
589  }
590 
591  return Image(out_img);
592  }
593 
594 
595  inline std::vector<heif_item_id> ImageHandle::get_list_of_metadata_block_IDs(const char* type_filter) const noexcept {
596  int nBlocks = heif_image_handle_get_number_of_metadata_blocks(m_image_handle.get(),
597  type_filter);
598  std::vector<heif_item_id> ids(nBlocks);
599  int n = heif_image_handle_get_list_of_metadata_block_IDs(m_image_handle.get(),
600  type_filter,
601  ids.data(), nBlocks);
602  (void)n;
603  //assert(n==nBlocks);
604  return ids;
605  }
606 
607  inline std::string ImageHandle::get_metadata_type(heif_item_id metadata_id) const noexcept {
608  return heif_image_handle_get_metadata_type(m_image_handle.get(), metadata_id);
609  }
610 
611  inline std::string ImageHandle::get_metadata_content_type(heif_item_id metadata_id) const noexcept {
612  return heif_image_handle_get_metadata_content_type(m_image_handle.get(), metadata_id);
613  }
614 
615  inline std::vector<uint8_t> ImageHandle::get_metadata(heif_item_id metadata_id) const {
616  size_t data_size = heif_image_handle_get_metadata_size(m_image_handle.get(),
617  metadata_id);
618 
619  std::vector<uint8_t> data(data_size);
620 
621  Error err = Error(heif_image_handle_get_metadata(m_image_handle.get(),
622  metadata_id,
623  data.data()));
624  if (err) {
625  throw err;
626  }
627 
628  return data;
629  }
630 
631 
632 
633  inline Image::Image(heif_image* image) {
634  m_image = std::shared_ptr<heif_image>(image,
635  [] (heif_image* h) { heif_image_release(h); });
636  }
637 
638 
639  inline void Image::create(int width, int height,
640  enum heif_colorspace colorspace,
641  enum heif_chroma chroma) {
642  heif_image* image;
643  Error err = Error(heif_image_create(width, height, colorspace, chroma, &image));
644  if (err) {
645  m_image.reset();
646  throw err;
647  }
648  else {
649  m_image = std::shared_ptr<heif_image>(image,
650  [] (heif_image* h) { heif_image_release(h); });
651  }
652  }
653 
654  inline void Image::add_plane(enum heif_channel channel,
655  int width, int height, int bit_depth) {
656  Error err = Error(heif_image_add_plane(m_image.get(), channel, width, height, bit_depth));
657  if (err) {
658  throw err;
659  }
660  }
661 
662  inline heif_colorspace Image::get_colorspace() const noexcept {
663  return heif_image_get_colorspace(m_image.get());
664  }
665 
666  inline heif_chroma Image::get_chroma_format() const noexcept {
667  return heif_image_get_chroma_format(m_image.get());
668  }
669 
670  inline int Image::get_width(enum heif_channel channel) const noexcept {
671  return heif_image_get_width(m_image.get(), channel);
672  }
673 
674  inline int Image::get_height(enum heif_channel channel) const noexcept {
675  return heif_image_get_height(m_image.get(), channel);
676  }
677 
678  inline int Image::get_bits_per_pixel(enum heif_channel channel) const noexcept {
679  return heif_image_get_bits_per_pixel(m_image.get(), channel);
680  }
681 
682  inline bool Image::has_channel(enum heif_channel channel) const noexcept {
683  return heif_image_has_channel(m_image.get(), channel);
684  }
685 
686  inline const uint8_t* Image::get_plane(enum heif_channel channel, int* out_stride) const noexcept {
687  return heif_image_get_plane_readonly(m_image.get(), channel, out_stride);
688  }
689 
690  inline uint8_t* Image::get_plane(enum heif_channel channel, int* out_stride) noexcept {
691  return heif_image_get_plane(m_image.get(), channel, out_stride);
692  }
693 
694  inline Image Image::scale_image(int width, int height,
695  const ScalingOptions&) const {
696  heif_image* img;
697  Error err = Error(heif_image_scale_image(m_image.get(), &img, width,height,
698  nullptr)); // TODO: scaling options not defined yet
699  if (err) {
700  throw err;
701  }
702 
703  return Image(img);
704  }
705 
706 
707 
708  inline std::vector<EncoderDescriptor>
710  const char* name_filter) noexcept {
711  int maxDescriptors = 10;
712  int nDescriptors;
713  for (;;) {
714  const struct heif_encoder_descriptor** descriptors;
715  descriptors = new const heif_encoder_descriptor*[maxDescriptors];
716 
717  nDescriptors = heif_context_get_encoder_descriptors(nullptr,
718  format_filter,
719  name_filter,
720  descriptors,
721  maxDescriptors);
722  if (nDescriptors < maxDescriptors) {
723  std::vector<EncoderDescriptor> outDescriptors;
724  for (int i=0;i<nDescriptors;i++) {
725  outDescriptors.push_back(EncoderDescriptor(descriptors[i]));
726  }
727 
728  delete[] descriptors;
729 
730  return outDescriptors;
731  }
732  else {
733  delete[] descriptors;
734  maxDescriptors *= 2;
735  }
736  }
737  }
738 
739 
740  inline std::string EncoderDescriptor::get_name() const noexcept {
741  return heif_encoder_descriptor_get_name(m_descriptor);
742  }
743 
744  inline std::string EncoderDescriptor::get_id_name() const noexcept {
745  return heif_encoder_descriptor_get_id_name(m_descriptor);
746  }
747 
750  }
751 
752  inline bool EncoderDescriptor::supportes_lossy_compression() const noexcept {
754  }
755 
758  }
759 
761  heif_encoder* encoder;
762  Error err = Error(heif_context_get_encoder(nullptr, m_descriptor, &encoder));
763  if (err) {
764  throw err;
765  }
766 
767  return Encoder(encoder);
768  }
769 
770 
772  heif_encoder* encoder;
773  Error err = Error(heif_context_get_encoder_for_format(nullptr, format, &encoder));
774  if (err) {
775  throw err;
776  }
777 
778  m_encoder = std::shared_ptr<heif_encoder>(encoder,
779  [] (heif_encoder* e) { heif_encoder_release(e); });
780  }
781 
782  inline Encoder::Encoder(struct heif_encoder* encoder) noexcept
783  {
784  m_encoder = std::shared_ptr<heif_encoder>(encoder,
785  [] (heif_encoder* e) { heif_encoder_release(e); });
786  }
787 
788 
789  inline EncoderParameter::EncoderParameter(const heif_encoder_parameter* param)
790  : m_parameter(param)
791  {
792  }
793 
794  inline std::string EncoderParameter::get_name() const noexcept {
795  return heif_encoder_parameter_get_name(m_parameter);
796  }
797 
798  inline enum heif_encoder_parameter_type EncoderParameter::get_type() const noexcept {
799  return heif_encoder_parameter_get_type(m_parameter);
800  }
801 
802  inline bool EncoderParameter::is_integer() const noexcept {
804  }
805 
806  inline bool EncoderParameter::get_valid_integer_range(int& out_minimum, int& out_maximum) {
807  int have_minimum_maximum;
809  &have_minimum_maximum,
810  &out_minimum, &out_maximum));
811  if (err) {
812  throw err;
813  }
814 
815  return have_minimum_maximum;
816  }
817 
818  inline bool EncoderParameter::is_boolean() const noexcept {
820  }
821 
822  inline bool EncoderParameter::is_string() const noexcept {
824  }
825 
826  inline std::vector<std::string> EncoderParameter::get_valid_string_values() const {
827  const char*const* stringarray;
829  &stringarray));
830  if (err) {
831  throw err;
832  }
833 
834  std::vector<std::string> values;
835  for (int i=0; stringarray[i]; i++) {
836  values.push_back(stringarray[i]);
837  }
838 
839  return values;
840  }
841 
842  inline std::vector<EncoderParameter> Encoder::list_parameters() const noexcept {
843  std::vector<EncoderParameter> parameters;
844 
845  for (const struct heif_encoder_parameter*const* params = heif_encoder_list_parameters(m_encoder.get());
846  *params;
847  params++) {
848  parameters.push_back(EncoderParameter(*params));
849  }
850 
851  return parameters;
852  }
853 
854 
855  inline void Encoder::set_lossy_quality(int quality) {
856  Error err = Error(heif_encoder_set_lossy_quality(m_encoder.get(), quality));
857  if (err) {
858  throw err;
859  }
860  }
861 
862  inline void Encoder::set_lossless(bool enable_lossless) {
863  Error err = Error(heif_encoder_set_lossless(m_encoder.get(), enable_lossless));
864  if (err) {
865  throw err;
866  }
867  }
868 
869  inline void Encoder::set_integer_parameter(std::string parameter_name, int value) {
870  Error err = Error(heif_encoder_set_parameter_integer(m_encoder.get(), parameter_name.c_str(), value));
871  if (err) {
872  throw err;
873  }
874  }
875 
876  inline int Encoder::get_integer_parameter(std::string parameter_name) const {
877  int value;
878  Error err = Error(heif_encoder_get_parameter_integer(m_encoder.get(), parameter_name.c_str(), &value));
879  if (err) {
880  throw err;
881  }
882  return value;
883  }
884 
885  inline void Encoder::set_boolean_parameter(std::string parameter_name, bool value) {
886  Error err = Error(heif_encoder_set_parameter_boolean(m_encoder.get(), parameter_name.c_str(), value));
887  if (err) {
888  throw err;
889  }
890  }
891 
892  inline bool Encoder::get_boolean_parameter(std::string parameter_name) const {
893  int value;
894  Error err = Error(heif_encoder_get_parameter_boolean(m_encoder.get(), parameter_name.c_str(), &value));
895  if (err) {
896  throw err;
897  }
898  return value;
899  }
900 
901  inline void Encoder::set_string_parameter(std::string parameter_name, std::string value) {
902  Error err = Error(heif_encoder_set_parameter_string(m_encoder.get(), parameter_name.c_str(), value.c_str()));
903  if (err) {
904  throw err;
905  }
906  }
907 
908  inline std::string Encoder::get_string_parameter(std::string parameter_name) const {
909  const int max_size = 250;
910  char value[max_size];
911  Error err = Error(heif_encoder_get_parameter_string(m_encoder.get(), parameter_name.c_str(),
912  value, max_size));
913  if (err) {
914  throw err;
915  }
916  return value;
917  }
918 
919  inline void Encoder::set_parameter(std::string parameter_name, std::string parameter_value) {
920  Error err = Error(heif_encoder_set_parameter(m_encoder.get(), parameter_name.c_str(),
921  parameter_value.c_str()));
922  if (err) {
923  throw err;
924  }
925  }
926 
927  inline std::string Encoder::get_parameter(std::string parameter_name) const {
928  const int max_size = 250;
929  char value[max_size];
930  Error err = Error(heif_encoder_get_parameter(m_encoder.get(), parameter_name.c_str(),
931  value, max_size));
932  if (err) {
933  throw err;
934  }
935  return value;
936  }
937 
938  inline void Context::set_primary_image(ImageHandle& new_primary_image_handle) {
939  Error err = Error(heif_context_set_primary_image(m_context.get(),
940  new_primary_image_handle.get_raw_image_handle()));
941  if (err) {
942  throw err;
943  }
944  }
945 
946 
948  // TODO: this is a bit hacky. It would be better to have an API function to set
949  // the options to default values. But I do not see any reason for that apart from
950  // this use-case.
951 
952  struct heif_encoding_options* default_options = heif_encoding_options_alloc();
953  *static_cast<heif_encoding_options*>(this) = *default_options; // copy over all options
954  heif_encoding_options_free(default_options);
955  }
956 
957 
958  inline ImageHandle Context::encode_image(const Image& img, Encoder& encoder,
959  const EncodingOptions& options) {
960  struct heif_image_handle* image_handle;
961 
962  Error err = Error(heif_context_encode_image(m_context.get(),
963  img.m_image.get(),
964  encoder.m_encoder.get(),
965  &options,
966  &image_handle));
967  if (err) {
968  throw err;
969  }
970 
971  return ImageHandle(image_handle);
972  }
973 
974 
976  const ImageHandle& master_image_handle,
977  Encoder& encoder,
978  const EncodingOptions& options,
979  int bbox_size) {
980  struct heif_image_handle* thumb_image_handle;
981 
982  Error err = Error(heif_context_encode_thumbnail(m_context.get(),
983  image.m_image.get(),
984  master_image_handle.get_raw_image_handle(),
985  encoder.m_encoder.get(),
986  &options,
987  bbox_size,
988  &thumb_image_handle));
989  if (err) {
990  throw err;
991  }
992 
993  return ImageHandle(thumb_image_handle);
994  }
995 
996 
997  inline void Context::assign_thumbnail(const ImageHandle& thumbnail_image,
998  const ImageHandle& master_image) {
999  Error err = Error(heif_context_assign_thumbnail(m_context.get(),
1000  thumbnail_image.get_raw_image_handle(),
1001  master_image.get_raw_image_handle()));
1002  if (err) {
1003  throw err;
1004  }
1005  }
1006 
1007  inline void Context::add_exif_metadata(const ImageHandle& master_image,
1008  const void* data, int size) {
1009  Error err = Error(heif_context_add_exif_metadata(m_context.get(),
1010  master_image.get_raw_image_handle(),
1011  data, size));
1012  if (err) {
1013  throw err;
1014  }
1015  }
1016 
1017  inline void Context::add_XMP_metadata(const ImageHandle& master_image,
1018  const void* data, int size) {
1019  Error err = Error(heif_context_add_XMP_metadata(m_context.get(),
1020  master_image.get_raw_image_handle(),
1021  data, size));
1022  if (err) {
1023  throw err;
1024  }
1025  }
1026 }
1027 
1028 
1029 #endif
Definition: heif_cxx.h:119
EncodingOptions()
Definition: heif_cxx.h:947
Definition: heif_cxx.h:90
virtual ~Reader()
Definition: heif_cxx.h:92
virtual heif_reader_grow_status wait_for_file_size(int64_t target_size)=0
virtual int read(void *data, size_t size)=0
virtual int64_t get_position() const =0
virtual int seek(int64_t position)=0
Definition: heif_cxx.h:78
Definition: heif_cxx.h:150
virtual ~Writer()
Definition: heif_cxx.h:152
virtual heif_error write(const void *data, size_t size)=0
Definition: heif_cxx.h:74
void write_to_file(std::string filename) const
Definition: heif_cxx.h:520
void read_from_memory(const void *mem, size_t size, const ReadingOptions &opts=ReadingOptions())
Definition: heif_cxx.h:388
heif_item_id get_primary_image_ID() const
Definition: heif_cxx.h:457
void read_from_memory_without_copy(const void *mem, size_t size, const ReadingOptions &opts=ReadingOptions())
Definition: heif_cxx.h:395
void assign_thumbnail(const ImageHandle &thumbnail_image, const ImageHandle &master_image)
Definition: heif_cxx.h:997
ImageHandle get_primary_image_handle() const
Definition: heif_cxx.h:466
void set_primary_image(ImageHandle &new_primary_image_handle)
Definition: heif_cxx.h:938
void read_from_file(std::string filename, const ReadingOptions &opts=ReadingOptions())
Definition: heif_cxx.h:381
int get_number_of_top_level_images() const noexcept
Definition: heif_cxx.h:442
ImageHandle encode_image(const Image &img, Encoder &encoder, const EncodingOptions &options=EncodingOptions())
Definition: heif_cxx.h:958
friend struct ::heif_error heif_writer_trampoline_write(struct heif_context *ctx, const void *data, size_t size, void *userdata)
Definition: heif_cxx.h:494
ImageHandle get_image_handle(heif_item_id id) const
Definition: heif_cxx.h:476
bool is_top_level_image_ID(heif_item_id id) const noexcept
Definition: heif_cxx.h:446
void read_from_reader(Reader &, const ReadingOptions &opts=ReadingOptions())
Definition: heif_cxx.h:433
void write(Writer &)
Definition: heif_cxx.h:513
std::vector< heif_item_id > get_list_of_top_level_image_IDs() const noexcept
Definition: heif_cxx.h:450
Context()
Definition: heif_cxx.h:375
void add_XMP_metadata(const ImageHandle &master_image, const void *data, int size)
Definition: heif_cxx.h:1017
ImageHandle encode_thumbnail(const Image &image, const ImageHandle &master_image, Encoder &encoder, const EncodingOptions &, int bbox_size)
Definition: heif_cxx.h:975
void add_exif_metadata(const ImageHandle &master_image, const void *data, int size)
Definition: heif_cxx.h:1007
Definition: heif_cxx.h:281
static std::vector< EncoderDescriptor > get_encoder_descriptors(enum heif_compression_format format_filter, const char *name_filter) noexcept
Definition: heif_cxx.h:709
Encoder get_encoder() const
Definition: heif_cxx.h:760
bool supportes_lossless_compression() const noexcept
Definition: heif_cxx.h:756
enum heif_compression_format get_compression_format() const noexcept
Definition: heif_cxx.h:748
bool supportes_lossy_compression() const noexcept
Definition: heif_cxx.h:752
std::string get_name() const noexcept
Definition: heif_cxx.h:740
std::string get_id_name() const noexcept
Definition: heif_cxx.h:744
Definition: heif_cxx.h:311
std::vector< std::string > get_valid_string_values() const
Definition: heif_cxx.h:826
bool is_boolean() const noexcept
Definition: heif_cxx.h:818
std::string get_name() const noexcept
Definition: heif_cxx.h:794
bool is_string() const noexcept
Definition: heif_cxx.h:822
bool is_integer() const noexcept
Definition: heif_cxx.h:802
enum heif_encoder_parameter_type get_type() const noexcept
Definition: heif_cxx.h:798
bool get_valid_integer_range(int &out_minimum, int &out_maximum)
Definition: heif_cxx.h:806
Definition: heif_cxx.h:336
std::vector< EncoderParameter > list_parameters() const noexcept
Definition: heif_cxx.h:842
bool get_boolean_parameter(std::string parameter_name) const
Definition: heif_cxx.h:892
void set_integer_parameter(std::string parameter_name, int value)
Definition: heif_cxx.h:869
void set_lossless(bool enable_lossless)
Definition: heif_cxx.h:862
void set_parameter(std::string parameter_name, std::string parameter_value)
Definition: heif_cxx.h:919
void set_lossy_quality(int quality)
Definition: heif_cxx.h:855
std::string get_string_parameter(std::string parameter_name) const
Definition: heif_cxx.h:908
void set_boolean_parameter(std::string parameter_name, bool value)
Definition: heif_cxx.h:885
Encoder(enum heif_compression_format format)
Definition: heif_cxx.h:771
void set_string_parameter(std::string parameter_name, std::string value)
Definition: heif_cxx.h:901
std::string get_parameter(std::string parameter_name) const
Definition: heif_cxx.h:927
int get_integer_parameter(std::string parameter_name) const
Definition: heif_cxx.h:876
Definition: error.h:75
heif_error_code get_code() const
Definition: heif_cxx.h:52
heif_suberror_code get_subcode() const
Definition: heif_cxx.h:54
std::string get_message() const
Definition: heif_cxx.h:50
Error()
Definition: heif_cxx.h:38
Error(const heif_error &err)
Definition: heif_cxx.h:44
Definition: heif_cxx.h:219
Definition: heif_cxx.h:177
heif_image_handle * get_raw_image_handle() noexcept
Definition: heif_cxx.h:226
std::string get_metadata_type(heif_item_id metadata_id) const noexcept
Definition: heif_cxx.h:607
ImageHandle()
Definition: heif_cxx.h:179
bool is_primary_image() const noexcept
Definition: heif_cxx.h:536
std::string get_metadata_content_type(heif_item_id metadata_id) const noexcept
Definition: heif_cxx.h:611
const heif_image_handle * get_raw_image_handle() const noexcept
Definition: heif_cxx.h:227
int get_number_of_thumbnails() const noexcept
Definition: heif_cxx.h:558
Image decode_image(heif_colorspace colorspace, heif_chroma chroma, const DecodingOptions &options=DecodingOptions())
Definition: heif_cxx.h:579
ImageHandle get_thumbnail(heif_item_id id)
Definition: heif_cxx.h:569
bool has_alpha_channel() const noexcept
Definition: heif_cxx.h:548
int get_height() const noexcept
Definition: heif_cxx.h:544
std::vector< heif_item_id > get_list_of_metadata_block_IDs(const char *type_filter=nullptr) const noexcept
Definition: heif_cxx.h:595
std::vector< heif_item_id > get_list_of_thumbnail_IDs() const noexcept
Definition: heif_cxx.h:562
bool empty() const noexcept
Definition: heif_cxx.h:183
std::vector< uint8_t > get_metadata(heif_item_id) const
Definition: heif_cxx.h:615
int get_width() const noexcept
Definition: heif_cxx.h:540
Definition: heif_cxx.h:266
Definition: heif_cxx.h:235
int get_height(enum heif_channel channel) const noexcept
Definition: heif_cxx.h:674
bool has_channel(enum heif_channel channel) const noexcept
Definition: heif_cxx.h:682
void add_plane(enum heif_channel channel, int width, int height, int bit_depth)
Definition: heif_cxx.h:654
void create(int width, int height, enum heif_colorspace colorspace, enum heif_chroma chroma)
Definition: heif_cxx.h:639
const uint8_t * get_plane(enum heif_channel channel, int *out_stride) const noexcept
Definition: heif_cxx.h:686
Image()
Definition: heif_cxx.h:237
heif_chroma get_chroma_format() const noexcept
Definition: heif_cxx.h:666
heif_colorspace get_colorspace() const noexcept
Definition: heif_cxx.h:662
int get_width(enum heif_channel channel) const noexcept
Definition: heif_cxx.h:670
int get_bits_per_pixel(enum heif_channel channel) const noexcept
Definition: heif_cxx.h:678
Image scale_image(int width, int height, const ScalingOptions &options=ScalingOptions()) const
Definition: heif_cxx.h:694
LIBHEIF_API int heif_context_get_encoder_descriptors(struct heif_context *, enum heif_compression_format format_filter, const char *name_filter, const struct heif_encoder_descriptor **out_encoders, int count)
LIBHEIF_API struct heif_error heif_encoder_set_parameter_string(struct heif_encoder *, const char *parameter_name, const char *value)
LIBHEIF_API struct heif_error heif_context_read_from_memory_without_copy(struct heif_context *, const void *mem, size_t size, const struct heif_reading_options *)
LIBHEIF_API struct heif_error heif_image_handle_get_thumbnail(const struct heif_image_handle *main_image_handle, heif_item_id thumbnail_id, struct heif_image_handle **out_thumbnail_handle)
LIBHEIF_API size_t heif_image_handle_get_metadata_size(const struct heif_image_handle *handle, heif_item_id metadata_id)
LIBHEIF_API struct heif_error heif_context_get_primary_image_ID(struct heif_context *ctx, heif_item_id *id)
LIBHEIF_API struct heif_error heif_context_write(struct heif_context *, struct heif_writer *writer, void *userdata)
LIBHEIF_API int heif_context_is_top_level_image_ID(struct heif_context *ctx, heif_item_id id)
LIBHEIF_API struct heif_error heif_context_get_encoder(struct heif_context *context, const struct heif_encoder_descriptor *, struct heif_encoder **out_encoder)
LIBHEIF_API struct heif_error heif_context_get_primary_image_handle(struct heif_context *ctx, struct heif_image_handle **)
heif_channel
Definition: heif.h:748
LIBHEIF_API uint8_t * heif_image_get_plane(struct heif_image *, enum heif_channel channel, int *out_stride)
heif_colorspace
Definition: heif.h:741
heif_chroma
Definition: heif.h:722
LIBHEIF_API struct heif_error heif_encoder_get_parameter_string(struct heif_encoder *, const char *parameter_name, char *value, int value_size)
LIBHEIF_API const uint8_t * heif_image_get_plane_readonly(const struct heif_image *, enum heif_channel channel, int *out_stride)
LIBHEIF_API int heif_image_handle_get_list_of_thumbnail_IDs(const struct heif_image_handle *handle, heif_item_id *ids, int count)
LIBHEIF_API struct heif_error heif_encoder_get_parameter_integer(struct heif_encoder *, const char *parameter_name, int *value)
LIBHEIF_API struct heif_error heif_context_encode_thumbnail(struct heif_context *, const struct heif_image *image, const struct heif_image_handle *master_image_handle, struct heif_encoder *encoder, const struct heif_encoding_options *options, int bbox_size, struct heif_image_handle **out_thumb_image_handle)
LIBHEIF_API struct heif_error heif_encoder_set_parameter(struct heif_encoder *, const char *parameter_name, const char *value)
LIBHEIF_API struct heif_error heif_context_read_from_reader(struct heif_context *, const struct heif_reader *reader, void *userdata, const struct heif_reading_options *)
LIBHEIF_API void heif_context_free(struct heif_context *)
LIBHEIF_API int heif_image_handle_get_width(const struct heif_image_handle *handle)
LIBHEIF_API struct heif_error heif_context_add_exif_metadata(struct heif_context *, const struct heif_image_handle *image_handle, const void *data, int size)
LIBHEIF_API struct heif_error heif_context_add_XMP_metadata(struct heif_context *, const struct heif_image_handle *image_handle, const void *data, int size)
LIBHEIF_API enum heif_colorspace heif_image_get_colorspace(const struct heif_image *)
LIBHEIF_API struct heif_error heif_context_get_image_handle(struct heif_context *ctx, heif_item_id id, struct heif_image_handle **)
heif_suberror_code
Definition: heif.h:124
@ heif_suberror_Unspecified
Definition: heif.h:126
LIBHEIF_API struct heif_error heif_encoder_set_lossless(struct heif_encoder *, int enable)
LIBHEIF_API struct heif_encoding_options * heif_encoding_options_alloc()
LIBHEIF_API int heif_image_handle_get_height(const struct heif_image_handle *handle)
LIBHEIF_API int heif_image_get_bits_per_pixel(const struct heif_image *, enum heif_channel channel)
LIBHEIF_API struct heif_error heif_context_read_from_file(struct heif_context *, const char *filename, const struct heif_reading_options *)
LIBHEIF_API int heif_encoder_descriptor_supportes_lossy_compression(const struct heif_encoder_descriptor *)
LIBHEIF_API enum heif_encoder_parameter_type heif_encoder_parameter_get_type(const struct heif_encoder_parameter *)
heif_error_code
Definition: heif.h:91
@ heif_error_Ok
Definition: heif.h:93
LIBHEIF_API const char * heif_encoder_descriptor_get_name(const struct heif_encoder_descriptor *)
heif_compression_format
Definition: heif.h:715
LIBHEIF_API int heif_image_get_height(const struct heif_image *, enum heif_channel channel)
LIBHEIF_API struct heif_error heif_encoder_get_parameter(struct heif_encoder *, const char *parameter_name, char *value_ptr, int value_size)
LIBHEIF_API struct heif_error heif_encoder_parameter_get_valid_string_values(const struct heif_encoder_parameter *, const char *const **out_stringarray)
LIBHEIF_API struct heif_error heif_encoder_set_lossy_quality(struct heif_encoder *, int quality)
LIBHEIF_API int heif_image_has_channel(const struct heif_image *, enum heif_channel channel)
LIBHEIF_API const char * heif_encoder_parameter_get_name(const struct heif_encoder_parameter *)
uint32_t heif_item_id
Definition: heif.h:276
LIBHEIF_API struct heif_error heif_context_set_primary_image(struct heif_context *, struct heif_image_handle *image_handle)
heif_reader_grow_status
Definition: heif.h:349
LIBHEIF_API struct heif_context * heif_context_alloc(void)
LIBHEIF_API int heif_encoder_descriptor_supportes_lossless_compression(const struct heif_encoder_descriptor *)
LIBHEIF_API struct heif_error heif_encoder_get_parameter_boolean(struct heif_encoder *, const char *parameter_name, int *value)
LIBHEIF_API int heif_context_get_list_of_top_level_image_IDs(struct heif_context *ctx, heif_item_id *ID_array, int count)
LIBHEIF_API const char * heif_encoder_descriptor_get_id_name(const struct heif_encoder_descriptor *)
LIBHEIF_API struct heif_error heif_image_scale_image(const struct heif_image *input, struct heif_image **output, int width, int height, const struct heif_scaling_options *options)
LIBHEIF_API int heif_image_handle_has_alpha_channel(const struct heif_image_handle *)
LIBHEIF_API struct heif_error heif_image_create(int width, int height, enum heif_colorspace colorspace, enum heif_chroma chroma, struct heif_image **out_image)
LIBHEIF_API int heif_image_handle_get_list_of_metadata_block_IDs(const struct heif_image_handle *handle, const char *type_filter, heif_item_id *ids, int count)
LIBHEIF_API int heif_context_get_number_of_top_level_images(struct heif_context *ctx)
LIBHEIF_API struct heif_error heif_encoder_set_parameter_integer(struct heif_encoder *, const char *parameter_name, int value)
LIBHEIF_API void heif_encoder_release(struct heif_encoder *)
LIBHEIF_API int heif_image_handle_get_number_of_metadata_blocks(const struct heif_image_handle *handle, const char *type_filter)
LIBHEIF_API struct heif_error heif_encoder_parameter_get_valid_integer_range(const struct heif_encoder_parameter *, int *have_minimum_maximum, int *minimum, int *maximum)
LIBHEIF_API const char * heif_image_handle_get_metadata_type(const struct heif_image_handle *handle, heif_item_id metadata_id)
LIBHEIF_API struct heif_error heif_context_get_encoder_for_format(struct heif_context *context, enum heif_compression_format format, struct heif_encoder **)
LIBHEIF_API struct heif_error heif_encoder_set_parameter_boolean(struct heif_encoder *, const char *parameter_name, int value)
LIBHEIF_API const struct heif_encoder_parameter *const * heif_encoder_list_parameters(struct heif_encoder *)
LIBHEIF_API int heif_image_handle_is_primary_image(const struct heif_image_handle *handle)
LIBHEIF_API enum heif_chroma heif_image_get_chroma_format(const struct heif_image *)
LIBHEIF_API struct heif_error heif_image_handle_get_metadata(const struct heif_image_handle *handle, heif_item_id metadata_id, void *out_data)
LIBHEIF_API void heif_encoding_options_free(struct heif_encoding_options *)
LIBHEIF_API void heif_image_release(const struct heif_image *)
LIBHEIF_API struct heif_error heif_context_encode_image(struct heif_context *, const struct heif_image *image, struct heif_encoder *encoder, const struct heif_encoding_options *options, struct heif_image_handle **out_image_handle)
LIBHEIF_API struct heif_error heif_context_write_to_file(struct heif_context *, const char *filename)
LIBHEIF_API enum heif_compression_format heif_encoder_descriptor_get_compression_format(const struct heif_encoder_descriptor *)
LIBHEIF_API int heif_image_get_width(const struct heif_image *, enum heif_channel channel)
LIBHEIF_API int heif_image_handle_get_number_of_thumbnails(const struct heif_image_handle *handle)
LIBHEIF_API struct heif_error heif_context_assign_thumbnail(struct heif_context *, const struct heif_image_handle *master_image, const struct heif_image_handle *thumbnail_image)
LIBHEIF_API void heif_image_handle_release(const struct heif_image_handle *)
LIBHEIF_API const char * heif_image_handle_get_metadata_content_type(const struct heif_image_handle *handle, heif_item_id metadata_id)
LIBHEIF_API struct heif_error heif_context_read_from_memory(struct heif_context *, const void *mem, size_t size, const struct heif_reading_options *)
heif_encoder_parameter_type
Definition: heif.h:1030
@ heif_encoder_parameter_type_boolean
Definition: heif.h:1032
@ heif_encoder_parameter_type_integer
Definition: heif.h:1031
@ heif_encoder_parameter_type_string
Definition: heif.h:1033
LIBHEIF_API struct heif_error heif_image_add_plane(struct heif_image *image, enum heif_channel channel, int width, int height, int bit_depth)
LIBHEIF_API struct heif_error heif_decode_image(const struct heif_image_handle *in_handle, struct heif_image **out_img, enum heif_colorspace colorspace, enum heif_chroma chroma, const struct heif_decoding_options *options)
qulonglong value
Definition: itemviewutilities.cpp:592
@ Image
Definition: coredbconstants.h:98
Definition: bitstream.h:41
int heif_reader_trampoline_read(void *data, size_t size, void *userdata)
Definition: heif_cxx.h:408
int heif_reader_trampoline_seek(int64_t position, void *userdata)
Definition: heif_cxx.h:413
int64_t heif_reader_trampoline_get_position(void *userdata)
Definition: heif_cxx.h:403
struct ::heif_error heif_writer_trampoline_write(struct heif_context *ctx, const void *data, size_t size, void *userdata)
Definition: heif_cxx.h:494
heif_reader_grow_status heif_reader_trampoline_wait_for_file_size(int64_t target_size, void *userdata)
Definition: heif_cxx.h:418
Definition: heif_api_structs.h:45
Definition: heif_plugin_registry.h:37
Definition: heif_plugin.h:208
Definition: heif_api_structs.h:51
Definition: heif.h:1121
Definition: heif.h:264
const char * message
Definition: heif.h:272
enum heif_suberror_code subcode
Definition: heif.h:269
enum heif_error_code code
Definition: heif.h:266
Definition: heif_api_structs.h:30
std::shared_ptr< heif::HeifContext::Image > image
Definition: heif_api_structs.h:31
std::shared_ptr< heif::HeifContext > context
Definition: heif_api_structs.h:34
Definition: heif_api_structs.h:39
Definition: heif.h:355
Definition: heif.h:899
Definition: scan.h:26