diff options
author | Andreas Huber <andih@google.com> | 2011-03-21 16:28:04 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-03-21 16:45:25 -0700 |
commit | 8505f2fe1e4fd94878d57169dd7fdc10c9633f62 (patch) | |
tree | f75099b583655d5446896957af8c35ff9cd3b607 /media | |
parent | e2c32e9f966cf9f2c9ed94bf0703344a2cca284b (diff) | |
download | frameworks_base-8505f2fe1e4fd94878d57169dd7fdc10c9633f62.zip frameworks_base-8505f2fe1e4fd94878d57169dd7fdc10c9633f62.tar.gz frameworks_base-8505f2fe1e4fd94878d57169dd7fdc10c9633f62.tar.bz2 |
DO NOT MERGE: Enable http-live support for https:// urls, fix a parsing issue.
Change-Id: Ic683201dcfcd11fb4bccfeefc63427a4c9bfabb4
related-to-bug: 4148291
Diffstat (limited to 'media')
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerService.cpp | 3 | ||||
-rw-r--r-- | media/libstagefright/httplive/M3UParser.cpp | 27 |
2 files changed, 27 insertions, 3 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index a42cca5..0156634 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -744,7 +744,8 @@ player_type getPlayerType(const char* url) return TEST_PLAYER; } - if (!strncasecmp("http://", url, 7)) { + if (!strncasecmp("http://", url, 7) + || !strncasecmp("https://", url, 8)) { size_t len = strlen(url); if (len >= 5 && !strcasecmp(".m3u8", &url[len - 5])) { return NU_PLAYER; diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp index 95f6741..2eb180a 100644 --- a/media/libstagefright/httplive/M3UParser.cpp +++ b/media/libstagefright/httplive/M3UParser.cpp @@ -20,8 +20,8 @@ #include "include/M3UParser.h" +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/foundation/AMessage.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaErrors.h> namespace android { @@ -306,6 +306,29 @@ status_t M3UParser::parseStreamInf( return OK; } +// Find the next occurence of the character "what" at or after "offset", +// but ignore occurences between quotation marks. +// Return the index of the occurrence or -1 if not found. +static ssize_t FindNextUnquoted( + const AString &line, char what, size_t offset) { + CHECK_NE((int)what, (int)'"'); + + bool quoted = false; + while (offset < line.size()) { + char c = line.c_str()[offset]; + + if (c == '"') { + quoted = !quoted; + } else if (c == what && !quoted) { + return offset; + } + + ++offset; + } + + return -1; +} + // static status_t M3UParser::parseCipherInfo( const AString &line, sp<AMessage> *meta, const AString &baseURI) { @@ -318,7 +341,7 @@ status_t M3UParser::parseCipherInfo( size_t offset = colonPos + 1; while (offset < line.size()) { - ssize_t end = line.find(",", offset); + ssize_t end = FindNextUnquoted(line, ',', offset); if (end < 0) { end = line.size(); } |