Skip to content
Merged
5 changes: 3 additions & 2 deletions checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
files="FF|CRC32"/>

<!-- Probe/builder/options/progress fields use snake_case to match FFmpeg's JSON API -->
<suppress checks="MemberName"
<suppress checks="MemberName|GoogleNonConstantFieldName"
files="(probe|builder|options|progress)[\\/]"/>
<suppress checks="ParameterName"
files="(probe|builder|options|progress)[\\/]"/>

<!-- NUT format parser uses spec-matching names for readability -->
<suppress checks="MemberName|ParameterName|LocalVariableName|AbbreviationAsWordInName"
<suppress checks="MemberName|ParameterName|LocalVariableName|AbbreviationAsWordInName|GoogleNonConstantFieldName"
files="nut[\\/]"/>

</suppressions>
31 changes: 17 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.23.1</version>
<version>13.4.0</version>
</dependency>
</dependencies>
<configuration>
Expand Down Expand Up @@ -544,19 +544,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>checkstyle</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -593,6 +580,22 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- Checkstyle 13.x requires Java 21+, so bind it only here -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>checkstyle</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public class FractionAdapter extends TypeAdapter<Fraction> {

/** If set, 0/0 returns this value, instead of throwing a ArithmeticException. */
@SuppressWarnings(
"Immutable") // TODO Remove when https://github.com/google/error-prone/issues/512 is fixed
"Immutable") // TODO: Remove when https://github.com/google/error-prone/issues/512 is fixed
private final Fraction zeroByZero;

/** If set, N/0 returns this value, instead of throwing a ArithmeticException. */
@SuppressWarnings(
"Immutable") // TODO Remove when https://github.com/google/error-prone/issues/512 is fixed
"Immutable") // TODO: Remove when https://github.com/google/error-prone/issues/512 is fixed
private final Fraction divideByZero;

