diff --git a/RELEASENOTES.md b/RELEASENOTES.md index de78e1407c..99783b63e3 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -19,6 +19,9 @@ `Renderer` instead, except for `C.MSG_SET_SURFACE`, which is replaced with `Renderer.MSG_SET_VIDEO_OUTPUT`. * Remove `DeviceListener`. Use `Player.Listener` instead. + * Remove `CacheDataSourceFactory`. Use `CacheDataSource.Factory` instead. + * Remove `CacheDataSinkFactory`. Use `CacheDataSink.Factory` instead. + * Remove `FileDataSourceFactory`. Use `FileDataSource.Factory` instead. ### 2.15.0 (2021-08-10) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/FileDataSourceFactory.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/FileDataSourceFactory.java deleted file mode 100644 index 004a68fdaf..0000000000 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/FileDataSourceFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2016 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.exoplayer2.upstream; - -import androidx.annotation.Nullable; - -/** @deprecated Use {@link FileDataSource.Factory}. */ -@Deprecated -public final class FileDataSourceFactory implements DataSource.Factory { - - private final FileDataSource.Factory wrappedFactory; - - public FileDataSourceFactory() { - this(/* listener= */ null); - } - - public FileDataSourceFactory(@Nullable TransferListener listener) { - wrappedFactory = new FileDataSource.Factory().setListener(listener); - } - - @Override - public FileDataSource createDataSource() { - return wrappedFactory.createDataSource(); - } -} diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSinkFactory.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSinkFactory.java deleted file mode 100644 index effb5f213e..0000000000 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSinkFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2016 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.exoplayer2.upstream.cache; - -import com.google.android.exoplayer2.upstream.DataSink; - -/** @deprecated Use {@link CacheDataSink.Factory}. */ -@Deprecated -public final class CacheDataSinkFactory implements DataSink.Factory { - - private final Cache cache; - private final long fragmentSize; - private final int bufferSize; - - /** @see CacheDataSink#CacheDataSink(Cache, long) */ - public CacheDataSinkFactory(Cache cache, long fragmentSize) { - this(cache, fragmentSize, CacheDataSink.DEFAULT_BUFFER_SIZE); - } - - /** @see CacheDataSink#CacheDataSink(Cache, long, int) */ - public CacheDataSinkFactory(Cache cache, long fragmentSize, int bufferSize) { - this.cache = cache; - this.fragmentSize = fragmentSize; - this.bufferSize = bufferSize; - } - - @Override - public DataSink createDataSink() { - return new CacheDataSink(cache, fragmentSize, bufferSize); - } -} diff --git a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceFactory.java b/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceFactory.java deleted file mode 100644 index 0f6159e349..0000000000 --- a/library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSourceFactory.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2016 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.exoplayer2.upstream.cache; - -import androidx.annotation.Nullable; -import com.google.android.exoplayer2.upstream.DataSink; -import com.google.android.exoplayer2.upstream.DataSource; -import com.google.android.exoplayer2.upstream.FileDataSource; - -/** @deprecated Use {@link CacheDataSource.Factory}. */ -@Deprecated -public final class CacheDataSourceFactory implements DataSource.Factory { - - private final Cache cache; - private final DataSource.Factory upstreamFactory; - private final DataSource.Factory cacheReadDataSourceFactory; - @CacheDataSource.Flags private final int flags; - @Nullable private final DataSink.Factory cacheWriteDataSinkFactory; - @Nullable private final CacheDataSource.EventListener eventListener; - @Nullable private final CacheKeyFactory cacheKeyFactory; - - /** - * Constructs a factory which creates {@link CacheDataSource} instances with default {@link - * DataSource} and {@link DataSink} instances for reading and writing the cache. - * - * @param cache The cache. - * @param upstreamFactory A {@link DataSource.Factory} for creating upstream {@link DataSource}s - * for reading data not in the cache. - */ - public CacheDataSourceFactory(Cache cache, DataSource.Factory upstreamFactory) { - this(cache, upstreamFactory, /* flags= */ 0); - } - - /** @see CacheDataSource#CacheDataSource(Cache, DataSource, int) */ - public CacheDataSourceFactory( - Cache cache, DataSource.Factory upstreamFactory, @CacheDataSource.Flags int flags) { - this( - cache, - upstreamFactory, - new FileDataSource.Factory(), - new CacheDataSink.Factory().setCache(cache), - flags, - /* eventListener= */ null); - } - - /** - * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, - * CacheDataSource.EventListener) - */ - public CacheDataSourceFactory( - Cache cache, - DataSource.Factory upstreamFactory, - DataSource.Factory cacheReadDataSourceFactory, - @Nullable DataSink.Factory cacheWriteDataSinkFactory, - @CacheDataSource.Flags int flags, - @Nullable CacheDataSource.EventListener eventListener) { - this( - cache, - upstreamFactory, - cacheReadDataSourceFactory, - cacheWriteDataSinkFactory, - flags, - eventListener, - /* cacheKeyFactory= */ null); - } - - /** - * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, - * CacheDataSource.EventListener, CacheKeyFactory) - */ - public CacheDataSourceFactory( - Cache cache, - DataSource.Factory upstreamFactory, - DataSource.Factory cacheReadDataSourceFactory, - @Nullable DataSink.Factory cacheWriteDataSinkFactory, - @CacheDataSource.Flags int flags, - @Nullable CacheDataSource.EventListener eventListener, - @Nullable CacheKeyFactory cacheKeyFactory) { - this.cache = cache; - this.upstreamFactory = upstreamFactory; - this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; - this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; - this.flags = flags; - this.eventListener = eventListener; - this.cacheKeyFactory = cacheKeyFactory; - } - - @Override - public CacheDataSource createDataSource() { - return new CacheDataSource( - cache, - upstreamFactory.createDataSource(), - cacheReadDataSourceFactory.createDataSource(), - cacheWriteDataSinkFactory == null ? null : cacheWriteDataSinkFactory.createDataSink(), - flags, - eventListener, - cacheKeyFactory); - } -}