Skip to content

Commit

Permalink
Stereo distance effect moved to Local Filters
Browse files Browse the repository at this point in the history
  • Loading branch information
olir committed Mar 19, 2018
1 parent 515ffc3 commit 9ded309
Show file tree
Hide file tree
Showing 16 changed files with 274 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import de.screenflow.frankenstein.vf.global.OU2LR;
import de.screenflow.frankenstein.vf.global.OutputSizeLimiter;
import de.screenflow.frankenstein.vf.global.RL2LR;
import de.screenflow.frankenstein.vf.global.StereoEffect;
import de.screenflow.frankenstein.vf.input.CameraInput;
import de.screenflow.frankenstein.vf.input.SlideShowInput;
import de.screenflow.frankenstein.vf.input.StreamInput;
Expand All @@ -39,18 +38,16 @@
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.Slider;
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;
import javafx.scene.control.TextField;
import javafx.scene.control.Slider;
import javafx.scene.control.Label;
import javafx.scene.control.ToggleButton;
import javafx.scene.input.InputMethodEvent;

public class ConfigurationSceneController {

Expand Down Expand Up @@ -106,9 +103,6 @@ public class ConfigurationSceneController {
@FXML
RadioButton rVideoFileOutput;

@FXML
CheckBox cPostProcessing;

@FXML
TabPane tabPane;

Expand Down Expand Up @@ -184,12 +178,6 @@ public class ConfigurationSceneController {
@FXML
RadioButton vrModeFromVR;

@FXML
ToggleButton stereoEffectFilterEnabled;

@FXML
Slider sliderStereoPerspective;

@FXML
TextField tfPropertyOutputFile;

Expand All @@ -208,11 +196,14 @@ public class ConfigurationSceneController {
@FXML
RadioButton rStreamInput;

@FXML Tab tabVideoStreamInput;
@FXML
Tab tabVideoStreamInput;

@FXML TextField tfPropertyInputStream;
@FXML
TextField tfPropertyInputStream;

@FXML TextField tfPropertyRecordingFile;
@FXML
TextField tfPropertyRecordingFile;

/**
* Initialize method, automatically called by @{link FXMLLoader}
Expand Down Expand Up @@ -299,16 +290,10 @@ public void changed(ObservableValue<? extends String> observable, String oldValu
else
vrModeFromSBS.setSelected(true);

sliderStereoPerspective.setValue(configuration.perspective);
sliderStereoPerspective.valueProperty().addListener((observable, oldvalue, newvalue) -> {
int newPerspective = newvalue.intValue();
configuration.perspective = newPerspective;
});

configuration.setInputStreamURL(tfPropertyInputStream.getText());
tfPropertyInputStream.textProperty().addListener((observable, oldValue, newValue) -> {
configuration.setInputStreamURL(tfPropertyInputStream.getText());
});
});
}

public void configure(FxMain main, Stage stage) {
Expand All @@ -333,7 +318,8 @@ public void doneButtonPressed(ActionEvent event) {
} else if (rCameraInput.isSelected()) {
configuration.setSource(new CameraInput(0));
} else if (rStreamInput.isSelected()) {
configuration.setSource(new StreamInput(configuration.getInputStreamURL(), configuration.getRecordingVideo()));
configuration
.setSource(new StreamInput(configuration.getInputStreamURL(), configuration.getRecordingVideo()));
configuration.doInput = true;
} else {
throw new Error("No Input Method.");
Expand All @@ -358,12 +344,6 @@ public void doneButtonPressed(ActionEvent event) {
if (rVRConverter.isSelected())
filters.add(new LR2VR180(configuration.vrModeShrinkOnly, configuration.vrModeShrinkFactor));

if (cPostProcessing.isSelected()) {
if (stereoEffectFilterEnabled.isSelected()) {
filters.add(new StereoEffect(configuration.perspective));
}
}

configuration.doOutput = rVideoFileOutput.isSelected();

if (configuration.doOutput) {
Expand Down Expand Up @@ -412,22 +392,22 @@ public void rActionCameraInput() {
configuration.outputVideo = new File(new File(lastVideoDir), "stream.mp4").getAbsolutePath();
else
configuration.outputVideo = new File(new File("."), "stream.mp4").getAbsolutePath();

tfPropertyOutputFile.setText(configuration.outputVideo);
removeTab(tabVideoFileInput);
removeTab(tabSlideshow);
removeTab(tabTestVideoGenerator);
removeTab(tabVideoStreamInput);
}

@FXML
public void rActionStreamInput() {
String lastVideoDir = configuration.getInputVideoPath();
if (lastVideoDir != null)
configuration.outputVideo = new File(new File(lastVideoDir), "stream.mp4").getAbsolutePath();
else
configuration.outputVideo = new File(new File("."), "stream.mp4").getAbsolutePath();

tfPropertyOutputFile.setText(configuration.outputVideo);
removeTab(tabVideoFileInput);
removeTab(tabSlideshow);
Expand Down Expand Up @@ -494,7 +474,7 @@ private File chooseRecordingVideo() {

File file = fileChooser.showSaveDialog(stage);
if (!file.getName().endsWith(".mp4")) {
file = new File(file.getParentFile(), file.getName().replaceAll("\\..*", ".mp4"));
file = new File(file.getParentFile(), file.getName().replaceAll("\\..*", ".mp4"));
}
if (file != null && !file.isDirectory()) {
configuration.setRecordingVideo(file.getAbsolutePath());
Expand All @@ -516,7 +496,6 @@ private File chooseRecordingVideo() {
}
}


@FXML
public void rActionSlideshowGenerator() {

Expand Down Expand Up @@ -621,14 +600,6 @@ public void rActionDelay() {
addTab(tabDelay);
}

@FXML
public void cbActionPostProcessing() {
if (cPostProcessing.isSelected())
addTab(tabPostProcessing);
else
removeTab(tabPostProcessing);
}

@FXML
public void rActionNoAlignment() {
removeTab(tabSwap);
Expand Down Expand Up @@ -668,9 +639,9 @@ public void btnActionChangeInputFile() {
if (!rCloneLR.isSelected())
rCloneLR.setSelected(true);
}
// removeTab(tabVideoFileInput);
// removeTab(tabSlideshow);
// addTab(tabTestVideoGenerator);
// removeTab(tabVideoFileInput);
// removeTab(tabSlideshow);
// addTab(tabTestVideoGenerator);
}

@FXML
Expand All @@ -687,7 +658,7 @@ public void btnActionChangeInputDir() {
addTab(tabTestVideoGenerator);
}

@FXML
@FXML
public void btnActionChangeRecordingFile() {
File file = chooseRecordingVideo();
if (file == null) {
Expand All @@ -696,11 +667,11 @@ public void btnActionChangeRecordingFile() {
if (!rCloneLR.isSelected())
rCloneLR.setSelected(true);
}
// removeTab(tabVideoFileInput);
// removeTab(tabSlideshow);
// addTab(tabTestVideoGenerator);
// removeTab(tabVideoFileInput);
// removeTab(tabSlideshow);
// addTab(tabTestVideoGenerator);
}

// @FXML
public boolean tfActionChangeTestScreenWidth(String oldValue, String newValue) {

Expand Down Expand Up @@ -764,10 +735,4 @@ public void rActionVRModeFromVR() {
configuration.vrModeShrinkOnly = true;
}

@FXML
public void tbActionStereoEffectFilterEnabled() {
sliderStereoPerspective.setDisable(!stereoEffectFilterEnabled.isSelected());
}


}
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
package de.screenflow.frankenstein.fxml;

import java.net.URL;

import de.screenflow.frankenstein.vf.LocalVideoFilter;
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;

public class FilterSetupController {

@FXML ComboBox<LocalVideoFilter> cbFilter;

private ProcessingSceneController parent;

private Stage stage;

private LocalVideoFilter selectedFilter = null;

@FXML ComboBox<LocalVideoFilter> cbFilter;

@FXML BorderPane bpContainer;

public void configure(ProcessingSceneController parent, Stage stage) {
this.parent = parent;
Expand All @@ -26,10 +32,15 @@ public void configure(ProcessingSceneController parent, Stage stage) {
cbFilter.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<LocalVideoFilter>() {
@Override public void changed(ObservableValue<? extends LocalVideoFilter> selected, LocalVideoFilter oldFilter, LocalVideoFilter newFilter) {
if (oldFilter != null) {
bpContainer.setCenter(null);
selectedFilter = null;
}
if (newFilter != null) {
selectedFilter = newFilter;
selectedFilter = newFilter.createInstance();
URL url = getClass().getResource("application.css");
String stylesheet = url.toExternalForm();
Scene scene = selectedFilter.createConfigurationScene(FxMain.getLocale(), stylesheet);
bpContainer.setCenter(scene.getRoot());
}
}
});
Expand All @@ -40,7 +51,7 @@ public void ok() {
stage.close();
}

public LocalVideoFilter getSelectedFilterType() {
public LocalVideoFilter getSelectedFilterInstance() {
return selectedFilter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import de.screenflow.frankenstein.vf.VideoFilter;
import de.screenflow.frankenstein.vf.VideoStreamSource;
import de.screenflow.frankenstein.vf.local.BWFilter;
import de.screenflow.frankenstein.vf.local.StereoDistanceFilter;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
Expand Down Expand Up @@ -218,6 +219,7 @@ public void changed(ObservableValue<? extends FilterElement> observable, FilterE

localFilters = new ArrayList<LocalVideoFilter>();
localFilters.add(new BWFilter());
localFilters.add(new StereoDistanceFilter());

updateDuration();

Expand Down Expand Up @@ -846,7 +848,7 @@ public void filterSetup() {
stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(btnListFilter.getScene().getWindow());
stage.showAndWait();
LocalVideoFilter f = controller.getSelectedFilterType().getInstance();
LocalVideoFilter f = controller.getSelectedFilterInstance();
selectedFilter.setType(f);
processor.applyLocalFilters(filterListData);
Platform.runLater(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
*/
package de.screenflow.frankenstein.vf;

import java.util.Locale;

import javafx.scene.Parent;
import javafx.scene.Scene;

public interface LocalVideoFilter extends VideoFilter {
LocalVideoFilter getInstance();
LocalVideoFilter createInstance();
Scene createConfigurationScene(Locale locale, String stylesheet);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package de.screenflow.frankenstein.vf.local;

public class BWConfigController {

}

0 comments on commit 9ded309

Please sign in to comment.