QueryVideoPoseJobListResult.cc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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/QueryVideoPoseJobListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Mts;
  19. using namespace AlibabaCloud::Mts::Model;
  20. QueryVideoPoseJobListResult::QueryVideoPoseJobListResult() :
  21. ServiceResult()
  22. {}
  23. QueryVideoPoseJobListResult::QueryVideoPoseJobListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryVideoPoseJobListResult::~QueryVideoPoseJobListResult()
  29. {}
  30. void QueryVideoPoseJobListResult::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 allJobList = value["JobList"]["Job"];
  37. for (auto value : allJobList)
  38. {
  39. Job jobListObject;
  40. if(!value["JobId"].isNull())
  41. jobListObject.jobId = value["JobId"].asString();
  42. if(!value["PipelineId"].isNull())
  43. jobListObject.pipelineId = value["PipelineId"].asString();
  44. if(!value["UserData"].isNull())
  45. jobListObject.userData = value["UserData"].asString();
  46. if(!value["State"].isNull())
  47. jobListObject.state = value["State"].asString();
  48. auto inputNode = value["Input"];
  49. if(!inputNode["Bucket"].isNull())
  50. jobListObject.input.bucket = inputNode["Bucket"].asString();
  51. if(!inputNode["Location"].isNull())
  52. jobListObject.input.location = inputNode["Location"].asString();
  53. if(!inputNode["Object"].isNull())
  54. jobListObject.input.object = inputNode["Object"].asString();
  55. if(!inputNode["RoleArn"].isNull())
  56. jobListObject.input.roleArn = inputNode["RoleArn"].asString();
  57. auto outputConfigNode = value["OutputConfig"];
  58. auto videoFileNode = outputConfigNode["VideoFile"];
  59. if(!videoFileNode["Bucket"].isNull())
  60. jobListObject.outputConfig.videoFile.bucket = videoFileNode["Bucket"].asString();
  61. if(!videoFileNode["Location"].isNull())
  62. jobListObject.outputConfig.videoFile.location = videoFileNode["Location"].asString();
  63. if(!videoFileNode["Object"].isNull())
  64. jobListObject.outputConfig.videoFile.object = videoFileNode["Object"].asString();
  65. if(!videoFileNode["RoleArn"].isNull())
  66. jobListObject.outputConfig.videoFile.roleArn = videoFileNode["RoleArn"].asString();
  67. auto dataFileNode = outputConfigNode["DataFile"];
  68. if(!dataFileNode["Bucket"].isNull())
  69. jobListObject.outputConfig.dataFile.bucket = dataFileNode["Bucket"].asString();
  70. if(!dataFileNode["Location"].isNull())
  71. jobListObject.outputConfig.dataFile.location = dataFileNode["Location"].asString();
  72. if(!dataFileNode["Object"].isNull())
  73. jobListObject.outputConfig.dataFile.object = dataFileNode["Object"].asString();
  74. if(!dataFileNode["RoleArn"].isNull())
  75. jobListObject.outputConfig.dataFile.roleArn = dataFileNode["RoleArn"].asString();
  76. auto propertiesNode = value["Properties"];
  77. if(!propertiesNode["Width"].isNull())
  78. jobListObject.properties.width = propertiesNode["Width"].asString();
  79. if(!propertiesNode["Height"].isNull())
  80. jobListObject.properties.height = propertiesNode["Height"].asString();
  81. if(!propertiesNode["Bitrate"].isNull())
  82. jobListObject.properties.bitrate = propertiesNode["Bitrate"].asString();
  83. if(!propertiesNode["Duration"].isNull())
  84. jobListObject.properties.duration = propertiesNode["Duration"].asString();
  85. if(!propertiesNode["Fps"].isNull())
  86. jobListObject.properties.fps = propertiesNode["Fps"].asString();
  87. if(!propertiesNode["FileSize"].isNull())
  88. jobListObject.properties.fileSize = propertiesNode["FileSize"].asString();
  89. if(!propertiesNode["FileFormat"].isNull())
  90. jobListObject.properties.fileFormat = propertiesNode["FileFormat"].asString();
  91. auto streamsNode = propertiesNode["Streams"];
  92. auto allVideoStreamList = value["VideoStreamList"]["VideoStream"];
  93. for (auto value : allVideoStreamList)
  94. {
  95. Job::Properties::Streams::VideoStream videoStreamObject;
  96. if(!value["Index"].isNull())
  97. videoStreamObject.index = value["Index"].asString();
  98. if(!value["CodecName"].isNull())
  99. videoStreamObject.codecName = value["CodecName"].asString();
  100. if(!value["CodecLongName"].isNull())
  101. videoStreamObject.codecLongName = value["CodecLongName"].asString();
  102. if(!value["Profile"].isNull())
  103. videoStreamObject.profile = value["Profile"].asString();
  104. if(!value["CodecTimeBase"].isNull())
  105. videoStreamObject.codecTimeBase = value["CodecTimeBase"].asString();
  106. if(!value["CodecTagString"].isNull())
  107. videoStreamObject.codecTagString = value["CodecTagString"].asString();
  108. if(!value["CodecTag"].isNull())
  109. videoStreamObject.codecTag = value["CodecTag"].asString();
  110. if(!value["Width"].isNull())
  111. videoStreamObject.width = value["Width"].asString();
  112. if(!value["Height"].isNull())
  113. videoStreamObject.height = value["Height"].asString();
  114. if(!value["HasBFrames"].isNull())
  115. videoStreamObject.hasBFrames = value["HasBFrames"].asString();
  116. if(!value["Sar"].isNull())
  117. videoStreamObject.sar = value["Sar"].asString();
  118. if(!value["Dar"].isNull())
  119. videoStreamObject.dar = value["Dar"].asString();
  120. if(!value["PixFmt"].isNull())
  121. videoStreamObject.pixFmt = value["PixFmt"].asString();
  122. if(!value["Level"].isNull())
  123. videoStreamObject.level = value["Level"].asString();
  124. if(!value["Fps"].isNull())
  125. videoStreamObject.fps = value["Fps"].asString();
  126. if(!value["AvgFPS"].isNull())
  127. videoStreamObject.avgFPS = value["AvgFPS"].asString();
  128. if(!value["Timebase"].isNull())
  129. videoStreamObject.timebase = value["Timebase"].asString();
  130. if(!value["StartTime"].isNull())
  131. videoStreamObject.startTime = value["StartTime"].asString();
  132. if(!value["Duration"].isNull())
  133. videoStreamObject.duration = value["Duration"].asString();
  134. if(!value["Bitrate"].isNull())
  135. videoStreamObject.bitrate = value["Bitrate"].asString();
  136. if(!value["NumFrames"].isNull())
  137. videoStreamObject.numFrames = value["NumFrames"].asString();
  138. if(!value["Lang"].isNull())
  139. videoStreamObject.lang = value["Lang"].asString();
  140. if(!value["Rotate"].isNull())
  141. videoStreamObject.rotate = value["Rotate"].asString();
  142. auto networkCostNode = value["NetworkCost"];
  143. if(!networkCostNode["PreloadTime"].isNull())
  144. videoStreamObject.networkCost.preloadTime = networkCostNode["PreloadTime"].asString();
  145. if(!networkCostNode["CostBandwidth"].isNull())
  146. videoStreamObject.networkCost.costBandwidth = networkCostNode["CostBandwidth"].asString();
  147. if(!networkCostNode["AvgBitrate"].isNull())
  148. videoStreamObject.networkCost.avgBitrate = networkCostNode["AvgBitrate"].asString();
  149. jobListObject.properties.streams.videoStreamList.push_back(videoStreamObject);
  150. }
  151. auto allAudioStreamList = value["AudioStreamList"]["AudioStream"];
  152. for (auto value : allAudioStreamList)
  153. {
  154. Job::Properties::Streams::AudioStream audioStreamObject;
  155. if(!value["Index"].isNull())
  156. audioStreamObject.index = value["Index"].asString();
  157. if(!value["CodecName"].isNull())
  158. audioStreamObject.codecName = value["CodecName"].asString();
  159. if(!value["CodecTimeBase"].isNull())
  160. audioStreamObject.codecTimeBase = value["CodecTimeBase"].asString();
  161. if(!value["CodecLongName"].isNull())
  162. audioStreamObject.codecLongName = value["CodecLongName"].asString();
  163. if(!value["CodecTagString"].isNull())
  164. audioStreamObject.codecTagString = value["CodecTagString"].asString();
  165. if(!value["CodecTag"].isNull())
  166. audioStreamObject.codecTag = value["CodecTag"].asString();
  167. if(!value["SampleFmt"].isNull())
  168. audioStreamObject.sampleFmt = value["SampleFmt"].asString();
  169. if(!value["Samplerate"].isNull())
  170. audioStreamObject.samplerate = value["Samplerate"].asString();
  171. if(!value["Channels"].isNull())
  172. audioStreamObject.channels = value["Channels"].asString();
  173. if(!value["ChannelLayout"].isNull())
  174. audioStreamObject.channelLayout = value["ChannelLayout"].asString();
  175. if(!value["Timebase"].isNull())
  176. audioStreamObject.timebase = value["Timebase"].asString();
  177. if(!value["StartTime"].isNull())
  178. audioStreamObject.startTime = value["StartTime"].asString();
  179. if(!value["Duration"].isNull())
  180. audioStreamObject.duration = value["Duration"].asString();
  181. if(!value["Bitrate"].isNull())
  182. audioStreamObject.bitrate = value["Bitrate"].asString();
  183. if(!value["NumFrames"].isNull())
  184. audioStreamObject.numFrames = value["NumFrames"].asString();
  185. if(!value["Lang"].isNull())
  186. audioStreamObject.lang = value["Lang"].asString();
  187. jobListObject.properties.streams.audioStreamList.push_back(audioStreamObject);
  188. }
  189. auto allSubtitleStreamList = value["SubtitleStreamList"]["SubtitleStream"];
  190. for (auto value : allSubtitleStreamList)
  191. {
  192. Job::Properties::Streams::SubtitleStream subtitleStreamObject;
  193. if(!value["Index"].isNull())
  194. subtitleStreamObject.index = value["Index"].asString();
  195. if(!value["CodecName"].isNull())
  196. subtitleStreamObject.codecName = value["CodecName"].asString();
  197. if(!value["CodecTimeBase"].isNull())
  198. subtitleStreamObject.codecTimeBase = value["CodecTimeBase"].asString();
  199. if(!value["CodecLongName"].isNull())
  200. subtitleStreamObject.codecLongName = value["CodecLongName"].asString();
  201. if(!value["CodecTagString"].isNull())
  202. subtitleStreamObject.codecTagString = value["CodecTagString"].asString();
  203. if(!value["CodecTag"].isNull())
  204. subtitleStreamObject.codecTag = value["CodecTag"].asString();
  205. if(!value["Timebase"].isNull())
  206. subtitleStreamObject.timebase = value["Timebase"].asString();
  207. if(!value["StartTime"].isNull())
  208. subtitleStreamObject.startTime = value["StartTime"].asString();
  209. if(!value["Duration"].isNull())
  210. subtitleStreamObject.duration = value["Duration"].asString();
  211. if(!value["Lang"].isNull())
  212. subtitleStreamObject.lang = value["Lang"].asString();
  213. jobListObject.properties.streams.subtitleStreamList.push_back(subtitleStreamObject);
  214. }
  215. auto formatNode = propertiesNode["Format"];
  216. if(!formatNode["NumStreams"].isNull())
  217. jobListObject.properties.format.numStreams = formatNode["NumStreams"].asString();
  218. if(!formatNode["NumPrograms"].isNull())
  219. jobListObject.properties.format.numPrograms = formatNode["NumPrograms"].asString();
  220. if(!formatNode["FormatName"].isNull())
  221. jobListObject.properties.format.formatName = formatNode["FormatName"].asString();
  222. if(!formatNode["FormatLongName"].isNull())
  223. jobListObject.properties.format.formatLongName = formatNode["FormatLongName"].asString();
  224. if(!formatNode["StartTime"].isNull())
  225. jobListObject.properties.format.startTime = formatNode["StartTime"].asString();
  226. if(!formatNode["Duration"].isNull())
  227. jobListObject.properties.format.duration = formatNode["Duration"].asString();
  228. if(!formatNode["Size"].isNull())
  229. jobListObject.properties.format.size = formatNode["Size"].asString();
  230. if(!formatNode["Bitrate"].isNull())
  231. jobListObject.properties.format.bitrate = formatNode["Bitrate"].asString();
  232. auto mNSMessageResultNode = value["MNSMessageResult"];
  233. if(!mNSMessageResultNode["MessageId"].isNull())
  234. jobListObject.mNSMessageResult.messageId = mNSMessageResultNode["MessageId"].asString();
  235. if(!mNSMessageResultNode["ErrorMessage"].isNull())
  236. jobListObject.mNSMessageResult.errorMessage = mNSMessageResultNode["ErrorMessage"].asString();
  237. if(!mNSMessageResultNode["ErrorCode"].isNull())
  238. jobListObject.mNSMessageResult.errorCode = mNSMessageResultNode["ErrorCode"].asString();
  239. jobList_.push_back(jobListObject);
  240. }
  241. auto allNonExistJobIds = value["NonExistJobIds"]["String"];
  242. for (const auto &item : allNonExistJobIds)
  243. nonExistJobIds_.push_back(item.asString());
  244. }
  245. std::vector<std::string> QueryVideoPoseJobListResult::getNonExistJobIds()const
  246. {
  247. return nonExistJobIds_;
  248. }
  249. std::vector<QueryVideoPoseJobListResult::Job> QueryVideoPoseJobListResult::getJobList()const
  250. {
  251. return jobList_;
  252. }