MediaSetVideoProps.java
5.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.scene7.is.catalog.util.ObjectTypeEnum
* com.scene7.is.catalog.util.localization.LocaleMap
* com.scene7.is.provider.UserData
* com.scene7.is.provider.ZoomTargets
* com.scene7.is.provider.catalog.Catalog
* com.scene7.is.provider.catalog.CatalogException
* com.scene7.is.provider.catalog.ObjectRecord
* com.scene7.is.sleng.HotSpot
* com.scene7.is.util.SizeInt
* com.scene7.is.util.callbacks.Option
* com.scene7.is.util.collections.CollectionUtil
* com.scene7.is.util.text.ParsingException
* org.jetbrains.annotations.NotNull
*/
package com.scene7.is.ps.provider.fvctx;
import com.scene7.is.catalog.util.ObjectTypeEnum;
import com.scene7.is.catalog.util.localization.LocaleMap;
import com.scene7.is.provider.UserData;
import com.scene7.is.provider.ZoomTargets;
import com.scene7.is.provider.catalog.Catalog;
import com.scene7.is.provider.catalog.CatalogException;
import com.scene7.is.provider.catalog.ObjectRecord;
import com.scene7.is.ps.provider.fvctx.FvctxImagePath;
import com.scene7.is.ps.provider.fvctx.MediaSetMetaData;
import com.scene7.is.ps.provider.fvctx.MediaSetVideoEntry;
import com.scene7.is.sleng.HotSpot;
import com.scene7.is.util.SizeInt;
import com.scene7.is.util.callbacks.Option;
import com.scene7.is.util.collections.CollectionUtil;
import com.scene7.is.util.text.ParsingException;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;
import java.util.zip.Adler32;
import org.jetbrains.annotations.NotNull;
public class MediaSetVideoProps {
@NotNull
private final byte[] versionKey;
@NotNull
private final String recordId;
@NotNull
private final List<UserData> userData;
@NotNull
private final String fileSuffix;
@NotNull
private final String filePath;
@NotNull
private final LocaleMap localeMap;
@NotNull
private final String locale;
private final boolean isInCatalog;
private final Option<Long> bitRate;
@NotNull
private final Option<SizeInt> videoSize;
@NotNull
private final Option<String> videoFormat;
private static final Logger LOGGER = Logger.getLogger(MediaSetVideoProps.class.getName());
public MediaSetVideoProps(@NotNull byte[] versionKey, @NotNull String recordId, @NotNull String fileSuffix, @NotNull String filePath, @NotNull List<UserData> userData, @NotNull LocaleMap localeMap, @NotNull String locale, boolean isInCatalog, Option<Long> bitRate, @NotNull Option<SizeInt> videoSize, @NotNull Option<String> videoFormat) {
this.versionKey = Arrays.copyOf(versionKey, versionKey.length);
this.recordId = recordId;
this.fileSuffix = fileSuffix;
this.filePath = filePath;
this.userData = CollectionUtil.copy(userData);
this.localeMap = localeMap;
this.locale = locale;
this.isInCatalog = isInCatalog;
this.bitRate = bitRate;
this.videoSize = videoSize;
this.videoFormat = videoFormat;
}
public MediaSetVideoProps(@NotNull MediaSetVideoEntry videoEntry) {
this(videoEntry.getVersionKey(), videoEntry.getRecordId(), videoEntry.getFileSuffix(), videoEntry.getFilePath(), videoEntry.getMetaData().getUserData(), videoEntry.getMetaData().getLocaleMap(), videoEntry.getMetaData().getLocale(), videoEntry.isInCatalog(), videoEntry.getBitRate(), videoEntry.getVideoSize(), videoEntry.getVideoFormat());
}
@NotNull
public static Adler32 updateVideoDigest(@NotNull Adler32 digest, @NotNull MediaSetVideoProps videoProps) {
digest.update(videoProps.versionKey);
return digest;
}
@NotNull
public static MediaSetMetaData buildVideoUserData(@NotNull Catalog catalog, @NotNull String path, String locale) throws ParsingException, CatalogException {
String preparedPath = FvctxImagePath.preparePath(path);
ObjectRecord videoRecord = catalog.getRecord(preparedPath, ObjectTypeEnum.STATIC);
if (!videoRecord.isSubstitute()) {
UserData userData = videoRecord.getUserData();
LocaleMap localeMap = catalog.getLocaleStrMap();
return new MediaSetMetaData(MediaSetMetaData.EMPTY_TARGETS, MediaSetMetaData.EMPTY_MAPS, CollectionUtil.immutableListOf((Object[])new UserData[]{userData}), localeMap, locale);
}
return MediaSetMetaData.EMPTY_MEDIA_SET_META_DATA;
}
@NotNull
public byte[] getVersionKey() {
return this.versionKey;
}
@NotNull
public String getRecordId() {
return this.recordId;
}
@NotNull
public List<UserData> getUserData() {
return CollectionUtil.copy(this.userData);
}
@NotNull
public String getFileSuffix() {
return this.fileSuffix;
}
@NotNull
public LocaleMap getLocaleMap() {
return this.localeMap;
}
@NotNull
public String getLocale() {
return this.locale;
}
public boolean isInCatalog() {
return this.isInCatalog;
}
@NotNull
public String getFilePath() {
return this.filePath;
}
public Option<Long> getBitRate() {
return this.bitRate;
}
@NotNull
public Option<SizeInt> getVideoSize() {
return this.videoSize;
}
@NotNull
public Option<String> getVideoFormat() {
return this.videoFormat;
}
}