Remove some deprecated source/sink classes

PiperOrigin-RevId: 389879570
This commit is contained in:
olly 2021-08-10 15:31:49 +01:00 committed by Christos Tsilopoulos
parent 31a839c848
commit f5d8c211f5
4 changed files with 3 additions and 194 deletions

View File

@ -19,6 +19,9 @@
`Renderer` instead, except for `C.MSG_SET_SURFACE`, which is replaced `Renderer` instead, except for `C.MSG_SET_SURFACE`, which is replaced
with `Renderer.MSG_SET_VIDEO_OUTPUT`. with `Renderer.MSG_SET_VIDEO_OUTPUT`.
* Remove `DeviceListener`. Use `Player.Listener` instead. * 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) ### 2.15.0 (2021-08-10)

View File

@ -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();
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}