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
24726372
authored
Nov 18, 2014
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add support for extracting Vorbis audio in WebM Extractor.
parent
6a544da2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
9 deletions
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
library/src/main/java/com/google/android/exoplayer/parser/webm/DefaultEbmlReader.java
library/src/main/java/com/google/android/exoplayer/parser/webm/EbmlEventHandler.java
library/src/main/java/com/google/android/exoplayer/parser/webm/EbmlReader.java
library/src/main/java/com/google/android/exoplayer/parser/webm/WebmExtractor.java
library/src/main/java/com/google/android/exoplayer/util/MimeTypes.java
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
View file @
24726372
...
@@ -87,7 +87,7 @@ public class DashChunkSource implements ChunkSource {
...
@@ -87,7 +87,7 @@ public class DashChunkSource implements ChunkSource {
formats
[
i
]
=
representations
[
i
].
format
;
formats
[
i
]
=
representations
[
i
].
format
;
maxWidth
=
Math
.
max
(
formats
[
i
].
width
,
maxWidth
);
maxWidth
=
Math
.
max
(
formats
[
i
].
width
,
maxWidth
);
maxHeight
=
Math
.
max
(
formats
[
i
].
height
,
maxHeight
);
maxHeight
=
Math
.
max
(
formats
[
i
].
height
,
maxHeight
);
Extractor
extractor
=
formats
[
i
].
mimeType
.
startsWith
(
MimeTypes
.
VIDEO_WEBM
)
Extractor
extractor
=
mimeTypeIsWebm
(
formats
[
i
].
mimeType
)
?
new
WebmExtractor
()
:
new
FragmentedMp4Extractor
();
?
new
WebmExtractor
()
:
new
FragmentedMp4Extractor
();
extractors
.
put
(
formats
[
i
].
id
,
extractor
);
extractors
.
put
(
formats
[
i
].
id
,
extractor
);
this
.
representations
.
put
(
formats
[
i
].
id
,
representations
[
i
]);
this
.
representations
.
put
(
formats
[
i
].
id
,
representations
[
i
]);
...
@@ -197,6 +197,10 @@ public class DashChunkSource implements ChunkSource {
...
@@ -197,6 +197,10 @@ public class DashChunkSource implements ChunkSource {
// Do nothing.
// Do nothing.
}
}
private
boolean
mimeTypeIsWebm
(
String
mimeType
)
{
return
mimeType
.
startsWith
(
MimeTypes
.
VIDEO_WEBM
)
||
mimeType
.
startsWith
(
MimeTypes
.
AUDIO_WEBM
);
}
private
Chunk
newInitializationChunk
(
RangedUri
initializationUri
,
RangedUri
indexUri
,
private
Chunk
newInitializationChunk
(
RangedUri
initializationUri
,
RangedUri
indexUri
,
Representation
representation
,
Extractor
extractor
,
DataSource
dataSource
,
Representation
representation
,
Extractor
extractor
,
DataSource
dataSource
,
int
trigger
)
{
int
trigger
)
{
...
...
library/src/main/java/com/google/android/exoplayer/parser/webm/DefaultEbmlReader.java
View file @
24726372
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
com
.
google
.
android
.
exoplayer
.
parser
.
webm
;
package
com
.
google
.
android
.
exoplayer
.
parser
.
webm
;
import
com.google.android.exoplayer.C
;
import
com.google.android.exoplayer.C
;
import
com.google.android.exoplayer.ParserException
;
import
com.google.android.exoplayer.upstream.NonBlockingInputStream
;
import
com.google.android.exoplayer.upstream.NonBlockingInputStream
;
import
com.google.android.exoplayer.util.Assertions
;
import
com.google.android.exoplayer.util.Assertions
;
...
@@ -134,7 +135,7 @@ import java.util.Stack;
...
@@ -134,7 +135,7 @@ import java.util.Stack;
}
}
@Override
@Override
public
int
read
(
NonBlockingInputStream
inputStream
)
{
public
int
read
(
NonBlockingInputStream
inputStream
)
throws
ParserException
{
Assertions
.
checkState
(
eventHandler
!=
null
);
Assertions
.
checkState
(
eventHandler
!=
null
);
while
(
true
)
{
while
(
true
)
{
while
(!
masterElementsStack
.
isEmpty
()
while
(!
masterElementsStack
.
isEmpty
()
...
...
library/src/main/java/com/google/android/exoplayer/parser/webm/EbmlEventHandler.java
View file @
24726372
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer
.
parser
.
webm
;
package
com
.
google
.
android
.
exoplayer
.
parser
.
webm
;
import
com.google.android.exoplayer.ParserException
;
import
com.google.android.exoplayer.upstream.NonBlockingInputStream
;
import
com.google.android.exoplayer.upstream.NonBlockingInputStream
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
...
@@ -46,41 +47,47 @@ import java.nio.ByteBuffer;
...
@@ -46,41 +47,47 @@ import java.nio.ByteBuffer;
* @param elementOffsetBytes The byte offset where this element starts
* @param elementOffsetBytes The byte offset where this element starts
* @param headerSizeBytes The byte length of this element's ID and size header
* @param headerSizeBytes The byte length of this element's ID and size header
* @param contentsSizeBytes The byte length of this element's children
* @param contentsSizeBytes The byte length of this element's children
* @throws ParserException If a parsing error occurs.
*/
*/
public
void
onMasterElementStart
(
public
void
onMasterElementStart
(
int
id
,
long
elementOffsetBytes
,
int
headerSizeBytes
,
long
contentsSizeBytes
);
int
id
,
long
elementOffsetBytes
,
int
headerSizeBytes
,
long
contentsSizeBytes
)
throws
ParserException
;
/**
/**
* Called when a master element has finished reading in all of its children from the
* Called when a master element has finished reading in all of its children from the
* {@link NonBlockingInputStream}.
* {@link NonBlockingInputStream}.
*
*
* @param id The integer ID of this element
* @param id The integer ID of this element
* @throws ParserException If a parsing error occurs.
*/
*/
public
void
onMasterElementEnd
(
int
id
);
public
void
onMasterElementEnd
(
int
id
)
throws
ParserException
;
/**
/**
* Called when an integer element is encountered in the {@link NonBlockingInputStream}.
* Called when an integer element is encountered in the {@link NonBlockingInputStream}.
*
*
* @param id The integer ID of this element
* @param id The integer ID of this element
* @param value The integer value this element contains
* @param value The integer value this element contains
* @throws ParserException If a parsing error occurs.
*/
*/
public
void
onIntegerElement
(
int
id
,
long
value
);
public
void
onIntegerElement
(
int
id
,
long
value
)
throws
ParserException
;
/**
/**
* Called when a float element is encountered in the {@link NonBlockingInputStream}.
* Called when a float element is encountered in the {@link NonBlockingInputStream}.
*
*
* @param id The integer ID of this element
* @param id The integer ID of this element
* @param value The float value this element contains
* @param value The float value this element contains
* @throws ParserException If a parsing error occurs.
*/
*/
public
void
onFloatElement
(
int
id
,
double
value
);
public
void
onFloatElement
(
int
id
,
double
value
)
throws
ParserException
;
/**
/**
* Called when a string element is encountered in the {@link NonBlockingInputStream}.
* Called when a string element is encountered in the {@link NonBlockingInputStream}.
*
*
* @param id The integer ID of this element
* @param id The integer ID of this element
* @param value The string value this element contains
* @param value The string value this element contains
* @throws ParserException If a parsing error occurs.
*/
*/
public
void
onStringElement
(
int
id
,
String
value
);
public
void
onStringElement
(
int
id
,
String
value
)
throws
ParserException
;
/**
/**
* Called when a binary element is encountered in the {@link NonBlockingInputStream}.
* Called when a binary element is encountered in the {@link NonBlockingInputStream}.
...
@@ -109,9 +116,10 @@ import java.nio.ByteBuffer;
...
@@ -109,9 +116,10 @@ import java.nio.ByteBuffer;
* @param inputStream The {@link NonBlockingInputStream} from which this
* @param inputStream The {@link NonBlockingInputStream} from which this
* element's contents should be read
* element's contents should be read
* @return True if the element was read. False otherwise.
* @return True if the element was read. False otherwise.
* @throws ParserException If a parsing error occurs.
*/
*/
public
boolean
onBinaryElement
(
public
boolean
onBinaryElement
(
int
id
,
long
elementOffsetBytes
,
int
headerSizeBytes
,
int
contentsSizeBytes
,
int
id
,
long
elementOffsetBytes
,
int
headerSizeBytes
,
int
contentsSizeBytes
,
NonBlockingInputStream
inputStream
);
NonBlockingInputStream
inputStream
)
throws
ParserException
;
}
}
library/src/main/java/com/google/android/exoplayer/parser/webm/EbmlReader.java
View file @
24726372
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer
.
parser
.
webm
;
package
com
.
google
.
android
.
exoplayer
.
parser
.
webm
;
import
com.google.android.exoplayer.ParserException
;
import
com.google.android.exoplayer.upstream.NonBlockingInputStream
;
import
com.google.android.exoplayer.upstream.NonBlockingInputStream
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
...
@@ -53,8 +54,9 @@ import java.nio.ByteBuffer;
...
@@ -53,8 +54,9 @@ import java.nio.ByteBuffer;
*
*
* @param inputStream The input stream from which data should be read
* @param inputStream The input stream from which data should be read
* @return One of the {@code RESULT_*} flags defined in this interface
* @return One of the {@code RESULT_*} flags defined in this interface
* @throws ParserException If parsing fails.
*/
*/
public
int
read
(
NonBlockingInputStream
inputStream
);
public
int
read
(
NonBlockingInputStream
inputStream
)
throws
ParserException
;
/**
/**
* The total number of bytes consumed by the reader since first created or last {@link #reset()}.
* The total number of bytes consumed by the reader since first created or last {@link #reset()}.
...
...
library/src/main/java/com/google/android/exoplayer/parser/webm/WebmExtractor.java
View file @
24726372
This diff is collapsed.
Click to expand it.
library/src/main/java/com/google/android/exoplayer/util/MimeTypes.java
View file @
24726372
...
@@ -34,6 +34,8 @@ public class MimeTypes {
...
@@ -34,6 +34,8 @@ public class MimeTypes {
public
static
final
String
AUDIO_AAC
=
BASE_TYPE_AUDIO
+
"/mp4a-latm"
;
public
static
final
String
AUDIO_AAC
=
BASE_TYPE_AUDIO
+
"/mp4a-latm"
;
public
static
final
String
AUDIO_AC3
=
BASE_TYPE_AUDIO
+
"/ac3"
;
public
static
final
String
AUDIO_AC3
=
BASE_TYPE_AUDIO
+
"/ac3"
;
public
static
final
String
AUDIO_EC3
=
BASE_TYPE_AUDIO
+
"/eac3"
;
public
static
final
String
AUDIO_EC3
=
BASE_TYPE_AUDIO
+
"/eac3"
;
public
static
final
String
AUDIO_WEBM
=
BASE_TYPE_AUDIO
+
"/webm"
;
public
static
final
String
AUDIO_VORBIS
=
BASE_TYPE_AUDIO
+
"/vorbis"
;
public
static
final
String
TEXT_VTT
=
BASE_TYPE_TEXT
+
"/vtt"
;
public
static
final
String
TEXT_VTT
=
BASE_TYPE_TEXT
+
"/vtt"
;
...
...
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