use of org.opencastproject.silencedetection.api.MediaSegment in project opencast by opencast.
the class SilenceDetectionServiceImpl method generateSmil.
/**
* Create a smil from given parameters.
*
* @param segments media segment list with timestamps
* @param referenceTracks tracks to put as media segment source files
* @return generated smil
* @throws SmilException if smil creation failed
*/
protected Smil generateSmil(MediaSegments segments, List<Track> referenceTracks) throws SmilException {
SmilResponse smilResponse = smilService.createNewSmil();
Track[] referenceTracksArr = referenceTracks.toArray(new Track[referenceTracks.size()]);
for (MediaSegment segment : segments.getMediaSegments()) {
smilResponse = smilService.addParallel(smilResponse.getSmil());
String parId = smilResponse.getEntity().getId();
smilResponse = smilService.addClips(smilResponse.getSmil(), parId, referenceTracksArr, segment.getSegmentStart(), segment.getSegmentStop() - segment.getSegmentStart());
}
return smilResponse.getSmil();
}
Aggregations