Skip to content

Commit

Permalink
remove java.util.logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sannies committed Aug 19, 2016
1 parent 46d75b9 commit 95badfe
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 147 deletions.

This file was deleted.

Expand Up @@ -30,26 +30,30 @@
import org.mp4parser.muxer.tracks.CencEncryptedTrack;
import org.mp4parser.tools.IsoTypeWriter;
import org.mp4parser.tools.Path;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;
import java.util.*;
import java.util.logging.Logger;

import static org.mp4parser.tools.CastUtils.l2i;

/**
* Creates a fragmented MP4 file.
*/
public class FragmentedMp4Builder implements Mp4Builder {
private static final Logger LOG = Logger.getLogger(FragmentedMp4Builder.class.getName());
private static org.slf4j.Logger LOG = LoggerFactory.getLogger(FragmentedMp4Builder.class.getName());

protected Fragmenter fragmenter;

public FragmentedMp4Builder() {
}

private static long getTrackDuration(Movie movie, Track track) {
return (track.getDuration() * movie.getTimescale()) / track.getTrackMetaData().getTimescale();
}

public Date getDate() {
return new Date();
}
Expand All @@ -63,7 +67,6 @@ public ParsableBox createFtyp(Movie movie) {
return new FileTypeBox("iso6", 1, minorBrands);
}


protected List<Box> createMoofMdat(final Movie movie) {
List<Box> moofsMdats = new ArrayList<Box>();
HashMap<Track, long[]> intersectionMap = new HashMap<Track, long[]>();
Expand Down Expand Up @@ -149,7 +152,7 @@ protected int createFragment(List<Box> moofsMdats, Track track, long startSample
* {@inheritDoc}
*/
public Container build(Movie movie) {
LOG.fine("Creating movie " + movie);
LOG.debug("Creating movie " + movie);
if (fragmenter == null) {
fragmenter = new DefaultFragmenterImpl(2);
}
Expand Down Expand Up @@ -346,7 +349,6 @@ protected void createSaiz(long startSample, long endSample, CencEncryptedTrack t
parent.addBox(saiz);
}


/**
* Gets all samples starting with <code>startSample</code> (one based -&gt; one is the first) and
* ending with <code>endSample</code> (exclusive).
Expand Down Expand Up @@ -715,10 +717,6 @@ protected ParsableBox createTkhd(Movie movie, Track track) {
return tkhd;
}

private static long getTrackDuration(Movie movie, Track track) {
return (track.getDuration() * movie.getTimescale()) / track.getTrackMetaData().getTimescale();
}

protected ParsableBox createMdhd(Movie movie, Track track) {
MediaHeaderBox mdhd = new MediaHeaderBox();
mdhd.setCreationTime(track.getTrackMetaData().getCreationTime());
Expand Down Expand Up @@ -783,7 +781,7 @@ protected ParsableBox createMdia(Track track, Movie movie) {
}

protected ParsableBox createTrak(Track track, Movie movie) {
LOG.fine("Creating Track " + track);
LOG.debug("Creating Track " + track);
TrackBox trackBox = new TrackBox();
trackBox.addBox(createTkhd(movie, track));
ParsableBox edts = createEdts(track, movie);
Expand Down
Expand Up @@ -21,12 +21,13 @@
import org.mp4parser.muxer.Movie;
import org.mp4parser.muxer.Track;
import org.mp4parser.tools.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Logger;

import static org.mp4parser.tools.Mp4Math.lcm;

Expand All @@ -37,7 +38,7 @@
*/
public class SyncSampleIntersectFinderImpl implements Fragmenter {

private static Logger LOG = Logger.getLogger(SyncSampleIntersectFinderImpl.class.getName());
private static Logger LOG = LoggerFactory.getLogger(SyncSampleIntersectFinderImpl.class.getName());

private final int minFragmentDurationSeconds;
private Movie movie;
Expand Down Expand Up @@ -238,21 +239,21 @@ public long[] getCommonIndices(long[] syncSamples, long[] syncSampleTimes, long
log += (String.format("%10d,", l));
}
log += ("]");
LOG.warning(log);
LOG.warn(log);
log = "";

log += String.format("%5d - In : [", syncSamples.length);
for (long l : syncSamples) {
log += (String.format("%10d,", l));
}
log += ("]");
LOG.warning(log);
LOG.warning("There are less than 25% of common sync samples in the given track.");
LOG.warn(log);
LOG.warn("There are less than 25% of common sync samples in the given track.");
throw new RuntimeException("There are less than 25% of common sync samples in the given track.");
} else if (nuSyncSamples.size() < (syncSamples.length * 0.5)) {
LOG.fine("There are less than 50% of common sync samples in the given track. This is implausible but I'm ok to continue.");
LOG.info("There are less than 50% of common sync samples in the given track. This is implausible but I'm ok to continue.");
} else if (nuSyncSamples.size() < syncSamples.length) {
LOG.finest("Common SyncSample positions vs. this tracks SyncSample positions: " + nuSyncSamples.size() + " vs. " + syncSamples.length);
LOG.trace("Common SyncSample positions vs. this tracks SyncSample positions: " + nuSyncSamples.size() + " vs. " + syncSamples.length);
}
// End: Warn user if samples are not matching!

Expand Down
Expand Up @@ -24,19 +24,21 @@
import org.mp4parser.muxer.Sample;
import org.mp4parser.muxer.Track;
import org.mp4parser.muxer.TrackMetaData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;


/**
* Changes the timescale of a track by wrapping the track.
*/
public class ChangeTimeScaleTrack implements Track {
private static final Logger LOG = Logger.getLogger(ChangeTimeScaleTrack.class.getName());
private static Logger LOG = LoggerFactory.getLogger(ChangeTimeScaleTrack.class.getName());

Track source;
List<CompositionTimeToSample.Entry> ctts;
Expand Down Expand Up @@ -115,7 +117,7 @@ static long[] adjustTts(long[] sourceArray, double timeScaleFactor, long[] syncS
// we are at the sample before sync point
if (syncSampleTimes[ssIndex] != summedDurations) {
long correction = syncSampleTimes[ssIndex] - (summedDurations + x);
LOG.finest(String.format("Sample %d %d / %d - correct by %d", i, summedDurations, syncSampleTimes[ssIndex], correction));
LOG.debug(String.format("Sample %d %d / %d - correct by %d", i, summedDurations, syncSampleTimes[ssIndex], correction));
x += correction;
}
}
Expand Down
Expand Up @@ -13,22 +13,23 @@
import org.mp4parser.tools.IsoTypeReader;
import org.mp4parser.tools.Mp4Arrays;
import org.mp4parser.tools.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;

import static org.mp4parser.tools.CastUtils.l2i;

/**
*
*/
public class H263TrackImpl extends AbstractH26XTrack {
private static Logger LOG = Logger.getLogger(ESDescriptor.class.getName());
private static Logger LOG = LoggerFactory.getLogger(ESDescriptor.class.getName());

int RECTANGULAR = 0;
int BINARY = 1;
Expand Down
Expand Up @@ -13,19 +13,21 @@
import org.mp4parser.muxer.tracks.h264.parsing.model.SeqParameterSet;
import org.mp4parser.tools.Mp4Arrays;
import org.mp4parser.tools.RangeStartMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.logging.Logger;


/**
* The <code>H264TrackImpl</code> creates a <code>Track</code> from an H.264
* Annex B file.
*/
public class H264TrackImpl extends AbstractH26XTrack {
private static final Logger LOG = Logger.getLogger(H264TrackImpl.class.getName());
private static Logger LOG = LoggerFactory.getLogger(H264TrackImpl.class.getName());

Map<Integer, ByteBuffer> spsIdToSpsBytes = new HashMap<Integer, ByteBuffer>();
Map<Integer, SeqParameterSet> spsIdToSps = new HashMap<Integer, SeqParameterSet>();
Expand Down Expand Up @@ -308,7 +310,7 @@ boolean isFirstInNew(FirstVclNalDetector nu) {
FirstVclNalDetector current = new FirstVclNalDetector(nal,
nalUnitHeader.nal_ref_idc, nalUnitHeader.nal_unit_type);
if (fvnd != null && fvnd.isFirstInNew(current)) {
LOG.finest("Wrapping up cause of first vcl nal is found");
LOG.debug("Wrapping up cause of first vcl nal is found");
createSample(buffered);
}
fvnd = current;
Expand All @@ -319,7 +321,7 @@ boolean isFirstInNew(FirstVclNalDetector nu) {

case H264NalUnitTypes.SEI:
if (fvnd != null) {
LOG.finest("Wrapping up cause of SEI after vcl marks new sample");
LOG.debug("Wrapping up cause of SEI after vcl marks new sample");
createSample(buffered);
fvnd = null;
}
Expand All @@ -330,7 +332,7 @@ boolean isFirstInNew(FirstVclNalDetector nu) {

case H264NalUnitTypes.AU_UNIT_DELIMITER:
if (fvnd != null) {
LOG.finest("Wrapping up cause of AU after vcl marks new sample");
LOG.debug("Wrapping up cause of AU after vcl marks new sample");
createSample(buffered);
fvnd = null;
}
Expand All @@ -339,15 +341,15 @@ boolean isFirstInNew(FirstVclNalDetector nu) {
break;
case H264NalUnitTypes.SEQ_PARAMETER_SET:
if (fvnd != null) {
LOG.finest("Wrapping up cause of SPS after vcl marks new sample");
LOG.debug("Wrapping up cause of SPS after vcl marks new sample");
createSample(buffered);
fvnd = null;
}
handleSPS((ByteBuffer) nal.rewind());
break;
case 8:
if (fvnd != null) {
LOG.finest("Wrapping up cause of PPS after vcl marks new sample");
LOG.debug("Wrapping up cause of PPS after vcl marks new sample");
createSample(buffered);
fvnd = null;
}
Expand All @@ -363,7 +365,7 @@ boolean isFirstInNew(FirstVclNalDetector nu) {

default:
// buffered.add(nal);
LOG.warning("Unknown NAL unit type: " + nalUnitHeader.nal_unit_type);
LOG.warn("Unknown NAL unit type: " + nalUnitHeader.nal_unit_type);

}

Expand Down Expand Up @@ -434,7 +436,7 @@ private void createSample(List<ByteBuffer> buffered) throws IOException {
}
}
if (nu == null) {
LOG.warning("Sample without Slice");
LOG.warn("Sample without Slice");
return;
}
assert slice != null;
Expand Down Expand Up @@ -583,16 +585,16 @@ private void configureFramerate() {
timescale = firstSeqParameterSet.vuiParams.time_scale >> 1; // Not sure why, but I found this in several places, and it works...
frametick = firstSeqParameterSet.vuiParams.num_units_in_tick;
if (timescale == 0 || frametick == 0) {
LOG.warning("vuiParams contain invalid values: time_scale: " + timescale + " and frame_tick: " + frametick + ". Setting frame rate to 25fps");
LOG.warn("vuiParams contain invalid values: time_scale: " + timescale + " and frame_tick: " + frametick + ". Setting frame rate to 25fps");
timescale = 90000;
frametick = 3600;
}

if (timescale / frametick > 100) {
LOG.warning("Framerate is " + (timescale / frametick) + ". That is suspicious.");
LOG.warn("Framerate is " + (timescale / frametick) + ". That is suspicious.");
}
} else {
LOG.warning("Can't determine frame rate. Guessing 25 fps");
LOG.warn("Can't determine frame rate. Guessing 25 fps");
timescale = 90000;
frametick = 3600;
}
Expand Down

0 comments on commit 95badfe

Please sign in to comment.