/** Constructs a FractionAdapter with default zero values for edge cases. */
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/bramp/ffmpeg/FFcommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected BufferedReader wrapErrorInReader(Process p) {
protected void throwOnError(Process p) throws IOException {
try {
if (ProcessUtils.waitForWithTimeout(p, 1, TimeUnit.SECONDS) != 0) {
// TODO Parse the error
// TODO: Parse the error
throw new IOException(path + " returned non-zero exit status. Check stdout.");
}
} catch (TimeoutException e) {
Expand All @@ -83,7 +83,7 @@ protected void throwOnError(Process p) throws IOException {
protected void throwOnError(Process p, FFmpegProbeResult result) throws IOException {
try {
if (ProcessUtils.waitForWithTimeout(p, 1, TimeUnit.SECONDS) != 0) {
// TODO Parse the error
// TODO: Parse the error
final FFmpegError ffmpegError = null == result ? null : result.getError();
throw new FFmpegException(
path + " returned non-zero exit status. Check stdout.", ffmpegError);
Expand Down Expand Up @@ -143,7 +143,7 @@ public void run(List<String> args) throws IOException {
assert (p != null);

try {
// TODO Move the copy onto a thread, so that FFmpegProgressListener can be on this thread.
// TODO: Move the copy onto a thread, so that FFmpegProgressListener can be on this thread.

// Now block reading ffmpeg's stdout. We are effectively throwing away the output.
CharStreams.copy(wrapInReader(p), processOutputStream);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/FFmpeg.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public synchronized List<ChannelLayout> channelLayouts() throws IOException {

/** Creates a progress parser for the given listener. */
protected ProgressParser createProgressParser(ProgressListener listener) throws IOException {
// TODO In future create the best kind for this OS, unix socket, named pipe, or TCP.
// TODO: In future create the best kind for this OS, unix socket, named pipe, or TCP.
try {
// Default to TCP because it is supported across all OSes, and is better than UDP because it
// provides good properties such as in-order packets, reliability, error checking, etc.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/FFmpegUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static String toTimecode(long duration, TimeUnit units) {
duration = Math.abs(duration);
}

long nanoseconds = units.toNanos(duration); // TODO This will clip at Long.MAX_VALUE
long nanoseconds = units.toNanos(duration); // TODO: This will clip at Long.MAX_VALUE
long seconds = units.toSeconds(duration);
long ns = nanoseconds - SECONDS.toNanos(seconds);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/FFprobe.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public FFmpegProbeResult probe(
this.builder().setInput(mediaPath).setUserAgent(userAgent).addExtraArgs(extraArgs).build());
}

// TODO Add Probe Inputstream
// TODO: Add Probe Inputstream
/** Probes media using the supplied arguments and returns the result. */
public FFmpegProbeResult probe(List<String> args) throws IOException {
checkIfFFprobe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public T setAudioFilter(String filter) {
@CheckReturnValue
@Override
public EncodingOptions buildOptions() {
// TODO When/if modelmapper supports @ConstructorProperties, we map this
// TODO: When/if modelmapper supports @ConstructorProperties, we map this
// object, instead of doing new XXX(...)
// https://github.com/jhalterman/modelmapper/issues/44
return new EncodingOptions(
Expand Down Expand Up @@ -351,13 +351,13 @@ protected List<String> build(FFmpegBuilder parent, int pass) {

checkState(input != null, "Target size must be used with setInput(FFmpegProbeResult)");

// TODO factor in start time and/or number of frames
// TODO: factor in start time and/or number of frames

double durationInSeconds = input.format.duration;
long totalBitRate =
(long) Math.floor((targetSize * 8) / durationInSeconds) - pass_padding_bitrate;

// TODO Calculate audioBitRate
// TODO: Calculate audioBitRate

if (video_enabled && video_bit_rate == 0) {
// Video (and possibly audio)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public abstract class AbstractFFmpegStreamBuilder<T extends AbstractFFmpegStream
public long targetSize = 0; // in bytes
public long pass_padding_bitrate = 1024; // in bits per second

public boolean throwWarnings = true; // TODO Either delete this, or apply it consistently
public boolean throwWarnings = true; // TODO: Either delete this, or apply it consistently

/** Constructs a stream builder with no parent. */
protected AbstractFFmpegStreamBuilder() {
Expand Down Expand Up @@ -759,7 +759,7 @@ protected void addVideoFlags(FFmpegBuilder parent, ImmutableList.Builder<String>
args.add("-s", String.format("%dx%d", video_width, video_height));
}

// TODO What if width is set but heigh isn't. We don't seem to do anything
// TODO: What if width is set but heigh isn't. We don't seem to do anything

if (video_frame_rate != null) {
args.add("-r", video_frame_rate.toString());
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/bramp/ffmpeg/builder/AudioCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ public class AudioCodec {
/** Monkey's Audio. */
public static final String APE = "ape";

/** aptX (Audio Processing Technology for Bluetooth). */
/** AptX (Audio Processing Technology for Bluetooth). */
public static final String APTX = "aptx";

/** aptX HD (Audio Processing Technology for Bluetooth). */
/** AptX HD (Audio Processing Technology for Bluetooth). */
public static final String APTX_HD = "aptx_hd";

/** ATRAC1 (Adaptive TRansform Acoustic Coding). */
Expand Down Expand Up @@ -260,7 +260,7 @@ public class AudioCodec {
/** Constrained Energy Lapped Transform (CELT). */
public static final String CELT = "celt";

/** codec2 (very low bitrate speech codec). */
/** Codec2 (very low bitrate speech codec). */
public static final String CODEC2 = "codec2";

/** RFC 3389 Comfort Noise. */
Expand Down Expand Up @@ -344,7 +344,7 @@ public class AudioCodec {
/** IAC (Indeo Audio Coder). */
public static final String IAC = "iac";

/** iLBC (Internet Low Bitrate Codec). */
/** ILBC (Internet Low Bitrate Codec). */
public static final String ILBC = "ilbc";

/** IMC (Intel Music Coder). */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public FFmpegHlsOutputBuilder setHlsTime(long duration, TimeUnit units) {
}

/**
* hls_segment_filename Examples <br>
* Sets the HLS segment filename ({@code hls_segment_filename}). Examples: <br>
* <br>
* "file%03d.ts" segment files: file000.ts, file001.ts, file002.ts, etc.
*
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/net/bramp/ffmpeg/builder/VideoCodec.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ public class VideoCodec {
/** HuffYUV MT. */
public static final String HYMT = "hymt";

/** id Quake II CIN video (decoders: idcinvideo). */
/** Id Quake II CIN video (decoders: idcinvideo). */
public static final String IDCIN = "idcin";

/** iCEDraw text. */
/** ICEDraw text. */
public static final String IDF = "idf";

/** IFF ACBM/ANIM/DEEP/ILBM/PBM/RGB8/RGBN (decoders: iff). */
Expand Down Expand Up @@ -548,19 +548,19 @@ public class VideoCodec {
/** RemotelyAnywhere Screen Capture. */
public static final String RASC = "rasc";

/** raw video. */
/** Raw video. */
public static final String RAWVIDEO = "rawvideo";

/** RL2 video. */
public static final String RL2 = "rl2";

/** id RoQ video (decoders: roqvideo) (encoders: roqvideo). */
/** Id RoQ video (decoders: roqvideo) (encoders: roqvideo). */
public static final String ROQ = "roq";

/** QuickTime video (RPZA). */
public static final String RPZA = "rpza";

/** innoHeim/Rsupport Screen Capture Codec. */
/** InnoHeim/Rsupport Screen Capture Codec. */
public static final String RSCC = "rscc";

/** RTV1 (RivaTuner Video). */
Expand Down Expand Up @@ -731,7 +731,7 @@ public class VideoCodec {
/** Sierra VMD video. */
public static final String VMDVIDEO = "vmdvideo";

/** vMix Video. */
/** VMix Video. */
public static final String VMIX = "vmix";

/** VMware Screen Codec / VMware Video. */
Expand Down Expand Up @@ -809,7 +809,7 @@ public class VideoCodec {
/** Wing Commander IV / Xxan. */
public static final String XAN_WC4 = "xan_wc4";

/** eXtended BINary text. */
/** EXtended BINary text. */
public static final String XBIN = "xbin";

/** XBM (X BitMap) image. */
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/io/LoggingFilterReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public LoggingFilterReader(Reader in, Logger logger) {
/** Logs the contents of the buffer and resets it. */
protected void log() {
if (buffer.length() > 0) {
// TODO Change from debug, to a user defined level
// TODO: Change from debug, to a user defined level
logger.debug(buffer.toString());
buffer.setLength(0);
}
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/net/bramp/ffmpeg/nut/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

/** A video or audio frame. */
public class Frame {
// TODO Change this to a enum
// TODO: Change this to a enum
static final long FLAG_KEY = 1 << 0;
static final long FLAG_EOR = 1 << 1;
static final long FLAG_CODED_PTS = 1 << 3;
Expand Down Expand Up @@ -47,7 +47,7 @@ protected Map<String, Object> readMetaData(NutDataInputStream in) throws IOExcep
} else if (type == -2) {
String k = new String(in.readVarArray(), StandardCharsets.UTF_8);
String v = new String(in.readVarArray(), StandardCharsets.UTF_8);
value = k + "=" + v; // TODO Change this some how
value = k + "=" + v; // TODO: Change this some how

} else if (type == -3) {
value = in.readSignedVarInt();
Expand All @@ -57,7 +57,7 @@ protected Map<String, Object> readMetaData(NutDataInputStream in) throws IOExcep
* t (v coded universal timestamp) tmp v id= tmp % time_base_count value= (tmp /
* time_base_count) * timeBase[id]
*/
value = in.readVarLong(); // TODO Convert to timestamp
value = in.readVarLong(); // TODO: Convert to timestamp

} else if (type < -4) {
long denominator = -type - 4;
Expand Down Expand Up @@ -117,7 +117,7 @@ public void read(NutReader nut, NutDataInputStream in, int code) throws IOExcept
pts = coded_pts - (1L << stream.header.msbPtsShift);
}
} else {
// TODO Test this code path
// TODO: Test this code path
pts = stream.last_pts + fc.ptsDelta;
}
stream.last_pts = pts;
Expand Down Expand Up @@ -149,7 +149,7 @@ public void read(NutReader nut, NutDataInputStream in, int code) throws IOExcept
if ((flags & FLAG_CHECKSUM) == FLAG_CHECKSUM) {
@SuppressWarnings("unused")
long checksum = in.readInt();
// TODO Test checksum
// TODO: Test checksum
}

if (size > 4096) {
Expand All @@ -158,7 +158,7 @@ public void read(NutReader nut, NutDataInputStream in, int code) throws IOExcept

// Now data
if ((flags & FLAG_SM_DATA) == FLAG_SM_DATA) {
// TODO Test this path.
// TODO: Test this path.

if (nut.header.version < 4) {
throw new IOException("Frame SM Data not allowed in version 4 or less");
Expand All @@ -178,7 +178,7 @@ public void read(NutReader nut, NutDataInputStream in, int code) throws IOExcept
metaData = null;
}

// TODO Use some kind of byte pool
// TODO: Use some kind of byte pool
data = new byte[size];

byte[] elision = nut.header.elision.get(header_idx);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/nut/IndexPacket.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package net.bramp.ffmpeg.nut;

/** Represents an index packet in the NUT multimedia container format. */
// TODO
// TODO:
public class IndexPacket {}
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/nut/InfoPacket.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package net.bramp.ffmpeg.nut;

/** Represents an info packet in the NUT multimedia container format. */
// TODO
// TODO:
public class InfoPacket {}
4 changes: 2 additions & 2 deletions src/main/java/net/bramp/ffmpeg/nut/NutDataInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public int readVarInt() throws IOException {
more = (b & 0x80) == 0x80;
result = 128 * result + (b & 0x7F);

// TODO Check for int overflow
// TODO: Check for int overflow
} while (more);

return result;
Expand All @@ -64,7 +64,7 @@ public long readVarLong() throws IOException {
more = (b & 0x80) == 0x80;
result = 128 * result + (b & 0x7F);

// TODO Check for long overflow
// TODO: Check for long overflow
} while (more);

return result;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/nut/Packet.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void seekToPacketFooter(NutDataInputStream in) throws IOException {
if (current > header.end) {
throw new IOException("Can not seek backwards at:" + current + " end:" + header.end);
}
// TODO Fix this to not cast longs to ints
// TODO: Fix this to not cast longs to ints
in.skipBytes((int) (header.end - current));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/nut/PacketHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void read(NutDataInputStream in, long startcode) throws IOException {
long expected = in.getCRC();
checksum = in.readInt();
if (checksum != expected) {
// TODO This code path has never been tested.
// TODO: This code path has never been tested.
throw new IOException(
String.format("invalid header checksum %X want %X", expected, checksum));
}
Expand Down
Loading
Loading