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

Commit 2df13053 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

stagefright: add method to MediaCodecInfoWriter to find existing info

This is used to update existing info - e.g. add new aliases.

Bug: 119631295
Change-Id: I7c45f558a507e9c145f26c1f27f6e2adb7b4e4b0
parent 9d301ec7
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -37,6 +37,16 @@ std::unique_ptr<MediaCodecInfoWriter>
            new MediaCodecInfoWriter(info.get()));
}

std::unique_ptr<MediaCodecInfoWriter>
        MediaCodecListWriter::findMediaCodecInfo(const char *name) {
    for (const sp<MediaCodecInfo> &info : mCodecInfos) {
        if (!strcmp(info->getCodecName(), name)) {
            return std::unique_ptr<MediaCodecInfoWriter>(new MediaCodecInfoWriter(info.get()));
        }
    }
    return nullptr;
}

void MediaCodecListWriter::writeGlobalSettings(
        const sp<AMessage> &globalSettings) const {
    for (const std::pair<std::string, std::string> &kv : mGlobalSettings) {
+7 −0
Original line number Diff line number Diff line
@@ -48,6 +48,13 @@ struct MediaCodecListWriter {
     * added `MediaCodecInfo` object.
     */
    std::unique_ptr<MediaCodecInfoWriter> addMediaCodecInfo();
    /**
     * Find an existing `MediaCodecInfo` object for a codec name and return a
     * `MediaCodecInfoWriter` object associated with the found added `MediaCodecInfo`.
     *
     * @return The `MediaCodecInfoWriter` object if found, or nullptr if not found.
     */
    std::unique_ptr<MediaCodecInfoWriter> findMediaCodecInfo(const char *codecName);
private:
    MediaCodecListWriter() = default;