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
dd2921f9
authored
Oct 28, 2014
by
ojw28
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #97 from google/dev
dev
parents
1057a458
552db2fa
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
25 deletions
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DashVodRendererBuilder.java
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DemoPlayer.java
demo/src/main/java/com/google/android/exoplayer/demo/full/player/SmoothStreamingRendererBuilder.java
demo/src/main/java/com/google/android/exoplayer/demo/simple/DashVodRendererBuilder.java
demo/src/main/java/com/google/android/exoplayer/demo/simple/SmoothStreamingRendererBuilder.java
library/src/main/java/com/google/android/exoplayer/upstream/UriDataSource.java
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DashVodRendererBuilder.java
View file @
dd2921f9
...
...
@@ -43,7 +43,7 @@ import com.google.android.exoplayer.drm.StreamingDrmSessionManager;
import
com.google.android.exoplayer.upstream.BufferPool
;
import
com.google.android.exoplayer.upstream.DataSource
;
import
com.google.android.exoplayer.upstream.DefaultBandwidthMeter
;
import
com.google.android.exoplayer.upstream.
Http
DataSource
;
import
com.google.android.exoplayer.upstream.
Uri
DataSource
;
import
com.google.android.exoplayer.util.ManifestFetcher
;
import
com.google.android.exoplayer.util.ManifestFetcher.ManifestCallback
;
import
com.google.android.exoplayer.util.MimeTypes
;
...
...
@@ -162,7 +162,7 @@ public class DashVodRendererBuilder implements RendererBuilder,
}
// Build the video renderer.
DataSource
videoDataSource
=
new
HttpDataSource
(
userAgent
,
null
,
bandwidthMeter
);
DataSource
videoDataSource
=
new
UriDataSource
(
userAgent
,
bandwidthMeter
);
ChunkSource
videoChunkSource
;
String
mimeType
=
videoRepresentations
[
0
].
format
.
mimeType
;
if
(
mimeType
.
equals
(
MimeTypes
.
VIDEO_MP4
)
||
mimeType
.
equals
(
MimeTypes
.
VIDEO_WEBM
))
{
...
...
@@ -187,7 +187,7 @@ public class DashVodRendererBuilder implements RendererBuilder,
audioChunkSource
=
null
;
audioRenderer
=
null
;
}
else
{
DataSource
audioDataSource
=
new
HttpDataSource
(
userAgent
,
null
,
bandwidthMeter
);
DataSource
audioDataSource
=
new
UriDataSource
(
userAgent
,
bandwidthMeter
);
audioTrackNames
=
new
String
[
audioRepresentationsList
.
size
()];
ChunkSource
[]
audioChunkSources
=
new
ChunkSource
[
audioRepresentationsList
.
size
()];
FormatEvaluator
audioEvaluator
=
new
FormatEvaluator
.
FixedEvaluator
();
...
...
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DemoPlayer.java
View file @
dd2921f9
...
...
@@ -131,7 +131,7 @@ public class DemoPlayer implements ExoPlayer.Listener, ChunkSampleSource.EventLi
* A listener for receiving notifications of timed text.
*/
public
interface
TextListener
{
public
abstract
void
onText
(
String
text
);
void
onText
(
String
text
);
}
// Constants pulled into this class for convenience.
...
...
@@ -287,7 +287,6 @@ public class DemoPlayer implements ExoPlayer.Listener, ChunkSampleSource.EventLi
this
.
trackNames
=
trackNames
;
this
.
multiTrackSources
=
multiTrackSources
;
rendererBuildingState
=
RENDERER_BUILDING_STATE_BUILT
;
maybeReportPlayerState
();
pushSurfaceAndVideoTrack
(
false
);
pushTrackSelection
(
TYPE_AUDIO
,
true
);
pushTrackSelection
(
TYPE_TEXT
,
true
);
...
...
demo/src/main/java/com/google/android/exoplayer/demo/full/player/SmoothStreamingRendererBuilder.java
View file @
dd2921f9
...
...
@@ -41,7 +41,7 @@ import com.google.android.exoplayer.text.ttml.TtmlParser;
import
com.google.android.exoplayer.upstream.BufferPool
;
import
com.google.android.exoplayer.upstream.DataSource
;
import
com.google.android.exoplayer.upstream.DefaultBandwidthMeter
;
import
com.google.android.exoplayer.upstream.
Http
DataSource
;
import
com.google.android.exoplayer.upstream.
Uri
DataSource
;
import
com.google.android.exoplayer.util.ManifestFetcher
;
import
com.google.android.exoplayer.util.Util
;
...
...
@@ -155,7 +155,7 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder,
}
// Build the video renderer.
DataSource
videoDataSource
=
new
HttpDataSource
(
userAgent
,
null
,
bandwidthMeter
);
DataSource
videoDataSource
=
new
UriDataSource
(
userAgent
,
bandwidthMeter
);
ChunkSource
videoChunkSource
=
new
SmoothStreamingChunkSource
(
manifestFetcher
,
videoStreamElementIndex
,
videoTrackIndices
,
videoDataSource
,
new
AdaptiveEvaluator
(
bandwidthMeter
),
LIVE_EDGE_LATENCY_MS
);
...
...
@@ -177,7 +177,7 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder,
}
else
{
audioTrackNames
=
new
String
[
audioStreamElementCount
];
ChunkSource
[]
audioChunkSources
=
new
ChunkSource
[
audioStreamElementCount
];
DataSource
audioDataSource
=
new
HttpDataSource
(
userAgent
,
null
,
bandwidthMeter
);
DataSource
audioDataSource
=
new
UriDataSource
(
userAgent
,
bandwidthMeter
);
FormatEvaluator
audioFormatEvaluator
=
new
FormatEvaluator
.
FixedEvaluator
();
audioStreamElementCount
=
0
;
for
(
int
i
=
0
;
i
<
manifest
.
streamElements
.
length
;
i
++)
{
...
...
@@ -208,7 +208,7 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder,
}
else
{
textTrackNames
=
new
String
[
textStreamElementCount
];
ChunkSource
[]
textChunkSources
=
new
ChunkSource
[
textStreamElementCount
];
DataSource
ttmlDataSource
=
new
HttpDataSource
(
userAgent
,
null
,
bandwidthMeter
);
DataSource
ttmlDataSource
=
new
UriDataSource
(
userAgent
,
bandwidthMeter
);
FormatEvaluator
ttmlFormatEvaluator
=
new
FormatEvaluator
.
FixedEvaluator
();
textStreamElementCount
=
0
;
for
(
int
i
=
0
;
i
<
manifest
.
streamElements
.
length
;
i
++)
{
...
...
demo/src/main/java/com/google/android/exoplayer/demo/simple/DashVodRendererBuilder.java
View file @
dd2921f9
...
...
@@ -37,7 +37,7 @@ import com.google.android.exoplayer.demo.simple.SimplePlayerActivity.RendererBui
import
com.google.android.exoplayer.upstream.BufferPool
;
import
com.google.android.exoplayer.upstream.DataSource
;
import
com.google.android.exoplayer.upstream.DefaultBandwidthMeter
;
import
com.google.android.exoplayer.upstream.
Http
DataSource
;
import
com.google.android.exoplayer.upstream.
Uri
DataSource
;
import
com.google.android.exoplayer.util.ManifestFetcher
;
import
com.google.android.exoplayer.util.ManifestFetcher.ManifestCallback
;
...
...
@@ -118,7 +118,7 @@ import java.util.ArrayList;
videoRepresentationsList
.
toArray
(
videoRepresentations
);
// Build the video renderer.
DataSource
videoDataSource
=
new
HttpDataSource
(
userAgent
,
null
,
bandwidthMeter
);
DataSource
videoDataSource
=
new
UriDataSource
(
userAgent
,
bandwidthMeter
);
ChunkSource
videoChunkSource
=
new
DashChunkSource
(
videoDataSource
,
new
AdaptiveEvaluator
(
bandwidthMeter
),
videoRepresentations
);
ChunkSampleSource
videoSampleSource
=
new
ChunkSampleSource
(
videoChunkSource
,
loadControl
,
...
...
@@ -127,7 +127,7 @@ import java.util.ArrayList;
MediaCodec
.
VIDEO_SCALING_MODE_SCALE_TO_FIT
,
0
,
mainHandler
,
playerActivity
,
50
);
// Build the audio renderer.
DataSource
audioDataSource
=
new
HttpDataSource
(
userAgent
,
null
,
bandwidthMeter
);
DataSource
audioDataSource
=
new
UriDataSource
(
userAgent
,
bandwidthMeter
);
ChunkSource
audioChunkSource
=
new
DashChunkSource
(
audioDataSource
,
new
FormatEvaluator
.
FixedEvaluator
(),
audioRepresentation
);
SampleSource
audioSampleSource
=
new
ChunkSampleSource
(
audioChunkSource
,
loadControl
,
...
...
demo/src/main/java/com/google/android/exoplayer/demo/simple/SmoothStreamingRendererBuilder.java
View file @
dd2921f9
...
...
@@ -35,7 +35,7 @@ import com.google.android.exoplayer.smoothstreaming.SmoothStreamingManifestParse
import
com.google.android.exoplayer.upstream.BufferPool
;
import
com.google.android.exoplayer.upstream.DataSource
;
import
com.google.android.exoplayer.upstream.DefaultBandwidthMeter
;
import
com.google.android.exoplayer.upstream.
Http
DataSource
;
import
com.google.android.exoplayer.upstream.
Uri
DataSource
;
import
com.google.android.exoplayer.util.ManifestFetcher
;
import
com.google.android.exoplayer.util.ManifestFetcher.ManifestCallback
;
...
...
@@ -121,7 +121,7 @@ import java.util.ArrayList;
}
// Build the video renderer.
DataSource
videoDataSource
=
new
HttpDataSource
(
userAgent
,
null
,
bandwidthMeter
);
DataSource
videoDataSource
=
new
UriDataSource
(
userAgent
,
bandwidthMeter
);
ChunkSource
videoChunkSource
=
new
SmoothStreamingChunkSource
(
manifestFetcher
,
videoStreamElementIndex
,
videoTrackIndices
,
videoDataSource
,
new
AdaptiveEvaluator
(
bandwidthMeter
),
LIVE_EDGE_LATENCY_MS
);
...
...
@@ -131,7 +131,7 @@ import java.util.ArrayList;
MediaCodec
.
VIDEO_SCALING_MODE_SCALE_TO_FIT
,
0
,
mainHandler
,
playerActivity
,
50
);
// Build the audio renderer.
DataSource
audioDataSource
=
new
HttpDataSource
(
userAgent
,
null
,
bandwidthMeter
);
DataSource
audioDataSource
=
new
UriDataSource
(
userAgent
,
bandwidthMeter
);
ChunkSource
audioChunkSource
=
new
SmoothStreamingChunkSource
(
manifestFetcher
,
audioStreamElementIndex
,
new
int
[]
{
0
},
audioDataSource
,
new
FormatEvaluator
.
FixedEvaluator
(),
LIVE_EDGE_LATENCY_MS
);
...
...
library/src/main/java/com/google/android/exoplayer/upstream/UriDataSource.java
View file @
dd2921f9
...
...
@@ -62,24 +62,21 @@ public final class UriDataSource implements DataSource {
@Override
public
long
open
(
DataSpec
dataSpec
)
throws
IOException
{
Assertions
.
checkState
(
dataSource
==
null
);
dataSource
=
dataSpec
.
uri
.
getScheme
().
equals
(
FILE_URI_SCHEME
)
?
fileDataSource
:
httpDataSource
;
dataSource
=
FILE_URI_SCHEME
.
equals
(
dataSpec
.
uri
.
getScheme
())
?
fileDataSource
:
httpDataSource
;
return
dataSource
.
open
(
dataSpec
);
}
@Override
public
void
close
()
throws
IOException
{
Assertions
.
checkNotNull
(
dataSource
);
public
int
read
(
byte
[]
buffer
,
int
offset
,
int
readLength
)
throws
IOException
{
return
dataSource
.
read
(
buffer
,
offset
,
readLength
);
}
@Override
public
void
close
()
throws
IOException
{
if
(
dataSource
!=
null
)
{
dataSource
.
close
();
dataSource
=
null
;
}
@Override
public
int
read
(
byte
[]
buffer
,
int
offset
,
int
readLength
)
throws
IOException
{
Assertions
.
checkNotNull
(
dataSource
);
return
dataSource
.
read
(
buffer
,
offset
,
readLength
);
}
}
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