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

Commit ba3e7f5b authored by Chong Zhang's avatar Chong Zhang
Browse files

remove video editor from MediaProfile

bug: 17112465
Change-Id: Id59ba13e9c796298ad7dbaf03a595cc1fa62c169
parent 2d6b6601
Loading
Loading
Loading
Loading
+1 −78
Original line number Diff line number Diff line
@@ -58,24 +58,6 @@ enum camcorder_quality {
    CAMCORDER_QUALITY_HIGH_SPEED_LIST_END = 2005,
};

/**
 * Set CIF as default maximum import and export resolution of video editor.
 * The maximum import and export resolutions are platform specific,
 * which should be defined in media_profiles.xml.
 * Set default maximum prefetch YUV frames to 6, which means video editor can
 * queue up to 6 YUV frames in the video encoder source.
 * This value is used to limit the amount of memory used by video editor
 * engine when the encoder consumes YUV frames at a lower speed
 * than video editor engine produces.
 */
enum videoeditor_capability {
    VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352,
    VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288,
    VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352,
    VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288,
    VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES = 6
};

enum video_decoder {
    VIDEO_DECODER_WMV,
};
@@ -147,32 +129,6 @@ public:
     */
    int getVideoEncoderParamByName(const char *name, video_encoder codec) const;

    /**
     * Returns the value for the given param name for the video editor cap
     * param or -1 if error.
     * Supported param name are:
     * videoeditor.input.width.max - max input video frame width
     * videoeditor.input.height.max - max input video frame height
     * videoeditor.output.width.max - max output video frame width
     * videoeditor.output.height.max - max output video frame height
     * maxPrefetchYUVFrames - max prefetch YUV frames in video editor engine. This value is used
     * to limit the memory consumption.
     */
    int getVideoEditorCapParamByName(const char *name) const;

    /**
     * Returns the value for the given param name for the video editor export codec format
     * param or -1 if error.
     * Supported param name are:
     * videoeditor.export.profile - export video profile
     * videoeditor.export.level - export video level
     * Supported param codec are:
     * 1 for h263
     * 2 for h264
     * 3 for mpeg4
     */
    int getVideoEditorExportParamByName(const char *name, int codec) const;

    /**
     * Returns the audio encoders supported.
     */
@@ -221,7 +177,7 @@ private:

    MediaProfiles& operator=(const MediaProfiles&);  // Don't call me
    MediaProfiles(const MediaProfiles&);             // Don't call me
    MediaProfiles() { mVideoEditorCap = NULL; }        // Dummy default constructor
    MediaProfiles() {}                               // Dummy default constructor
    ~MediaProfiles();                                // Don't delete me

    struct VideoCodec {
@@ -366,31 +322,6 @@ private:
        int mCameraId;
        Vector<int> mLevels;
    };
    struct ExportVideoProfile {
        ExportVideoProfile(int codec, int profile, int level)
            :mCodec(codec),mProfile(profile),mLevel(level) {}
        ~ExportVideoProfile() {}
        int mCodec;
        int mProfile;
        int mLevel;
    };
    struct VideoEditorCap {
        VideoEditorCap(int inFrameWidth, int inFrameHeight,
            int outFrameWidth, int outFrameHeight, int frames)
            : mMaxInputFrameWidth(inFrameWidth),
              mMaxInputFrameHeight(inFrameHeight),
              mMaxOutputFrameWidth(outFrameWidth),
              mMaxOutputFrameHeight(outFrameHeight),
              mMaxPrefetchYUVFrames(frames) {}

        ~VideoEditorCap() {}

        int mMaxInputFrameWidth;
        int mMaxInputFrameHeight;
        int mMaxOutputFrameWidth;
        int mMaxOutputFrameHeight;
        int mMaxPrefetchYUVFrames;
    };

    int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const;
    void initRequiredProfileRefs(const Vector<int>& cameraIds);
@@ -403,7 +334,6 @@ private:
    static void logAudioEncoderCap(const AudioEncoderCap& cap);
    static void logVideoDecoderCap(const VideoDecoderCap& cap);
    static void logAudioDecoderCap(const AudioDecoderCap& cap);
    static void logVideoEditorCap(const VideoEditorCap& cap);

    // If the xml configuration file does exist, use the settings
    // from the xml
