data_process_req.h 85 KB

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