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

Commit 575c277d authored by Daniel Bonnevier's avatar Daniel Bonnevier Committed by Tomoharu Kasahara
Browse files

Return bits per sample and sample rate as metadata

Makes it possible to retrieve bits per sample and
sample rate by metadata retriever.

Bug: 112986969
Test: Check if sample rate and bits per sample can be retrieved

Change-Id: Iaefb0ad51c08a5abb4ba60c5eed50697c78fa70b
parent 887cb9ea
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ enum {
    METADATA_KEY_COLOR_STANDARD  = 35,
    METADATA_KEY_COLOR_TRANSFER  = 36,
    METADATA_KEY_COLOR_RANGE     = 37,
    METADATA_KEY_SAMPLERATE      = 38,
    METADATA_KEY_BITS_PER_SAMPLE = 39,

    // Add more here...
};
+13 −0
Original line number Diff line number Diff line
@@ -550,6 +550,19 @@ void StagefrightMetadataRetriever::parseMetaData() {
                if (!trackMeta->findInt32(kKeyBitRate, &audioBitrate)) {
                    audioBitrate = -1;
                }

                int32_t bitsPerSample = -1;
                int32_t sampleRate = -1;
                trackMeta->findInt32(kKeyBitsPerSample, &bitsPerSample);
                trackMeta->findInt32(kKeySampleRate, &sampleRate);
                if (bitsPerSample >= 0) {
                    sprintf(tmp, "%d", bitsPerSample);
                    mMetaData.add(METADATA_KEY_BITS_PER_SAMPLE, String8(tmp));
                }
                if (sampleRate >= 0) {
                    sprintf(tmp, "%d", sampleRate);
                    mMetaData.add(METADATA_KEY_SAMPLERATE, String8(tmp));
                }
            } else if (!hasVideo && !strncasecmp("video/", mime, 6)) {
                hasVideo = true;