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

Commit 96a875ef authored by Lajos Molnar's avatar Lajos Molnar
Browse files

stagefright: allow selecting codec by name in SimpleDecodingSource

Bug: 17108024
Change-Id: I78f2ef45ec6cf746535e05f4166717829e642b19
parent 65dd3eee
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -43,9 +43,11 @@ public:
    // case the source will return empty buffers.
    // This source cannot be restarted (hence the name "Simple"), all reads are blocking, and
    // does not support secure input or pausing.
    // if |desiredCodec| is given, use this specific codec.
    static sp<SimpleDecodingSource> Create(
            const sp<MediaSource> &source, uint32_t flags = 0,
            const sp<ANativeWindow> &nativeWindow = NULL);
            const sp<ANativeWindow> &nativeWindow = NULL,
            const char *desiredCodec = NULL);

    virtual ~SimpleDecodingSource();

+5 −1
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ const int64_t kTimeoutWaitForOutputUs = 500000; // 0.5 seconds

//static
sp<SimpleDecodingSource> SimpleDecodingSource::Create(
        const sp<MediaSource> &source, uint32_t flags, const sp<ANativeWindow> &nativeWindow) {
        const sp<MediaSource> &source, uint32_t flags, const sp<ANativeWindow> &nativeWindow,
        const char *desiredCodec) {
    sp<Surface> surface = static_cast<Surface*>(nativeWindow.get());
    const char *mime = NULL;
    sp<MetaData> meta = source->getFormat();
@@ -55,6 +56,9 @@ sp<SimpleDecodingSource> SimpleDecodingSource::Create(

    for (size_t i = 0; i < matchingCodecs.size(); ++i) {
        const AString &componentName = matchingCodecs[i];
        if (desiredCodec != NULL && componentName.compare(desiredCodec)) {
            continue;
        }

        ALOGV("Attempting to allocate codec '%s'", componentName.c_str());