Skip to content

Commit

Permalink
Merge pull request #29 from google/dev
Browse files Browse the repository at this point in the history
Merge 1.0.12 to master
  • Loading branch information
ojw28 committed Aug 14, 2014
2 parents 553a1d2 + cc04fd1 commit 79c2f53
Show file tree
Hide file tree
Showing 57 changed files with 1,085 additions and 732 deletions.
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Android generated
bin
gen
lint.xml

# IntelliJ IDEA
.idea
*.iml
*.ipr
*.iws
classes
gen-external-apklibs

# Eclipse
.project
.classpath
.settings
.checkstyle

# Gradle
.gradle
build
out

# Maven
target
release.properties
pom.xml.*

# Ant
ant.properties
local.properties
proguard.cfg
proguard-project.txt

# Other
.DS_Store
dist
tmp
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ accompanying demo application. To get started:

## Using Gradle ##

ExoPlayer can also be built using Gradle. For a complete list of tasks, run:
ExoPlayer can also be built using Gradle. You can include it as a dependent project and build from source. e.g.

./gradlew tasks
```
// setting.gradle
include ':app', ':..:ExoPlayer:library'
// app/build.gradle
dependencies {
compile project(':..:ExoPlayer:library')
}
```

If you want to use ExoPlayer as a jar, run:

```
./gradlew jarRelease
```

and copy library.jar to the libs-folder of your new project.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.10.+'
classpath 'com.android.tools.build:gradle:0.12.+'
}
}

Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.exoplayer.demo"
android:versionCode="1010"
android:versionName="1.0.10"
android:versionCode="1012"
android:versionName="1.0.12"
android:theme="@style/RootTheme">

