Search in sources :

Example 1 with ConcatExecutable

use of org.fagu.fmv.core.exec.executable.ConcatExecutable in project fmv by f-agu.

the class Append method appendAudioOrVideo.

/**
 * @param sourceNum
 * @param args
 */
private void appendAudioOrVideo(int sourceNum, String[] args) {
    if (args.length != 3) {
        getPrinter().println("usage: append <num-source> <start-time> <duration>");
        return;
    }
    try {
        Time startTime = Time.parse(args[1]);
        Duration duration = Duration.parse(args[2]);
        ConcatExecutable concatExecutable = getConcatExecutable();
        if (concatExecutable == null) {
            return;
        }
        CutExecutable cutExecutable = new CutExecutable(project, startTime, duration);
        cutExecutable.setSource(new SourceSource(project, sourceNum));
        concatExecutable.add(cutExecutable);
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) Time(org.fagu.fmv.utils.time.Time) Duration(org.fagu.fmv.utils.time.Duration) SourceSource(org.fagu.fmv.core.exec.source.SourceSource) CutExecutable(org.fagu.fmv.core.exec.executable.CutExecutable)

Example 2 with ConcatExecutable

use of org.fagu.fmv.core.exec.executable.ConcatExecutable in project fmv by f-agu.

the class Console method startConsole.

/**
 * @param consoleReader
 * @throws IOException
 */
private void startConsole(ConsoleReader consoleReader) throws IOException {
    List<Executable> executables = project.getExecutables();
    if (!executables.isEmpty()) {
        return;
    }
    consoleReader.println("Create a default structure");
    GenericExecutable rootExec = new GenericExecutable(project);
    FadeAudioVideoFilterExec fadeOut = new FadeAudioVideoFilterExec(project, FadeType.OUT, Time.valueOf(200), Duration.valueOf(3));
    rootExec.add(fadeOut);
    FadeAudioVideoFilterExec fadeIn = new FadeAudioVideoFilterExec(project, FadeType.IN, Time.valueOf(0), Duration.valueOf(2));
    fadeOut.add(fadeIn);
    GenericFilterExec audioMerge = new GenericFilterExec(project, "amerge");
    fadeIn.add(audioMerge);
    ConcatExecutable concat = new ConcatExecutable(project);
    audioMerge.add(concat);
    project.modified();
}
Also used : GenericFilterExec(org.fagu.fmv.core.exec.filter.GenericFilterExec) ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) FadeAudioVideoFilterExec(org.fagu.fmv.core.exec.filter.FadeAudioVideoFilterExec) ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) Executable(org.fagu.fmv.core.exec.Executable) GenericExecutable(org.fagu.fmv.core.exec.executable.GenericExecutable) GenericExecutable(org.fagu.fmv.core.exec.executable.GenericExecutable)

Example 3 with ConcatExecutable

use of org.fagu.fmv.core.exec.executable.ConcatExecutable in project fmv by f-agu.

the class Append method appendImage.

/**
 * @param sourceNum
 * @param args
 */
private void appendImage(int sourceNum, String[] args) {
    if (args.length != 3) {
        getPrinter().println("usage: append <num-source> <duration>");
        return;
    }
    Duration duration = Duration.parse(args[1]);
    ConcatExecutable concatExecutable = getConcatExecutable();
    if (concatExecutable == null) {
        return;
    }
    GenericExecutable genericExecutable = new GenericExecutable(project);
    genericExecutable.add(new SourceSource(project, sourceNum));
}
Also used : ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) Duration(org.fagu.fmv.utils.time.Duration) SourceSource(org.fagu.fmv.core.exec.source.SourceSource) GenericExecutable(org.fagu.fmv.core.exec.executable.GenericExecutable)

Example 4 with ConcatExecutable

use of org.fagu.fmv.core.exec.executable.ConcatExecutable in project fmv by f-agu.

the class Append method getConcatExecutable.

// ********************************************
/**
 * @return
 */
private ConcatExecutable getConcatExecutable() {
    Executable currentExecutable = environnement.getCurrentExecutable();
    if (currentExecutable != null && currentExecutable instanceof ConcatExecutable) {
        return (ConcatExecutable) currentExecutable;
    }
    List<ConcatExecutable> execs = BaseIdentifiable.stream(project).filter(id -> id instanceof ConcatExecutable).map(id -> (ConcatExecutable) id).collect(Collectors.toList());
    int size = execs.size();
    if (size == 0) {
        return new ConcatExecutable(project);
    }
    if (size == 1) {
        return execs.get(0);
    }
    Printer printer = getPrinter();
    printer.println("Too many executable.");
    printer.println("List all executables: execlist");
    printer.println("And select one: toexecutable <id>");
    return null;
}
Also used : Printer(org.fagu.fmv.cli.utils.Printer) CutExecutable(org.fagu.fmv.core.exec.executable.CutExecutable) ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) Duration(org.fagu.fmv.utils.time.Duration) Collectors(java.util.stream.Collectors) Executable(org.fagu.fmv.core.exec.Executable) Command(org.fagu.fmv.cli.annotation.Command) List(java.util.List) Alias(org.fagu.fmv.cli.annotation.Alias) SourceSource(org.fagu.fmv.core.exec.source.SourceSource) Time(org.fagu.fmv.utils.time.Time) GenericExecutable(org.fagu.fmv.core.exec.executable.GenericExecutable) FileSource(org.fagu.fmv.core.project.FileSource) BaseIdentifiable(org.fagu.fmv.core.exec.BaseIdentifiable) ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) CutExecutable(org.fagu.fmv.core.exec.executable.CutExecutable) ConcatExecutable(org.fagu.fmv.core.exec.executable.ConcatExecutable) Executable(org.fagu.fmv.core.exec.Executable) GenericExecutable(org.fagu.fmv.core.exec.executable.GenericExecutable) Printer(org.fagu.fmv.cli.utils.Printer)

Aggregations

ConcatExecutable (org.fagu.fmv.core.exec.executable.ConcatExecutable)4 GenericExecutable (org.fagu.fmv.core.exec.executable.GenericExecutable)3 SourceSource (org.fagu.fmv.core.exec.source.SourceSource)3 Duration (org.fagu.fmv.utils.time.Duration)3 Executable (org.fagu.fmv.core.exec.Executable)2 CutExecutable (org.fagu.fmv.core.exec.executable.CutExecutable)2 Time (org.fagu.fmv.utils.time.Time)2 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Alias (org.fagu.fmv.cli.annotation.Alias)1 Command (org.fagu.fmv.cli.annotation.Command)1 Printer (org.fagu.fmv.cli.utils.Printer)1 BaseIdentifiable (org.fagu.fmv.core.exec.BaseIdentifiable)1 FadeAudioVideoFilterExec (org.fagu.fmv.core.exec.filter.FadeAudioVideoFilterExec)1 GenericFilterExec (org.fagu.fmv.core.exec.filter.GenericFilterExec)1 FileSource (org.fagu.fmv.core.project.FileSource)1