@@ -106,52 +106,63 @@ public abstract class AbstractFFmpegStreamBuilder<T extends AbstractFFmpegStream
106106
107107 public boolean throwWarnings = true ; // TODO Either delete this, or apply it consistently
108108
109+ /** Constructs a stream builder with no parent. */
109110 protected AbstractFFmpegStreamBuilder () {
110111 this .parent = null ;
111112 }
112113
114+ /** Constructs a stream builder with the given parent and output filename. */
113115 protected AbstractFFmpegStreamBuilder (FFmpegBuilder parent , String filename ) {
114116 this .parent = checkNotNull (parent );
115117 this .filename = checkNotEmpty (filename , "filename must not be empty" );
116118 }
117119
120+ /** Constructs a stream builder with the given parent and output URI. */
118121 protected AbstractFFmpegStreamBuilder (FFmpegBuilder parent , URI uri ) {
119122 this .parent = checkNotNull (parent );
120123 this .uri = checkValidStream (uri );
121124 }
122125
126+ /** Returns this instance for fluent API chaining. */
123127 protected abstract T getThis ();
124128
129+ /** Applies the given encoding options to this builder. */
125130 public T useOptions (EncodingOptions opts ) {
126131 Mapper .map (opts , this );
127132 return getThis ();
128133 }
129134
135+ /** Applies the given main encoding options to this builder. */
130136 public T useOptions (MainEncodingOptions opts ) {
131137 Mapper .map (opts , this );
132138 return getThis ();
133139 }
134140
141+ /** Applies the given audio encoding options to this builder. */
135142 public T useOptions (AudioEncodingOptions opts ) {
136143 Mapper .map (opts , this );
137144 return getThis ();
138145 }
139146
147+ /** Applies the given video encoding options to this builder. */
140148 public T useOptions (VideoEncodingOptions opts ) {
141149 Mapper .map (opts , this );
142150 return getThis ();
143151 }
144152
153+ /** Disables video output. */
145154 public T disableVideo () {
146155 this .video_enabled = false ;
147156 return getThis ();
148157 }
149158
159+ /** Disables audio output. */
150160 public T disableAudio () {
151161 this .audio_enabled = false ;
152162 return getThis ();
153163 }
154164
165+ /** Disables subtitle output. */
155166 public T disableSubtitle () {
156167 this .subtitle_enabled = false ;
157168 return getThis ();
@@ -207,6 +218,7 @@ public T setPreset(String preset) {
207218 return getThis ();
208219 }
209220
221+ /** Sets the output filename. */
210222 public T setFilename (String filename ) {
211223 this .filename = checkNotEmpty (filename , "filename must not be empty" );
212224 return getThis ();
@@ -232,10 +244,12 @@ public T setFilename(Path path) {
232244 return setFilename (checkNotNull (path ).toString ());
233245 }
234246
247+ /** Returns the output filename. */
235248 public String getFilename () {
236249 return filename ;
237250 }
238251
252+ /** Sets the output URI. */
239253 public T setUri (URI uri ) {
240254 this .uri = checkValidStream (uri );
241255 return getThis ();
@@ -317,6 +331,7 @@ public T setFrames(int frames) {
317331 return getThis ();
318332 }
319333
334+ /** Checks if the given width or height value is valid. */
320335 protected static boolean isValidSize (int widthOrHeight ) {
321336 return widthOrHeight > 0 || widthOrHeight == -1 ;
322337 }
@@ -527,6 +542,7 @@ public T setDuration(long duration, TimeUnit units) {
527542 return getThis ();
528543 }
529544
545+ /** Sets the strict mode for standards compliance. */
530546 public T setStrict (Strict strict ) {
531547 this .strict = checkNotNull (strict );
532548 return getThis ();
@@ -607,6 +623,7 @@ public FFmpegBuilder done() {
607623 */
608624 public abstract EncodingOptions buildOptions ();
609625
626+ /** Builds the command-line arguments for the given pass using the parent builder. */
610627 protected List <String > build (int pass ) {
611628 Preconditions .checkState (parent != null , "Can not build without parent being set" );
612629 return build (parent , pass );
@@ -659,8 +676,10 @@ protected List<String> build(FFmpegBuilder parent, int pass) {
659676 return args .build ();
660677 }
661678
679+ /** Adds source and target specific arguments for the given pass. */
662680 protected abstract void addSourceTarget (int pass , ImmutableList .Builder <String > args );
663681
682+ /** Adds global flags such as format, preset, and time options to the arguments. */
664683 protected void addGlobalFlags (FFmpegBuilder parent , ImmutableList .Builder <String > args ) {
665684 if (strict != Strict .NORMAL ) {
666685 args .add ("-strict" , strict .toString ());
@@ -689,6 +708,7 @@ protected void addGlobalFlags(FFmpegBuilder parent, ImmutableList.Builder<String
689708 args .addAll (meta_tags );
690709 }
691710
711+ /** Adds audio-related flags such as codec, channels, and sample rate to the arguments. */
692712 protected void addAudioFlags (ImmutableList .Builder <String > args ) {
693713 if (!Strings .isNullOrEmpty (audio_codec )) {
694714 args .add ("-acodec" , audio_codec );
@@ -707,6 +727,7 @@ protected void addAudioFlags(ImmutableList.Builder<String> args) {
707727 }
708728 }
709729
730+ /** Adds video-related flags such as codec, frame rate, and resolution to the arguments. */
710731 protected void addVideoFlags (FFmpegBuilder parent , ImmutableList .Builder <String > args ) {
711732 if (video_frames != null ) {
712733 args .add ("-vframes" , video_frames .toString ());
@@ -745,6 +766,7 @@ protected void addVideoFlags(FFmpegBuilder parent, ImmutableList.Builder<String>
745766 }
746767 }
747768
769+ /** Adds format-related arguments such as stream mappings. */
748770 protected void addFormatArgs (ImmutableList .Builder <String > args ) {
749771 for (String map : maps ) {
750772 args .add ("-map" , map );
0 commit comments