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

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

Merge "AAudio: add IEC61937 support."

parents 9cbb81ce ca6a3f4a
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -103,7 +103,23 @@ enum {
     *
     * Available since API level 31.
     */
    AAUDIO_FORMAT_PCM_I32
    AAUDIO_FORMAT_PCM_I32,

    /**
     * This format is used for compressed audio wrapped in IEC61937 for HDMI
     * or S/PDIF passthrough.
     *
     * Unlike PCM playback, the Android framework is not able to do format
     * conversion for IEC61937. In that case, when IEC61937 is requested, sampling
     * rate and channel count or channel mask must be specified. Otherwise, it may
     * fail when opening the stream. Apps are able to get the correct configuration
     * for the playback by calling
     * <a href="/reference/android/media/AudioManager#getDevices(int)">
     *   AudioManager#getDevices(int)</a>.
     *
     * Available since API level 34.
     */
    AAUDIO_FORMAT_IEC61937

};
typedef int32_t aaudio_format_t;
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ static aaudio_result_t isFormatValid(audio_format_t format) {
        case AUDIO_FORMAT_PCM_32_BIT:
        case AUDIO_FORMAT_PCM_FLOAT:
        case AUDIO_FORMAT_PCM_24_BIT_PACKED:
        case AUDIO_FORMAT_IEC61937:
            break; // valid
        default:
            ALOGD("audioFormat not valid, audio_format_t = 0x%08x", format);
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ const char* AudioGlobal_convertFormatToText(aaudio_format_t format) {
        AAUDIO_CASE_ENUM(AAUDIO_FORMAT_PCM_FLOAT);
        AAUDIO_CASE_ENUM(AAUDIO_FORMAT_PCM_I24_PACKED);
        AAUDIO_CASE_ENUM(AAUDIO_FORMAT_PCM_I32);
        AAUDIO_CASE_ENUM(AAUDIO_FORMAT_IEC61937);
    }
    return "Unrecognized";
}
+5 −0
Original line number Diff line number Diff line
@@ -192,6 +192,11 @@ aaudio_result_t AudioStreamBuilder::build(AudioStream** streamPtr) {
        allowMMap = false;
    }

    if (getFormat() == AUDIO_FORMAT_IEC61937) {
        ALOGD("%s IEC61937 format is selected, do not allow MMAP in this case.", __func__);
        allowMMap = false;
    }

    if (!allowMMap && !allowLegacy) {
        ALOGE("%s() no backend available: neither MMAP nor legacy path are allowed", __func__);
        return AAUDIO_ERROR_ILLEGAL_ARGUMENT;
+6 −0
Original line number Diff line number Diff line
@@ -140,6 +140,9 @@ audio_format_t AAudioConvert_aaudioToAndroidDataFormat(aaudio_format_t aaudioFor
    case AAUDIO_FORMAT_PCM_I32:
        androidFormat = AUDIO_FORMAT_PCM_32_BIT;
        break;
    case AAUDIO_FORMAT_IEC61937:
        androidFormat = AUDIO_FORMAT_IEC61937;
        break;
    default:
        androidFormat = AUDIO_FORMAT_INVALID;
        ALOGE("%s() 0x%08X unrecognized", __func__, aaudioFormat);
@@ -166,6 +169,9 @@ aaudio_format_t AAudioConvert_androidToAAudioDataFormat(audio_format_t androidFo
    case AUDIO_FORMAT_PCM_32_BIT:
        aaudioFormat = AAUDIO_FORMAT_PCM_I32;
        break;
    case AUDIO_FORMAT_IEC61937:
        aaudioFormat = AAUDIO_FORMAT_IEC61937;
        break;
    default:
        aaudioFormat = AAUDIO_FORMAT_INVALID;
        ALOGE("%s() 0x%08X unrecognized", __func__, androidFormat);