From 95ff728a1d8b1dad817a85c1f7015eec28804676 Mon Sep 17 00:00:00 2001 From: yangfan Date: Tue, 23 Jan 2024 16:37:26 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0CheckEncodedFormat?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E8=BF=94=E5=9B=9E=E9=9D=9EERR=5FIMAGE=5FSOUR?= =?UTF-8?q?CE=5FDATA=5FINCOMPLETE=E7=BB=93=E6=9E=9C=E7=9A=84=E5=85=9C?= =?UTF-8?q?=E5=BA=95=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangfan Change-Id: If2c98af69741820480c5975a3c5e810601c82c60 --- frameworks/innerkitsimpl/codec/src/image_source.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frameworks/innerkitsimpl/codec/src/image_source.cpp b/frameworks/innerkitsimpl/codec/src/image_source.cpp index 059937709..0da9447b2 100644 --- a/frameworks/innerkitsimpl/codec/src/image_source.cpp +++ b/frameworks/innerkitsimpl/codec/src/image_source.cpp @@ -1288,6 +1288,8 @@ uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) return SUCCESS; } else if (result == ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { streamIncomplete = true; + } else { + return result; // unsuccess result,direct return } } -- Gitee From 7a560e2fcf7bb29fe14bfeacd8ceeadb3e34e5a4 Mon Sep 17 00:00:00 2001 From: yangfan Date: Tue, 23 Jan 2024 16:56:57 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=86=97=E4=BD=99?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangfan Change-Id: Iee8b70166f6d255e198730ab229116c856bf48e4 --- .../innerkitsimpl/codec/src/image_source.cpp | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/frameworks/innerkitsimpl/codec/src/image_source.cpp b/frameworks/innerkitsimpl/codec/src/image_source.cpp index 0da9447b2..b7c6fa4d9 100644 --- a/frameworks/innerkitsimpl/codec/src/image_source.cpp +++ b/frameworks/innerkitsimpl/codec/src/image_source.cpp @@ -1252,20 +1252,29 @@ uint32_t ImageSource::GetFormatExtended(string &format) uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) { - bool streamIncomplete = false; + // bool streamIncomplete = false; auto hintIter = formatAgentMap_.end(); if (!formatHint.empty()) { uint32_t ret = CheckFormatHint(formatHint, hintIter); - if (ret == ERR_IMAGE_SOURCE_DATA) { - HiLog::Error(LABEL, "[ImageSource]image source data error."); - return ret; - } else if (ret == SUCCESS) { + // if (ret == ERR_IMAGE_SOURCE_DATA) { + // HiLog::Error(LABEL, "[ImageSource]image source data error."); + // return ret; + // } else if (ret == SUCCESS) { + // format = hintIter->first; + // HiLog::Debug(LABEL, "[ImageSource]check input image format success, format:%{public}s.", format.c_str()); + // return SUCCESS; + // } else if (ret == ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { + // streamIncomplete = true; + // HiLog::Error(LABEL, "[ImageSource]image source data error ERR_IMAGE_SOURCE_DATA_INCOMPLETE."); + // } + + if (ret == SUCCESS) { format = hintIter->first; HiLog::Debug(LABEL, "[ImageSource]check input image format success, format:%{public}s.", format.c_str()); return SUCCESS; - } else if (ret == ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { - streamIncomplete = true; - HiLog::Error(LABEL, "[ImageSource]image source data error ERR_IMAGE_SOURCE_DATA_INCOMPLETE."); + } else { + HiLog::Error(LABEL, "[ImageSource]image source checkFormatHint error, type: %{public}d",ret); + return ret; } } @@ -1286,17 +1295,16 @@ uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) HiLog::Info(LABEL, "[ImageSource]GetEncodedFormat success format :%{public}s.", iter->first.c_str()); format = iter->first; return SUCCESS; - } else if (result == ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { - streamIncomplete = true; } else { + HiLog::Error(LABEL, "[ImageSource]image source checkEncodedFormat error, type: %{public}d",result); return result; // unsuccess result,direct return } } - if (streamIncomplete) { - HiLog::Error(LABEL, "[ImageSource]image source incomplete."); - return ERR_IMAGE_SOURCE_DATA_INCOMPLETE; - } + // if (streamIncomplete) { + // HiLog::Error(LABEL, "[ImageSource]image source incomplete."); + // return ERR_IMAGE_SOURCE_DATA_INCOMPLETE; + // } // default return raw image format = InnerFormat::RAW_FORMAT; -- Gitee From c92acf1f985357f09cf8b41e6dabfc35acfb0d80 Mon Sep 17 00:00:00 2001 From: yangfan Date: Tue, 23 Jan 2024 16:58:09 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangfan Change-Id: Icbbcdeb0bb0f4fabceb4d02cc8fad216e1a2ef91 --- .../innerkitsimpl/codec/src/image_source.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/frameworks/innerkitsimpl/codec/src/image_source.cpp b/frameworks/innerkitsimpl/codec/src/image_source.cpp index b7c6fa4d9..33832fc64 100644 --- a/frameworks/innerkitsimpl/codec/src/image_source.cpp +++ b/frameworks/innerkitsimpl/codec/src/image_source.cpp @@ -1252,22 +1252,9 @@ uint32_t ImageSource::GetFormatExtended(string &format) uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) { - // bool streamIncomplete = false; auto hintIter = formatAgentMap_.end(); if (!formatHint.empty()) { uint32_t ret = CheckFormatHint(formatHint, hintIter); - // if (ret == ERR_IMAGE_SOURCE_DATA) { - // HiLog::Error(LABEL, "[ImageSource]image source data error."); - // return ret; - // } else if (ret == SUCCESS) { - // format = hintIter->first; - // HiLog::Debug(LABEL, "[ImageSource]check input image format success, format:%{public}s.", format.c_str()); - // return SUCCESS; - // } else if (ret == ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { - // streamIncomplete = true; - // HiLog::Error(LABEL, "[ImageSource]image source data error ERR_IMAGE_SOURCE_DATA_INCOMPLETE."); - // } - if (ret == SUCCESS) { format = hintIter->first; HiLog::Debug(LABEL, "[ImageSource]check input image format success, format:%{public}s.", format.c_str()); @@ -1301,11 +1288,6 @@ uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) } } - // if (streamIncomplete) { - // HiLog::Error(LABEL, "[ImageSource]image source incomplete."); - // return ERR_IMAGE_SOURCE_DATA_INCOMPLETE; - // } - // default return raw image format = InnerFormat::RAW_FORMAT; HiLog::Info(LABEL, "[ImageSource]image default to raw format."); -- Gitee From 08bdf9fd0ac49f3a3f78bd166e9f41f89394fb3f Mon Sep 17 00:00:00 2001 From: yangfan Date: Tue, 23 Jan 2024 17:36:32 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangfan Change-Id: I9aaefde4fe4ad2b9c522ccecfc4b1f1d97d79899 --- frameworks/innerkitsimpl/codec/src/image_source.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/innerkitsimpl/codec/src/image_source.cpp b/frameworks/innerkitsimpl/codec/src/image_source.cpp index 33832fc64..19df67172 100644 --- a/frameworks/innerkitsimpl/codec/src/image_source.cpp +++ b/frameworks/innerkitsimpl/codec/src/image_source.cpp @@ -1260,7 +1260,7 @@ uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) HiLog::Debug(LABEL, "[ImageSource]check input image format success, format:%{public}s.", format.c_str()); return SUCCESS; } else { - HiLog::Error(LABEL, "[ImageSource]image source checkFormatHint error, type: %{public}d",ret); + HiLog::Error(LABEL, "[ImageSource]image source checkFormatHint error, type: %{public}d", ret); return ret; } } @@ -1283,7 +1283,7 @@ uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) format = iter->first; return SUCCESS; } else { - HiLog::Error(LABEL, "[ImageSource]image source checkEncodedFormat error, type: %{public}d",result); + HiLog::Error(LABEL, "[ImageSource]image source checkEncodedFormat error, type: %{public}d", result); return result; // unsuccess result,direct return } } -- Gitee From 59f64b90158cb4cc3b58129e1f5bcfc241cb87bd Mon Sep 17 00:00:00 2001 From: yangfan Date: Tue, 23 Jan 2024 19:51:36 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangfan Change-Id: I6dacd3ece4e7750948db27d4bb3a517a09e17976 --- .../innerkitsimpl/codec/src/image_source.cpp | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/frameworks/innerkitsimpl/codec/src/image_source.cpp b/frameworks/innerkitsimpl/codec/src/image_source.cpp index 19df67172..ede65540d 100644 --- a/frameworks/innerkitsimpl/codec/src/image_source.cpp +++ b/frameworks/innerkitsimpl/codec/src/image_source.cpp @@ -1252,15 +1252,16 @@ uint32_t ImageSource::GetFormatExtended(string &format) uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) { + uint32_t ret; auto hintIter = formatAgentMap_.end(); if (!formatHint.empty()) { - uint32_t ret = CheckFormatHint(formatHint, hintIter); + ret = CheckFormatHint(formatHint, hintIter); if (ret == SUCCESS) { format = hintIter->first; HiLog::Debug(LABEL, "[ImageSource]check input image format success, format:%{public}s.", format.c_str()); return SUCCESS; - } else { - HiLog::Error(LABEL, "[ImageSource]image source checkFormatHint error, type: %{public}d", ret); + } else if (ret != ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { + HiLog::Error(LABEL, "[ImageSource]checkFormatHint error, type: %{public}d", ret); return ret; } } @@ -1275,20 +1276,25 @@ uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) continue; // has been checked before. } AbsImageFormatAgent *agent = iter->second; - auto result = CheckEncodedFormat(*agent); - if (result == ERR_IMAGE_MISMATCHED_FORMAT) { + ret = CheckEncodedFormat(*agent); + if (ret == ERR_IMAGE_MISMATCHED_FORMAT) { continue; } else if (result == SUCCESS) { HiLog::Info(LABEL, "[ImageSource]GetEncodedFormat success format :%{public}s.", iter->first.c_str()); format = iter->first; return SUCCESS; - } else { - HiLog::Error(LABEL, "[ImageSource]image source checkEncodedFormat error, type: %{public}d", result); - return result; // unsuccess result,direct return + } else if (ret != ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { + HiLog::Error(LABEL, "[ImageSource]checkEncodedFormat error, type: %{public}d", ret); + return ret; } } - // default return raw image + if (ret == ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { + HiLog::Error(LABEL, "[ImageSource]image source incomplete."); + return ret; + } + + // default return raw image, ERR_IMAGE_MISMATCHED_FORMAT format = InnerFormat::RAW_FORMAT; HiLog::Info(LABEL, "[ImageSource]image default to raw format."); return SUCCESS; -- Gitee From b86b64a334db253aa8e69d9352ff921aafad23fa Mon Sep 17 00:00:00 2001 From: yangfan Date: Tue, 23 Jan 2024 20:39:20 +0800 Subject: [PATCH 6/7] =?UTF-8?q?GetFormatExtended=E5=86=97=E4=BD=99?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangfan Change-Id: I1bc2ed17589176a4978988a51c6597d43243ba4f --- frameworks/innerkitsimpl/codec/src/image_source.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/frameworks/innerkitsimpl/codec/src/image_source.cpp b/frameworks/innerkitsimpl/codec/src/image_source.cpp index ede65540d..934e00dfd 100644 --- a/frameworks/innerkitsimpl/codec/src/image_source.cpp +++ b/frameworks/innerkitsimpl/codec/src/image_source.cpp @@ -1260,7 +1260,7 @@ uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) format = hintIter->first; HiLog::Debug(LABEL, "[ImageSource]check input image format success, format:%{public}s.", format.c_str()); return SUCCESS; - } else if (ret != ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { + } else { HiLog::Error(LABEL, "[ImageSource]checkFormatHint error, type: %{public}d", ret); return ret; } @@ -1283,18 +1283,13 @@ uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) HiLog::Info(LABEL, "[ImageSource]GetEncodedFormat success format :%{public}s.", iter->first.c_str()); format = iter->first; return SUCCESS; - } else if (ret != ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { + } else { HiLog::Error(LABEL, "[ImageSource]checkEncodedFormat error, type: %{public}d", ret); return ret; } } - if (ret == ERR_IMAGE_SOURCE_DATA_INCOMPLETE) { - HiLog::Error(LABEL, "[ImageSource]image source incomplete."); - return ret; - } - - // default return raw image, ERR_IMAGE_MISMATCHED_FORMAT + // default return raw image, ERR_IMAGE_MISMATCHED_FORMAT case format = InnerFormat::RAW_FORMAT; HiLog::Info(LABEL, "[ImageSource]image default to raw format."); return SUCCESS; -- Gitee From 440ddd3aacaeb2e4eafc08cfe174469340f9c871 Mon Sep 17 00:00:00 2001 From: yangfan Date: Wed, 24 Jan 2024 10:23:10 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E9=97=A8=E7=A6=81=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangfan Change-Id: I8e97e2f9d0ddde7cc7bc36d68eb27083254ae8a7 --- frameworks/innerkitsimpl/codec/src/image_source.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/innerkitsimpl/codec/src/image_source.cpp b/frameworks/innerkitsimpl/codec/src/image_source.cpp index 934e00dfd..8d166d1e4 100644 --- a/frameworks/innerkitsimpl/codec/src/image_source.cpp +++ b/frameworks/innerkitsimpl/codec/src/image_source.cpp @@ -1279,7 +1279,7 @@ uint32_t ImageSource::GetEncodedFormat(const string &formatHint, string &format) ret = CheckEncodedFormat(*agent); if (ret == ERR_IMAGE_MISMATCHED_FORMAT) { continue; - } else if (result == SUCCESS) { + } else if (ret == SUCCESS) { HiLog::Info(LABEL, "[ImageSource]GetEncodedFormat success format :%{public}s.", iter->first.c_str()); format = iter->first; return SUCCESS; -- Gitee