summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/httplive/M3UParser.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-03-21 16:28:04 -0700
committerAndreas Huber <andih@google.com>2011-03-21 16:34:02 -0700
commit0a73d81f213fb2d6f2fdd59c4dda047bf453bb1c (patch)
treeeab2ea363949c1b7f356fc4b921e48137d2db775 /media/libstagefright/httplive/M3UParser.cpp
parent7b55c7ce1d8f187430d0b6bda68378f549930289 (diff)
downloadframeworks_av-0a73d81f213fb2d6f2fdd59c4dda047bf453bb1c.zip
frameworks_av-0a73d81f213fb2d6f2fdd59c4dda047bf453bb1c.tar.gz
frameworks_av-0a73d81f213fb2d6f2fdd59c4dda047bf453bb1c.tar.bz2
Enable http-live support for https:// urls, fix a parsing issue.
Change-Id: I2284e1d62babde7f739fba6a3cb4e2619f0e62f9 related-to-bug: 4148291
Diffstat (limited to 'media/libstagefright/httplive/M3UParser.cpp')
-rw-r--r--media/libstagefright/httplive/M3UParser.cpp27
1 files changed, 25 insertions, 2 deletions
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();
}