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
a085d2f2
authored
Apr 10, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add END_OF_INPUT constant + start using it.
parent
608d685b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
library/src/main/java/com/google/android/exoplayer/C.java
library/src/main/java/com/google/android/exoplayer/upstream/DataSource.java
library/src/main/java/com/google/android/exoplayer/upstream/DefaultHttpDataSource.java
library/src/main/java/com/google/android/exoplayer/C.java
View file @
a085d2f2
...
@@ -44,6 +44,12 @@ public final class C {
...
@@ -44,6 +44,12 @@ public final class C {
public
static
final
String
UTF8_NAME
=
"UTF-8"
;
public
static
final
String
UTF8_NAME
=
"UTF-8"
;
/**
/**
* @see MediaCodec#CRYPTO_MODE_AES_CTR
*/
@SuppressWarnings
(
"InlinedApi"
)
public
static
final
int
CRYPTO_MODE_AES_CTR
=
MediaCodec
.
CRYPTO_MODE_AES_CTR
;
/**
* @see MediaExtractor#SAMPLE_FLAG_SYNC
* @see MediaExtractor#SAMPLE_FLAG_SYNC
*/
*/
@SuppressWarnings
(
"InlinedApi"
)
@SuppressWarnings
(
"InlinedApi"
)
...
@@ -61,10 +67,9 @@ public final class C {
...
@@ -61,10 +67,9 @@ public final class C {
public
static
final
int
SAMPLE_FLAG_DECODE_ONLY
=
0x8000000
;
public
static
final
int
SAMPLE_FLAG_DECODE_ONLY
=
0x8000000
;
/**
/**
*
@see MediaCodec#CRYPTO_MODE_AES_CTR
*
A return value for methods where the end of an input was encountered.
*/
*/
@SuppressWarnings
(
"InlinedApi"
)
public
static
final
int
RESULT_END_OF_INPUT
=
-
1
;
public
static
final
int
CRYPTO_MODE_AES_CTR
=
MediaCodec
.
CRYPTO_MODE_AES_CTR
;
private
C
()
{}
private
C
()
{}
...
...
library/src/main/java/com/google/android/exoplayer/upstream/DataSource.java
View file @
a085d2f2
...
@@ -63,7 +63,8 @@ public interface DataSource {
...
@@ -63,7 +63,8 @@ public interface DataSource {
* @param buffer The buffer into which the read data should be stored.
* @param buffer The buffer into which the read data should be stored.
* @param offset The start offset into {@code buffer} at which data should be written.
* @param offset The start offset into {@code buffer} at which data should be written.
* @param readLength The maximum number of bytes to read.
* @param readLength The maximum number of bytes to read.
* @return The number of bytes read, or -1 if the end of the opened range is reached.
* @return The number of bytes read, or {@link C#RESULT_END_OF_INPUT} if the end of the opened
* range is reached.
* @throws IOException If an error occurs reading from the source.
* @throws IOException If an error occurs reading from the source.
*/
*/
public
int
read
(
byte
[]
buffer
,
int
offset
,
int
readLength
)
throws
IOException
;
public
int
read
(
byte
[]
buffer
,
int
offset
,
int
readLength
)
throws
IOException
;
...
...
library/src/main/java/com/google/android/exoplayer/upstream/DefaultHttpDataSource.java
View file @
a085d2f2
...
@@ -401,7 +401,8 @@ public class DefaultHttpDataSource implements HttpDataSource {
...
@@ -401,7 +401,8 @@ public class DefaultHttpDataSource implements HttpDataSource {
* @param buffer The buffer into which the read data should be stored.
* @param buffer The buffer into which the read data should be stored.
* @param offset The start offset into {@code buffer} at which data should be written.
* @param offset The start offset into {@code buffer} at which data should be written.
* @param readLength The maximum number of bytes to read.
* @param readLength The maximum number of bytes to read.
* @return The number of bytes read, or -1 if the end of the opened range is reached.
* @return The number of bytes read, or {@link C#RESULT_END_OF_INPUT} if the end of the opened
* range is reached.
* @throws IOException If an error occurs reading from the source.
* @throws IOException If an error occurs reading from the source.
*/
*/
private
int
readInternal
(
byte
[]
buffer
,
int
offset
,
int
readLength
)
throws
IOException
{
private
int
readInternal
(
byte
[]
buffer
,
int
offset
,
int
readLength
)
throws
IOException
{
...
@@ -409,7 +410,7 @@ public class DefaultHttpDataSource implements HttpDataSource {
...
@@ -409,7 +410,7 @@ public class DefaultHttpDataSource implements HttpDataSource {
:
(
int
)
Math
.
min
(
readLength
,
bytesToRead
-
bytesRead
);
:
(
int
)
Math
.
min
(
readLength
,
bytesToRead
-
bytesRead
);
if
(
readLength
==
0
)
{
if
(
readLength
==
0
)
{
// We've read all of the requested data.
// We've read all of the requested data.
return
-
1
;
return
C
.
RESULT_END_OF_INPUT
;
}
}
int
read
=
inputStream
.
read
(
buffer
,
offset
,
readLength
);
int
read
=
inputStream
.
read
(
buffer
,
offset
,
readLength
);
...
@@ -418,7 +419,7 @@ public class DefaultHttpDataSource implements HttpDataSource {
...
@@ -418,7 +419,7 @@ public class DefaultHttpDataSource implements HttpDataSource {
// The server closed the connection having not sent sufficient data.
// The server closed the connection having not sent sufficient data.
throw
new
EOFException
();
throw
new
EOFException
();
}
}
return
-
1
;
return
C
.
RESULT_END_OF_INPUT
;
}
}
bytesRead
+=
read
;
bytesRead
+=
read
;
...
...
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