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

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

heif: allow files without valid image sequence track to extract

Some heif files advertise 'hevc' brand but don't have valid
image sequence tracks. These are technically non-compliant,
but allow the still images to extract as long as some still
images are found.

Also fix a type in the format conversion code.

bug: 72363209
bug: 63633199
Change-Id: I5b6c486cdccb06c6d45090967650791eb9b513cf
parent fd4fb71b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -606,6 +606,14 @@ status_t MPEG4Extractor::readMetaData() {
                ALOGE("heif image %u has no meta!", imageIndex);
                continue;
            }
            // Some heif files advertise image sequence brands (eg. 'hevc') in
            // ftyp box, but don't have any valid tracks in them. Instead of
            // reporting the entire file as malformed, we override the error
            // to allow still images to be extracted.
            if (err != OK) {
                ALOGW("Extracting still images only");
                err = OK;
            }

            ALOGV("adding HEIF image track %u", imageIndex);
            Track *track = new Track;
+1 −1
Original line number Diff line number Diff line
@@ -667,7 +667,7 @@ status_t convertMetaDataToMessage(
        if (!strncasecmp("image/", mime, 6)) {
            int32_t gridWidth, gridHeight, gridRows, gridCols;
            if (meta->findInt32(kKeyGridWidth, &gridWidth)
                    && meta->findInt32(kKeyHeight, &gridHeight)
                    && meta->findInt32(kKeyGridHeight, &gridHeight)
                    && meta->findInt32(kKeyGridRows, &gridRows)
                    && meta->findInt32(kKeyGridCols, &gridCols)) {
                msg->setInt32("grid-width", gridWidth);