Skip to content

Commit 6b7bd4b

Browse files
author
jeffreykzli
committed
merge origin master
2 parents 4246921 + 83636dd commit 6b7bd4b

File tree

11 files changed

+160
-52
lines changed

11 files changed

+160
-52
lines changed

src/main/java/com/qcloud/cos/COSClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4081,8 +4081,8 @@ public MediaInfoResponse generateMediainfo(MediaInfoRequest request) {
40814081
rejectNull(request.getInput().getObject(),
40824082
"The input.object parameter must be specified setting the object tags");
40834083
CosHttpRequest<MediaInfoRequest> httpRequest = this.createRequest(request.getBucketName(), "/mediainfo", request, HttpMethodName.POST);
4084-
this.setContent(httpRequest, RequestXmlFactory.convertToXmlByteArray(request), "application/xml", false);
4085-
return this.invoke(httpRequest, new Unmarshallers.MediaInfoUnmarshaller());
4084+
this.setContent(httpRequest, CIAuditingXmlFactoryV2.convertToXmlByteArray(request), "application/xml", false);
4085+
return this.invoke(httpRequest, new Unmarshallers.CICommonUnmarshaller<MediaInfoResponse>(MediaInfoResponse.class));
40864086
}
40874087

40884088
@Override

src/main/java/com/qcloud/cos/demo/ci/MediaInfoDemo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.qcloud.cos.COSClient;
44
import com.qcloud.cos.model.ciModel.mediaInfo.MediaInfoRequest;
55
import com.qcloud.cos.model.ciModel.mediaInfo.MediaInfoResponse;
6+
import com.qcloud.cos.utils.CIJackson;
67

