Expose bitDepth to MediaMetadataRetriever
Bug: b/217378477
Test:
Change-Id: I16dabdf9aaabf341a9cebb1624e464155196a5a8
diff --git a/media/libheif/HeifDecoderImpl.cpp b/media/libheif/HeifDecoderImpl.cpp
index 041b427..923f5c1 100644
--- a/media/libheif/HeifDecoderImpl.cpp
+++ b/media/libheif/HeifDecoderImpl.cpp
@@ -47,6 +47,7 @@
info->mRotationAngle = videoFrame->mRotationAngle;
info->mBytesPerPixel = videoFrame->mBytesPerPixel;
info->mDurationUs = videoFrame->mDurationUs;
+ info->mBitDepth = videoFrame->mBitDepth;
if (videoFrame->mIccSize > 0) {
info->mIccData.assign(
videoFrame->getFlattenedIccData(),
@@ -377,13 +378,14 @@
// issue (e.g. by copying).
VideoFrame* videoFrame = static_cast<VideoFrame*>(sharedMem->unsecurePointer());
- ALOGV("Image dimension %dx%d, display %dx%d, angle %d, iccSize %d",
+ ALOGV("Image dimension %dx%d, display %dx%d, angle %d, iccSize %d, bitDepth %d",
videoFrame->mWidth,
videoFrame->mHeight,
videoFrame->mDisplayWidth,
videoFrame->mDisplayHeight,
videoFrame->mRotationAngle,
- videoFrame->mIccSize);
+ videoFrame->mIccSize,
+ videoFrame->mBitDepth);
initFrameInfo(&mImageInfo, videoFrame);
@@ -729,4 +731,13 @@
return (mCurScanline > oldScanline) ? (mCurScanline - oldScanline) : 0;
}
+uint32_t HeifDecoderImpl::getColorDepth() {
+ HeifFrameInfo* info = &mImageInfo;
+ if (info != nullptr) {
+ return mImageInfo.mBitDepth;
+ } else {
+ return 0;
+ }
+}
+
} // namespace android