diff --git a/libheif/codecs/hevc.cc b/libheif/codecs/hevc.cc index f0f7b89a99..3de4637cb6 100644 --- a/libheif/codecs/hevc.cc +++ b/libheif/codecs/hevc.cc @@ -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(id); - assert(hvcC_box); -#if 0 + auto hvcC_box = get_file()->get_property(get_id()); if (!hvcC_box) { return Error{heif_error_Invalid_input, heif_suberror_No_hvcC_box}; } -#endif m_decoder = std::make_shared(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; } diff --git a/libheif/codecs/hevc.h b/libheif/codecs/hevc.h index 0cfe2dc22e..c389e13734 100644 --- a/libheif/codecs/hevc.h +++ b/libheif/codecs/hevc.h @@ -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) {} @@ -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;