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
ef396933
authored
Jan 21, 2015
by
ojw28
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #255 from google/dev
dev -> dev-hls
parents
4158ede6
e246970a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
library/src/main/java/com/google/android/exoplayer/FrameworkSampleSource.java
library/src/main/java/com/google/android/exoplayer/FrameworkSampleSource.java
View file @
ef396933
...
...
@@ -23,6 +23,7 @@ import android.content.Context;
import
android.media.MediaExtractor
;
import
android.net.Uri
;
import
java.io.FileDescriptor
;
import
java.io.IOException
;
import
java.util.Map
;
import
java.util.UUID
;
...
...
@@ -39,10 +40,16 @@ public final class FrameworkSampleSource implements SampleSource {
private
static
final
int
TRACK_STATE_ENABLED
=
1
;
private
static
final
int
TRACK_STATE_FORMAT_SENT
=
2
;
// Parameters for a Uri data source.
private
final
Context
context
;
private
final
Uri
uri
;
private
final
Map
<
String
,
String
>
headers
;
// Parameters for a FileDescriptor data source.
private
final
FileDescriptor
fileDescriptor
;
private
final
long
fileDescriptorOffset
;
private
final
long
fileDescriptorLength
;
private
MediaExtractor
extractor
;
private
TrackInfo
[]
trackInfos
;
private
boolean
prepared
;
...
...
@@ -55,17 +62,41 @@ public final class FrameworkSampleSource implements SampleSource {
public
FrameworkSampleSource
(
Context
context
,
Uri
uri
,
Map
<
String
,
String
>
headers
,
int
downstreamRendererCount
)
{
Assertions
.
checkState
(
Util
.
SDK_INT
>=
16
);
this
.
remainingReleaseCount
=
downstreamRendererCount
;
this
.
context
=
context
;
this
.
uri
=
uri
;
this
.
headers
=
headers
;
this
.
fileDescriptor
=
null
;
this
.
fileDescriptorOffset
=
0
;
this
.
fileDescriptorLength
=
0
;
}
public
FrameworkSampleSource
(
FileDescriptor
fileDescriptor
,
long
offset
,
long
length
,
int
downstreamRendererCount
)
{
Assertions
.
checkState
(
Util
.
SDK_INT
>=
16
);
this
.
remainingReleaseCount
=
downstreamRendererCount
;
this
.
fileDescriptor
=
fileDescriptor
;
this
.
fileDescriptorOffset
=
offset
;
this
.
fileDescriptorLength
=
length
;
this
.
context
=
null
;
this
.
uri
=
null
;
this
.
headers
=
null
;
}
@Override
public
boolean
prepare
()
throws
IOException
{
if
(!
prepared
)
{
extractor
=
new
MediaExtractor
();
if
(
context
!=
null
)
{
extractor
.
setDataSource
(
context
,
uri
,
headers
);
}
else
{
extractor
.
setDataSource
(
fileDescriptor
,
fileDescriptorOffset
,
fileDescriptorLength
);
}
trackStates
=
new
int
[
extractor
.
getTrackCount
()];
pendingDiscontinuities
=
new
boolean
[
trackStates
.
length
];
trackInfos
=
new
TrackInfo
[
trackStates
.
length
];
...
...
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