diff options
author | Patrik2 Carlsson <patrik2.carlsson@sonyericsson.com> | 2012-08-17 15:16:50 +0200 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2014-10-20 13:54:37 -0700 |
commit | a64683d281909c2abe7ecf32a819e7256aaa36f1 (patch) | |
tree | 3fd2cf0ab25820085bf61d4d837147e39904f5b5 | |
parent | 786f859ba06c6be93f744de532a5201403d854a7 (diff) | |
download | frameworks_av-a64683d281909c2abe7ecf32a819e7256aaa36f1.tar.gz frameworks_av-a64683d281909c2abe7ecf32a819e7256aaa36f1.tar.bz2 frameworks_av-a64683d281909c2abe7ecf32a819e7256aaa36f1.zip |
Support MPEG4 and H263 FourCC types in Matroska files
Handles MPEG4 and H263 content with FourCC header in Matroska files
based on how these are handled in the AVI parser.
Also adding placehoders for DivX.
Change-Id: I38b2c2fd429b6e4810a7b118bf60823d502320ae
-rw-r--r-- | media/libstagefright/matroska/MatroskaExtractor.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp index 022205dc2a..fec682cce4 100644 --- a/media/libstagefright/matroska/MatroskaExtractor.cpp +++ b/media/libstagefright/matroska/MatroskaExtractor.cpp @@ -41,6 +41,20 @@ namespace android { +typedef struct { + uint32_t biSize; + uint32_t biWidth; + uint32_t biHeight; + uint16_t biPlanes; + uint16_t biBitCount; + uint32_t biCompression; + uint32_t biSizeImage; + uint32_t biXPelsPerMeter; + uint32_t biYPelsPerMeter; + uint32_t biClrUsed; + uint32_t biClrImportant; +} BITMAPINFOHEADER; + struct DataSourceReader : public mkvparser::IMkvReader { DataSourceReader(const sp<DataSource> &source) : mSource(source) { @@ -974,6 +988,49 @@ void MatroskaExtractor::addTracks() { meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_VP8); } else if (!strcmp("V_VP9", codecID)) { meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_VP9); + } else if (!strcmp("V_MS/VFW/FOURCC", codecID)) { + if (codecPrivateSize >= sizeof(BITMAPINFOHEADER)) { + char *fourcc = (char *) &((BITMAPINFOHEADER *) codecPrivate)->biCompression; + + switch (FOURCC(fourcc[0], fourcc[1], fourcc[2], fourcc[3])) { + case 'XVID': + case 'xvid': + case 'FMP4': + case 'fmp4': + case 'MP4V': + case 'mp4v': + meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_MPEG4); + break; + case 'H263': + case 'h263': + meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_H263); + break; + case 'DIV3': + case 'div3': + case 'DIV4': + case 'div4': + ALOGW("DivX 3.11 codec not supported"); + continue; + case 'DIVX': + case 'divx': + ALOGW("DivX 4 codec not supported"); + continue; + case 'DX50': + case 'dx50': + ALOGW("DivX 5 codec not supported"); + continue; + case 'MP42': + default: + ALOGW("fourcc id: %hhX%hhX%hhX%hhX is not supported\n", + fourcc[0], fourcc[1], fourcc[2], fourcc[3]); + continue; + } + + ALOGV("fourcc id: %.4s", fourcc); + } else { + ALOGW("fourcc size: %d is not supported\n", codecPrivateSize); + continue; + } } else { ALOGW("%s is not supported.", codecID); continue; |