Skip to content

Commit dec2f7f

Browse files
jeongmallrobrampdependabot[bot]
committed
Add -map option (#362)
* feat: Add -map option * chore: rename master branch to main in CI workflow * Bump org.apache.maven.plugins:maven-release-plugin from 3.0.1 to 3.3.1 (#380) Bumps [org.apache.maven.plugins:maven-release-plugin](https://github.com/apache/maven-release) from 3.0.1 to 3.3.1. - [Release notes](https://github.com/apache/maven-release/releases) - [Commits](apache/maven-release@maven-release-3.0.1...maven-release-3.3.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-release-plugin dependency-version: 3.3.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump org.apache.maven.plugins:maven-pmd-plugin from 3.21.2 to 3.28.0 (#379) Bumps [org.apache.maven.plugins:maven-pmd-plugin](https://github.com/apache/maven-pmd-plugin) from 3.21.2 to 3.28.0. - [Release notes](https://github.com/apache/maven-pmd-plugin/releases) - [Commits](apache/maven-pmd-plugin@maven-pmd-plugin-3.21.2...maven-pmd-plugin-3.28.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-pmd-plugin dependency-version: 3.28.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump org.codehaus.mojo:extra-enforcer-rules from 1.8.0 to 1.12.0 (#378) Bumps [org.codehaus.mojo:extra-enforcer-rules](https://github.com/mojohaus/extra-enforcer-rules) from 1.8.0 to 1.12.0. - [Release notes](https://github.com/mojohaus/extra-enforcer-rules/releases) - [Commits](mojohaus/extra-enforcer-rules@1.8.0...1.12.0) --- updated-dependencies: - dependency-name: org.codehaus.mojo:extra-enforcer-rules dependency-version: 1.12.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump org.apache.maven.plugins:maven-install-plugin from 3.1.1 to 3.1.4 (#376) Bumps [org.apache.maven.plugins:maven-install-plugin](https://github.com/apache/maven-install-plugin) from 3.1.1 to 3.1.4. - [Release notes](https://github.com/apache/maven-install-plugin/releases) - [Commits](apache/maven-install-plugin@maven-install-plugin-3.1.1...maven-install-plugin-3.1.4) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-install-plugin dependency-version: 3.1.4 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * ci: split workflows into test and release - test.yml: CI only (push to main, PRs) - release.yml: publish + javadoc (tag push, manual dispatch) - Automate javadoc publishing to GitHub Pages via Actions - Support manual dispatch for one-off javadoc deploys * chore: simplify pom.xml Remove dead/obsolete plugins and config: - maven-release-plugin (replaced by GitHub Actions) - cobertura-maven-plugin (abandoned, incompatible with modern Java) - coveralls-maven-plugin (abandoned, not used in CI) - formatter-maven-plugin (replaced by fmt-maven-plugin) - maven-scm-publish-plugin (replaced by GitHub Actions Pages deploy) - maven-site-plugin (no longer running mvn site) - Entire <reporting> section (broken/stale plugins) - Java 8 profile (minimum is now Java 11) - Java 9+ profile (inlined maven.compiler.release into properties) - distributionManagement/snapshotRepository (unused with central-publishing-maven-plugin) - Duplicate central-publishing-maven-plugin version --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Andrew Brampton <github@bramp.net> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 708ab78 commit dec2f7f

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public abstract class AbstractFFmpegStreamBuilder<T extends AbstractFFmpegStream
7070
public Long duration; // in milliseconds
7171

7272
public final List<String> meta_tags = new ArrayList<>();
73+
public final List<String> maps = new ArrayList<>();
7374

7475
public boolean audio_enabled = true;
7576
public String audio_codec;
@@ -364,6 +365,18 @@ public T addMetaTag(MetadataSpecifier spec, String key, String value) {
364365
return getThis();
365366
}
366367

368+
public T addMap(int inputIndex) {
369+
checkArgument(inputIndex >= 0, "inputIndex must be greater or equal to zero");
370+
this.maps.add(String.valueOf(inputIndex));
371+
return getThis();
372+
}
373+
374+
public T addMap(int inputIndex, StreamSpecifier spec) {
375+
checkArgument(inputIndex >= 0, "inputIndex must be greater or equal to zero");
376+
this.maps.add(inputIndex + ":" + spec.spec());
377+
return getThis();
378+
}
379+
367380
public T setAudioCodec(String codec) {
368381
this.audio_enabled = true;
369382
this.audio_codec = checkNotEmpty(codec, "codec must not be empty");
@@ -673,5 +686,9 @@ protected void addVideoFlags(FFmpegBuilder parent, ImmutableList.Builder<String>
673686
}
674687
}
675688

676-
protected void addFormatArgs(ImmutableList.Builder<String> args) {}
689+
protected void addFormatArgs(ImmutableList.Builder<String> args) {
690+
for (String map : maps) {
691+
args.add("-map", map);
692+
}
693+
}
677694
}

‎src/test/java/net/bramp/ffmpeg/builder/AbstractFFmpegStreamBuilderTest.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package net.bramp.ffmpeg.builder;
22

3+
import static net.bramp.ffmpeg.builder.StreamSpecifier.stream;
4+
import static net.bramp.ffmpeg.builder.StreamSpecifierType.*;
35
import static org.hamcrest.MatcherAssert.assertThat;
46
import static org.hamcrest.core.Is.is;
57
import static org.junit.Assert.assertEquals;
@@ -225,4 +227,11 @@ public void testAddExtraArgs() {
225227

226228
assertThat(removeCommon(command), is(ImmutableList.of("-some", "args")));
227229
}
230+
231+
@Test
232+
public void testAddMap() {
233+
List<String> command = getBuilder().addMap(0, stream(Video)).build(0);
234+
235+
assertThat(removeCommon(command), is(ImmutableList.of("-map", "0:v")));
236+
}
228237
}

0 commit comments

Comments
 (0)