Skip to content

Commit

Permalink
initialize Decoder in ImageItem::on_load_file()
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 1, 2024
1 parent 957093a commit 9d891b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 5 additions & 7 deletions libheif/codecs/hevc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -640,24 +640,22 @@ Error parse_sps_for_hvcC_configuration(const uint8_t* sps, size_t size,



ImageItem_HEVC::ImageItem_HEVC(HeifContext* ctx, heif_item_id id)
: ImageItem(ctx, id)
Error ImageItem_HEVC::on_load_file()
{
auto hvcC_box = ctx->get_heif_file()->get_property<Box_hvcC>(id);
assert(hvcC_box);
#if 0
auto hvcC_box = get_file()->get_property<Box_hvcC>(get_id());
if (!hvcC_box) {
return Error{heif_error_Invalid_input,
heif_suberror_No_hvcC_box};
}
#endif

m_decoder = std::make_shared<Decoder_HEVC>(hvcC_box);

DataExtent extent;
extent.set_from_image_item(ctx->get_heif_file().get(), id);
extent.set_from_image_item(get_context()->get_heif_file().get(), get_id());

m_decoder->set_data_extent(extent);

return Error::Ok;
}


Expand Down
4 changes: 3 additions & 1 deletion libheif/codecs/hevc.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Error parse_sps_for_hvcC_configuration(const uint8_t* sps, size_t size,
class ImageItem_HEVC : public ImageItem
{
public:
ImageItem_HEVC(HeifContext* ctx, heif_item_id id);
ImageItem_HEVC(HeifContext* ctx, heif_item_id id) : ImageItem(ctx, id) {}

ImageItem_HEVC(HeifContext* ctx) : ImageItem(ctx) {}

Expand All @@ -137,6 +137,8 @@ class ImageItem_HEVC : public ImageItem

heif_compression_format get_compression_format() const override { return heif_compression_HEVC; }

Error on_load_file() override;

int get_luma_bits_per_pixel() const override;

int get_chroma_bits_per_pixel() const override;
Expand Down

0 comments on commit 9d891b8

Please sign in to comment.