Add tv module for USB tuner support + demo app

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168366847
This commit is contained in:
aquilescanta 2017-09-12 06:18:03 -07:00 committed by Oliver Woodman
parent 0adb4502f6
commit f257300d8e
6 changed files with 145 additions and 0 deletions

1
.gitignore vendored
View File

@ -39,6 +39,7 @@ proguard-project.txt
# Other
.DS_Store
cmake-build-debug
dist
tmp

4
demos/tv/README.md Normal file
View File

@ -0,0 +1,4 @@
# TV tuner demo application #
This folder contains a demo application that uses ExoPlayer to play broadcast
TV from USB tuners.

49
demos/tv/build.gradle Normal file
View File

@ -0,0 +1,49 @@
// Copyright (C) 2017 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.
apply from: '../../constants.gradle'
apply plugin: 'com.android.application'
android {
compileSdkVersion project.ext.compileSdkVersion
buildToolsVersion project.ext.buildToolsVersion
defaultConfig {
minSdkVersion 21
targetSdkVersion project.ext.targetSdkVersion
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
debug {
jniDebuggable = true
}
}
lintOptions {
// The demo app does not have translations.
disable 'MissingTranslation'
}
}
dependencies {
compile project(modulePrefix + 'library-core')
compile project(modulePrefix + 'library-ui')
compile project(modulePrefix + 'internal-extension-tv')
compile project(modulePrefix + 'extension-ffmpeg')
}

41
extensions/tv/README.md Normal file
View File

@ -0,0 +1,41 @@
# ExoPlayer TV tuner extension #
Provides components for broadcast TV playback with ExoPlayer.
## Links ##
* [Javadoc][]: Classes matching `com.google.android.exoplayer2.ext.tv.*`
belong to this extension.
[Javadoc]: https://google.github.io/ExoPlayer/doc/reference/index.html
## Build Instructions ##
* Checkout ExoPlayer:
```
git clone https://github.com/google/ExoPlayer.git
```
* Set the following environment variables:
```
cd "<path to exoplayer checkout>"
EXOPLAYER_ROOT="$(pwd)"
TV_MODULE_PATH="${EXOPLAYER_ROOT}/extensions/tv/src/main"
```
* Download the [Android NDK][] and set its location in an environment variable:
[Android NDK]: https://developer.android.com/tools/sdk/ndk/index.html
```
NDK_PATH="<path to Android NDK>"
```
* Build the JNI native libraries from the command line:
```
cd "${TV_MODULE_PATH}"/jni && \
${NDK_PATH}/ndk-build APP_ABI=all -j<N>
```

View File

@ -0,0 +1,39 @@
// Copyright (C) 2017 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.
apply from: '../../constants.gradle'
apply plugin: 'com.android.library'
android {
compileSdkVersion project.ext.compileSdkVersion
buildToolsVersion project.ext.buildToolsVersion
defaultConfig {
minSdkVersion 21
targetSdkVersion project.ext.targetSdkVersion
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] // Disable the automatic ndk-build call by Android Studio.
}
}
dependencies {
compile project(modulePrefix + 'library-core')
}
ext {
javadocTitle = 'TV tuner extension'
}
apply from: '../../javadoc_library.gradle'

View File

@ -62,6 +62,17 @@ public final class ParsableBitArray {
reset(data, data.length);
}
/**
* Sets this instance's data, position and limit to match the provided {@code parsableByteArray}.
* Any modifications to the underlying data array will be visible in both instances
*
* @param parsableByteArray The {@link ParsableByteArray}.
*/
public void reset(ParsableByteArray parsableByteArray) {
reset(parsableByteArray.data, parsableByteArray.limit());
setPosition(parsableByteArray.getPosition() * 8);
}
/**
* Updates the instance to wrap {@code data}, and resets the position to zero.
*