QueryFpCompareJobListResult.cc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/mts/model/QueryFpCompareJobListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Mts;
  19. using namespace AlibabaCloud::Mts::Model;
  20. QueryFpCompareJobListResult::QueryFpCompareJobListResult() :
  21. ServiceResult()
  22. {}
  23. QueryFpCompareJobListResult::QueryFpCompareJobListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryFpCompareJobListResult::~QueryFpCompareJobListResult()
  29. {}
  30. void QueryFpCompareJobListResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. auto allFpCompareJobListNode = value["FpCompareJobList"]["FpCompareJob"];
  37. for (auto valueFpCompareJobListFpCompareJob : allFpCompareJobListNode)
  38. {
  39. FpCompareJob fpCompareJobListObject;
  40. if(!valueFpCompareJobListFpCompareJob["Id"].isNull())
  41. fpCompareJobListObject.id = valueFpCompareJobListFpCompareJob["Id"].asString();
  42. if(!valueFpCompareJobListFpCompareJob["UserData"].isNull())
  43. fpCompareJobListObject.userData = valueFpCompareJobListFpCompareJob["UserData"].asString();
  44. if(!valueFpCompareJobListFpCompareJob["PipelineId"].isNull())
  45. fpCompareJobListObject.pipelineId = valueFpCompareJobListFpCompareJob["PipelineId"].asString();
  46. if(!valueFpCompareJobListFpCompareJob["FpDBId"].isNull())
  47. fpCompareJobListObject.fpDBId = valueFpCompareJobListFpCompareJob["FpDBId"].asString();
  48. if(!valueFpCompareJobListFpCompareJob["State"].isNull())
  49. fpCompareJobListObject.state = valueFpCompareJobListFpCompareJob["State"].asString();
  50. if(!valueFpCompareJobListFpCompareJob["Code"].isNull())
  51. fpCompareJobListObject.code = valueFpCompareJobListFpCompareJob["Code"].asString();
  52. if(!valueFpCompareJobListFpCompareJob["Message"].isNull())
  53. fpCompareJobListObject.message = valueFpCompareJobListFpCompareJob["Message"].asString();
  54. if(!valueFpCompareJobListFpCompareJob["CreationTime"].isNull())
  55. fpCompareJobListObject.creationTime = valueFpCompareJobListFpCompareJob["CreationTime"].asString();
  56. if(!valueFpCompareJobListFpCompareJob["FinishTime"].isNull())
  57. fpCompareJobListObject.finishTime = valueFpCompareJobListFpCompareJob["FinishTime"].asString();
  58. auto masterFileNode = value["MasterFile"];
  59. if(!masterFileNode["Bucket"].isNull())
  60. fpCompareJobListObject.masterFile.bucket = masterFileNode["Bucket"].asString();
  61. if(!masterFileNode["Location"].isNull())
  62. fpCompareJobListObject.masterFile.location = masterFileNode["Location"].asString();
  63. if(!masterFileNode["Object"].isNull())
  64. fpCompareJobListObject.masterFile.object = masterFileNode["Object"].asString();
  65. auto queryFileNode = value["QueryFile"];
  66. if(!queryFileNode["Bucket"].isNull())
  67. fpCompareJobListObject.queryFile.bucket = queryFileNode["Bucket"].asString();
  68. if(!queryFileNode["Location"].isNull())
  69. fpCompareJobListObject.queryFile.location = queryFileNode["Location"].asString();
  70. if(!queryFileNode["Object"].isNull())
  71. fpCompareJobListObject.queryFile.object = queryFileNode["Object"].asString();
  72. auto matchFrameStorageNode = value["MatchFrameStorage"];
  73. auto masterMediaFramesNode = matchFrameStorageNode["MasterMediaFrames"];
  74. if(!masterMediaFramesNode["Bucket"].isNull())
  75. fpCompareJobListObject.matchFrameStorage.masterMediaFrames.bucket = masterMediaFramesNode["Bucket"].asString();
  76. if(!masterMediaFramesNode["Location"].isNull())
  77. fpCompareJobListObject.matchFrameStorage.masterMediaFrames.location = masterMediaFramesNode["Location"].asString();
  78. if(!masterMediaFramesNode["Object"].isNull())
  79. fpCompareJobListObject.matchFrameStorage.masterMediaFrames.object = masterMediaFramesNode["Object"].asString();
  80. auto queryMediaFramesNode = matchFrameStorageNode["QueryMediaFrames"];
  81. if(!queryMediaFramesNode["Bucket"].isNull())
  82. fpCompareJobListObject.matchFrameStorage.queryMediaFrames.bucket = queryMediaFramesNode["Bucket"].asString();
  83. if(!queryMediaFramesNode["Location"].isNull())
  84. fpCompareJobListObject.matchFrameStorage.queryMediaFrames.location = queryMediaFramesNode["Location"].asString();
  85. if(!queryMediaFramesNode["Object"].isNull())
  86. fpCompareJobListObject.matchFrameStorage.queryMediaFrames.object = queryMediaFramesNode["Object"].asString();
  87. auto matchedFramesDescFileNode = matchFrameStorageNode["MatchedFramesDescFile"];
  88. if(!matchedFramesDescFileNode["Bucket"].isNull())
  89. fpCompareJobListObject.matchFrameStorage.matchedFramesDescFile.bucket = matchedFramesDescFileNode["Bucket"].asString();
  90. if(!matchedFramesDescFileNode["Location"].isNull())
  91. fpCompareJobListObject.matchFrameStorage.matchedFramesDescFile.location = matchedFramesDescFileNode["Location"].asString();
  92. if(!matchedFramesDescFileNode["Object"].isNull())
  93. fpCompareJobListObject.matchFrameStorage.matchedFramesDescFile.object = matchedFramesDescFileNode["Object"].asString();
  94. auto fpCompareResultNode = value["FpCompareResult"];
  95. auto allMediaMatchSegmentsNode = fpCompareResultNode["MediaMatchSegments"]["MediaMatchSegment"];
  96. for (auto fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment : allMediaMatchSegmentsNode)
  97. {
  98. FpCompareJob::FpCompareResult::MediaMatchSegment mediaMatchSegmentObject;
  99. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["QueryStartFrame"].isNull())
  100. mediaMatchSegmentObject.queryStartFrame = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["QueryStartFrame"].asString();
  101. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["QueryEndFrame"].isNull())
  102. mediaMatchSegmentObject.queryEndFrame = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["QueryEndFrame"].asString();
  103. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["MasterStartFrame"].isNull())
  104. mediaMatchSegmentObject.masterStartFrame = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["MasterStartFrame"].asString();
  105. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["MasterEndFrame"].isNull())
  106. mediaMatchSegmentObject.masterEndFrame = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["MasterEndFrame"].asString();
  107. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["QueryStartTime"].isNull())
  108. mediaMatchSegmentObject.queryStartTime = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["QueryStartTime"].asString();
  109. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["QueryEndTime"].isNull())
  110. mediaMatchSegmentObject.queryEndTime = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["QueryEndTime"].asString();
  111. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["MasterStartTime"].isNull())
  112. mediaMatchSegmentObject.masterStartTime = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["MasterStartTime"].asString();
  113. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["MasterEndTime"].isNull())
  114. mediaMatchSegmentObject.masterEndTime = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["MasterEndTime"].asString();
  115. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["TotalMatchFrameNum"].isNull())
  116. mediaMatchSegmentObject.totalMatchFrameNum = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["TotalMatchFrameNum"].asString();
  117. if(!fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["Score"].isNull())
  118. mediaMatchSegmentObject.score = fpCompareResultNodeMediaMatchSegmentsMediaMatchSegment["Score"].asString();
  119. fpCompareJobListObject.fpCompareResult.mediaMatchSegments.push_back(mediaMatchSegmentObject);
  120. }
  121. auto masterMediaInfoNode = fpCompareResultNode["MasterMediaInfo"];
  122. if(!masterMediaInfoNode["Duration"].isNull())
  123. fpCompareJobListObject.fpCompareResult.masterMediaInfo.duration = masterMediaInfoNode["Duration"].asString();
  124. if(!masterMediaInfoNode["FpNum"].isNull())
  125. fpCompareJobListObject.fpCompareResult.masterMediaInfo.fpNum = masterMediaInfoNode["FpNum"].asString();
  126. if(!masterMediaInfoNode["Width"].isNull())
  127. fpCompareJobListObject.fpCompareResult.masterMediaInfo.width = masterMediaInfoNode["Width"].asString();
  128. if(!masterMediaInfoNode["Height"].isNull())
  129. fpCompareJobListObject.fpCompareResult.masterMediaInfo.height = masterMediaInfoNode["Height"].asString();
  130. if(!masterMediaInfoNode["Fps"].isNull())
  131. fpCompareJobListObject.fpCompareResult.masterMediaInfo.fps = masterMediaInfoNode["Fps"].asString();
  132. if(!masterMediaInfoNode["TotalVideoFrame"].isNull())
  133. fpCompareJobListObject.fpCompareResult.masterMediaInfo.totalVideoFrame = masterMediaInfoNode["TotalVideoFrame"].asString();
  134. if(!masterMediaInfoNode["AudioBitRate"].isNull())
  135. fpCompareJobListObject.fpCompareResult.masterMediaInfo.audioBitRate = masterMediaInfoNode["AudioBitRate"].asString();
  136. if(!masterMediaInfoNode["AudioChannels"].isNull())
  137. fpCompareJobListObject.fpCompareResult.masterMediaInfo.audioChannels = masterMediaInfoNode["AudioChannels"].asString();
  138. if(!masterMediaInfoNode["AudioSampleRate"].isNull())
  139. fpCompareJobListObject.fpCompareResult.masterMediaInfo.audioSampleRate = masterMediaInfoNode["AudioSampleRate"].asString();
  140. auto queryMediaInfoNode = fpCompareResultNode["QueryMediaInfo"];
  141. if(!queryMediaInfoNode["Duration"].isNull())
  142. fpCompareJobListObject.fpCompareResult.queryMediaInfo.duration = queryMediaInfoNode["Duration"].asString();
  143. if(!queryMediaInfoNode["FpNum"].isNull())
  144. fpCompareJobListObject.fpCompareResult.queryMediaInfo.fpNum = queryMediaInfoNode["FpNum"].asString();
  145. if(!queryMediaInfoNode["Width"].isNull())
  146. fpCompareJobListObject.fpCompareResult.queryMediaInfo.width = queryMediaInfoNode["Width"].asString();
  147. if(!queryMediaInfoNode["Height"].isNull())
  148. fpCompareJobListObject.fpCompareResult.queryMediaInfo.height = queryMediaInfoNode["Height"].asString();
  149. if(!queryMediaInfoNode["Fps"].isNull())
  150. fpCompareJobListObject.fpCompareResult.queryMediaInfo.fps = queryMediaInfoNode["Fps"].asString();
  151. if(!queryMediaInfoNode["TotalVideoFrame"].isNull())
  152. fpCompareJobListObject.fpCompareResult.queryMediaInfo.totalVideoFrame = queryMediaInfoNode["TotalVideoFrame"].asString();
  153. if(!queryMediaInfoNode["AudioBitRate"].isNull())
  154. fpCompareJobListObject.fpCompareResult.queryMediaInfo.audioBitRate = queryMediaInfoNode["AudioBitRate"].asString();
  155. if(!queryMediaInfoNode["AudioChannels"].isNull())
  156. fpCompareJobListObject.fpCompareResult.queryMediaInfo.audioChannels = queryMediaInfoNode["AudioChannels"].asString();
  157. if(!queryMediaInfoNode["AudioSampleRate"].isNull())
  158. fpCompareJobListObject.fpCompareResult.queryMediaInfo.audioSampleRate = queryMediaInfoNode["AudioSampleRate"].asString();
  159. fpCompareJobList_.push_back(fpCompareJobListObject);
  160. }
  161. auto allNonExistIds = value["NonExistIds"]["String"];
  162. for (const auto &item : allNonExistIds)
  163. nonExistIds_.push_back(item.asString());
  164. }
  165. std::vector<QueryFpCompareJobListResult::FpCompareJob> QueryFpCompareJobListResult::getFpCompareJobList()const
  166. {
  167. return fpCompareJobList_;
  168. }
  169. std::vector<std::string> QueryFpCompareJobListResult::getNonExistIds()const
  170. {
  171. return nonExistIds_;
  172. }