Use tokens for IOmxNode.
Test: Mirroring, Camera, Photos, YouTube and Play Movies apps.
Bug: 35442034
Change-Id: I0e43ec57d0f37c71d41652fd9883b72650433e20
diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk
index ad70470..ff5e5d3 100644
--- a/cmds/stagefright/Android.mk
+++ b/cmds/stagefright/Android.mk
@@ -12,7 +12,6 @@
libjpeg libgui libcutils liblog \
libhidlmemory \
android.hardware.media.omx@1.0 \
- android.hardware.media.omx@1.0-utils \
LOCAL_C_INCLUDES:= \
frameworks/av/media/libstagefright \
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index ffa09eb..4d8dd3c 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -65,7 +65,7 @@
#include <gui/SurfaceComposerClient.h>
#include <android/hardware/media/omx/1.0/IOmx.h>
-#include <omx/hal/1.0/utils/WOmx.h>
+#include <media/omx/1.0/WOmx.h>
using namespace android;
diff --git a/media/libstagefright/omx/hal/1.0/utils/Conversion.h b/include/media/omx/1.0/Conversion.h
similarity index 99%
rename from media/libstagefright/omx/hal/1.0/utils/Conversion.h
rename to include/media/omx/1.0/Conversion.h
index c4876ac..ee83713 100644
--- a/media/libstagefright/omx/hal/1.0/utils/Conversion.h
+++ b/include/media/omx/1.0/Conversion.h
@@ -29,12 +29,12 @@
#include <binder/Binder.h>
#include <binder/Status.h>
#include <ui/FenceTime.h>
-#include <media/OMXFenceParcelable.h>
#include <cutils/native_handle.h>
#include <gui/IGraphicBufferProducer.h>
+#include <media/OMXFenceParcelable.h>
#include <media/OMXBuffer.h>
-#include <VideoAPI.h>
+#include <media/hardware/VideoAPI.h>
#include <android/hidl/memory/1.0/IMemory.h>
#include <android/hardware/media/omx/1.0/types.h>
diff --git a/media/libstagefright/omx/hal/1.0/utils/WGraphicBufferSource.h b/include/media/omx/1.0/WGraphicBufferSource.h
similarity index 99%
rename from media/libstagefright/omx/hal/1.0/utils/WGraphicBufferSource.h
rename to include/media/omx/1.0/WGraphicBufferSource.h
index 1090d52..7c80c2e 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WGraphicBufferSource.h
+++ b/include/media/omx/1.0/WGraphicBufferSource.h
@@ -20,8 +20,8 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
-#include <media/IOMX.h>
#include <binder/Binder.h>
+#include <media/IOMX.h>
#include <android/hardware/graphics/common/1.0/types.h>
#include <android/hardware/media/omx/1.0/IOmxNode.h>
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmx.h b/include/media/omx/1.0/WOmx.h
similarity index 97%
rename from media/libstagefright/omx/hal/1.0/utils/WOmx.h
rename to include/media/omx/1.0/WOmx.h
index 7860f46..4aaf470 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WOmx.h
+++ b/include/media/omx/1.0/WOmx.h
@@ -20,7 +20,7 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
-#include "../../../../include/OMXNodeInstance.h"
+#include <media/IOMX.h>
#include <android/hardware/media/omx/1.0/IOmx.h>
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxBufferProducer.h b/include/media/omx/1.0/WOmxBufferProducer.h
similarity index 100%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxBufferProducer.h
rename to include/media/omx/1.0/WOmxBufferProducer.h
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxBufferSource.h b/include/media/omx/1.0/WOmxBufferSource.h
similarity index 98%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxBufferSource.h
rename to include/media/omx/1.0/WOmxBufferSource.h
index 086f648..86322da 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WOmxBufferSource.h
+++ b/include/media/omx/1.0/WOmxBufferSource.h
@@ -21,7 +21,7 @@
#include <hidl/Status.h>
#include <binder/Binder.h>
-#include <media/OMXFenceParcelable.h>
+#include <OMXFenceParcelable.h>
#include <android/hardware/media/omx/1.0/IOmxBufferSource.h>
#include <android/BnOMXBufferSource.h>
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxNode.h b/include/media/omx/1.0/WOmxNode.h
similarity index 96%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxNode.h
rename to include/media/omx/1.0/WOmxNode.h
index 46dfb49..3176a65 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WOmxNode.h
+++ b/include/media/omx/1.0/WOmxNode.h
@@ -20,9 +20,9 @@
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
+#include <binder/HalToken.h>
#include <utils/Errors.h>
-
-#include "../../../../include/OMXNodeInstance.h"
+#include <media/IOMX.h>
#include <android/hardware/media/omx/1.0/IOmxNode.h>
#include <android/hardware/media/omx/1.0/IOmxObserver.h>
@@ -59,9 +59,8 @@
* - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object.
*/
-struct LWOmxNode : public BnOMXNode {
- sp<IOmxNode> mBase;
- LWOmxNode(sp<IOmxNode> const& base);
+struct LWOmxNode : public H2BConverter<IOmxNode, IOMXNode, BnOMXNode> {
+ LWOmxNode(sp<IOmxNode> const& base) : CBase(base) {}
status_t freeNode() override;
status_t sendCommand(
OMX_COMMANDTYPE cmd, OMX_S32 param) override;
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxObserver.h b/include/media/omx/1.0/WOmxObserver.h
similarity index 100%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxObserver.h
rename to include/media/omx/1.0/WOmxObserver.h
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxProducerListener.h b/include/media/omx/1.0/WOmxProducerListener.h
similarity index 100%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxProducerListener.h
rename to include/media/omx/1.0/WOmxProducerListener.h
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index eac532b..c057cf5 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -55,15 +55,36 @@
OMXBuffer.cpp \
Visualizer.cpp \
StringArray.cpp \
+ omx/1.0/WGraphicBufferSource.cpp \
+ omx/1.0/WOmx.cpp \
+ omx/1.0/WOmxBufferProducer.cpp \
+ omx/1.0/WOmxBufferSource.cpp \
+ omx/1.0/WOmxNode.cpp \
+ omx/1.0/WOmxObserver.cpp \
+ omx/1.0/WOmxProducerListener.cpp \
LOCAL_SHARED_LIBRARIES := \
libui liblog libcutils libutils libbinder libsonivox libicuuc libicui18n libexpat \
libcamera_client libstagefright_foundation \
libgui libdl libaudioutils libaudioclient \
libmedia_helper libmediadrm \
+ libbase \
libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ libhidlmemory \
+ android.hidl.base@1.0 \
+ android.hidl.memory@1.0 \
+ android.hardware.graphics.common@1.0 \
+ android.hardware.media@1.0 \
+ android.hardware.media.omx@1.0 \
-LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder libsonivox libmediadrm
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \
+ libbinder \
+ libsonivox \
+ libmediadrm \
+ android.hardware.media.omx@1.0 \
+ android.hidl.memory@1.0 \
# for memory heap analysis
LOCAL_STATIC_LIBRARIES := libc_malloc_debug_backtrace libc_logging
@@ -76,8 +97,9 @@
$(TOP)/system/libhidl/base/include \
$(TOP)/frameworks/native/include/media/openmax \
$(TOP)/frameworks/av/include/media/ \
- $(TOP)/frameworks/av/media/libstagefright \
$(TOP)/frameworks/av/media/libmedia/aidl \
+ $(TOP)/frameworks/av/include \
+ $(TOP)/frameworks/native/include \
$(call include-path-for, audio-utils)
LOCAL_EXPORT_C_INCLUDE_DIRS := \
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp
index 67939b2..223ca6b 100644
--- a/media/libmedia/IOMX.cpp
+++ b/media/libmedia/IOMX.cpp
@@ -29,6 +29,7 @@
#include <utils/NativeHandle.h>
#include <gui/IGraphicBufferProducer.h>
+#include <omx/1.0/WOmxNode.h>
#include <android/IGraphicBufferSource.h>
#include <android/IOMXBufferSource.h>
@@ -448,8 +449,115 @@
}
};
+using ::android::hardware::media::omx::V1_0::utils::LWOmxNode;
+class HpOMXNode : public HpInterface<BpOMXNode, LWOmxNode> {
+public:
+ HpOMXNode(const sp<IBinder>& base) : PBase(base) {}
+
+ virtual status_t freeNode() {
+ return mBase->freeNode();
+ }
+
+ virtual status_t sendCommand(
+ OMX_COMMANDTYPE cmd, OMX_S32 param) {
+ return mBase->sendCommand(cmd, param);
+ }
+
+ virtual status_t getParameter(
+ OMX_INDEXTYPE index, void *params, size_t size) {
+ return mBase->getParameter(index, params, size);
+ }
+
+ virtual status_t setParameter(
+ OMX_INDEXTYPE index, const void *params, size_t size) {
+ return mBase->setParameter(index, params, size);
+ }
+
+ virtual status_t getConfig(
+ OMX_INDEXTYPE index, void *params, size_t size) {
+ return mBase->getConfig(index, params, size);
+ }
+
+ virtual status_t setConfig(
+ OMX_INDEXTYPE index, const void *params, size_t size) {
+ return mBase->setConfig(index, params, size);
+ }
+
+ virtual status_t setPortMode(
+ OMX_U32 port_index, IOMX::PortMode mode) {
+ return mBase->setPortMode(port_index, mode);
+ }
+
+ virtual status_t prepareForAdaptivePlayback(
+ OMX_U32 portIndex, OMX_BOOL enable,
+ OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight) {
+ return mBase->prepareForAdaptivePlayback(
+ portIndex, enable, maxFrameWidth, maxFrameHeight);
+ }
+
+ virtual status_t configureVideoTunnelMode(
+ OMX_U32 portIndex, OMX_BOOL tunneled,
+ OMX_U32 audioHwSync, native_handle_t **sidebandHandle) {
+ return mBase->configureVideoTunnelMode(
+ portIndex, tunneled, audioHwSync, sidebandHandle);
+ }
+
+ virtual status_t getGraphicBufferUsage(
+ OMX_U32 port_index, OMX_U32* usage) {
+ return mBase->getGraphicBufferUsage(port_index, usage);
+ }
+
+ virtual status_t setInputSurface(
+ const sp<IOMXBufferSource> &bufferSource) {
+ return mBase->setInputSurface(bufferSource);
+ }
+
+ virtual status_t allocateSecureBuffer(
+ OMX_U32 port_index, size_t size, buffer_id *buffer,
+ void **buffer_data, sp<NativeHandle> *native_handle) {
+ return mBase->allocateSecureBuffer(
+ port_index, size, buffer, buffer_data, native_handle);
+ }
+
+ virtual status_t useBuffer(
+ OMX_U32 port_index, const OMXBuffer &omxBuf, buffer_id *buffer) {
+ return mBase->useBuffer(port_index, omxBuf, buffer);
+ }
+
+ virtual status_t freeBuffer(
+ OMX_U32 port_index, buffer_id buffer) {
+ return mBase->freeBuffer(port_index, buffer);
+ }
+
+ virtual status_t fillBuffer(
+ buffer_id buffer, const OMXBuffer &omxBuf, int fenceFd = -1) {
+ return mBase->fillBuffer(buffer, omxBuf, fenceFd);
+ }
+
+ virtual status_t emptyBuffer(
+ buffer_id buffer, const OMXBuffer &omxBuf,
+ OMX_U32 flags, OMX_TICKS timestamp, int fenceFd = -1) {
+ return mBase->emptyBuffer(buffer, omxBuf, flags, timestamp, fenceFd);
+ }
+
+ virtual status_t getExtensionIndex(
+ const char *parameter_name,
+ OMX_INDEXTYPE *index) {
+ return mBase->getExtensionIndex(parameter_name, index);
+ }
+
+ virtual status_t dispatchMessage(const omx_message &msg) {
+ return mBase->dispatchMessage(msg);
+ }
+
+ // TODO: this is temporary, will be removed when quirks move to OMX side
+ virtual status_t setQuirks(OMX_U32 quirks) {
+ return mBase->setQuirks(quirks);
+ }
+};
+
IMPLEMENT_META_INTERFACE(OMX, "android.hardware.IOMX");
-IMPLEMENT_META_INTERFACE(OMXNode, "android.hardware.IOMXNode");
+IMPLEMENT_HYBRID_META_INTERFACE(OMXNode, IOmxNode, "android.hardware.IOMXNode");
////////////////////////////////////////////////////////////////////////////////
diff --git a/media/libmedia/include/IMediaCodecService.h b/media/libmedia/include/IMediaCodecService.h
index 984a0fd..da3c5a03 100644
--- a/media/libmedia/include/IMediaCodecService.h
+++ b/media/libmedia/include/IMediaCodecService.h
@@ -21,7 +21,7 @@
#include <binder/IMemory.h>
#include <binder/Parcel.h>
#include <media/IDataSource.h>
-#include <include/OMX.h>
+#include <media/IOMX.h>
namespace android {
diff --git a/media/libmedia/include/IOMX.h b/media/libmedia/include/IOMX.h
index 39b9ad4..b4fc04c 100644
--- a/media/libmedia/include/IOMX.h
+++ b/media/libmedia/include/IOMX.h
@@ -19,6 +19,7 @@
#define ANDROID_IOMX_H_
#include <binder/IInterface.h>
+#include <binder/HalToken.h>
#include <utils/List.h>
#include <utils/String8.h>
#include <cutils/native_handle.h>
@@ -26,6 +27,7 @@
#include <list>
#include <media/hardware/MetadataBufferType.h>
+#include <android/hardware/media/omx/1.0/IOmxNode.h>
#include <OMX_Core.h>
#include <OMX_Video.h>
@@ -42,6 +44,8 @@
class OMXBuffer;
struct omx_message;
+using hardware::media::omx::V1_0::IOmxNode;
+
class IOMX : public IInterface {
public:
DECLARE_META_INTERFACE(OMX);
@@ -83,7 +87,7 @@
class IOMXNode : public IInterface {
public:
- DECLARE_META_INTERFACE(OMXNode);
+ DECLARE_HYBRID_META_INTERFACE(OMXNode, IOmxNode);
typedef IOMX::buffer_id buffer_id;
diff --git a/media/libstagefright/omx/hal/1.0/utils/WGraphicBufferSource.cpp b/media/libmedia/omx/1.0/WGraphicBufferSource.cpp
similarity index 93%
rename from media/libstagefright/omx/hal/1.0/utils/WGraphicBufferSource.cpp
rename to media/libmedia/omx/1.0/WGraphicBufferSource.cpp
index 0ba6060..247c540 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WGraphicBufferSource.cpp
+++ b/media/libmedia/omx/1.0/WGraphicBufferSource.cpp
@@ -16,9 +16,9 @@
#include <stagefright/foundation/ColorUtils.h>
-#include "WGraphicBufferSource.h"
-#include "WOmxNode.h"
-#include "Conversion.h"
+#include <media/omx/1.0/WGraphicBufferSource.h>
+#include <media/omx/1.0/WOmxNode.h>
+#include <media/omx/1.0/Conversion.h>
namespace android {
namespace hardware {
@@ -36,8 +36,10 @@
::android::binder::Status LWGraphicBufferSource::configure(
const sp<IOMXNode>& omxNode, int32_t dataSpace) {
+ sp<IOmxNode> hOmxNode = omxNode->getHalInterface();
return toBinderStatus(mBase->configure(
- new TWOmxNode(omxNode), toHardwareDataspace(dataSpace)));
+ hOmxNode == nullptr ? new TWOmxNode(omxNode) : hOmxNode,
+ toHardwareDataspace(dataSpace)));
}
::android::binder::Status LWGraphicBufferSource::setSuspend(
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmx.cpp b/media/libmedia/omx/1.0/WOmx.cpp
similarity index 93%
rename from media/libstagefright/omx/hal/1.0/utils/WOmx.cpp
rename to media/libmedia/omx/1.0/WOmx.cpp
index 00f40cd..39871f8 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WOmx.cpp
+++ b/media/libmedia/omx/1.0/WOmx.cpp
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#include "WOmx.h"
-#include "WOmxNode.h"
-#include "WOmxObserver.h"
-#include "WOmxBufferProducer.h"
-#include "WGraphicBufferSource.h"
-#include "Conversion.h"
+#include <media/omx/1.0/WOmx.h>
+#include <media/omx/1.0/WOmxNode.h>
+#include <media/omx/1.0/WOmxObserver.h>
+#include <media/omx/1.0/WOmxBufferProducer.h>
+#include <media/omx/1.0/WGraphicBufferSource.h>
+#include <media/omx/1.0/Conversion.h>
namespace android {
namespace hardware {
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxBufferProducer.cpp b/media/libmedia/omx/1.0/WOmxBufferProducer.cpp
similarity index 88%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxBufferProducer.cpp
rename to media/libmedia/omx/1.0/WOmxBufferProducer.cpp
index e9a93b9..03499f2 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WOmxBufferProducer.cpp
+++ b/media/libmedia/omx/1.0/WOmxBufferProducer.cpp
@@ -16,11 +16,11 @@
#define LOG_TAG "WOmxBufferProducer-utils"
-#include <android-base/logging.h>
+#include <utils/Log.h>
-#include "WOmxBufferProducer.h"
-#include "WOmxProducerListener.h"
-#include "Conversion.h"
+#include <media/omx/1.0/WOmxBufferProducer.h>
+#include <media/omx/1.0/WOmxProducerListener.h>
+#include <media/omx/1.0/Conversion.h>
namespace android {
namespace hardware {
@@ -72,8 +72,7 @@
native_handle_t* nh = nullptr;
if ((fence == nullptr) || !wrapAs(&tFence, &nh, *fence)) {
- LOG(ERROR) << "TWOmxBufferProducer::dequeueBuffer - "
- "Invalid output fence";
+ ALOGE("TWOmxBufferProducer::dequeueBuffer - Invalid output fence");
_hidl_cb(toStatus(status),
static_cast<int32_t>(slot),
tFence,
@@ -82,8 +81,7 @@
}
std::vector<std::vector<native_handle_t*> > nhAA;
if (getFrameTimestamps && !wrapAs(&tOutTimestamps, &nhAA, outTimestamps)) {
- LOG(ERROR) << "TWOmxBufferProducer::dequeueBuffer - "
- "Invalid output timestamps";
+ ALOGE("TWOmxBufferProducer::dequeueBuffer - Invalid output timestamps");
_hidl_cb(toStatus(status),
static_cast<int32_t>(slot),
tFence,
@@ -120,16 +118,14 @@
hidl_handle tFence;
if (outBuffer == nullptr) {
- LOG(ERROR) << "TWOmxBufferProducer::detachNextBuffer - "
- "Invalid output buffer";
+ ALOGE("TWOmxBufferProducer::detachNextBuffer - Invalid output buffer");
_hidl_cb(toStatus(status), tBuffer, tFence);
return Void();
}
wrapAs(&tBuffer, *outBuffer);
native_handle_t* nh = nullptr;
if ((outFence != nullptr) && !wrapAs(&tFence, &nh, *outFence)) {
- LOG(ERROR) << "TWOmxBufferProducer::detachNextBuffer - "
- "Invalid output fence";
+ ALOGE("TWOmxBufferProducer::detachNextBuffer - Invalid output fence");
_hidl_cb(toStatus(status), tBuffer, tFence);
return Void();
}
@@ -145,8 +141,8 @@
int outSlot;
sp<GraphicBuffer> lBuffer = new GraphicBuffer();
if (!convertTo(lBuffer.get(), buffer)) {
- LOG(ERROR) << "TWOmxBufferProducer::attachBuffer - "
- "Invalid input native window buffer";
+ ALOGE("TWOmxBufferProducer::attachBuffer - "
+ "Invalid input native window buffer");
_hidl_cb(toStatus(BAD_VALUE), -1);
return Void();
}
@@ -166,8 +162,7 @@
NATIVE_WINDOW_SCALING_MODE_FREEZE,
0, ::android::Fence::NO_FENCE);
if (!convertTo(&lInput, input)) {
- LOG(ERROR) << "TWOmxBufferProducer::queueBuffer - "
- "Invalid input";
+ ALOGE("TWOmxBufferProducer::queueBuffer - Invalid input");
_hidl_cb(toStatus(BAD_VALUE), tOutput);
return Void();
}
@@ -177,8 +172,7 @@
std::vector<std::vector<native_handle_t*> > nhAA;
if (!wrapAs(&tOutput, &nhAA, lOutput)) {
- LOG(ERROR) << "TWOmxBufferProducer::queueBuffer - "
- "Invalid output";
+ ALOGE("TWOmxBufferProducer::queueBuffer - Invalid output");
_hidl_cb(toStatus(BAD_VALUE), tOutput);
return Void();
}
@@ -196,8 +190,7 @@
int32_t slot, const hidl_handle& fence) {
sp<Fence> lFence = new Fence();
if (!convertTo(lFence.get(), fence)) {
- LOG(ERROR) << "TWOmxBufferProducer::cancelBuffer - "
- "Invalid input fence";
+ ALOGE("TWOmxBufferProducer::cancelBuffer - Invalid input fence");
return toStatus(BAD_VALUE);
}
return toStatus(mBase->cancelBuffer(static_cast<int>(slot), lFence));
@@ -224,8 +217,7 @@
QueueBufferOutput tOutput;
std::vector<std::vector<native_handle_t*> > nhAA;
if (!wrapAs(&tOutput, &nhAA, lOutput)) {
- LOG(ERROR) << "TWOmxBufferProducer::connect - "
- "Invalid output";
+ ALOGE("TWOmxBufferProducer::connect - Invalid output");
_hidl_cb(toStatus(status), tOutput);
return Void();
}
@@ -300,8 +292,8 @@
hidl_handle tOutFence;
native_handle_t* nh = nullptr;
if ((lOutFence == nullptr) || !wrapAs(&tOutFence, &nh, *lOutFence)) {
- LOG(ERROR) << "TWOmxBufferProducer::getLastQueuedBuffer - "
- "Invalid output fence";
+ ALOGE("TWOmxBufferProducer::getLastQueuedBuffer - "
+ "Invalid output fence");
_hidl_cb(toStatus(status),
tOutBuffer,
tOutFence,
@@ -323,8 +315,8 @@
FrameEventHistoryDelta tDelta;
std::vector<std::vector<native_handle_t*> > nhAA;
if (!wrapAs(&tDelta, &nhAA, lDelta)) {
- LOG(ERROR) << "TWOmxBufferProducer::getFrameTimestamps - "
- "Invalid output frame timestamps";
+ ALOGE("TWOmxBufferProducer::getFrameTimestamps - "
+ "Invalid output frame timestamps");
_hidl_cb(tDelta);
return Void();
}
@@ -392,13 +384,13 @@
fnStatus = toStatusT(status);
*slot = tSlot;
if (!convertTo(fence->get(), tFence)) {
- LOG(ERROR) << "LWOmxBufferProducer::dequeueBuffer - "
- "Invalid output fence";
+ ALOGE("LWOmxBufferProducer::dequeueBuffer - "
+ "Invalid output fence");
fnStatus = fnStatus == NO_ERROR ? BAD_VALUE : fnStatus;
}
if (outTimestamps && !convertTo(outTimestamps, tTs)) {
- LOG(ERROR) << "LWOmxBufferProducer::dequeueBuffer - "
- "Invalid output timestamps";
+ ALOGE("LWOmxBufferProducer::dequeueBuffer - "
+ "Invalid output timestamps");
fnStatus = fnStatus == NO_ERROR ? BAD_VALUE : fnStatus;
}
}));
@@ -421,13 +413,13 @@
hidl_handle const& tFence) {
fnStatus = toStatusT(status);
if (!convertTo(outFence->get(), tFence)) {
- LOG(ERROR) << "LWOmxBufferProducer::detachNextBuffer - "
- "Invalid output fence";
+ ALOGE("LWOmxBufferProducer::detachNextBuffer - "
+ "Invalid output fence");
fnStatus = fnStatus == NO_ERROR ? BAD_VALUE : fnStatus;
}
if (!convertTo(outBuffer->get(), tBuffer)) {
- LOG(ERROR) << "LWOmxBufferProducer::detachNextBuffer - "
- "Invalid output buffer";
+ ALOGE("LWOmxBufferProducer::detachNextBuffer - "
+ "Invalid output buffer");
fnStatus = fnStatus == NO_ERROR ? BAD_VALUE : fnStatus;
}
}));
@@ -454,8 +446,7 @@
IOmxBufferProducer::QueueBufferInput tInput;
native_handle_t* nh;
if (!wrapAs(&tInput, &nh, input)) {
- LOG(ERROR) << "LWOmxBufferProducer::queueBuffer - "
- "Invalid input";
+ ALOGE("LWOmxBufferProducer::queueBuffer - Invalid input");
return BAD_VALUE;
}
status_t fnStatus;
@@ -465,8 +456,8 @@
IOmxBufferProducer::QueueBufferOutput const& tOutput) {
fnStatus = toStatusT(status);
if (!convertTo(output, tOutput)) {
- LOG(ERROR) << "LWOmxBufferProducer::queueBuffer - "
- "Invalid output";
+ ALOGE("LWOmxBufferProducer::queueBuffer - "
+ "Invalid output");
fnStatus = fnStatus == NO_ERROR ? BAD_VALUE : fnStatus;
}
}));
@@ -478,8 +469,7 @@
hidl_handle tFence;
native_handle_t* nh = nullptr;
if ((fence == nullptr) || !wrapAs(&tFence, &nh, *fence)) {
- LOG(ERROR) << "LWOmxBufferProducer::cancelBuffer - "
- "Invalid input fence";
+ ALOGE("LWOmxBufferProducer::cancelBuffer - Invalid input fence");
return BAD_VALUE;
}
@@ -513,8 +503,7 @@
IOmxBufferProducer::QueueBufferOutput const& tOutput) {
fnStatus = toStatusT(status);
if (!convertTo(output, tOutput)) {
- LOG(ERROR) << "LWOmxBufferProducer::connect - "
- "Invalid output";
+ ALOGE("LWOmxBufferProducer::connect - Invalid output");
fnStatus = fnStatus == NO_ERROR ? BAD_VALUE : fnStatus;
}
}));
@@ -579,14 +568,14 @@
fnStatus = toStatusT(status);
*outBuffer = new GraphicBuffer();
if (!convertTo(outBuffer->get(), buffer)) {
- LOG(ERROR) << "LWOmxBufferProducer::getLastQueuedBuffer - "
- "Invalid output buffer";
+ ALOGE("LWOmxBufferProducer::getLastQueuedBuffer - "
+ "Invalid output buffer");
fnStatus = fnStatus == NO_ERROR ? BAD_VALUE : fnStatus;
}
*outFence = new Fence();
if (!convertTo(outFence->get(), fence)) {
- LOG(ERROR) << "LWOmxBufferProducer::getLastQueuedBuffer - "
- "Invalid output fence";
+ ALOGE("LWOmxBufferProducer::getLastQueuedBuffer - "
+ "Invalid output fence");
fnStatus = fnStatus == NO_ERROR ? BAD_VALUE : fnStatus;
}
std::copy(transformMatrix.data(),
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxBufferSource.cpp b/media/libmedia/omx/1.0/WOmxBufferSource.cpp
similarity index 96%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxBufferSource.cpp
rename to media/libmedia/omx/1.0/WOmxBufferSource.cpp
index fe565e6..7cca5bd 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WOmxBufferSource.cpp
+++ b/media/libmedia/omx/1.0/WOmxBufferSource.cpp
@@ -16,8 +16,8 @@
#include <utils/String8.h>
-#include "WOmxBufferSource.h"
-#include "Conversion.h"
+#include <media/omx/1.0/WOmxBufferSource.h>
+#include <media/omx/1.0/Conversion.h>
namespace android {
namespace hardware {
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxNode.cpp b/media/libmedia/omx/1.0/WOmxNode.cpp
similarity index 98%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxNode.cpp
rename to media/libmedia/omx/1.0/WOmxNode.cpp
index df191c7..b5186b5 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WOmxNode.cpp
+++ b/media/libmedia/omx/1.0/WOmxNode.cpp
@@ -16,9 +16,9 @@
#include <algorithm>
-#include "WOmxNode.h"
-#include "WOmxBufferSource.h"
-#include "Conversion.h"
+#include <media/omx/1.0/WOmxNode.h>
+#include <media/omx/1.0/WOmxBufferSource.h>
+#include <media/omx/1.0/Conversion.h>
namespace android {
namespace hardware {
@@ -30,9 +30,6 @@
using ::android::hardware::Void;
// LWOmxNode
-LWOmxNode::LWOmxNode(sp<IOmxNode> const& base) : mBase(base) {
-}
-
status_t LWOmxNode::freeNode() {
return toStatusT(mBase->freeNode());
}
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxObserver.cpp b/media/libmedia/omx/1.0/WOmxObserver.cpp
similarity index 92%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxObserver.cpp
rename to media/libmedia/omx/1.0/WOmxObserver.cpp
index 05ec37e..fa0407f 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WOmxObserver.cpp
+++ b/media/libmedia/omx/1.0/WOmxObserver.cpp
@@ -18,12 +18,12 @@
#include <vector>
-#include <android-base/logging.h>
+#include <utils/Log.h>
#include <cutils/native_handle.h>
#include <binder/Binder.h>
-#include "WOmxObserver.h"
-#include "Conversion.h"
+#include <media/omx/1.0/WOmxObserver.h>
+#include <media/omx/1.0/Conversion.h>
namespace android {
namespace hardware {
@@ -47,7 +47,7 @@
}
auto transResult = mBase->onMessages(tMessages);
if (!transResult.isOk()) {
- LOG(ERROR) << "LWOmxObserver::onMessages - Transaction failed";
+ ALOGE("LWOmxObserver::onMessages - Transaction failed");
}
for (auto& handle : handles) {
native_handle_close(handle);
diff --git a/media/libstagefright/omx/hal/1.0/utils/WOmxProducerListener.cpp b/media/libmedia/omx/1.0/WOmxProducerListener.cpp
similarity index 96%
rename from media/libstagefright/omx/hal/1.0/utils/WOmxProducerListener.cpp
rename to media/libmedia/omx/1.0/WOmxProducerListener.cpp
index 80b0f71..3ee381f 100644
--- a/media/libstagefright/omx/hal/1.0/utils/WOmxProducerListener.cpp
+++ b/media/libmedia/omx/1.0/WOmxProducerListener.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "WOmxProducerListener.h"
+#include <media/omx/1.0/WOmxProducerListener.h>
namespace android {
namespace hardware {
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 78f28ae..81eecaf 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -45,6 +45,7 @@
#include <media/stagefright/SurfaceUtils.h>
#include <media/hardware/HardwareAPI.h>
#include <media/OMXBuffer.h>
+#include <media/omx/1.0/WOmxNode.h>
#include <hidlmemory/mapping.h>
@@ -63,7 +64,6 @@
#include <android/hidl/allocator/1.0/IAllocator.h>
#include <android/hidl/memory/1.0/IMemory.h>
-#include "omx/hal/1.0/utils/WOmxNode.h"
namespace android {
@@ -6133,10 +6133,7 @@
if (mDeathNotifier != NULL) {
if (mCodec->mOMXNode != NULL) {
if (mCodec->getTrebleFlag()) {
- auto tOmxNode =
- (static_cast<
- ::android::hardware::media::omx::V1_0::utils::
- LWOmxNode*>(mCodec->mOMXNode.get()))->mBase;
+ auto tOmxNode = mCodec->mOMXNode->getHalInterface();
tOmxNode->unlinkToDeath(mDeathNotifier);
} else {
sp<IBinder> binder = IInterface::asBinder(mCodec->mOMXNode);
@@ -6304,8 +6301,7 @@
mDeathNotifier = new DeathNotifier(notify);
if (mCodec->getTrebleFlag()) {
- auto tOmxNode = (static_cast<::android::hardware::media::omx::V1_0::
- utils::LWOmxNode*>(omxNode.get()))->mBase;
+ auto tOmxNode = omxNode->getHalInterface();
if (!tOmxNode->linkToDeath(mDeathNotifier, 0)) {
mDeathNotifier.clear();
}
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 140ceb1..7ce6102 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -120,7 +120,6 @@
android.hidl.allocator@1.0 \
android.hidl.memory@1.0 \
android.hardware.media.omx@1.0 \
- android.hardware.media.omx@1.0-utils \
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
diff --git a/media/libstagefright/OMXClient.cpp b/media/libstagefright/OMXClient.cpp
index b77ee1d..1706221 100644
--- a/media/libstagefright/OMXClient.cpp
+++ b/media/libstagefright/OMXClient.cpp
@@ -28,9 +28,9 @@
#include <media/IMediaCodecService.h>
#include <media/stagefright/OMXClient.h>
-#include "include/OMX.h"
+#include <media/IOMX.h>
-#include "omx/hal/1.0/utils/WOmx.h"
+#include <media/omx/1.0/WOmx.h>
namespace android {
diff --git a/media/libstagefright/omx/Android.mk b/media/libstagefright/omx/Android.mk
index 82b8143..f70f13b 100644
--- a/media/libstagefright/omx/Android.mk
+++ b/media/libstagefright/omx/Android.mk
@@ -34,6 +34,9 @@
libhidlmemory \
android.hidl.memory@1.0 \
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := \
+ android.hidl.memory@1.0
+
LOCAL_MODULE:= libstagefright_omx
LOCAL_CFLAGS += -Werror -Wall
LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow cfi
diff --git a/media/libstagefright/omx/hal/1.0/utils/Android.mk b/media/libstagefright/omx/hal/1.0/utils/Android.mk
deleted file mode 100644
index c44ce25..0000000
--- a/media/libstagefright/omx/hal/1.0/utils/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.media.omx@1.0-utils
-LOCAL_SRC_FILES := \
- WGraphicBufferSource.cpp \
- WOmx.cpp \
- WOmxBufferProducer.cpp \
- WOmxBufferSource.cpp \
- WOmxNode.cpp \
- WOmxObserver.cpp \
- WOmxProducerListener.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
- libmedia \
- libstagefright_foundation \
- libstagefright_omx \
- libui \
- libgui \
- libhidlbase \
- libhidltransport \
- libhwbinder \
- libhidlmemory \
- libutils \
- libcutils \
- libbinder \
- liblog \
- libbase \
- android.hardware.media.omx@1.0 \
- android.hardware.graphics.common@1.0 \
- android.hardware.media@1.0 \
- android.hidl.base@1.0 \
-
-LOCAL_C_INCLUDES += \
- $(TOP)/frameworks/av/include \
- $(TOP)/frameworks/av/media/libstagefright \
- $(TOP)/frameworks/native/include \
- $(TOP)/frameworks/native/include/media/openmax \
- $(TOP)/frameworks/native/include/media/hardware \
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libstagefright/omx/tests/Android.mk b/media/libstagefright/omx/tests/Android.mk
index 6d0f189..5941b94 100644
--- a/media/libstagefright/omx/tests/Android.mk
+++ b/media/libstagefright/omx/tests/Android.mk
@@ -17,7 +17,6 @@
android.hidl.allocator@1.0 \
android.hidl.memory@1.0 \
android.hardware.media.omx@1.0 \
- android.hardware.media.omx@1.0-utils
LOCAL_C_INCLUDES := \
$(TOP)/frameworks/av/media/libstagefright \