@Test public void testLimit() { assertTrue(limit(track(1511), l.mk(sec(-1), sec(1511), sec(1512))).isEmpty()); assertTrue(limit(track(1511), l.mk(percent(-0.2), percent(101))).isEmpty()); assertEquals(4, limit(track(1511), l.mk(percent(0), percent(100), sec(0), sec(1510))).size()); assertEquals(4, limit(track(1511), l.mk(percent(0), percent(10), sec(10), sec(1500), percent(200))).size()); }
static List<MediaPosition> limit(Track track, List<MediaPosition> positions) { final Long duration = track.getDuration(); if (duration == null || (track.getStreams() != null && Arrays.stream(track.getStreams()) .filter(stream -> stream instanceof VideoStream) .map(org.opencastproject.mediapackage.Stream::getFrameCount) .allMatch(frameCount -> frameCount == null || frameCount == 1))) { return java.util.Collections.singletonList(new MediaPosition(PositionType.Seconds, 0)); } return positions.stream() .filter(p -> (PositionType.Seconds.equals(p.type) && p.position >= 0 && p.position < duration) || (PositionType.Percentage.equals(p.type) && p.position >= 0 && p.position <= 100)) .collect(Collectors.toList()); }
ImageWorkflowOperationHandler extends AbstractWorkflowOperationHandler { static List<MediaPosition> limit(Track track, List<MediaPosition> positions) { final Long duration = track.getDuration(); if (duration == null || (track.getStreams() != null && Arrays.stream(track.getStreams()) .filter(stream -> stream instanceof VideoStream) .map(org.opencastproject.mediapackage.Stream::getFrameCount) .allMatch(frameCount -> frameCount == null || frameCount == 1))) { return java.util.Collections.singletonList(new MediaPosition(PositionType.Seconds, 0)); } return positions.stream() .filter(p -> (PositionType.Seconds.equals(p.type) && p.position >= 0 && p.position < duration) || (PositionType.Percentage.equals(p.type) && p.position >= 0 && p.position <= 100)) .collect(Collectors.toList()); } }
ImageWorkflowOperationHandler extends AbstractWorkflowOperationHandler { static List<MediaPosition> limit(Track track, List<MediaPosition> positions) { final Long duration = track.getDuration(); if (duration == null || (track.getStreams() != null && Arrays.stream(track.getStreams()) .filter(stream -> stream instanceof VideoStream) .map(org.opencastproject.mediapackage.Stream::getFrameCount) .allMatch(frameCount -> frameCount == null || frameCount == 1))) { return java.util.Collections.singletonList(new MediaPosition(PositionType.Seconds, 0)); } return positions.stream() .filter(p -> (PositionType.Seconds.equals(p.type) && p.position >= 0 && p.position < duration) || (PositionType.Percentage.equals(p.type) && p.position >= 0 && p.position <= 100)) .collect(Collectors.toList()); }  }
ImageWorkflowOperationHandler extends AbstractWorkflowOperationHandler { static List<MediaPosition> limit(Track track, List<MediaPosition> positions) { final Long duration = track.getDuration(); if (duration == null || (track.getStreams() != null && Arrays.stream(track.getStreams()) .filter(stream -> stream instanceof VideoStream) .map(org.opencastproject.mediapackage.Stream::getFrameCount) .allMatch(frameCount -> frameCount == null || frameCount == 1))) { return java.util.Collections.singletonList(new MediaPosition(PositionType.Seconds, 0)); } return positions.stream() .filter(p -> (PositionType.Seconds.equals(p.type) && p.position >= 0 && p.position < duration) || (PositionType.Percentage.equals(p.type) && p.position >= 0 && p.position <= 100)) .collect(Collectors.toList()); }  void setWorkspace(Workspace workspace); @Override WorkflowOperationResult start(final WorkflowInstance wi, JobContext ctx); static StreamFold<MediaPackageElementFlavor, S> flavorFold(S selector); static StreamFold<String, S> tagFold(S selector); static Fn<String, EncodingProfile> fetchProfile(final ComposerService composerService); }
ImageWorkflowOperationHandler extends AbstractWorkflowOperationHandler { static List<MediaPosition> limit(Track track, List<MediaPosition> positions) { final Long duration = track.getDuration(); if (duration == null || (track.getStreams() != null && Arrays.stream(track.getStreams()) .filter(stream -> stream instanceof VideoStream) .map(org.opencastproject.mediapackage.Stream::getFrameCount) .allMatch(frameCount -> frameCount == null || frameCount == 1))) { return java.util.Collections.singletonList(new MediaPosition(PositionType.Seconds, 0)); } return positions.stream() .filter(p -> (PositionType.Seconds.equals(p.type) && p.position >= 0 && p.position < duration) || (PositionType.Percentage.equals(p.type) && p.position >= 0 && p.position <= 100)) .collect(Collectors.toList()); }  void setWorkspace(Workspace workspace); @Override WorkflowOperationResult start(final WorkflowInstance wi, JobContext ctx); static StreamFold<MediaPackageElementFlavor, S> flavorFold(S selector); static StreamFold<String, S> tagFold(S selector); static Fn<String, EncodingProfile> fetchProfile(final ComposerService composerService); static final String OPT_SOURCE_FLAVOR; static final String OPT_SOURCE_FLAVORS; static final String OPT_SOURCE_TAGS; static final String OPT_PROFILES; static final String OPT_POSITIONS; static final String OPT_TARGET_FLAVOR; static final String OPT_TARGET_TAGS; static final String OPT_TARGET_BASE_NAME_FORMAT_SECOND; static final String OPT_TARGET_BASE_NAME_FORMAT_PERCENT; static final String OPT_END_MARGIN; static final double SINGLE_FRAME_POS; }