Skip to content

Commit

Permalink
VTK-427 correctly name thumbnail representation even if thumbnail don…
Browse files Browse the repository at this point in the history
…'t share a common prefix
  • Loading branch information
sannies committed Sep 1, 2017
1 parent 2a1655d commit 76a5331
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ private static String greatestCommonPrefix(String a, String b) {

public static void addThumbnailTrack(PeriodType periodType, List<File> files, File outputDirectory, Map<String, String> outOptions) throws IOException {
LOG.info("Using thumbnail files in following order: " + files.stream().map(File::getName).collect(Collectors.joining(", ")));
String prefix = files.get(0).getName();
String prefix = files.get(0).getAbsolutePath();

Dimension dRef = null;
for (File file : files) {
prefix = greatestCommonPrefix(prefix, file.getName());
prefix = greatestCommonPrefix(prefix, file.getAbsolutePath());
Dimension d = getImageDimension(file);
if (dRef == null) {
dRef = d;
Expand All @@ -215,6 +215,7 @@ public static void addThumbnailTrack(PeriodType periodType, List<File> files, Fi
}
}
}
prefix = prefix.split(File.separator)[prefix.split(File.separator).length-1];
assert dRef != null;
File targetDir = new File(outputDirectory, prefix);
long thumbsize = 0;
Expand Down Expand Up @@ -310,6 +311,21 @@ public static RepresentationType addVideoRepresentation(AdaptationSetType adapta
representationType.setWidth(videoWidth);
representationType.setHeight(videoHeight);
representationType.setFrameRate(convertFramerate(framesPerSecond));
/*for (SampleEntry se : t.getSampleEntries()) {
OriginalFormatBox frma = Path.getPath((Box) se, "sinf/frma");
String type;
if (frma != null) {
type = frma.getDataFormat();
} else {
type = se.getType();
}
if (type.startsWith("avc")) {
AvcConfigurationBox avcConfigurationBox = Path.getPath((Box) se, "avcC");
SeqParameterSet sps = SeqParameterSet.read(avcConfigurationBox.getSequenceParameterSets().get(0).array());
System.err.println( sps.vuiParams.aspect_ratio_info_present_flag);
}
}*/
representationType.setSar("1:1");
representationType.setBandwidth(RepresentationBuilderImpl.getBandwidth(t));
representationType.setId(representationId);
Expand Down

0 comments on commit 76a5331

Please sign in to comment.