data_process_req.h 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138
  1. #pragma once
  2. #include <sstream>
  3. #include <string>
  4. #include <vector>
  5. #include "Poco/Dynamic/Struct.h"
  6. #include "Poco/JSON/Object.h"
  7. #include "request/bucket_req.h"
  8. #include "request/object_req.h"
  9. namespace qcloud_cos {
  10. struct Input {
  11. Input() : object(""), region(""), bucket("") {}
  12. std::string object; // 文件在 COS 上的文件路径,Bucket 由 Host 指定
  13. std::string region;
  14. std::string bucket;
  15. std::string url;
  16. std::string to_string() const {
  17. std::stringstream ss;
  18. ss << "object: " << object;
  19. ss << " bucket: " << bucket;
  20. ss << " region: " << region;
  21. ss << " url: " << url;
  22. return ss.str();
  23. }
  24. };
  25. struct Output {
  26. Output() : region(""), bucket(""), object("") {}
  27. std::string region; // 存储桶的地域
  28. std::string bucket; // 存储结果的存储桶
  29. std::string object; // 输出文件路径
  30. std::string sprite_object; //雪碧图输出
  31. std::string au_object; // 人声结果文件
  32. std::string bass_object; // Bass声结果文件
  33. std::string drum_object; // 鼓声结果文件
  34. std::string to_string() const {
  35. std::stringstream ss;
  36. ss << "region: " << region << ", bucket: " << bucket
  37. << ", object: " << object << ", sprite_object: " << sprite_object
  38. << ", au_object: " << au_object << ", bass_object: " << bass_object
  39. << ", drum_object: " << drum_object << std::endl;
  40. return ss.str();
  41. }
  42. };
  43. struct DocProcess {
  44. DocProcess()
  45. : src_type(""),
  46. tgt_type(""),
  47. sheet_id(1),
  48. start_page(1),
  49. end_page(-1),
  50. image_params(""),
  51. doc_passwd(""),
  52. comments(0),
  53. paper_direction(0),
  54. quality(100),
  55. zoom(100) {}
  56. std::string src_type; // 源数据的后缀类型
  57. std::string tgt_type; // 转换输出目标文件类型
  58. int sheet_id; // 表格文件参数
  59. int start_page; // 从第 X 页开始转换
  60. int end_page; // 转换至第 X 页
  61. int page_size; //
  62. std::string image_params; // 转换后的图片处理参数
  63. std::string doc_passwd; // Office 文档的打开密码
  64. int comments; // 是否隐藏批注和应用修订,默认为0
  65. int paper_direction; // 表格文件转换纸张方向,0代表垂直方向,非0代表水平方向,默认为0
  66. int quality; // 生成预览图的图片质量,取值范围 [1-100],默认值100。
  67. // 例:值为100,代表生成图片质量为100%
  68. int zoom; // 预览图片的缩放参数
  69. std::string to_string() const {
  70. std::stringstream ss;
  71. ss << "src_type: " << src_type << ", tgt_type: " << tgt_type
  72. << ", sheet_id: " << sheet_id << ", start_page: " << start_page
  73. << ", end_page: " << end_page << ", page_size: " << page_size
  74. << ", image_params: " << image_params << ", doc_passwd: " << doc_passwd
  75. << ", comments: " << comments << ", paper_direction: " << paper_direction
  76. << ", quality: " << quality << ", zoom: " << zoom;
  77. return ss.str();
  78. }
  79. };
  80. struct PageInfo {
  81. PageInfo()
  82. : page_no(0), tgt_uri(""), x_sheet_pics(0), pic_index(0), pic_num(0) {}
  83. int page_no; // 预览产物页码,源文件为 Excel 格式时表示 SheetId
  84. std::string tgt_uri; // 预览产物生成的 cos 桶路径
  85. int x_sheet_pics; // 当前 Sheet 生成的图片总数(源文件为 Excel 特有参数)
  86. int pic_index; // 当前预览产物在整个源文件中的序号(源文件为 Excel 特有参数)
  87. int pic_num; // 当前预览产物在 Sheet 中的序号(源文件为 Excel 特有参数)
  88. std::string to_string() const {
  89. std::stringstream ss;
  90. ss << "page_no: " << page_no << ", tgt_uri: " << tgt_uri
  91. << ", x_sheet_pics: " << x_sheet_pics << ", pic_index: " << pic_index
  92. << ", pic_num: " << pic_num;
  93. return ss.str();
  94. }
  95. };
  96. struct DocProcessResult {
  97. DocProcessResult()
  98. : tgt_type(""),
  99. total_pageount(0),
  100. succ_pagecount(0),
  101. fail_pagecount(0),
  102. total_sheetcount(0) {}
  103. std::vector<PageInfo> page_infos; // 预览任务产物详情
  104. std::string tgt_type; // 预览产物目标格式
  105. std::string task_id; //
  106. int total_pageount; // 预览任务产物的总数
  107. int succ_pagecount; // 预览任务产物的成功数
  108. int fail_pagecount; // 预览任务产物的失败数
  109. int total_sheetcount; // 预览任务的 Sheet 总数(源文件为 Excel 特有参数)
  110. std::string to_string() const {
  111. std::stringstream ss;
  112. for (auto& page_info : page_infos) {
  113. ss << ", page_info: " << page_info.to_string();
  114. }
  115. ss << ", tgt_type: " << tgt_type << ", task_id: " << task_id
  116. << ", total_pageount: " << total_pageount
  117. << ", succ_pagecount: " << succ_pagecount
  118. << ", fail_pagecount: " << fail_pagecount
  119. << ", total_sheetcount: " << total_sheetcount;
  120. return ss.str();
  121. }
  122. };
  123. struct Operation {
  124. Output output; // 当 Tag 为 DocProcess 时有效,指定该任务的参数
  125. DocProcess doc_process; // 结果输出地址
  126. DocProcessResult
  127. doc_process_result; // 在 job 的类型为 DocProcess 且 job 状态为 success
  128. // 时,返回文档预览任务结果详情
  129. std::string to_string() const {
  130. std::stringstream ss;
  131. ss << "output: " << output.to_string()
  132. << ", doc_process: " << doc_process.to_string()
  133. << ", doc_process_result: " << doc_process_result.to_string();
  134. return ss.str();
  135. }
  136. };
  137. struct CodeLocation {
  138. std::vector<std::string> points; // 二维码坐标点
  139. std::string to_string() const {
  140. std::stringstream ss;
  141. for (auto& point : points) {
  142. ss << ", point: " << point;
  143. }
  144. ss << std::endl;
  145. return ss.str();
  146. }
  147. };
  148. struct QRcodeInfo {
  149. std::string code_url; // 二维码的内容。可能识别不出
  150. CodeLocation code_location; // 图中识别到的二维码位置坐标
  151. std::string to_string() const {
  152. std::stringstream ss;
  153. ss << "code_url: " << code_url
  154. << ", code_location: " << code_location.to_string() << std::endl;
  155. return ss.str();
  156. }
  157. };
  158. struct GetQRcodeResult {
  159. int code_status; // 二维码识别结果。0表示未识别到二维码,1表示识别到二维码
  160. std::vector<QRcodeInfo> qr_code_info; // 二维码识别结果,可能有多个
  161. std::string
  162. result_image; // 处理后的图片 base64数据,请求参数 cover 为1时返回
  163. std::string to_string() const {
  164. std::stringstream ss;
  165. ss << "code_status: " << code_status;
  166. for (auto& qr_code : qr_code_info) {
  167. ss << "qr_code: " << qr_code.to_string();
  168. }
  169. ss << "result_image: " << result_image << std::endl;
  170. return ss.str();
  171. }
  172. };
  173. struct Object {
  174. std::string key; // 文件名
  175. std::string location; // 图片路径
  176. std::string format; // 图片格式
  177. int width; // 图片宽度
  178. int height; // 图片高度
  179. int size; // 图片大小
  180. int quality; // 图片质量
  181. std::string etag; // 处理结果图 ETag 信息
  182. int code_status; // 二维码识别结果。0表示未识别到二维码,1表示识别到二维码
  183. int watermark_status; // 当 type
  184. // 为2时返回该字段,表示提取到全盲水印的可信度。
  185. // 具体为0-100的数字,75分以上表示确定有盲水印,60-75表示疑似有盲水印,60以下可认为未提取到盲水印
  186. std::vector<QRcodeInfo> qr_code_info; // 二维码识别结果,可能有多个
  187. std::string to_string() const {
  188. std::stringstream ss;
  189. ss << "key: " << key << ", location: " << location << ", format: " << format
  190. << ", width: " << width << ", heihth: " << height << ", size: " << size
  191. << ", quality: " << quality << ", etag: " << etag
  192. << ", watermark_status: " << watermark_status;
  193. for (auto& qr_code : qr_code_info) {
  194. ss << "qr_code: " << qr_code.to_string();
  195. }
  196. ss << std::endl;
  197. return ss.str();
  198. }
  199. };
  200. struct ProcessResults {
  201. std::vector<Object> objects; // 可能有多个对象
  202. std::string to_string() const {
  203. std::stringstream ss;
  204. for (auto& object : objects) {
  205. ss << "object: " << object.to_string();
  206. }
  207. ss << std::endl;
  208. return ss.str();
  209. }
  210. };
  211. struct ImageInfo {
  212. std::string format; // 格式
  213. int width; // 图片宽度
  214. int height; // 图片高度
  215. int quality; // 图片质量
  216. std::string ave; // 图片主色调
  217. int orientation; // 图片旋转角度
  218. std::string to_string() const {
  219. std::stringstream ss;
  220. ss << "format: " << format << ", width: " << width << ", heihth: " << height
  221. << ", quality: " << quality << ", ave: " << ave
  222. << ", orientation: " << orientation << std::endl;
  223. return ss.str();
  224. }
  225. };
  226. struct OriginalInfo {
  227. std::string key; // 原图文件名
  228. std::string location; // 图片路径
  229. ImageInfo image_info; // 原图图片信息
  230. std::string etag; // 原图 ETag 信息
  231. std::string to_string() const {
  232. std::stringstream ss;
  233. ss << "key: " << key << ", location: " << location
  234. << ", image_info: " << image_info.to_string() << ", etag: " << etag
  235. << std::endl;
  236. return ss.str();
  237. }
  238. };
  239. struct UploadResult {
  240. OriginalInfo original_info; // 原图信息
  241. ProcessResults process_result; // 图片处理结果
  242. std::string to_string() const {
  243. std::stringstream ss;
  244. ss << "original_info: " << original_info.to_string()
  245. << ", process_result: " << process_result.to_string() << std::endl;
  246. return ss.str();
  247. }
  248. };
  249. struct PicRules {
  250. std::string bucket; // 存储结果的目标存储桶名称,格式为
  251. // BucketName-APPID,如果不指定的话默认保存到当前存储桶
  252. std::string
  253. fileid; // 处理结果的文件路径名称,如以/开头,则存入指定文件夹中,否则,存入原图文件存储的同目录
  254. std::string
  255. rule; // 处理参数,参见对象存储图片处理
  256. // API。若按指定样式处理,则以style/开头,后加样式名,如样式名为test,则
  257. // rule 字段为style/test
  258. };
  259. class PicOperation {
  260. public:
  261. PicOperation() : is_pic_info(true) {}
  262. virtual ~PicOperation() {}
  263. std::vector<PicRules> GetRules() const { return rules; }
  264. void AddRule(const PicRules& rule) { rules.push_back(rule); }
  265. void TurnOffPicInfo() { is_pic_info = false; }
  266. std::string GenerateJsonString() const {
  267. Poco::JSON::Object::Ptr json_root = new Poco::JSON::Object();
  268. if (is_pic_info) {
  269. json_root->set("is_pic_info", 1);
  270. } else {
  271. json_root->set("is_pic_info", 0);
  272. }
  273. Poco::JSON::Array rules_array;
  274. for (auto& it : rules) {
  275. Poco::JSON::Object::Ptr rule = new Poco::JSON::Object();
  276. if (!it.bucket.empty()) {
  277. rule->set("bucket", it.bucket);
  278. }
  279. rule->set("fileid", it.fileid);
  280. rule->set("rule", it.rule);
  281. rules_array.add(rule);
  282. }
  283. json_root->set("rules", rules_array);
  284. std::ostringstream oss;
  285. Poco::JSON::Stringifier::stringify(json_root, oss);
  286. return oss.str();
  287. }
  288. private:
  289. bool
  290. is_pic_info; // 是否返回原图信息,0不返回原图信息,1返回原图信息,默认为0
  291. std::vector<PicRules>
  292. rules; //处理规则,一条规则对应一个处理结果(目前支持五条规则),不填则不进行图片处理
  293. };
  294. struct BucketInfo {
  295. std::string bucket_id; // 存储桶 ID
  296. std::string name; // 存储桶名称,同 BucketId
  297. std::string region; // 所在的地域
  298. std::string create_time; // 创建时间
  299. std::string alias_bucket_id; // 存储桶别名
  300. std::string to_string() const {
  301. std::stringstream ss;
  302. ss << "bucket_id: " << bucket_id << ", name: " << name
  303. << ", region: " << region << ", create_time: " << create_time
  304. << ", alias_bucket_id: " << alias_bucket_id;
  305. return ss.str();
  306. }
  307. };
  308. struct CreateDocBucketResult {
  309. std::string request_id; // 请求的唯一ID
  310. BucketInfo doc_bucket; // 媒体Bucket
  311. std::string to_string() const {
  312. std::stringstream ss;
  313. ss << "request_id: " << request_id << std::endl;
  314. ss << doc_bucket.to_string() << std::endl;
  315. ss << std::endl;
  316. return ss.str();
  317. }
  318. };
  319. struct DocBucketResponse {
  320. std::string request_id; // 请求的唯一 ID
  321. int total_count; // 文档预览 Bucket 总数
  322. int page_number; // 当前页数,同请求中的 pageNumber
  323. int page_size; // 每页个数,同请求中的 pageSize
  324. std::vector<BucketInfo> doc_bucket_list; // 文档预览 Bucket 列表
  325. std::string to_string() const {
  326. std::stringstream ss;
  327. ss << "request_id: " << request_id << ", total_count: " << total_count
  328. << ", page_number: " << page_number << ", page_size: " << page_size;
  329. for (auto& bucket : doc_bucket_list) {
  330. ss << ", bucket: " << bucket.to_string();
  331. }
  332. ss << std::endl;
  333. return ss.str();
  334. }
  335. };
  336. struct JobsDetail {
  337. JobsDetail() {}
  338. std::string code; // 错误码,只有 State 为 Failed 时有意义
  339. std::string message; // 错误描述,只有 State 为 Failed 时有意义
  340. std::string job_id; // 新创建任务的 ID
  341. std::string tag; // 新创建任务的 Tag:DocProcess
  342. std::string state; // 任务的状态,为
  343. // Submitted、Running、Success、Failed、Pause、Cancel 其中一个
  344. std::string create_time; // 任务的创建时间
  345. std::string end_time; //
  346. std::string queue_id; // 任务所属的队列 ID
  347. Input input; // 该任务的输入文件路径
  348. Operation operation; // 文档该任务的规则
  349. std::string to_string() const {
  350. std::stringstream ss;
  351. ss << "code: " << code << ", message: " << message << ", job_id: " << job_id
  352. << ", tag: " << tag << ", state: " << state
  353. << ", create_time: " << create_time << ", end_time: " << end_time
  354. << ", queue_id: " << queue_id << ". input: " << input.to_string()
  355. << ", operation: " << operation.to_string();
  356. return ss.str();
  357. }
  358. };
  359. struct NotifyConfig {
  360. std::string url; // 回调地址
  361. std::string state; // 开关状态,On 或者 Off
  362. std::string type; // 回调类型,Url
  363. std::string event; // 触发回调的事件
  364. std::string to_string() const {
  365. std::stringstream ss;
  366. ss << "url: " << url << ", state: " << state << ", type: " << type
  367. << ", event: " << event;
  368. return ss.str();
  369. }
  370. };
  371. struct NonExistPIDs {
  372. std::vector<std::string> queue_id; // NonExistPIDs
  373. std::string to_string() const {
  374. std::stringstream ss;
  375. for (auto& q : queue_id) {
  376. ss << ", queue_id: " << q;
  377. }
  378. return ss.str();
  379. }
  380. };
  381. struct QueueList {
  382. std::string queue_id; // 队列 ID
  383. std::string name; // 队列名字
  384. std::string state; // 当前状态,Active 或者 Paused
  385. NotifyConfig notify_config; // 回调配置
  386. int max_size; // 队列最大长度
  387. int max_concurrent; // 当前队列最大并行执行的任务数
  388. std::string update_time; // 更新时间
  389. std::string create_time; // 创建时间
  390. std::string bucket_id; //
  391. std::string category; //
  392. std::string to_string() const {
  393. std::stringstream ss;
  394. ss << "queue_id: " << queue_id << ", name: " << name << ", state: " << state
  395. << ", notify_config: " << notify_config.to_string()
  396. << ", max_size: " << max_size << ", max_concurrent: " << max_concurrent
  397. << ", update_time: " << update_time << ", create_time: " << create_time
  398. << ". bucket_id: " << bucket_id << ", category: " << category;
  399. return ss.str();
  400. }
  401. };
  402. struct DescribeMediaBucketsResult {
  403. std::string request_id; // 请求的唯一ID
  404. int total_count; // 媒体Bucket总数
  405. int page_number; // 当前页数
  406. int page_size; // 每页个数
  407. std::vector<BucketInfo> media_bucket_list; // 媒体Bucket列表
  408. std::string to_string() const {
  409. std::stringstream ss;
  410. ss << "request_id: " << request_id << std::endl
  411. << "total_count: " << total_count << std::endl
  412. << "page_number: " << page_number << std::endl
  413. << "page_size: " << page_size << std::endl;
  414. for (auto& bucket : media_bucket_list) {
  415. ss << bucket.to_string() << std::endl;
  416. }
  417. ss << std::endl;
  418. return ss.str();
  419. }
  420. };
  421. struct CreateMediaBucketResult {
  422. std::string request_id; // 请求的唯一ID
  423. BucketInfo media_bucket; // 媒体Bucket
  424. std::string to_string() const {
  425. std::stringstream ss;
  426. ss << "request_id: " << request_id << std::endl;
  427. ss << media_bucket.to_string() << std::endl;
  428. ss << std::endl;
  429. return ss.str();
  430. }
  431. };
  432. struct VideoInfo {
  433. int index; // 该流的编号
  434. std::string codec_name; // 编解码格式名字
  435. std::string codec_long_name; // 编解码格式的详细名字
  436. std::string codec_time_base; // 编码时基
  437. std::string codec_tag_string; // 编码标签名
  438. std::string codec_tag; // 编码标签
  439. std::string color_primaries; // 色原
  440. std::string color_range; // 色彩范围
  441. std::string color_transfer; // 色彩通道
  442. std::string profile; // 视频编码档位
  443. int height; // 视频高,单位 px
  444. int width; // 视频宽,单位 px
  445. int has_bframe; // 是否有B帧。1表示有,0表示无
  446. int ref_frames; // 视频编码的参考帧个数
  447. std::string sar; // 采样宽高比
  448. std::string dar; // 显示宽高比
  449. std::string pix_format; // 像素格式
  450. std::string field_order; // 场的顺序
  451. int level; // 视频编码等级
  452. int fps; // 视频帧率
  453. std::string avg_fps; // 平均帧率
  454. std::string time_base; // 时基
  455. float start_time; // 视频开始时间,单位为秒
  456. float duration; // 视频时长,单位为秒
  457. float bitrate; // 比特率,单位为 kbps
  458. int num_frames; // 总帧数
  459. std::string language; // 语言
  460. std::string to_string() const {
  461. std::stringstream ss;
  462. ss << "index: " << index << std::endl
  463. << "codec_name: " << codec_name << std::endl
  464. << "codec_long_name: " << codec_long_name << std::endl
  465. << "codec_time_base: " << codec_time_base << std::endl
  466. << "codec_tag_string: " << codec_tag_string << std::endl
  467. << "codec_tag: " << codec_tag << std::endl
  468. << "color_primaries: " << color_primaries << std::endl
  469. << "color_transfer: " << color_transfer << std::endl
  470. << "color_range: " << color_range << std::endl
  471. << "profile: " << profile << std::endl
  472. << "height: " << height << std::endl
  473. << "width: " << width << std::endl
  474. << "has_bframe: " << has_bframe << std::endl
  475. << "ref_frames: " << ref_frames << std::endl
  476. << "sar: " << sar << std::endl
  477. << "dar: " << dar << std::endl
  478. << "pix_format: " << pix_format << std::endl
  479. << "field_order: " << field_order << std::endl
  480. << "level: " << level << std::endl
  481. << "fps: " << fps << std::endl
  482. << "avg_fps: " << avg_fps << std::endl
  483. << "time_base: " << time_base << std::endl
  484. << "start_time: " << start_time << std::endl
  485. << "duration: " << duration << std::endl
  486. << "bitrate: " << bitrate << std::endl
  487. << "num_frames: " << num_frames << std::endl
  488. << "language: " << language << std::endl;
  489. return ss.str();
  490. }
  491. };
  492. struct AudioInfo {
  493. int index; // 该流的编号
  494. std::string codec_name; // 编解码格式名字
  495. std::string codec_long_name; // 编解码格式的详细名字
  496. std::string codec_time_base; // 编码时基
  497. std::string codec_tag_string; // 编码标签名
  498. std::string codec_tag; // 编码标签
  499. std::string sample_fmt; // 采样格式
  500. int sample_rate; // 采样率
  501. int channel; // 通道数量
  502. std::string channel_layout; // 通道格式
  503. std::string time_base; // 时基
  504. float start_time; // 音频开始时间,单位秒
  505. float duration; // 音频时长,单位秒
  506. float bitrate; // 比特率,单位为 kbps
  507. std::string language; // 语言
  508. std::string to_string() const {
  509. std::stringstream ss;
  510. ss << "index: " << index << std::endl
  511. << "codec_name: " << codec_name << std::endl
  512. << "codec_long_name: " << codec_long_name << std::endl
  513. << "codec_time_base: " << codec_time_base << std::endl
  514. << "codec_tag_string: " << codec_tag_string << std::endl
  515. << "codec_tag: " << codec_tag << std::endl
  516. << "sample_fmt: " << sample_fmt << std::endl
  517. << "sample_rate: " << sample_rate << std::endl
  518. << "channel: " << channel << std::endl
  519. << "channel_layout: " << channel_layout << std::endl
  520. << "time_base: " << time_base << std::endl
  521. << "start_time: " << start_time << std::endl
  522. << "duration: " << duration << std::endl
  523. << "bitrate: " << bitrate << std::endl
  524. << "language: " << language << std::endl;
  525. return ss.str();
  526. }
  527. };
  528. struct SubtitleInfo {
  529. int index; // 该流的编号
  530. std::string language; // 语言
  531. std::string to_string() const {
  532. std::stringstream ss;
  533. ss << "index: " << index << std::endl
  534. << "language: " << language << std::endl;
  535. return ss.str();
  536. }
  537. };
  538. struct StreamInfo {
  539. VideoInfo video; // 视频信息
  540. AudioInfo audio; // 音频信息
  541. SubtitleInfo subtitle; // 字幕信息
  542. std::string to_string() const {
  543. std::stringstream ss;
  544. ss << "video: " << video.to_string() << std::endl
  545. << "audio: " << audio.to_string() << std::endl
  546. << "subtitle: " << subtitle.to_string() << std::endl;
  547. return ss.str();
  548. }
  549. };
  550. struct FormatInfo {
  551. int num_stream; // Stream(包含 Video、Audio、Subtitle)的数量
  552. int num_program; // 节目的数量
  553. std::string format_name; // 容器格式名字
  554. std::string format_long_name; // 容器格式的详细名字
  555. float start_time; //起始时间,单位为秒
  556. float duration; //时长,单位为秒
  557. float bitrate; //比特率,单位为 kbps
  558. int size; //大小,单位为 Byte
  559. std::string to_string() const {
  560. std::stringstream ss;
  561. ss << "num_stream: " << num_stream << std::endl
  562. << "num_program: " << num_program << std::endl
  563. << "format_name: " << format_name << std::endl
  564. << "format_long_name: " << format_long_name << std::endl
  565. << "start_time: " << start_time << std::endl
  566. << "duration: " << duration << std::endl
  567. << "bitrate: " << bitrate << std::endl
  568. << "size: " << size << std::endl;
  569. return ss.str();
  570. }
  571. };
  572. struct MediaInfo {
  573. StreamInfo stream; // 流信息
  574. FormatInfo format; // 格式信息
  575. std::string to_string() const {
  576. std::stringstream ss;
  577. ss << "stream: " << stream.to_string() << std::endl
  578. << "format: " << format.to_string() << std::endl;
  579. return ss.str();
  580. }
  581. };
  582. struct GetMediaInfoResult {
  583. MediaInfo media_info; // 媒体信息
  584. std::string to_string() const {
  585. std::stringstream ss;
  586. ss << "media_info: " << media_info.to_string() << std::endl;
  587. return ss.str();
  588. }
  589. };
  590. struct Md5Info {
  591. Md5Info() : object_name(""), md5("") {}
  592. std::string object_name;
  593. std::string md5;
  594. std::string to_string() const {
  595. std::stringstream ss;
  596. ss << "md5: " << md5 << std::endl
  597. << "object_name: " << object_name << std::endl;
  598. return ss.str();
  599. }
  600. };
  601. struct OutputFile {
  602. OutputFile() : bucket(""), region(""), object_name(""), md5_info() {}
  603. std::string bucket;
  604. std::string region;
  605. std::string object_name;
  606. Md5Info md5_info;
  607. std::string to_string() const {
  608. std::stringstream ss;
  609. ss << "bucket: " << bucket << std::endl
  610. << "region: " << region << std::endl
  611. << "object_name: " << object_name << std::endl
  612. << "md5_info: " << md5_info.to_string() << std::endl;
  613. return ss.str();
  614. }
  615. };
  616. struct MediaResult {
  617. MediaResult() : output_file() {}
  618. OutputFile output_file;
  619. std::string to_string() const {
  620. std::stringstream ss;
  621. ss << "output_file: " << output_file.to_string() << std::endl;
  622. return ss.str();
  623. }
  624. };
  625. struct CallBackkMqConfig {
  626. CallBackkMqConfig() :
  627. mq_region(""),
  628. mq_mode(""),
  629. mq_name("") {}
  630. std::string mq_region;
  631. std::string mq_mode;
  632. std::string mq_name;
  633. };
  634. struct SpriteSnapShotConfig {
  635. SpriteSnapShotConfig() :
  636. cell_width(""),
  637. cell_height(""),
  638. padding(""),
  639. margin(""),
  640. color(""),
  641. columns(""),
  642. lines(""),
  643. scale_method("") {}
  644. std::string cell_width; // 单图宽度,非必选,值范围:[8,4096],单位:px,默认原视频宽度
  645. std::string cell_height; // 单图高度,非必选,值范围:[8,4096],单位:px,默认原视频高度
  646. std::string padding; // 雪碧图内边距大小,非必选,值范围:[0,1024],单位:px,默认0
  647. std::string margin; // 雪碧图外边距大小,非必选,值范围:[0,1024],单位:px,默认0
  648. std::string color; // 背景颜色,非必选,支持颜色详见https://www.ffmpeg.org/ffmpeg-utils.html#color-syntax
  649. std::string columns; // 雪碧图列数,非必选,值范围:[1,10000]
  650. std::string lines; // 雪碧图行数,值范围:[1,10000]
  651. std::string scale_method; // 雪碧图缩放模式,非必选,取值范围为 DirectScale: 指定宽高缩放,MaxWHScaleAndPad: 指定最大宽高缩放填充,MaxWHScale: 指定最大宽高缩放,默认值为DirectScale,主动设置 CellWidth 和CellHeight 时生效
  652. std::string to_string() const {
  653. std::stringstream ss;
  654. ss << "cell_width: " << cell_width << std::endl
  655. << "cell_height: " << cell_height << std::endl
  656. << "padding: " << padding << std::endl
  657. << "margin: " << margin << std::endl
  658. << "color: " << color << std::endl
  659. << "columns: " << columns << std::endl
  660. << "lines: " << lines << std::endl
  661. << "scale_method: " << scale_method << std::endl;
  662. return ss.str();
  663. }
  664. };
  665. struct Snapshot {
  666. Snapshot() :
  667. mode(""),
  668. start(""),
  669. time_interval(""),
  670. count(""),
  671. width(""),
  672. height(""),
  673. ci_param(""),
  674. is_check_black(""),
  675. is_check_count(""),
  676. black_level(""),
  677. pixel_black_threshold(""),
  678. snap_shot_out_mode(""),
  679. sprite_snapshot_config() {}
  680. std::string mode; // 截图模式,非必选,取值范围:Interval 间隔模式、Average 平均模式、 KeyFrame 关键帧模式,默认值 Interval
  681. std::string start; // 开始时间,非必选,单位秒,默认0,支持float格式,当 Mode 为 Interval、Average 时生效
  682. std::string time_interval; // 截图时间间隔,非必选,单位秒,取值范围(0, 3600],支持float格式,当 Mode 为 Interval 时生效
  683. std::string count; // 截图数量,必选,取值范围(0,10000]
  684. std::string width; // 宽,取值范围[128,4096],单位px,若只设置 Width 时,按照视频原始比例计算 Height,默认原视频宽
  685. std::string height; // 高,取值范围[128,4096],单位px,若只设置 Height 时,按照视频原始比例计算 Width,默认原视频高
  686. std::string ci_param; // 图片处理参数,非必选,参考 https://cloud.tencent.com/document/product/460/36540
  687. std::string is_check_black; // 是否开启黑屏检测,非必选,取值 true、false,默认false
  688. std::string is_check_count; // 是否强制检查截图个数,非必选,取值 true、false,默认false,使用自定义间隔模式截图时,视频时长不够截取 Count 个截图,可以转为平均截图模式截取 Count 个截图
  689. std::string black_level; // 截图黑屏检测参数,非必选,当 IsCheckBlack=true 时有效,值参考范围[30,100],表示黑色像素的占比值,值越小,黑色占比越小;Start>0,参数设置无效,不做过滤黑屏;Start=0 参数有效,截帧的开始时间为第一帧非黑屏开始
  690. std::string pixel_black_threshold; // 截图黑屏检测参数,非必选,当 IsCheckBlack=true 时有效 判断像素点是否为黑色点的阈值,取值范围:[0,255]
  691. std::string snap_shot_out_mode; // 截图输出模式参数,非必选,取值范围为 OnlySnapshot 仅输出截图模式,OnlySprite 仅输出雪碧图模式,SnapshotAndSprite 输出截图与雪碧图模式,默认值 OnlySnapshot
  692. SpriteSnapShotConfig sprite_snapshot_config; // 雪碧图输出配置,非必选
  693. std::string to_string() const {
  694. std::stringstream ss;
  695. ss << "mode: " << mode << std::endl
  696. << "start: " << start << std::endl
  697. << "time_interval: " << time_interval << std::endl
  698. << "count: " << count << std::endl
  699. << "width: " << width << std::endl
  700. << "height: " << height << std::endl
  701. << "ci_param: " << ci_param << std::endl
  702. << "is_check_black: " << is_check_black << std::endl
  703. << "black_level: " << black_level << std::endl
  704. << "pixel_black_threshold: " << pixel_black_threshold << std::endl
  705. << "snap_shot_out_mode: " << snap_shot_out_mode << std::endl
  706. << "sprite_snapshot_config: " << sprite_snapshot_config.to_string() << std::endl;
  707. return ss.str();
  708. }
  709. };
  710. struct FileUncompressConfig {
  711. FileUncompressConfig() :
  712. prefix(""),
  713. un_compress_key(""),
  714. prefix_replaced("") {}
  715. std::string prefix;
  716. std::string un_compress_key;
  717. std::string prefix_replaced;
  718. std::string to_string() const {
  719. std::stringstream ss;
  720. ss << "prefix: " << prefix << std::endl
  721. << "prefix_replaced: " << prefix_replaced << std::endl
  722. << "un_compress_key: " << un_compress_key << std::endl;
  723. return ss.str();
  724. }
  725. };
  726. struct FileUncompressResult {
  727. FileUncompressResult () :
  728. region(""),
  729. bucket(""),
  730. file_count("") {};
  731. std::string region;
  732. std::string bucket;
  733. std::string file_count;
  734. std::string to_string() const {
  735. std::stringstream ss;
  736. ss << "region: " << region << std::endl
  737. << "bucket: " << bucket << std::endl
  738. << "file_count: " << file_count << std::endl;
  739. return ss.str();
  740. }
  741. };
  742. struct TimeInterval {
  743. TimeInterval () :
  744. start(""),
  745. duration("") {};
  746. std::string start; // 开始时间, 单位为秒,支持floar格式,默认0
  747. std::string duration; // 持续时间,单位为秒,支持float格式,默认原始视频时长
  748. std::string to_string() const {
  749. std::stringstream ss;
  750. ss << "start: " << start << std::endl
  751. << "duration: " << duration << std::endl;
  752. return ss.str();
  753. }
  754. };
  755. struct ClipConfig {
  756. ClipConfig () :
  757. duration("") {}
  758. std::string duration; // 分片时长,默认5s
  759. std::string to_string() const {
  760. std::stringstream ss;
  761. ss << "duration: " << duration << std::endl;
  762. return ss.str();
  763. }
  764. };
  765. struct Container {
  766. Container () :
  767. format(""),
  768. clip_config() {}
  769. std::string format; // 封装格式,不同任务类型取值范围不同,取值详见API接口文档
  770. ClipConfig clip_config; // 分片配置,当format为 hls 或 dash 时生效
  771. std::string to_string() const {
  772. std::stringstream ss;
  773. ss << "format: " << format << std::endl
  774. << "clip_config: " << clip_config.to_string() << std::endl;
  775. return ss.str();
  776. }
  777. };
  778. struct Video {
  779. Video () :
  780. codec(""),
  781. width(""),
  782. height(""),
  783. fps(""),
  784. remove("false"),
  785. profile(""),
  786. bit_rate(""),
  787. crf(""),
  788. gop(""),
  789. preset(""),
  790. buf_size(""),
  791. max_rate(""),
  792. pixfmt(""),
  793. long_short_mode(""),
  794. rotate(""),
  795. roi(""),
  796. crop(""),
  797. interlaced(""),
  798. animate_only_keep_key_frame(""),
  799. animate_time_interval_of_frame(""),
  800. animate_frames_per_second(""),
  801. quality("") {};
  802. std::string codec; // 编码格式,默认 H.264,不同任务类型取值范围不同,取值详情见API接口文档
  803. std::string width; // 宽,单位px,取值范围[128,4096],必须为偶数,默认为视频原始宽,若只设置 Width 时,按照视频原始比例计算 Height
  804. std::string height; // 高,单位px,取值范围[128,4096],必须为偶数,默认为视频原始高,若只设置 Height 时,按照视频原始比例计算 Width
  805. std::string fps; // 帧率,取值范围(0,60],单位fps
  806. std::string remove; // 是否删除视频流,取值 true 或 false,默认 false
  807. std::string profile; // 编码级别,当编码格式为 H.264 时支持此参数,取值范围支持 baseline、main、high、auto,详见 https://cloud.tencent.com/document/product/460
  808. std::string bit_rate; // 视频输出文件码率,取值范围[10.50000],单位Kbps,设置为 auto 表示自适应码率
  809. std::string crf; // 码率-质量控制因子,取值范围(0,51],如果设置了Crf,则BitRate失效,当BitRate为空时,Crf默认25
  810. std::string gop; // 关键帧间最大帧数,取值范围[1,100000]
  811. std::string preset; // 视频算法器预置,详见 https://cloud.tencent.com/document/product/460
  812. std::string buf_size; // 缓冲区大小,取值范围[1000,128000],单位Kb,Codec为 VP8/VP9 时不支持该参数
  813. std::string max_rate; // 视频码率峰值,取值范围[10,50000],单位Kbps,Codec为 VP8/VP9 时不支持该参数
  814. std::string pixfmt; // 视频颜色格式,Codec为H.264时支持 yuv420p、yuv422p、yuv444p、yuvj420p、yuvj422p、yuvj444p、auto,Codec为H.265支持:yuv420p、yuv420p10le、auto, Codec为 VP8/VP9/AV1 时不支持
  815. std::string long_short_mode; // 长短边自适应,取值 true或 false。Codec 为 VP8/VP9/AV1 时不支持此参数
  816. std::string rotate; // 旋转角度,值范围:[0, 360)
  817. std::string roi; // Roi 强度 取值为 none、low、medium、high Codec 为 VP8/VP9 时不支持此参数
  818. std::string crop; // 自由裁剪,自定义裁切: width:height:left:top。示例:1280:800:0:140,width和height的值需要大于0,left和top的值需要大于等于0
  819. std::string interlaced; // 开启隔行扫描,取值 false/true
  820. std::string animate_only_keep_key_frame; // 动图只保留关键帧,取值 true :AnimateTimeIntervalOfFrame 和 AnimateFramesPerSecond 无效; false:AnimateTimeIntervalOfFrame 和 AnimateFramesPerSecond 必填
  821. std::string animate_time_interval_of_frame; // 动图抽帧间隔时间 取值范围:(0,视频时长] 若设置 TimeInterval.Duration,则小于该值
  822. std::string animate_frames_per_second; // 每秒抽帧帧数,取值范围:(0,视频帧率)
  823. std::string quality; // 相对质量,取值范围[1,100),webp 图像质量设定生效,gif 没有质量参数
  824. std::string to_string() const {
  825. std::stringstream ss;
  826. ss << "codec: " << codec << std::endl
  827. << "width: " << width << std::endl
  828. << "height: " << height << std::endl
  829. << "remove: " << remove << std::endl
  830. << "profile: " << profile << std::endl
  831. << "bit_rate: " << bit_rate << std::endl
  832. << "crf: " << crf << std::endl
  833. << "gop: " << gop << std::endl
  834. << "preset: " << preset << std::endl
  835. << "buf_size: " << buf_size << std::endl
  836. << "max_rate: " << max_rate << std::endl
  837. << "pixfmt: " << pixfmt << std::endl
  838. << "long_short_mode: " << long_short_mode << std::endl
  839. << "rotate: " << rotate << std::endl
  840. << "roi: " << roi << std::endl
  841. << "crop: " << crop << std::endl
  842. << "interlaced: " << interlaced << std::endl
  843. << "animate_only_keep_key_freme: " << animate_only_keep_key_frame << std::endl
  844. << "animate_time_interval_of_frame: " << animate_time_interval_of_frame << std::endl
  845. << "animate_frames_per_second: " << animate_frames_per_second << std::endl
  846. << "quality: " << quality << std::endl;
  847. return ss.str();
  848. }
  849. };
  850. struct Audio {
  851. Audio() :
  852. codec(""),
  853. sample_rate(""),
  854. bit_rate(""),
  855. channels(""),
  856. remove(""),
  857. sample_format("") {};
  858. std::string codec; // 编解码格式,取值 aac、mp3、flac、amr、Vorbis、opus、pcm_s16le, 默认 aac
  859. std::string sample_rate; // 采样率,单位 Hz,取值 8000、11025、12000、16000、22050、24000、32000、44100、48000、88200、96000,默认 44100
  860. std::string bit_rate; // 原始音频码率,单位 Kbps,取值范围[8,1000]
  861. std::string channels; // 声道数
  862. std::string remove; // 是否删除音频流,取值 true/false,默认false
  863. std::string sample_format; // 采样位宽
  864. std::string to_string() const {
  865. std::stringstream ss;
  866. ss << "codec: " << codec << std::endl
  867. << "remove: " << remove << std::endl
  868. << "bit_rate: " << bit_rate << std::endl
  869. << "sample_rate: " << sample_rate << std::endl
  870. << "channels: " << channels << std::endl
  871. << "sample_format: " << sample_format << std::endl;
  872. return ss.str();
  873. }
  874. };
  875. struct HlsEncrypt {
  876. HlsEncrypt() :
  877. is_hls_encrypt(""),
  878. url_key("") {};
  879. std::string is_hls_encrypt; // 是否开启 HLS 加密,取值 true、false 当 Container.Format 为 hls 时支持加密
  880. std::string url_key; // HLS 加密的 key,当 IsHlsEncrypt 为 true 时,该参数才有意义
  881. std::string to_string() const {
  882. std::stringstream ss;
  883. ss << "is_hls_encrypt: " << is_hls_encrypt << std::endl
  884. << "url_key: " << url_key << std::endl;
  885. return ss.str();
  886. }
  887. };
  888. struct DashEncrypt {
  889. DashEncrypt() :
  890. is_encrypt(""),
  891. url_key("") {};
  892. std::string is_encrypt; // 是否开启 DASH 加密,取值 true、false 当 Container.Format 为 dash 时支持加密
  893. std::string url_key; // DASH 加密的 key 当 IsEncrypt 为 true 时,该参数才有意义
  894. std::string to_string() const {
  895. std::stringstream ss;
  896. ss << "is_encrypt: " << is_encrypt << std::endl
  897. << "url_key: " << url_key << std::endl;
  898. return ss.str();
  899. }
  900. };
  901. struct TransConfig {
  902. TransConfig() :
  903. adj_dar_method(""),
  904. is_check_reso(""),
  905. is_check_video_bit_rate(""),
  906. video_bit_rate_adj_method(""),
  907. is_check_audio_bit_rate(""),
  908. audio_bit_rate_adj_method(""),
  909. is_check_video_fps(""),
  910. video_fps_adj_method(""),
  911. delete_meta_data(""),
  912. is_hdr_2_sdr(""),
  913. transcode_index(""),
  914. hls_encrypt(),
  915. dash_encrypt() {}
  916. std::string adj_dar_method; // 分辨率调整方式,取值 scale、crop、pad、none
  917. std::string is_check_reso; // 是否检查分辨率,取值 true、false
  918. std::string reso_adj_method; // 分辨率调整方式,当 IsCheckReso 为 true 时生效,取值0、1;0 表示使用原视频分辨率,1 表示返回转码失败
  919. std::string is_check_video_bit_rate; // 是否检查视频码率,取值 true、false
  920. std::string video_bit_rate_adj_method; // 视频码率调整方式,IsCheckVideoBitrate 为 true 时生效,取值0、1;当输出视频码率大于原视频码率时,0表示使用原视频码率;1表示返回转码失败
  921. std::string is_check_audio_bit_rate; // 是否检查音频码率,取值 true、false
  922. std::string audio_bit_rate_adj_method; // 音频码率调整方式,IsCheckAudioBitrate 为 true 时生效,取值0、1; 当输出音频码率大于原音频码率时,0表示使用原音频码率;1表示返回转码失败
  923. std::string is_check_video_fps; // 是否检查视频帧率,取值 true、false
  924. std::string video_fps_adj_method; // 视频帧率调整方式 IsCheckVideoFps 为 true 时生效,取值0、1; 当输出视频帧率大于原视频帧率时,0表示使用原视频帧率;1表示返回转码失败
  925. std::string delete_meta_data; // 是否删除文件中的 MetaData 信息,取值 true、false
  926. std::string is_hdr_2_sdr; // 是否开启 HDR 转 SDR,取值 true、false
  927. std::string transcode_index; // 指定处理的流编号,对应媒体信息中的 Response.MediaInfo.Stream.Video.Index 和 Response.MediaInfo.Stream.Audio.Index,详见 https://cloud.tencent.com/document/product/460/49284#MediaInfo
  928. HlsEncrypt hls_encrypt; // hls 加密配置
  929. DashEncrypt dash_encrypt; // dash 加密配置
  930. std::string to_string() const {
  931. std::stringstream ss;
  932. ss << "adj_dar_method: " << adj_dar_method << std::endl
  933. << "is_check_reso: " << is_check_reso << std::endl
  934. << "reso_adj_method: " << reso_adj_method << std::endl
  935. << "is_check_video_bit_rate: " << is_check_video_bit_rate << std::endl
  936. << "video_bit_rate_adj_method: " << video_bit_rate_adj_method << std::endl
  937. << "is_check_audio_bit_rate: " << is_check_audio_bit_rate << std::endl
  938. << "audio_bit_rate_adj_method: " << audio_bit_rate_adj_method << std::endl
  939. << "is_check_video_fps: " << is_check_video_fps << std::endl
  940. << "video_fps_adj_method: " << video_fps_adj_method << std::endl
  941. << "delete_meta_data: " << delete_meta_data << std::endl
  942. << "is_hdr_2_sdr: " << is_hdr_2_sdr << std::endl
  943. << "trans_code_index: " << transcode_index << std::endl
  944. << "hls_encrypt: " << hls_encrypt.to_string() << std::endl
  945. << "interdash_encryptlaced: " << dash_encrypt.to_string() << std::endl;
  946. return ss.str();
  947. }
  948. };
  949. struct EffectConfig {
  950. EffectConfig() :
  951. enable_start_fade_in(""),
  952. start_fade_in_time(""),
  953. enable_end_fade_out(""),
  954. end_fade_out_time(""),
  955. enable_bgm_fade(""),
  956. bgm_fade_time("") {};
  957. std::string enable_start_fade_in; // 开始淡出,取值 true/false,默认false
  958. std::string start_fade_in_time; // 淡入时长,大于0,支持浮点数
  959. std::string enable_end_fade_out; // 开始淡出,取值 true/false,默认false
  960. std::string end_fade_out_time; // 淡出时长,大于0,支持浮点数
  961. std::string enable_bgm_fade; // 开始 bgm 转换淡入,取值 true/false,默认 false
  962. std::string bgm_fade_time; // bgm 转换淡入时长,大于0,支持浮点数
  963. std::string to_string() const {
  964. std::stringstream ss;
  965. ss << "enable_start_fade_in: " << enable_start_fade_in << std::endl
  966. << "start_fade_in_time: " << start_fade_in_time << std::endl
  967. << "enable_end_fade_out: " << enable_end_fade_out << std::endl
  968. << "end_fade_out_time: " << end_fade_out_time << std::endl
  969. << "enable_bgm_fade: " << enable_bgm_fade << std::endl
  970. << "bgm_fade_time: " << bgm_fade_time << std::endl;
  971. return ss.str();
  972. }
  973. };
  974. struct AudioMix {
  975. AudioMix() :
  976. audio_source(""),
  977. mix_mode(""),
  978. replace(""),
  979. effect_config() {};
  980. std::string audio_source; // 需要被混音的音轨媒体地址, 需要做 URLEncode, 需要和Input媒体文件在同一个bucket
  981. std::string mix_mode; // 混音模式,取值 Repeat 循环混音、Once 混音一次播放,默认Repeat
  982. std::string replace; // 是否用混音音轨媒体替换Input媒体文件的原音频,取值 true/false,默认 false
  983. EffectConfig effect_config; // 混音淡入淡出配置
  984. std::string to_string() const {
  985. std::stringstream ss;
  986. ss << "audio_source: " << audio_source << std::endl
  987. << "mix_mode: " << mix_mode << std::endl
  988. << "replace: " << replace << std::endl
  989. << "effect_config: " << effect_config.to_string() << std::endl;
  990. return ss.str();
  991. }
  992. };
  993. struct SlideConfig {
  994. SlideConfig() :
  995. slide_mode(""),
  996. x_slide_speed(""),
  997. y_slide_speed("") {};
  998. std::string slide_mode; // 滑动模式,取值 Default 默认不开启,ScrollFromLeft: 从左到右滚动,若设置了ScrollFromLeft模式,则Watermark.Pos参数不生效
  999. std::string x_slide_speed; // 横向滑动速度,取值范围:[0,10]内的整数,默认0
  1000. std::string y_slide_speed; // 纵向滑动速度,取值范围:[0,10]内的整数,默认0
  1001. std::string to_string() const {
  1002. std::stringstream ss;
  1003. ss << "slide_mode: " << slide_mode << std::endl
  1004. << "x_slide_speed: " << x_slide_speed << std::endl
  1005. << "y_slide_speed: " << y_slide_speed << std::endl;
  1006. return ss.str();
  1007. }
  1008. };
  1009. struct ImageWatermark {
  1010. ImageWatermark() :
  1011. url(""),
  1012. mode(""),
  1013. width(""),
  1014. height(""),
  1015. transparency(""),
  1016. backgroud("") {};
  1017. std::string url; // 水印图地址(需要 Urlencode 后传入)
  1018. std::string mode; // 尺寸模式,取值 Original:原有尺寸 Proportion:按比例 Fixed:固定大小
  1019. std::string width; // 宽,取值详见https://cloud.tencent.com/document/product/460/84725#Watermark
  1020. std::string height; // 高,取值详见https://cloud.tencent.com/document/product/460/84725#Watermark
  1021. std::string transparency; // 透明度,值范围:[1 100],单位%
  1022. std::string backgroud; // 是否背景图,取值 true、false
  1023. std::string to_string() const {
  1024. std::stringstream ss;
  1025. ss << "url: " << url << std::endl
  1026. << "mode: " << mode << std::endl
  1027. << "width: " << width << std::endl
  1028. << "height: " << height << std::endl
  1029. << "transparency: " << transparency << std::endl
  1030. << "backgroud: " << backgroud << std::endl;
  1031. return ss.str();
  1032. }
  1033. };
  1034. struct TextWatermark {
  1035. TextWatermark() :
  1036. font_size(""),
  1037. font_type(""),
  1038. font_color(""),
  1039. transparency(""),
  1040. text("") {}
  1041. std::string font_size; // 字体大小,值范围:[5 100],单位 px
  1042. std::string font_type; // 字体类型,详见https://cloud.tencent.com/document/product/460/84725#Watermark
  1043. std::string font_color; // 字体颜色,格式:0xRRGGBB
  1044. std::string transparency; // 透明度,值范围:[1 100],单位%
  1045. std::string text; // 水印内容,长度不超过64个字符,仅支持中文、英文、数字、_、-和*
  1046. std::string to_string() const {
  1047. std::stringstream ss;
  1048. ss << "font_size: " << font_size << std::endl
  1049. << "font_type: " << font_type << std::endl
  1050. << "font_color: " << font_color << std::endl
  1051. << "transparency: " << transparency << std::endl
  1052. << "text: " << text << std::endl;
  1053. return ss.str();
  1054. }
  1055. };
  1056. struct Watermark {
  1057. Watermark() :
  1058. type(""),
  1059. pos(""),
  1060. loc_mode(""),
  1061. dx(""),
  1062. dy(""),
  1063. start_time(""),
  1064. end_time(""),
  1065. slide_config(),
  1066. image(),
  1067. text() {};
  1068. std::string type; // 水印类型,取值 Text 文字水印,Image 图片水印
  1069. std::string pos; // 位置基准,取值 TopRight/TopLeft/BottomRight/BottomLeft/Left/Right/Top/Bottom/Center
  1070. std::string loc_mode; // 偏移方式,取值 Relativity 按比例,Absolute 固定位置
  1071. std::string dx; // 水平偏移,取值详见 https://cloud.tencent.com/document/product/460/84725#Watermark
  1072. std::string dy; // 垂直偏移,取值详见 https://cloud.tencent.com/document/product/460/84725#Watermark
  1073. std::string start_time; // 开始时间,取值[0,视频时长],单位秒,支持float格式,执行精度到毫秒
  1074. std::string end_time; // 结束时间,取值[0,视频时长],单位秒,支持float格式,执行精度到毫秒
  1075. SlideConfig slide_config; // 水印滑动配置,配置该参数后水印位移设置不生效,极速高清/H265转码暂时不支持该参数
  1076. ImageWatermark image; // 图片水印节点
  1077. TextWatermark text; // 文本水印节点
  1078. std::string to_string() const {
  1079. std::stringstream ss;
  1080. ss << "type: " << type << std::endl
  1081. << "pos: " << pos << std::endl
  1082. << "loc_mode: " << loc_mode << std::endl
  1083. << "dx: " << dx << std::endl
  1084. << "dy: " << dy << std::endl
  1085. << "start_time: " << start_time << std::endl
  1086. << "slide_config: " << slide_config.to_string() << std::endl
  1087. << "image: " << image.to_string() << std::endl
  1088. << "text: " << text.to_string() << std::endl;
  1089. return ss.str();
  1090. }
  1091. };
  1092. struct RemoveWatermark {
  1093. RemoveWatermark() :
  1094. dx(""),
  1095. dy(""),
  1096. width(""),
  1097. height("") {};
  1098. std::string dx; // 距离左上角原点 x 偏移,范围为[1, 4096]
  1099. std::string dy; // 距离左上角原点 y 偏移,范围为[1, 4096]
  1100. std::string width; // 宽,范围为[1, 4096]
  1101. std::string height; // 高,范围为[1, 4096]
  1102. std::string to_string() const {
  1103. std::stringstream ss;
  1104. ss << "width: " << width << std::endl
  1105. << "height: " << height << std::endl
  1106. << "dx: " << dx << std::endl
  1107. << "dy: " << dy << std::endl;
  1108. return ss.str();
  1109. }
  1110. };
  1111. struct Subtitle {
  1112. Subtitle() :
  1113. url("") {}
  1114. std::string url; // 同 bucket 的字幕地址,需要 encode
  1115. std::string to_string() const {
  1116. std::stringstream ss;
  1117. ss << "url: " << url << std::endl;
  1118. return ss.str();
  1119. }
  1120. };
  1121. struct Subtitles {
  1122. Subtitles() :
  1123. subtitle(std::vector<Subtitle>()) {};
  1124. std::vector<Subtitle> subtitle; // 字幕参数
  1125. std::string to_string() const {
  1126. std::stringstream ss;
  1127. ss << "subtitle: ";
  1128. for (std::vector<Subtitle>::const_iterator iter = subtitle.begin(); iter != subtitle.end(); iter++) {
  1129. ss << iter->to_string() << std::endl;
  1130. }
  1131. return ss.str();
  1132. }
  1133. };
  1134. struct DigitalWatermark {
  1135. DigitalWatermark() :
  1136. message(""),
  1137. type(""),
  1138. version(""),
  1139. ignore_error(""),
  1140. state("") {};
  1141. std::string message; // 嵌入数字水印的水印信息,长度不超过64个字符,仅支持中文、英文、数字、_、-和*
  1142. std::string type; // 数字水印类型,当前仅可设置为 Text
  1143. std::string version; // 数字水印版本,当前仅可设置为 V1
  1144. std::string ignore_error; // 当添加水印失败是否忽略错误继续执行任务,限制为 true/false,在非 DigitalWatermark 任务中生效
  1145. std::string state; // 添加水印是否成功,执行中为Running,成功为 Success,失败为 Failed,该字段不能主动设置,当任务提交成功时,会返回该字段
  1146. std::string to_string() const {
  1147. std::stringstream ss;
  1148. ss << "message: " << message << std::endl
  1149. << "type: " << type << std::endl
  1150. << "version: " << version << std::endl
  1151. << "ignore_error: " << ignore_error << std::endl
  1152. << "state: " << state << std::endl;
  1153. return ss.str();
  1154. }
  1155. };
  1156. struct ExtractDigitalWatermark {
  1157. ExtractDigitalWatermark() : type(""), version(""), message("") {}
  1158. std::string type; // 数字水印类型,当前仅可设置为 Text
  1159. std::string version; // 数字水印版本,当前仅可设置为 V1
  1160. std::string message; // 提取出的数字水印字符串信息
  1161. std::string to_string() const {
  1162. std::stringstream ss;
  1163. ss << "message: " << message << std::endl
  1164. << "type: " << type << std::endl
  1165. << "version: " << version << std::endl;
  1166. return ss.str();
  1167. }
  1168. };
  1169. struct Transcode {
  1170. Transcode():
  1171. time_interval(),
  1172. container(),
  1173. video(),
  1174. audio(),
  1175. trans_config(),
  1176. audio_mix(),
  1177. audio_mix_array(std::vector<AudioMix>()) {};
  1178. TimeInterval time_interval; // 时间区间
  1179. Container container; // 容器格式
  1180. Video video; // 视频信息
  1181. Audio audio; // 音频信息
  1182. TransConfig trans_config; // 转码配置
  1183. AudioMix audio_mix; // 混音参数
  1184. std::vector<AudioMix> audio_mix_array; // 混音参数,最多能传两个
  1185. std::string to_string() const {
  1186. std::stringstream ss;
  1187. ss << "time_interval: " << time_interval.to_string() << std::endl
  1188. << "container: " << container.to_string() << std::endl
  1189. << "video: " << video.to_string() << std::endl
  1190. << "audio: " << audio.to_string() << std::endl
  1191. << "trans_config: " << trans_config.to_string() << std::endl
  1192. << "audio_mix: " << audio_mix.to_string() << std::endl;
  1193. ss << "audio_mix_array: ";
  1194. for (std::vector<AudioMix>::const_iterator iter = audio_mix_array.begin(); iter != audio_mix_array.end(); iter++) {
  1195. ss << iter->to_string() << std::endl;
  1196. }
  1197. return ss.str();
  1198. }
  1199. };
  1200. struct Animation {
  1201. Animation():
  1202. time_interval(),
  1203. container(),
  1204. video() {}
  1205. TimeInterval time_interval; // 时间区间
  1206. Container container; // 容器格式
  1207. Video video; // 视频信息
  1208. std::string to_string() const {
  1209. std::stringstream ss;
  1210. ss << "time_interval: " << time_interval.to_string() << std::endl
  1211. << "container: " << container.to_string() << std::endl
  1212. << "video: " << video.to_string() << std::endl;
  1213. return ss.str();
  1214. }
  1215. };
  1216. struct SmartCover {
  1217. SmartCover():
  1218. format(""),
  1219. width(""),
  1220. height(""),
  1221. count(""),
  1222. delete_duplicates("") {};
  1223. std::string format; // 图片格式,支持 jpg、png、webp,默认jpg
  1224. std::string width; // 宽,取值范围[128,4096],单位px,若只设置 Width 时,按照视频原始比例计算 Heigth,默认视频原始宽度
  1225. std::string height; // 窄,取值范围[128,4096],单位px,若只设置 Height 时,按照视频原始比例计算 Width,默认视频原始高度
  1226. std::string count; // 截图数量,取值范围 [1,10],默认3
  1227. std::string delete_duplicates; // 封面去重,取值true/false,默认false
  1228. std::string to_string() const {
  1229. std::stringstream ss;
  1230. ss << "format: " << format << std::endl
  1231. << "width: " << width << std::endl
  1232. << "height: " << height << std::endl
  1233. << "count: " << count << std::endl
  1234. << "delete_duplicates: " << delete_duplicates << std::endl;
  1235. return ss.str();
  1236. }
  1237. };
  1238. struct Segment {
  1239. Segment():
  1240. format(""),
  1241. duration(""),
  1242. transcode_index(""),
  1243. hls_encrypt(),
  1244. start_time(""),
  1245. end_time("") {}
  1246. std::string format; // 封装格式,支持 aac、mp3、flac、mp4、ts、mkv、avi、hls、m3u8
  1247. std::string duration; // 转封装时长,单位:秒,不小于5的整数,不设置 Duration 时,表示只转封装格式不分段
  1248. std::string transcode_index; // 处理的流编号
  1249. HlsEncrypt hls_encrypt; // hls 加密配置,当封装格式为 hls 和 m3u8 时生效
  1250. std::string start_time; // 开始时间 取值范围:[0,视频时长],默认值为0,单位为秒,支持 float 格式,执行精度精确到毫秒
  1251. std::string end_time; // 结束时间 取值范围:[0,视频时长],默认值为0,单位为秒,支持 float 格式,执行精度精确到毫秒
  1252. std::string to_string() const {
  1253. std::stringstream ss;
  1254. ss << "format: " << format << std::endl
  1255. << "duration: " << duration << std::endl
  1256. << "transcode_index: " << transcode_index << std::endl
  1257. << "start_time: " << start_time << std::endl
  1258. << "end_time: " << end_time << std::endl
  1259. << "hls_encrypt: " << hls_encrypt.to_string() << std::endl;
  1260. return ss.str();
  1261. }
  1262. };
  1263. struct AudioConfig {
  1264. AudioConfig() {};
  1265. std::string codec; // 编解码格式,取值 aac、mp3、flac、amr。当 Request.AudioMode 为 MusicMode 时,仅支持 mp3、wav、acc
  1266. std::string sample_rate; // 采样率 单位:Hz 可选 8000、11025、22050、32000、44100、48000、96000。 当 Codec 设置为 aac/flac 时,不支持 8000;当 Codec 设置为 mp3 时,不支持 8000 和 96000;当 Codec 设置为 amr 时,只支持 8000;当 Request.AudioMode 为 MusicMode 时,该参数无效
  1267. std::string bit_rate; // 音频码率 单位:Kbps 值范围:[8,1000] 当 Request.AudioMode 为 MusicMode 时,该参数无效
  1268. std::string channels; // 声道数 当 Codec 设置为 aac/flac,支持1、2、4、5、6、8;当 Codec 设置为 mp3,支持1、2;当 Codec 设置为 amr,只支持1;当 Request.AudioMode 为 MusicMode 时,该参数无效
  1269. std::string to_string() const {
  1270. std::stringstream ss;
  1271. ss << "codec: " << codec << std::endl
  1272. << "sample_rate: " << sample_rate << std::endl
  1273. << "bit_rate: " << bit_rate << std::endl
  1274. << "channels: " << channels << std::endl;
  1275. return ss.str();
  1276. }
  1277. };
  1278. struct VoiceSeparate {
  1279. VoiceSeparate():
  1280. audio_mode(""),
  1281. audio_config() {}
  1282. std::string audio_mode; // 输出音频模式,IsAudio:输出人声 IsBackground:输出背景声 AudioAndBackground:输出人声和背景声 MusicMode:输出人声、背景声、Bass声、鼓声
  1283. AudioConfig audio_config; // 音频配置
  1284. std::string to_string() const {
  1285. std::stringstream ss;
  1286. ss << "audio_mode: " << audio_mode << std::endl
  1287. << "audio_config: " << audio_config.to_string() << std::endl;
  1288. return ss.str();
  1289. }
  1290. };
  1291. struct VideoMontage {
  1292. VideoMontage() :
  1293. audio(),
  1294. video(),
  1295. container(),
  1296. audio_mix(),
  1297. audio_mix_array(std::vector<AudioMix>()),
  1298. scene("") {};
  1299. Audio audio; // 音频参数
  1300. Video video; // 视频参数
  1301. Container container; // 封装格式
  1302. AudioMix audio_mix; // 混音参数
  1303. std::vector<AudioMix> audio_mix_array; // 混音参数数组
  1304. std::string scene; // 精彩集锦场景 Video:普通视频 Soccer: 足球
  1305. std::string to_string() const {
  1306. std::stringstream ss;
  1307. ss << "container: " << container.to_string() << std::endl
  1308. << "video: " << video.to_string() << std::endl
  1309. << "audio: " << audio.to_string() << std::endl
  1310. << "scene: " << scene << std::endl
  1311. << "audio_mix: " << audio_mix.to_string() << std::endl;
  1312. ss << "audio_mix_array: ";
  1313. for (std::vector<AudioMix>::const_iterator iter = audio_mix_array.begin(); iter != audio_mix_array.end(); iter++) {
  1314. ss << iter->to_string() << std::endl;
  1315. }
  1316. return ss.str();
  1317. }
  1318. };
  1319. struct ConcatFragment {
  1320. ConcatFragment() :
  1321. url(""),
  1322. fragment_index(""),
  1323. start_time(""),
  1324. end_time("") {};
  1325. std::string url; // 同 bucket 对象地址,需要 urlEncode
  1326. std::string fragment_index; // 拼接对象的索引位置,大于等于0的整数
  1327. std::string start_time; // 开始时间,取值范围[0, 视频时长] 单位为秒
  1328. std::string end_time; // 结束时间,取值范围[0, 视频时长] 单位为秒
  1329. std::string to_string() const {
  1330. std::stringstream ss;
  1331. ss << "url: " << url << std::endl
  1332. << "fragment_index: " << fragment_index << std::endl
  1333. << "start_time: " << start_time << std::endl
  1334. << "end_time: " << end_time << std::endl;
  1335. return ss.str();
  1336. }
  1337. };
  1338. struct SceneChnageInfo {
  1339. SceneChnageInfo():
  1340. mode(""),
  1341. time("") {}
  1342. std::string mode; // 转场模式,取值:Default 不添加转场特效、FADE 淡入淡出、GRADIENT 渐变
  1343. std::string time; // 转场时间,单位秒,取值范围(0,5],支持小数
  1344. std::string to_string() const {
  1345. std::stringstream ss;
  1346. ss << "mode: " << mode << std::endl
  1347. << "time: " << time << std::endl;
  1348. return ss.str();
  1349. }
  1350. };
  1351. struct Concat {
  1352. Concat() :
  1353. concat_fragment(std::vector<ConcatFragment>()),
  1354. audio(),
  1355. video(),
  1356. container(),
  1357. audio_mix(),
  1358. audio_mix_array(std::vector<AudioMix>()),
  1359. index(""),
  1360. direct_concat("") {};
  1361. std::vector<ConcatFragment> concat_fragment; // 拼接节点,支持多个文件,按照文件顺序拼接
  1362. Audio audio; // 音频参数
  1363. Video video; // 视频参数
  1364. Container container; // 封装格式
  1365. AudioMix audio_mix; // 混音参数
  1366. std::vector<AudioMix> audio_mix_array; // 混音参数数组
  1367. std::string index; // Input 节点位于 ConcatFragment 序列索引,不能大于 ConcatFragment 长度
  1368. std::string direct_concat; // 简单拼接方式(不转码直接拼接),其他的视频和音频参数失效,取值 true/false
  1369. SceneChnageInfo scene_change_info; // 转场特效
  1370. std::string to_string() const {
  1371. std::stringstream ss;
  1372. ss << "index: " << index << std::endl
  1373. << "container: " << container.to_string() << std::endl
  1374. << "video: " << video.to_string() << std::endl
  1375. << "audio: " << audio.to_string() << std::endl
  1376. << "derect_concat: " << direct_concat << std::endl
  1377. << "scene_change_info: " << scene_change_info.to_string() << std::endl
  1378. << "audio_mix: " << audio_mix.to_string() << std::endl;
  1379. ss << "audio_mix_array: ";
  1380. for (std::vector<AudioMix>::const_iterator iter = audio_mix_array.begin(); iter != audio_mix_array.end(); iter++) {
  1381. ss << iter->to_string() << std::endl;
  1382. }
  1383. ss << "concat_fragment";
  1384. for (std::vector<ConcatFragment>::const_iterator iter = concat_fragment.begin(); iter != concat_fragment.end(); iter++) {
  1385. ss << iter->to_string() << std::endl;
  1386. }
  1387. return ss.str();
  1388. }
  1389. };
  1390. struct JobsOperation {
  1391. JobsOperation() :
  1392. job_level(0),
  1393. user_data(""),
  1394. template_id(""),
  1395. template_name(""),
  1396. snapshot(),
  1397. media_result(),
  1398. file_uncompress_config(),
  1399. file_uncompress_result(),
  1400. smart_cover(),
  1401. concat(),
  1402. video_montage(),
  1403. voice_separate(),
  1404. segment() {}
  1405. Output output; // 输出配置,非必选
  1406. int job_level; // 任务优先级,非必选,级别限制:0 、1 、2 。级别越大任务优先级越高,默认为0
  1407. std::string user_data; // 用户透传信息,非必选
  1408. std::string template_id; // 模版ID,非必选
  1409. std::string template_name; // 模版名称,非必选
  1410. Snapshot snapshot; // 截图参数,非必选,Tag 为 Snapshot 时生效
  1411. Transcode transcode; // 转码参数,非必选,Tag 为 Transcode 时生效
  1412. std::vector<Watermark> watermarks; // 水印参数,非必选,Tag 为 Transocde、Watermark 时生效
  1413. std::vector<std::string> watermark_template_id; // 水印模版ID,非必选,Tag 为 Transocde、Watermark 时生效
  1414. RemoveWatermark remove_watermark; // 去除水印参数,非必选,Tag 为 Transcode 时生效
  1415. Subtitles subtitles; // 字幕参数,非必选,Tag 为 Transcode 时生效
  1416. DigitalWatermark digital_watermark; // 数字水印参数,非必选,Tag 为 Transocde、DigitalWatermark 时生效
  1417. ExtractDigitalWatermark extract_digital_watermark;// 提取数字水印参数,非必选,Tag 为 ExtractDigitalWatermark 时生效
  1418. MediaResult media_result; // 输出文件基本信息,响应字段,非请求参数
  1419. MediaInfo media_info; // 输出文件媒体信息,响应字段,非请求参数
  1420. FileUncompressConfig file_uncompress_config; // 文件压缩配置
  1421. FileUncompressResult file_uncompress_result; // 文件压缩结果信息
  1422. Animation animation; // 动图参数,非必选,Tag 为 Animation 时生效
  1423. SmartCover smart_cover; // 智能封面参数,非必选,Tag 为 SmartCover 时生效
  1424. Concat concat; // 拼接参数,非必选,Tag 为 Concat 时生效
  1425. VideoMontage video_montage; // 精彩锦集参数,非必选,Tag 为 VideoMontage 时生效
  1426. VoiceSeparate voice_separate; // 人声分离参数,非必选,Tag 为 VoiceSeparate 时生效
  1427. Segment segment; // 转封装参数,非必选,Tag 为 Segment 时生效
  1428. std::string to_string() const {
  1429. std::stringstream ss;
  1430. ss << "output: " << output.to_string() << std::endl
  1431. << "job_level: " << job_level << std::endl
  1432. << "template_id: " << template_id << std::endl
  1433. << "template_name: " << template_name << std::endl
  1434. << "user_data: " << user_data << std::endl
  1435. << "file_uncompress_config: " << file_uncompress_config.to_string() << std::endl
  1436. << "file_uncompress_result: " << file_uncompress_result.to_string() << std::endl
  1437. << "snapshot: " << snapshot.to_string() << std::endl
  1438. << "transcode: " << transcode.to_string() << std::endl
  1439. << "remove_watermark: " << remove_watermark.to_string() << std::endl
  1440. << "subtitles: " << subtitles.to_string() << std::endl
  1441. << "digital_watermark: " << digital_watermark.to_string() << std::endl
  1442. << "extract_digital_watermark: " << extract_digital_watermark.to_string() << std::endl
  1443. << "media_result: " << media_result.to_string() << std::endl
  1444. << "media_info: " << media_info.to_string() << std::endl
  1445. << "animation: " << animation.to_string() << std::endl
  1446. << "video_montage: " << video_montage.to_string() << std::endl
  1447. << "voice_separate: " << voice_separate.to_string() << std::endl
  1448. << "smart_cover: " << smart_cover.to_string() << std::endl
  1449. << "segment: " << segment.to_string() << std::endl;
  1450. ss << "watermarks: ";
  1451. for (std::vector<Watermark>::const_iterator iter = watermarks.begin(); iter != watermarks.end(); iter++) {
  1452. ss << iter->to_string() << std::endl;
  1453. }
  1454. ss << "watermark_template_id: ";
  1455. for (std::vector<std::string>::const_iterator iter = watermark_template_id.begin(); iter != watermark_template_id.end(); iter++) {
  1456. ss << iter->c_str() << ",";
  1457. }
  1458. ss << std::endl;
  1459. return ss.str();
  1460. }
  1461. };
  1462. struct JobsOptions {
  1463. JobsOptions():
  1464. tag(""),
  1465. input(),
  1466. operation(),
  1467. queue_id(),
  1468. queue_type(),
  1469. callback_format(),
  1470. callback_type(),
  1471. callback(),
  1472. callback_mq_config() {}
  1473. std::string tag;
  1474. Input input;
  1475. JobsOperation operation;
  1476. std::string queue_id;
  1477. std::string queue_type;
  1478. std::string callback_format;
  1479. std::string callback_type;
  1480. std::string callback;
  1481. CallBackkMqConfig callback_mq_config;
  1482. };
  1483. struct JobsDetails {
  1484. std::string code; // 错误码,只有 State 为 Failed 时有意义
  1485. std::string message; // 错误描述,只有 State 为 Failed 时有意义
  1486. std::string job_id; // 新创建任务的 ID
  1487. std::string tag; // 新创建任务的 Tag:DocProcess
  1488. std::string state; // 任务的状态,为
  1489. // Submitted、Running、Success、Failed、Pause、Cancel 其中一个
  1490. std::string create_time; // 任务的创建时间
  1491. std::string end_time; //
  1492. std::string queue_id; // 任务所属的队列 ID
  1493. std::string start_time; // 任务开始时间
  1494. std::string queue_type; // 队列类型
  1495. std::string progress; // 任务进度
  1496. Input input; // 该任务的输入文件路径
  1497. JobsOperation operation; // 任务operation
  1498. std::string to_string() const {
  1499. std::stringstream ss;
  1500. ss << "code: " << code << std::endl;
  1501. ss << "message: " << message << std::endl;
  1502. ss << "job_id: " << job_id << std::endl;
  1503. ss << "tag: " << tag << std::endl;
  1504. ss << "state: " << state << std::endl;
  1505. ss << "start_time: " << start_time << std::endl;
  1506. ss << "create_time: " << create_time << std::endl;
  1507. ss << "end_time: " << end_time << std::endl;
  1508. ss << "queue_id: " << queue_id << std::endl;
  1509. ss << "queue_type: " << queue_type << std::endl;
  1510. ss << "progress: " << progress << std::endl;
  1511. ss << "input: " << input.to_string() << std::endl;
  1512. ss << "operation: " << operation.to_string() << std::endl;
  1513. return ss.str();
  1514. }
  1515. };
  1516. class PutImageByFileReq : public PutObjectByFileReq {
  1517. public:
  1518. PutImageByFileReq(const std::string& bucket_name,
  1519. const std::string& object_name,
  1520. const std::string& local_image)
  1521. : PutObjectByFileReq(bucket_name, object_name, local_image) {}
  1522. virtual ~PutImageByFileReq() {}
  1523. PicOperation GetPictureOperation() const { return m_pic_operation; }
  1524. void SetPicOperation(const PicOperation& pic_operation) {
  1525. m_pic_operation = pic_operation;
  1526. AddHeader("Pic-Operations", m_pic_operation.GenerateJsonString());
  1527. }
  1528. // 检查图片处理的效果图文件是否覆盖了原图
  1529. void CheckCoverOriginImage();
  1530. private:
  1531. PicOperation m_pic_operation;
  1532. };
  1533. class CloudImageProcessReq : public ObjectReq {
  1534. public:
  1535. CloudImageProcessReq(const std::string& bucket_name,
  1536. const std::string& object_name)
  1537. : ObjectReq(bucket_name, object_name) {
  1538. m_method = "POST";
  1539. }
  1540. virtual ~CloudImageProcessReq() {}
  1541. void SetPicOperation(const PicOperation& pic_operation) {
  1542. m_pic_operation = pic_operation;
  1543. AddHeader("Pic-Operations", m_pic_operation.GenerateJsonString());
  1544. AddParam("image_process", "");
  1545. }
  1546. private:
  1547. PicOperation m_pic_operation;
  1548. };
  1549. class GetQRcodeReq : public ObjectReq {
  1550. public:
  1551. GetQRcodeReq(const std::string& bucket_name, const std::string& object_name)
  1552. : ObjectReq(bucket_name, object_name) {
  1553. AddParam("ci-process", "QRcode");
  1554. AddParam("cover", "0");
  1555. m_method = "GET";
  1556. }
  1557. virtual ~GetQRcodeReq() {}
  1558. // 二维码覆盖功能,将对识别出的二维码覆盖上马赛克。取值为0或1。0表示不开启二维码覆盖,1表示开启二维码覆盖,默认值0
  1559. void EnableCover() { AddParam("cover", "1"); }
  1560. };
  1561. class CreateDocBucketReq : public BucketReq{
  1562. public:
  1563. explicit CreateDocBucketReq(const std::string& bucket_name) : BucketReq(bucket_name) {
  1564. m_method = "POST";
  1565. m_path = "/docbucket";
  1566. SetHttps();
  1567. }
  1568. virtual ~CreateDocBucketReq() {}
  1569. };
  1570. class DescribeDocProcessBucketsReq : public BaseReq {
  1571. public:
  1572. DescribeDocProcessBucketsReq() {
  1573. m_method = "GET";
  1574. m_path = "/docbucket";
  1575. // 该接口只支持https
  1576. SetHttps();
  1577. }
  1578. virtual ~DescribeDocProcessBucketsReq() {}
  1579. void SetRegions(const std::string& regions) { AddParam("regions", regions); }
  1580. void SetBucketNames(const std::string& bucket_names) {
  1581. AddParam("bucketNames", bucket_names);
  1582. }
  1583. void SetBucketName(const std::string& bucket_name) {
  1584. AddParam("bucketName", bucket_name);
  1585. }
  1586. void SetPageNumber(const std::string& page_number) {
  1587. AddParam("pageNumber", page_number);
  1588. }
  1589. void SetPageSize(const std::string& page_size) {
  1590. AddParam("PageSize", page_size);
  1591. }
  1592. };
  1593. class DocPreviewReq : public GetObjectByFileReq {
  1594. public:
  1595. DocPreviewReq(const std::string& bucket_name, const std::string& object_name,
  1596. const std::string& local_file)
  1597. : GetObjectByFileReq(bucket_name, object_name, local_file) {
  1598. AddParam("ci-process", "doc-preview");
  1599. AddParam("page", "1");
  1600. AddParam("sheet", "1");
  1601. AddParam("dstType", "jpg");
  1602. AddParam("comment", "0");
  1603. AddParam("excelPaperDirection", "0");
  1604. AddParam("quality", "100");
  1605. AddParam("scale", "100");
  1606. }
  1607. virtual ~DocPreviewReq() {}
  1608. // 源数据的后缀类型,当前文档转换根据 COS 对象的后缀名来确定源数据类型。当
  1609. // COS 对象没有后缀名时,可以设置该值
  1610. void SetSrcType(const std::string& src_type) {
  1611. AddParam("srcType", src_type);
  1612. }
  1613. // 需转换的文档页码,默认从1开始计数;表格文件中 page 表示转换的第 X 个
  1614. // sheet 的第 X 张图
  1615. void SetPage(const int page) { AddParam("page", std::to_string(page)); }
  1616. // 转换后的图片处理参数,支持 基础图片处理 所有处理参数,多个处理参数可通过
  1617. // 管道操作符 分隔,从而实现在一次访问中按顺序对图片进行不同处理
  1618. void SetImageParams(const std::string& image_param) {
  1619. AddParam("ImageParams", image_param);
  1620. }
  1621. // 表格文件参数,转换第 X 个表,默认为1
  1622. void SetSheet(const int sheet) {
  1623. AddParam("ImageParams", std::to_string(sheet));
  1624. }
  1625. // 转换输出目标文件类型
  1626. void SetDstType(const std::string& dst_type) {
  1627. AddParam("dstType", dst_type);
  1628. }
  1629. // Office 文档的打开密码,如果需要转换有密码的文档,请设置该字段
  1630. void SetPasswd(const std::string& passwd) { AddParam("password", passwd); }
  1631. // 是否隐藏批注和应用修订,默认为
  1632. void SetComment(const int comment) {
  1633. AddParam("comment", std::to_string(comment));
  1634. }
  1635. // 表格文件转换纸张方向,0代表垂直方向,非0代表水平方向,默认为0
  1636. void SetExcelPaperDirection(const int direction) {
  1637. AddParam("excelPaperDirection", std::to_string(direction));
  1638. }
  1639. // 生成预览图的图片质量,取值范围 [1-100],默认值100。
  1640. // 例:值为100,代表生成图片质量为100%
  1641. void SetQuality(const int quality) {
  1642. AddParam("quality", std::to_string(quality));
  1643. }
  1644. // 预览图片的缩放参数,取值范围[10-200], 默认值100。
  1645. // 例:值为200,代表图片缩放比例为200% 即放大两倍
  1646. void SetScale(const int scale) { AddParam("scale", std::to_string(scale)); }
  1647. };
  1648. class DescribeQueuesReq : public BucketReq {
  1649. public:
  1650. DescribeQueuesReq(const std::string bucket_name)
  1651. :BucketReq(bucket_name) {
  1652. m_method = "GET";
  1653. m_path = "/queue";
  1654. SetHttps();
  1655. }
  1656. virtual ~DescribeQueuesReq() {}
  1657. // 队列 ID,以“,”符号分割字符串。
  1658. void SetQueueId(const std::string& queue_id) {
  1659. AddParam("queueId", queue_id);
  1660. }
  1661. // 队列状态
  1662. // 1. Active 表示队列内的作业会被媒体处理服务调度执行。
  1663. // 2. Paused 表示队列暂停,作业不再会被媒体处理调度执行,队列内的所有作业状态维持在暂停状态,已经执行中的任务不受影响。
  1664. void SetState(const std::string& state) { AddParam("states", state); }
  1665. // 第几页,默认值1。
  1666. void SetPageNumber(const std::string& page_number) {
  1667. AddParam("pageNumber", page_number);
  1668. }
  1669. // 每页个数,默认值10
  1670. void SetPageSize(const std::string& page_size) {
  1671. AddParam("PageSize", page_size);
  1672. }
  1673. };
  1674. class UpdateQueueReq : public BucketReq {
  1675. public:
  1676. UpdateQueueReq(const std::string& bucket_name)
  1677. : BucketReq(bucket_name) {
  1678. SetMethod("PUT");
  1679. SetPath("/queue");
  1680. AddHeader("Content-Type", "application/xml");
  1681. SetHttps();
  1682. }
  1683. virtual ~UpdateQueueReq() {}
  1684. void SetQueueId(const std::string& queue_id) {
  1685. m_queue_id = queue_id;
  1686. m_path.append("/" + queue_id);
  1687. }
  1688. void SetName(const std::string& name) { m_name = name; }
  1689. void SetState(const std::string& state) { m_state = state; }
  1690. void SetNotifyConfig(const NotifyConfig& notify_config) {
  1691. m_notify_config = notify_config;
  1692. }
  1693. bool GenerateRequestBody(std::string* body) const;
  1694. private:
  1695. std::string m_name; // 队列名称
  1696. std::string m_queue_id; // 队列 ID
  1697. std::string m_state; // 队列状态
  1698. NotifyConfig m_notify_config; // 通知渠道
  1699. };
  1700. class CreateDocProcessJobsReq : public BucketReq {
  1701. public:
  1702. CreateDocProcessJobsReq(const std::string& bucket_name)
  1703. : BucketReq(bucket_name) {
  1704. SetMethod("POST");
  1705. SetPath("/doc_jobs");
  1706. SetHttps();
  1707. AddHeader("Content-Type", "application/xml");
  1708. m_tag = "DocProcess";
  1709. }
  1710. virtual ~CreateDocProcessJobsReq() {}
  1711. void SetTag(const std::string& tag) { m_tag = tag; }
  1712. void SetOperation(const Operation& operation) { m_operation = operation; }
  1713. void SetInput(const Input& input) { m_input = input; }
  1714. void SetQueueId(const std::string& queue_id) { m_queue_id = queue_id; }
  1715. bool GenerateRequestBody(std::string* body) const;
  1716. private:
  1717. std::string m_tag; // 创建任务的 Tag,目前仅支持:DocProcess
  1718. Input m_input; // 待操作的文件对象
  1719. Operation m_operation; // 操作规则
  1720. std::string m_queue_id; // 任务所在的队列 ID
  1721. };
  1722. class DescribeDocProcessJobReq : public BucketReq {
  1723. public:
  1724. DescribeDocProcessJobReq(const std::string& bucket_name)
  1725. : BucketReq(bucket_name) {
  1726. SetMethod("GET");
  1727. SetPath("/doc_jobs");
  1728. SetHttps();
  1729. }
  1730. virtual ~DescribeDocProcessJobReq() {}
  1731. void SetJobId(const std::string& job_id) { m_path += "/" + job_id; }
  1732. };
  1733. class DescribeDocProcessJobsReq : public BucketReq {
  1734. public:
  1735. DescribeDocProcessJobsReq(const std::string& bucket_name)
  1736. : BucketReq(bucket_name) {
  1737. SetMethod("GET");
  1738. SetPath("/doc_jobs");
  1739. SetHttps();
  1740. AddParam("tag", "DocProcess");
  1741. AddParam("orderByTime", "Desc");
  1742. AddParam("size", "10");
  1743. AddParam("states", "All");
  1744. }
  1745. virtual ~DescribeDocProcessJobsReq() {}
  1746. void SetQueueId(const std::string& queue_id) {
  1747. AddParam("queueId", queue_id);
  1748. }
  1749. void SetOrderByTime(const std::string& order) {
  1750. AddParam("orderByTime", order);
  1751. }
  1752. void SetNextToken(const std::string& next_token) {
  1753. AddParam("nextToken", next_token);
  1754. }
  1755. void SetSize(const int size) {
  1756. AddParam("size", StringUtil::IntToString(size));
  1757. }
  1758. void SetStates(const std::string& states) { AddParam("states", states); }
  1759. void SetStartCreationTime(const std::string& start_time) {
  1760. AddParam("startCreationTime", start_time);
  1761. }
  1762. void SetEndCreationTime(const std::string& end_time) {
  1763. AddParam("endCreationTime", end_time);
  1764. }
  1765. };
  1766. class DescribeDocProcessQueuesReq : public DescribeQueuesReq {
  1767. public:
  1768. DescribeDocProcessQueuesReq(const std::string& bucket_name)
  1769. : DescribeQueuesReq(bucket_name) {
  1770. SetPath("/docqueue");
  1771. }
  1772. virtual ~DescribeDocProcessQueuesReq() {}
  1773. };
  1774. class UpdateDocProcessQueueReq : public UpdateQueueReq {
  1775. public:
  1776. UpdateDocProcessQueueReq(const std::string& bucket_name)
  1777. : UpdateQueueReq(bucket_name) {
  1778. SetPath("/docqueue");
  1779. }
  1780. virtual ~UpdateDocProcessQueueReq() {}
  1781. };
  1782. class DescribeMediaBucketsReq : public BucketReq {
  1783. public:
  1784. DescribeMediaBucketsReq() {
  1785. m_method = "GET";
  1786. m_path = "/mediabucket";
  1787. // 该接口只支持https
  1788. SetHttps();
  1789. }
  1790. virtual ~DescribeMediaBucketsReq() {}
  1791. // 地域信息,例如
  1792. // ap-shanghai、ap-beijing,若查询多个地域以“,”分隔字符串,支持中国大陆地域
  1793. void SetRegions(const std::string& regions) { AddParam("regions", regions); }
  1794. // 存储桶名称,以“,”分隔,支持多个存储桶,精确搜索
  1795. void SetBucketNames(const std::string& bucket_names) {
  1796. AddParam("bucketNames", bucket_names);
  1797. }
  1798. // 存储桶名称前缀,前缀搜索
  1799. void SetBucketName(const std::string& bucket_name) {
  1800. AddParam("bucketName", bucket_name);
  1801. }
  1802. // 第几页
  1803. void SetPageNumber(const std::string& page_number) {
  1804. AddParam("pageNumber", page_number);
  1805. }
  1806. // 每页个数
  1807. void SetPageSize(const std::string& page_size) {
  1808. AddParam("PageSize", page_size);
  1809. }
  1810. };
  1811. class GetSnapshotReq : public GetObjectByFileReq {
  1812. public:
  1813. GetSnapshotReq(const std::string& bucket_name, const std::string& object_name,
  1814. const std::string& local_file)
  1815. : GetObjectByFileReq(bucket_name, object_name, local_file) {
  1816. AddParam("ci-process", "snapshot");
  1817. AddParam("time", "0");
  1818. }
  1819. virtual ~GetSnapshotReq() {}
  1820. // 截图的时间点,单位为秒,必选
  1821. void SetTime(float time) { AddParam("time", std::to_string(time)); }
  1822. // 截图的宽,默认为0,当 width 和 height
  1823. // 都为0时,表示使用视频的宽高;如果单个为0,则以另外一个值按视频宽高比例自动适应
  1824. void SetWitdh(int width) { AddParam("width", std::to_string(width)); }
  1825. // 截图的高,默认为0,当 width 和 height
  1826. // 都为0时,表示使用视频的宽高;如果单个为0,则以另外一个值按视频宽高比例自动适应
  1827. void SetHeight(int height) { AddParam("height", std::to_string(height)); }
  1828. // 截图的格式,支持 jpg 和 png,默认 jpg
  1829. void SetFormat(const std::string& format) { AddParam("format", format); }
  1830. // 图片旋转方式
  1831. // auto:按视频旋转信息进行自动旋转,off:不旋转,默认值为 auto
  1832. void SetRotate(const std::string& rotate) { AddParam("rotate", rotate); }
  1833. // 截帧方式
  1834. // keyframe:截取指定时间点之前的最近的一个关键帧,
  1835. // exactframe:截取指定时间点的帧, 默认值为 exactframe
  1836. void SetMode(const std::string& mode) { AddParam("mode", mode); }
  1837. };
  1838. class PutBucketToCIReq : public BucketReq{
  1839. public:
  1840. explicit PutBucketToCIReq(const std::string& bucket_name) : BucketReq(bucket_name) {
  1841. m_method = "PUT";
  1842. }
  1843. virtual ~PutBucketToCIReq() {}
  1844. };
  1845. class CreateMediaBucketReq : public BucketReq{
  1846. public:
  1847. explicit CreateMediaBucketReq(const std::string& bucket_name) : BucketReq(bucket_name) {
  1848. m_method = "POST";
  1849. m_path = "/mediabucket";
  1850. SetHttps();
  1851. }
  1852. virtual ~CreateMediaBucketReq() {}
  1853. };
  1854. class GetMediaInfoReq : public ObjectReq {
  1855. public:
  1856. GetMediaInfoReq(const std::string& bucket_name,
  1857. const std::string& object_name)
  1858. : ObjectReq(bucket_name, object_name) {
  1859. AddParam("ci-process", "videoinfo");
  1860. m_method = "GET";
  1861. }
  1862. virtual ~GetMediaInfoReq() {}
  1863. };
  1864. class GetPm3u8Req : public GetObjectByFileReq {
  1865. public:
  1866. GetPm3u8Req(const std::string& bucket_name, const std::string& object_name,
  1867. const std::string& local_file)
  1868. : GetObjectByFileReq(bucket_name, object_name, local_file) {
  1869. AddParam("ci-process", "pm3u8");
  1870. AddParam("expires", "3600");
  1871. }
  1872. virtual ~GetPm3u8Req() {}
  1873. // 私有 ts 资源 url 下载凭证的相对有效期,单位为秒,范围为[3600, 43200],必选
  1874. void SetExpires(int expires) { AddParam("expires", std::to_string(expires)); }
  1875. };
  1876. class DescribeMediaQueuesReq : public DescribeQueuesReq {
  1877. public:
  1878. DescribeMediaQueuesReq(const std::string bucket_name)
  1879. : DescribeQueuesReq(bucket_name) {
  1880. m_path = "/queue";
  1881. }
  1882. virtual ~DescribeMediaQueuesReq() {}
  1883. // 队列类型
  1884. // 1. CateAll:所有类型。
  1885. // 2. Transcoding:媒体处理队列。
  1886. // 3. SpeedTranscoding:媒体处理倍速转码队列。
  1887. // 4. 默认为 Transcoding。
  1888. void SetCategory(const std::string& category) {
  1889. AddParam("category", category);
  1890. }
  1891. };
  1892. class UpdateMediaQueueReq : public UpdateQueueReq {
  1893. public:
  1894. UpdateMediaQueueReq(const std::string& bucket_name)
  1895. : UpdateQueueReq(bucket_name) {
  1896. SetPath("/docqueue");
  1897. }
  1898. virtual ~UpdateMediaQueueReq() {}
  1899. };
  1900. class CreateDataProcessJobsReq : public BucketReq {
  1901. public:
  1902. CreateDataProcessJobsReq(const std::string& bucket_name)
  1903. : BucketReq(bucket_name) {
  1904. SetMethod("POST");
  1905. SetPath("/jobs");
  1906. SetHttps();
  1907. AddHeader("Content-Type", "application/xml");
  1908. }
  1909. virtual ~CreateDataProcessJobsReq() {}
  1910. virtual bool GenerateRequestBody(std::string* body) const;
  1911. static void GenerateVideoNode(rapidxml::xml_document<>& doc, const Video& video, rapidxml::xml_node<>* video_node);
  1912. static void GenerateAudioNode(rapidxml::xml_document<>& doc, const Audio& audio, rapidxml::xml_node<>* node);
  1913. static void GenerateContainerNode(rapidxml::xml_document<>& doc, const Container& container, rapidxml::xml_node<>* node);
  1914. static void GenerateAudioMixNode(rapidxml::xml_document<>& doc, const AudioMix& audio_mix, rapidxml::xml_node<>* node);
  1915. void setOperation(JobsOptions operation) {
  1916. options_ = operation;
  1917. }
  1918. private:
  1919. JobsOptions options_;
  1920. // virtual bool GenerateRequestBody(std::string* body) const {};
  1921. };
  1922. class DescribeDataProcessJobReq : public BucketReq {
  1923. public:
  1924. DescribeDataProcessJobReq(const std::string& bucket_name)
  1925. : BucketReq(bucket_name) {
  1926. SetMethod("GET");
  1927. SetPath("/jobs");
  1928. SetHttps();
  1929. }
  1930. virtual ~DescribeDataProcessJobReq() {}
  1931. void SetJobId(const std::string& job_id) { m_path += "/" + job_id; }
  1932. };
  1933. class CancelDataProcessJobReq : public BucketReq {
  1934. public:
  1935. CancelDataProcessJobReq(const std::string& bucket_name)
  1936. : BucketReq(bucket_name) {
  1937. SetMethod("PUT");
  1938. SetPath("/jobs");
  1939. SetHttps();
  1940. }
  1941. virtual ~CancelDataProcessJobReq() {}
  1942. void SetJobId(const std::string& job_id) { m_path += "/" + job_id; }
  1943. };
  1944. } // namespace qcloud_cos