@@ -415,9 +345,6 @@ private:
    static VideoDecoderCap* createVideoDecoderCap(const char **atts);
    static VideoEncoderCap* createVideoEncoderCap(const char **atts);
    static AudioEncoderCap* createAudioEncoderCap(const char **atts);
    static VideoEditorCap* createVideoEditorCap(
                const char **atts, MediaProfiles *profiles);
    static ExportVideoProfile* createExportVideoProfile(const char **atts);

    static CamcorderProfile* createCamcorderProfile(
                int cameraId, const char **atts, Vector<int>& cameraIds);
@@ -461,8 +388,6 @@ private:
    static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles);
    static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles);
    static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles);
    static void createDefaultVideoEditorCap(MediaProfiles *profiles);
    static void createDefaultExportVideoProfiles(MediaProfiles *profiles);

    static VideoEncoderCap* createDefaultH263VideoEncoderCap();
    static VideoEncoderCap* createDefaultM4vVideoEncoderCap();
@@ -520,8 +445,6 @@ private:

    RequiredProfiles *mRequiredProfileRefs;
    Vector<int>              mCameraIds;
    VideoEditorCap* mVideoEditorCap;
    Vector<ExportVideoProfile*> mVideoEditorExportProfiles;
};

}; // namespace android
+0 −126
Original line number Diff line number Diff line
@@ -152,16 +152,6 @@ MediaProfiles::logAudioDecoderCap(const MediaProfiles::AudioDecoderCap& cap UNUS
    ALOGV("codec = %d", cap.mCodec);
}

/*static*/ void
MediaProfiles::logVideoEditorCap(const MediaProfiles::VideoEditorCap& cap UNUSED)
{
    ALOGV("videoeditor cap:");
    ALOGV("mMaxInputFrameWidth = %d", cap.mMaxInputFrameWidth);
    ALOGV("mMaxInputFrameHeight = %d", cap.mMaxInputFrameHeight);
    ALOGV("mMaxOutputFrameWidth = %d", cap.mMaxOutputFrameWidth);
    ALOGV("mMaxOutputFrameHeight = %d", cap.mMaxOutputFrameHeight);
}

/*static*/ int
MediaProfiles::findTagForName(const MediaProfiles::NameToTagMap *map, size_t nMappings,
        const char *name)
@@ -398,42 +388,6 @@ void MediaProfiles::addStartTimeOffset(int cameraId, const char** atts)
    ALOGV("%s: cameraId=%d, offset=%d ms", __func__, cameraId, offsetTimeMs);
    mStartTimeOffsets.replaceValueFor(cameraId, offsetTimeMs);
}
/*static*/ MediaProfiles::ExportVideoProfile*
MediaProfiles::createExportVideoProfile(const char **atts)
{
    CHECK(!strcmp("name", atts[0]) &&
          !strcmp("profile", atts[2]) &&
          !strcmp("level", atts[4]));

    const size_t nMappings =
        sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]);
    const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]);
    CHECK(codec != -1);

    MediaProfiles::ExportVideoProfile *profile =
        new MediaProfiles::ExportVideoProfile(
            codec, atoi(atts[3]), atoi(atts[5]));

    return profile;
}
/*static*/ MediaProfiles::VideoEditorCap*
MediaProfiles::createVideoEditorCap(const char **atts, MediaProfiles *profiles)
{
    CHECK(!strcmp("maxInputFrameWidth", atts[0]) &&
          !strcmp("maxInputFrameHeight", atts[2])  &&
          !strcmp("maxOutputFrameWidth", atts[4]) &&
          !strcmp("maxOutputFrameHeight", atts[6]) &&
          !strcmp("maxPrefetchYUVFrames", atts[8]));

    MediaProfiles::VideoEditorCap *pVideoEditorCap =
        new MediaProfiles::VideoEditorCap(atoi(atts[1]), atoi(atts[3]),
                atoi(atts[5]), atoi(atts[7]), atoi(atts[9]));

    logVideoEditorCap(*pVideoEditorCap);
    profiles->mVideoEditorCap = pVideoEditorCap;

    return pVideoEditorCap;
}

