后台服务
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
5.1 KiB

  1. package com.iformall.sm;
  2. import lombok.Data;
  3. import java.util.List;
  4. @Data
  5. public class AiVideoParam {
  6. /**
  7. * | 参数 | 必选 | 类型 | 说明 |
  8. * | ----------------- | ---- | ------- | ------------------------------------------------------------ |
  9. * | gen_txt | 是 | string | 需要生成的文字内容 |
  10. * | video_template_id | 是 | string | 使用的视频模板ID |
  11. * | voice_id | 是 | string | 音色ID,如:"zh-CN-YunxiNeural"。如果使用“default”,表示不指定具体的,由后端服务自动匹配 |
  12. * | voice_style | 是 | string | TTS语音风格,如:”angry“。如果使用“default”,表示默认风格 |
  13. * | video_files | 否 | array[] | 字典类型,包含背景、数字人、素材信息。缺省,使用默认模板。 |
  14. * | + back_ground | 否 | array[] | 字典类型,背景信息 |
  15. * | ++ image | 是 | string | 背景图片,base64编辑后的字符串类型数据 |
  16. * | ++ type | 是 | string | 背景图片类型,共两种。horizontal 表示横版,vertical 表示竖版 |
  17. * | + digital_human | 否 | array[] | 字典类型,数字人信息 |
  18. * | ++ coord | 是 | array[] | 集合类型,表示相对于左上角的位置,如[100, 200],表示相对于左边缘100像素,相对于上边缘200相素 |
  19. * | ++ level | 是 | uint32 | 数字人图片的层级,值越大表示越高层,0表示最底层 |
  20. * | ++ ratio | 是 | float32 | 相对于原数字人图片大小的缩放比例,如0.5表示宽高均变为原来的一半 |
  21. * | + material | 否 | array[] | 字典类型,素材信息。具体的值是集合类型,内部由每个素材信息(素材信息是字典类型)组成,如"material":[{素材1的信息},{素材2的信息},{素材3的信息}] |
  22. * | ++ | 否 | array[] | 集合类型,每个素材信息(素材信息是字典类型)组成 |
  23. * | +++ coord | 是 | array[] | 集合类型,表示相对于左上角的位置,如[100, 200],表示相对于左边缘100像素,相对于上边缘200相素 |
  24. * | +++ image | 是 | string | 素材图片,base64编辑后的字符串类型数据 |
  25. * | +++ level | 是 | uint32 | 素材图片的层级,值越大表示越高层,0表示最底层 |
  26. * | +++ ratio | 是 | float32 | 相对于原素材图片大小的缩放比例,如0.5表示宽高均变为原来的一半 |
  27. */
  28. private String gen_txt;
  29. private String video_template_id;
  30. private String voice_id;
  31. private String voice_style;
  32. private VideoFiles video_files;
  33. public String neglectImgString(){
  34. StringBuffer str = new StringBuffer();
  35. str.append("{");
  36. str.append("\"gen_txt\":").append("\"").append(gen_txt).append("\",");
  37. str.append("\"video_template_id\":").append("\"").append(video_template_id).append("\",");
  38. str.append("\"voice_id\":").append("\"").append(voice_id).append("\",");
  39. str.append("\"voice_style\":").append("\"").append(voice_style).append("\",");
  40. if(video_files != null){
  41. str.append("\"video_files\":").append("{");
  42. if(video_files.getBack_ground() != null){
  43. str.append("\"back_ground\":").append("{")
  44. .append("\"image\":").append("\"").append("\",")
  45. .append("\"type\":").append("\"").append(video_files.getBack_ground().getType()).append("\"")
  46. .append("},");
  47. }
  48. if(video_files.getDigital_human() != null){
  49. str.append("\"digital_human\":").append("{")
  50. .append("\"coord\":").append(video_files.getDigital_human().getCoord().toString()).append(",")
  51. .append("\"level\":").append(video_files.getDigital_human().getLevel()).append(",")
  52. .append("\"ratio\":").append(video_files.getDigital_human().getRatio())
  53. .append("},");
  54. }
  55. if(video_files.getMaterial() != null && video_files.getMaterial().size() > 0){
  56. str.append("\"material\":").append("[");
  57. for (Material material:video_files.getMaterial()) {
  58. if(material != null){
  59. str.append("{");
  60. str.append("\"coord\":").append(material.getCoord().toString()).append(",")
  61. .append("\"image\":").append("\"").append("\",")
  62. .append("\"level\":").append(material.getLevel()).append(",")
  63. .append("\"ratio\":").append(material.getRatio());
  64. str.append("},");
  65. }
  66. }
  67. str.deleteCharAt(str.length()-1);
  68. str.append("]");
  69. }
  70. str.append("},");
  71. }
  72. str.deleteCharAt(str.length()-1);
  73. str.append("}");
  74. return str.toString();
  75. }
  76. @Data
  77. public static class VideoFiles {
  78. private BackGround back_ground;
  79. private Material digital_human;
  80. private List<Material> material;
  81. }
  82. @Data
  83. public static class BackGround {
  84. private String image;
  85. private String type;
  86. }
  87. @Data
  88. public static class Material {
  89. private int[] coord;
  90. private String image;
  91. private int level;
  92. private float ratio;
  93. }
  94. }