Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88107427 authored by Chong Zhang's avatar Chong Zhang
Browse files

Copy slow-motion related metadata to AMediaExtractor_getFileFormat

SEF slo-mo extract will put the slo-mo marker on file meta (instead
of track meta). Passthrough the slo-mo marker as well as layer count
on the NuMediaExtractor's getFileFormat.

bug: 160260201
test: locally apply the SEF extractor patch, and verify that
AMediaExtractor_getFileFormat can retrieve the slo-mo markers
and layer count info for SEF slo-mo clips.

Change-Id: I6497ec50ad8662425376d6c1924f75fd495fd71d
parent 358a0844
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -312,6 +312,27 @@ status_t NuMediaExtractor::getFileFormat(sp<AMessage> *format) const {
        (*format)->setBuffer("pssh", buf);
    }

    // Copy over the slow-motion related metadata
    const void *slomoMarkers;
    size_t slomoMarkersSize;
    if (meta->findData(kKeySlowMotionMarkers, &type, &slomoMarkers, &slomoMarkersSize)
            && slomoMarkersSize > 0) {
        sp<ABuffer> buf = new ABuffer(slomoMarkersSize);
        memcpy(buf->data(), slomoMarkers, slomoMarkersSize);
        (*format)->setBuffer("slow-motion-markers", buf);
    }

    int32_t temporalLayerCount;
    if (meta->findInt32(kKeyTemporalLayerCount, &temporalLayerCount)
            && temporalLayerCount > 0) {
        (*format)->setInt32("temporal-layer-count", temporalLayerCount);
    }

    float captureFps;
    if (meta->findFloat(kKeyCaptureFramerate, &captureFps) && captureFps > 0.0f) {
        (*format)->setFloat("capture-rate", captureFps);
    }

    return OK;
}