<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public void onVideoSizeChanged(int width, int height) {
// DemoPlayer.InfoListener

@Override
public void onBandwidthSample(int elapsedMs, long bytes, long bandwidthEstimate) {
public void onBandwidthSample(int elapsedMs, long bytes, long bitrateEstimate) {
Log.d(TAG, "bandwidth [" + getSessionTimeString() + ", " + bytes +
", " + getTimeString(elapsedMs) + ", " + bandwidthEstimate + "]");
", " + getTimeString(elapsedMs) + ", " + bitrateEstimate + "]");
}

@Override
Expand All @@ -92,7 +92,7 @@ public void onDroppedFrames(int count, long elapsed) {

@Override
public void onLoadStarted(int sourceId, String formatId, int trigger, boolean isInitialization,
int mediaStartTimeMs, int mediaEndTimeMs, long totalBytes) {
int mediaStartTimeMs, int mediaEndTimeMs, long length) {
loadStartTimeMs[sourceId] = SystemClock.elapsedRealtime();
if (VerboseLogUtil.isTagEnabled(TAG)) {
Log.v(TAG, "loadStart [" + getSessionTimeString() + ", " + sourceId
Expand All @@ -101,7 +101,7 @@ public void onLoadStarted(int sourceId, String formatId, int trigger, boolean is
}

@Override
public void onLoadCompleted(int sourceId) {
public void onLoadCompleted(int sourceId, long bytesLoaded) {
if (VerboseLogUtil.isTagEnabled(TAG)) {
long downloadTime = SystemClock.elapsedRealtime() - loadStartTimeMs[sourceId];
Log.v(TAG, "loadEnd [" + getSessionTimeString() + ", " + sourceId + ", " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ protected long getCurrentPositionUs() {

@Override
protected long getDurationUs() {
return TrackRenderer.MATCH_LONGEST;
return TrackRenderer.MATCH_LONGEST_US;
}

@Override
protected long getBufferedPositionUs() {
return TrackRenderer.END_OF_TRACK;
return TrackRenderer.END_OF_TRACK_US;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ public interface InfoListener {
void onVideoFormatEnabled(String formatId, int trigger, int mediaTimeMs);
void onAudioFormatEnabled(String formatId, int trigger, int mediaTimeMs);
void onDroppedFrames(int count, long elapsed);
void onBandwidthSample(int elapsedMs, long bytes, long bandwidthEstimate);
void onBandwidthSample(int elapsedMs, long bytes, long bitrateEstimate);
void onLoadStarted(int sourceId, String formatId, int trigger, boolean isInitialization,
int mediaStartTimeMs, int mediaEndTimeMs, long totalBytes);
void onLoadCompleted(int sourceId);
int mediaStartTimeMs, int mediaEndTimeMs, long length);
void onLoadCompleted(int sourceId, long bytesLoaded);
}

/**
Expand Down Expand Up @@ -391,9 +391,9 @@ public void onDroppedFrames(int count, long elapsed) {
}

@Override
public void onBandwidthSample(int elapsedMs, long bytes, long bandwidthEstimate) {
public void onBandwidthSample(int elapsedMs, long bytes, long bitrateEstimate) {
if (infoListener != null) {
infoListener.onBandwidthSample(elapsedMs, bytes, bandwidthEstimate);
infoListener.onBandwidthSample(elapsedMs, bytes, bitrateEstimate);
}
}

Expand Down Expand Up @@ -471,34 +471,34 @@ public void onDrawnToSurface(Surface surface) {

@Override
public void onLoadStarted(int sourceId, String formatId, int trigger, boolean isInitialization,
int mediaStartTimeMs, int mediaEndTimeMs, long totalBytes) {
int mediaStartTimeMs, int mediaEndTimeMs, long length) {
if (infoListener != null) {
infoListener.onLoadStarted(sourceId, formatId, trigger, isInitialization, mediaStartTimeMs,
mediaEndTimeMs, totalBytes);
mediaEndTimeMs, length);
}
}

@Override
public void onLoadCompleted(int sourceId) {
public void onLoadCompleted(int sourceId, long bytesLoaded) {
if (infoListener != null) {
infoListener.onLoadCompleted(sourceId);
infoListener.onLoadCompleted(sourceId, bytesLoaded);
}
}

@Override
public void onLoadCanceled(int sourceId) {
public void onLoadCanceled(int sourceId, long bytesLoaded) {
// Do nothing.
}

@Override
public void onUpstreamDiscarded(int sourceId, int mediaStartTimeMs, int mediaEndTimeMs,
long totalBytes) {
long bytesDiscarded) {
// Do nothing.
}

@Override
public void onDownstreamDiscarded(int sourceId, int mediaStartTimeMs, int mediaEndTimeMs,
long totalBytes) {
long bytesDiscarded) {
// Do nothing.
}

Expand Down
11 changes: 11 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,14 @@ android {

dependencies {
}

android.libraryVariants.all { variant ->
def name = variant.buildType.name
if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) {
return; // Skip debug builds.
}
def task = project.tasks.create "jar${name.capitalize()}", Jar
task.dependsOn variant.javaCompile
task.from variant.javaCompile.destinationDir
artifacts.add('archives', task);
}
30 changes: 30 additions & 0 deletions library/src/main/java/com/google/android/exoplayer/C.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer;

/**
* Defines constants that are generally useful throughout the library.
*/
public final class C {

/**
* Represents an unbounded length of data.
*/
public static final int LENGTH_UNBOUNDED = -1;

private C() {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,54 +17,41 @@

/**
* Maintains codec event counts, for debugging purposes only.
* <p>
* Counters should be written from the playback thread only. Counters may be read from any thread.
* To ensure that the counter values are correctly reflected between threads, users of this class
* should invoke {@link #ensureUpdated()} prior to reading and after writing.
*/
public final class CodecCounters {

public volatile long codecInitCount;
public volatile long codecReleaseCount;
public volatile long outputFormatChangedCount;
public volatile long outputBuffersChangedCount;
public volatile long queuedInputBufferCount;
public volatile long inputBufferWaitingForSampleCount;
public volatile long keyframeCount;
public volatile long queuedEndOfStreamCount;
public volatile long renderedOutputBufferCount;
public volatile long skippedOutputBufferCount;
public volatile long droppedOutputBufferCount;
public volatile long discardedSamplesCount;
public int codecInitCount;
public int codecReleaseCount;
public int outputFormatChangedCount;
public int outputBuffersChangedCount;
public int renderedOutputBufferCount;
public int skippedOutputBufferCount;
public int droppedOutputBufferCount;

/**
* Resets all counts to zero.
* Should be invoked from the playback thread after the counters have been updated. Should also
* be invoked from any other thread that wishes to read the counters, before reading. These calls
* ensure that counter updates are made visible to the reading threads.
*/
public void zeroAllCounts() {
codecInitCount = 0;
codecReleaseCount = 0;
outputFormatChangedCount = 0;
outputBuffersChangedCount = 0;
queuedInputBufferCount = 0;
inputBufferWaitingForSampleCount = 0;
keyframeCount = 0;
queuedEndOfStreamCount = 0;
renderedOutputBufferCount = 0;
skippedOutputBufferCount = 0;
droppedOutputBufferCount = 0;
discardedSamplesCount = 0;
public synchronized void ensureUpdated() {
// Do nothing. The use of synchronized ensures a memory barrier should another thread also
// call this method.
}

public String getDebugString() {
ensureUpdated();
StringBuilder builder = new StringBuilder();
builder.append("cic(").append(codecInitCount).append(")");
builder.append("crc(").append(codecReleaseCount).append(")");
builder.append("ofc(").append(outputFormatChangedCount).append(")");
builder.append("obc(").append(outputBuffersChangedCount).append(")");
builder.append("qib(").append(queuedInputBufferCount).append(")");
builder.append("wib(").append(inputBufferWaitingForSampleCount).append(")");
builder.append("kfc(").append(keyframeCount).append(")");
builder.append("qes(").append(queuedEndOfStreamCount).append(")");
builder.append("ren(").append(renderedOutputBufferCount).append(")");
builder.append("sob(").append(skippedOutputBufferCount).append(")");
builder.append("dob(").append(droppedOutputBufferCount).append(")");
builder.append("dsc(").append(discardedSamplesCount).append(")");
return builder.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,16 @@ public interface ExoPlayerComponent {
public void seekTo(int positionMs);

/**
* Stops playback.
* Stops playback. Use {@code setPlayWhenReady(false)} rather than this method if the intention
* is to pause playback.
* <p>
* Calling this method will cause the playback state to transition to
* {@link ExoPlayer#STATE_IDLE}. Note that the player instance can still be used, and that
* {@link ExoPlayer#release()} must still be called on the player should it no longer be required.
* {@link ExoPlayer#STATE_IDLE}. The player instance can still be used, and
* {@link ExoPlayer#release()} must still be called on the player if it's no longer required.
* <p>
* Use {@code setPlayWhenReady(false)} rather than this method if the intention is to pause
* playback.
* Calling this method does not reset the playback position. If this player instance will be used
* to play another video from its start, then {@code seekTo(0)} should be called after stopping
* the player and before preparing it for the next video.
*/
public void stop();

Expand Down
Loading

0 comments on commit 79c2f53

Please sign in to comment.