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

Commit f4449eea authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Propagate haptic channels metadata through MediaFormat in MediaPlayer...

Merge "Propagate haptic channels metadata through MediaFormat in MediaPlayer so that the presence of haptic channels can be determined without re-opening the source with a MediaExtractor."
parents 68caf3cc b3de207e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -992,6 +992,11 @@ sp<AMessage> NuPlayer::GenericSource::getTrackInfo(size_t trackIndex) const {
        format->setInt32("auto", !!isAutoselect);
        format->setInt32("default", !!isDefault);
        format->setInt32("forced", !!isForced);
    } else if (trackType == MEDIA_TRACK_TYPE_AUDIO) {
        int32_t hapticChannelCount;
        if (meta->findInt32(kKeyHapticChannelCount, &hapticChannelCount)) {
            format->setInt32("haptic-channel-count", hapticChannelCount);
        }
    }

    return format;
+7 −0
Original line number Diff line number Diff line
@@ -555,6 +555,13 @@ void NuPlayer::writeTrackInfo(
        reply->writeInt32(isAuto);
        reply->writeInt32(isDefault);
        reply->writeInt32(isForced);
    } else if (trackType == MEDIA_TRACK_TYPE_AUDIO) {
        int32_t hapticChannelCount;
        bool hasHapticChannels = format->findInt32("haptic-channel-count", &hapticChannelCount);
        reply->writeInt32(hasHapticChannels);
        if (hasHapticChannels) {
            reply->writeInt32(hapticChannelCount);
        }
    }
}