Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gef-integration.target/gef-integration.target
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?><target name="gef-integration" sequenceNumber="1">
<?pde version="3.8"?>
<target name="gef-integration" sequenceNumber="1">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.xtext.sdk.feature.group" version="0.0.0"/>
Expand Down
6 changes: 5 additions & 1 deletion org.sofproject.alsa.topo/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<accessrules>
<accessrule kind="accessible" pattern="javafx/**"/>
</accessrules>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Expand Down
1 change: 1 addition & 0 deletions org.sofproject.alsa.topo/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ Export-Package: org.sofproject.alsa.topo.conf,
Require-Bundle: org.sofproject.core,
org.sofproject.topo.ui
Bundle-Vendor: Intel Corporation
Import-Package: org.sofproject.topo.ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,56 @@ public void serialize() throws CoreException, IOException {
}
outputFile.getParent().refreshLocal(1, null);
}

@Override
public String getPipelineString() {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
Writer writer = new BufferedWriter(new OutputStreamWriter(os));
// tlv-s
tlvs.serialize(writer);

// vendor tokens
vTokensIndex.serialize(writer);

// vendor tuples
vTuplesIndex.serialize(writer);

// data
dataIndex.serialize(writer);

// control bytes
controlBytes.serialize(writer);

// control mixers
controlMixers.serialize(writer);

// pcm capabilities
pcmCapsIndex.serialize(writer);

// pcm-s
pcms.serialize(writer);

// be-s
beIndex.serialize(writer);

// hw-configs
hwConfigs.serialize(writer);

// pipelines (widgets + graphs)
pipelines.serialize(writer);
interConnections.serialize(writer);

writer.close();
os.close();

return os.toString();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}

