diff --git a/VERSION b/VERSION index ec1cfddcc..bc9c067f2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1463 \ No newline at end of file +1.36.1464 \ No newline at end of file diff --git a/videorecog/CMakeLists.txt b/videorecog/CMakeLists.txt index 976c8148d..705d72532 100644 --- a/videorecog/CMakeLists.txt +++ b/videorecog/CMakeLists.txt @@ -23,6 +23,8 @@ set(videorecog_public_header set(videorecog_public_header_model include/alibabacloud/videorecog/model/DetectVideoShotRequest.h include/alibabacloud/videorecog/model/DetectVideoShotResult.h + include/alibabacloud/videorecog/model/EvaluateVideoQualityRequest.h + include/alibabacloud/videorecog/model/EvaluateVideoQualityResult.h include/alibabacloud/videorecog/model/GenerateVideoCoverRequest.h include/alibabacloud/videorecog/model/GenerateVideoCoverResult.h include/alibabacloud/videorecog/model/GetAsyncJobResultRequest.h @@ -38,6 +40,8 @@ set(videorecog_src src/VideorecogClient.cc src/model/DetectVideoShotRequest.cc src/model/DetectVideoShotResult.cc + src/model/EvaluateVideoQualityRequest.cc + src/model/EvaluateVideoQualityResult.cc src/model/GenerateVideoCoverRequest.cc src/model/GenerateVideoCoverResult.cc src/model/GetAsyncJobResultRequest.cc diff --git a/videorecog/include/alibabacloud/videorecog/VideorecogClient.h b/videorecog/include/alibabacloud/videorecog/VideorecogClient.h index 7e6b7882f..f6d4314b3 100644 --- a/videorecog/include/alibabacloud/videorecog/VideorecogClient.h +++ b/videorecog/include/alibabacloud/videorecog/VideorecogClient.h @@ -24,6 +24,8 @@ #include "VideorecogExport.h" #include "model/DetectVideoShotRequest.h" #include "model/DetectVideoShotResult.h" +#include "model/EvaluateVideoQualityRequest.h" +#include "model/EvaluateVideoQualityResult.h" #include "model/GenerateVideoCoverRequest.h" #include "model/GenerateVideoCoverResult.h" #include "model/GetAsyncJobResultRequest.h" @@ -46,6 +48,9 @@ namespace AlibabaCloud typedef Outcome DetectVideoShotOutcome; typedef std::future DetectVideoShotOutcomeCallable; typedef std::function&)> DetectVideoShotAsyncHandler; + typedef Outcome EvaluateVideoQualityOutcome; + typedef std::future EvaluateVideoQualityOutcomeCallable; + typedef std::function&)> EvaluateVideoQualityAsyncHandler; typedef Outcome GenerateVideoCoverOutcome; typedef std::future GenerateVideoCoverOutcomeCallable; typedef std::function&)> GenerateVideoCoverAsyncHandler; @@ -69,6 +74,9 @@ namespace AlibabaCloud DetectVideoShotOutcome detectVideoShot(const Model::DetectVideoShotRequest &request)const; void detectVideoShotAsync(const Model::DetectVideoShotRequest& request, const DetectVideoShotAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DetectVideoShotOutcomeCallable detectVideoShotCallable(const Model::DetectVideoShotRequest& request) const; + EvaluateVideoQualityOutcome evaluateVideoQuality(const Model::EvaluateVideoQualityRequest &request)const; + void evaluateVideoQualityAsync(const Model::EvaluateVideoQualityRequest& request, const EvaluateVideoQualityAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + EvaluateVideoQualityOutcomeCallable evaluateVideoQualityCallable(const Model::EvaluateVideoQualityRequest& request) const; GenerateVideoCoverOutcome generateVideoCover(const Model::GenerateVideoCoverRequest &request)const; void generateVideoCoverAsync(const Model::GenerateVideoCoverRequest& request, const GenerateVideoCoverAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GenerateVideoCoverOutcomeCallable generateVideoCoverCallable(const Model::GenerateVideoCoverRequest& request) const; diff --git a/videorecog/include/alibabacloud/videorecog/model/EvaluateVideoQualityRequest.h b/videorecog/include/alibabacloud/videorecog/model/EvaluateVideoQualityRequest.h new file mode 100644 index 000000000..5b3e22461 --- /dev/null +++ b/videorecog/include/alibabacloud/videorecog/model/EvaluateVideoQualityRequest.h @@ -0,0 +1,48 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_VIDEORECOG_MODEL_EVALUATEVIDEOQUALITYREQUEST_H_ +#define ALIBABACLOUD_VIDEORECOG_MODEL_EVALUATEVIDEOQUALITYREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Videorecog { +namespace Model { +class ALIBABACLOUD_VIDEORECOG_EXPORT EvaluateVideoQualityRequest : public RpcServiceRequest { +public: + EvaluateVideoQualityRequest(); + ~EvaluateVideoQualityRequest(); + std::string getMode() const; + void setMode(const std::string &mode); + bool getAsync() const; + void setAsync(bool async); + std::string getVideoUrl() const; + void setVideoUrl(const std::string &videoUrl); + +private: + std::string mode_; + bool async_; + std::string videoUrl_; +}; +} // namespace Model +} // namespace Videorecog +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_VIDEORECOG_MODEL_EVALUATEVIDEOQUALITYREQUEST_H_ diff --git a/videorecog/include/alibabacloud/videorecog/model/EvaluateVideoQualityResult.h b/videorecog/include/alibabacloud/videorecog/model/EvaluateVideoQualityResult.h new file mode 100644 index 000000000..34ff224cf --- /dev/null +++ b/videorecog/include/alibabacloud/videorecog/model/EvaluateVideoQualityResult.h @@ -0,0 +1,72 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_VIDEORECOG_MODEL_EVALUATEVIDEOQUALITYRESULT_H_ +#define ALIBABACLOUD_VIDEORECOG_MODEL_EVALUATEVIDEOQUALITYRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Videorecog + { + namespace Model + { + class ALIBABACLOUD_VIDEORECOG_EXPORT EvaluateVideoQualityResult : public ServiceResult + { + public: + struct Data + { + struct VideoQualityInfo + { + float noiseIntensity; + float luminance; + float compressiveStrength; + float blurriness; + float colorSaturation; + float colorContrast; + float mosScore; + float colorfulness; + }; + VideoQualityInfo videoQualityInfo; + std::string pdfUrl; + std::string jsonUrl; + }; + + + EvaluateVideoQualityResult(); + explicit EvaluateVideoQualityResult(const std::string &payload); + ~EvaluateVideoQualityResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_VIDEORECOG_MODEL_EVALUATEVIDEOQUALITYRESULT_H_ \ No newline at end of file diff --git a/videorecog/src/VideorecogClient.cc b/videorecog/src/VideorecogClient.cc index ed1d88601..743e88fd8 100644 --- a/videorecog/src/VideorecogClient.cc +++ b/videorecog/src/VideorecogClient.cc @@ -87,6 +87,42 @@ VideorecogClient::DetectVideoShotOutcomeCallable VideorecogClient::detectVideoSh return task->get_future(); } +VideorecogClient::EvaluateVideoQualityOutcome VideorecogClient::evaluateVideoQuality(const EvaluateVideoQualityRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return EvaluateVideoQualityOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return EvaluateVideoQualityOutcome(EvaluateVideoQualityResult(outcome.result())); + else + return EvaluateVideoQualityOutcome(outcome.error()); +} + +void VideorecogClient::evaluateVideoQualityAsync(const EvaluateVideoQualityRequest& request, const EvaluateVideoQualityAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, evaluateVideoQuality(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +VideorecogClient::EvaluateVideoQualityOutcomeCallable VideorecogClient::evaluateVideoQualityCallable(const EvaluateVideoQualityRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->evaluateVideoQuality(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + VideorecogClient::GenerateVideoCoverOutcome VideorecogClient::generateVideoCover(const GenerateVideoCoverRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/videorecog/src/model/EvaluateVideoQualityRequest.cc b/videorecog/src/model/EvaluateVideoQualityRequest.cc new file mode 100644 index 000000000..93fb61316 --- /dev/null +++ b/videorecog/src/model/EvaluateVideoQualityRequest.cc @@ -0,0 +1,54 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Videorecog::Model::EvaluateVideoQualityRequest; + +EvaluateVideoQualityRequest::EvaluateVideoQualityRequest() + : RpcServiceRequest("videorecog", "2020-03-20", "EvaluateVideoQuality") { + setMethod(HttpRequest::Method::Post); +} + +EvaluateVideoQualityRequest::~EvaluateVideoQualityRequest() {} + +std::string EvaluateVideoQualityRequest::getMode() const { + return mode_; +} + +void EvaluateVideoQualityRequest::setMode(const std::string &mode) { + mode_ = mode; + setBodyParameter(std::string("Mode"), mode); +} + +bool EvaluateVideoQualityRequest::getAsync() const { + return async_; +} + +void EvaluateVideoQualityRequest::setAsync(bool async) { + async_ = async; + setBodyParameter(std::string("Async"), async ? "true" : "false"); +} + +std::string EvaluateVideoQualityRequest::getVideoUrl() const { + return videoUrl_; +} + +void EvaluateVideoQualityRequest::setVideoUrl(const std::string &videoUrl) { + videoUrl_ = videoUrl; + setBodyParameter(std::string("VideoUrl"), videoUrl); +} + diff --git a/videorecog/src/model/EvaluateVideoQualityResult.cc b/videorecog/src/model/EvaluateVideoQualityResult.cc new file mode 100644 index 000000000..60fdf3c9b --- /dev/null +++ b/videorecog/src/model/EvaluateVideoQualityResult.cc @@ -0,0 +1,85 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Videorecog; +using namespace AlibabaCloud::Videorecog::Model; + +EvaluateVideoQualityResult::EvaluateVideoQualityResult() : + ServiceResult() +{} + +EvaluateVideoQualityResult::EvaluateVideoQualityResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +EvaluateVideoQualityResult::~EvaluateVideoQualityResult() +{} + +void EvaluateVideoQualityResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + if(!dataNode["JsonUrl"].isNull()) + data_.jsonUrl = dataNode["JsonUrl"].asString(); + if(!dataNode["PdfUrl"].isNull()) + data_.pdfUrl = dataNode["PdfUrl"].asString(); + auto videoQualityInfoNode = dataNode["VideoQualityInfo"]; + if(!videoQualityInfoNode["CompressiveStrength"].isNull()) + data_.videoQualityInfo.compressiveStrength = std::stof(videoQualityInfoNode["CompressiveStrength"].asString()); + if(!videoQualityInfoNode["NoiseIntensity"].isNull()) + data_.videoQualityInfo.noiseIntensity = std::stof(videoQualityInfoNode["NoiseIntensity"].asString()); + if(!videoQualityInfoNode["Blurriness"].isNull()) + data_.videoQualityInfo.blurriness = std::stof(videoQualityInfoNode["Blurriness"].asString()); + if(!videoQualityInfoNode["ColorContrast"].isNull()) + data_.videoQualityInfo.colorContrast = std::stof(videoQualityInfoNode["ColorContrast"].asString()); + if(!videoQualityInfoNode["ColorSaturation"].isNull()) + data_.videoQualityInfo.colorSaturation = std::stof(videoQualityInfoNode["ColorSaturation"].asString()); + if(!videoQualityInfoNode["Luminance"].isNull()) + data_.videoQualityInfo.luminance = std::stof(videoQualityInfoNode["Luminance"].asString()); + if(!videoQualityInfoNode["Colorfulness"].isNull()) + data_.videoQualityInfo.colorfulness = std::stof(videoQualityInfoNode["Colorfulness"].asString()); + if(!videoQualityInfoNode["MosScore"].isNull()) + data_.videoQualityInfo.mosScore = std::stof(videoQualityInfoNode["MosScore"].asString()); + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string EvaluateVideoQualityResult::getMessage()const +{ + return message_; +} + +EvaluateVideoQualityResult::Data EvaluateVideoQualityResult::getData()const +{ + return data_; +} + +std::string EvaluateVideoQualityResult::getCode()const +{ + return code_; +} +