heif: cache the entire stream if possible to support seek

Also, reuse decoding result if decode is called again. Currently
decode only retrieves primary picture, so there is no point to
go to metadata retriever again.

Bug: 64077740

Change-Id: I9243de396957f4d717c386bbaa8692494d624998
diff --git a/media/libheif/HeifDecoderImpl.h b/media/libheif/HeifDecoderImpl.h
index 2f8f0f8..c2e4ff3 100644
--- a/media/libheif/HeifDecoderImpl.h
+++ b/media/libheif/HeifDecoderImpl.h
@@ -54,6 +54,7 @@
     sp<IMemory> mFrameMemory;
     android_pixel_format_t mOutputColor;
     size_t mCurScanline;
+    bool mFrameDecoded;
 };
 
 } // namespace android