Andreas Huber be06d26cdc Squashed commit of the following:
commit 5bb012f0065f7ffaaeb4f569d71f0e3a8d6b19c3
Author: Andreas Huber <andih@google.com>
Date:   Fri Aug 14 10:40:08 2009 -0700

    An attempt at fixing export using the qcom encoders. More quirks.

commit 0690e76bfa48118a68287ccf1bbfa82febaa620c
Author: Andreas Huber <andih@google.com>
Date:   Fri Aug 14 09:08:28 2009 -0700

    Callbacks are now dispatched from a separate thread in OMX.

commit c6571a039526df29b6343f9a1971dbc019088c61
Author: Andreas Huber <andih@google.com>
Date:   Thu Aug 13 15:42:25 2009 -0700

    Massive API changes throughout stagefright, smart pointers everywhere.

commit 900612af6a0555664d9ba195112cd859491265f4
Author: Andreas Huber <andih@google.com>
Date:   Thu Aug 13 13:33:12 2009 -0700

    OMXCodecs now properly shutdown.

commit 96732f05e1b0603dcd1b11f16a23512592eeb4f5
Author: Andreas Huber <andih@google.com>
Date:   Thu Aug 13 12:04:04 2009 -0700

    More work on JPEG decoding using the hardware OMX component.

commit 63839a073ac393e3a130434ba467969053b694ad
Author: Andreas Huber <andih@google.com>
Date:   Wed Aug 12 13:13:31 2009 -0700

    An attempt to drive the JPEG decoder OMX node.

commit 3ac2fe5ab2926eda81b2123610b2434c645294ff
Author: Andreas Huber <andih@google.com>
Date:   Tue Aug 11 16:38:21 2009 -0700

    Renamed StateMachine to OMXCodec and put it in its proper place.

commit 247da75a96bf8881956413023dd49a84d5b4f5b2
Author: Andreas Huber <andih@google.com>
Date:   Tue Aug 11 16:06:19 2009 -0700

    Statemachine is now a full-fledged MediaSource.

commit 045244f6771fa0b9b329495c953afda900a84b71
Author: Andreas Huber <andih@google.com>
Date:   Fri Aug 7 09:16:54 2009 -0700

    Properly setup the input format when exporting to AMR audio.

commit 271b984cb32c5cd9e46e3f90ae121f334e4b8da9
Author: Andreas Huber <andih@google.com>
Date:   Thu Aug 6 09:59:38 2009 -0700

    Added some code to test audio encoding to the OMX harness.

commit 79af4748e4af33bd66d3fbac606e332a69741cf4
Author: Andreas Huber <andih@google.com>
Date:   Wed Aug 5 14:36:22 2009 -0700

    Merge the old OMXDecoder and the new, shiny, StateMachine code.

commit 91cf5dd77a8762bc10a0b2ffce35e3bbeb262231
Author: Andreas Huber <andih@google.com>
Date:   Tue Aug 4 17:41:43 2009 -0700

    A new harness to test OMX node compliance (and quirks).
2009-08-17 10:24:50 -07:00

205 lines
5.7 KiB
C++

