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
a74fd17e
authored
Oct 26, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Handle curle braces in SystemID UUID.
Issue: #863
parent
21c1b8ca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
0 deletions
library/src/androidTest/assets/smoothstreaming/sample_ismc_1
library/src/androidTest/assets/smoothstreaming/sample_ismc_2
library/src/androidTest/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParserTest.java
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParser.java
library/src/androidTest/assets/smoothstreaming/sample_ismc_1
0 → 100755
View file @
a74fd17e
<?xml version="1.0" encoding="UTF-8"?>
<SmoothStreamingMedia
MajorVersion=
"2"
MinorVersion=
"0"
Duration=
"2300000000"
TimeScale=
"10000000"
>
<Protection>
<ProtectionHeader
SystemID=
"9A04F079-9840-4286-AB92-E65BE0885F95"
>
<!-- Base 64-Encoded data omitted for clarity -->
</ProtectionHeader>
</Protection>
<StreamIndex
Type =
"video"
Chunks =
"115"
QualityLevels =
"2"
MaxWidth =
"720"
MaxHeight =
"480"
TimeScale=
"10000000"
Url =
"QualityLevels({bitrate},{CustomAttributes})/Fragments(video={start_time})"
Name =
"video"
>
<QualityLevel
Index=
"0"
Bitrate=
"1536000"
FourCC=
"WVC1"
MaxWidth=
"720"
MaxHeight=
"480"
CodecPrivateData =
"270000010FCBEE1670EF8A16783BF180C9089CC4AFA11C0000010E1207F840"
>
<CustomAttributes>
<Attribute
Name =
"Compatibility"
Value =
"Desktop"
/>
</CustomAttributes>
</QualityLevel>
<QualityLevel
Index=
"5"
Bitrate=
"307200"
FourCC=
"WVC1"
MaxWidth=
"720"
MaxHeight=
"480"
CodecPrivateData =
"270000010FCBEE1670EF8A16783BF180C9089CC4AFA11C0000010E1207F840"
>
<CustomAttributes>
<Attribute
Name =
"Compatibility"
Value =
"Handheld"
/>
</CustomAttributes>
</QualityLevel>
<c
t =
"0"
d =
"19680000"
/>
<c
n =
"1"
t =
"19680000"
d=
"8980000"
/>
</StreamIndex>
</SmoothStreamingMedia>
library/src/androidTest/assets/smoothstreaming/sample_ismc_2
0 → 100755
View file @
a74fd17e
<?xml version="1.0" encoding="UTF-8"?>
<SmoothStreamingMedia
MajorVersion=
"2"
MinorVersion=
"0"
Duration=
"2300000000"
TimeScale=
"10000000"
>
<Protection>
<ProtectionHeader
SystemID=
"{9A04F079-9840-4286-AB92-E65BE0885F95}"
>
<!-- Base 64-Encoded data omitted for clarity -->
</ProtectionHeader>
</Protection>
<StreamIndex
Type =
"video"
Chunks =
"115"
QualityLevels =
"2"
MaxWidth =
"720"
MaxHeight =
"480"
TimeScale=
"10000000"
Url =
"QualityLevels({bitrate},{CustomAttributes})/Fragments(video={start_time})"
Name =
"video"
>
<QualityLevel
Index=
"0"
Bitrate=
"1536000"
FourCC=
"WVC1"
MaxWidth=
"720"
MaxHeight=
"480"
CodecPrivateData =
"270000010FCBEE1670EF8A16783BF180C9089CC4AFA11C0000010E1207F840"
>
<CustomAttributes>
<Attribute
Name =
"Compatibility"
Value =
"Desktop"
/>
</CustomAttributes>
</QualityLevel>
<QualityLevel
Index=
"5"
Bitrate=
"307200"
FourCC=
"WVC1"
MaxWidth=
"720"
MaxHeight=
"480"
CodecPrivateData =
"270000010FCBEE1670EF8A16783BF180C9089CC4AFA11C0000010E1207F840"
>
<CustomAttributes>
<Attribute
Name =
"Compatibility"
Value =
"Handheld"
/>
</CustomAttributes>
</QualityLevel>
<c
t =
"0"
d =
"19680000"
/>
<c
n =
"1"
t =
"19680000"
d=
"8980000"
/>
</StreamIndex>
</SmoothStreamingMedia>
library/src/androidTest/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParserTest.java
0 → 100644
View file @
a74fd17e
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
google
.
android
.
exoplayer
.
smoothstreaming
;
import
android.test.InstrumentationTestCase
;
import
java.io.IOException
;
import
java.io.InputStream
;
/**
* Unit tests for {@link SmoothStreamingManifestParser}.
*/
public
class
SmoothStreamingManifestParserTest
extends
InstrumentationTestCase
{
private
static
final
String
SAMPLE_ISMC_1
=
"smoothstreaming/sample_ismc_1"
;
private
static
final
String
SAMPLE_ISMC_2
=
"smoothstreaming/sample_ismc_2"
;
public
void
testParseSmoothStreamingManifest
()
throws
IOException
{
SmoothStreamingManifestParser
parser
=
new
SmoothStreamingManifestParser
();
// Simple test to ensure that the sample manifest parses without throwing any exceptions.
// SystemID UUID in the manifest is not wrapped in braces.
InputStream
inputStream1
=
getInstrumentation
().
getContext
().
getResources
().
getAssets
().
open
(
SAMPLE_ISMC_1
);
parser
.
parse
(
"https://example.com/test.ismc"
,
inputStream1
);
// Simple test to ensure that the sample manifest parses without throwing any exceptions.
// SystemID UUID in the manifest is wrapped in braces.
InputStream
inputStream2
=
getInstrumentation
().
getContext
().
getResources
().
getAssets
().
open
(
SAMPLE_ISMC_2
);
parser
.
parse
(
"https://example.com/test.ismc"
,
inputStream2
);
}
}
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParser.java
View file @
a74fd17e
...
...
@@ -404,6 +404,7 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser<SmoothS
if
(
TAG_PROTECTION_HEADER
.
equals
(
parser
.
getName
()))
{
inProtectionHeader
=
true
;
String
uuidString
=
parser
.
getAttributeValue
(
null
,
KEY_SYSTEM_ID
);
uuidString
=
stripCurlyBraces
(
uuidString
);
uuid
=
UUID
.
fromString
(
uuidString
);
}
}
...
...
@@ -427,6 +428,12 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser<SmoothS
return
new
ProtectionElement
(
uuid
,
PsshAtomUtil
.
buildPsshAtom
(
uuid
,
initData
));
}
private
static
String
stripCurlyBraces
(
String
uuidString
)
{
if
(
uuidString
.
charAt
(
0
)
==
'{'
&&
uuidString
.
charAt
(
uuidString
.
length
()
-
1
)
==
'}'
)
{
uuidString
=
uuidString
.
substring
(
1
,
uuidString
.
length
()
-
1
);
}
return
uuidString
;
}
}
private
static
class
StreamElementParser
extends
ElementParser
{
...
...
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