Package restructuring to accommodate incoming features (sorry).
This may be painful in terms of applications having to change their imports. Sorry about that.
This commit is contained in:
parent
27c0e7d776
commit
ed0b02d09b
@ -58,7 +58,7 @@ accompanying demo application. To get started:
|
||||
ExoPlayer can also be built using Gradle. You can include it as a dependent project and build from source. e.g.
|
||||
|
||||
```
|
||||
// setting.gradle
|
||||
// settings.gradle
|
||||
include ':app', ':..:ExoPlayer:library'
|
||||
|
||||
// app/build.gradle
|
||||
|
@ -117,9 +117,11 @@ public class FullPlayerActivity extends Activity implements SurfaceHolder.Callba
|
||||
View root = findViewById(R.id.root);
|
||||
root.setOnTouchListener(new OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View arg0, MotionEvent arg1) {
|
||||
if (arg1.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
toggleControlsVisibility();
|
||||
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
|
||||
view.performClick();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ package com.google.android.exoplayer.chunk;
|
||||
import com.google.android.exoplayer.MediaFormat;
|
||||
import com.google.android.exoplayer.ParserException;
|
||||
import com.google.android.exoplayer.SampleHolder;
|
||||
import com.google.android.exoplayer.parser.Extractor;
|
||||
import com.google.android.exoplayer.chunk.parser.Extractor;
|
||||
import com.google.android.exoplayer.upstream.DataSource;
|
||||
import com.google.android.exoplayer.upstream.DataSpec;
|
||||
import com.google.android.exoplayer.upstream.NonBlockingInputStream;
|
||||
@ -28,9 +28,9 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* An Mp4 {@link MediaChunk}.
|
||||
* A {@link MediaChunk} extracted from a container.
|
||||
*/
|
||||
public final class Mp4MediaChunk extends MediaChunk {
|
||||
public final class ContainerMediaChunk extends MediaChunk {
|
||||
|
||||
private final Extractor extractor;
|
||||
private final boolean maybeSelfContained;
|
||||
@ -44,7 +44,7 @@ public final class Mp4MediaChunk extends MediaChunk {
|
||||
* @deprecated Use the other constructor, passing null as {@code psshInfo}.
|
||||
*/
|
||||
@Deprecated
|
||||
public Mp4MediaChunk(DataSource dataSource, DataSpec dataSpec, Format format,
|
||||
public ContainerMediaChunk(DataSource dataSource, DataSpec dataSpec, Format format,
|
||||
int trigger, long startTimeUs, long endTimeUs, int nextChunkIndex,
|
||||
Extractor extractor, boolean maybeSelfContained, long sampleOffsetUs) {
|
||||
this(dataSource, dataSpec, format, trigger, startTimeUs, endTimeUs, nextChunkIndex,
|
||||
@ -68,7 +68,7 @@ public final class Mp4MediaChunk extends MediaChunk {
|
||||
* improve startup latency.
|
||||
* @param sampleOffsetUs An offset to subtract from the sample timestamps parsed by the extractor.
|
||||
*/
|
||||
public Mp4MediaChunk(DataSource dataSource, DataSpec dataSpec, Format format,
|
||||
public ContainerMediaChunk(DataSource dataSource, DataSpec dataSpec, Format format,
|
||||
int trigger, long startTimeUs, long endTimeUs, int nextChunkIndex, Extractor extractor,
|
||||
Map<UUID, byte[]> psshInfo, boolean maybeSelfContained, long sampleOffsetUs) {
|
||||
super(dataSource, dataSpec, format, trigger, startTimeUs, endTimeUs, nextChunkIndex);
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser;
|
||||
package com.google.android.exoplayer.chunk.parser;
|
||||
|
||||
import com.google.android.exoplayer.MediaFormat;
|
||||
import com.google.android.exoplayer.ParserException;
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser;
|
||||
package com.google.android.exoplayer.chunk.parser;
|
||||
|
||||
/**
|
||||
* Defines segments within a media stream.
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.mp4;
|
||||
package com.google.android.exoplayer.chunk.parser.mp4;
|
||||
|
||||
/* package */ final class DefaultSampleValues {
|
||||
|
@ -13,20 +13,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.mp4;
|
||||
package com.google.android.exoplayer.chunk.parser.mp4;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
import com.google.android.exoplayer.MediaFormat;
|
||||
import com.google.android.exoplayer.ParserException;
|
||||
import com.google.android.exoplayer.SampleHolder;
|
||||
import com.google.android.exoplayer.parser.Extractor;
|
||||
import com.google.android.exoplayer.parser.SegmentIndex;
|
||||
import com.google.android.exoplayer.parser.mp4.Atom.ContainerAtom;
|
||||
import com.google.android.exoplayer.parser.mp4.Atom.LeafAtom;
|
||||
import com.google.android.exoplayer.chunk.parser.Extractor;
|
||||
import com.google.android.exoplayer.chunk.parser.SegmentIndex;
|
||||
import com.google.android.exoplayer.mp4.Atom;
|
||||
import com.google.android.exoplayer.mp4.Atom.ContainerAtom;
|
||||
import com.google.android.exoplayer.mp4.Atom.LeafAtom;
|
||||
import com.google.android.exoplayer.mp4.Track;
|
||||
import com.google.android.exoplayer.upstream.NonBlockingInputStream;
|
||||
import com.google.android.exoplayer.util.Assertions;
|
||||
import com.google.android.exoplayer.util.CodecSpecificDataUtil;
|
||||
import com.google.android.exoplayer.util.MimeTypes;
|
||||
import com.google.android.exoplayer.util.ParsableByteArray;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.mp4;
|
||||
package com.google.android.exoplayer.chunk.parser.mp4;
|
||||
|
||||
/**
|
||||
* Encapsulates information parsed from a track encryption (tenc) box in an MP4 stream.
|
@ -13,9 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.mp4;
|
||||
package com.google.android.exoplayer.chunk.parser.mp4;
|
||||
|
||||
import com.google.android.exoplayer.upstream.NonBlockingInputStream;
|
||||
import com.google.android.exoplayer.util.ParsableByteArray;
|
||||
|
||||
/**
|
||||
* A holder for information corresponding to a single fragment of an mp4 file.
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.webm;
|
||||
package com.google.android.exoplayer.chunk.parser.webm;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
import com.google.android.exoplayer.ParserException;
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.webm;
|
||||
package com.google.android.exoplayer.chunk.parser.webm;
|
||||
|
||||
import com.google.android.exoplayer.ParserException;
|
||||
import com.google.android.exoplayer.upstream.NonBlockingInputStream;
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.webm;
|
||||
package com.google.android.exoplayer.chunk.parser.webm;
|
||||
|
||||
import com.google.android.exoplayer.ParserException;
|
||||
import com.google.android.exoplayer.upstream.NonBlockingInputStream;
|
@ -13,13 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.webm;
|
||||
package com.google.android.exoplayer.chunk.parser.webm;
|
||||
|
||||
import com.google.android.exoplayer.MediaFormat;
|
||||
import com.google.android.exoplayer.ParserException;
|
||||
import com.google.android.exoplayer.SampleHolder;
|
||||
import com.google.android.exoplayer.parser.Extractor;
|
||||
import com.google.android.exoplayer.parser.SegmentIndex;
|
||||
import com.google.android.exoplayer.chunk.parser.Extractor;
|
||||
import com.google.android.exoplayer.chunk.parser.SegmentIndex;
|
||||
import com.google.android.exoplayer.upstream.NonBlockingInputStream;
|
||||
import com.google.android.exoplayer.util.LongArray;
|
||||
import com.google.android.exoplayer.util.MimeTypes;
|
@ -23,22 +23,22 @@ import com.google.android.exoplayer.TrackRenderer;
|
||||
import com.google.android.exoplayer.chunk.Chunk;
|
||||
import com.google.android.exoplayer.chunk.ChunkOperationHolder;
|
||||
import com.google.android.exoplayer.chunk.ChunkSource;
|
||||
import com.google.android.exoplayer.chunk.ContainerMediaChunk;
|
||||
import com.google.android.exoplayer.chunk.Format;
|
||||
import com.google.android.exoplayer.chunk.Format.DecreasingBandwidthComparator;
|
||||
import com.google.android.exoplayer.chunk.FormatEvaluator;
|
||||
import com.google.android.exoplayer.chunk.FormatEvaluator.Evaluation;
|
||||
import com.google.android.exoplayer.chunk.MediaChunk;
|
||||
import com.google.android.exoplayer.chunk.Mp4MediaChunk;
|
||||
import com.google.android.exoplayer.chunk.SingleSampleMediaChunk;
|
||||
import com.google.android.exoplayer.chunk.parser.Extractor;
|
||||
import com.google.android.exoplayer.chunk.parser.mp4.FragmentedMp4Extractor;
|
||||
import com.google.android.exoplayer.chunk.parser.webm.WebmExtractor;
|
||||
import com.google.android.exoplayer.dash.mpd.AdaptationSet;
|
||||
import com.google.android.exoplayer.dash.mpd.ContentProtection;
|
||||
import com.google.android.exoplayer.dash.mpd.MediaPresentationDescription;
|
||||
import com.google.android.exoplayer.dash.mpd.Period;
|
||||
import com.google.android.exoplayer.dash.mpd.RangedUri;
|
||||
import com.google.android.exoplayer.dash.mpd.Representation;
|
||||
import com.google.android.exoplayer.parser.Extractor;
|
||||
import com.google.android.exoplayer.parser.mp4.FragmentedMp4Extractor;
|
||||
import com.google.android.exoplayer.parser.webm.WebmExtractor;
|
||||
import com.google.android.exoplayer.text.webvtt.WebvttParser;
|
||||
import com.google.android.exoplayer.upstream.DataSource;
|
||||
import com.google.android.exoplayer.upstream.DataSpec;
|
||||
@ -464,9 +464,9 @@ public class DashChunkSource implements ChunkSource {
|
||||
return new SingleSampleMediaChunk(dataSource, dataSpec, representation.format, 0,
|
||||
startTimeUs, endTimeUs, nextAbsoluteSegmentNum, null, representationHolder.vttHeader);
|
||||
} else {
|
||||
return new Mp4MediaChunk(dataSource, dataSpec, representation.format, trigger, startTimeUs,
|
||||
endTimeUs, nextAbsoluteSegmentNum, representationHolder.extractor, psshInfo, false,
|
||||
presentationTimeOffsetUs);
|
||||
return new ContainerMediaChunk(dataSource, dataSpec, representation.format, trigger,
|
||||
startTimeUs, endTimeUs, nextAbsoluteSegmentNum, representationHolder.extractor, psshInfo,
|
||||
false, presentationTimeOffsetUs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
*/
|
||||
package com.google.android.exoplayer.dash;
|
||||
|
||||
import com.google.android.exoplayer.chunk.parser.SegmentIndex;
|
||||
import com.google.android.exoplayer.dash.mpd.RangedUri;
|
||||
import com.google.android.exoplayer.parser.SegmentIndex;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
||||
import android.net.Uri;
|
||||
|
@ -13,11 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.mp4;
|
||||
package com.google.android.exoplayer.mp4;
|
||||
|
||||
import com.google.android.exoplayer.util.ParsableByteArray;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* package */ abstract class Atom {
|
||||
public abstract class Atom {
|
||||
|
||||
public static final int TYPE_avc1 = 0x61766331;
|
||||
public static final int TYPE_avc3 = 0x61766333;
|
||||
@ -66,7 +68,7 @@ import java.util.ArrayList;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public final static class LeafAtom extends Atom {
|
||||
public static final class LeafAtom extends Atom {
|
||||
|
||||
public final ParsableByteArray data;
|
||||
|
||||
@ -77,7 +79,7 @@ import java.util.ArrayList;
|
||||
|
||||
}
|
||||
|
||||
public final static class ContainerAtom extends Atom {
|
||||
public static final class ContainerAtom extends Atom {
|
||||
|
||||
public final ArrayList<Atom> children;
|
||||
public final int endByteOffset;
|
@ -13,9 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.mp4;
|
||||
package com.google.android.exoplayer.mp4;
|
||||
|
||||
import com.google.android.exoplayer.MediaFormat;
|
||||
import com.google.android.exoplayer.chunk.parser.mp4.TrackEncryptionBox;
|
||||
|
||||
/**
|
||||
* Encapsulates information describing an MP4 track.
|
@ -21,16 +21,16 @@ import com.google.android.exoplayer.TrackInfo;
|
||||
import com.google.android.exoplayer.chunk.Chunk;
|
||||
import com.google.android.exoplayer.chunk.ChunkOperationHolder;
|
||||
import com.google.android.exoplayer.chunk.ChunkSource;
|
||||
import com.google.android.exoplayer.chunk.ContainerMediaChunk;
|
||||
import com.google.android.exoplayer.chunk.Format;
|
||||
import com.google.android.exoplayer.chunk.Format.DecreasingBandwidthComparator;
|
||||
import com.google.android.exoplayer.chunk.FormatEvaluator;
|
||||
import com.google.android.exoplayer.chunk.FormatEvaluator.Evaluation;
|
||||
import com.google.android.exoplayer.chunk.MediaChunk;
|
||||
import com.google.android.exoplayer.chunk.Mp4MediaChunk;
|
||||
import com.google.android.exoplayer.parser.Extractor;
|
||||
import com.google.android.exoplayer.parser.mp4.FragmentedMp4Extractor;
|
||||
import com.google.android.exoplayer.parser.mp4.Track;
|
||||
import com.google.android.exoplayer.parser.mp4.TrackEncryptionBox;
|
||||
import com.google.android.exoplayer.chunk.parser.Extractor;
|
||||
import com.google.android.exoplayer.chunk.parser.mp4.FragmentedMp4Extractor;
|
||||
import com.google.android.exoplayer.chunk.parser.mp4.TrackEncryptionBox;
|
||||
import com.google.android.exoplayer.mp4.Track;
|
||||
import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.ProtectionElement;
|
||||
import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.StreamElement;
|
||||
import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifest.TrackElement;
|
||||
@ -373,7 +373,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
||||
DataSpec dataSpec = new DataSpec(uri, offset, -1, cacheKey);
|
||||
// In SmoothStreaming each chunk contains sample timestamps relative to the start of the chunk.
|
||||
// To convert them the absolute timestamps, we need to set sampleOffsetUs to -chunkStartTimeUs.
|
||||
return new Mp4MediaChunk(dataSource, dataSpec, formatInfo, trigger, chunkStartTimeUs,
|
||||
return new ContainerMediaChunk(dataSource, dataSpec, formatInfo, trigger, chunkStartTimeUs,
|
||||
nextStartTimeUs, nextChunkIndex, extractor, psshInfo, false, -chunkStartTimeUs);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ package com.google.android.exoplayer.text.eia608;
|
||||
import com.google.android.exoplayer.util.BitArray;
|
||||
import com.google.android.exoplayer.util.MimeTypes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -87,7 +86,7 @@ public class Eia608Parser {
|
||||
return mimeType.equals(MimeTypes.APPLICATION_EIA608);
|
||||
}
|
||||
|
||||
public List<ClosedCaption> parse(byte[] data, int size, long timeUs) throws IOException {
|
||||
public List<ClosedCaption> parse(byte[] data, int size, long timeUs) {
|
||||
if (size <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import com.google.android.exoplayer.upstream.cache.CacheDataSink.CacheDataSinkEx
|
||||
import com.google.android.exoplayer.util.Assertions;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -50,6 +51,8 @@ public final class CacheDataSource implements DataSource {
|
||||
|
||||
}
|
||||
|
||||
private static final String TAG = "CacheDataSource";
|
||||
|
||||
private final Cache cache;
|
||||
private final DataSource cacheReadDataSource;
|
||||
private final DataSource cacheWriteDataSource;
|
||||
@ -123,9 +126,6 @@ public final class CacheDataSource implements DataSource {
|
||||
@Override
|
||||
public long open(DataSpec dataSpec) throws IOException {
|
||||
Assertions.checkState(dataSpec.uriIsFullStream);
|
||||
// TODO: Support caching for unbounded requests. This requires storing the source length
|
||||
// into the cache (the simplest approach is to incorporate it into each cache file's name).
|
||||
Assertions.checkState(dataSpec.length != C.LENGTH_UNBOUNDED);
|
||||
try {
|
||||
uri = dataSpec.uri;
|
||||
key = dataSpec.key;
|
||||
@ -148,10 +148,12 @@ public final class CacheDataSource implements DataSource {
|
||||
totalCachedBytesRead += bytesRead;
|
||||
}
|
||||
readPosition += bytesRead;
|
||||
bytesRemaining -= bytesRead;
|
||||
if (bytesRemaining != C.LENGTH_UNBOUNDED) {
|
||||
bytesRemaining -= bytesRead;
|
||||
}
|
||||
} else {
|
||||
closeCurrentSource();
|
||||
if (bytesRemaining > 0) {
|
||||
if (bytesRemaining > 0 && bytesRemaining != C.LENGTH_UNBOUNDED) {
|
||||
openNextSource();
|
||||
return read(buffer, offset, max);
|
||||
}
|
||||
@ -185,6 +187,11 @@ public final class CacheDataSource implements DataSource {
|
||||
CacheSpan span;
|
||||
if (ignoreCache) {
|
||||
span = null;
|
||||
} else if (bytesRemaining == C.LENGTH_UNBOUNDED) {
|
||||
// TODO: Support caching for unbounded requests. This requires storing the source length
|
||||
// into the cache (the simplest approach is to incorporate it into each cache file's name).
|
||||
Log.w(TAG, "Cache bypassed due to unbounded length.");
|
||||
span = null;
|
||||
} else if (blockOnCache) {
|
||||
span = cache.startReadWrite(key, readPosition);
|
||||
} else {
|
||||
|
@ -13,9 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer.parser.mp4;
|
||||
|
||||
import com.google.android.exoplayer.util.Assertions;
|
||||
package com.google.android.exoplayer.util;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@ -23,7 +21,7 @@ import java.nio.ByteBuffer;
|
||||
* Wraps a byte array, providing a set of methods for parsing data from it. Numerical values are
|
||||
* parsed with the assumption that their constituent bytes are in big endian order.
|
||||
*/
|
||||
/* package */ final class ParsableByteArray {
|
||||
public final class ParsableByteArray {
|
||||
|
||||
public final byte[] data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user