diff options
author | Andreas Huber <andih@google.com> | 2011-01-19 10:34:52 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-01-19 10:34:52 -0800 |
commit | d95b46a1d130a90835f217540926f400a9075aa5 (patch) | |
tree | 4a55258d94900cc2c18d9dc44e6dd0143d736e3a /media/libmedia | |
parent | 2597aedb3869e46f945359c529e03263c77a944d (diff) | |
download | frameworks_base-d95b46a1d130a90835f217540926f400a9075aa5.zip frameworks_base-d95b46a1d130a90835f217540926f400a9075aa5.tar.gz frameworks_base-d95b46a1d130a90835f217540926f400a9075aa5.tar.bz2 |
Make parameter blocks read/writable even for SET_PARAMETER/SET_CONFIG requests.
Refactor the logic a little.
Change-Id: Idd7a26678d846c96b0b11f096305e7467381bda3
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/IOMX.cpp | 78 |
1 files changed, 20 insertions, 58 deletions
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp index 9ce6738..af67175 100644 --- a/media/libmedia/IOMX.cpp +++ b/media/libmedia/IOMX.cpp @@ -5,6 +5,7 @@ #include <binder/IMemory.h> #include <binder/Parcel.h> #include <media/IOMX.h> +#include <media/stagefright/foundation/ADebug.h> #include <surfaceflinger/ISurface.h> #include <surfaceflinger/Surface.h> @@ -449,48 +450,9 @@ status_t BnOMX::onTransact( } case GET_PARAMETER: - { - CHECK_INTERFACE(IOMX, data, reply); - - node_id node = (void*)data.readIntPtr(); - OMX_INDEXTYPE index = static_cast<OMX_INDEXTYPE>(data.readInt32()); - - size_t size = data.readInt32(); - - // XXX I am not happy with this but Parcel::readInplace didn't work. - void *params = malloc(size); - data.read(params, size); - - status_t err = getParameter(node, index, params, size); - - reply->writeInt32(err); - - if (err == OK) { - reply->write(params, size); - } - - free(params); - params = NULL; - - return NO_ERROR; - } - case SET_PARAMETER: - { - CHECK_INTERFACE(IOMX, data, reply); - - node_id node = (void*)data.readIntPtr(); - OMX_INDEXTYPE index = static_cast<OMX_INDEXTYPE>(data.readInt32()); - - size_t size = data.readInt32(); - void *params = const_cast<void *>(data.readInplace(size)); - - reply->writeInt32(setParameter(node, index, params, size)); - - return NO_ERROR; - } - case GET_CONFIG: + case SET_CONFIG: { CHECK_INTERFACE(IOMX, data, reply); @@ -499,15 +461,30 @@ status_t BnOMX::onTransact( size_t size = data.readInt32(); - // XXX I am not happy with this but Parcel::readInplace didn't work. void *params = malloc(size); data.read(params, size); - status_t err = getConfig(node, index, params, size); + status_t err; + switch (code) { + case GET_PARAMETER: + err = getParameter(node, index, params, size); + break; + case SET_PARAMETER: + err = setParameter(node, index, params, size); + break; + case GET_CONFIG: + err = getConfig(node, index, params, size); + break; + case SET_CONFIG: + err = setConfig(node, index, params, size); + break; + default: + TRESPASS(); + } reply->writeInt32(err); - if (err == OK) { + if ((code == GET_PARAMETER || code == GET_CONFIG) && err == OK) { reply->write(params, size); } @@ -517,21 +494,6 @@ status_t BnOMX::onTransact( return NO_ERROR; } - case SET_CONFIG: - { - CHECK_INTERFACE(IOMX, data, reply); - - node_id node = (void*)data.readIntPtr(); - OMX_INDEXTYPE index = static_cast<OMX_INDEXTYPE>(data.readInt32()); - - size_t size = data.readInt32(); - void *params = const_cast<void *>(data.readInplace(size)); - - reply->writeInt32(setConfig(node, index, params, size)); - - return NO_ERROR; - } - case ENABLE_GRAPHIC_BUFFERS: { CHECK_INTERFACE(IOMX, data, reply); |