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
e4b35e88
authored
Sep 11, 2014
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Transition ExoPlayer to use longs for ms timestamps.
parent
d85f4abb
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
35 additions
and
35 deletions
demo/src/main/java/com/google/android/exoplayer/demo/full/FullPlayerActivity.java
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DemoPlayer.java
demo/src/main/java/com/google/android/exoplayer/demo/simple/SimplePlayerActivity.java
library/src/main/java/com/google/android/exoplayer/ExoPlayer.java
library/src/main/java/com/google/android/exoplayer/ExoPlayerImpl.java
library/src/main/java/com/google/android/exoplayer/ExoPlayerImplInternal.java
library/src/main/java/com/google/android/exoplayer/parser/mp4/FragmentedMp4Extractor.java
library/src/main/java/com/google/android/exoplayer/parser/mp4/TrackFragment.java
library/src/main/java/com/google/android/exoplayer/util/PlayerControl.java
demo/src/main/java/com/google/android/exoplayer/demo/full/FullPlayerActivity.java
View file @
e4b35e88
...
...
@@ -70,7 +70,7 @@ public class FullPlayerActivity extends Activity implements SurfaceHolder.Callba
private
boolean
playerNeedsPrepare
;
private
boolean
autoPlay
=
true
;
private
int
playerPosition
;
private
long
playerPosition
;
private
boolean
enableBackgroundAudio
=
false
;
private
Uri
contentUri
;
...
...
demo/src/main/java/com/google/android/exoplayer/demo/full/player/DemoPlayer.java
View file @
e4b35e88
...
...
@@ -310,7 +310,7 @@ public class DemoPlayer implements ExoPlayer.Listener, ChunkSampleSource.EventLi
player
.
setPlayWhenReady
(
playWhenReady
);
}
public
void
seekTo
(
int
positionMs
)
{
public
void
seekTo
(
long
positionMs
)
{
player
.
seekTo
(
positionMs
);
}
...
...
@@ -339,11 +339,11 @@ public class DemoPlayer implements ExoPlayer.Listener, ChunkSampleSource.EventLi
return
playerState
;
}
public
int
getCurrentPosition
()
{
public
long
getCurrentPosition
()
{
return
player
.
getCurrentPosition
();
}
public
int
getDuration
()
{
public
long
getDuration
()
{
return
player
.
getDuration
();
}
...
...
demo/src/main/java/com/google/android/exoplayer/demo/simple/SimplePlayerActivity.java
View file @
e4b35e88
...
...
@@ -76,7 +76,7 @@ public class SimplePlayerActivity extends Activity implements SurfaceHolder.Call
private
MediaCodecVideoTrackRenderer
videoRenderer
;
private
boolean
autoPlay
=
true
;
private
int
playerPosition
;
private
long
playerPosition
;
private
Uri
contentUri
;
private
int
contentType
;
...
...
library/src/main/java/com/google/android/exoplayer/ExoPlayer.java
View file @
e4b35e88
...
...
@@ -229,7 +229,7 @@ public interface ExoPlayer {
/**
* Represents an unknown time or duration.
*/
public
static
final
int
UNKNOWN_TIME
=
-
1
;
public
static
final
long
UNKNOWN_TIME
=
-
1
;
/**
* Gets the {@link Looper} associated with the playback thread.
...
...
@@ -313,7 +313,7 @@ public interface ExoPlayer {
*
* @param positionMs The seek position.
*/
public
void
seekTo
(
int
positionMs
);
public
void
seekTo
(
long
positionMs
);
/**
* Stops playback. Use {@code setPlayWhenReady(false)} rather than this method if the intention
...
...
@@ -363,14 +363,14 @@ public interface ExoPlayer {
* @return The duration of the track in milliseconds, or {@link ExoPlayer#UNKNOWN_TIME} if the
* duration is not known.
*/
public
int
getDuration
();
public
long
getDuration
();
/**
* Gets the current playback position in milliseconds.
*
* @return The current playback position in milliseconds.
*/
public
int
getCurrentPosition
();
public
long
getCurrentPosition
();
/**
* Gets an estimate of the absolute position in milliseconds up to which data is buffered.
...
...
@@ -378,7 +378,7 @@ public interface ExoPlayer {
* @return An estimate of the absolute position in milliseconds up to which data is buffered,
* or {@link ExoPlayer#UNKNOWN_TIME} if no estimate is available.
*/
public
int
getBufferedPosition
();
public
long
getBufferedPosition
();
/**
* Gets an estimate of the percentage into the media up to which data is buffered.
...
...
library/src/main/java/com/google/android/exoplayer/ExoPlayerImpl.java
View file @
e4b35e88
...
...
@@ -130,7 +130,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
@Override
public
void
seekTo
(
int
positionMs
)
{
public
void
seekTo
(
long
positionMs
)
{
internalPlayer
.
seekTo
(
positionMs
);
}
...
...
@@ -156,26 +156,26 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
@Override
public
int
getDuration
()
{
public
long
getDuration
()
{
return
internalPlayer
.
getDuration
();
}
@Override
public
int
getCurrentPosition
()
{
public
long
getCurrentPosition
()
{
return
internalPlayer
.
getCurrentPosition
();
}
@Override
public
int
getBufferedPosition
()
{
public
long
getBufferedPosition
()
{
return
internalPlayer
.
getBufferedPosition
();
}
@Override
public
int
getBufferedPercentage
()
{
int
bufferedPosition
=
getBufferedPosition
();
int
duration
=
getDuration
();
long
bufferedPosition
=
getBufferedPosition
();
long
duration
=
getDuration
();
return
bufferedPosition
==
ExoPlayer
.
UNKNOWN_TIME
||
duration
==
ExoPlayer
.
UNKNOWN_TIME
?
0
:
(
duration
==
0
?
100
:
(
bufferedPosition
*
100
)
/
duration
);
:
(
int
)
(
duration
==
0
?
100
:
(
bufferedPosition
*
100
)
/
duration
);
}
// Not private so it can be called from an inner class without going through a thunk method.
...
...
library/src/main/java/com/google/android/exoplayer/ExoPlayerImplInternal.java
View file @
e4b35e88
...
...
@@ -117,18 +117,18 @@ import java.util.List;
return
internalPlaybackThread
.
getLooper
();
}
public
int
getCurrentPosition
()
{
return
(
int
)
(
positionUs
/
1000
)
;
public
long
getCurrentPosition
()
{
return
positionUs
/
1000
;
}
public
int
getBufferedPosition
()
{
public
long
getBufferedPosition
()
{
return
bufferedPositionUs
==
TrackRenderer
.
UNKNOWN_TIME_US
?
ExoPlayer
.
UNKNOWN_TIME
:
(
int
)
(
bufferedPositionUs
/
1000
)
;
:
bufferedPositionUs
/
1000
;
}
public
int
getDuration
()
{
public
long
getDuration
()
{
return
durationUs
==
TrackRenderer
.
UNKNOWN_TIME_US
?
ExoPlayer
.
UNKNOWN_TIME
:
(
int
)
(
durationUs
/
1000
)
;
:
durationUs
/
1000
;
}
public
void
prepare
(
TrackRenderer
...
renderers
)
{
...
...
@@ -139,8 +139,8 @@ import java.util.List;
handler
.
obtainMessage
(
MSG_SET_PLAY_WHEN_READY
,
playWhenReady
?
1
:
0
,
0
).
sendToTarget
();
}
public
void
seekTo
(
int
positionMs
)
{
handler
.
obtainMessage
(
MSG_SEEK_TO
,
positionMs
,
0
).
sendToTarget
();
public
void
seekTo
(
long
positionMs
)
{
handler
.
obtainMessage
(
MSG_SEEK_TO
,
positionMs
).
sendToTarget
();
}
public
void
stop
()
{
...
...
@@ -204,7 +204,7 @@ import java.util.List;
return
true
;
}
case
MSG_SEEK_TO:
{
seekToInternal
(
msg
.
arg1
);
seekToInternal
(
(
Long
)
msg
.
obj
);
return
true
;
}
case
MSG_STOP:
{
...
...
@@ -453,7 +453,7 @@ import java.util.List;
}
}
private
void
seekToInternal
(
int
positionMs
)
throws
ExoPlaybackException
{
private
void
seekToInternal
(
long
positionMs
)
throws
ExoPlaybackException
{
rebuffering
=
false
;
positionUs
=
positionMs
*
1000L
;
mediaClock
.
stop
();
...
...
library/src/main/java/com/google/android/exoplayer/parser/mp4/FragmentedMp4Extractor.java
View file @
e4b35e88
...
...
@@ -855,8 +855,8 @@ public final class FragmentedMp4Extractor implements Extractor {
out
.
initTables
(
sampleCount
);
int
[]
sampleSizeTable
=
out
.
sampleSizeTable
;
int
[]
sampleDecodingTimeTable
=
out
.
sampleDecodingTimeTable
;
int
[]
sampleCompositionTimeOffsetTable
=
out
.
sampleCompositionTimeOffsetTable
;
long
[]
sampleDecodingTimeTable
=
out
.
sampleDecodingTimeTable
;
boolean
[]
sampleIsSyncFrameTable
=
out
.
sampleIsSyncFrameTable
;
long
timescale
=
track
.
timescale
;
...
...
@@ -882,7 +882,7 @@ public final class FragmentedMp4Extractor implements Extractor {
}
else
{
sampleCompositionTimeOffsetTable
[
i
]
=
0
;
}
sampleDecodingTimeTable
[
i
]
=
(
int
)
((
cumulativeTime
*
1000
)
/
timescale
)
;
sampleDecodingTimeTable
[
i
]
=
(
cumulativeTime
*
1000
)
/
timescale
;
sampleSizeTable
[
i
]
=
sampleSize
;
sampleIsSyncFrameTable
[
i
]
=
((
sampleFlags
>>
16
)
&
0x1
)
==
0
&&
(!
workaroundEveryVideoFrameIsSyncFrame
||
i
==
0
);
...
...
library/src/main/java/com/google/android/exoplayer/parser/mp4/TrackFragment.java
View file @
e4b35e88
...
...
@@ -33,14 +33,14 @@ import com.google.android.exoplayer.upstream.NonBlockingInputStream;
*/
public
int
[]
sampleSizeTable
;
/**
* The decoding time of each sample in the run.
*/
public
int
[]
sampleDecodingTimeTable
;
/**
* The composition time offset of each sample in the run.
*/
public
int
[]
sampleCompositionTimeOffsetTable
;
/**
* The decoding time of each sample in the run.
*/
public
long
[]
sampleDecodingTimeTable
;
/**
* Indicates which samples are sync frames.
*/
public
boolean
[]
sampleIsSyncFrameTable
;
...
...
library/src/main/java/com/google/android/exoplayer/util/PlayerControl.java
View file @
e4b35e88
...
...
@@ -70,12 +70,12 @@ public class PlayerControl implements MediaPlayerControl {
@Override
public
int
getCurrentPosition
()
{
return
exoPlayer
.
getCurrentPosition
();
return
(
int
)
exoPlayer
.
getCurrentPosition
();
}
@Override
public
int
getDuration
()
{
return
exoPlayer
.
getDuration
();
return
(
int
)
exoPlayer
.
getDuration
();
}
@Override
...
...
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