Search in sources :

Example 1 with MediaSegment

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();
}
Also used : MediaSegment(org.opencastproject.silencedetection.api.MediaSegment) SmilResponse(org.opencastproject.smil.api.SmilResponse) Track(org.opencastproject.mediapackage.Track)

Aggregations

Track (org.opencastproject.mediapackage.Track)1 MediaSegment (org.opencastproject.silencedetection.api.MediaSegment)1 SmilResponse (org.opencastproject.smil.api.SmilResponse)1