Search in sources :

Example 1 with ClipFactory

use of com.helospark.tactview.core.timeline.ClipFactory in project tactview by helospark.

the class StandardGraphElementFactoryConfiguration method fileClipGraphElementFactory.

@Bean
public GraphElementFactory fileClipGraphElementFactory(List<ClipFactory> clipFactories, ClipFactoryChain clipFactoryChain, MessagingService messagingService) {
    return StandardGraphElementFactory.builder().withId("file").withDoesSupport(uri -> uri.startsWith("file://")).withName("File").withCategory(GraphCategory.INPUT).withNeedsInputParam(true).withCreator(graphRequest -> {
        AddClipRequest request = AddClipRequest.builder().withAddClipRequestMetadataKey(Map.of()).withPosition(TimelinePosition.ofZero()).withFilePath(graphRequest.uri.replaceFirst("file://", "")).build();
        VisualTimelineClip clip = (VisualTimelineClip) clipFactoryChain.createClips(request).get(0);
        clip.setInterval(INTERVAL);
        messagingService.sendAsyncMessage(new ClipDescriptorsAdded(clip.getId(), clip.getDescriptors(), clip));
        return new VisualTimelineClipElement(clip);
    }).withRestorer((node, metadata) -> {
        node.get("creatorFactoryId").asText();
        return new VisualTimelineClipElement(node, metadata, (VisualTimelineClip) clipFactoryChain.restoreClip(node.get("clip"), metadata));
    }).build();
}
Also used : TimelineClipType(com.helospark.tactview.core.timeline.TimelineClipType) TactviewPlatform(com.helospark.tactview.core.util.conditional.TactviewPlatform) ConditionalOnPlatform(com.helospark.tactview.core.util.conditional.ConditionalOnPlatform) ClipFactory(com.helospark.tactview.core.timeline.ClipFactory) StatelessVideoEffect(com.helospark.tactview.core.timeline.StatelessVideoEffect) EffectParametersRepository(com.helospark.tactview.core.timeline.effect.EffectParametersRepository) Configuration(com.helospark.lightdi.annotation.Configuration) CreateEffectRequest(com.helospark.tactview.core.timeline.effect.CreateEffectRequest) KeyframeSuccesfullyAddedMessage(com.helospark.tactview.core.timeline.message.KeyframeSuccesfullyAddedMessage) ConditionalOnProperty(com.helospark.lightdi.annotation.ConditionalOnProperty) AddClipRequest(com.helospark.tactview.core.timeline.AddClipRequest) EffectFactory(com.helospark.tactview.core.timeline.effect.EffectFactory) GraphProvider(com.helospark.tactview.core.timeline.effect.interpolation.provider.GraphProvider) Map(java.util.Map) Bean(com.helospark.lightdi.annotation.Bean) CameraOutputToV4L2LoopbackElement(com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.realtime.CameraOutputToV4L2LoopbackElement) ProceduralClipFactoryChainItem(com.helospark.tactview.core.timeline.proceduralclip.ProceduralClipFactoryChainItem) GraphCategory(com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.GraphElementFactory.GraphCategory) TimelinePosition(com.helospark.tactview.core.timeline.TimelinePosition) OpencvL4V2LoopbackImplementation(com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.realtime.camera.OpencvL4V2LoopbackImplementation) ClipDescriptorsAdded(com.helospark.tactview.core.timeline.message.ClipDescriptorsAdded) Collectors(java.util.stream.Collectors) TimelineLength(com.helospark.tactview.core.timeline.TimelineLength) MessagingService(com.helospark.tactview.core.util.messaging.MessagingService) TimelineInterval(com.helospark.tactview.core.timeline.TimelineInterval) VisualTimelineClip(com.helospark.tactview.core.timeline.VisualTimelineClip) List(java.util.List) Optional(java.util.Optional) ClipFactoryChain(com.helospark.tactview.core.timeline.ClipFactoryChain) ProceduralVisualClip(com.helospark.tactview.core.timeline.proceduralclip.ProceduralVisualClip) AddClipRequest(com.helospark.tactview.core.timeline.AddClipRequest) ClipDescriptorsAdded(com.helospark.tactview.core.timeline.message.ClipDescriptorsAdded) VisualTimelineClip(com.helospark.tactview.core.timeline.VisualTimelineClip) Bean(com.helospark.lightdi.annotation.Bean)

Aggregations

Bean (com.helospark.lightdi.annotation.Bean)1 ConditionalOnProperty (com.helospark.lightdi.annotation.ConditionalOnProperty)1 Configuration (com.helospark.lightdi.annotation.Configuration)1 AddClipRequest (com.helospark.tactview.core.timeline.AddClipRequest)1 ClipFactory (com.helospark.tactview.core.timeline.ClipFactory)1 ClipFactoryChain (com.helospark.tactview.core.timeline.ClipFactoryChain)1 StatelessVideoEffect (com.helospark.tactview.core.timeline.StatelessVideoEffect)1 TimelineClipType (com.helospark.tactview.core.timeline.TimelineClipType)1 TimelineInterval (com.helospark.tactview.core.timeline.TimelineInterval)1 TimelineLength (com.helospark.tactview.core.timeline.TimelineLength)1 TimelinePosition (com.helospark.tactview.core.timeline.TimelinePosition)1 VisualTimelineClip (com.helospark.tactview.core.timeline.VisualTimelineClip)1 CreateEffectRequest (com.helospark.tactview.core.timeline.effect.CreateEffectRequest)1 EffectFactory (com.helospark.tactview.core.timeline.effect.EffectFactory)1 EffectParametersRepository (com.helospark.tactview.core.timeline.effect.EffectParametersRepository)1 GraphCategory (com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.GraphElementFactory.GraphCategory)1 CameraOutputToV4L2LoopbackElement (com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.realtime.CameraOutputToV4L2LoopbackElement)1 OpencvL4V2LoopbackImplementation (com.helospark.tactview.core.timeline.effect.interpolation.graph.domain.types.realtime.camera.OpencvL4V2LoopbackImplementation)1 GraphProvider (com.helospark.tactview.core.timeline.effect.interpolation.provider.GraphProvider)1 ClipDescriptorsAdded (com.helospark.tactview.core.timeline.message.ClipDescriptorsAdded)1