if (resetOnMetadataUpdate) {
reset();
}
- updateTimestamp();
+ updateTimestamp(true);
}
@Override
public void process(byte[] buffer) throws IOException {
super.process(buffer);
counter.getAndAdd(buffer.length);
- updateTimestamp();
+ updateTimestamp(false);
}
//
//
/** Updates the timestamp in the metadata. */
- private void updateTimestamp() {
+ private void updateTimestamp(boolean now) {
long timestamp = getMillis() / 1000;
- if (lastTimestamp.get() != timestamp) {
- super.metadataUpdated(parentMetadata.get().comment(String.format("%02d:%02d", timestamp / 60, timestamp % 60)));
+ if (now || (lastTimestamp.get() != timestamp)) {
+ super.metadataUpdated(parentMetadata.get().comment(String.format("%s%02d:%02d", (timestamp >= 3600) ? String.format("%d:", timestamp / 3600) : "" , (timestamp % 3600) / 60, timestamp % 60)));
lastTimestamp.set(timestamp);
}
}