Skip to content

Commit 2ee7207

Browse files
committed
Add datasource module
PiperOrigin-RevId: 404897119
1 parent 37b5847 commit 2ee7207

File tree

99 files changed

+142
-33
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+142
-33
lines changed

core_settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ project(modulePrefix + 'library-ui').projectDir = new File(rootDir, 'library/ui'
5151
include modulePrefix + 'extension-leanback'
5252
project(modulePrefix + 'extension-leanback').projectDir = new File(rootDir, 'extensions/leanback')
5353

54+
include modulePrefix + 'library-datasource'
55+
project(modulePrefix + 'library-datasource').projectDir = new File(rootDir, 'library/datasource')
5456
include modulePrefix + 'extension-cronet'
5557
project(modulePrefix + 'extension-cronet').projectDir = new File(rootDir, 'extensions/cronet')
5658
include modulePrefix + 'extension-rtmp'

extensions/cronet/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ android {
2222
dependencies {
2323
api "com.google.android.gms:play-services-cronet:17.0.1"
2424
implementation project(modulePrefix + 'library-common')
25+
implementation project(modulePrefix + 'library-datasource')
2526
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
2627
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
2728
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion

extensions/okhttp/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ android.defaultConfig.minSdkVersion 21
1717

1818
dependencies {
1919
implementation project(modulePrefix + 'library-common')
20+
implementation project(modulePrefix + 'library-datasource')
2021
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
2122
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
2223
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion

extensions/rtmp/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
1515

1616
dependencies {
1717
implementation project(modulePrefix + 'library-common')
18+
implementation project(modulePrefix + 'library-datasource')
1819
implementation 'net.butterflytv.utils:rtmp-client:3.1.0'
1920
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
2021
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion

library/all/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
1515

1616
dependencies {
1717
api project(modulePrefix + 'library-common')
18+
api project(modulePrefix + 'library-datasource')
1819
api project(modulePrefix + 'library-decoder')
1920
api project(modulePrefix + 'library-extractor')
2021
api project(modulePrefix + 'library-core')

library/common/build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,11 @@
1414
apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
1515

1616
android {
17-
defaultConfig {
18-
multiDexEnabled true
19-
}
20-
2117
buildTypes {
2218
debug {
2319
testCoverageEnabled = true
2420
}
2521
}
26-
27-
sourceSets {
28-
androidTest.assets.srcDir '../../testdata/src/test/assets/'
29-
}
3022
}
3123

3224
dependencies {
@@ -56,7 +48,6 @@ dependencies {
5648
testImplementation 'androidx.test.ext:junit:' + androidxTestJUnitVersion
5749
testImplementation 'junit:junit:' + junitVersion
5850
testImplementation 'com.google.truth:truth:' + truthVersion
59-
testImplementation 'com.squareup.okhttp3:mockwebserver:' + okhttpVersion
6051
testImplementation 'org.robolectric:robolectric:' + robolectricVersion
6152
testImplementation project(modulePrefix + 'library-core')
6253
testImplementation project(modulePrefix + 'testutils')

library/common/proguard-rules.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
# Proguard rules specific to the common module.
22

3-
# Constant folding for resource integers may mean that a resource passed to this method appears to be unused. Keep the method to prevent this from happening.
4-
-keepclassmembers class com.google.android.exoplayer2.upstream.RawResourceDataSource {
5-
public static android.net.Uri buildRawResourceUri(int);
6-
}
7-
8-
# Constructors accessed via reflection in DefaultDataSource
9-
-dontnote com.google.android.exoplayer2.ext.rtmp.RtmpDataSource
10-
-keepclassmembers class com.google.android.exoplayer2.ext.rtmp.RtmpDataSource {
11-
();
12-
}
13-
143
# Don't warn about checkerframework and Kotlin annotations
154
-dontwarn org.checkerframework.**
165
-dontwarn kotlin.annotations.jvm.**

library/core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ android {
3737
dependencies {
3838
api project(modulePrefix + 'library-common')
3939
// TODO(b/203754886): Revisit which modules are exported as API dependencies.
40+
api project(modulePrefix + 'library-datasource')
4041
api project(modulePrefix + 'library-decoder')
4142
api project(modulePrefix + 'library-extractor')
4243
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion

library/datasource/README.md

Lines changed: 12 additions & 0 deletions

library/datasource/build.gradle

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright (C) 2020 The Android Open Source Project
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
apply from: "$gradle.ext.exoplayerSettingsDir/common_library_config.gradle"
15+
16+
android {
17+
defaultConfig {
18+
multiDexEnabled true
19+
}
20+
21+
buildTypes {
22+
debug {
23+
testCoverageEnabled = true
24+
}
25+
}
26+
27+
sourceSets {
28+
androidTest.assets.srcDir '../../testdata/src/test/assets/'
29+
test.assets.srcDir '../../testdata/src/test/assets/'
30+
}
31+
}
32+
33+
dependencies {
34+
implementation project(modulePrefix + 'library-common')
35+
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
36+
compileOnly 'com.google.code.findbugs:jsr305:' + jsr305Version
37+
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
38+
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion
39+
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
40+
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
41+
androidTestImplementation 'androidx.test:runner:' + androidxTestRunnerVersion
42+
androidTestImplementation 'com.linkedin.dexmaker:dexmaker:' + dexmakerVersion
43+
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:' + dexmakerVersion
44+
androidTestImplementation(project(modulePrefix + 'testutils')) {
45+
exclude module: modulePrefix.substring(1) + 'library-core'
46+
}
47+
testImplementation 'org.mockito:mockito-core:' + mockitoVersion
48+
testImplementation 'androidx.test:core:' + androidxTestCoreVersion
49+
testImplementation 'androidx.test.ext:junit:' + androidxTestJUnitVersion
50+
testImplementation 'com.google.truth:truth:' + truthVersion
51+
testImplementation 'com.squareup.okhttp3:mockwebserver:' + okhttpVersion
52+
testImplementation 'org.robolectric:robolectric:' + robolectricVersion
53+
testImplementation project(modulePrefix + 'testutils')
54+
}
55+
56+
ext {
57+
javadocTitle = 'DataSource module'
58+
}
59+
apply from: '../../javadoc_library.gradle'
60+
61+
ext {
62+
releaseArtifactId = 'exoplayer-datasource'
63+
releaseDescription = 'The ExoPlayer library DataSource module.'
64+
}
65+
apply from: '../../publish.gradle'

library/datasource/proguard-rules.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Proguard rules specific to the DataSource module.
2+
3+
# Constant folding for resource integers may mean that a resource passed to this method appears to be unused. Keep the method to prevent this from happening.
4+
-keepclassmembers class com.google.android.exoplayer2.upstream.RawResourceDataSource {
5+
public static android.net.Uri buildRawResourceUri(int);
6+
}
7+
8+
# Constructors accessed via reflection in DefaultDataSource
9+
-dontnote com.google.android.exoplayer2.ext.rtmp.RtmpDataSource
10+
-keepclassmembers class com.google.android.exoplayer2.ext.rtmp.RtmpDataSource {
11+
();
12+
}

library/common/src/androidTest/AndroidManifest.xml renamed to library/datasource/src/androidTest/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
xml version="1.0" encoding="utf-8"?>
2-
library/common/src/androidTest/java/com/google/android/exoplayer2/upstream/ContentDataSourceContractTest.java renamed to library/datasource/src/androidTest/java/com/google/android/exoplayer2/upstream/ContentDataSourceContractTest.java
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import android.net.Uri;
2020
import androidx.test.core.app.ApplicationProvider;
2121
import androidx.test.ext.junit.runners.AndroidJUnit4;
22-
import com.google.android.exoplayer2.common.test.R;
2322
import com.google.android.exoplayer2.testutil.DataSourceContractTest;
23+
import com.google.android.exoplayer2.upstream.test.R;
2424
import com.google.android.exoplayer2.util.Util;
2525
import com.google.common.collect.ImmutableList;
2626
import org.junit.runner.RunWith;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
xml version="1.0" encoding="utf-8"?>
2+
16+
17+
<manifest package="com.google.android.exoplayer2.upstream">
18+
<uses-sdk/>
19+
manifest>
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.android.exoplayer2.upstream.crypto;
16+
package com.google.android.exoplayer2.upstream;
1717

1818
import static com.google.android.exoplayer2.util.Util.castNonNull;
1919
import static java.lang.Math.min;
2020

2121
import androidx.annotation.Nullable;
22-
import com.google.android.exoplayer2.upstream.DataSink;
23-
import com.google.android.exoplayer2.upstream.DataSpec;
2422
import java.io.IOException;
2523
import javax.crypto.Cipher;
2624

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,14 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.android.exoplayer2.upstream.crypto;
16+
package com.google.android.exoplayer2.upstream;
1717

1818
import static com.google.android.exoplayer2.util.Assertions.checkNotNull;
1919
import static com.google.android.exoplayer2.util.Util.castNonNull;
2020

2121
import android.net.Uri;
2222
import androidx.annotation.Nullable;
2323
import com.google.android.exoplayer2.C;
24-
import com.google.android.exoplayer2.upstream.DataSource;
25-
import com.google.android.exoplayer2.upstream.DataSpec;
26-
import com.google.android.exoplayer2.upstream.TransferListener;
2724
import java.io.IOException;
2825
import java.util.List;
2926
import java.util.Map;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.android.exoplayer2.upstream.crypto;
16+
package com.google.android.exoplayer2.upstream;
1717

1818
import androidx.annotation.Nullable;
1919
import com.google.android.exoplayer2.util.Assertions;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
xml version="1.0" encoding="utf-8"?>
2+
16+
17+
<manifest package="com.google.android.exoplayer2.upstream">
18+
<uses-sdk/>
19+
manifest>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.google.android.exoplayer2.upstream.crypto;
16+
package com.google.android.exoplayer2.upstream;
1717

1818
import static com.google.common.truth.Truth.assertThat;
1919
import static java.lang.Math.min;

0 commit comments

Comments
 (0)