78
/**
89
* GenerateMediainfo 接口用于获取媒体文件的信息。

src/main/java/com/qcloud/cos/internal/ParserMediaInfoUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ public static void ParsingMediaVideo(MediaInfoVideo video, String name, String v
146146
video.setLanguage(value);
147147
case "NumFrames":
148148
video.setNumFrames(value);
149+
case "CreationTime":
150+
video.setCreationTime(value);
149151
default:
150152
break;
151153
}
@@ -558,6 +560,9 @@ public static void ParsingStreamAudio(MediaInfoAudio audio, String name, String
558560
case "CodecName":
559561
audio.setCodecName(value);
560562
break;
563+
case "CreationTime":
564+
audio.setCreationTime(value);
565+
break;
561566
default:
562567
break;
563568
}

src/main/java/com/qcloud/cos/internal/crypto/COSCryptoModuleBase.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,8 @@ public InitiateMultipartUploadResult initiateMultipartUploadSecurely(
235235
long dataSize = req.getDataSize();
236236
long partSize = req.getPartSize();
237237

238-
if (dataSize < 0 || partSize < 0) {
239-
throw new CosClientException("initiate multipart upload with encryption client must set dataSize and partSize");
240-
}
241-
242-
if (partSize % 16 != 0) {
243-
throw new CosClientException("initiat multipart uplaod with encryption client must set part size a mutiple of 16"
244-
+ "but got " + partSize);
238+
if (partSize < 0) {
239+
throw new CosClientException("initiate multipart upload with encryption client must set partSize");
245240
}
246241

247242
metadata.addUserMetadata(Headers.ENCRYPTION_DATA_SIZE, Long.toString(dataSize));

src/main/java/com/qcloud/cos/model/ciModel/mediaInfo/MediaInfoAudio.java

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ public class MediaInfoAudio {
9595
@XStreamAlias("Language")
9696
private String language;
9797

98+
@XStreamAlias("CreationTime")
99+
private String creationTime;
100+
98101
public String getBitrate() {
99102
return bitrate;
100103
}
@@ -215,24 +218,35 @@ public void setLanguage(String language) {
215218
this.language = language;
216219
}
217220

221+
public String getCreationTime() {
222+
return creationTime;
223+
}
224+
225+
public void setCreationTime(String creationTime) {
226+
this.creationTime = creationTime;
227+
}
228+
229+
218230
@Override
219231
public String toString() {
220-
return "MediaInfoAudio{" +
221-
"bitrate='" + bitrate + '\'' +
222-
", channel='" + channel + '\'' +
223-
", channelLayout='" + channelLayout + '\'' +
224-
", codecLongName='" + codecLongName + '\'' +
225-
", codecName='" + codecName + '\'' +
226-
", codecTag='" + codecTag + '\'' +
227-
", codecTagString='" + codecTagString + '\'' +
228-
", codecTimeBase='" + codecTimeBase + '\'' +
229-
", duration='" + duration + '\'' +
230-
", index='" + index + '\'' +
231-
", sampleFmt='" + sampleFmt + '\'' +
232-
", sampleRate='" + sampleRate + '\'' +
233-
", startTime='" + startTime + '\'' +
234-
", timebase='" + timebase + '\'' +
235-
", language='" + language + '\'' +
236-
'}';
232+
final StringBuilder sb = new StringBuilder("MediaInfoAudio{");
233+
sb.append("bitrate='").append(bitrate).append('\'');
234+
sb.append(", channel='").append(channel).append('\'');
235+
sb.append(", channelLayout='").append(channelLayout).append('\'');
236+
sb.append(", codecLongName='").append(codecLongName).append('\'');
237+
sb.append(", codecName='").append(codecName).append('\'');
238+
sb.append(", codecTag='").append(codecTag).append('\'');
239+
sb.append(", codecTagString='").append(codecTagString).append('\'');
240+
sb.append(", codecTimeBase='").append(codecTimeBase).append('\'');
241+
sb.append(", duration='").append(duration).append('\'');
242+
sb.append(", index='").append(index).append('\'');
243+
sb.append(", sampleFmt='").append(sampleFmt).append('\'');
244+
sb.append(", sampleRate='").append(sampleRate).append('\'');
245+
sb.append(", startTime='").append(startTime).append('\'');
246+
sb.append(", timebase='").append(timebase).append('\'');
247+
sb.append(", language='").append(language).append('\'');
248+
sb.append(", creationTime='").append(creationTime).append('\'');
249+
sb.append('}');
250+
return sb.toString();
237251
}
238252
}

src/main/java/com/qcloud/cos/model/ciModel/mediaInfo/MediaInfoRequest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
package com.qcloud.cos.model.ciModel.mediaInfo;
22

33
import com.qcloud.cos.internal.CIServiceRequest;
4+
import com.qcloud.cos.internal.CosServiceRequest;
45
import com.qcloud.cos.model.ciModel.common.MediaInputObject;
6+
import com.thoughtworks.xstream.annotations.XStreamAlias;
57

68
import java.io.Serializable;
79

810
/**
911
* 媒体信息接口 请求实体
1012
*/
13+
@XStreamAlias("Request")
1114
public class MediaInfoRequest extends CIServiceRequest implements Serializable {
15+
@XStreamAlias("BucketName")
16+
private String bucketName;
17+
@XStreamAlias("Input")
1218
private MediaInputObject input;
1319

20+
public String getBucketName() {
21+
return bucketName;
22+
}
23+
24+
public void setBucketName(String bucketName) {
25+
this.bucketName = bucketName;
26+
}
27+
1428
public MediaInputObject getInput() {
1529
if (input==null)
1630
input = new MediaInputObject();

src/main/java/com/qcloud/cos/model/ciModel/mediaInfo/MediaInfoResponse.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33

44
import com.qcloud.cos.model.CiServiceResult;
5+
import com.thoughtworks.xstream.annotations.XStreamAlias;
56

67
/**
78
* MediaInfo 媒体信息返回包装类 详情见:https://cloud.tencent.com/document/product/460/38935
89
*/
10+
@XStreamAlias("Response")
911
public class MediaInfoResponse extends CiServiceResult {
1012
/**
1113
* 媒体信息实体对象
1214
*/
15+
@XStreamAlias("MediaInfo")
1316
private MediaInfoStreamObject mediaInfo;
1417

1518
public MediaInfoStreamObject getMediaInfo() {

src/main/java/com/qcloud/cos/model/ciModel/mediaInfo/MediaInfoStream.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.qcloud.cos.model.ciModel.mediaInfo;
22

3+
import com.thoughtworks.xstream.annotations.XStreamAlias;
4+
import com.thoughtworks.xstream.annotations.XStreamImplicit;
5+
36
import java.util.ArrayList;
47
import java.util.List;
58

@@ -10,14 +13,17 @@ public class MediaInfoStream {
1013
/**
1114
* 视频信息
1215
*/
16+
@XStreamImplicit(itemFieldName = "Video")
1317
private List<MediaInfoVideo> mediaInfoVideoList;
1418
/**
1519
* 音频信息
1620
*/
21+
@XStreamImplicit(itemFieldName = "Audio")
1722
private List<MediaInfoAudio> mediaInfoAudioList;
1823
/**
1924
* 字幕信息
2025
*/
26+
@XStreamAlias("Subtitle")
2127
private MediaInfoSubtitle subtitle;
2228

2329
public List<MediaInfoVideo> getMediaInfoVideoList() {

src/main/java/com/qcloud/cos/model/ciModel/mediaInfo/MediaInfoStreamObject.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package com.qcloud.cos.model.ciModel.mediaInfo;
22

3+
import com.thoughtworks.xstream.annotations.XStreamAlias;
4+
35
import java.io.Serializable;
46

57
/**
68
* MediaInfo 格式详情实体类 详情见:https://cloud.tencent.com/document/product/460/38935
79
*/
810
public class MediaInfoStreamObject implements Serializable {
11+
@XStreamAlias("Format")
912
private MediaFormat format;
13+
@XStreamAlias("Stream")
1014
private MediaInfoStream stream;
1115

1216
public MediaFormat getFormat() {

src/main/java/com/qcloud/cos/model/ciModel/mediaInfo/MediaInfoVideo.java

Lines changed: 86 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ public class MediaInfoVideo {
4343
@XStreamAlias("CodecTag")
4444
private String codecTag;
4545

46+
/**
47+
* 色原
48+
*/
49+
@XStreamAlias("ColorPrimaries")
50+
private String colorPrimaries;
51+
52+
/**
53+
* 色彩范围
54+
*/
55+
@XStreamAlias("ColorRange")
56+
private String colorRange;
57+
58+
/**
59+
* 色彩通道
60+
*/
61+
@XStreamAlias("ColorTransfer")
62+
private String colorTransfer;
63+
4664
/**
4765
* 视频编码档位
4866
*/
@@ -151,8 +169,44 @@ public class MediaInfoVideo {
151169
@XStreamAlias("Language")
152170
private String language;
153171

172+
@XStreamAlias("Rotation")
154173
private String rotation;
155174

175+
@XStreamAlias("CreationTime")
176+
private String creationTime;
177+
178+
public String getColorPrimaries() {
179+
return colorPrimaries;
180+
}
181+
182+
public void setColorPrimaries(String colorPrimaries) {
183+
this.colorPrimaries = colorPrimaries;
184+
}
185+
186+
public String getColorRange() {
187+
return colorRange;
188+
}
189+
190+
public void setColorRange(String colorRange) {
191+
this.colorRange = colorRange;
192+
}
193+
194+
public String getColorTransfer() {
195+
return colorTransfer;
196+
}
197+
198+
public void setColorTransfer(String colorTransfer) {
199+
this.colorTransfer = colorTransfer;
200+
}
201+
202+
public String getCreationTime() {
203+
return creationTime;
204+
}
205+
206+
public void setCreationTime(String creationTime) {
207+
this.creationTime = creationTime;
208+
}
209+
156210
public String getIndex() {
157211
return index;
158212
}
@@ -355,31 +409,37 @@ public void setRotation(String rotation) {
355409

356410
@Override
357411
public String toString() {
358-
return "MediaInfoVideo{" +
359-
"index='" + index + '\'' +
360-
", codecName='" + codecName + '\'' +
361-
", codecLongName='" + codecLongName + '\'' +
362-
", codecTimeBase='" + codecTimeBase + '\'' +
363-
", codecTagString='" + codecTagString + '\'' +
364-
", codecTag='" + codecTag + '\'' +
365-
", profile='" + profile + '\'' +
366-
", height='" + height + '\'' +
367-
", width='" + width + '\'' +
368-
", hasBFrame='" + hasBFrame + '\'' +
369-
", refFrames='" + refFrames + '\'' +
370-
", sar='" + sar + '\'' +
371-
", dar='" + dar + '\'' +
372-
", pixFormat='" + pixFormat + '\'' +
373-
", fieldOrder='" + fieldOrder + '\'' +
374-
", level='" + level + '\'' +
375-
", fps='" + fps + '\'' +
376-
", avgFps='" + avgFps + '\'' +
377-
", timebase='" + timebase + '\'' +
378-
", startTime='" + startTime + '\'' +
379-
", duration='" + duration + '\'' +
380-
", bitrate='" + bitrate + '\'' +
381-
", numFrames='" + numFrames + '\'' +
382-
", language='" + language + '\'' +
383-
'}';
412+
final StringBuilder sb = new StringBuilder("MediaInfoVideo{");
413+
sb.append("index='").append(index).append('\'');
414+
sb.append(", codecName='").append(codecName).append('\'');
415+
sb.append(", codecLongName='").append(codecLongName).append('\'');
416+
sb.append(", codecTimeBase='").append(codecTimeBase).append('\'');
417+
sb.append(", codecTagString='").append(codecTagString).append('\'');
418+
sb.append(", codecTag='").append(codecTag).append('\'');
419+
sb.append(", colorPrimaries='").append(colorPrimaries).append('\'');
420+
sb.append(", colorRange='").append(colorRange).append('\'');
421+
sb.append(", colorTransfer='").append(colorTransfer).append('\'');
422+
sb.append(", profile='").append(profile).append('\'');
423+
sb.append(", height='").append(height).append('\'');
424+
sb.append(", width='").append(width).append('\'');
425+
sb.append(", hasBFrame='").append(hasBFrame).append('\'');
426+
sb.append(", refFrames='").append(refFrames).append('\'');
427+
sb.append(", sar='").append(sar).append('\'');
428+
sb.append(", dar='").append(dar).append('\'');
429+
sb.append(", pixFormat='").append(pixFormat).append('\'');
430+
sb.append(", fieldOrder='").append(fieldOrder).append('\'');
431+
sb.append(", level='").append(level).append('\'');
432+
sb.append(", fps='").append(fps).append('\'');
433+
sb.append(", avgFps='").append(avgFps).append('\'');
434+
sb.append(", timebase='").append(timebase).append('\'');
435+
sb.append(", startTime='").append(startTime).append('\'');
436+
sb.append(", duration='").append(duration).append('\'');
437+
sb.append(", bitrate='").append(bitrate).append('\'');
438+
sb.append(", numFrames='").append(numFrames).append('\'');
439+
sb.append(", language='").append(language).append('\'');
440+
sb.append(", rotation='").append(rotation).append('\'');
441+
sb.append(", creationTime='").append(creationTime).append('\'');
442+
sb.append('}');
443+
return sb.toString();
384444
}
385445
}

0 commit comments

Comments
 (0)