From 9641a8e47588357baa0de8b967e809e5cdf1901f Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Sat, 29 Nov 2014 11:43:23 -0800 Subject: stagefright: Support HEVC tracks in Matroska containers * Pass the HVCC atom to Stagefright. Change-Id: I7fdca25e20b9051925936a34e594808b18a3a3bd --- media/libstagefright/matroska/MatroskaExtractor.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'media/libstagefright/matroska') diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp index e6ed900..2143e35 100644 --- a/media/libstagefright/matroska/MatroskaExtractor.cpp +++ b/media/libstagefright/matroska/MatroskaExtractor.cpp @@ -136,6 +136,7 @@ private: enum Type { AVC, AAC, + HEVC, OTHER }; @@ -234,6 +235,18 @@ MatroskaSource::MatroskaSource( mNALSizeLen = 1 + (avcc[4] & 3); ALOGV("mNALSizeLen = %zu", mNALSizeLen); + } else if (!strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_HEVC)) { + mType = HEVC; + + uint32_t type; + const void *data; + size_t size; + CHECK(meta->findData(kKeyHVCC, &type, &data, &size)); + + const uint8_t *ptr = (const uint8_t *)data; + CHECK(size >= 7); + mNALSizeLen = 1 + (ptr[14 + 7] & 3); + ALOGV("mNALSizeLen = %zu", mNALSizeLen); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC)) { mType = AAC; } @@ -603,7 +616,7 @@ status_t MatroskaSource::read( MediaBuffer *frame = *mPendingFrames.begin(); mPendingFrames.erase(mPendingFrames.begin()); - if (mType != AVC) { + if (mType != AVC && mType != HEVC) { if (targetSampleTimeUs >= 0ll) { frame->meta_data()->setInt64( kKeyTargetTime, targetSampleTimeUs); @@ -1001,6 +1014,10 @@ void MatroskaExtractor::addTracks() { codecID); continue; } + } else if (!strcmp("V_MPEGH/ISO/HEVC", codecID)) { + meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_HEVC); + meta->setData(kKeyHVCC, 0, codecPrivate, codecPrivateSize); + } else if (!strcmp("V_VP8", codecID)) { meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_VP8); } else if (!strcmp("V_VP9", codecID)) { -- cgit v1.1