From 3028596afc8d2374ab220725c3fd2774e4e86557 Mon Sep 17 00:00:00 2001 From: chen0088 Date: Tue, 26 Apr 2022 20:07:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?YUV=E6=8B=8D=E7=85=A7=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chen0088 --- .../src/dstream_operator/dstream_operator.cpp | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp index ff6b8783..8bef3f55 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp @@ -601,10 +601,13 @@ void DStreamOperator::ConvertStreamInfo(std::shared_ptr &srcInfo, st dstInfo->dataspace_ = srcInfo->datasapce_; dstInfo->encodeType_ = (DCEncodeType)srcInfo->encodeType_; - if ((srcInfo->intent_ == STILL_CAPTURE) || (srcInfo->intent_ == POST_VIEW) || - (dstInfo->encodeType_ == ENCODE_TYPE_JPEG)) { + if ((srcInfo->intent_ == STILL_CAPTURE) || (srcInfo->intent_ == POST_VIEW)) { dstInfo->type_ = DCStreamType::SNAPSHOT_FRAME; - dstInfo->format_ = OHOS_CAMERA_FORMAT_JPEG; + if (dstInfo->encodeType_ == ENCODE_TYPE_JPEG) { + dstInfo->format_ = OHOS_CAMERA_FORMAT_JPEG; + } else if (dstInfo->encodeType_ == ENCODE_TYPE_NULL){ + dstInfo->format_ = OHOS_CAMERA_FORMAT_YCRCB_420_SP; + } } else { dstInfo->type_ = DCStreamType::CONTINUOUS_FRAME; dstInfo->format_ = @@ -706,7 +709,11 @@ void DStreamOperator::ChooseSuitableFormat(std::vector 0) { captureInfo->format_ = dcSupportedFormatMap_[DCSceneType::PHOTO].at(0); } else { - captureInfo->format_ = OHOS_CAMERA_FORMAT_JPEG; + if ((streamInfo.at(0))->encodeType_ == DCEncodeType::ENCODE_TYPE_JPEG) { + captureInfo->format_ = OHOS_CAMERA_FORMAT_JPEG; + } else { + captureInfo->format_ = OHOS_CAMERA_FORMAT_YCRCB_420_SP; + } } } } @@ -760,7 +767,11 @@ void DStreamOperator::ChooseSuitableEncodeType(std::vectorencodeType_ = DCEncodeType::ENCODE_TYPE_NULL; } } else { - captureInfo->encodeType_ = DCEncodeType::ENCODE_TYPE_JPEG; + if ((streamInfo.at(0))->encodeType_ == DCEncodeType::ENCODE_TYPE_JPEG) { + captureInfo->encodeType_ = DCEncodeType::ENCODE_TYPE_JPEG; + } else { + captureInfo->encodeType_ = DCEncodeType::ENCODE_TYPE_NULL; + } } } -- Gitee From fdae577c0ca77efaed1b3bb05e4cc6576f3c559b Mon Sep 17 00:00:00 2001 From: chen0088 Date: Tue, 26 Apr 2022 20:14:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?YUV=E6=8B=8D=E7=85=A7=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chen0088 --- camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp index 8bef3f55..fb0e2d9a 100644 --- a/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp +++ b/camera_hdf/hdi_impl/src/dstream_operator/dstream_operator.cpp @@ -605,7 +605,7 @@ void DStreamOperator::ConvertStreamInfo(std::shared_ptr &srcInfo, st dstInfo->type_ = DCStreamType::SNAPSHOT_FRAME; if (dstInfo->encodeType_ == ENCODE_TYPE_JPEG) { dstInfo->format_ = OHOS_CAMERA_FORMAT_JPEG; - } else if (dstInfo->encodeType_ == ENCODE_TYPE_NULL){ + } else if (dstInfo->encodeType_ == ENCODE_TYPE_NULL) { dstInfo->format_ = OHOS_CAMERA_FORMAT_YCRCB_420_SP; } } else { -- Gitee