use of com.helospark.tactview.core.timeline.TimelineManagerFramesRequest in project tactview by helospark.
the class SingleFullImageViewController method renderFullScreenAtCurrentLocation.
public void renderFullScreenAtCurrentLocation() {
TimelinePosition currentPosition = uiTimelineManager.getCurrentPosition();
int height = projectRepository.getHeight();
int width = projectRepository.getWidth();
TimelineManagerFramesRequest frameRequest = TimelineManagerFramesRequest.builder().withPosition(currentPosition).withScale(1.0).withPreviewWidth(width).withPreviewHeight(height).build();
CompletableFuture.supplyAsync(() -> {
ByteBuffer image = timelineManagerRenderService.getFrame(frameRequest).getAudioVideoFragment().getVideoResult().getBuffer();
return byteBufferToImageConverter.convertToJavafxImage(image, width, height);
}).exceptionally(e -> {
logger.error("Error rendering image", e);
return null;
}).thenAccept(image -> {
Platform.runLater(() -> {
ImageShowDialog dialog = new ImageShowDialog(image, stylesheetAdderService);
dialog.show();
});
});
}
use of com.helospark.tactview.core.timeline.TimelineManagerFramesRequest in project tactview by helospark.
the class SubtimelineAudioClip method requestAudioFrameInternal.
@Override
protected AudioFrameResult requestAudioFrameInternal(AudioRequest audioRequest) {
TimelineManagerFramesRequest channelFrameRequest = TimelineManagerFramesRequest.builder().withAudioBytesPerSample(Optional.of(audioRequest.getBytesPerSample())).withAudioLength(Optional.of(audioRequest.getLength())).withAudioSampleRate(Optional.of(audioRequest.getSampleRate())).withPosition(audioRequest.getPosition()).withNeedSound(true).withNeedVideo(false).withPreviewWidth(// TODO: find why these dummy values are needed
800).withPreviewHeight(600).build();
AudioVideoFragment audioVideoFragment = timelineManagerRenderService.getFrame(channelFrameRequest).getAudioVideoFragment();
audioVideoFragment.freeVideoResult();
return audioVideoFragment.getAudioResult();
}
use of com.helospark.tactview.core.timeline.TimelineManagerFramesRequest in project tactview by helospark.
the class RectangleProceduralClipIT method testRectangleProviderWithFullscreen.
@Test
public void testRectangleProviderWithFullscreen() {
TimelineClip clip = fakeUi.dragProceduralClipToFirstChannel("rectangle", TimelinePosition.ofZero());
fakeUi.selectClipAndFindSettingByName(clip.getId(), "Area").addKeyframe(new InterpolationLine(new Point(0.0, 0.0), new Point(1.0, 1.0)));
fakeUi.selectClipAndFindSettingByName(clip.getId(), "Fuzziness").addKeyframe(0.5);
fakeUi.selectClipAndFindSettingByName(clip.getId(), "Color").addKeyframe(new Color(1.0, 0.0, 0.0));
TimelineManagerFramesRequest frameRequest = IntegrationTestUtil.getDefaultFrameRequest().build();
AudioVideoFragment frame = fakeUi.requestFrame(frameRequest);
ReadOnlyClipImage videoFrame = frame.getVideoResult();
IntegrationTestUtil.pixelEquals(videoFrame, 0, 200, new ColorWithAlpha(0, 0, 0, 0));
IntegrationTestUtil.pixelEquals(videoFrame, 300, 200, new ColorWithAlpha(255, 0, 0, 255));
IntegrationTestUtil.pixelEquals(videoFrame, 100, 200, new ColorWithAlpha(127, 0, 0, 127));
}
use of com.helospark.tactview.core.timeline.TimelineManagerFramesRequest in project tactview by helospark.
the class AbstractRenderService method queryFrameAt.
protected AudioVideoFragment queryFrameAt(RenderRequestFrameRequest request) {
RenderRequest renderRequest = request.renderRequest;
TimelinePosition currentPosition = request.currentPosition;
Optional<Integer> sampleRate = request.sampleRate;
Optional<Integer> bytesPerSample = request.bytesPerSample;
Optional<Integer> numberOfChannels = request.numberOfChannels;
boolean needsVideo = request.needsVideo;
boolean needsSound = request.needsSound;
double upscale = renderRequest.getUpscale().doubleValue();
double scaleMultiplier = (double) renderRequest.getWidth() / projectRepository.getWidth();
TimelineManagerFramesRequest frameRequest = TimelineManagerFramesRequest.builder().withPosition(currentPosition).withPreviewWidth((int) (request.expectedWidth * upscale)).withPreviewHeight((int) (request.expectedHeight * upscale)).withScale(scaleMultiplier * upscale).withAudioSampleRate(sampleRate).withAudioBytesPerSample(bytesPerSample).withNeedVideo(needsVideo).withNeedSound(needsSound).withNumberOfChannels(numberOfChannels).withAudioLength(request.audioLength).build();
AudioVideoFragment frame = timelineManagerRenderService.getFrame(frameRequest).getAudioVideoFragment();
if (frame.getVideoResult() != null && (renderRequest.getUpscale().compareTo(BigDecimal.ONE) > 0.0 || // due to +1 for width/height on odd size
frame.getVideoResult().getWidth() != request.expectedWidth || frame.getVideoResult().getHeight() != request.expectedHeight)) {
ScaleRequest scaleRequest = ScaleRequest.builder().withImage(frame.getVideoResult()).withNewWidth(request.expectedWidth).withNewHeight(request.expectedHeight).build();
ClipImage scaledImage = scaleService.createScaledImage(scaleRequest);
frame = frame.butFreeAndReplaceVideoFrame(scaledImage);
}
return frame;
}
use of com.helospark.tactview.core.timeline.TimelineManagerFramesRequest in project tactview by helospark.
the class SubtimelineVisualClip method requestFrame.
@Override
public ReadOnlyClipImage requestFrame(RequestFrameParameter request) {
TimelineManagerFramesRequest channelFrameRequest = TimelineManagerFramesRequest.builder().withPosition(request.getPosition()).withScale(request.getScale()).withPreviewWidth(request.getWidth()).withPreviewHeight(request.getHeight()).withNeedSound(false).withNeedVideo(true).build();
AudioVideoFragment audioVideoFragment = timelineManagerRenderService.getFrame(channelFrameRequest).getAudioVideoFragment();
audioVideoFragment.getAudioResult().free();
return audioVideoFragment.getVideoResult();
}
Aggregations