Skip to content

Commit e750662

Browse files
author
markjrzhang
committed
update Mediainfo API
1 parent 58c2dec commit e750662

File tree

10 files changed

+139
-56
lines changed

10 files changed

+139
-56
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.qcloud</groupId>
66
<artifactId>cos_api</artifactId>
7-
<version>5.6.235</version>
7+
<version>5.6.237</version>
88
<packaging>jar</packaging>
99
<name>cos-java-sdk</name>
1010
<description>java sdk for qcloud cos</description>

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

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

40254025
@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/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: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ public class MediaInfoAudio {
9595
@XStreamAlias("Language")
9696
private String language;
9797

98-
/**
99-
* 语言
100-
*/
10198
@XStreamAlias("CreationTime")
10299
private String creationTime;
103100

@@ -229,24 +226,27 @@ public void setCreationTime(String creationTime) {
229226
this.creationTime = creationTime;
230227
}
231228

229+
232230
@Override
233231
public String toString() {
234-
return "MediaInfoAudio{" +
235-
"bitrate='" + bitrate + '\'' +
236-
", channel='" + channel + '\'' +
237-
", channelLayout='" + channelLayout + '\'' +
238-
", codecLongName='" + codecLongName + '\'' +
239-
", codecName='" + codecName + '\'' +
240-
", codecTag='" + codecTag + '\'' +
241-
", codecTagString='" + codecTagString + '\'' +
242-
", codecTimeBase='" + codecTimeBase + '\'' +
243-
", duration='" + duration + '\'' +
244-
", index='" + index + '\'' +
245-
", sampleFmt='" + sampleFmt + '\'' +
246-
", sampleRate='" + sampleRate + '\'' +
247-
", startTime='" + startTime + '\'' +
248-
", timebase='" + timebase + '\'' +
249-
", language='" + language + '\'' +
250-
'}';
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();
251251
}
252252
}

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)