Matroska: HEVC support

Matroska HEVC support is based on AVC but with
HEVC headers stored in the codec private configuration data.

Test: Play Matroska media file with HEVC codec video.
Bug: 65147780

Change-Id: I5c426123513cf367b87d8fa64630068bbba7cdf1
gugelfrei
Patrik2 Carlsson 11 years ago committed by Takahiro Aizawa
parent 809ea9d9cc
commit f69544accb

@ -139,6 +139,7 @@ private:
enum Type {
AVC,
AAC,
HEVC,
OTHER
};
@ -147,7 +148,7 @@ private:
Type mType;
bool mIsAudio;
BlockIterator mBlockIter;
ssize_t mNALSizeLen; // for type AVC
ssize_t mNALSizeLen; // for type AVC or HEVC
List<MediaBuffer *> mPendingFrames;
@ -243,6 +244,19 @@ MatroskaSource::MatroskaSource(
} else {
ALOGE("No mNALSizeLen");
}
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_HEVC)) {
mType = HEVC;
uint32_t dummy;
const uint8_t *hvcc;
size_t hvccSize;
if (meta->findData(kKeyHVCC, &dummy, (const void **)&hvcc, &hvccSize)
&& hvccSize >= 22u) {
mNALSizeLen = 1 + (hvcc[14+7] & 3);
ALOGV("mNALSizeLen = %zu", mNALSizeLen);
} else {
ALOGE("No mNALSizeLen");
}
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC)) {
mType = AAC;
}
@ -670,7 +684,7 @@ status_t MatroskaSource::read(
MediaBuffer *frame = *mPendingFrames.begin();
mPendingFrames.erase(mPendingFrames.begin());
if (mType != AVC || mNALSizeLen == 0) {
if ((mType != AVC && mType != HEVC) || mNALSizeLen == 0) {
if (targetSampleTimeUs >= 0ll) {
frame->meta_data()->setInt64(
kKeyTargetTime, targetSampleTimeUs);
@ -1204,6 +1218,14 @@ void MatroskaExtractor::addTracks() {
if (!strcmp("V_MPEG4/ISO/AVC", codecID)) {
meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_AVC);
meta->setData(kKeyAVCC, 0, codecPrivate, codecPrivateSize);
} else if (!strcmp("V_MPEGH/ISO/HEVC", codecID)) {
meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_VIDEO_HEVC);
if (codecPrivateSize > 0) {
meta->setData(kKeyHVCC, kTypeHVCC, codecPrivate, codecPrivateSize);
} else {
ALOGW("HEVC is detected, but does not have configuration.");
continue;
}
} else if (!strcmp("V_MPEG4/ISO/ASP", codecID)) {
if (codecPrivateSize > 0) {
meta->setCString(

Loading…
Cancel
Save