Update EvaluateVideoQuality.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<Error, Model::DetectVideoShotResult> DetectVideoShotOutcome;
|
||||
typedef std::future<DetectVideoShotOutcome> DetectVideoShotOutcomeCallable;
|
||||
typedef std::function<void(const VideorecogClient*, const Model::DetectVideoShotRequest&, const DetectVideoShotOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DetectVideoShotAsyncHandler;
|
||||
typedef Outcome<Error, Model::EvaluateVideoQualityResult> EvaluateVideoQualityOutcome;
|
||||
typedef std::future<EvaluateVideoQualityOutcome> EvaluateVideoQualityOutcomeCallable;
|
||||
typedef std::function<void(const VideorecogClient*, const Model::EvaluateVideoQualityRequest&, const EvaluateVideoQualityOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> EvaluateVideoQualityAsyncHandler;
|
||||
typedef Outcome<Error, Model::GenerateVideoCoverResult> GenerateVideoCoverOutcome;
|
||||
typedef std::future<GenerateVideoCoverOutcome> GenerateVideoCoverOutcomeCallable;
|
||||
typedef std::function<void(const VideorecogClient*, const Model::GenerateVideoCoverRequest&, const GenerateVideoCoverOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& 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<const AsyncCallerContext>& context = nullptr) const;
|
||||
GenerateVideoCoverOutcomeCallable generateVideoCoverCallable(const Model::GenerateVideoCoverRequest& request) const;
|
||||
|
||||
@@ -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 <alibabacloud/videorecog/VideorecogExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
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_
|
||||
@@ -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 <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/videorecog/VideorecogExport.h>
|
||||
|
||||
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_
|
||||
@@ -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