Release SegmentGreenScreenVideo.

This commit is contained in:
sdk-team
2021-02-01 02:41:37 +00:00
parent e0575e4c67
commit df825120f3
8 changed files with 278 additions and 0 deletions

View File

@@ -23,6 +23,8 @@ set(videoseg_public_header
set(videoseg_public_header_model
include/alibabacloud/videoseg/model/GetAsyncJobResultRequest.h
include/alibabacloud/videoseg/model/GetAsyncJobResultResult.h
include/alibabacloud/videoseg/model/SegmentGreenScreenVideoRequest.h
include/alibabacloud/videoseg/model/SegmentGreenScreenVideoResult.h
include/alibabacloud/videoseg/model/SegmentHalfBodyRequest.h
include/alibabacloud/videoseg/model/SegmentHalfBodyResult.h
include/alibabacloud/videoseg/model/SegmentVideoBodyRequest.h
@@ -32,6 +34,8 @@ set(videoseg_src
src/VideosegClient.cc
src/model/GetAsyncJobResultRequest.cc
src/model/GetAsyncJobResultResult.cc
src/model/SegmentGreenScreenVideoRequest.cc
src/model/SegmentGreenScreenVideoResult.cc
src/model/SegmentHalfBodyRequest.cc
src/model/SegmentHalfBodyResult.cc
src/model/SegmentVideoBodyRequest.cc

View File

@@ -24,6 +24,8 @@
#include "VideosegExport.h"
#include "model/GetAsyncJobResultRequest.h"
#include "model/GetAsyncJobResultResult.h"
#include "model/SegmentGreenScreenVideoRequest.h"
#include "model/SegmentGreenScreenVideoResult.h"
#include "model/SegmentHalfBodyRequest.h"
#include "model/SegmentHalfBodyResult.h"
#include "model/SegmentVideoBodyRequest.h"
@@ -40,6 +42,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::GetAsyncJobResultResult> GetAsyncJobResultOutcome;
typedef std::future<GetAsyncJobResultOutcome> GetAsyncJobResultOutcomeCallable;
typedef std::function<void(const VideosegClient*, const Model::GetAsyncJobResultRequest&, const GetAsyncJobResultOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetAsyncJobResultAsyncHandler;
typedef Outcome<Error, Model::SegmentGreenScreenVideoResult> SegmentGreenScreenVideoOutcome;
typedef std::future<SegmentGreenScreenVideoOutcome> SegmentGreenScreenVideoOutcomeCallable;
typedef std::function<void(const VideosegClient*, const Model::SegmentGreenScreenVideoRequest&, const SegmentGreenScreenVideoOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SegmentGreenScreenVideoAsyncHandler;
typedef Outcome<Error, Model::SegmentHalfBodyResult> SegmentHalfBodyOutcome;
typedef std::future<SegmentHalfBodyOutcome> SegmentHalfBodyOutcomeCallable;
typedef std::function<void(const VideosegClient*, const Model::SegmentHalfBodyRequest&, const SegmentHalfBodyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SegmentHalfBodyAsyncHandler;
@@ -54,6 +59,9 @@ namespace AlibabaCloud
GetAsyncJobResultOutcome getAsyncJobResult(const Model::GetAsyncJobResultRequest &request)const;
void getAsyncJobResultAsync(const Model::GetAsyncJobResultRequest& request, const GetAsyncJobResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetAsyncJobResultOutcomeCallable getAsyncJobResultCallable(const Model::GetAsyncJobResultRequest& request) const;
SegmentGreenScreenVideoOutcome segmentGreenScreenVideo(const Model::SegmentGreenScreenVideoRequest &request)const;
void segmentGreenScreenVideoAsync(const Model::SegmentGreenScreenVideoRequest& request, const SegmentGreenScreenVideoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
SegmentGreenScreenVideoOutcomeCallable segmentGreenScreenVideoCallable(const Model::SegmentGreenScreenVideoRequest& request) const;
SegmentHalfBodyOutcome segmentHalfBody(const Model::SegmentHalfBodyRequest &request)const;
void segmentHalfBodyAsync(const Model::SegmentHalfBodyRequest& request, const SegmentHalfBodyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
SegmentHalfBodyOutcomeCallable segmentHalfBodyCallable(const Model::SegmentHalfBodyRequest& request) const;

View File

@@ -0,0 +1,51 @@
/*
* 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_VIDEOSEG_MODEL_SEGMENTGREENSCREENVIDEOREQUEST_H_
#define ALIBABACLOUD_VIDEOSEG_MODEL_SEGMENTGREENSCREENVIDEOREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/videoseg/VideosegExport.h>
namespace AlibabaCloud
{
namespace Videoseg
{
namespace Model
{
class ALIBABACLOUD_VIDEOSEG_EXPORT SegmentGreenScreenVideoRequest : public RpcServiceRequest
{
public:
SegmentGreenScreenVideoRequest();
~SegmentGreenScreenVideoRequest();
bool getAsync()const;
void setAsync(bool async);
std::string getVideoURL()const;
void setVideoURL(const std::string& videoURL);
private:
bool async_;
std::string videoURL_;
};
}
}
}
#endif // !ALIBABACLOUD_VIDEOSEG_MODEL_SEGMENTGREENSCREENVIDEOREQUEST_H_

View File

@@ -0,0 +1,59 @@
/*
* 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_VIDEOSEG_MODEL_SEGMENTGREENSCREENVIDEORESULT_H_
#define ALIBABACLOUD_VIDEOSEG_MODEL_SEGMENTGREENSCREENVIDEORESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/videoseg/VideosegExport.h>
namespace AlibabaCloud
{
namespace Videoseg
{
namespace Model
{
class ALIBABACLOUD_VIDEOSEG_EXPORT SegmentGreenScreenVideoResult : public ServiceResult
{
public:
struct Data
{
std::string videoURL;
};
SegmentGreenScreenVideoResult();
explicit SegmentGreenScreenVideoResult(const std::string &payload);
~SegmentGreenScreenVideoResult();
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_VIDEOSEG_MODEL_SEGMENTGREENSCREENVIDEORESULT_H_

View File

@@ -87,6 +87,42 @@ VideosegClient::GetAsyncJobResultOutcomeCallable VideosegClient::getAsyncJobResu
return task->get_future();
}
VideosegClient::SegmentGreenScreenVideoOutcome VideosegClient::segmentGreenScreenVideo(const SegmentGreenScreenVideoRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return SegmentGreenScreenVideoOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return SegmentGreenScreenVideoOutcome(SegmentGreenScreenVideoResult(outcome.result()));
else
return SegmentGreenScreenVideoOutcome(outcome.error());
}
void VideosegClient::segmentGreenScreenVideoAsync(const SegmentGreenScreenVideoRequest& request, const SegmentGreenScreenVideoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, segmentGreenScreenVideo(request), context);
};
asyncExecute(new Runnable(fn));
}
VideosegClient::SegmentGreenScreenVideoOutcomeCallable VideosegClient::segmentGreenScreenVideoCallable(const SegmentGreenScreenVideoRequest &request) const
{
auto task = std::make_shared<std::packaged_task<SegmentGreenScreenVideoOutcome()>>(
[this, request]()
{
return this->segmentGreenScreenVideo(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
VideosegClient::SegmentHalfBodyOutcome VideosegClient::segmentHalfBody(const SegmentHalfBodyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,51 @@
/*
* 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/videoseg/model/SegmentGreenScreenVideoRequest.h>
using AlibabaCloud::Videoseg::Model::SegmentGreenScreenVideoRequest;
SegmentGreenScreenVideoRequest::SegmentGreenScreenVideoRequest() :
RpcServiceRequest("videoseg", "2020-03-20", "SegmentGreenScreenVideo")
{
setMethod(HttpRequest::Method::Post);
}
SegmentGreenScreenVideoRequest::~SegmentGreenScreenVideoRequest()
{}
bool SegmentGreenScreenVideoRequest::getAsync()const
{
return async_;
}
void SegmentGreenScreenVideoRequest::setAsync(bool async)
{
async_ = async;
setBodyParameter("Async", async ? "true" : "false");
}
std::string SegmentGreenScreenVideoRequest::getVideoURL()const
{
return videoURL_;
}
void SegmentGreenScreenVideoRequest::setVideoURL(const std::string& videoURL)
{
videoURL_ = videoURL;
setBodyParameter("VideoURL", videoURL);
}

View File

@@ -0,0 +1,66 @@
/*
* 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/videoseg/model/SegmentGreenScreenVideoResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Videoseg;
using namespace AlibabaCloud::Videoseg::Model;
SegmentGreenScreenVideoResult::SegmentGreenScreenVideoResult() :
ServiceResult()
{}
SegmentGreenScreenVideoResult::SegmentGreenScreenVideoResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
SegmentGreenScreenVideoResult::~SegmentGreenScreenVideoResult()
{}
void SegmentGreenScreenVideoResult::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["VideoURL"].isNull())
data_.videoURL = dataNode["VideoURL"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
}
std::string SegmentGreenScreenVideoResult::getMessage()const
{
return message_;
}
SegmentGreenScreenVideoResult::Data SegmentGreenScreenVideoResult::getData()const
{
return data_;
}
std::string SegmentGreenScreenVideoResult::getCode()const
{
return code_;
}