@Override
public IRemoteOpsProvider getRemoteOpsProvider() {
return null; // no extra ops
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@

package org.sofproject.alsa.topo.model;

import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Collection;
import java.util.HashMap;
Expand Down
6 changes: 5 additions & 1 deletion org.sofproject.fw.ui/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<accessrules>
<accessrule kind="accessible" pattern="javafx/**"/>
</accessrules>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Expand Down
6 changes: 5 additions & 1 deletion org.sofproject.gst.topo/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<accessrules>
<accessrule kind="accessible" pattern="javafx/**"/>
</accessrules>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Expand Down
2 changes: 2 additions & 0 deletions org.sofproject.gst.topo/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ Require-Bundle: org.sofproject.core,
org.sofproject.ui,
org.sofproject.topo.ui,
com.jcraft.jsch
Import-Package: org.eclipse.ui
Export-Package: org.sofproject.gst.topo.ops
5 changes: 4 additions & 1 deletion org.sofproject.gst.topo/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
plugin.xml,\
lib/jackson-annotations-2.10.1.jar,\
lib/jackson-core-2.10.1.jar,\
lib/jackson-databind-2.10.1.jar
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -192,6 +195,7 @@ public void serialize() throws CoreException, IOException {
fileInput.setContents(new ByteArrayInputStream(os.toByteArray()), true, false, null);
}

@Override
public String getPipelineString() {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright (c) 2019, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Intel Corporation nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

package org.sofproject.gst.topo.ops;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.FileSystem;
import java.nio.file.Path;
import java.nio.file.Paths;

import org.eclipse.core.runtime.IProgressMonitor;
import org.sofproject.core.AudioDevNodeProject;
import org.sofproject.core.connection.AudioDevNodeConnection;
import org.sofproject.core.ops.SimpleRemoteOp;
import org.sofproject.topo.ui.json.JsonProperty;
import org.sofproject.topo.ui.json.JsonUtils;

import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;

public class GstDockerOperation extends SimpleRemoteOp {

private JsonUtils jsonUtils;

public GstDockerOperation(AudioDevNodeConnection conn, JsonUtils jsonUtils) {
super(conn);
this.jsonUtils = jsonUtils;
}

@Override
public boolean isCancelable() {
return true;
}

@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Sending json to docker", 100);

try {
if (!conn.isConnected()) {
throw new InvocationTargetException(new IllegalStateException("Node not connected"));
}

JsonProperty jsonProperty = jsonUtils.getJsonProperty();

AudioDevNodeProject proj = conn.getProject();
Session session = conn.getSession();
ChannelExec channel = (ChannelExec) session.openChannel("exec");
channel.setInputStream(null);

String jsonFileName = "pipeline.json";
String projectPath = proj.getProject().getLocation().toString();
Path partPathToJson = Paths.get(jsonProperty.getType().toLowerCase(), jsonProperty.getName(), jsonProperty.getVersion());
Path fullPathToJson = Paths.get(projectPath, partPathToJson.toString(), jsonFileName);
String linuxPartPathToJson = partPathToJson.toString();
linuxPartPathToJson = linuxPartPathToJson.replace("\\", "/");

BufferedReader reader = new BufferedReader(new FileReader(fullPathToJson.toString()));
String currentLine = reader.readLine();
reader.close();

channel.setPty(true); // for ctrl+c sending
String command = String.format(
"docker exec -t video_analytics_serving_gstreamer /bin/bash -c \"cd pipelines; mkdir -p %s; cd %s; touch %s; echo \'%s\' > %s\"",
linuxPartPathToJson, linuxPartPathToJson, jsonFileName, currentLine.replace("\"", "\\\""), jsonFileName);
channel.setCommand(command);

channel.connect();

while (!channel.isEOF())
;
channel.disconnect();
monitor.beginTask("Sending json to docker", 1000);

} catch (JSchException | IOException e) {
throw new InvocationTargetException(e);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (c) 2019, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Intel Corporation nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

package org.sofproject.gst.topo.ops;

import org.sofproject.core.connection.AudioDevNodeConnection;
import org.sofproject.core.ops.IRemoteOp;
import org.sofproject.core.ops.IRemoteOpsProvider;
import org.sofproject.topo.ui.json.JsonUtils;

public class GstDockerOpsProvider implements IRemoteOpsProvider {

public static final String SEND_DOCKER = "org.sofproject.gst.topo.ops.senddocker";

public static final String[] OPS = { SEND_DOCKER };

JsonUtils jsonUtils;

public GstDockerOpsProvider(JsonUtils jsonUtils) {
this.jsonUtils = jsonUtils;
}

@Override
public String[] getRemoteOpsIds() {
return OPS;
}

@Override
public String getRemoteOpDisplayName(String opId) {
switch (opId) {
case SEND_DOCKER:
return "Serialize Topology to Json & send to Docker";
default:
return null;
}
}

@Override
public IRemoteOp createRemoteOp(String opId, AudioDevNodeConnection conn) {
switch (opId) {
case SEND_DOCKER:
return new GstDockerOperation(conn, jsonUtils);
default:
return null;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public IRemoteOp createRemoteOp(String opId, AudioDevNodeConnection conn) {
switch (opId) {
case TEST_TOPO:
if (conn == null) {
conn = AudioDevNodeConnectionManager.getInstance().getConnection(graph.getFileInput().getProject());;
conn = AudioDevNodeConnectionManager.getInstance().getConnection(graph.getFileInput().getProject());
}
return new GstTopoTestOperation(graph, conn);
default:
Expand Down
10 changes: 9 additions & 1 deletion org.sofproject.topo.ui/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<accessrules>
<accessrule kind="accessible" pattern="javafx/**"/>
</accessrules>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/javax-inject.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-annotations-2.10.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-core-2.10.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-databind-2.10.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
10 changes: 8 additions & 2 deletions org.sofproject.topo.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.core.runtime;visibility:=reexport,
org.eclipse.gef.zest.fx;bundle-version="5.0.1",
org.eclipse.gef.zest.fx.ui;bundle-version="5.0.2",
org.sofproject.core,
org.sofproject.ui
org.sofproject.ui,
org.sofproject.gst.topo
Import-Package: com.google.common.collect;version="21.0.0",
com.google.common.reflect;version="21.0.0",
com.google.inject;version="1.3.0",
Expand All @@ -25,4 +26,9 @@ Import-Package: com.google.common.collect;version="21.0.0",
com.google.inject.util;version="1.3.0"
Bundle-Vendor: Intel Corporation
Export-Package: org.sofproject.topo.ui.editor,
org.sofproject.topo.ui.graph
org.sofproject.topo.ui.graph,
org.sofproject.topo.ui.json
Bundle-ClassPath: lib/jackson-annotations-2.10.1.jar,
lib/jackson-core-2.10.1.jar,
lib/jackson-databind-2.10.1.jar,
.
5 changes: 4 additions & 1 deletion org.sofproject.topo.ui/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
bin/
bin/,\
lib/jackson-annotations-2.10.1.jar,\
lib/jackson-core-2.10.1.jar,\
lib/jackson-databind-2.10.1.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added org.sofproject.topo.ui/lib/javax-inject.jar
Binary file not shown.
Loading