/src/libheif/libheif/sequences/chunk.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * HEIF image base codec. |
3 | | * Copyright (c) 2024 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 LIBHEIF_CHUNK_H |
22 | | #define LIBHEIF_CHUNK_H |
23 | | |
24 | | #include "codecs/decoder.h" |
25 | | #include <memory> |
26 | | #include <vector> |
27 | | |
28 | | |
29 | | class HeifContext; |
30 | | |
31 | | class Box_VisualSampleEntry; |
32 | | |
33 | | |
34 | | class Chunk |
35 | | { |
36 | | public: |
37 | | Chunk(HeifContext* ctx, uint32_t track_id, heif_compression_format format); |
38 | | |
39 | | Chunk(HeifContext* ctx, uint32_t track_id, std::shared_ptr<const Box> sample_description_box, |
40 | | uint32_t first_sample, uint32_t num_samples, uint64_t file_offset, const std::shared_ptr<const Box_stsz>& sample_sizes); |
41 | | |
42 | 0 | virtual ~Chunk() = default; |
43 | | |
44 | 0 | heif_compression_format get_compression_format() const { return m_compression_format; } |
45 | | |
46 | 0 | virtual std::shared_ptr<class Decoder> get_decoder() const { return m_decoder; } |
47 | | |
48 | 0 | virtual std::shared_ptr<class Encoder> get_encoder() const { return m_encoder; } |
49 | | |
50 | 0 | uint32_t first_sample_number() const { return m_first_sample; } |
51 | | |
52 | 0 | uint32_t last_sample_number() const { return m_last_sample; } |
53 | | |
54 | | DataExtent get_data_extent_for_sample(uint32_t n) const; |
55 | | |
56 | | private: |
57 | | HeifContext* m_ctx = nullptr; |
58 | | uint32_t m_track_id = 0; |
59 | | |
60 | | heif_compression_format m_compression_format = heif_compression_undefined; |
61 | | |
62 | | uint32_t m_first_sample = 0; |
63 | | uint32_t m_last_sample = 0; |
64 | | |
65 | | //uint32_t m_sample_description_index = 0; |
66 | | |
67 | | uint32_t m_next_sample_to_be_decoded = 0; |
68 | | |
69 | | struct SampleFileRange |
70 | | { |
71 | | uint64_t offset = 0; |
72 | | uint32_t size = 0; |
73 | | }; |
74 | | |
75 | | std::vector<SampleFileRange> m_sample_ranges; |
76 | | |
77 | | std::shared_ptr<class Decoder> m_decoder; |
78 | | std::shared_ptr<class Encoder> m_encoder; |
79 | | }; |
80 | | |
81 | | |
82 | | #endif //LIBHEIF_CHUNK_H |