-
-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Implement AbstractFFmepgInputBuilder * test: Add precondition checks for two pass builder * feat: Extract input and output specifier into their own method * docs: Update javadoc * docs(README): Update README to include the new InputBuilder syntax * feat: Add -stream_loop parameter to AbstractFFmpegInputBuilder
- Loading branch information
Showing
22 changed files
with
1,302 additions
and
60 deletions.
There are no files selected for viewing
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
75 changes: 75 additions & 0 deletions
75
src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegInputBuilder.java
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package net.bramp.ffmpeg.builder; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import net.bramp.ffmpeg.options.EncodingOptions; | ||
import net.bramp.ffmpeg.probe.FFmpegProbeResult; | ||
|
||
import javax.annotation.CheckReturnValue; | ||
|
||
public abstract class AbstractFFmpegInputBuilder<T extends AbstractFFmpegInputBuilder<T>> extends AbstractFFmpegStreamBuilder<T> { | ||
private final FFmpegProbeResult probeResult; | ||
|
||
private boolean readAtNativeFrameRate; | ||
/** | ||
* Number of times input stream shall be looped. Loop 0 means no loop, loop -1 means infinite loop. | ||
*/ | ||
private int streamLoop; | ||
|
||
protected AbstractFFmpegInputBuilder(FFmpegBuilder parent, String filename) { | ||
this(parent, null, filename); | ||
} | ||
|
||
protected AbstractFFmpegInputBuilder(FFmpegBuilder parent, FFmpegProbeResult probeResult, String filename) { | ||
super(parent, filename); | ||
this.probeResult = probeResult; | ||
} | ||
|
||
public T readAtNativeFrameRate() { | ||
this.readAtNativeFrameRate = true; | ||
return getThis(); | ||
} | ||
|
||
/** | ||
* Sets number of times input stream shall be looped. Loop 0 means no loop, loop -1 means infinite loop. | ||
* @param streamLoop loop counter | ||
* @return this | ||
*/ | ||
public T setStreamLoop(int streamLoop) { | ||
this.streamLoop = streamLoop; | ||
|
||
return getThis(); | ||
} | ||
|
||
public FFmpegProbeResult getProbeResult() { | ||
return probeResult; | ||
} | ||
|
||
@Override | ||
@CheckReturnValue | ||
@SuppressWarnings("unchecked") | ||
protected T getThis() { | ||
return (T) this; | ||
} | ||
|
||
@Override | ||
public EncodingOptions buildOptions() { | ||
return null; | ||
} | ||
|
||
@Override | ||
protected void addGlobalFlags(FFmpegBuilder parent, ImmutableList.Builder<String> args) { | ||
if (this.readAtNativeFrameRate) { | ||
args.add("-re"); | ||
} | ||
|
||
if (this.streamLoop != 0) { | ||
args.add("-stream_loop", Integer.toString(this.streamLoop)); | ||
} | ||
|
||
super.addGlobalFlags(parent, args); | ||
} | ||
|
||
public int getStreamLoop() { | ||
return streamLoop; | ||
} | ||
} |
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
Oops, something went wrong.