/*
* 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 ANDROID_IOMX_H_
#define ANDROID_IOMX_H_
#include <binder/IInterface.h>
#include <utils/List.h>
#include <utils/String8.h>
#include <OMX_Core.h>
#include <OMX_Video.h>
namespace android {
class IMemory;
class IOMXObserver;
class IOMXRenderer;
class ISurface;
class Surface;
class IOMX : public IInterface {
public:
DECLARE_META_INTERFACE(OMX);
typedef void *buffer_id;
typedef void *node_id;
virtual status_t list_nodes(List<String8> *list) = 0;
virtual status_t allocate_node(const char *name, node_id *node) = 0;
virtual status_t free_node(node_id node) = 0;
virtual status_t send_command(
node_id node, OMX_COMMANDTYPE cmd, OMX_S32 param) = 0;
virtual status_t get_parameter(
node_id node, OMX_INDEXTYPE index,
void *params, size_t size) = 0;
virtual status_t set_parameter(
node_id node, OMX_INDEXTYPE index,
const void *params, size_t size) = 0;
virtual status_t get_config(
node_id node, OMX_INDEXTYPE index,
void *params, size_t size) = 0;
virtual status_t set_config(
node_id node, OMX_INDEXTYPE index,
const void *params, size_t size) = 0;
virtual status_t use_buffer(
node_id node, OMX_U32 port_index, const sp<IMemory> &params,
buffer_id *buffer) = 0;
virtual status_t allocate_buffer(
node_id node, OMX_U32 port_index, size_t size,
buffer_id *buffer) = 0;
virtual status_t allocate_buffer_with_backup(
node_id node, OMX_U32 port_index, const sp<IMemory> &params,
buffer_id *buffer) = 0;
virtual status_t free_buffer(
node_id node, OMX_U32 port_index, buffer_id buffer) = 0;
virtual status_t observe_node(
node_id node, const sp<IOMXObserver> &observer) = 0;
virtual void fill_buffer(node_id node, buffer_id buffer) = 0;
virtual void empty_buffer(
node_id node,
buffer_id buffer,
OMX_U32 range_offset, OMX_U32 range_length,
OMX_U32 flags, OMX_TICKS timestamp) = 0;
virtual status_t get_extension_index(
node_id node,
const char *parameter_name,
OMX_INDEXTYPE *index) = 0;
virtual sp<IOMXRenderer> createRenderer(
const sp<ISurface> &surface,
const char *componentName,
OMX_COLOR_FORMATTYPE colorFormat,
size_t encodedWidth, size_t encodedHeight,
size_t displayWidth, size_t displayHeight) = 0;
// Note: This method is _not_ virtual, it exists as a wrapper around
// the virtual "createRenderer" method above facilitating extraction
// of the ISurface from a regular Surface.
sp<IOMXRenderer> createRenderer(
const sp<Surface> &surface,
const char *componentName,
OMX_COLOR_FORMATTYPE colorFormat,
size_t encodedWidth, size_t encodedHeight,
size_t displayWidth, size_t displayHeight);
};
struct omx_message {
enum {
EVENT,
EMPTY_BUFFER_DONE,
FILL_BUFFER_DONE,
// reserved for OMXDecoder use.
START,
INITIAL_FILL_BUFFER,
// reserved for OMXObserver use.
QUIT_OBSERVER,
} type;
IOMX::node_id node;
union {
// if type == EVENT
struct {
OMX_EVENTTYPE event;
OMX_U32 data1;
OMX_U32 data2;
} event_data;
// if type == EMPTY_BUFFER_DONE || type == FILL_BUFFER
// || type == INITIAL_FILL_BUFFER
struct {
IOMX::buffer_id buffer;
} buffer_data;
// if type == EMPTY_BUFFER || type == FILL_BUFFER_DONE
struct {
IOMX::buffer_id buffer;
OMX_U32 range_offset;
OMX_U32 range_length;
OMX_U32 flags;
OMX_TICKS timestamp;
OMX_PTR platform_private; // ignored if type == EMPTY_BUFFER
} extended_buffer_data;
// if type == SEND_COMMAND
struct {
OMX_COMMANDTYPE cmd;
OMX_S32 param;
} send_command_data;
} u;
};
class IOMXObserver : public IInterface {
public:
DECLARE_META_INTERFACE(OMXObserver);
virtual void on_message(const omx_message &msg) = 0;
};
class IOMXRenderer : public IInterface {
public:
DECLARE_META_INTERFACE(OMXRenderer);
virtual void render(IOMX::buffer_id buffer) = 0;
};
////////////////////////////////////////////////////////////////////////////////
class BnOMX : public BnInterface<IOMX> {
public:
virtual status_t onTransact(
uint32_t code, const Parcel &data, Parcel *reply,
uint32_t flags = 0);
};
class BnOMXObserver : public BnInterface<IOMXObserver> {
public:
virtual status_t onTransact(
uint32_t code, const Parcel &data, Parcel *reply,
uint32_t flags = 0);
};
class BnOMXRenderer : public BnInterface<IOMXRenderer> {
public:
virtual status_t onTransact(
uint32_t code, const Parcel &data, Parcel *reply,
uint32_t flags = 0);
};
} // namespace android
#endif // ANDROID_IOMX_H_