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

Commit 572e6a5c authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change I74bf38a0 into eclair-mr2

* changes:
  Squashed commit of the following:
parents 413f523a e3ec3cec
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#define HARDWARE_API_H_

#include <media/stagefright/OMXPluginBase.h>
#include <media/stagefright/VideoRenderer.h>
#include <ui/ISurface.h>
#include <utils/RefBase.h>
@@ -31,5 +32,7 @@ extern android::VideoRenderer *createRenderer(
        size_t displayWidth, size_t displayHeight,
        size_t decodedWidth, size_t decodedHeight);

extern android::OMXPluginBase *createOMXPlugin();

#endif  // HARDWARE_API_H_
+51 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OMX_PLUGIN_BASE_H_

#define OMX_PLUGIN_BASE_H_

#include <sys/types.h>

#include <OMX_Component.h>

namespace android {

struct OMXComponentBase;

struct OMXPluginBase {
    OMXPluginBase() {}
    virtual ~OMXPluginBase() {}

    virtual OMX_ERRORTYPE makeComponentInstance(
            const char *name,
            const OMX_CALLBACKTYPE *callbacks,
            OMX_PTR appData,
            OMX_COMPONENTTYPE **component) = 0;

    virtual OMX_ERRORTYPE enumerateComponents(
            OMX_STRING name,
            size_t size,
            OMX_U32 index) = 0;

private:
    OMXPluginBase(const OMXPluginBase &);
    OMXPluginBase &operator=(const OMXPluginBase &);
};

}  // namespace android

#endif  // OMX_PLUGIN_BASE_H_
+6 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@

namespace android {

struct OMXMaster;
class OMXNodeInstance;

class OMX : public BnOMX,
@@ -108,9 +109,14 @@ public:

    void invalidateNodeID(node_id node);

protected:
    virtual ~OMX();

private:
    Mutex mLock;

    OMXMaster *mMaster;

    struct CallbackDispatcher;
    sp<CallbackDispatcher> mDispatcher;

+24 −5
Original line number Diff line number Diff line
@@ -11,16 +11,33 @@ LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
LOCAL_SRC_FILES:=                     \
        ColorConverter.cpp            \
	OMX.cpp                       \
        OMXComponentBase.cpp          \
        OMXNodeInstance.cpp           \
        OMXMaster.cpp                 \
        OMXSoftwareCodecsPlugin.cpp   \
        SoftwareRenderer.cpp

ifneq ($(BUILD_WITHOUT_PV),true)
LOCAL_SRC_FILES += \
        OMXPVCodecsPlugin.cpp
else
LOCAL_CFLAGS += -DNO_OPENCORE
endif

LOCAL_SHARED_LIBRARIES :=       \
        libbinder               \
        libmedia                \
        libutils                \
        libui                   \
        libcutils               \
        libcutils

ifneq ($(BUILD_WITHOUT_PV),true)
LOCAL_SHARED_LIBRARIES += \
        libopencore_common
endif

LOCAL_STATIC_LIBRARIES :=       \
        libstagefright_mp3

ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true)
        LOCAL_LDLIBS += -lpthread -ldl
@@ -35,3 +52,5 @@ LOCAL_PRELINK_MODULE:= false
LOCAL_MODULE:= libstagefright_omx

include $(BUILD_SHARED_LIBRARY)

include $(call all-makefiles-under,$(LOCAL_PATH))
+17 −13
Original line number Diff line number Diff line
@@ -18,11 +18,11 @@
#define LOG_TAG "OMX"
#include <utils/Log.h>

#include <dlfcn.h>

#include "../include/OMX.h"
#include "OMXRenderer.h"

#include "pv_omxcore.h"

#include "../include/OMXNodeInstance.h"
#include "../include/SoftwareRenderer.h"

@@ -30,6 +30,8 @@
#include <media/stagefright/MediaDebug.h>
#include <media/stagefright/VideoRenderer.h>

#include "OMXMaster.h"

#include <OMX_Component.h>

namespace android {
@@ -178,10 +180,16 @@ private:
};

OMX::OMX()
    : mDispatcher(new CallbackDispatcher(this)),
    : mMaster(new OMXMaster),
      mDispatcher(new CallbackDispatcher(this)),
      mNodeCounter(0) {
}

OMX::~OMX() {
    delete mMaster;
    mMaster = NULL;
}

void OMX::binderDied(const wp<IBinder> &the_late_who) {
    OMXNodeInstance *instance;

@@ -201,14 +209,12 @@ void OMX::binderDied(const wp<IBinder> &the_late_who) {
}

status_t OMX::listNodes(List<String8> *list) {
    OMX_MasterInit();  // XXX Put this somewhere else.

    list->clear();

    OMX_U32 index = 0;
    char componentName[256];
    while (OMX_MasterComponentNameEnum(componentName, sizeof(componentName), index)
               == OMX_ErrorNone) {
    while (mMaster->enumerateComponents(
                componentName, sizeof(componentName), index) == OMX_ErrorNone) {
        list->push_back(String8(componentName));

        ++index;
@@ -223,14 +229,12 @@ status_t OMX::allocateNode(

    *node = 0;

    OMX_MasterInit();  // XXX Put this somewhere else.

    OMXNodeInstance *instance = new OMXNodeInstance(this, observer);

    OMX_HANDLETYPE handle;
    OMX_ERRORTYPE err = OMX_MasterGetHandle(
            &handle, const_cast<char *>(name), instance,
            &OMXNodeInstance::kCallbacks);
    OMX_COMPONENTTYPE *handle;
    OMX_ERRORTYPE err = mMaster->makeComponentInstance(
            name, &OMXNodeInstance::kCallbacks,
            instance, &handle);

    if (err != OMX_ErrorNone) {
        LOGV("FAILED to allocate omx component '%s'", name);
Loading