The MatroskaExtractor will now publish a different mime-type "video/webm" if
the doctype of the matroska file indicates that it is a webm file.
Change-Id: I467f597690a841043ecd11d2a2cae93351820f1b
related-to-bug: 5042137
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index e1b9991..3ef7b71 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -493,7 +493,8 @@
: mDataSource(source),
mReader(new DataSourceReader(mDataSource)),
mSegment(NULL),
- mExtractedThumbnails(false) {
+ mExtractedThumbnails(false),
+ mIsWebm(false) {
off64_t size;
mIsLiveStreaming =
(mDataSource->flags()
@@ -507,6 +508,10 @@
return;
}
+ if (ebmlHeader.m_docType && !strcmp("webm", ebmlHeader.m_docType)) {
+ mIsWebm = true;
+ }
+
long long ret =
mkvparser::Segment::CreateInstance(mReader, pos, mSegment);
@@ -757,7 +762,10 @@
sp<MetaData> MatroskaExtractor::getMetaData() {
sp<MetaData> meta = new MetaData;
- meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_CONTAINER_MATROSKA);
+
+ meta->setCString(
+ kKeyMIMEType,
+ mIsWebm ? "video/webm" : MEDIA_MIMETYPE_CONTAINER_MATROSKA);
return meta;
}
diff --git a/media/libstagefright/matroska/MatroskaExtractor.h b/media/libstagefright/matroska/MatroskaExtractor.h
index 38ebd61..1294b4f 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.h
+++ b/media/libstagefright/matroska/MatroskaExtractor.h
@@ -68,6 +68,7 @@
mkvparser::Segment *mSegment;
bool mExtractedThumbnails;
bool mIsLiveStreaming;
+ bool mIsWebm;
void addTracks();
void findThumbnails();