jpadmana | faca05e | 2013-06-04 16:03:29 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <hardware/audio.h> |
| 18 | #include <hardware/audio_effect.h> |
jpadmana | f90c7e0 | 2013-11-14 17:20:52 +0530 | [diff] [blame] | 19 | #include "EffectsFactory.h" |
| 20 | |
jpadmana | faca05e | 2013-06-04 16:03:29 +0530 | [diff] [blame] | 21 | namespace android { |
| 22 | enum { |
| 23 | SUB_FX_HOST, // Index of HOST in the descriptor and handle arrays |
| 24 | // of the Proxy context |
| 25 | SUB_FX_OFFLOAD, // Index of OFFLOAD in the descriptor and handle arrays |
| 26 | // of the Proxy context |
| 27 | SUB_FX_COUNT // The number of sub effects for a Proxy(1 HW, 1 SW) |
| 28 | }; |
| 29 | #if __cplusplus |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
| 33 | int EffectProxyCreate(const effect_uuid_t *uuid, |
| 34 | int32_t sessionId, |
| 35 | int32_t ioId, |
| 36 | effect_handle_t *pHandle); |
| 37 | int EffectProxyRelease(effect_handle_t handle); |
| 38 | int EffectProxyGetDescriptor(const effect_uuid_t *uuid, |
| 39 | effect_descriptor_t *pDescriptor); |
| 40 | /* Effect Control Interface Implementation: Process */ |
| 41 | int Effect_process(effect_handle_t self, |
| 42 | audio_buffer_t *inBuffer, |
| 43 | audio_buffer_t *outBuffer); |
| 44 | |
| 45 | /* Effect Control Interface Implementation: Command */ |
| 46 | int Effect_command(effect_handle_t self, |
| 47 | uint32_t cmdCode, |
| 48 | uint32_t cmdSize, |
| 49 | void *pCmdData, |
| 50 | uint32_t *replySize, |
| 51 | void *pReplyData); |
| 52 | int Effect_getDescriptor(effect_handle_t self, |
| 53 | effect_descriptor_t *pDescriptor); |
| 54 | |
| 55 | const struct effect_interface_s gEffectInterface = { |
| 56 | Effect_process, |
| 57 | Effect_command, |
| 58 | Effect_getDescriptor, |
| 59 | NULL, |
| 60 | }; |
| 61 | |
Eric Laurent | 5d6d86a | 2013-09-20 12:27:32 -0700 | [diff] [blame] | 62 | #define PROXY_REPLY_SIZE_MAX (64 * 1024) // must be power of two |
| 63 | #define PROXY_REPLY_SIZE_DEFAULT 32 // must be power of two |
| 64 | |
jpadmana | faca05e | 2013-06-04 16:03:29 +0530 | [diff] [blame] | 65 | struct EffectContext { |
| 66 | const struct effect_interface_s *common_itfe; // Holds the itfe of the Proxy |
jpadmana | f90c7e0 | 2013-11-14 17:20:52 +0530 | [diff] [blame] | 67 | sub_effect_entry_t** sube; // Points to the sub effects |
jpadmana | faca05e | 2013-06-04 16:03:29 +0530 | [diff] [blame] | 68 | effect_descriptor_t* desc; // Points to the sub effect descriptors |
jpadmana | f90c7e0 | 2013-11-14 17:20:52 +0530 | [diff] [blame] | 69 | audio_effect_library_t** aeli; // Points to the sub effect aeli |
jpadmana | faca05e | 2013-06-04 16:03:29 +0530 | [diff] [blame] | 70 | effect_handle_t eHandle[SUB_FX_COUNT]; // The effect handles of the sub effects |
| 71 | int index; // The index that is currently active - HOST or OFFLOAD |
| 72 | int32_t sessionId; // The sessiond in which the effect is created. |
| 73 | // Stored in context to pass on to sub effect creation |
| 74 | int32_t ioId; // The ioId in which the effect is created. |
| 75 | // Stored in context to pass on to sub effect creation |
| 76 | effect_uuid_t uuid; // UUID of the Proxy |
Eric Laurent | 5d6d86a | 2013-09-20 12:27:32 -0700 | [diff] [blame] | 77 | char* replyData; // temporary buffer for non active sub effect command reply |
| 78 | uint32_t replySize; // current size of temporary reply buffer |
jpadmana | faca05e | 2013-06-04 16:03:29 +0530 | [diff] [blame] | 79 | }; |
| 80 | |
| 81 | #if __cplusplus |
| 82 | } // extern "C" |
| 83 | #endif |
| 84 | } //namespace android |