Skip to content

Commit

Permalink
api module
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Rode committed Mar 28, 2018
1 parent 301e22b commit 81daf1a
Show file tree
Hide file tree
Showing 428 changed files with 77,521 additions and 256 deletions.
88 changes: 30 additions & 58 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>de.serviceflow.frankenstein</groupId>
<artifactId>root</artifactId>
<version>0.2.0</version>
<version>0.3.1-SNAPSHOT</version>
</parent>

<!-- Maven Coordinates -->
Expand All @@ -38,41 +38,11 @@
<artifactId>opencv</artifactId>
<version>3.2.0-1</version>
</dependency>
<!-- AI Submodul
<dependency>
<groupId>ml.dmlc.mxnet</groupId>
<artifactId>mxnet-full_2.10-linux-x86_64-gpu</artifactId>
<version>0.1.1</version>
<groupId>de.serviceflow.frankenstein.plugin</groupId>
<artifactId>api</artifactId>
<version>0.3.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ml.dmlc.mxnet</groupId>
<artifactId>mxnet-core_2.10</artifactId>
<version>0.1.1</version>
</dependency>
-->
<!-- jogamp
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.jogamp.jocl</groupId>
<artifactId>jocl-main</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.jogamp.joal</groupId>
<artifactId>joal-main</artifactId>
<version>2.3.1</version>
</dependency>
-->

</dependencies>

<profiles>
Expand Down Expand Up @@ -181,8 +151,33 @@
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<skip>false</skip>
<executable>javaw</executable>
<workingDirectory>${basedir}/src/main/resources</workingDirectory><!-- opencv_ffmpeg320 dll location -->
<arguments>
<argument>${openh264opt}</argument>
<argument>-jar</argument>
<argument>${basedir}/target/frankenstein.jar</argument>
</arguments>
</configuration>
<!--
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
-->
</plugin>


<!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down Expand Up @@ -215,29 +210,6 @@
</plugin>
-->

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>javaw</executable>
<workingDirectory>${basedir}/src/main/resources</workingDirectory><!-- opencv_ffmpeg320 dll location -->
<arguments>
<argument>${openh264opt}</argument>
<argument>-jar</argument>
<argument>${basedir}/target/frankenstein.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

<!-- Java Documentation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
30 changes: 15 additions & 15 deletions app/src/main/java/de/serviceflow/frankenstein/MovieProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,21 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.videoio.VideoWriter;

import de.serviceflow.frankenstein.plugin.api.FilterContext;
import de.serviceflow.frankenstein.plugin.api.SegmentVideoFilter;
import de.serviceflow.frankenstein.task.Task;
import de.serviceflow.frankenstein.task.TaskHandler;
import de.serviceflow.frankenstein.task.TimeTaskHandler;
import de.serviceflow.frankenstein.vf.DefaultFilterContext;
import de.serviceflow.frankenstein.vf.FilterContext;
import de.serviceflow.frankenstein.vf.FilterElement;
import de.serviceflow.frankenstein.vf.SegmentVideoFilter;
import de.serviceflow.frankenstein.vf.VideoFilter;
import de.serviceflow.frankenstein.vf.VideoStreamSource;
import de.serviceflow.frankenstein.vf.input.VideoInput;
import javafx.collections.ObservableList;

