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
b9addf28
authored
Mar 03, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Formatting tweaks for enhanced ID3 support + support in demo app.
parent
0c6566bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
15 deletions
demo/src/main/java/com/google/android/exoplayer/demo/PlayerActivity.java
demo/src/main/java/com/google/android/exoplayer/demo/Samples.java
library/src/main/java/com/google/android/exoplayer/metadata/Id3Parser.java
demo/src/main/java/com/google/android/exoplayer/demo/PlayerActivity.java
View file @
b9addf28
...
...
@@ -26,6 +26,8 @@ import com.google.android.exoplayer.demo.player.DemoPlayer.RendererBuilder;
import
com.google.android.exoplayer.demo.player.HlsRendererBuilder
;
import
com.google.android.exoplayer.demo.player.SmoothStreamingRendererBuilder
;
import
com.google.android.exoplayer.demo.player.UnsupportedDrmException
;
import
com.google.android.exoplayer.metadata.GeobMetadata
;
import
com.google.android.exoplayer.metadata.PrivMetadata
;
import
com.google.android.exoplayer.metadata.TxxxMetadata
;
import
com.google.android.exoplayer.text.CaptionStyleCompat
;
import
com.google.android.exoplayer.text.SubtitleView
;
...
...
@@ -446,11 +448,22 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
@Override
public
void
onId3Metadata
(
Map
<
String
,
Object
>
metadata
)
{
for
(
int
i
=
0
;
i
<
metadata
.
size
();
i
++)
{
if
(
metadata
.
containsKey
(
TxxxMetadata
.
TYPE
))
{
TxxxMetadata
txxxMetadata
=
(
TxxxMetadata
)
metadata
.
get
(
TxxxMetadata
.
TYPE
);
Log
.
i
(
TAG
,
String
.
format
(
"ID3 TimedMetadata: description=%s, value=%s"
,
txxxMetadata
.
description
,
txxxMetadata
.
value
));
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
metadata
.
entrySet
())
{
if
(
TxxxMetadata
.
TYPE
.
equals
(
entry
.
getKey
()))
{
TxxxMetadata
txxxMetadata
=
(
TxxxMetadata
)
entry
.
getValue
();
Log
.
i
(
TAG
,
String
.
format
(
"ID3 TimedMetadata %s: description=%s, value=%s"
,
TxxxMetadata
.
TYPE
,
txxxMetadata
.
description
,
txxxMetadata
.
value
));
}
else
if
(
PrivMetadata
.
TYPE
.
equals
(
entry
.
getKey
()))
{
PrivMetadata
privMetadata
=
(
PrivMetadata
)
entry
.
getValue
();
Log
.
i
(
TAG
,
String
.
format
(
"ID3 TimedMetadata %s: owner=%s"
,
PrivMetadata
.
TYPE
,
privMetadata
.
owner
));
}
else
if
(
GeobMetadata
.
TYPE
.
equals
(
entry
.
getKey
()))
{
GeobMetadata
geobMetadata
=
(
GeobMetadata
)
entry
.
getValue
();
Log
.
i
(
TAG
,
String
.
format
(
"ID3 TimedMetadata %s: mimeType=%s, filename=%s, description=%s"
,
GeobMetadata
.
TYPE
,
geobMetadata
.
mimeType
,
geobMetadata
.
filename
,
geobMetadata
.
description
));
}
else
{
Log
.
i
(
TAG
,
String
.
format
(
"ID3 TimedMetadata %s"
,
entry
.
getKey
()));
}
}
}
...
...
demo/src/main/java/com/google/android/exoplayer/demo/Samples.java
View file @
b9addf28
...
...
@@ -123,9 +123,8 @@ import java.util.Locale;
new
Sample
(
"Apple AAC media playlist"
,
"https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear0/"
+
"prog_index.m3u8"
,
DemoUtil
.
TYPE_HLS
),
new
Sample
(
"Apple ID3 metadata"
,
"http://devimages.apple.com/samplecode/adDemo/"
+
"ad.m3u8"
,
DemoUtil
.
TYPE_HLS
),
new
Sample
(
"Apple ID3 metadata"
,
"http://devimages.apple.com/samplecode/adDemo/ad.m3u8"
,
DemoUtil
.
TYPE_HLS
),
};
public
static
final
Sample
[]
MISC
=
new
Sample
[]
{
...
...
library/src/main/java/com/google/android/exoplayer/metadata/Id3Parser.java
View file @
b9addf28
...
...
@@ -100,8 +100,8 @@ public class Id3Parser implements MetadataParser<Map<String, Object>> {
String
description
=
new
String
(
frame
,
descriptionStartIndex
,
descriptionEndIndex
-
descriptionStartIndex
,
charset
);
int
objectDataSize
=
frameSize
-
1
/* encoding byte */
-
descriptionEndIndex
-
delimiterLength
(
encoding
);
int
objectDataSize
=
frameSize
-
1
/* encoding byte */
-
descriptionEndIndex
-
delimiterLength
(
encoding
);
byte
[]
objectData
=
new
byte
[
objectDataSize
];
System
.
arraycopy
(
frame
,
descriptionEndIndex
+
delimiterLength
(
encoding
),
objectData
,
0
,
objectDataSize
);
...
...
@@ -133,13 +133,13 @@ public class Id3Parser implements MetadataParser<Map<String, Object>> {
int
terminationPos
=
indexOf
(
data
,
fromIndex
,
(
byte
)
0
);
// For single byte encoding charsets, we are done
if
(
encodingByte
==
ID3_TEXT_ENCODING_ISO_8859_1
||
encodingByte
==
ID3_TEXT_ENCODING_UTF_8
)
{
if
(
encodingByte
==
ID3_TEXT_ENCODING_ISO_8859_1
||
encodingByte
==
ID3_TEXT_ENCODING_UTF_8
)
{
return
terminationPos
;
}
// Otherwise, look for a two zero bytes
while
(
terminationPos
<
data
.
length
-
1
)
{
if
(
data
[
terminationPos
+
1
]
==
(
byte
)
0
)
{
while
(
terminationPos
<
data
.
length
-
1
)
{
if
(
data
[
terminationPos
+
1
]
==
(
byte
)
0
)
{
return
terminationPos
;
}
terminationPos
=
indexOf
(
data
,
terminationPos
+
1
,
(
byte
)
0
);
...
...
@@ -149,8 +149,8 @@ public class Id3Parser implements MetadataParser<Map<String, Object>> {
}
private
static
int
delimiterLength
(
int
encodingByte
)
{
return
(
encodingByte
==
ID3_TEXT_ENCODING_ISO_8859_1
||
encodingByte
==
ID3_TEXT_ENCODING_UTF_8
)
?
1
:
2
;
return
(
encodingByte
==
ID3_TEXT_ENCODING_ISO_8859_1
||
encodingByte
==
ID3_TEXT_ENCODING_UTF_8
)
?
1
:
2
;
}
/**
...
...
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