@Test public void testDetermineDimension() throws Exception { VideoStreamImpl videoStream = new VideoStreamImpl("test1"); videoStream.setFrameWidth(80); videoStream.setFrameHeight(30); VideoStreamImpl videoStream2 = new VideoStreamImpl("test2"); videoStream2.setFrameWidth(101); videoStream2.setFrameHeight(50); TrackImpl videoTrack = new TrackImpl(); videoTrack.setURI(URI.create("/test")); videoTrack.setVideo(Collections.list((VideoStream) videoStream)); TrackImpl videoTrack2 = new TrackImpl(); videoTrack2.setURI(URI.create("/test")); videoTrack2.setVideo(Collections.list((VideoStream) videoStream2)); List<Track> tracks = Collections.list((Track) videoTrack, (Track) videoTrack2); EncodingProfileImpl encodingProfile = new EncodingProfileImpl(); encodingProfile.setIdentifier("test"); ComposerService composerService = EasyMock.createMock(ComposerService.class); EasyMock.expect( composerService.concat(encodingProfile.getIdentifier(), Dimension.dimension(101, 50), false, tracks.toArray(new Track[tracks.size()]))).andReturn(null).once(); EasyMock.expect( composerService.concat(encodingProfile.getIdentifier(), Dimension.dimension(100, 50), false, tracks.toArray(new Track[tracks.size()]))).andReturn(null).once(); EasyMock.replay(composerService); PartialImportWorkflowOperationHandler handler = new PartialImportWorkflowOperationHandler(); handler.setComposerService(composerService); handler.startConcatJob(encodingProfile, tracks, -1.0F, false); handler.startConcatJob(encodingProfile, tracks, -1.0F, true); }
private Dimension determineDimension(List<Track> tracks, boolean forceDivisible) { Tuple<Track, Dimension> trackDimension = getLargestTrack(tracks); if (trackDimension == null) return null; if (forceDivisible && (trackDimension.getB().getHeight() % 2 != 0 || trackDimension.getB().getWidth() % 2 != 0)) { Dimension scaledDimension = Dimension.dimension((trackDimension.getB().getWidth() / 2) * 2, (trackDimension .getB().getHeight() / 2) * 2); logger.info("Determined output dimension {} scaled down from {} for track {}", scaledDimension, trackDimension.getB(), trackDimension.getA()); return scaledDimension; } else { logger.info("Determined output dimension {} for track {}", trackDimension.getB(), trackDimension.getA()); return trackDimension.getB(); } }
PartialImportWorkflowOperationHandler extends AbstractWorkflowOperationHandler { private Dimension determineDimension(List<Track> tracks, boolean forceDivisible) { Tuple<Track, Dimension> trackDimension = getLargestTrack(tracks); if (trackDimension == null) return null; if (forceDivisible && (trackDimension.getB().getHeight() % 2 != 0 || trackDimension.getB().getWidth() % 2 != 0)) { Dimension scaledDimension = Dimension.dimension((trackDimension.getB().getWidth() / 2) * 2, (trackDimension .getB().getHeight() / 2) * 2); logger.info("Determined output dimension {} scaled down from {} for track {}", scaledDimension, trackDimension.getB(), trackDimension.getA()); return scaledDimension; } else { logger.info("Determined output dimension {} for track {}", trackDimension.getB(), trackDimension.getA()); return trackDimension.getB(); } } }
PartialImportWorkflowOperationHandler extends AbstractWorkflowOperationHandler { private Dimension determineDimension(List<Track> tracks, boolean forceDivisible) { Tuple<Track, Dimension> trackDimension = getLargestTrack(tracks); if (trackDimension == null) return null; if (forceDivisible && (trackDimension.getB().getHeight() % 2 != 0 || trackDimension.getB().getWidth() % 2 != 0)) { Dimension scaledDimension = Dimension.dimension((trackDimension.getB().getWidth() / 2) * 2, (trackDimension .getB().getHeight() / 2) * 2); logger.info("Determined output dimension {} scaled down from {} for track {}", scaledDimension, trackDimension.getB(), trackDimension.getA()); return scaledDimension; } else { logger.info("Determined output dimension {} for track {}", trackDimension.getB(), trackDimension.getA()); return trackDimension.getB(); } }  }
PartialImportWorkflowOperationHandler extends AbstractWorkflowOperationHandler { private Dimension determineDimension(List<Track> tracks, boolean forceDivisible) { Tuple<Track, Dimension> trackDimension = getLargestTrack(tracks); if (trackDimension == null) return null; if (forceDivisible && (trackDimension.getB().getHeight() % 2 != 0 || trackDimension.getB().getWidth() % 2 != 0)) { Dimension scaledDimension = Dimension.dimension((trackDimension.getB().getWidth() / 2) * 2, (trackDimension .getB().getHeight() / 2) * 2); logger.info("Determined output dimension {} scaled down from {} for track {}", scaledDimension, trackDimension.getB(), trackDimension.getA()); return scaledDimension; } else { logger.info("Determined output dimension {} for track {}", trackDimension.getB(), trackDimension.getA()); return trackDimension.getB(); } }  void setComposerService(ComposerService composerService); void setWorkspace(Workspace workspace); @Override WorkflowOperationResult start(final WorkflowInstance workflowInstance, JobContext context); }
PartialImportWorkflowOperationHandler extends AbstractWorkflowOperationHandler { private Dimension determineDimension(List<Track> tracks, boolean forceDivisible) { Tuple<Track, Dimension> trackDimension = getLargestTrack(tracks); if (trackDimension == null) return null; if (forceDivisible && (trackDimension.getB().getHeight() % 2 != 0 || trackDimension.getB().getWidth() % 2 != 0)) { Dimension scaledDimension = Dimension.dimension((trackDimension.getB().getWidth() / 2) * 2, (trackDimension .getB().getHeight() / 2) * 2); logger.info("Determined output dimension {} scaled down from {} for track {}", scaledDimension, trackDimension.getB(), trackDimension.getA()); return scaledDimension; } else { logger.info("Determined output dimension {} for track {}", trackDimension.getB(), trackDimension.getA()); return trackDimension.getB(); } }  void setComposerService(ComposerService composerService); void setWorkspace(Workspace workspace); @Override WorkflowOperationResult start(final WorkflowInstance workflowInstance, JobContext context);  }