Skip to content

Commit 449b005

Browse files
committed
chore: Move two-pass format check into AbstractFFmpegOutputBuilder
1 parent d37cded commit 449b005

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegOutputBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ public EncodingOptions buildOptions() {
255255
@Override
256256
protected List<String> build(int pass) {
257257
Preconditions.checkState(parent != null, "Can not build without parent being set");
258+
258259
return build(parent, pass);
259260
}
260261

@@ -273,7 +274,10 @@ protected List<String> build(FFmpegBuilder parent, int pass) {
273274
checkArgument(
274275
targetSize != 0 || video_bit_rate != 0,
275276
"Target size, or video bitrate must be specified when using two-pass");
277+
278+
checkArgument(format != null, "Format must be specified when using two-pass");
276279
}
280+
277281
if (targetSize > 0) {
278282
checkState(parent.inputs.size() == 1, "Target size does not support multiple inputs");
279283

src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegStreamBuilder.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
*/
5656
public abstract class AbstractFFmpegStreamBuilder<T extends AbstractFFmpegStreamBuilder<T>> {
5757

58-
private static final String DEVNULL = SystemUtils.IS_OS_WINDOWS ? "NUL" : "/dev/null";
58+
protected static final String DEVNULL = SystemUtils.IS_OS_WINDOWS ? "NUL" : "/dev/null";
5959

6060
final FFmpegBuilder parent;
6161

@@ -551,11 +551,6 @@ protected List<String> build(int pass) {
551551
protected List<String> build(FFmpegBuilder parent, int pass) {
552552
checkNotNull(parent);
553553

554-
if (pass > 0) {
555-
// TODO Write a test for this:
556-
checkArgument(format != null, "Format must be specified when using two-pass");
557-
}
558-
559554
ImmutableList.Builder<String> args = new ImmutableList.Builder<>();
560555

561556
addGlobalFlags(parent, args);

0 commit comments

Comments
 (0)