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

Commit 61f6cfa9 authored by Mingming Yin's avatar Mingming Yin Committed by Satish Kamuju
Browse files

audio: add support for extended audio encoding

- add support for EVRC, QCELP, and LPCM encoding.

Change-Id: I2f93a88ed5c9bd502399ef145a5802d1a15fcc45
parent ae614d22
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -74,6 +74,9 @@ enum output_format {
    /* VP8/VORBIS data in a WEBM container */
    OUTPUT_FORMAT_WEBM = 9,

    OUTPUT_FORMAT_QCP = 20,
    OUTPUT_FORMAT_WAVE = 21,

    OUTPUT_FORMAT_LIST_END // must be last - used to validate format type
};

@@ -86,6 +89,10 @@ enum audio_encoder {
    AUDIO_ENCODER_AAC_ELD = 5,
    AUDIO_ENCODER_VORBIS = 6,

    AUDIO_ENCODER_EVRC = 10,
    AUDIO_ENCODER_QCELP = 11,
    AUDIO_ENCODER_LPCM = 12,

    AUDIO_ENCODER_LIST_END // must be the last - used to validate the audio encoder type
};

+16 −8
Original line number Diff line number Diff line
@@ -821,8 +821,10 @@ status_t StagefrightRecorder::prepareInternal() {
            break;

        default:
            if (handleCustomRecording() != OK) {
                ALOGE("Unsupported output file format: %d", mOutputFormat);
                status = UNKNOWN_ERROR;
            }
            break;
    }

@@ -886,8 +888,10 @@ status_t StagefrightRecorder::start() {

        default:
        {
            if (handleCustomOutputFormats() != OK) {
                ALOGE("Unsupported output file format: %d", mOutputFormat);
                status = UNKNOWN_ERROR;
            }
            break;
        }
    }
@@ -972,9 +976,11 @@ sp<MediaSource> StagefrightRecorder::createAudioSource() {
            break;

        default:
            if (handleCustomAudioSource(format) != OK) {
                ALOGE("Unknown audio encoder: %d", mAudioEncoder);
                return NULL;
            }
    }

    int32_t maxInputSize;
    CHECK(audioSource->getFormat()->findInt32(
@@ -1638,9 +1644,11 @@ status_t StagefrightRecorder::setupAudioEncoder(const sp<MediaWriter>& writer) {
            break;

        default:
            if (handleCustomAudioEncoder() != OK) {
                ALOGE("Unsupported audio encoder: %d", mAudioEncoder);
                return UNKNOWN_ERROR;
            }
    }

    sp<MediaSource> audioEncoder = createAudioSource();
    if (audioEncoder == NULL) {
+4 −0
Original line number Diff line number Diff line
@@ -186,6 +186,10 @@ protected:
    void clipNumberOfAudioChannels();
    void setDefaultProfileIfNecessary();
    virtual void setDefaultVideoEncoderIfNecessary();
    virtual status_t handleCustomOutputFormats() {return UNKNOWN_ERROR;}
    virtual status_t handleCustomRecording() {return UNKNOWN_ERROR;}
    virtual status_t handleCustomAudioSource(sp<AMessage> /*format*/) {return UNKNOWN_ERROR;}
    virtual status_t handleCustomAudioEncoder() {return UNKNOWN_ERROR;}


    StagefrightRecorder(const StagefrightRecorder &);