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
30c59c7a
authored
Jan 13, 2017
by
Devin Tuchsen
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Apple Lossless (ALAC) support
parent
5a16aee2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
2 deletions
extensions/ffmpeg/README.md
extensions/ffmpeg/src/main/java/com/google/android/exoplayer2/ext/ffmpeg/FfmpegDecoder.java
extensions/ffmpeg/src/main/java/com/google/android/exoplayer2/ext/ffmpeg/FfmpegLibrary.java
library/src/main/java/com/google/android/exoplayer2/extractor/mp4/Atom.java
library/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
library/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java
extensions/ffmpeg/README.md
View file @
30c59c7a
...
@@ -63,6 +63,7 @@ git clone git://source.ffmpeg.org/ffmpeg ffmpeg && cd ffmpeg && \
...
@@ -63,6 +63,7 @@ git clone git://source.ffmpeg.org/ffmpeg ffmpeg && cd ffmpeg && \
--enable-decoder=vorbis \
--enable-decoder=vorbis \
--enable-decoder=opus \
--enable-decoder=opus \
--enable-decoder=flac \
--enable-decoder=flac \
--enable-decoder=alac \
&& \
&& \
make -j4 && \
make -j4 && \
make install-libs
make install-libs
...
...
extensions/ffmpeg/src/main/java/com/google/android/exoplayer2/ext/ffmpeg/FfmpegDecoder.java
View file @
30c59c7a
...
@@ -87,7 +87,11 @@ import java.util.List;
...
@@ -87,7 +87,11 @@ import java.util.List;
}
}
if
(!
hasOutputFormat
)
{
if
(!
hasOutputFormat
)
{
channelCount
=
ffmpegGetChannelCount
(
nativeContext
);
channelCount
=
ffmpegGetChannelCount
(
nativeContext
);
sampleRate
=
ffmpegGetSampleRate
(
nativeContext
);
if
(
"alac"
.
equals
(
codecName
))
{
sampleRate
=
ByteBuffer
.
wrap
(
extraData
,
extraData
.
length
-
4
,
4
).
getInt
();
}
else
{
sampleRate
=
ffmpegGetSampleRate
(
nativeContext
);
}
hasOutputFormat
=
true
;
hasOutputFormat
=
true
;
}
}
outputBuffer
.
data
.
position
(
0
);
outputBuffer
.
data
.
position
(
0
);
...
@@ -123,6 +127,7 @@ import java.util.List;
...
@@ -123,6 +127,7 @@ import java.util.List;
private
static
byte
[]
getExtraData
(
String
mimeType
,
List
<
byte
[]>
initializationData
)
{
private
static
byte
[]
getExtraData
(
String
mimeType
,
List
<
byte
[]>
initializationData
)
{
switch
(
mimeType
)
{
switch
(
mimeType
)
{
case
MimeTypes
.
AUDIO_AAC
:
case
MimeTypes
.
AUDIO_AAC
:
case
MimeTypes
.
AUDIO_ALAC
:
case
MimeTypes
.
AUDIO_OPUS
:
case
MimeTypes
.
AUDIO_OPUS
:
return
initializationData
.
get
(
0
);
return
initializationData
.
get
(
0
);
case
MimeTypes
.
AUDIO_VORBIS
:
case
MimeTypes
.
AUDIO_VORBIS
:
...
...
extensions/ffmpeg/src/main/java/com/google/android/exoplayer2/ext/ffmpeg/FfmpegLibrary.java
View file @
30c59c7a
...
@@ -92,6 +92,8 @@ public final class FfmpegLibrary {
...
@@ -92,6 +92,8 @@ public final class FfmpegLibrary {
return
"amrwb"
;
return
"amrwb"
;
case
MimeTypes
.
AUDIO_FLAC
:
case
MimeTypes
.
AUDIO_FLAC
:
return
"flac"
;
return
"flac"
;
case
MimeTypes
.
AUDIO_ALAC
:
return
"alac"
;
default
:
default
:
return
null
;
return
null
;
}
}
...
...
library/src/main/java/com/google/android/exoplayer2/extractor/mp4/Atom.java
View file @
30c59c7a
...
@@ -135,6 +135,7 @@ import java.util.List;
...
@@ -135,6 +135,7 @@ import java.util.List;
public
static
final
int
TYPE_vp09
=
Util
.
getIntegerCodeForString
(
"vp09"
);
public
static
final
int
TYPE_vp09
=
Util
.
getIntegerCodeForString
(
"vp09"
);
public
static
final
int
TYPE_vpcC
=
Util
.
getIntegerCodeForString
(
"vpcC"
);
public
static
final
int
TYPE_vpcC
=
Util
.
getIntegerCodeForString
(
"vpcC"
);
public
static
final
int
TYPE_camm
=
Util
.
getIntegerCodeForString
(
"camm"
);
public
static
final
int
TYPE_camm
=
Util
.
getIntegerCodeForString
(
"camm"
);
public
static
final
int
TYPE_alac
=
Util
.
getIntegerCodeForString
(
"alac"
);
public
final
int
type
;
public
final
int
type
;
...
...
library/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java
View file @
30c59c7a
...
@@ -604,7 +604,7 @@ import java.util.List;
...
@@ -604,7 +604,7 @@ import java.util.List;
||
childAtomType
==
Atom
.
TYPE_dtsh
||
childAtomType
==
Atom
.
TYPE_dtsl
||
childAtomType
==
Atom
.
TYPE_dtsh
||
childAtomType
==
Atom
.
TYPE_dtsl
||
childAtomType
==
Atom
.
TYPE_samr
||
childAtomType
==
Atom
.
TYPE_sawb
||
childAtomType
==
Atom
.
TYPE_samr
||
childAtomType
==
Atom
.
TYPE_sawb
||
childAtomType
==
Atom
.
TYPE_lpcm
||
childAtomType
==
Atom
.
TYPE_sowt
||
childAtomType
==
Atom
.
TYPE_lpcm
||
childAtomType
==
Atom
.
TYPE_sowt
||
childAtomType
==
Atom
.
TYPE__mp3
)
{
||
childAtomType
==
Atom
.
TYPE__mp3
||
childAtomType
==
Atom
.
TYPE_alac
)
{
parseAudioSampleEntry
(
stsd
,
childAtomType
,
childStartPosition
,
childAtomSize
,
trackId
,
parseAudioSampleEntry
(
stsd
,
childAtomType
,
childStartPosition
,
childAtomSize
,
trackId
,
language
,
isQuickTime
,
drmInitData
,
out
,
i
);
language
,
isQuickTime
,
drmInitData
,
out
,
i
);
}
else
if
(
childAtomType
==
Atom
.
TYPE_TTML
)
{
}
else
if
(
childAtomType
==
Atom
.
TYPE_TTML
)
{
...
@@ -839,6 +839,8 @@ import java.util.List;
...
@@ -839,6 +839,8 @@ import java.util.List;
mimeType
=
MimeTypes
.
AUDIO_RAW
;
mimeType
=
MimeTypes
.
AUDIO_RAW
;
}
else
if
(
atomType
==
Atom
.
TYPE__mp3
)
{
}
else
if
(
atomType
==
Atom
.
TYPE__mp3
)
{
mimeType
=
MimeTypes
.
AUDIO_MPEG
;
mimeType
=
MimeTypes
.
AUDIO_MPEG
;
}
else
if
(
atomType
==
Atom
.
TYPE_alac
)
{
mimeType
=
MimeTypes
.
AUDIO_ALAC
;
}
}
byte
[]
initializationData
=
null
;
byte
[]
initializationData
=
null
;
...
@@ -876,6 +878,10 @@ import java.util.List;
...
@@ -876,6 +878,10 @@ import java.util.List;
out
.
format
=
Format
.
createAudioSampleFormat
(
Integer
.
toString
(
trackId
),
mimeType
,
null
,
out
.
format
=
Format
.
createAudioSampleFormat
(
Integer
.
toString
(
trackId
),
mimeType
,
null
,
Format
.
NO_VALUE
,
Format
.
NO_VALUE
,
channelCount
,
sampleRate
,
null
,
drmInitData
,
0
,
Format
.
NO_VALUE
,
Format
.
NO_VALUE
,
channelCount
,
sampleRate
,
null
,
drmInitData
,
0
,
language
);
language
);
}
else
if
(
childAtomType
==
Atom
.
TYPE_alac
)
{
initializationData
=
new
byte
[
childAtomSize
];
parent
.
setPosition
(
childPosition
);
parent
.
readBytes
(
initializationData
,
0
,
childAtomSize
);
}
}
childPosition
+=
childAtomSize
;
childPosition
+=
childAtomSize
;
}
}
...
...
library/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java
View file @
30c59c7a
...
@@ -60,6 +60,7 @@ public final class MimeTypes {
...
@@ -60,6 +60,7 @@ public final class MimeTypes {
public
static
final
String
AUDIO_AMR_NB
=
BASE_TYPE_AUDIO
+
"/3gpp"
;
public
static
final
String
AUDIO_AMR_NB
=
BASE_TYPE_AUDIO
+
"/3gpp"
;
public
static
final
String
AUDIO_AMR_WB
=
BASE_TYPE_AUDIO
+
"/amr-wb"
;
public
static
final
String
AUDIO_AMR_WB
=
BASE_TYPE_AUDIO
+
"/amr-wb"
;
public
static
final
String
AUDIO_FLAC
=
BASE_TYPE_AUDIO
+
"/x-flac"
;
public
static
final
String
AUDIO_FLAC
=
BASE_TYPE_AUDIO
+
"/x-flac"
;
public
static
final
String
AUDIO_ALAC
=
BASE_TYPE_AUDIO
+
"/alac"
;
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