submit_analysis_job.go 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. package mts
  2. //Licensed under the Apache License, Version 2.0 (the "License");
  3. //you may not use this file except in compliance with the License.
  4. //You may obtain a copy of the License at
  5. //
  6. //http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. //Unless required by applicable law or agreed to in writing, software
  9. //distributed under the License is distributed on an "AS IS" BASIS,
  10. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. //See the License for the specific language governing permissions and
  12. //limitations under the License.
  13. //
  14. // Code generated by Alibaba Cloud SDK Code Generator.
  15. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. func (client *Client) SubmitAnalysisJob(request *SubmitAnalysisJobRequest) (response *SubmitAnalysisJobResponse, err error) {
  21. response = CreateSubmitAnalysisJobResponse()
  22. err = client.DoAction(request, response)
  23. return
  24. }
  25. func (client *Client) SubmitAnalysisJobWithChan(request *SubmitAnalysisJobRequest) (<-chan *SubmitAnalysisJobResponse, <-chan error) {
  26. responseChan := make(chan *SubmitAnalysisJobResponse, 1)
  27. errChan := make(chan error, 1)
  28. err := client.AddAsyncTask(func() {
  29. defer close(responseChan)
  30. defer close(errChan)
  31. response, err := client.SubmitAnalysisJob(request)
  32. responseChan <- response
  33. errChan <- err
  34. })
  35. if err != nil {
  36. errChan <- err
  37. close(responseChan)
  38. close(errChan)
  39. }
  40. return responseChan, errChan
  41. }
  42. func (client *Client) SubmitAnalysisJobWithCallback(request *SubmitAnalysisJobRequest, callback func(response *SubmitAnalysisJobResponse, err error)) <-chan int {
  43. result := make(chan int, 1)
  44. err := client.AddAsyncTask(func() {
  45. var response *SubmitAnalysisJobResponse
  46. var err error
  47. defer close(result)
  48. response, err = client.SubmitAnalysisJob(request)
  49. callback(response, err)
  50. result <- 1
  51. })
  52. if err != nil {
  53. defer close(result)
  54. callback(nil, err)
  55. result <- 0
  56. }
  57. return result
  58. }
  59. type SubmitAnalysisJobRequest struct {
  60. *requests.RpcRequest
  61. Input string `position:"Query" name:"Input"`
  62. UserData string `position:"Query" name:"UserData"`
  63. ResourceOwnerId string `position:"Query" name:"ResourceOwnerId"`
  64. AnalysisConfig string `position:"Query" name:"AnalysisConfig"`
  65. ResourceOwnerAccount string `position:"Query" name:"ResourceOwnerAccount"`
  66. OwnerAccount string `position:"Query" name:"OwnerAccount"`
  67. Action string `position:"Query" name:"Action"`
  68. OwnerId string `position:"Query" name:"OwnerId"`
  69. Priority string `position:"Query" name:"Priority"`
  70. AccessKeyId string `position:"Query" name:"AccessKeyId"`
  71. PipelineId string `position:"Query" name:"PipelineId"`
  72. }
  73. type SubmitAnalysisJobResponse struct {
  74. *responses.BaseResponse
  75. RequestId string `json:"RequestId"`
  76. AnalysisJob struct {
  77. Id string `json:"Id"`
  78. UserData string `json:"UserData"`
  79. State string `json:"State"`
  80. Code string `json:"Code"`
  81. Message string `json:"Message"`
  82. Percent int64 `json:"Percent"`
  83. CreationTime string `json:"CreationTime"`
  84. PipelineId string `json:"PipelineId"`
  85. Priority string `json:"Priority"`
  86. InputFile struct {
  87. Bucket string `json:"Bucket"`
  88. Location string `json:"Location"`
  89. Object string `json:"Object"`
  90. } `json:"InputFile"`
  91. AnalysisConfig struct {
  92. QualityControl struct {
  93. RateQuality string `json:"RateQuality"`
  94. MethodStreaming string `json:"MethodStreaming"`
  95. } `json:"QualityControl"`
  96. PropertiesControl struct {
  97. Deinterlace string `json:"Deinterlace"`
  98. Crop struct {
  99. Mode string `json:"Mode"`
  100. Width string `json:"Width"`
  101. Height string `json:"Height"`
  102. Top string `json:"Top"`
  103. Left string `json:"Left"`
  104. } `json:"Crop"`
  105. } `json:"PropertiesControl"`
  106. } `json:"AnalysisConfig"`
  107. MNSMessageResult struct {
  108. MessageId string `json:"MessageId"`
  109. ErrorMessage string `json:"ErrorMessage"`
  110. ErrorCode string `json:"ErrorCode"`
  111. } `json:"MNSMessageResult"`
  112. TemplateList []struct {
  113. Id string `json:"Id"`
  114. Name string `json:"Name"`
  115. State string `json:"State"`
  116. Container struct {
  117. Format string `json:"Format"`
  118. } `json:"Container"`
  119. Video struct {
  120. Codec string `json:"Codec"`
  121. Profile string `json:"Profile"`
  122. Bitrate string `json:"Bitrate"`
  123. Crf string `json:"Crf"`
  124. Width string `json:"Width"`
  125. Height string `json:"Height"`
  126. Fps string `json:"Fps"`
  127. Gop string `json:"Gop"`
  128. Preset string `json:"Preset"`
  129. ScanMode string `json:"ScanMode"`
  130. Bufsize string `json:"Bufsize"`
  131. Maxrate string `json:"Maxrate"`
  132. PixFmt string `json:"PixFmt"`
  133. Degrain string `json:"Degrain"`
  134. Qscale string `json:"Qscale"`
  135. BitrateBnd struct {
  136. Max string `json:"Max"`
  137. Min string `json:"Min"`
  138. } `json:"BitrateBnd"`
  139. } `json:"Video"`
  140. Audio struct {
  141. Codec string `json:"Codec"`
  142. Profile string `json:"Profile"`
  143. Samplerate string `json:"Samplerate"`
  144. Bitrate string `json:"Bitrate"`
  145. Channels string `json:"Channels"`
  146. Qscale string `json:"Qscale"`
  147. } `json:"Audio"`
  148. TransConfig struct {
  149. TransMode string `json:"TransMode"`
  150. } `json:"TransConfig"`
  151. MuxConfig struct {
  152. Segment struct {
  153. Duration string `json:"Duration"`
  154. } `json:"Segment"`
  155. Gif struct {
  156. Loop string `json:"Loop"`
  157. FinalDelay string `json:"FinalDelay"`
  158. } `json:"Gif"`
  159. } `json:"MuxConfig"`
  160. } `json:"TemplateList"`
  161. } `json:"AnalysisJob"`
  162. }
  163. func CreateSubmitAnalysisJobRequest() (request *SubmitAnalysisJobRequest) {
  164. request = &SubmitAnalysisJobRequest{
  165. RpcRequest: &requests.RpcRequest{},
  166. }
  167. request.InitWithApiInfo("Mts", "2014-06-18", "SubmitAnalysisJob", "", "")
  168. return
  169. }
  170. func CreateSubmitAnalysisJobResponse() (response *SubmitAnalysisJobResponse) {
  171. response = &SubmitAnalysisJobResponse{
  172. BaseResponse: &responses.BaseResponse{},
  173. }
  174. return
  175. }