88import com .google .common .base .Preconditions ;
99import com .google .common .base .Strings ;
1010import com .google .common .collect .ImmutableList ;
11+ import java .io .File ;
1112import java .net .URI ;
13+ import java .nio .file .Path ;
14+ import java .nio .file .Paths ;
1215import java .util .ArrayList ;
1316import java .util .List ;
1417import java .util .Map ;
@@ -104,6 +107,14 @@ public FFmpegBuilder setPassDirectory(String directory) {
104107 return this ;
105108 }
106109
110+ public FFmpegBuilder setPassDirectory (File directory ) {
111+ return setPassDirectory (checkNotNull (directory ).getPath ());
112+ }
113+
114+ public FFmpegBuilder setPassDirectory (Path directory ) {
115+ return setPassDirectory (checkNotNull (directory ).toString ());
116+ }
117+
107118 public String getPassDirectory () {
108119 return this .pass_directory ;
109120 }
@@ -153,6 +164,14 @@ public FFmpegFileInputBuilder addInput(String filename) {
153164 return this .doAddInput (new FFmpegFileInputBuilder (this , filename ));
154165 }
155166
167+ public FFmpegFileInputBuilder addInput (File file ) {
168+ return addInput (checkNotNull (file ).getPath ());
169+ }
170+
171+ public FFmpegFileInputBuilder addInput (Path path ) {
172+ return addInput (checkNotNull (path ).toString ());
173+ }
174+
156175 public <T extends AbstractFFmpegInputBuilder <T >> FFmpegBuilder addInput (T input ) {
157176 return this .doAddInput (input ).done ();
158177 }
@@ -179,6 +198,16 @@ public FFmpegFileInputBuilder setInput(String filename) {
179198 return addInput (filename );
180199 }
181200
201+ public FFmpegFileInputBuilder setInput (File file ) {
202+ clearInputs ();
203+ return addInput (file );
204+ }
205+
206+ public FFmpegFileInputBuilder setInput (Path path ) {
207+ clearInputs ();
208+ return addInput (path );
209+ }
210+
182211 public <T extends AbstractFFmpegInputBuilder <T >> FFmpegBuilder setInput (T input ) {
183212 checkNotNull (input );
184213
@@ -306,6 +335,14 @@ public FFmpegOutputBuilder addOutput(String filename) {
306335 return output ;
307336 }
308337
338+ public FFmpegOutputBuilder addOutput (File file ) {
339+ return addOutput (checkNotNull (file ).getPath ());
340+ }
341+
342+ public FFmpegOutputBuilder addOutput (Path path ) {
343+ return addOutput (checkNotNull (path ).toString ());
344+ }
345+
309346 /**
310347 * Adds new output file.
311348 *
@@ -336,6 +373,14 @@ public FFmpegHlsOutputBuilder addHlsOutput(String filename) {
336373 return output ;
337374 }
338375
376+ public FFmpegHlsOutputBuilder addHlsOutput (File file ) {
377+ return addHlsOutput (checkNotNull (file ).getPath ());
378+ }
379+
380+ public FFmpegHlsOutputBuilder addHlsOutput (Path path ) {
381+ return addHlsOutput (checkNotNull (path ).toString ());
382+ }
383+
339384 /**
340385 * Adds an existing FFmpegOutputBuilder. This is similar to calling the other addOuput methods but
341386 * instead allows an existing FFmpegOutputBuilder to be used, and reused.
@@ -420,7 +465,7 @@ public List<String> build() {
420465 args .add ("-pass" , Integer .toString (pass ));
421466
422467 if (pass_prefix != null ) {
423- args .add ("-passlogfile" , pass_directory + pass_prefix );
468+ args .add ("-passlogfile" , Paths . get ( pass_directory , pass_prefix ). toString () );
424469 }
425470 }
426471
0 commit comments