public class MovieProcessor {

Expand Down Expand Up @@ -65,7 +62,7 @@ public class MovieProcessor {

private File ffmpeg;

private SegmentVideoFilter previewFilter=null;
private SegmentVideoFilter previewFilter = null;

public MovieProcessor(Configuration configuration) {
this.ffmpegPath = configuration.getFFmpegPath();
Expand Down Expand Up @@ -124,9 +121,10 @@ public void init(ProcessingListener l) {
public void applyLocalFilters(List<FilterElement> filterListData) {
localFilters = filterListData;
if (localFilters != null && !localFilters.isEmpty()) {
FilterContext context = new DefaultFilterContext();
for (FilterElement element : localFilters) {
if (element.filter != null) {
element.filter.configure(frame);
element.filter.process(frame, 1, context);
}
}
}
Expand Down Expand Up @@ -437,7 +435,7 @@ public void closeOutput() {
}

public void seek(final ProcessingListener l, int frameId) {
// System.out.println("MovieProcessor.seek @"+frameId);
// System.out.println("MovieProcessor.seek @"+frameId);
if (configuration.doInput && frameId < currentPos) {
if (l != null)
l.seeking(0);
Expand All @@ -451,24 +449,26 @@ public void seek(final ProcessingListener l, int frameId) {
FilterContext context = new DefaultFilterContext();
Mat newFrame = frame;
for (VideoFilter filter : filters) {
// System.out.println("MovieProcessor process "+filter.getClass().getName());
// System.out.println("MovieProcessor process
// "+filter.getClass().getName());
newFrame = filter.process(newFrame, frameId, context);
}
if (localFilters != null && !localFilters.isEmpty()) {
for (FilterElement element : localFilters) {
if (element.filter != null) {
if (element.r.start <= currentPos && currentPos < element.r.end) {
// System.out.println("MovieProcessor processStreamFrame " +
// element.filter);
// System.out.println("MovieProcessor
// processStreamFrame " +
// element.filter);
newFrame = element.filter.process(newFrame, currentPos, context);
}
}
}
}
if (previewFilter!=null) {
// System.out.println("MovieProcessor processStreamFrame " +
// previewFilter);
newFrame = previewFilter.process(newFrame, currentPos, context);
if (previewFilter != null) {
// System.out.println("MovieProcessor processStreamFrame " +
// previewFilter);
newFrame = previewFilter.process(newFrame, currentPos, context);
}
if (l != null)
l.nextFrameProcessed(newFrame, currentPos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@

import org.opencv.core.Mat;

import de.serviceflow.frankenstein.vf.SegmentVideoFilter;
import de.serviceflow.frankenstein.plugin.api.SegmentFilterConfigListener;
import de.serviceflow.frankenstein.vf.VideoStreamSource;
import de.serviceflow.frankenstein.vf.segment.SegmentConfigController;

public interface ProcessingListener {
public interface ProcessingListener extends SegmentFilterConfigListener {
void videoStarted(int frames, double fps);

void nextFrameLoaded(VideoStreamSource s);

void nextFrameProcessed(Mat frame, int frameId);

void seekDone(int frameId);

void seeking(int i);

void prematureEnd(int realFrameCount);

void taskUpdate(String timeStamp, String message);

void taskError(String errorMessage);
void configChanged(SegmentConfigController segmentConfigController, SegmentVideoFilter selectedFilter);
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleButton;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

import java.net.URL;

import de.serviceflow.frankenstein.vf.SegmentVideoFilter;
import de.serviceflow.frankenstein.vf.segment.NativeSegmentFilter;
import de.serviceflow.frankenstein.vf.segment.SegmentConfigController;
import de.serviceflow.frankenstein.plugin.api.SegmentConfigController;
import de.serviceflow.frankenstein.plugin.api.SegmentVideoFilter;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.stage.Stage;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class FilterSetupController {

Expand All @@ -21,36 +20,40 @@ public class FilterSetupController {

private SegmentVideoFilter selectedFilter = null;

@FXML ComboBox<SegmentVideoFilter> cbFilter;
@FXML
ComboBox<SegmentVideoFilter> cbFilter;

@FXML
BorderPane bpContainer;

@FXML BorderPane bpContainer;

public void configure(ProcessingSceneController parent, Stage stage) {
this.parent = parent;
this.stage = stage;

cbFilter.getItems().setAll(parent.getLocalFilters());

cbFilter.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<SegmentVideoFilter>() {
@Override public void changed(ObservableValue<? extends SegmentVideoFilter> selected, SegmentVideoFilter oldFilter, SegmentVideoFilter newFilter) {
if (oldFilter != null) {
bpContainer.setCenter(null);
selectedFilter = null;
}
if (newFilter != null) {
selectedFilter = newFilter.createInstance();
URL url = getClass().getResource("application.css");
String stylesheet = url.toExternalForm();
Scene scene = selectedFilter.createConfigurationScene(stylesheet);
bpContainer.setCenter(scene.getRoot());
SegmentConfigController c = ((SegmentVideoFilter)selectedFilter).getConfigController();
c.bind(parent, selectedFilter);
c.fireChange();
}
}
});
}

@Override
public void changed(ObservableValue<? extends SegmentVideoFilter> selected, SegmentVideoFilter oldFilter,
SegmentVideoFilter newFilter) {
if (oldFilter != null) {
bpContainer.setCenter(null);
selectedFilter = null;
}
if (newFilter != null) {
selectedFilter = newFilter.createInstance();
URL url = getClass().getResource("application.css");
String stylesheet = url.toExternalForm();
Scene scene = selectedFilter.createConfigurationScene(stylesheet);
bpContainer.setCenter(scene.getRoot());
SegmentConfigController c = ((SegmentVideoFilter) selectedFilter).getConfigController();
c.bind(parent, selectedFilter);
c.fireChange();
}
}
});
}

public void ok() {
System.out.println("ok");
stage.close();
Expand Down

0 comments on commit 81daf1a

Please sign in to comment.