Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
68f2dc59
authored
Sep 10, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove MultiTrackChunkSource (multi track now supported directly).
parent
e6ca2df5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
140 deletions
library/src/main/java/com/google/android/exoplayer/chunk/MultiTrackChunkSource.java
library/src/main/java/com/google/android/exoplayer/chunk/MultiTrackChunkSource.java
deleted
100644 → 0
View file @
e6ca2df5
/*
* Copyright (C) 2014 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
.
exoplayer
.
chunk
;
import
com.google.android.exoplayer.ExoPlaybackException
;
import
com.google.android.exoplayer.ExoPlayer.ExoPlayerComponent
;
import
com.google.android.exoplayer.MediaFormat
;
import
com.google.android.exoplayer.dash.DashChunkSource
;
import
com.google.android.exoplayer.smoothstreaming.SmoothStreamingChunkSource
;
import
com.google.android.exoplayer.util.Assertions
;
import
java.io.IOException
;
import
java.util.List
;
/**
* A {@link ChunkSource} providing the ability to switch between multiple other {@link ChunkSource}
* instances.
*
* @deprecated {@link DashChunkSource} and {@link SmoothStreamingChunkSource} both support multiple
* tracks directly, so use of this class should not be required. It will be deleted once legacy
* uses have been removed.
*/
@Deprecated
public
final
class
MultiTrackChunkSource
implements
ChunkSource
,
ExoPlayerComponent
{
/**
* A message to indicate a source selection. Source selection can only be performed when the
* source is disabled.
*/
public
static
final
int
MSG_SELECT_TRACK
=
1
;
private
final
ChunkSource
[]
allSources
;
private
ChunkSource
selectedSource
;
private
boolean
enabled
;
public
MultiTrackChunkSource
(
ChunkSource
...
sources
)
{
this
.
allSources
=
sources
;
this
.
selectedSource
=
sources
[
0
];
}
public
MultiTrackChunkSource
(
List
<
ChunkSource
>
sources
)
{
this
(
toChunkSourceArray
(
sources
));
}
/**
* Gets the number of tracks that this source can switch between. May be called safely from any
* thread.
*
* @return The number of tracks.
*/
public
int
getMultiTrackCount
()
{
return
allSources
.
length
;
}
@Override
public
boolean
prepare
()
{
boolean
prepared
=
true
;
for
(
int
i
=
0
;
i
<
allSources
.
length
;
i
++)
{
prepared
&=
allSources
[
i
].
prepare
();
}
return
prepared
;
}
@Override
public
int
getTrackCount
()
{
return
selectedSource
.
getTrackCount
();
}
@Override
public
MediaFormat
getFormat
(
int
track
)
{
return
selectedSource
.
getFormat
(
track
);
}
@Override
public
void
enable
(
int
track
)
{
selectedSource
.
enable
(
track
);
enabled
=
true
;
}
@Override
public
void
disable
(
List
<?
extends
MediaChunk
>
queue
)
{
selectedSource
.
disable
(
queue
);
enabled
=
false
;
}
@Override
public
void
continueBuffering
(
long
playbackPositionUs
)
{
selectedSource
.
continueBuffering
(
playbackPositionUs
);
}
@Override
public
void
getChunkOperation
(
List
<?
extends
MediaChunk
>
queue
,
long
seekPositionUs
,
long
playbackPositionUs
,
ChunkOperationHolder
out
)
{
selectedSource
.
getChunkOperation
(
queue
,
seekPositionUs
,
playbackPositionUs
,
out
);
}
@Override
public
void
maybeThrowError
()
throws
IOException
{
selectedSource
.
maybeThrowError
();
}
@Override
public
void
handleMessage
(
int
what
,
Object
msg
)
throws
ExoPlaybackException
{
Assertions
.
checkState
(!
enabled
);
if
(
what
==
MSG_SELECT_TRACK
)
{
selectedSource
=
allSources
[(
Integer
)
msg
];
}
}
@Override
public
void
onChunkLoadCompleted
(
Chunk
chunk
)
{
selectedSource
.
onChunkLoadCompleted
(
chunk
);
}
@Override
public
void
onChunkLoadError
(
Chunk
chunk
,
Exception
e
)
{
selectedSource
.
onChunkLoadError
(
chunk
,
e
);
}
private
static
ChunkSource
[]
toChunkSourceArray
(
List
<
ChunkSource
>
sources
)
{
ChunkSource
[]
chunkSourceArray
=
new
ChunkSource
[
sources
.
size
()];
sources
.
toArray
(
chunkSourceArray
);
return
chunkSourceArray
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment