summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG4Extractor.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-11-11 15:34:21 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-11 15:34:21 +0000
commit023132eac2f2e2e0aa8859231cce1a6d324242fd (patch)
tree157565f7f422b42fe15cd23118079a70dd528ab1 /media/libstagefright/MPEG4Extractor.cpp
parent0bb80204f457e1f948e47abacd86fae9ee687de4 (diff)
parentcb432e65fd876b8b210f548c07b230517450b3b9 (diff)
downloadframeworks_av-023132eac2f2e2e0aa8859231cce1a6d324242fd.zip
frameworks_av-023132eac2f2e2e0aa8859231cce1a6d324242fd.tar.gz
frameworks_av-023132eac2f2e2e0aa8859231cce1a6d324242fd.tar.bz2
am 510180f1: am 08e42967: Merge "Add support for retrieving location information in mp4/3gpp files" into ics-mr1
* commit '510180f162dee3ae5416a98caa07f58a754f4b3f': Add support for retrieving location information in mp4/3gpp files
Diffstat (limited to 'media/libstagefright/MPEG4Extractor.cpp')
-rw-r--r--media/libstagefright/MPEG4Extractor.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 1b286fa..7b6fa38 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -1136,6 +1136,41 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
break;
}
+ // @xyz
+ case FOURCC('\xA9', 'x', 'y', 'z'):
+ {
+ // Best case the total data length inside "@xyz" box
+ // would be 8, for instance "@xyz" + "\x00\x04\x15\xc7" + "0+0/",
+ // where "\x00\x04" is the text string length with value = 4,
+ // "\0x15\xc7" is the language code = en, and "0+0" is a
+ // location (string) value with longitude = 0 and latitude = 0.
+ if (chunk_data_size < 8) {
+ return ERROR_MALFORMED;
+ }
+
+ // Worst case the location string length would be 18,
+ // for instance +90.0000-180.0000, without the trailing "/" and
+ // the string length + language code.
+ char buffer[18];
+
+ // Substracting 5 from the data size is because the text string length +
+ // language code takes 4 bytes, and the trailing slash "/" takes 1 byte.
+ off64_t location_length = chunk_data_size - 5;
+ if (location_length >= (off64_t) sizeof(buffer)) {
+ return ERROR_MALFORMED;
+ }
+
+ if (mDataSource->readAt(
+ data_offset + 4, buffer, location_length) < location_length) {
+ return ERROR_IO;
+ }
+
+ buffer[location_length] = '\0';
+ mFileMetaData->setCString(kKeyLocation, buffer);
+ *offset += chunk_size;
+ break;
+ }
+
case FOURCC('e', 's', 'd', 's'):
{
if (chunk_data_size < 4) {