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
a7dd0f76
authored
Jan 30, 2017
by
ojw28
Committed by
GitHub
Jan 30, 2017
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #2326 from devint1/alac-dev
Apple Lossless (ALAC) support
parents
4b8a6572
6becba8c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
1 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 @
a7dd0f76
...
@@ -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 @
a7dd0f76
...
@@ -19,6 +19,7 @@ import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
...
@@ -19,6 +19,7 @@ import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import
com.google.android.exoplayer2.decoder.SimpleDecoder
;
import
com.google.android.exoplayer2.decoder.SimpleDecoder
;
import
com.google.android.exoplayer2.decoder.SimpleOutputBuffer
;
import
com.google.android.exoplayer2.decoder.SimpleOutputBuffer
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.util.List
;
import
java.util.List
;
...
@@ -88,6 +89,13 @@ import java.util.List;
...
@@ -88,6 +89,13 @@ import java.util.List;
if
(!
hasOutputFormat
)
{
if
(!
hasOutputFormat
)
{
channelCount
=
ffmpegGetChannelCount
(
nativeContext
);
channelCount
=
ffmpegGetChannelCount
(
nativeContext
);
sampleRate
=
ffmpegGetSampleRate
(
nativeContext
);
sampleRate
=
ffmpegGetSampleRate
(
nativeContext
);
if
(
sampleRate
==
0
&&
"alac"
.
equals
(
codecName
))
{
// ALAC decoder did not set the sample rate in earlier versions of FFMPEG.
// See https://trac.ffmpeg.org/ticket/6096
ParsableByteArray
parsableExtraData
=
new
ParsableByteArray
(
extraData
);
parsableExtraData
.
setPosition
(
extraData
.
length
-
4
);
sampleRate
=
parsableExtraData
.
readUnsignedIntToInt
();
}
hasOutputFormat
=
true
;
hasOutputFormat
=
true
;
}
}
outputBuffer
.
data
.
position
(
0
);
outputBuffer
.
data
.
position
(
0
);
...
@@ -123,6 +131,7 @@ import java.util.List;
...
@@ -123,6 +131,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 @
a7dd0f76
...
@@ -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 @
a7dd0f76
...
@@ -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 @
a7dd0f76
...
@@ -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 @
a7dd0f76
...
@@ -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