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

Commit ac27b63b authored by Steve Kondik's avatar Steve Kondik
Browse files

stagefright: Move a bunch of FFMPEG stuff out of here

 * Get rid of some of the glue code for stagefright-plugins
   and use the new extension header and plugin.
 * Still a bunch of TODOs on this, but it works.

Change-Id: If07d3213952b624d48035e5f58ad883b2a4049b0
parent d5627156
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -230,6 +230,10 @@ LOCAL_C_INCLUDES += \
	$(TOP)/hardware/samsung/exynos4/include
endif

# FFMPEG plugin
LOCAL_C_INCLUDES += \
	$(TOP)/external/stagefright-plugins/include

LOCAL_MODULE:= libstagefright

LOCAL_MODULE_TAGS := optional
+8 −6
Original line number Diff line number Diff line
@@ -56,7 +56,8 @@ namespace android {
static void *loadExtractorPlugin() {
    void *ret = NULL;
    char lib[PROPERTY_VALUE_MAX];
    if (property_get("media.stagefright.extractor-plugin", lib, "libFFmpegExtractor.so")) {
    if (property_get("media.sf.extractor-plugin", lib, NULL)) {
        if (lib != NULL) {
            if (void *extractorLib = ::dlopen(lib, RTLD_LAZY)) {
                ret = ::dlsym(extractorLib, "getExtractorPlugin");
                ALOGW_IF(!ret, "Failed to find symbol, dlerror: %s", ::dlerror());
@@ -64,6 +65,7 @@ static void *loadExtractorPlugin() {
                ALOGV("Failed to load %s, dlerror: %s", lib, ::dlerror());
            }
        }
    }
    return ret;
}

+16 −14
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@
#include <OMX_AudioExt.h>
#include <OMX_IndexExt.h>

#include <OMX_FFMPEG_Extn.h>

namespace android {

void FFMPEGSoftCodec::convertMessageToMetaData(
@@ -226,13 +228,13 @@ status_t FFMPEGSoftCodec::setVideoFormat(
            *compressionFormat = OMX_VIDEO_CodingRV;
        }
    } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_VC1, mime)) {
        *compressionFormat = OMX_VIDEO_CodingVC1;
        *compressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingVC1;
    } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_FLV1, mime)) {
        *compressionFormat = OMX_VIDEO_CodingFLV1;
        *compressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingFLV1;
    } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX, mime)) {
        *compressionFormat = OMX_VIDEO_CodingDIVX;
        *compressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingDIVX;
    } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_HEVC, mime)) {
        *compressionFormat = OMX_VIDEO_CodingHEVC;
        *compressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingHEVC;
    } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_FFMPEG, mime)) {
        ALOGV("Setting the OMX_VIDEO_PARAM_FFMPEGTYPE params");
        err = setFFmpegVideoFormat(msg, OMXhandle, nodeID);
@@ -502,7 +504,7 @@ status_t FFMPEGSoftCodec::setFFmpegVideoFormat(
    param.nPortIndex = kPortIndexInput;

    status_t err = OMXhandle->getParameter(
            nodeID, OMX_IndexParamVideoFFmpeg, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamVideoFFmpeg, &param, sizeof(param));
    if (err != OK)
        return err;

@@ -511,7 +513,7 @@ status_t FFMPEGSoftCodec::setFFmpegVideoFormat(
    param.nHeight  = height;

    err = OMXhandle->setParameter(
            nodeID, OMX_IndexParamVideoFFmpeg, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamVideoFFmpeg, &param, sizeof(param));
    return err;
}

@@ -776,7 +778,7 @@ status_t FFMPEGSoftCodec::setMP2Format(
    param.nPortIndex = kPortIndexInput;

    err = OMXhandle->getParameter(
            nodeID, OMX_IndexParamAudioMp2, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamAudioMp2, &param, sizeof(param));
    if (err != OK)
        return err;

@@ -784,7 +786,7 @@ status_t FFMPEGSoftCodec::setMP2Format(
    param.nSampleRate = sampleRate;

    return OMXhandle->setParameter(
            nodeID, OMX_IndexParamAudioMp2, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamAudioMp2, &param, sizeof(param));
}

status_t FFMPEGSoftCodec::setAC3Format(
@@ -843,7 +845,7 @@ status_t FFMPEGSoftCodec::setAPEFormat(
    param.nPortIndex = kPortIndexInput;

    err = OMXhandle->getParameter(
            nodeID, OMX_IndexParamAudioApe, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamAudioApe, &param, sizeof(param));
    if (err != OK)
        return err;

@@ -852,7 +854,7 @@ status_t FFMPEGSoftCodec::setAPEFormat(
    param.nBitsPerSample = bitsPerSample;

    return OMXhandle->setParameter(
            nodeID, OMX_IndexParamAudioApe, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamAudioApe, &param, sizeof(param));
}

status_t FFMPEGSoftCodec::setDTSFormat(
@@ -877,7 +879,7 @@ status_t FFMPEGSoftCodec::setDTSFormat(
    param.nPortIndex = kPortIndexInput;

    err = OMXhandle->getParameter(
            nodeID, OMX_IndexParamAudioDts, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamAudioDts, &param, sizeof(param));
    if (err != OK)
        return err;

@@ -885,7 +887,7 @@ status_t FFMPEGSoftCodec::setDTSFormat(
    param.nSamplingRate = sampleRate;

    return OMXhandle->setParameter(
            nodeID, OMX_IndexParamAudioDts, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamAudioDts, &param, sizeof(param));
}

status_t FFMPEGSoftCodec::setFFmpegAudioFormat(
@@ -921,7 +923,7 @@ status_t FFMPEGSoftCodec::setFFmpegAudioFormat(
    param.nPortIndex = kPortIndexInput;

    err = OMXhandle->getParameter(
            nodeID, OMX_IndexParamAudioFFmpeg, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamAudioFFmpeg, &param, sizeof(param));
    if (err != OK)
        return err;

@@ -934,7 +936,7 @@ status_t FFMPEGSoftCodec::setFFmpegAudioFormat(
    param.eSampleFormat  = sampleFormat;

    return OMXhandle->setParameter(
            nodeID, OMX_IndexParamAudioFFmpeg, &param, sizeof(param));
            nodeID, (OMX_INDEXTYPE)OMX_IndexParamAudioFFmpeg, &param, sizeof(param));
}

}
+0 −23
Original line number Diff line number Diff line
@@ -71,29 +71,6 @@ static const struct {
    const char *mRole;

} kComponents[] = {
    { "OMX.ffmpeg.mpeg2.decoder", "ffmpegvdec", "video_decoder.mpeg2" },
    { "OMX.ffmpeg.h263.decoder", "ffmpegvdec", "video_decoder.h263" },
    { "OMX.ffmpeg.mpeg4.decoder", "ffmpegvdec", "video_decoder.mpeg4" },
    { "OMX.ffmpeg.wmv.decoder", "ffmpegvdec", "video_decoder.wmv" },
    { "OMX.ffmpeg.rv.decoder", "ffmpegvdec", "video_decoder.rv" },
    { "OMX.ffmpeg.h264.decoder", "ffmpegvdec", "video_decoder.avc" },
    { "OMX.ffmpeg.vp8.decoder", "ffmpegvdec", "video_decoder.vp8" },
    { "OMX.ffmpeg.vc1.decoder", "ffmpegvdec", "video_decoder.vc1" },
    { "OMX.ffmpeg.flv1.decoder", "ffmpegvdec", "video_decoder.flv1" },
    { "OMX.ffmpeg.divx.decoder", "ffmpegvdec", "video_decoder.divx" },
    { "OMX.ffmpeg.hevc.decoder", "ffmpegvdec", "video_decoder.hevc" },
    { "OMX.ffmpeg.vtrial.decoder", "ffmpegvdec", "video_decoder.trial" },
    { "OMX.ffmpeg.aac.decoder", "ffmpegadec", "audio_decoder.aac" },
    { "OMX.ffmpeg.mp3.decoder", "ffmpegadec", "audio_decoder.mp3" },
    { "OMX.ffmpeg.vorbis.decoder", "ffmpegadec", "audio_decoder.vorbis" },
    { "OMX.ffmpeg.wma.decoder", "ffmpegadec", "audio_decoder.wma" },
    { "OMX.ffmpeg.ra.decoder", "ffmpegadec", "audio_decoder.ra" },
    { "OMX.ffmpeg.flac.decoder", "ffmpegadec", "audio_decoder.flac" },
    { "OMX.ffmpeg.mp2.decoder", "ffmpegadec", "audio_decoder.mp2" },
    { "OMX.ffmpeg.ac3.decoder", "ffmpegadec", "audio_decoder.ac3" },
    { "OMX.ffmpeg.ape.decoder", "ffmpegadec", "audio_decoder.ape" },
    { "OMX.ffmpeg.dts.decoder", "ffmpegadec", "audio_decoder.dts" },
    { "OMX.ffmpeg.atrial.decoder", "ffmpegadec", "audio_decoder.trial" },
    { "OMX.google.aac.decoder", "aacdec", "audio_decoder.aac" },
    { "OMX.google.aac.encoder", "aacenc", "audio_encoder.aac" },
    { "OMX.google.amrnb.decoder", "amrdec", "audio_decoder.amrnb" },