Merge branch 'dev' of persistent-https://github.com/google/ExoPlayer into dev
This commit is contained in:
commit
0f57a5f1cf
39
.gitignore
vendored
Normal file
39
.gitignore
vendored
Normal file
@ -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
README.md
20
README.md
@ -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.
|
||||
|
@ -19,7 +19,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.10.+'
|
||||
classpath 'com.android.tools.build:gradle:0.12.+'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -280,14 +280,20 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
|
||||
|
||||
@Override
|
||||
protected void onDisabled() {
|
||||
releaseCodec();
|
||||
format = null;
|
||||
drmInitData = null;
|
||||
if (openedDrmSession) {
|
||||
drmSessionManager.close();
|
||||
openedDrmSession = false;
|
||||
try {
|
||||
releaseCodec();
|
||||
} finally {
|
||||
try {
|
||||
if (openedDrmSession) {
|
||||
drmSessionManager.close();
|
||||
openedDrmSession = false;
|
||||
}
|
||||
} finally {
|
||||
source.disable(trackIndex);
|
||||
}
|
||||
}
|
||||
source.disable(trackIndex);
|
||||
}
|
||||
|
||||
protected void releaseCodec() {
|
||||
|
@ -71,6 +71,14 @@ public class Format {
|
||||
*/
|
||||
public final int bitrate;
|
||||
|
||||
/**
|
||||
* The language of the format. Can be null if unknown.
|
||||
* <p>
|
||||
* The language codes are two-letter lowercase ISO language codes (such as "en") as defined by
|
||||
* ISO 639-1.
|
||||
*/
|
||||
public final String language;
|
||||
|
||||
/**
|
||||
* The average bandwidth in bytes per second.
|
||||
*
|
||||
@ -90,6 +98,21 @@ public class Format {
|
||||
*/
|
||||
public Format(String id, String mimeType, int width, int height, int numChannels,
|
||||
int audioSamplingRate, int bitrate) {
|
||||
this(id, mimeType, width, height, numChannels, audioSamplingRate, bitrate, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id The format identifier.
|
||||
* @param mimeType The format mime type.
|
||||
* @param width The width of the video in pixels, or -1 for non-video formats.
|
||||
* @param height The height of the video in pixels, or -1 for non-video formats.
|
||||
* @param numChannels The number of audio channels, or -1 for non-audio formats.
|
||||
* @param audioSamplingRate The audio sampling rate in Hz, or -1 for non-audio formats.
|
||||
* @param bitrate The average bandwidth of the format in bits per second.
|
||||
* @param language The language of the format.
|
||||
*/
|
||||
public Format(String id, String mimeType, int width, int height, int numChannels,
|
||||
int audioSamplingRate, int bitrate, String language) {
|
||||
this.id = Assertions.checkNotNull(id);
|
||||
this.mimeType = mimeType;
|
||||
this.width = width;
|
||||
@ -97,6 +120,7 @@ public class Format {
|
||||
this.numChannels = numChannels;
|
||||
this.audioSamplingRate = audioSamplingRate;
|
||||
this.bitrate = bitrate;
|
||||
this.language = language;
|
||||
this.bandwidth = bitrate / 8;
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler {
|
||||
throws XmlPullParserException, IOException {
|
||||
|
||||
String mimeType = xpp.getAttributeValue(null, "mimeType");
|
||||
String language = xpp.getAttributeValue(null, "lang");
|
||||
int contentType = parseAdaptationSetTypeFromMimeType(mimeType);
|
||||
|
||||
int id = -1;
|
||||
@ -160,7 +161,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler {
|
||||
parseAdaptationSetType(xpp.getAttributeValue(null, "contentType")));
|
||||
} else if (isStartTag(xpp, "Representation")) {
|
||||
Representation representation = parseRepresentation(xpp, contentId, baseUrl, periodStartMs,
|
||||
periodDurationMs, mimeType, segmentBase);
|
||||
periodDurationMs, mimeType, language, segmentBase);
|
||||
contentType = checkAdaptationSetTypeConsistency(contentType,
|
||||
parseAdaptationSetTypeFromMimeType(representation.format.mimeType));
|
||||
representations.add(representation);
|
||||
@ -230,8 +231,8 @@ public class MediaPresentationDescriptionParser extends DefaultHandler {
|
||||
// Representation parsing.
|
||||
|
||||
private Representation parseRepresentation(XmlPullParser xpp, String contentId, Uri baseUrl,
|
||||
long periodStartMs, long periodDurationMs, String mimeType, SegmentBase segmentBase)
|
||||
throws XmlPullParserException, IOException {
|
||||
long periodStartMs, long periodDurationMs, String mimeType, String language,
|
||||
SegmentBase segmentBase) throws XmlPullParserException, IOException {
|
||||
String id = xpp.getAttributeValue(null, "id");
|
||||
int bandwidth = parseInt(xpp, "bandwidth");
|
||||
int audioSamplingRate = parseInt(xpp, "audioSamplingRate");
|
||||
@ -257,7 +258,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler {
|
||||
} while (!isEndTag(xpp, "Representation"));
|
||||
|
||||
Format format = new Format(id, mimeType, width, height, numChannels, audioSamplingRate,
|
||||
bandwidth);
|
||||
bandwidth, language);
|
||||
return Representation.newInstance(periodStartMs, periodDurationMs, contentId, -1, format,
|
||||
segmentBase);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user