summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/httplive/M3UParser.cpp
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-03-07 02:42:14 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-07 02:42:14 +0000
commit8d1caa026caef3673799481c5fba454306f831e9 (patch)
tree654e8de748a437c7d25550381ff7c0c8015fe40e /media/libstagefright/httplive/M3UParser.cpp
parent04352de2e32d6dc0901436951f69357f5cd8655c (diff)
parent49ea13379fb15ddb73183ebafa3a377342ef932f (diff)
downloadframeworks_av-8d1caa026caef3673799481c5fba454306f831e9.zip
frameworks_av-8d1caa026caef3673799481c5fba454306f831e9.tar.gz
frameworks_av-8d1caa026caef3673799481c5fba454306f831e9.tar.bz2
am 49ea1337: Merge changes I787e1c05,I72d3a5e1,I0a5cc65f,I75fc2a25,I2c2be08d, ... into klp-dev
* commit '49ea13379fb15ddb73183ebafa3a377342ef932f': LiveSession: Use the actual, possibly redirected url as base in the M3U M3UParser: Skip query strings when looking for the last slash in a URL ChromiumHTTPDataSource: Keep track of the redirected URL Initial HLS seamless switch implementation. NuPlayer side support for seamless format switch. LiveSession refactor PlaylistFetcher: Add support for block-by-block decryption. LiveSession: Add support for block-by-block fetchFile.
Diffstat (limited to 'media/libstagefright/httplive/M3UParser.cpp')
-rw-r--r--media/libstagefright/httplive/M3UParser.cpp46
1 files changed, 22 insertions, 24 deletions
diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp
index ef0dcee..4c2c1f4 100644
--- a/media/libstagefright/httplive/M3UParser.cpp
+++ b/media/libstagefright/httplive/M3UParser.cpp
@@ -388,18 +388,6 @@ bool M3UParser::getTypeURI(size_t index, const char *key, AString *uri) const {
return true;
}
-bool M3UParser::getAudioURI(size_t index, AString *uri) const {
- return getTypeURI(index, "audio", uri);
-}
-
-bool M3UParser::getVideoURI(size_t index, AString *uri) const {
- return getTypeURI(index, "video", uri);
-}
-
-bool M3UParser::getSubtitleURI(size_t index, AString *uri) const {
- return getTypeURI(index, "subtitles", uri);
-}
-
static bool MakeURL(const char *baseURL, const char *url, AString *out) {
out->clear();
@@ -435,22 +423,32 @@ static bool MakeURL(const char *baseURL, const char *url, AString *out) {
} else {
// URL is a relative path
- size_t n = strlen(baseURL);
- if (baseURL[n - 1] == '/') {
- out->setTo(baseURL);
- out->append(url);
+ // Check for a possible query string
+ const char *qsPos = strchr(baseURL, '?');
+ size_t end;
+ if (qsPos != NULL) {
+ end = qsPos - baseURL;
} else {
- const char *slashPos = strrchr(baseURL, '/');
-
- if (slashPos > &baseURL[6]) {
- out->setTo(baseURL, slashPos - baseURL);
- } else {
- out->setTo(baseURL);
+ end = strlen(baseURL);
+ }
+ // Check for the last slash before a potential query string
+ for (ssize_t pos = end - 1; pos >= 0; pos--) {
+ if (baseURL[pos] == '/') {
+ end = pos;
+ break;
}
+ }
- out->append("/");
- out->append(url);
+ // Check whether the found slash actually is part of the path
+ // and not part of the "http://".
+ if (end > 6) {
+ out->setTo(baseURL, end);
+ } else {
+ out->setTo(baseURL);
}
+
+ out->append("/");
+ out->append(url);
}
ALOGV("base:'%s', url:'%s' => '%s'", baseURL, url, out->c_str());