Merge "camera: allow to get size of JPEG after conversion"
am: 3664a25aa7
Change-Id: I4acc12c67e8f446dcc8ab6e9f585b77bd3ab0d70
This commit is contained in:
commit
18033cb5d5
1 changed files with 5 additions and 0 deletions
|
@ -85,6 +85,8 @@ size_t ImageProcessor::GetConvertedSize(int fourcc, uint32_t width,
|
|||
case V4L2_PIX_FMT_BGR32:
|
||||
case V4L2_PIX_FMT_RGB32:
|
||||
return width * height * 4;
|
||||
case V4L2_PIX_FMT_JPEG:
|
||||
return 0; // For JPEG real size will be calculated after conversion.
|
||||
default:
|
||||
LOGF(ERROR) << "Pixel format " << FormatToString(fourcc)
|
||||
<< " is unsupported.";
|
||||
|
@ -388,6 +390,9 @@ static bool ConvertToJpeg(const CameraMetadata& metadata,
|
|||
return false;
|
||||
}
|
||||
size_t buffer_length = compressor.GetCompressedImageSize();
|
||||
if (out_frame->SetDataSize(buffer_length)) {
|
||||
return false;
|
||||
}
|
||||
memcpy(out_frame->GetData(), compressor.GetCompressedImagePtr(),
|
||||
buffer_length);
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue