Update EvaluateVideoQuality.
This commit is contained in:
@@ -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<const AsyncCallerContext>& 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<std::packaged_task<EvaluateVideoQualityOutcome()>>(
|
||||
[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();
|
||||
|
||||
54
videorecog/src/model/EvaluateVideoQualityRequest.cc
Normal file
54
videorecog/src/model/EvaluateVideoQualityRequest.cc
Normal file
@@ -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 <alibabacloud/videorecog/model/EvaluateVideoQualityRequest.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
85
videorecog/src/model/EvaluateVideoQualityResult.cc
Normal file
85
videorecog/src/model/EvaluateVideoQualityResult.cc
Normal file
@@ -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 <alibabacloud/videorecog/model/EvaluateVideoQualityResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user