/*static*/ void
MediaProfiles::startElementHandler(void *userData, const char *name, const char **atts)
@@ -465,10 +419,6 @@ MediaProfiles::startElementHandler(void *userData, const char *name, const char
            createCamcorderProfile(profiles->mCurrentCameraId, atts, profiles->mCameraIds));
    } else if (strcmp("ImageEncoding", name) == 0) {
        profiles->addImageEncodingQualityLevel(profiles->mCurrentCameraId, atts);
    } else if (strcmp("VideoEditorCap", name) == 0) {
        createVideoEditorCap(atts, profiles);
    } else if (strcmp("ExportVideoProfile", name) == 0) {
        profiles->mVideoEditorExportProfiles.add(createExportVideoProfile(atts));
    }
}

@@ -873,32 +823,6 @@ MediaProfiles::createDefaultImageEncodingQualityLevels(MediaProfiles *profiles)
    profiles->mImageEncodingQualityLevels.add(levels);
}

/*static*/ void
MediaProfiles::createDefaultVideoEditorCap(MediaProfiles *profiles)
{
    profiles->mVideoEditorCap =
        new MediaProfiles::VideoEditorCap(
                VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH,
                VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT,
                VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH,
                VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT,
                VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES);
}
/*static*/ void
MediaProfiles::createDefaultExportVideoProfiles(MediaProfiles *profiles)
{
    // Create default video export profiles
    profiles->mVideoEditorExportProfiles.add(
        new ExportVideoProfile(VIDEO_ENCODER_H263,
            OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level10));
    profiles->mVideoEditorExportProfiles.add(
        new ExportVideoProfile(VIDEO_ENCODER_MPEG_4_SP,
            OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level1));
    profiles->mVideoEditorExportProfiles.add(
        new ExportVideoProfile(VIDEO_ENCODER_H264,
            OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel13));
}

/*static*/ MediaProfiles*
MediaProfiles::createDefaultInstance()
{
@@ -910,8 +834,6 @@ MediaProfiles::createDefaultInstance()
    createDefaultAudioDecoders(profiles);
    createDefaultEncoderOutputFileFormats(profiles);
    createDefaultImageEncodingQualityLevels(profiles);
    createDefaultVideoEditorCap(profiles);
    createDefaultExportVideoProfiles(profiles);
    return profiles;
}

@@ -1009,54 +931,6 @@ int MediaProfiles::getVideoEncoderParamByName(const char *name, video_encoder co
    ALOGE("The given video encoder param name %s is not found", name);
    return -1;
}
int MediaProfiles::getVideoEditorExportParamByName(
    const char *name, int codec) const
{
    ALOGV("getVideoEditorExportParamByName: name %s codec %d", name, codec);
    ExportVideoProfile *exportProfile = NULL;
    int index = -1;
    for (size_t i =0; i < mVideoEditorExportProfiles.size(); i++) {
        exportProfile = mVideoEditorExportProfiles[i];
        if (exportProfile->mCodec == codec) {
            index = i;
            break;
        }
    }
    if (index == -1) {
        ALOGE("The given video decoder %d is not found", codec);
        return -1;
    }
    if (!strcmp("videoeditor.export.profile", name))
        return exportProfile->mProfile;
    if (!strcmp("videoeditor.export.level", name))
        return exportProfile->mLevel;

    ALOGE("The given video editor export param name %s is not found", name);
    return -1;
}
int MediaProfiles::getVideoEditorCapParamByName(const char *name) const
{
    ALOGV("getVideoEditorCapParamByName: %s", name);

    if (mVideoEditorCap == NULL) {
        ALOGE("The mVideoEditorCap is not created, then create default cap.");
        createDefaultVideoEditorCap(sInstance);
    }

    if (!strcmp("videoeditor.input.width.max", name))
        return mVideoEditorCap->mMaxInputFrameWidth;
    if (!strcmp("videoeditor.input.height.max", name))
        return mVideoEditorCap->mMaxInputFrameHeight;
    if (!strcmp("videoeditor.output.width.max", name))
        return mVideoEditorCap->mMaxOutputFrameWidth;
    if (!strcmp("videoeditor.output.height.max", name))
        return mVideoEditorCap->mMaxOutputFrameHeight;
    if (!strcmp("maxPrefetchYUVFrames", name))
        return mVideoEditorCap->mMaxPrefetchYUVFrames;

    ALOGE("The given video editor param name %s is not found", name);
    return -1;
}

Vector<audio_encoder> MediaProfiles::getAudioEncoders() const
{