-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
72e1f12
commit f4d74d5
Showing
115 changed files
with
11,800 additions
and
4,156 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
@author "MIAGE 2 students" | ||
VideoGen { | ||
|
||
mandatory videoseq v1 "hello.mp4" | ||
mandatory videoseq v1 "/Users/macher1/Documents/bref2.mov" | ||
optional videoseq v2 "v2folder/v2.mp4" | ||
alternatives v3 { | ||
videoseq v31 "bla.mp4" | ||
videoseq v32 "blabla.mp4" | ||
} | ||
mandatory videoseq v4 "coucou.mp4" | ||
mandatory videoseq v4 "/Users/macher1/Documents/bref2.mov" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,90 @@ | ||
import java.io.BufferedWriter; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.OutputStreamWriter; | ||
import java.util.ArrayList; | ||
import java.util.function.Consumer; | ||
import org.eclipse.emf.common.util.URI; | ||
import org.eclipse.xtend2.lib.StringConcatenation; | ||
import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
import org.eclipse.xtext.xbase.lib.Exceptions; | ||
import org.eclipse.xtext.xbase.lib.InputOutput; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.xtext.example.mydsl.videoGen.MandatoryVideoSeq; | ||
import org.xtext.example.mydsl.videoGen.Media; | ||
import org.xtext.example.mydsl.videoGen.VideoDescription; | ||
import org.xtext.example.mydsl.videoGen.VideoGeneratorModel; | ||
import org.xtext.example.mydsl.videoGen.VideoSeq; | ||
|
||
@SuppressWarnings("all") | ||
public class VideoGenTest1 { | ||
@Test | ||
public void testLoadModel() { | ||
final VideoGeneratorModel videoGen = new VideoGenHelper().loadVideoGenerator(URI.createURI("example1.videogen")); | ||
Assert.assertNotNull(videoGen); | ||
InputOutput.<String>println(videoGen.getInformation().getAuthorName()); | ||
try { | ||
final VideoGeneratorModel videoGen = new VideoGenHelper().loadVideoGenerator(URI.createURI("example1.videogen")); | ||
Assert.assertNotNull(videoGen); | ||
InputOutput.<String>println(videoGen.getInformation().getAuthorName()); | ||
final ArrayList<String> playlist = CollectionLiterals.<String>newArrayList(); | ||
final Consumer<Media> _function = (Media media) -> { | ||
if ((media instanceof VideoSeq)) { | ||
final VideoSeq video = ((VideoSeq) media); | ||
if ((video instanceof MandatoryVideoSeq)) { | ||
final VideoDescription desc = ((MandatoryVideoSeq)video).getDescription(); | ||
String _location = desc.getLocation(); | ||
String _plus = ("file \'" + _location); | ||
String _plus_1 = (_plus + "\'"); | ||
playlist.add(_plus_1); | ||
} | ||
} | ||
}; | ||
videoGen.getMedias().forEach(_function); | ||
String playlistStr = ""; | ||
for (final String pl : playlist) { | ||
String _playlistStr = playlistStr; | ||
playlistStr = (_playlistStr + (pl + "\n")); | ||
} | ||
this.writeInFile("playlist.txt", playlistStr); | ||
Process p = null; | ||
String ffmpegCmd = this.ffmpegConcatenateCommand("/Users/macher1/git/teaching-MDE-MIAGE1718/VideoGenToolSuite/playlist.txt", "ro.mp4").toString(); | ||
InputOutput.<String>println(ffmpegCmd); | ||
p = Runtime.getRuntime().exec(ffmpegCmd); | ||
p.waitFor(); | ||
} catch (Throwable _e) { | ||
throw Exceptions.sneakyThrow(_e); | ||
} | ||
} | ||
|
||
public void writeInFile(final String filename, final String data) { | ||
try { | ||
FileOutputStream _fileOutputStream = new FileOutputStream(filename); | ||
OutputStreamWriter _outputStreamWriter = new OutputStreamWriter(_fileOutputStream, "utf-8"); | ||
final BufferedWriter buffer = new BufferedWriter(_outputStreamWriter); | ||
try { | ||
buffer.write(data); | ||
} catch (final Throwable _t) { | ||
if (_t instanceof IOException) { | ||
final IOException e = (IOException)_t; | ||
throw e; | ||
} else { | ||
throw Exceptions.sneakyThrow(_t); | ||
} | ||
} finally { | ||
buffer.flush(); | ||
buffer.close(); | ||
} | ||
} catch (Throwable _e) { | ||
throw Exceptions.sneakyThrow(_e); | ||
} | ||
} | ||
|
||
public CharSequence ffmpegConcatenateCommand(final String mpegPlaylistFile, final String outputPath) { | ||
StringConcatenation _builder = new StringConcatenation(); | ||
_builder.append("/usr/local/bin/ffmpeg -y -f concat -safe 0 -i "); | ||
_builder.append(mpegPlaylistFile); | ||
_builder.append(" -c copy "); | ||
_builder.append(outputPath); | ||
_builder.newLineIfNotEmpty(); | ||
return _builder; | ||
} | ||
} |
Binary file modified
BIN
+0 Bytes
(100%)
org.xtext.example.videogen.ide/bin/org/xtext/example/mydsl/ide/.VideoGenIdeModule.xtendbin
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
org.xtext.example.videogen.ide/bin/org/xtext/example/mydsl/ide/.VideoGenIdeSetup.xtendbin
Binary file not shown.
Binary file modified
BIN
+2.41 KB
(130%)
...e.videogen.ide/bin/org/xtext/example/mydsl/ide/contentassist/antlr/VideoGenParser$1.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...ple.videogen.ide/bin/org/xtext/example/mydsl/ide/contentassist/antlr/VideoGenParser.class
Binary file not shown.
Oops, something went wrong.