Skip to content

Commit 41d61ec

Browse files
authored
Merge pull request #200 from tencentyun/feature_jojoliang_985bbfa3
Feature jojoliang 985bbfa3
2 parents 104ca44 + c0c434b commit 41d61ec

File tree

5 files changed

+144
-5
lines changed

5 files changed

+144
-5
lines changed

batch.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ type BatchJobReport struct {
3333
}
3434

3535
// BatchJobOperationCopy
36+
type BatchCOSTag struct {
37+
Key string `xml:"Key,omitempty" header:"-" url:"-"`
38+
Value string `xml:"Value,omitempty" header:"-" url:"-"`
39+
}
40+
type BatchNewObjectTagging struct {
41+
COSTag []BatchCOSTag `xml:"COSTag,omitempty" header:"-" url:"-"`
42+
}
43+
3644
type BatchMetadata struct {
3745
Key string `xml:"Key" header:"-" url:"-"`
3846
Value string `xml:"Value" header:"-" url:"-"`
@@ -59,12 +67,18 @@ type BatchAccessControlGrants struct {
5967
COSGrants *BatchCOSGrant `xml:"COSGrant,omitempty" header:"-" url:"-"`
6068
}
6169
type BatchJobOperationCopy struct {
70+
AccessControlDirective string `xml:"AccessControlDirective,omitempty" header:"-" url:"-"`
6271
AccessControlGrants *BatchAccessControlGrants `xml:"AccessControlGrants,omitempty" header:"-" url:"-"`
6372
CannedAccessControlList string `xml:"CannedAccessControlList,omitempty" header:"-" url:"-"`
73+
PrefixReplace bool `xml:"PrefixReplace,omitempty" header:"-" url:"-"`
74+
ResourcesPrefix string `xml:"ResourcesPrefix,omitempty" header:"-" url:"-"`
75+
TargetKeyPrefix string `xml:"TargetKeyPrefix,omitempty" header:"-" url:"-"`
6476
MetadataDirective string `xml:"MetadataDirective,omitempty" header:"-" url:"-"`
6577
ModifiedSinceConstraint int64 `xml:"ModifiedSinceConstraint,omitempty" header:"-" url:"-"`
6678
UnModifiedSinceConstraint int64 `xml:"UnModifiedSinceConstraint,omitempty" header:"-" url:"-"`
6779
NewObjectMetadata *BatchNewObjectMetadata `xml:"NewObjectMetadata,omitempty" header:"-" url:"-"`
80+
TaggingDirective string `xml:"TaggingDirective,omitempty" header:"-" url:"-"`
81+
NewObjectTagging *BatchNewObjectTagging `xml:"NewObjectTagging,omitempty" header:"-" url:"-"`
6882
StorageClass string `xml:"StorageClass,omitempty" header:"-" url:"-"`
6983
TargetResource string `xml:"TargetResource" header:"-" url:"-"`
7084
}

ci_media.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ type MediaProcessJobOperation struct {
729729
SpeechRecognition *SpeechRecognition `xml:"SpeechRecognition,omitempty"`
730730
SpeechRecognitionResult *SpeechRecognitionResult `xml:"SpeechRecognitionResult,omitempty"`
731731
SoundHoundResult *SoundHoundResult `xml:"SoundHoundResult,omitempty"`
732+
FillConcat *FillConcat `xml:"FillConcat,omitempty"`
733+
VideoSynthesis *VideoSynthesis `xml:"VideoSynthesis,omitempty"`
732734
}
733735

734736
// CreatePicJobsOptions TODO
@@ -3400,3 +3402,30 @@ func (s *CIService) DeleteTemplate(ctx context.Context, tempalteId string) (*Del
34003402
resp, err := s.client.send(ctx, &sendOpt)
34013403
return &res, resp, err
34023404
}
3405+
3406+
// FillConcat 填充拼接
3407+
type FillConcat struct {
3408+
Format string `xml:"Format,omitempty"`
3409+
FillInput []FillConcatInput `xml:"FillInput,omitempty"`
3410+
}
3411+
3412+
// FillConcatInput 填充拼接输入
3413+
type FillConcatInput struct {
3414+
Url string `xml:"Url,omitempty"`
3415+
FillTime string `xml:"FillTime,omitempty"`
3416+
}
3417+
3418+
// VideoSynthesis 视频合成
3419+
type VideoSynthesis struct {
3420+
KeepAudioTrack string `xml:"KeepAudioTrack,omitempty"`
3421+
SpliceInfo []VideoSynthesisSpliceInfo `xml:"SpliceInfo,omitempty"`
3422+
}
3423+
3424+
// VideoSynthesisSpliceInfo 视频合成输入
3425+
type VideoSynthesisSpliceInfo struct {
3426+
Url string `xml:"Url,omitempty"`
3427+
X string `xml:"X,omitempty"`
3428+
Y string `xml:"Y,omitempty"`
3429+
Width string `xml:"Width,omitempty"`
3430+
Height string `xml:"Height,omitempty"`
3431+
}

example/CI/workflow_and_job/jobs.go

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func DescribeJobs() {
7676
// https://cloud.tencent.com/document/product/460/84765
7777
func DescribeJob() {
7878
c := getClient()
79-
DescribeJobRes, _, err := c.CI.DescribeJob(context.Background(), "j5c6b2d1e044e11ee8b23bda0f853af96")
79+
DescribeJobRes, _, err := c.CI.DescribeJob(context.Background(), "ja507fb3413f711eebccc9dd62ab48c0e")
8080
log_status(err)
8181
fmt.Printf("%+v\n", DescribeJobRes.JobsDetail)
8282
}
@@ -120,6 +120,7 @@ func InvokeTranscodeJob() {
120120
}
121121

122122
// InvokeVideoEnhanceJob 提交一个画质增强任务
123+
// https://cloud.tencent.com/document/product/460/84775
123124
func InvokeVideoEnhanceJob() {
124125
c := getClient()
125126
createJobOpt := &cos.CreateJobsOptions{
@@ -180,7 +181,7 @@ func InvokeVideoEnhanceJob() {
180181
fmt.Printf("%+v\n", createJobRes.JobsDetail)
181182
}
182183

183-
// InvokeMediaInfoJob 提交一个获取媒体信息
184+
// InvokeMediaInfoJob 提交一个获取媒体信息任务
184185
// https://cloud.tencent.com/document/product/460/84776
185186
func InvokeMediaInfoJob() {
186187
c := getClient()
@@ -522,6 +523,10 @@ func InvokeConcatJob() {
522523
Codec: "AAC",
523524
},
524525
ConcatFragment: concatFragment,
526+
SceneChangeInfo: &cos.SceneChangeInfo{
527+
Mode: "GRADIENT", // Default:不添加转场特效; FADE:淡入淡出; GRADIENT:渐变
528+
Time: "4.5", // 取值范围:(0, 5], 支持小数, 默认值3
529+
},
525530
},
526531
},
527532
}
@@ -947,6 +952,99 @@ func InvokeMultiJobs() {
947952
}
948953
}
949954

955+
// InvokeFillConcatJob 提交一个填充拼接任务
956+
func InvokeFillConcatJob() {
957+
c := getClient()
958+
FillConcat := make([]cos.FillConcatInput, 0)
959+
FillConcat = append(FillConcat, cos.FillConcatInput{
960+
Url: "https://test-1234567890.cos.ap-chongqing.myqcloud.com/input/car.mp4",
961+
})
962+
FillConcat = append(FillConcat, cos.FillConcatInput{
963+
FillTime: "5.5",
964+
})
965+
FillConcat = append(FillConcat, cos.FillConcatInput{
966+
Url: "https://test-1234567890.cos.ap-chongqing.myqcloud.com/input/game.mp4",
967+
})
968+
createJobOpt := &cos.CreateJobsOptions{
969+
Tag: "FillConcat",
970+
Operation: &cos.MediaProcessJobOperation{
971+
FillConcat: &cos.FillConcat{
972+
Format: "mp4",
973+
FillInput: FillConcat,
974+
},
975+
Output: &cos.JobOutput{
976+
Region: "ap-chongqing",
977+
Object: "fill_concat.mp4",
978+
Bucket: "test-1234567890",
979+
},
980+
},
981+
}
982+
createJobRes, _, err := c.CI.CreateJob(context.Background(), createJobOpt)
983+
log_status(err)
984+
fmt.Printf("%+v\n", createJobRes.JobsDetail)
985+
}
986+
987+
// InvokeVideoSynthesisJob 提交一个视频合成任务
988+
func InvokeVideoSynthesisJob() {
989+
c := getClient()
990+
SpliceInfo := make([]cos.VideoSynthesisSpliceInfo, 0)
991+
SpliceInfo = append(SpliceInfo, cos.VideoSynthesisSpliceInfo{
992+
Url: "https://test-1234567890.cos.ap-chongqing.myqcloud.com/input/car.mp4",
993+
Width: "640",
994+
})
995+
SpliceInfo = append(SpliceInfo, cos.VideoSynthesisSpliceInfo{
996+
Url: "https://test-1234567890.cos.ap-chongqing.myqcloud.com/input/game.mp4",
997+
X: "640",
998+
Width: "640",
999+
})
1000+
w := cos.Watermark{
1001+
Type: "Text",
1002+
LocMode: "Absolute",
1003+
Dx: "640",
1004+
Pos: "TopLeft",
1005+
Text: &cos.Text{
1006+
Text: "helloworld",
1007+
FontSize: "25",
1008+
FontType: "simfang.ttf",
1009+
FontColor: "0xff0000",
1010+
Transparency: "100",
1011+
},
1012+
}
1013+
ws := []cos.Watermark{}
1014+
ws = append(ws, w)
1015+
createJobOpt := &cos.CreateJobsOptions{
1016+
Tag: "VideoSynthesis",
1017+
Operation: &cos.MediaProcessJobOperation{
1018+
VideoSynthesis: &cos.VideoSynthesis{
1019+
KeepAudioTrack: "false",
1020+
SpliceInfo: SpliceInfo,
1021+
},
1022+
Transcode: &cos.Transcode{
1023+
Container: &cos.Container{
1024+
Format: "mp4",
1025+
},
1026+
Video: &cos.Video{
1027+
Codec: "H.264",
1028+
Width: "1280",
1029+
Height: "960",
1030+
},
1031+
Audio: &cos.Audio{
1032+
Codec: "AAC",
1033+
},
1034+
},
1035+
Watermark: ws,
1036+
Output: &cos.JobOutput{
1037+
Region: "ap-chongqing",
1038+
Object: "video_synthesis.mp4",
1039+
Bucket: "test-1234567890",
1040+
},
1041+
},
1042+
}
1043+
createJobRes, _, err := c.CI.CreateJob(context.Background(), createJobOpt)
1044+
log_status(err)
1045+
fmt.Printf("%+v\n", createJobRes.JobsDetail)
1046+
}
1047+
9501048
// JobNotifyCallback 解析任务回调
9511049
func JobNotifyCallback() {
9521050
taskBody := "<Response><EventName>TaskFinish</EventName><JobsDetail><Code>Success</Code><CreationTime>2022-06-30T19:30:20+0800</CreationTime><EndTime>2022-06-30T19:31:56+0800</EndTime><Input><BucketId>test-123456789</BucketId><Object>input/demo.mp4</Object><Region>ap-chongqing</Region><CosHeaders><Key>Content-Type</Key><Value>video/mp4</Value></CosHeaders><CosHeaders><Key>x-cos-request-id</Key><Value>NjJiZDYwYTFfNjUzYTYyNjRfZjEwZl8xMmZhYzY5</Value></CosHeaders><CosHeaders><Key>EventName</Key><Value>cos:ObjectCreated:Put</Value></CosHeaders><CosHeaders><Key>Size</Key><Value>1424687</Value></CosHeaders></Input><JobId>j06668dc0f86811ecb90d0b03267ce0e5</JobId><Message/><Operation><DigitalWatermark><IgnoreError>false</IgnoreError><Message>123456789ab</Message><State>Failed</State><Type>Text</Type><Version>V1</Version></DigitalWatermark><MediaInfo><Format><Bitrate>8867.172000</Bitrate><Duration>13.654000</Duration><FormatLongName>QuickTime / MOV</FormatLongName><FormatName>mov,mp4,m4a,3gp,3g2,mj2</FormatName><NumProgram>0</NumProgram><NumStream>2</NumStream><Size>15134046</Size><StartTime>0.000000</StartTime></Format><Stream><Audio><Bitrate>128.726000</Bitrate><Channel>2</Channel><ChannelLayout>stereo</ChannelLayout><CodecLongName>AAC (Advanced Audio Coding)</CodecLongName><CodecName>aac</CodecName><CodecTag>0x6134706d</CodecTag><CodecTagString>mp4a</CodecTagString><CodecTimeBase>1/44100</CodecTimeBase><Duration>13.652993</Duration><Index>1</Index><Language>und</Language><SampleFmt>fltp</SampleFmt><SampleRate>44100</SampleRate><StartTime>0.000000</StartTime><Timebase>1/44100</Timebase></Audio><Subtitle/><Video><AvgFps>25.000000</AvgFps><Bitrate>9197.180000</Bitrate><CodecLongName>H.265 / HEVC (High Efficiency Video Coding)</CodecLongName><CodecName>hevc</CodecName><CodecTag>0x31766568</CodecTag><CodecTagString>hev1</CodecTagString><CodecTimeBase>1/12800</CodecTimeBase><ColorPrimaries>bt470bg</ColorPrimaries><ColorRange>tv</ColorRange><ColorTransfer>smpte170m</ColorTransfer><Duration>12.960000</Duration><FieldOrder>progressive</FieldOrder><Fps>25.000000</Fps><HasBFrame>2</HasBFrame><Height>1920</Height><Index>0</Index><Language>und</Language><Level>120</Level><NumFrames>324</NumFrames><PixFormat>yuv420p</PixFormat><Profile>Main</Profile><RefFrames>1</RefFrames><Rotation>0.000000</Rotation><StartTime>0.000000</StartTime><Timebase>1/12800</Timebase><Width>1088</Width></Video></Stream></MediaInfo><MediaResult><OutputFile><Bucket>test-123456789</Bucket><Md5Info><Md5>852883012a6ba726e6ed8d9b984edfdf</Md5><ObjectName>output/super_resolution.mp4</ObjectName></Md5Info><ObjectName>output/super_resolution.mp4</ObjectName><ObjectPrefix/><Region>ap-chongqing</Region></OutputFile></MediaResult><Output><Bucket>test-123456789</Bucket><Object>output/super_resolution.${ext}</Object><Region>ap-chongqing</Region></Output><TemplateId>t1f1ae1dfsdc9ds41dsb31632d45710642a</TemplateId><TemplateName>template_superresolution</TemplateName><TranscodeTemplateId>t156c107210e7243c5817354565d81b578</TranscodeTemplateId><UserData>This is my SuperResolution job.</UserData><JobLevel>0</JobLevel><WatermarkTemplateId>t143ae6e040af6431aa772c9ec3f0a3f36</WatermarkTemplateId><WatermarkTemplateId>t12a74d11687d444deba8a6cc52051ac27</WatermarkTemplateId></Operation><QueueId>p2242ab62c7c94486915508540933a2c6</QueueId><StartTime>2022-06-30T19:30:21+0800</StartTime><State>Success</State><Progress>100</Progress><SubTag>DigitalWatermark</SubTag><Tag>SuperResolution</Tag><Workflow><Name>SuperResolution_1581665960537</Name><RunId>ic90edd59f84f11ec9d4f525400a3c59f</RunId><WorkflowId>web6ac56c1ef54dbfa44d7f4103203be9</WorkflowId><WorkflowName>workflow-test</WorkflowName></Workflow></JobsDetail></Response>"

example/CI/workflow_and_job/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ func CreateVideoTargetRecTemplate() {
779779
}
780780

781781
// UpdateVideoTargetRecTemplate 更新视频目标检测模板
782-
// https://cloud.tencent.com/document/product/460/84760
782+
// https://cloud.tencent.com/document/product/460/84756
783783
func UpdateVideoTargetRecTemplate() {
784784
c := getClient()
785785
rand.Seed(time.Now().UnixNano())

example/CI/workflow_and_job/workflow.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ func DeleteWorkflow() {
8282
// https://cloud.tencent.com/document/product/460/76856
8383
func CreateWorkflow() {
8484
c := getClient()
85-
// CreateMediaWorkflow
8685
rand.Seed(time.Now().UnixNano())
8786
createWorkflowOpt := &cos.CreateMediaWorkflowOptions{
8887
MediaWorkflow: &cos.MediaWorkflow{
@@ -110,7 +109,6 @@ func CreateWorkflow() {
110109
// https://cloud.tencent.com/document/product/460/76861
111110
func UpdateWorkflow() {
112111
c := getClient()
113-
// UpdateMediaWorkflow
114112
rand.Seed(time.Now().UnixNano())
115113
updateWorkflowOpt := &cos.CreateMediaWorkflowOptions{
116114
MediaWorkflow: &cos.MediaWorkflow{

0 commit comments

Comments
 (0)