diff options
author | Chong Zhang <chz@google.com> | 2015-04-10 22:41:56 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2015-04-14 11:39:16 -0700 |
commit | a0d0ba51ad60a68117a0ee78e37ab78715b8a069 (patch) | |
tree | 8d7555285a426fd3b77b93fcfd550dc5c1e9f0c2 /media/libstagefright/httplive/M3UParser.cpp | |
parent | db93079daf06a94e50622d0383b9ed8e767e2f92 (diff) | |
download | frameworks_av-a0d0ba51ad60a68117a0ee78e37ab78715b8a069.zip frameworks_av-a0d0ba51ad60a68117a0ee78e37ab78715b8a069.tar.gz frameworks_av-a0d0ba51ad60a68117a0ee78e37ab78715b8a069.tar.bz2 |
HLS: parse stream resolution and set maxWidth/maxHeight
bug: 20160436
Change-Id: Ic3adb84d3c65cc65f62fc509a99d09602db862a1
Diffstat (limited to 'media/libstagefright/httplive/M3UParser.cpp')
-rw-r--r-- | media/libstagefright/httplive/M3UParser.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp index 7bb7f2c..ef9145c 100644 --- a/media/libstagefright/httplive/M3UParser.cpp +++ b/media/libstagefright/httplive/M3UParser.cpp @@ -808,6 +808,29 @@ status_t M3UParser::parseStreamInf( *meta = new AMessage; } (*meta)->setString(key.c_str(), codecs.c_str()); + } else if (!strcasecmp("resolution", key.c_str())) { + const char *s = val.c_str(); + char *end; + unsigned long width = strtoul(s, &end, 10); + + if (end == s || *end != 'x') { + // malformed + continue; + } + + s = end + 1; + unsigned long height = strtoul(s, &end, 10); + + if (end == s || *end != '\0') { + // malformed + continue; + } + + if (meta->get() == NULL) { + *meta = new AMessage; + } + (*meta)->setInt32("width", width); + (*meta)->setInt32("height", height); } else if (!strcasecmp("audio", key.c_str()) || !strcasecmp("video", key.c_str()) || !strcasecmp("subtitles", key.c_str())) { |