How to register alac decoder to multimedia framework?

179 Views Asked by At

Inside mp4 extractor we added support to parse ALAC encoded frames. Added SoftOMXComponent for ALAC decoder

Following files we modified for decoder MIME type registration:

  1. OMXUtils.cpp inside function GetComponentRole() added below code: static const MimeToRole kMimeToRole[] = { { "audio/alac","audio_decoder.alac", "audio_encoder.alac" },}

  2. In SoftOMXPlugin.cpp added { "OMX.google.alac.decoder", "allgoalacdec", "audio_decoder.alac" } to kComponents[]

  3. In media_codecs_google_audio.xml Added an entry for ALAC as below:

  4. Inside media/libstagefright/Utils.cpp Added an entry for ALAC at

    static const struct mime_conv_t mimeLookup[] = { { "audio/alac", AUDIO_FORMAT_ALAC}, }

5.Inside /libstagefright/ACodec.cpp at: status_t ACodec::configureCodec() Added for ALAC

else if (!strcasecmp(mime, "audio/alac")) {
    int32_t numChannels;
    int32_t sampleRate;
    if (!msg->findInt32("channel-count", &numChannels)
            || !msg->findInt32("sample-rate", &sampleRate)) {
        /* We do not want to setup the ALAC codec.Let the
         * Plugin do all the work*/
        err = OK;
    } else {
        err = setupRawAudioFormat(
                kPortIndexOutput,
                sampleRate,
                numChannels);
        err = OK;
    }
}

And Inside status_t:

ACodec::getPortFormat(){

    case OMX_AUDIO_CodingALAC:
        {
            OMX_AUDIO_PARAM_ALACTYPE params;

            InitOMXParams(&params);

            params.nPortIndex = portIndex;


            err = mOMXNode->getParameter(

                    (OMX_INDEXTYPE)OMX_IndexParamAudioAlac, &params, sizeof(params));

            if (err != OK) {

                return err;

            }

            notify->setString("mime", "audio/alac");

            notify->setInt32("channel-count", params.nChannels);

            notify->setInt32("sample-rate", params.nSamplingRate);

            // notify->setInt32("bits-per-sample", params.nBitsPerSample);

            break;

        }
}

We added above changes and build libstagefright and copied to board also media_codecs_google_audio.xml copied to hardware's /vendor/etc

But still we getting below error:

NuPlayerDecoder: Failed to create audio/alac decoder

0

There are 0 best solutions below