Merge "hal: improve logging."
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 6b056ce..1a4ce0a 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1161,6 +1161,8 @@
 int start_output_stream(struct stream_out *out)
 {
     int ret = 0;
+    int sink_channels = 0;
+    char prop_value[PROPERTY_VALUE_MAX] = {0};
     struct audio_usecase *uc_info;
     struct audio_device *adev = out->dev;
 
@@ -1185,10 +1187,17 @@
 
     /* This must be called before adding this usecase to the list */
     if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
-        if (is_offload_usecase(out->usecase))
-            check_and_set_hdmi_channels(adev, out->compr_config.codec->ch_in);
-        else
-            check_and_set_hdmi_channels(adev, out->config.channels);
+        property_get("audio.use.hdmi.sink.cap", prop_value, NULL);
+        if (!strncmp("true", prop_value, 4)) {
+            sink_channels = platform_edid_get_max_channels(out->dev->platform);
+            ALOGD("%s: set HDMI channel count[%d] based on sink capability", __func__, sink_channels);
+            check_and_set_hdmi_channels(adev, sink_channels);
+        } else {
+            if (is_offload_usecase(out->usecase))
+                check_and_set_hdmi_channels(adev, out->compr_config.codec->ch_in);
+            else
+                check_and_set_hdmi_channels(adev, out->config.channels);
+        }
     }
 
     list_add_tail(&adev->usecase_list, &uc_info->list);
@@ -2051,7 +2060,7 @@
      * Instead of writing zeroes here, we could trust the hardware
      * to always provide zeroes when muted.
      */
-    if (ret == 0 && voice_get_mic_mute(adev) && !voice_is_in_call(adev))
+    if (ret == 0 && voice_get_mic_mute(adev) && !voice_is_in_call_rec_stream(in))
         memset(buffer, 0, bytes);
 
 exit:
diff --git a/hal/msm8916/hw_info.c b/hal/msm8916/hw_info.c
index 661a0d0..4f35ffc 100644
--- a/hal/msm8916/hw_info.c
+++ b/hal/msm8916/hw_info.c
@@ -131,6 +131,12 @@
         hw_info->snd_devices = NULL;
         hw_info->num_snd_devices = 0;
         strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
+    } else if (!strcmp(snd_card_name, "msm8x16-snd-card-mtp")) {
+        strlcpy(hw_info->type, "", sizeof(hw_info->type));
+        strlcpy(hw_info->name, "msm8x16", sizeof(hw_info->name));
+        hw_info->snd_devices = NULL;
+        hw_info->num_snd_devices = 0;
+        strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
     } else if (!strcmp(snd_card_name, "msm8x16-skuh-snd-card")) {
         strlcpy(hw_info->type, "skuh", sizeof(hw_info->type));
         strlcpy(hw_info->name, "msm8x16", sizeof(hw_info->name));
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 4a4e408..4ca7ce7 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -33,6 +33,7 @@
 #include "voice_extn.h"
 
 #define MIXER_XML_PATH "/system/etc/mixer_paths.xml"
+#define MIXER_XML_PATH_MTP "/system/etc/mixer_paths_mtp.xml"
 #define MIXER_XML_PATH_AUXPCM "/system/etc/mixer_paths_auxpcm.xml"
 #define PLATFORM_INFO_XML_PATH      "/system/etc/audio_platform_info.xml"
 #define LIB_ACDB_LOADER "libacdbloader.so"
@@ -394,6 +395,19 @@
 #define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL)
 #define LOW_LATENCY_PLATFORM_DELAY (13*1000LL)
 
+static void query_platform(const char *snd_card_name,
+                                      char *mixer_xml_path)
+{
+    if (!strncmp(snd_card_name, "msm8x16-snd-card-mtp",
+                 sizeof("msm8x16-snd-card-mtp"))) {
+        strlcpy(mixer_xml_path, MIXER_XML_PATH_MTP,
+                sizeof(MIXER_XML_PATH_MTP));
+    } else {
+        strlcpy(mixer_xml_path, MIXER_XML_PATH,
+                sizeof(MIXER_XML_PATH));
+    }
+}
+
 static int set_echo_reference(struct mixer *mixer, const char* ec_ref)
 {
     struct mixer_ctl *ctl;
@@ -548,6 +562,7 @@
     struct platform_data *my_data = NULL;
     int retry_num = 0, snd_card_num = 0;
     const char *snd_card_name;
+    char mixer_xml_path[100];
 
     my_data = calloc(1, sizeof(struct platform_data));
 
@@ -575,10 +590,14 @@
         if (!my_data->hw_info) {
             ALOGE("%s: Failed to init hardware info", __func__);
         } else {
-            if (audio_extn_read_xml(adev, snd_card_num, MIXER_XML_PATH,
-                                    MIXER_XML_PATH_AUXPCM) == -ENOSYS)
+            query_platform(snd_card_name, mixer_xml_path);
+            ALOGD("%s: mixer path file is %s", __func__,
+                                    mixer_xml_path);
+            if (audio_extn_read_xml(adev, snd_card_num, mixer_xml_path,
+                                    MIXER_XML_PATH_AUXPCM) == -ENOSYS) {
                 adev->audio_route = audio_route_init(snd_card_num,
-                                                 MIXER_XML_PATH);
+                                                 mixer_xml_path);
+            }
             if (!adev->audio_route) {
                 ALOGE("%s: Failed to init audio route controls, aborting.",
                        __func__);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 923a085..64e090b 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1445,7 +1445,7 @@
             }
         } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
             snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC;
-            set_echo_reference(adev->mixer, EC_REF_RX);
+            set_echo_reference(adev, true);
         } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) {
             if (my_data->btsco_sample_rate == SAMPLE_RATE_16KHZ)
                 snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB;
@@ -1467,7 +1467,7 @@
                 }
             } else {
                 snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC;
-                set_echo_reference(adev->mixer, EC_REF_RX);
+                set_echo_reference(adev, true);
             }
         }
     } else if (source == AUDIO_SOURCE_CAMCORDER) {
diff --git a/hal/voice.c b/hal/voice.c
index 62d01db..bad9255 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -197,6 +197,19 @@
     return in_call;
 }
 
+bool voice_is_in_call_rec_stream(struct stream_in *in)
+{
+    bool in_call_rec = false;
+    int ret = 0;
+
+    ret = voice_extn_is_in_call_rec_stream(in, &in_call_rec);
+    if (ret == -ENOSYS) {
+        in_call_rec = false;
+    }
+
+    return in_call_rec;
+}
+
 uint32_t voice_get_active_session_id(struct audio_device *adev)
 {
     int ret = 0;
diff --git a/hal/voice.h b/hal/voice.h
index d160569..0098f94 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -77,6 +77,7 @@
                           struct str_parms *reply);
 void voice_init(struct audio_device *adev);
 bool voice_is_in_call(struct audio_device *adev);
+bool voice_is_in_call_rec_stream(struct stream_in *in);
 int voice_set_mic_mute(struct audio_device *dev, bool state);
 bool voice_get_mic_mute(struct audio_device *dev);
 int voice_set_volume(struct audio_device *adev, float volume);
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index 5dbd7b9..74dc426 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -356,6 +356,19 @@
     return 0;
 }
 
+int voice_extn_is_in_call_rec_stream(struct stream_in *in, bool *in_call_rec)
+{
+    *in_call_rec = false;
+
+    if(in->source == AUDIO_SOURCE_VOICE_DOWNLINK ||
+       in->source == AUDIO_SOURCE_VOICE_UPLINK ||
+       in->source == AUDIO_SOURCE_VOICE_CALL) {
+       *in_call_rec = true;
+    }
+
+    return 0;
+}
+
 void voice_extn_init(struct audio_device *adev)
 {
     adev->voice.session[VOICE_SESS_IDX].vsid =  VOICE_VSID;
diff --git a/hal/voice_extn/voice_extn.h b/hal/voice_extn/voice_extn.h
index f7d20e4..4a9c610 100644
--- a/hal/voice_extn/voice_extn.h
+++ b/hal/voice_extn/voice_extn.h
@@ -33,6 +33,7 @@
                                struct str_parms *query,
                                struct str_parms *reply);
 int voice_extn_is_in_call(struct audio_device *adev, bool *in_call);
+int voice_extn_is_in_call_rec_stream(struct stream_in *in, bool *in_call_rec);
 int voice_extn_get_active_session_id(struct audio_device *adev,
                                      uint32_t *session_id);
 void voice_extn_in_get_parameters(struct stream_in *in,
@@ -80,6 +81,11 @@
     return -ENOSYS;
 }
 
+static int voice_extn_is_in_call_rec_stream(struct stream_in *in, bool *in_call_rec)
+{
+    return -ENOSYS;
+}
+
 static int voice_extn_get_active_session_id(struct audio_device *adev,
                                             uint32_t *session_id)
 {
diff --git a/mm-audio/adec-aac/Android.mk b/mm-audio/adec-aac/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/mm-audio/adec-aac/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/mm-audio/adec-aac/Makefile b/mm-audio/adec-aac/Makefile
deleted file mode 100644
index 169fdc6..0000000
--- a/mm-audio/adec-aac/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-all:
-	@echo "invoking adec-aac make"
-	$(MAKE) -C qdsp6
-
-install:
-	$(MAKE) -C qdsp6 install
diff --git a/mm-audio/adec-aac/Makefile.am b/mm-audio/adec-aac/Makefile.am
deleted file mode 100644
index 24c1af2..0000000
--- a/mm-audio/adec-aac/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = qdsp6
diff --git a/mm-audio/adec-aac/sw/Android.mk b/mm-audio/adec-aac/sw/Android.mk
deleted file mode 100644
index 12a91b1..0000000
--- a/mm-audio/adec-aac/sw/Android.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-ifneq ($(BUILD_TINY_ANDROID),true)
-ifneq ($(BUILD_WITHOUT_PV),true)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# ---------------------------------------------------------------------------------
-#                 Common definitons
-# ---------------------------------------------------------------------------------
-
-libOmxAacDec-def := -g -O3
-libOmxAacDec-def += -DQC_MODIFIED
-libOmxAacDec-def += -D_ANDROID_
-libOmxAacDec-def += -D_ENABLE_QC_MSG_LOG_
-libOmxAacDec-def += -DVERBOSE
-libOmxAacDec-def += -D_DEBUG
-
-ifeq ($(BOARD_USES_QCOM_AUDIO_V2), true)
-libOmxAacDec-def += -DAUDIOV2
-endif
-
-# ---------------------------------------------------------------------------------
-#             Make the apps-test (mm-adec-omxaac-test)
-# ---------------------------------------------------------------------------------
-
-include $(CLEAR_VARS)
-
-ifeq ($(BOARD_USES_QCOM_AUDIO_V2), true)
-mm-aac-dec-test-inc   += $(TARGET_OUT_HEADERS)/mm-audio/audio-alsa
-mm-aac-dec-test-inc   += $(TARGET_OUT_HEADERS)/mm-core/omxcore
-mm-aac-dec-test-inc   += $(PV_TOP)/codecs_v2/omx/omx_mastercore/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_common/include \
-        		 $(PV_TOP)/extern_libs_v2/khronos/openmax/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_baseclass/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_aac/include \
-        		 $(PV_TOP)/codecs_v2/audio/aac/dec/include \
-
-LOCAL_MODULE            := sw-adec-omxaac-test
-LOCAL_MODULE_TAGS       := optional
-LOCAL_CFLAGS            := $(libOmxAacDec-def)
-LOCAL_C_INCLUDES        := $(mm-aac-dec-test-inc)
-LOCAL_PRELINK_MODULE    := false
-LOCAL_SHARED_LIBRARIES  := libopencore_common
-LOCAL_SHARED_LIBRARIES  += libomx_sharedlibrary
-LOCAL_SHARED_LIBRARIES  += libomx_aacdec_sharedlibrary
-LOCAL_SHARED_LIBRARIES  += libaudioalsa
-
-LOCAL_SRC_FILES         := test/omx_aac_dec_test.c
-
-include $(BUILD_EXECUTABLE)
-endif
-
-endif #BUILD_WITHOUT_PV
-endif #BUILD_TINY_ANDROID
-
-# ---------------------------------------------------------------------------------
-#                     END
-# ---------------------------------------------------------------------------------
diff --git a/mm-audio/adec-aac/sw/test/omx_aac_dec_test.c b/mm-audio/adec-aac/sw/test/omx_aac_dec_test.c
deleted file mode 100644
index e591cdd..0000000
--- a/mm-audio/adec-aac/sw/test/omx_aac_dec_test.c
+++ /dev/null
@@ -1,1302 +0,0 @@
-
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-    * Neither the name of The Linux Foundation nor
-      the names of its contributors may be used to endorse or promote
-      products derived from this software without specific prior written
-      permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-
-/*
-    An Open max test application ....
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <time.h>
-#include <sys/ioctl.h>
-
-#include "OMX_Core.h"
-#include "OMX_Component.h"
-#include "QOMX_AudioExtensions.h"
-#include "QOMX_AudioIndexExtensions.h"
-
-
-#ifdef AUDIOV2
-#include "control.h"
-#endif
-#include "pthread.h"
-#include <signal.h>
-
-#include <stdint.h>
-#include <linux/ioctl.h>
-#include <linux/msm_audio.h>
-#define SAMPLE_RATE 16000
-#define STEREO      2
-uint32_t samplerate = 16000;
-uint32_t channels = 2;
-uint32_t pcmplayback = 0;
-uint32_t tunnel      = 0;
-uint32_t filewrite   = 0;
-uint32_t configbufsize = 0;
-uint32_t sbr_ps_enabled = 0; //if 0, then both not enabled. if 1 only sbr enabled, if 2 both enabled.
-#define DEBUG_PRINT printf
-uint32_t flushinprogress = 0;
-uint32_t bsac = 0;
-int start_done = 0;
-
-#define PCM_PLAYBACK /* To write the pcm decoded data to the msm_pcm device for playback*/
-
-  int                          m_pcmdrv_fd;
-
-/************************************************************************/
-/*                #DEFINES                            */
-/************************************************************************/
-#define false 0
-#define true 1
-
-#define CONFIG_VERSION_SIZE(param) \
-    param.nVersion.nVersion = CURRENT_OMX_SPEC_VERSION;\
-    param.nSize = sizeof(param);
-
-#define FAILED(result) (result != OMX_ErrorNone)
-
-#define SUCCEEDED(result) (result == OMX_ErrorNone)
-
-/************************************************************************/
-/*                GLOBAL DECLARATIONS                     */
-/************************************************************************/
-
-pthread_mutex_t lock;
-pthread_cond_t cond;
-pthread_mutex_t elock;
-pthread_cond_t econd;
-pthread_mutex_t lock1;
-pthread_mutexattr_t lock1_attr;
-pthread_cond_t fcond;
-pthread_mutex_t etb_lock;
-pthread_mutex_t etb_lock1;
-pthread_cond_t etb_cond;
-pthread_mutexattr_t etb_lock_attr;
-FILE * inputBufferFile;
-FILE * outputBufferFile;
-OMX_PARAM_PORTDEFINITIONTYPE inputportFmt;
-OMX_PARAM_PORTDEFINITIONTYPE outputportFmt;
-OMX_AUDIO_PARAM_AACPROFILETYPE aacparam;
-QOMX_AUDIO_STREAM_INFO_DATA streaminfoparam;
-OMX_PORT_PARAM_TYPE portParam;
-OMX_ERRORTYPE error;
-int bReconfigureOutputPort = 0;
-
-
-#define ID_RIFF 0x46464952
-#define ID_WAVE 0x45564157
-#define ID_FMT  0x20746d66
-#define ID_DATA 0x61746164
-
-#define FORMAT_PCM 1
-
-static int bFileclose = 0;
-
-struct wav_header {
-  uint32_t riff_id;
-  uint32_t riff_sz;
-  uint32_t riff_fmt;
-  uint32_t fmt_id;
-  uint32_t fmt_sz;
-  uint16_t audio_format;
-  uint16_t num_channels;
-  uint32_t sample_rate;
-  uint32_t byte_rate;       /* sample_rate * num_channels * bps / 8 */
-  uint16_t block_align;     /* num_channels * bps / 8 */
-  uint16_t bits_per_sample;
-  uint32_t data_id;
-  uint32_t data_sz;
-};
-
-static unsigned totaldatalen = 0;
-/************************************************************************/
-/*                GLOBAL INIT                    */
-/************************************************************************/
-
-int input_buf_cnt = 0;
-int output_buf_cnt = 0;
-int used_ip_buf_cnt = 0;
-volatile int event_is_done = 0;
-volatile int ebd_event_is_done = 0;
-volatile int fbd_event_is_done = 0;
-volatile int etb_event_is_done = 0;
-int ebd_cnt;
-int bOutputEosReached = 0;
-int bInputEosReached = 0;
-int bEosOnInputBuf = 0;
-int bEosOnOutputBuf = 0;
-static int etb_done = 0;
-#ifdef AUDIOV2
-unsigned short session_id;
-unsigned short session_id_hpcm;
-int device_id;
-int control = 0;
-const char *device="speaker_stereo_rx";
-int devmgr_fd;
-#endif
-int bFlushing = false;
-int bPause    = false;
-const char *in_filename;
-const char out_filename[512];
-
-
-OMX_U8* pBuffer_tmp = NULL;
-
-int timeStampLfile = 0;
-int timestampInterval = 100;
-
-//* OMX Spec Version supported by the wrappers. Version = 1.1 */
-const OMX_U32 CURRENT_OMX_SPEC_VERSION = 0x00000101;
-OMX_COMPONENTTYPE* aac_dec_handle = 0;
-
-OMX_BUFFERHEADERTYPE  **pInputBufHdrs = NULL;
-OMX_BUFFERHEADERTYPE  **pOutputBufHdrs = NULL;
-
-/************************************************************************/
-/*                GLOBAL FUNC DECL                        */
-/************************************************************************/
-int Init_Decoder(char*);
-int Play_Decoder();
-void process_portreconfig();
-OMX_STRING aud_comp;
-
-/**************************************************************************/
-/*                STATIC DECLARATIONS                       */
-/**************************************************************************/
-
-static int open_audio_file ();
-static int Read_Buffer(OMX_BUFFERHEADERTYPE  *pBufHdr );
-static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *aac_dec_handle,
-                                       OMX_BUFFERHEADERTYPE  ***pBufHdrs,
-                                       OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize);
-
-
-static OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
-                                  OMX_IN OMX_PTR pAppData,
-                                  OMX_IN OMX_EVENTTYPE eEvent,
-                                  OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
-                                  OMX_IN OMX_PTR pEventData);
-static OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                                     OMX_IN OMX_PTR pAppData,
-                                     OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
-static OMX_ERRORTYPE FillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                                     OMX_IN OMX_PTR pAppData,
-                                     OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-static void write_devctlcmd(int fd, const void *buf, int param);
-
-void wait_for_event(void)
-{
-    pthread_mutex_lock(&lock);
-    DEBUG_PRINT("%s: event_is_done=%d", __FUNCTION__, event_is_done);
-    while (event_is_done == 0) {
-        pthread_cond_wait(&cond, &lock);
-    }
-    event_is_done = 0;
-    pthread_mutex_unlock(&lock);
-}
-
-void event_complete(void )
-{
-    pthread_mutex_lock(&lock);
-    if (event_is_done == 0) {
-        event_is_done = 1;
-        pthread_cond_broadcast(&cond);
-    }
-    pthread_mutex_unlock(&lock);
-}
-
-void etb_wait_for_event(void)
-{
-    pthread_mutex_lock(&etb_lock1);
-    DEBUG_PRINT("%s: etb_event_is_done=%d", __FUNCTION__, etb_event_is_done);
-    while (etb_event_is_done == 0) {
-        pthread_cond_wait(&etb_cond, &etb_lock1);
-    }
-    etb_event_is_done = 0;
-    pthread_mutex_unlock(&etb_lock1);
-}
-
-void etb_event_complete(void )
-{
-    pthread_mutex_lock(&etb_lock1);
-    if (etb_event_is_done == 0) {
-        etb_event_is_done = 1;
-        pthread_cond_broadcast(&etb_cond);
-    }
-    pthread_mutex_unlock(&etb_lock1);
-}
-
-
-
-OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
-                           OMX_IN OMX_PTR pAppData,
-                           OMX_IN OMX_EVENTTYPE eEvent,
-                           OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
-                           OMX_IN OMX_PTR pEventData)
-{
-    DEBUG_PRINT("Function %s \n", __FUNCTION__);
-
-    int bufCnt=0;
-    /* To remove warning for unused variable to keep prototype same */
-    (void)hComponent;
-    (void)pAppData;
-    (void)pEventData;
-
-    switch(eEvent) {
-        case OMX_EventCmdComplete:
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("\n OMX_EventCmdComplete \n");
-            DEBUG_PRINT("*********************************************\n");
-            if(OMX_CommandPortDisable == (OMX_COMMANDTYPE)nData1)
-            {
-                DEBUG_PRINT("******************************************\n");
-                DEBUG_PRINT("Recieved DISABLE Event Command Complete[%lu]\n",nData2);
-                DEBUG_PRINT("******************************************\n");
-            }
-            else if(OMX_CommandPortEnable == (OMX_COMMANDTYPE)nData1)
-            {
-                DEBUG_PRINT("*********************************************\n");
-                DEBUG_PRINT("Recieved ENABLE Event Command Complete[%lu]\n",nData2);
-                DEBUG_PRINT("*********************************************\n");
-            }
-            else if(OMX_CommandFlush== (OMX_COMMANDTYPE)nData1)
-            {
-                DEBUG_PRINT("*********************************************\n");
-                DEBUG_PRINT("Recieved FLUSH Event Command Complete[%lu]\n",nData2);
-                DEBUG_PRINT("*********************************************\n");
-            }
-            event_complete();
-            break;
-        case OMX_EventError:
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("\n OMX_EventError \n");
-            DEBUG_PRINT("*********************************************\n");
-            if(OMX_ErrorInvalidState == (OMX_ERRORTYPE)nData1)
-            {
-               DEBUG_PRINT("\n OMX_ErrorInvalidState \n");
-               for(bufCnt=0; bufCnt < input_buf_cnt; ++bufCnt)
-               {
-                  OMX_FreeBuffer(aac_dec_handle, 0, pInputBufHdrs[bufCnt]);
-               }
-               for(bufCnt=0; bufCnt < output_buf_cnt; ++bufCnt)
-               {
-                  OMX_FreeBuffer(aac_dec_handle, 1, pOutputBufHdrs[bufCnt]);
-               }
-
-               DEBUG_PRINT("*********************************************\n");
-               DEBUG_PRINT("\n Component Deinitialized \n");
-               DEBUG_PRINT("*********************************************\n");
-               exit(0);
-            }
-            else if(OMX_ErrorComponentSuspended == (OMX_ERRORTYPE)nData1)
-            {
-               DEBUG_PRINT("*********************************************\n");
-               DEBUG_PRINT("\n Component Received Suspend Event \n");
-               DEBUG_PRINT("*********************************************\n");
-            }
-            break;
-
-
-       case OMX_EventPortSettingsChanged:
-            bReconfigureOutputPort = 1;
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("\n OMX_EventPortSettingsChanged \n");
-            DEBUG_PRINT("*********************************************\n");
-            event_complete();
-            break;
-       case OMX_EventBufferFlag:
-             DEBUG_PRINT("\n *********************************************\n");
-             DEBUG_PRINT("\n OMX_EventBufferFlag \n");
-             DEBUG_PRINT("\n *********************************************\n");
-             
-             bOutputEosReached = true;
-             
-             event_complete();
-             break;
-
-       case OMX_EventComponentResumed:
-           DEBUG_PRINT("*********************************************\n");
-           DEBUG_PRINT("\n Component Received Suspend Event \n");
-           DEBUG_PRINT("*********************************************\n");
-           break;
-
-       default:
-            DEBUG_PRINT("\n Unknown Event \n");
-            break;
-    }
-    return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE FillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                              OMX_IN OMX_PTR pAppData,
-                              OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
-{
-   unsigned int i=0;
-   int bytes_writen = 0;
-   static int count = 0;
-   static int copy_done = 0;
-   static int length_filled = 0;
-   static int spill_length = 0;
-   static int pcm_buf_size = 4800;
-   static unsigned int pcm_buf_count = 2;
-   struct msm_audio_config drv_pcm_config;
-
-    /* To remove warning for unused variable to keep prototype same */
-   (void)pAppData;
-
-   if(flushinprogress == 1)
-   {
-       DEBUG_PRINT(" FillBufferDone: flush is in progress so hold the buffers\n");
-       return OMX_ErrorNone;
-   }
-   if(count == 0 && pcmplayback)
-   {
-       DEBUG_PRINT(" open pcm device \n");
-       m_pcmdrv_fd = open("/dev/msm_pcm_out", O_RDWR);
-       if (m_pcmdrv_fd < 0)
-       {
-          DEBUG_PRINT("Cannot open audio device\n");
-          return -1;
-       }
-       else
-       {
-          DEBUG_PRINT("Open pcm device successfull\n");
-          DEBUG_PRINT("Configure Driver for PCM playback \n");
-          ioctl(m_pcmdrv_fd, AUDIO_GET_CONFIG, &drv_pcm_config);
-          DEBUG_PRINT("drv_pcm_config.buffer_count %d \n", drv_pcm_config.buffer_count);
-          DEBUG_PRINT("drv_pcm_config.buffer_size %d \n", drv_pcm_config.buffer_size);
-          drv_pcm_config.sample_rate = samplerate; //SAMPLE_RATE; //m_adec_param.nSampleRate;
-          drv_pcm_config.channel_count = channels;  /* 1-> mono 2-> stereo*/
-          ioctl(m_pcmdrv_fd, AUDIO_SET_CONFIG, &drv_pcm_config);
-          DEBUG_PRINT("Configure Driver for PCM playback \n");
-          ioctl(m_pcmdrv_fd, AUDIO_GET_CONFIG, &drv_pcm_config);
-          DEBUG_PRINT("drv_pcm_config.buffer_count %d \n", drv_pcm_config.buffer_count);
-          DEBUG_PRINT("drv_pcm_config.buffer_size %d \n", drv_pcm_config.buffer_size);
-          pcm_buf_size = drv_pcm_config.buffer_size;
-          pcm_buf_count = drv_pcm_config.buffer_count;
-#ifdef AUDIOV2
-          ioctl(m_pcmdrv_fd, AUDIO_GET_SESSION_ID, &session_id_hpcm);
-		  DEBUG_PRINT("session id 0x%x \n", session_id_hpcm);
-			if(devmgr_fd >= 0)
-			{
-				write_devctlcmd(devmgr_fd, "-cmd=register_session_rx -sid=",  session_id_hpcm);
-			}
-			else
-			{
-				control = msm_mixer_open("/dev/snd/controlC0", 0);
-				if(control < 0)
-                			printf("ERROR opening the device\n");
-                		device_id = msm_get_device(device);
-                		device_id = 2;
-                		DEBUG_PRINT ("\ndevice_id = %d\n",device_id);
-                		DEBUG_PRINT("\nsession_id = %d\n",session_id);
-                		if (msm_en_device(device_id, 1))
-                		{
-                        		perror("could not enable device\n");
-                        		return -1;
-                		}
-				if (msm_route_stream(1, session_id_hpcm,device_id, 1))
-				{
-					DEBUG_PRINT("could not set stream routing\n");
-					return -1;
-				}
-			}
-#endif
-       }
-       pBuffer_tmp= (OMX_U8*)malloc(pcm_buf_count*sizeof(OMX_U8)*pcm_buf_size);
-       if (pBuffer_tmp == NULL)
-       {
-           return -1;
-       }
-       else
-       {
-           memset(pBuffer_tmp, 0, pcm_buf_count*pcm_buf_size);
-       }
-   }
-   DEBUG_PRINT(" FillBufferDone #%d size %lu\n", count++,pBuffer->nFilledLen);
-   if(bEosOnOutputBuf)
-       return OMX_ErrorNone;
-   if(filewrite == 1)
-   {
-       bytes_writen =
-       fwrite(pBuffer->pBuffer,1,pBuffer->nFilledLen,outputBufferFile);
-       DEBUG_PRINT(" FillBufferDone size writen to file  %d\n",bytes_writen);
-       totaldatalen += bytes_writen ;
-    }
-
-#ifdef PCM_PLAYBACK
-    if(pcmplayback && pBuffer->nFilledLen)
-    {
-        if(start_done == 0)
-        {
-            if((length_filled+pBuffer->nFilledLen)>=(pcm_buf_count*pcm_buf_size))
-            {
-                spill_length = (pBuffer->nFilledLen-(pcm_buf_count*pcm_buf_size)+length_filled);
-                memcpy (pBuffer_tmp+length_filled, pBuffer->pBuffer, ((pcm_buf_count*pcm_buf_size)-length_filled));
-
-                length_filled = (pcm_buf_count*pcm_buf_size);
-                copy_done = 1;
-            }
-            else
-            {
-                memcpy (pBuffer_tmp+length_filled, pBuffer->pBuffer, pBuffer->nFilledLen);
-                length_filled +=pBuffer->nFilledLen;
-            }
-            if (copy_done == 1)
-            {
-           for (i=0; i<pcm_buf_count; i++)
-           {
-                    if (write(m_pcmdrv_fd, pBuffer_tmp+i*pcm_buf_size, pcm_buf_size ) != pcm_buf_size)
-                    {
-                         DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                         return -1;
-                    }
-
-           }
-               DEBUG_PRINT("AUDIO_START called for PCM \n");
-               ioctl(m_pcmdrv_fd, AUDIO_START, 0);
-           if (spill_length != 0)
-           {
-                   if (write(m_pcmdrv_fd, pBuffer->pBuffer+((pBuffer->nFilledLen)-spill_length), spill_length) != spill_length)
-                   {
-                       DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                    return -1;
-                   }
-               }
-
-               copy_done = 0;
-               start_done = 1;
-
-            }
-        }
-        else
-        {
-            if (write(m_pcmdrv_fd, pBuffer->pBuffer, pBuffer->nFilledLen ) !=
-                (ssize_t)pBuffer->nFilledLen)
-            {
-                DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                return OMX_ErrorNone;
-            }
-        }
-        DEBUG_PRINT(" FillBufferDone: writing data to pcm device for play succesfull \n");
-    }
-#endif   // PCM_PLAYBACK
-
-
-    if(pBuffer->nFlags != OMX_BUFFERFLAG_EOS)
-    {
-        DEBUG_PRINT(" FBD calling FTB");
-        OMX_FillThisBuffer(hComponent,pBuffer);
-    }
-    else
-    {
-       DEBUG_PRINT(" FBD EOS REACHED...........\n");
-       bEosOnOutputBuf = true;
-
-    }
-    return OMX_ErrorNone;
-
-}
-
-
-OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                              OMX_IN OMX_PTR pAppData,
-                              OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
-{
-    int readBytes =0;
-
-    /* To remove warning for unused variable to keep prototype same */
-    (void)pAppData;
-    DEBUG_PRINT("\nFunction %s cnt[%d], used_ip_buf_cnt[%d]\n", __FUNCTION__, ebd_cnt,used_ip_buf_cnt);
-    DEBUG_PRINT("\nFunction %s %p %lu\n", __FUNCTION__, pBuffer,pBuffer->nFilledLen);
-    ebd_cnt++;
-    used_ip_buf_cnt--;
-    pthread_mutex_lock(&etb_lock);
-    if(!etb_done)
-    {
-        DEBUG_PRINT("\n*********************************************\n");
-        DEBUG_PRINT("Wait till first set of buffers are given to component\n");
-        DEBUG_PRINT("\n*********************************************\n");
-        etb_done++;
-        pthread_mutex_unlock(&etb_lock);
-        etb_wait_for_event();
-    }
-    else
-    {
-        pthread_mutex_unlock(&etb_lock);
-    }
-
-
-    if(bEosOnInputBuf)
-    {
-        DEBUG_PRINT("\n*********************************************\n");
-        DEBUG_PRINT("   EBD::EOS on input port\n ");
-        DEBUG_PRINT("*********************************************\n");
-        return OMX_ErrorNone;
-    }else if (bFlushing == true) {
-      DEBUG_PRINT("omx_aac_adec_test: bFlushing is set to TRUE used_ip_buf_cnt=%d\n",used_ip_buf_cnt);
-      if (used_ip_buf_cnt == 0) {
-        //fseek(inputBufferFile, 0, 0);
-        bFlushing = false;
-      } else {
-        DEBUG_PRINT("omx_aac_adec_test: more buffer to come back used_ip_buf_cnt=%d\n",used_ip_buf_cnt);
-        return OMX_ErrorNone;
-      }
-    }
-
-    if((readBytes = Read_Buffer(pBuffer)) > 0) {
-        pBuffer->nFilledLen = readBytes;
-        used_ip_buf_cnt++;
-        OMX_EmptyThisBuffer(hComponent,pBuffer);
-    }
-    else{
-        pBuffer->nFlags |= OMX_BUFFERFLAG_EOS;
-            used_ip_buf_cnt++;
-            //bInputEosReached = true;
-            bEosOnInputBuf = true;
-        pBuffer->nFilledLen = 0;
-        OMX_EmptyThisBuffer(hComponent,pBuffer);
-        DEBUG_PRINT("EBD..Either EOS or Some Error while reading file\n");
-    }
-    return OMX_ErrorNone;
-}
-
-void signal_handler(int sig_id) {
-
-  /* Flush */
-
-
-   if (sig_id == SIGUSR1) {
-    DEBUG_PRINT("%s Initiate flushing\n", __FUNCTION__);
-    bFlushing = true;
-    OMX_SendCommand(aac_dec_handle, OMX_CommandFlush, OMX_ALL, NULL);
-  } else if (sig_id == SIGUSR2) {
-    if (bPause == true) {
-      DEBUG_PRINT("%s resume playback\n", __FUNCTION__);
-      bPause = false;
-      OMX_SendCommand(aac_dec_handle, OMX_CommandStateSet, OMX_StateExecuting, NULL);
-    } else {
-      DEBUG_PRINT("%s pause playback\n", __FUNCTION__);
-      bPause = true;
-      OMX_SendCommand(aac_dec_handle, OMX_CommandStateSet, OMX_StatePause, NULL);
-    }
-  }
-}
-
-int main(int argc, char **argv)
-{
-    int bufCnt=0;
-    OMX_ERRORTYPE result;
-    struct sigaction sa;
-
-
-    struct wav_header hdr;
-    int bytes_writen = 0;
-
-    memset(&sa, 0, sizeof(sa));
-    sa.sa_handler = &signal_handler;
-    sigaction(SIGABRT, &sa, NULL);
-    sigaction(SIGUSR1, &sa, NULL);
-    sigaction(SIGUSR2, &sa, NULL);
-
-    pthread_cond_init(&cond, 0);
-    pthread_mutex_init(&lock, 0);
-
-    pthread_cond_init(&etb_cond, 0);
-    pthread_mutex_init(&etb_lock, 0);
-    pthread_mutex_init(&etb_lock1, 0);
-    pthread_mutexattr_init(&lock1_attr);
-    pthread_mutex_init(&lock1, &lock1_attr);
-
-    if (argc >= 6) {
-      in_filename = argv[1];
-      samplerate = atoi(argv[2]);
-      channels = atoi(argv[3]);
-      pcmplayback = atoi(argv[4]);
-      filewrite = atoi(argv[5]);
-      strlcpy((char *)out_filename,argv[1],sizeof((char *)out_filename));
-      strlcat((char *)out_filename,".wav",sizeof((char *)out_filename));
-    } else {
-
-        DEBUG_PRINT(" invalid format: \n");
-        DEBUG_PRINT("ex: ./sw-adec-omxaac-test AACINPUTFILE SAMPFREQ CHANNEL PCMPLAYBACK FILEWRITE\n");
-        DEBUG_PRINT( "PCMPLAYBACK = 1 (ENABLES PCM PLAYBACK IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT( "PCMPLAYBACK = 0 (DISABLES PCM PLAYBACK IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT( "FILEWRITE = 1 (ENABLES PCM FILEWRITE IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT( "FILEWRITE = 0 (DISABLES PCM FILEWRITE IN NON TUNNEL MODE) \n");
-        return 0;
-    }
-
-    aud_comp = "OMX.PV.aacdec";
-
-    if(Init_Decoder(aud_comp)!= 0x00)
-    {
-        DEBUG_PRINT("Decoder Init failed\n");
-        return -1;
-    }
-
-    if(Play_Decoder() != 0x00)
-    {
-        DEBUG_PRINT("Play_Decoder failed\n");
-        return -1;
-    }
-
-    // Wait till EOS is reached...
-
-   printf("before wait_for_event\n");
-   if(bReconfigureOutputPort)
-   {
-    wait_for_event();
-   }
-   if(bOutputEosReached) {
-
-        /******************************************************************/
-        #ifdef PCM_PLAYBACK
-        if(pcmplayback == 1)
-        {
-            sleep(1);
-            ioctl(m_pcmdrv_fd, AUDIO_STOP, 0);
-
-#ifdef AUDIOV2
-		if(devmgr_fd >= 0)
-        {
-			write_devctlcmd(devmgr_fd, "-cmd=unregister_session_rx -sid=", session_id_hpcm);
-		}
-		else
-		{
-			if (msm_route_stream(1, session_id_hpcm, device_id, 0))
-			{
-				DEBUG_PRINT("\ncould not set stream routing\n");
-            }
-        }
-#endif
-            if(m_pcmdrv_fd >= 0) {
-                close(m_pcmdrv_fd);
-                m_pcmdrv_fd = -1;
-                DEBUG_PRINT(" PCM device closed succesfully \n");
-            }
-            else
-            {
-                DEBUG_PRINT(" PCM device close failure \n");
-            }
-        }
-        #endif // PCM_PLAYBACK
-
-        if(filewrite == 1)
-        {
-            hdr.riff_id = ID_RIFF;
-            hdr.riff_sz = 0;
-            hdr.riff_fmt = ID_WAVE;
-            hdr.fmt_id = ID_FMT;
-            hdr.fmt_sz = 16;
-            hdr.audio_format = FORMAT_PCM;
-            hdr.num_channels = channels;//2;
-            hdr.sample_rate = samplerate; //SAMPLE_RATE;  //44100;
-            hdr.byte_rate = hdr.sample_rate * hdr.num_channels * 2;
-            hdr.block_align = hdr.num_channels * 2;
-            hdr.bits_per_sample = 16;
-            hdr.data_id = ID_DATA;
-            hdr.data_sz = 0;
-
-            DEBUG_PRINT("output file closed and EOS reached total decoded data length %d\n",totaldatalen);
-            hdr.data_sz = totaldatalen;
-            hdr.riff_sz = totaldatalen + 8 + 16 + 8;
-            fseek(outputBufferFile, 0L , SEEK_SET);
-            bytes_writen = fwrite(&hdr,1,sizeof(hdr),outputBufferFile);
-            if (bytes_writen <= 0) {
-                DEBUG_PRINT("Invalid Wav header write failed\n");
-            }
-            bFileclose = 1;
-            fclose(outputBufferFile);
-        }
-        /************************************************************************************/
-        DEBUG_PRINT("\nMoving the decoder to idle state \n");
-        OMX_SendCommand(aac_dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
-        wait_for_event();
-        DEBUG_PRINT("\nMoving the decoder to loaded state \n");
-        OMX_SendCommand(aac_dec_handle, OMX_CommandStateSet, OMX_StateLoaded,0);
-
-        DEBUG_PRINT("\nFillBufferDone: Deallocating i/p buffers \n");
-        for(bufCnt=0; bufCnt < input_buf_cnt; ++bufCnt) {
-            OMX_FreeBuffer(aac_dec_handle, 0, pInputBufHdrs[bufCnt]);
-        }
-
-        DEBUG_PRINT("\nFillBufferDone: Deallocating o/p buffers \n");
-        for(bufCnt=0; bufCnt < output_buf_cnt; ++bufCnt) {
-          OMX_FreeBuffer(aac_dec_handle, 1, pOutputBufHdrs[bufCnt]);
-        }
-        ebd_cnt=0;
-        wait_for_event();
-        ebd_cnt=0;
-        bOutputEosReached = false;
-        bInputEosReached = false;
-        bEosOnInputBuf = 0;
-        bEosOnOutputBuf = 0;
-        result = OMX_FreeHandle(aac_dec_handle);
-        if (result != OMX_ErrorNone) {
-            DEBUG_PRINT ("\nOMX_FreeHandle error. Error code: %d\n", result);
-        }
-           aac_dec_handle = NULL;
-#ifdef AUDIOV2
-        if(devmgr_fd >= 0)
-        {
-           write_devctlcmd(devmgr_fd, "-cmd=unregister_session_rx -sid=", session_id);
-           close(devmgr_fd);
-        }
-        else
-        {
-           if (msm_route_stream(1,session_id,device_id, 0))
-           {
-              DEBUG_PRINT("\ncould not set stream routing\n");
-              return -1;
-           }
-           if (msm_en_device(device_id, 0))
-           {
-              DEBUG_PRINT("\ncould not enable device\n");
-              return -1;
-           }
-           msm_mixer_close();
-        }
-#endif
-        /* Deinit OpenMAX */
-
-        OMX_Deinit();
-
-        pthread_cond_destroy(&cond);
-        pthread_mutex_destroy(&lock);
-        pthread_cond_destroy(&etb_cond);
-        pthread_mutex_destroy(&etb_lock);
-        pthread_mutex_destroy(&etb_lock1);
-        etb_done = 0;
-        bReconfigureOutputPort = 0;
-        if (pBuffer_tmp)
-        {
-            free(pBuffer_tmp);
-            pBuffer_tmp =NULL;
-        }
-
-        DEBUG_PRINT("*****************************************\n");
-        DEBUG_PRINT("******...TEST COMPLETED...***************\n");
-        DEBUG_PRINT("*****************************************\n");
-    }
-    return 0;
-}
-
-int Init_Decoder(OMX_STRING audio_component)
-{
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    OMX_ERRORTYPE omxresult;
-    OMX_U32 total = 0;
-    typedef OMX_U8* OMX_U8_PTR;
-    char *role ="audio_decoder.aac";
-
-    static OMX_CALLBACKTYPE call_back = {
-        &EventHandler,&EmptyBufferDone,&FillBufferDone
-    };
-
-    /* Init. the OpenMAX Core */
-    DEBUG_PRINT("\nInitializing OpenMAX Core....\n");
-    omxresult = OMX_Init();
-
-    if(OMX_ErrorNone != omxresult) {
-        DEBUG_PRINT("\n Failed to Init OpenMAX core");
-          return -1;
-    }
-    else {
-        DEBUG_PRINT("\nOpenMAX Core Init Done\n");
-    }
-
-    /* Query for audio decoders*/
-    DEBUG_PRINT("Aac_test: Before entering OMX_GetComponentOfRole");
-    OMX_GetComponentsOfRole(role, &total, 0);
-    DEBUG_PRINT ("\nTotal components of role=%s :%lu", role, total);
-
-
-    omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&aac_dec_handle),
-                        (OMX_STRING)audio_component, NULL, &call_back);
-    if (FAILED(omxresult)) {
-        DEBUG_PRINT("\nFailed to Load the component:%s\n", audio_component);
-    return -1;
-    }
-    else
-    {
-        DEBUG_PRINT("\nComponent %s is in LOADED state\n", audio_component);
-    }
-
-    /* Get the port information */
-    CONFIG_VERSION_SIZE(portParam);
-    omxresult = OMX_GetParameter(aac_dec_handle, OMX_IndexParamAudioInit,
-                                (OMX_PTR)&portParam);
-
-    if(FAILED(omxresult)) {
-        DEBUG_PRINT("\nFailed to get Port Param\n");
-    return -1;
-    }
-    else
-    {
-        DEBUG_PRINT("\nportParam.nPorts:%lu\n", portParam.nPorts);
-    DEBUG_PRINT("\nportParam.nStartPortNumber:%lu\n",
-                                             portParam.nStartPortNumber);
-    }
-    return 0;
-}
-
-int Play_Decoder()
-{
-    int i;
-    int Size=0;
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    OMX_ERRORTYPE ret;
-    OMX_INDEXTYPE index;
-
-    DEBUG_PRINT("sizeof[%d]\n", sizeof(OMX_BUFFERHEADERTYPE));
-
-    /* open the i/p and o/p files based on the video file format passed */
-    if(open_audio_file()) {
-        DEBUG_PRINT("\n Returning -1");
-    return -1;
-    }
-
-    /*  Configuration of Input Port definition */
-
-    /* Query the decoder input min buf requirements */
-    CONFIG_VERSION_SIZE(inputportFmt);
-
-    /* Port for which the Client needs to obtain info */
-    inputportFmt.nPortIndex = portParam.nStartPortNumber;
-
-    OMX_GetParameter(aac_dec_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-    DEBUG_PRINT ("\nDec: Input Buffer Count %lu\n", inputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nDec: Input Buffer Size %lu\n", inputportFmt.nBufferSize);
-
-    if(OMX_DirInput != inputportFmt.eDir) {
-        DEBUG_PRINT ("\nDec: Expect Input Port\n");
-    return -1;
-    }
-
-    inputportFmt.nBufferCountActual = inputportFmt.nBufferCountMin + 5;
-    OMX_SetParameter(aac_dec_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-    OMX_GetExtensionIndex(aac_dec_handle,"OMX.Qualcomm.index.audio.sessionId",&index);
-    OMX_GetParameter(aac_dec_handle,index,&streaminfoparam);
-#ifdef AUDIOV2
-    session_id = streaminfoparam.sessionId;
-	devmgr_fd = open("/data/omx_devmgr", O_WRONLY);
-	if(devmgr_fd >= 0)
-	{
-		control = 0;
-		write_devctlcmd(devmgr_fd, "-cmd=register_session_rx -sid=", session_id);
-	}
-	else
-	{
-		/*control = msm_mixer_open("/dev/snd/controlC0", 0);
-		if(control < 0)
-		printf("ERROR opening the device\n");
-		device_id = msm_get_device(device);
-		device_id = 2;
-		DEBUG_PRINT ("\ndevice_id = %d\n",device_id);
-		DEBUG_PRINT("\nsession_id = %d\n",session_id);
-		if (msm_en_device(device_id, 1))
-		{
-			perror("could not enable device\n");
-			return -1;
-		}
-
-		if (msm_route_stream(1,session_id,device_id, 1))
-		{
-			perror("could not set stream routing\n");
-			return -1;
-		}
-		*/
-	}
-#endif
-    /*  Configuration of Ouput Port definition */
-
-    /* Query the decoder outport's min buf requirements */
-    CONFIG_VERSION_SIZE(outputportFmt);
-    /* Port for which the Client needs to obtain info */
-    outputportFmt.nPortIndex = portParam.nStartPortNumber + 1;
-
-    OMX_GetParameter(aac_dec_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-    DEBUG_PRINT ("\nDec: Output Buffer Count %lu\n", outputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nDec: Output Buffer Size %lu\n", outputportFmt.nBufferSize);
-
-    if(OMX_DirOutput != outputportFmt.eDir) {
-        DEBUG_PRINT ("\nDec: Expect Output Port\n");
-    return -1;
-    }
-
-    outputportFmt.nBufferCountActual = outputportFmt.nBufferCountMin + 3;
-    OMX_SetParameter(aac_dec_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-
-    CONFIG_VERSION_SIZE(aacparam);
-    aacparam.nPortIndex   =  0;
-    aacparam.nChannels    =  channels; //2 ; /* 1-> mono 2-> stereo*/
-    aacparam.nBitRate     =  samplerate; //SAMPLE_RATE;
-    aacparam.nSampleRate  =  samplerate; //SAMPLE_RATE;
-    aacparam.eChannelMode =  OMX_AUDIO_ChannelModeStereo;
-    if (sbr_ps_enabled == 0 )
-        aacparam.eAACProfile = OMX_AUDIO_AACObjectLC;
-    else if (sbr_ps_enabled == 1 )
-        aacparam.eAACProfile = OMX_AUDIO_AACObjectHE;
-    else if (sbr_ps_enabled == 2 )
-        aacparam.eAACProfile = OMX_AUDIO_AACObjectHE_PS;
-    aacparam.eAACStreamFormat    =  OMX_AUDIO_AACStreamFormatMP2ADTS;
-    OMX_SetParameter(aac_dec_handle,OMX_IndexParamAudioAac,&aacparam);
-
-
-    DEBUG_PRINT ("\nOMX_SendCommand Decoder -> IDLE\n");
-    OMX_SendCommand(aac_dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
-    /* wait_for_event(); should not wait here event complete status will
-       not come until enough buffer are allocated */
-
-    input_buf_cnt = inputportFmt.nBufferCountActual; //  inputportFmt.nBufferCountMin + 5;
-    DEBUG_PRINT("Transition to Idle State succesful...\n");
-    /* Allocate buffer on decoder's i/p port */
-    error = Allocate_Buffer(aac_dec_handle, &pInputBufHdrs, inputportFmt.nPortIndex,
-                            input_buf_cnt, inputportFmt.nBufferSize);
-    if (error != OMX_ErrorNone) {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Input buffer error\n");
-    return -1;
-    }
-    else {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Input buffer success\n");
-    }
-
-    output_buf_cnt = outputportFmt.nBufferCountActual; // outputportFmt.nBufferCountMin ;
-
-    /* Allocate buffer on decoder's O/Pp port */
-    error = Allocate_Buffer(aac_dec_handle, &pOutputBufHdrs, outputportFmt.nPortIndex,
-                            output_buf_cnt, outputportFmt.nBufferSize);
-    if (error != OMX_ErrorNone) {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer error\n");
-    return -1;
-    }
-    else {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer success\n");
-    }
-
-    wait_for_event();
-
-
-    DEBUG_PRINT ("\nOMX_SendCommand Decoder -> Executing\n");
-    OMX_SendCommand(aac_dec_handle, OMX_CommandStateSet, OMX_StateExecuting,0);
-    wait_for_event();
-
-    DEBUG_PRINT(" Start sending OMX_FILLthisbuffer\n");
-    for(i=0; i < output_buf_cnt; i++) {
-        DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
-        pOutputBufHdrs[i]->nOutputPortIndex = 1;
-        pOutputBufHdrs[i]->nFlags = 0;
-        ret = OMX_FillThisBuffer(aac_dec_handle, pOutputBufHdrs[i]);
-        if (OMX_ErrorNone != ret) {
-            DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
-        }
-        else {
-            DEBUG_PRINT("OMX_FillThisBuffer success!\n");
-        }
-    }
-
-    DEBUG_PRINT(" Start sending OMX_emptythisbuffer\n");
-    for (i = 0;i < input_buf_cnt;i++) {
-        DEBUG_PRINT ("\nOMX_EmptyThisBuffer on Input buf no.%d\n",i);
-        pInputBufHdrs[i]->nInputPortIndex = 0;
-        Size = Read_Buffer(pInputBufHdrs[i]);
-        if(Size <=0 ){
-          DEBUG_PRINT("NO DATA READ\n");
-          //bInputEosReached = true;
-          bEosOnInputBuf = true;
-          pInputBufHdrs[i]->nFlags= OMX_BUFFERFLAG_EOS;
-        }
-        pInputBufHdrs[i]->nFilledLen = Size;
-        pInputBufHdrs[i]->nInputPortIndex = 0;
-        used_ip_buf_cnt++;
-        ret = OMX_EmptyThisBuffer(aac_dec_handle, pInputBufHdrs[i]);
-        if (OMX_ErrorNone != ret) {
-            DEBUG_PRINT("OMX_EmptyThisBuffer failed with result %d\n", ret);
-        }
-        else {
-            DEBUG_PRINT("OMX_EmptyThisBuffer success!\n");
-        }
-        if(Size <=0 ){
-            break;//eos reached
-        }
-    }
-    pthread_mutex_lock(&etb_lock);
-    if(etb_done)
-    {
-        DEBUG_PRINT("Component is waiting for EBD to be released.\n");
-        etb_event_complete();
-    }
-    else
-    {
-        DEBUG_PRINT("\n****************************\n");
-        DEBUG_PRINT("EBD not yet happened ...\n");
-        DEBUG_PRINT("\n****************************\n");
-        etb_done++;
-    }
-    pthread_mutex_unlock(&etb_lock);
-    while(1)
-    {
-        wait_for_event();
-        if(bOutputEosReached)
-        {
-            bReconfigureOutputPort = 0;
-            printf("bOutputEosReached breaking\n");
-            break;
-        }
-        else
-        {
-            if(bReconfigureOutputPort)
-               process_portreconfig();
-        }
-    }
-    return 0;
-}
-
-static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *avc_dec_handle,
-                                       OMX_BUFFERHEADERTYPE  ***pBufHdrs,
-                                       OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize)
-{
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    OMX_ERRORTYPE error=OMX_ErrorNone;
-    long bufCnt=0;
-    /* To remove warning for unused variable to keep prototype same */
-    (void)avc_dec_handle;
-    *pBufHdrs= (OMX_BUFFERHEADERTYPE **)
-                   malloc(sizeof(OMX_BUFFERHEADERTYPE*)*bufCntMin);
-
-    for(bufCnt=0; bufCnt < bufCntMin; ++bufCnt) {
-        DEBUG_PRINT("\n OMX_AllocateBuffer No %ld \n", bufCnt);
-        error = OMX_AllocateBuffer(aac_dec_handle, &((*pBufHdrs)[bufCnt]),
-                                   nPortIndex, NULL, bufSize);
-    }
-
-    return error;
-}
-
-static int Read_Buffer (OMX_BUFFERHEADERTYPE  *pBufHdr )
-{
-    int bytes_read=0;
-    pBufHdr->nFilledLen = 0;
-    pBufHdr->nFlags |= OMX_BUFFERFLAG_EOS;
-    DEBUG_PRINT("\n Length : %lu, buffer address : %p\n", pBufHdr->nAllocLen, pBufHdr->pBuffer);
-    if(bsac && configbufsize)
-    {
-        bytes_read = fread(pBufHdr->pBuffer, 1, configbufsize, inputBufferFile);
-        configbufsize = 0;
-        bsac = 0;
-    }
-    else
-    {
-        bytes_read = fread(pBufHdr->pBuffer, 1, pBufHdr->nAllocLen , inputBufferFile);
-    }
-    pBufHdr->nFilledLen = bytes_read;
-    if(bytes_read == 0)
-    {
-       pBufHdr->nFlags |= OMX_BUFFERFLAG_EOS;
-       DEBUG_PRINT ("\nBytes read zero\n");
-    }
-    else
-    {
-       pBufHdr->nFlags &= ~OMX_BUFFERFLAG_EOS;
-       DEBUG_PRINT ("\nBytes read is Non zero=%d\n",bytes_read);
-    }
-    return bytes_read;;
-}
-
-
-static int open_audio_file ()
-{
-    int error_code = 0;
-    struct wav_header hdr;
-    int header_len = 0;
-    memset(&hdr,0,sizeof(hdr));
-
-    hdr.riff_id = ID_RIFF;
-    hdr.riff_sz = 0;
-    hdr.riff_fmt = ID_WAVE;
-    hdr.fmt_id = ID_FMT;
-    hdr.fmt_sz = 16;
-    hdr.audio_format = FORMAT_PCM;
-    hdr.num_channels = channels;//2;
-    hdr.sample_rate = samplerate; //SAMPLE_RATE;  //44100;
-    hdr.byte_rate = hdr.sample_rate * hdr.num_channels * 2;
-    hdr.block_align = hdr.num_channels * 2;
-    hdr.bits_per_sample = 16;
-    hdr.data_id = ID_DATA;
-    hdr.data_sz = 0;
-
-    DEBUG_PRINT("Inside %s filename=%s -->%s\n", __FUNCTION__, in_filename,out_filename);
-    inputBufferFile = fopen (in_filename, "rb");
-    DEBUG_PRINT("\n FILE DESCRIPTOR : %p\n", inputBufferFile );
-    if (inputBufferFile == NULL) {
-        DEBUG_PRINT("\ni/p file %s could NOT be opened\n",
-                                         in_filename);
-	    error_code = -1;
-    }
-
-    if(filewrite == 1)
-    {
-      DEBUG_PRINT("output file is opened\n");
-      outputBufferFile = fopen(out_filename,"wb");
-      if (outputBufferFile == NULL) {
-        DEBUG_PRINT("\no/p file %s could NOT be opened\n",
-                                         out_filename);
-        error_code = -1;
-        return error_code;
-      }
-      header_len = fwrite(&hdr,1,sizeof(hdr),outputBufferFile);
-      if (header_len <= 0) {
-        DEBUG_PRINT("Invalid Wav header \n");
-      }
-      DEBUG_PRINT(" Length og wav header is %d \n",header_len );
-     }
-     return error_code;
-}
-
-void process_portreconfig ( )
-{
-    int bufCnt,i=0;
-    OMX_ERRORTYPE ret;
-    struct msm_audio_config drv_pcm_config;
-    //wait_for_event();
-    DEBUG_PRINT("************************************");
-    DEBUG_PRINT("RECIEVED EVENT PORT SETTINGS CHANGED EVENT\n");
-    DEBUG_PRINT("******************************************\n");
-
-    // wait for port settings changed event
-    DEBUG_PRINT("************************************");
-    DEBUG_PRINT("NOW SENDING FLUSH CMD\n");
-    DEBUG_PRINT("******************************************\n");
-    flushinprogress = 1;
-    OMX_SendCommand(aac_dec_handle, OMX_CommandFlush, 1, 0);
-
-    wait_for_event();
-    DEBUG_PRINT("************************************");
-    DEBUG_PRINT("RECIEVED FLUSH EVENT CMPL\n");
-    DEBUG_PRINT("******************************************\n");
-
-    // Send DISABLE command
-    OMX_SendCommand(aac_dec_handle, OMX_CommandPortDisable, 1, 0);
-
-    DEBUG_PRINT("******************************************\n");
-    DEBUG_PRINT("FREEING BUFFERS output_buf_cnt=%d\n",output_buf_cnt);
-    DEBUG_PRINT("******************************************\n");
-    // Free output Buffer
-    for(bufCnt=0; bufCnt < output_buf_cnt; ++bufCnt) {
-        OMX_FreeBuffer(aac_dec_handle, 1, pOutputBufHdrs[bufCnt]);
-    }
-
-    // wait for Disable event to come back
-    wait_for_event();
-    DEBUG_PRINT("******************************************\n");
-    DEBUG_PRINT("DISABLE EVENT RECD\n");
-    DEBUG_PRINT("******************************************\n");
-
-        // Send Enable command
-    OMX_SendCommand(aac_dec_handle, OMX_CommandPortEnable, 1, 0);
-    flushinprogress = 0;
-    // AllocateBuffers
-    DEBUG_PRINT("******************************************\n");
-    DEBUG_PRINT("ALLOC BUFFER AFTER PORT REENABLE");
-    DEBUG_PRINT("******************************************\n");
-    /* Allocate buffer on decoder's o/p port */
-    error = Allocate_Buffer(aac_dec_handle, &pOutputBufHdrs, outputportFmt.nPortIndex,
-                            output_buf_cnt, outputportFmt.nBufferSize);
-    if (error != OMX_ErrorNone) {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer error output_buf_cnt=%d\n",output_buf_cnt);
-        //return -1;
-    }
-    else
-    {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer success output_buf_cnt=%d\n",output_buf_cnt);
-    }
-
-    DEBUG_PRINT("******************************************\n");
-    DEBUG_PRINT("ENABLE EVENTiHANDLER RECD\n");
-    DEBUG_PRINT("******************************************\n");
-    // wait for enable event to come back
-    wait_for_event();
-    DEBUG_PRINT(" Calling stop on pcm driver...\n");
-    if(pcmplayback && start_done)
-    {
-        while (fsync(m_pcmdrv_fd) < 0) {
-        printf(" fsync failed\n");
-        sleep(1);
-        }
-        ioctl(m_pcmdrv_fd, AUDIO_STOP, 0);
-        ioctl(m_pcmdrv_fd, AUDIO_FLUSH, 0);
-        sleep(3);
-        DEBUG_PRINT("AUDIO_STOP\n");
-        OMX_GetParameter(aac_dec_handle,OMX_IndexParamAudioAac,&aacparam);
-        drv_pcm_config.sample_rate = aacparam.nSampleRate;
-        drv_pcm_config.channel_count = aacparam.nChannels;
-        printf("sample =%lu channel = %lu\n",aacparam.nSampleRate,aacparam.nChannels);
-        ioctl(m_pcmdrv_fd, AUDIO_SET_CONFIG, &drv_pcm_config);
-        DEBUG_PRINT("Configure Driver for PCM playback \n");
-        start_done = 0;
-        bReconfigureOutputPort = 0;
-    }
-
-    DEBUG_PRINT("******************************************\n");
-    DEBUG_PRINT("FTB after PORT RENABLE\n");
-    DEBUG_PRINT("******************************************\n");
-    for(i=0; i < output_buf_cnt; i++) {
-        DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
-        pOutputBufHdrs[i]->nOutputPortIndex = 1;
-        //pOutputBufHdrs[i]->nFlags &= ~OMX_BUFFERFLAG_EOS;
-        ret = OMX_FillThisBuffer(aac_dec_handle, pOutputBufHdrs[i]);
-        if (OMX_ErrorNone != ret) {
-            DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
-        }
-        else {
-            DEBUG_PRINT("OMX_FillThisBuffer success!\n");
-    }
-   }
-}
-
-static void write_devctlcmd(int fd, const void *buf, int param){
-	int nbytes, nbytesWritten;
-	char cmdstr[128];
-	snprintf(cmdstr, 128, "%s%d\n", (char *)buf, param);
-	nbytes = strlen(cmdstr);
-	nbytesWritten = write(fd, cmdstr, nbytes);
-
-	if(nbytes != nbytesWritten)
-		printf("Failed to write string \"%s\" to omx_devmgr\n", cmdstr);
-}
-
diff --git a/mm-audio/adec-amr/Android.mk b/mm-audio/adec-amr/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/mm-audio/adec-amr/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/mm-audio/adec-amr/sw/Android.mk b/mm-audio/adec-amr/sw/Android.mk
deleted file mode 100644
index ffa9789..0000000
--- a/mm-audio/adec-amr/sw/Android.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-ifneq ($(BUILD_TINY_ANDROID),true)
-ifneq ($(BUILD_WITHOUT_PV),true)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# ---------------------------------------------------------------------------------
-#                 Common definitons
-# ---------------------------------------------------------------------------------
-
-libOmxAmrDec-def := -g -O3
-libOmxAmrDec-def += -DQC_MODIFIED
-libOmxAmrDec-def += -D_ANDROID_
-libOmxAmrDec-def += -D_ENABLE_QC_MSG_LOG_
-libOmxAmrDec-def += -DVERBOSE
-libOmxAmrDec-def += -D_DEBUG
-libOmxAmrDec-def += -DAUDIOV2
-
-ifeq ($(BOARD_USES_QCOM_AUDIO_V2), true)
-libOmxAmrDec-def += -DAUDIOV2
-endif
-
-# ---------------------------------------------------------------------------------
-#             Make the apps-test (mm-adec-omxamr-test)
-# ---------------------------------------------------------------------------------
-
-include $(CLEAR_VARS)
-
-ifeq ($(BOARD_USES_QCOM_AUDIO_V2), true)
-mm-amr-dec-test-inc   += $(TARGET_OUT_HEADERS)/mm-audio/audio-alsa
-mm-amr-dec-test-inc   += $(TARGET_OUT_HEADERS)/mm-core/omxcore
-mm-amr-dec-test-inc   += $(PV_TOP)/codecs_v2/omx/omx_mastercore/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_common/include \
-        		 $(PV_TOP)/extern_libs_v2/khronos/openmax/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_baseclass/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_amr/include \
-        		 $(PV_TOP)/codecs_v2/audio/amr/dec/include \
-
-LOCAL_MODULE            := sw-adec-omxamr-test
-LOCAL_MODULE_TAGS       := optional
-LOCAL_CFLAGS            := $(libOmxAmrDec-def)
-LOCAL_C_INCLUDES        := $(mm-amr-dec-test-inc)
-LOCAL_PRELINK_MODULE    := false
-LOCAL_SHARED_LIBRARIES  := libopencore_common
-LOCAL_SHARED_LIBRARIES  += libomx_sharedlibrary
-LOCAL_SHARED_LIBRARIES  += libomx_amrdec_sharedlibrary
-LOCAL_SHARED_LIBRARIES  += libaudioalsa
-
-LOCAL_SRC_FILES         := test/omx_amr_dec_test.c
-
-include $(BUILD_EXECUTABLE)
-endif
-
-endif #BUILD_WITHOUT_PV
-endif #BUILD_TINY_ANDROID
-
-# ---------------------------------------------------------------------------------
-#                     END
-# ---------------------------------------------------------------------------------
diff --git a/mm-audio/adec-amr/sw/test/omx_amr_dec_test.c b/mm-audio/adec-amr/sw/test/omx_amr_dec_test.c
deleted file mode 100644
index 2ce7896..0000000
--- a/mm-audio/adec-amr/sw/test/omx_amr_dec_test.c
+++ /dev/null
@@ -1,1297 +0,0 @@
-
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-    * Neither the name of The Linux Foundation nor
-      the names of its contributors may be used to endorse or promote
-      products derived from this software without specific prior written
-      permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-
-/*
-    An Open max test application ....
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include "OMX_Core.h"
-#include "OMX_Component.h"
-#include "QOMX_AudioExtensions.h"
-#include "QOMX_AudioIndexExtensions.h"
-#ifdef AUDIOV2
-#include "control.h"
-#endif
-#include "pthread.h"
-#include <signal.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <stdint.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include<unistd.h>
-#include<string.h>
-#include <pthread.h>
-
-#include <linux/ioctl.h>
-#include <linux/msm_audio.h>
-
-#define SAMPLE_RATE 8000
-#define STEREO      2
-uint32_t samplerate = 8000;
-uint32_t channels = 1;
-uint32_t pcmplayback = 0;
-uint32_t tunnel      = 0;
-uint32_t filewrite   = 0;
-#ifdef _DEBUG
-
-#define DEBUG_PRINT(args...) printf("%s:%d ", __FUNCTION__, __LINE__); \
-    printf(args)
-
-#define DEBUG_PRINT_ERROR(args...) printf("%s:%d ", __FUNCTION__, __LINE__); \
-    printf(args)
-
-#else
-
-#define DEBUG_PRINT
-#define DEBUG_PRINT_ERROR
-
-#endif
-
-#define PCM_PLAYBACK /* To write the pcm decoded data to the msm_pcm device for playback*/
-int   m_pcmdrv_fd;
-
-/************************************************************************/
-/*                #DEFINES                            */
-/************************************************************************/
-#define false 0
-#define true 1
-
-#define CONFIG_VERSION_SIZE(param) \
-    param.nVersion.nVersion = CURRENT_OMX_SPEC_VERSION;\
-    param.nSize = sizeof(param);
-
-#define FAILED(result) (result != OMX_ErrorNone)
-
-#define SUCCEEDED(result) (result == OMX_ErrorNone)
-
-/************************************************************************/
-/*                GLOBAL DECLARATIONS                     */
-/************************************************************************/
-
-/* From WmfDecBytesPerFrame in dec_input_format_tab.cpp */
-const int sizes[] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 6, 5, 5, 0, 0, 0, 0 };
-
-pthread_mutex_t lock;
-pthread_mutex_t lock1;
-pthread_mutexattr_t lock1_attr;
-pthread_mutex_t etb_lock1;
-pthread_mutex_t etb_lock;
-pthread_cond_t etb_cond;
-
-pthread_cond_t cond;
-FILE * inputBufferFile;
-FILE * outputBufferFile;
-OMX_PARAM_PORTDEFINITIONTYPE inputportFmt;
-OMX_PARAM_PORTDEFINITIONTYPE outputportFmt;
-OMX_AUDIO_PARAM_AMRTYPE amrparam;
-QOMX_AUDIO_STREAM_INFO_DATA streaminfoparam;
-OMX_PORT_PARAM_TYPE portParam;
-OMX_ERRORTYPE error;
-OMX_U8* pBuffer_tmp = NULL;
-
-
-/* http://ccrma.stanford.edu/courses/422/projects/WaveFormat/ */
-
-#define ID_RIFF 0x46464952
-#define ID_WAVE 0x45564157
-#define ID_FMT  0x20746d66
-#define ID_DATA 0x61746164
-
-#define FORMAT_PCM 1
-
-static int bFileclose = 0;
-
-struct wav_header {
-  uint32_t riff_id;
-  uint32_t riff_sz;
-  uint32_t riff_fmt;
-  uint32_t fmt_id;
-  uint32_t fmt_sz;
-  uint16_t audio_format;
-  uint16_t num_channels;
-  uint32_t sample_rate;
-  uint32_t byte_rate;       /* sample_rate * num_channels * bps / 8 */
-  uint16_t block_align;     /* num_channels * bps / 8 */
-  uint16_t bits_per_sample;
-  uint32_t data_id;
-  uint32_t data_sz;
-};
-
-static unsigned totaldatalen = 0;
-
-/************************************************************************/
-/*                GLOBAL INIT                    */
-/************************************************************************/
-
-int input_buf_cnt = 0;
-int output_buf_cnt = 0;
-int used_ip_buf_cnt = 0;
-volatile int event_is_done = 0;
-volatile int ebd_event_is_done = 0;
-volatile int fbd_event_is_done = 0;
-int ebd_cnt;
-int bOutputEosReached = 0;
-int bInputEosReached = 0;
-int bEosOnInputBuf = 0;
-int bEosOnOutputBuf = 0;
-#ifdef AUDIOV2
-unsigned short session_id;
-unsigned short session_id_hpcm;
-int device_id; 
-int control = 0;
-//const char *device="handset_rx";
-const char *device="speaker_stereo_rx";
-int devmgr_fd;
-#endif
-static int etb_done = 0;
-static int etb_event_is_done = 0;
-
-OMX_AUDIO_AMRFRAMEFORMATTYPE frameFormat = 0;
-int bFlushing = false;
-int bPause    = false;
-const char *in_filename;
-const char out_filename[512];
-int chunksize =0;
-
-int timeStampLfile = 0;
-int timestampInterval = 100;
-
-//* OMX Spec Version supported by the wrappers. Version = 1.1 */
-const OMX_U32 CURRENT_OMX_SPEC_VERSION = 0x00000101;
-OMX_COMPONENTTYPE* amr_dec_handle = 0;
-
-OMX_BUFFERHEADERTYPE  **pInputBufHdrs = NULL;
-OMX_BUFFERHEADERTYPE  **pOutputBufHdrs = NULL;
-
-/************************************************************************/
-/*                GLOBAL FUNC DECL                        */
-/************************************************************************/
-int Init_Decoder(OMX_STRING audio_component);
-int Play_Decoder();
-
-OMX_STRING aud_comp;
-
-/**************************************************************************/
-/*                STATIC DECLARATIONS                       */
-/**************************************************************************/
-
-static int open_audio_file ();
-static int Read_Buffer(OMX_BUFFERHEADERTYPE  *pBufHdr );
-static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *amr_dec_handle,
-                                       OMX_BUFFERHEADERTYPE  ***pBufHdrs,
-                                       OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize);
-
-
-static OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
-                                  OMX_IN OMX_PTR pAppData,
-                                  OMX_IN OMX_EVENTTYPE eEvent,
-                                  OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
-                                  OMX_IN OMX_PTR pEventData);
-static OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                                     OMX_IN OMX_PTR pAppData,
-                                     OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
-static OMX_ERRORTYPE FillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                                     OMX_IN OMX_PTR pAppData,
-                                     OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-static void write_devctlcmd(int fd, const void *buf, int param);
-
-void wait_for_event(void)
-{
-    pthread_mutex_lock(&lock);
-    DEBUG_PRINT("%s: event_is_done=%d", __FUNCTION__, event_is_done);
-    while (event_is_done == 0) {
-        pthread_cond_wait(&cond, &lock);
-    }
-    event_is_done = 0;
-    pthread_mutex_unlock(&lock);
-}
-
-void event_complete(void )
-{
-    pthread_mutex_lock(&lock);
-    if (event_is_done == 0) {
-        event_is_done = 1;
-    	DEBUG_PRINT("%s: event_is_done=%d", __FUNCTION__, event_is_done);
-        pthread_cond_broadcast(&cond);
-    }
-    pthread_mutex_unlock(&lock);
-}
-
-void etb_wait_for_event(void)
-{
-    pthread_mutex_lock(&etb_lock);
-    DEBUG_PRINT("%s: etb_event_is_done=%d", __FUNCTION__, etb_event_is_done);
-    while (etb_event_is_done == 0) {
-        pthread_cond_wait(&etb_cond, &etb_lock);
-    }
-    etb_event_is_done = 0;
-    pthread_mutex_unlock(&etb_lock);
-}
-
-void etb_event_complete(void )
-{
-    pthread_mutex_lock(&etb_lock);
-    if (etb_event_is_done == 0) {
-        etb_event_is_done = 1;
-    	DEBUG_PRINT("%s: etb_event_is_done=%d", __FUNCTION__, etb_event_is_done);
-        pthread_cond_broadcast(&etb_cond);
-    }
-    pthread_mutex_unlock(&etb_lock);
-}
-
-
-OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
-                           OMX_IN OMX_PTR pAppData,
-                           OMX_IN OMX_EVENTTYPE eEvent,
-                           OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
-                           OMX_IN OMX_PTR pEventData)
-{
-    DEBUG_PRINT("Function %s \n", __FUNCTION__);
-    int bufCnt=0;
-    /* To remove warning for unused variable to keep prototype same */
-    (void)hComponent;
-    (void)pAppData;
-    (void)pEventData;
-
-    switch(eEvent)
-    {
-    case OMX_EventCmdComplete:
-        DEBUG_PRINT("*********************************************\n");
-        DEBUG_PRINT("\n OMX_EventCmdComplete \n");
-        DEBUG_PRINT("*********************************************\n");
-        if(OMX_CommandPortDisable == (OMX_COMMANDTYPE)nData1)
-        {
-            DEBUG_PRINT("******************************************\n");
-            DEBUG_PRINT("Recieved DISABLE Event Command Complete[%lu]\n",nData2);
-            DEBUG_PRINT("******************************************\n");
-        }
-        else if(OMX_CommandPortEnable == (OMX_COMMANDTYPE)nData1)
-        {
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("Recieved ENABLE Event Command Complete[%lu]\n",nData2);
-            DEBUG_PRINT("*********************************************\n");
-        }
-        else if(OMX_CommandFlush== (OMX_COMMANDTYPE)nData1)
-        {
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("Recieved FLUSH Event Command Complete[%lu]\n",nData2);
-            DEBUG_PRINT("*********************************************\n");
-        }
-        event_complete();
-        break;
-    case OMX_EventError:
-        DEBUG_PRINT("*********************************************\n");
-        DEBUG_PRINT("\n OMX_EventError \n");
-        DEBUG_PRINT("*********************************************\n");
-        if(OMX_ErrorInvalidState == (OMX_ERRORTYPE)nData1)
-        {
-            DEBUG_PRINT("\n OMX_ErrorInvalidState \n");
-            for(bufCnt=0; bufCnt < input_buf_cnt; ++bufCnt)
-            {
-               OMX_FreeBuffer(amr_dec_handle, 0, pInputBufHdrs[bufCnt]);
-            }
-            for(bufCnt=0; bufCnt < output_buf_cnt; ++bufCnt)
-            {
-               OMX_FreeBuffer(amr_dec_handle, 1, pOutputBufHdrs[bufCnt]);
-            }
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("\n Component Deinitialized \n");
-            DEBUG_PRINT("*********************************************\n");
-            exit(0);
-        }
-        else if(OMX_ErrorComponentSuspended == (OMX_ERRORTYPE)nData1)
-        {
-               DEBUG_PRINT("*********************************************\n");
-               DEBUG_PRINT("\n Component Received Suspend Event \n");
-               DEBUG_PRINT("*********************************************\n");
-        }
-        break;
-
-    case OMX_EventPortSettingsChanged:
-        DEBUG_PRINT("*********************************************\n");
-        DEBUG_PRINT("\n OMX_EventPortSettingsChanged \n");
-        DEBUG_PRINT("*********************************************\n");
-        event_complete();
-        break;
-    case OMX_EventBufferFlag:
-        DEBUG_PRINT("*********************************************\n");
-        DEBUG_PRINT("\n OMX_Bufferflag \n");
-        DEBUG_PRINT("*********************************************\n");
-        bOutputEosReached = true;
-        event_complete();
-        break;
-    case OMX_EventComponentResumed:
-        DEBUG_PRINT("*********************************************\n");
-        DEBUG_PRINT("\n Component Received Suspend Event \n");
-        DEBUG_PRINT("*********************************************\n");
-        break;
-    default:
-        DEBUG_PRINT("\n Unknown Event \n");
-        break;
-    }
-    return OMX_ErrorNone;
-}
-
-
-OMX_ERRORTYPE FillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                              OMX_IN OMX_PTR pAppData,
-                              OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
-{
-   unsigned int i=0;
-   int bytes_writen = 0;
-   static int count = 0;
-   static int copy_done = 0;
-   static int start_done = 0;
-   static int length_filled = 0;
-   static int spill_length = 0;
-   static int pcm_buf_size = 4800;
-   static unsigned int pcm_buf_count = 2;
-   struct msm_audio_config drv_pcm_config;
-
-    /* To remove warning for unused variable to keep prototype same */
-   (void)pAppData;
-
-   if(count == 0 && pcmplayback)
-   {
-       DEBUG_PRINT(" open pcm device \n");
-       m_pcmdrv_fd = open("/dev/msm_pcm_out", O_RDWR);
-       if (m_pcmdrv_fd < 0)
-       {
-          DEBUG_PRINT("Cannot open audio device\n");
-          return -1;
-       }
-       else
-       {
-          DEBUG_PRINT("Open pcm device successfull\n");
-          DEBUG_PRINT("Configure Driver for PCM playback \n");
-          ioctl(m_pcmdrv_fd, AUDIO_GET_CONFIG, &drv_pcm_config);
-          DEBUG_PRINT("drv_pcm_config.buffer_count %d \n", drv_pcm_config.buffer_count);
-          DEBUG_PRINT("drv_pcm_config.buffer_size %d \n", drv_pcm_config.buffer_size);
-          drv_pcm_config.sample_rate = samplerate; //SAMPLE_RATE; //m_adec_param.nSampleRate;
-          drv_pcm_config.channel_count = channels;  /* 1-> mono 2-> stereo*/
-          ioctl(m_pcmdrv_fd, AUDIO_SET_CONFIG, &drv_pcm_config);
-          DEBUG_PRINT("Configure Driver for PCM playback \n");
-          ioctl(m_pcmdrv_fd, AUDIO_GET_CONFIG, &drv_pcm_config);
-          DEBUG_PRINT("drv_pcm_config.buffer_count %d \n", drv_pcm_config.buffer_count);
-          DEBUG_PRINT("drv_pcm_config.buffer_size %d \n", drv_pcm_config.buffer_size);
-          pcm_buf_size = drv_pcm_config.buffer_size;
-          pcm_buf_count = drv_pcm_config.buffer_count;
-#ifdef AUDIOV2
-          ioctl(m_pcmdrv_fd, AUDIO_GET_SESSION_ID, &session_id_hpcm);
-          DEBUG_PRINT("session id 0x%4x \n", session_id_hpcm);
-	  if(devmgr_fd >= 0)
-	  {
-		write_devctlcmd(devmgr_fd, "-cmd=register_session_rx -sid=",  session_id_hpcm);
-	  }
-	  else
-	  {
-		control = msm_mixer_open("/dev/snd/controlC0", 0);
-		if(control < 0)
-		printf("ERROR opening the device\n");
-		device_id = msm_get_device(device);
-		DEBUG_PRINT ("\ndevice_id = %d\n",device_id);
-		DEBUG_PRINT("\nsession_id = %d\n",session_id);
-		if (msm_en_device(device_id, 1))
-		{
-			perror("could not enable device\n");
-			return -1;
-		}
-
-		if (msm_route_stream(1, session_id_hpcm,device_id, 1))
-		{
-      			DEBUG_PRINT("could not set stream routing\n");
-          			return -1;
-		}
-		}
-#endif
-       }
-       pBuffer_tmp= (OMX_U8*)malloc(pcm_buf_count*sizeof(OMX_U8)*pcm_buf_size);
-       if (pBuffer_tmp == NULL)
-       {
-         return -1;
-       }
-       else
-       {
-         memset(pBuffer_tmp, 0, pcm_buf_count*pcm_buf_size);
-       }
-   }
-   DEBUG_PRINT(" FillBufferDone #%d size %lu\n", count++,pBuffer->nFilledLen);
-
-    if(bEosOnOutputBuf)
-    {
-        return OMX_ErrorNone;
-    }
-
-   if(filewrite == 1)
-    {
-       bytes_writen =
-       fwrite(pBuffer->pBuffer,1,pBuffer->nFilledLen,outputBufferFile);
-        DEBUG_PRINT(" FillBufferDone size writen to file  %d\n",bytes_writen);
-        totaldatalen += bytes_writen ;
-    }
-
-#ifdef PCM_PLAYBACK
-    if(pcmplayback && pBuffer->nFilledLen)
-    {
-        if(start_done == 0)
-        {
-            if((length_filled+pBuffer->nFilledLen)>=(pcm_buf_count*pcm_buf_size))
-            {
-                spill_length = (pBuffer->nFilledLen-(pcm_buf_count*pcm_buf_size)+length_filled);
-                memcpy (pBuffer_tmp+length_filled, pBuffer->pBuffer, ((pcm_buf_count*pcm_buf_size)-length_filled));
-                length_filled = (pcm_buf_count*pcm_buf_size);
-                copy_done = 1;
-            }
-            else
-            {
-                memcpy (pBuffer_tmp+length_filled, pBuffer->pBuffer, pBuffer->nFilledLen);
-               length_filled +=pBuffer->nFilledLen;
-            }
-            if (copy_done == 1)
-            {
-                for (i=0; i<pcm_buf_count; i++)
-            {
-                     if (write(m_pcmdrv_fd, pBuffer_tmp+i*pcm_buf_size, pcm_buf_size ) != pcm_buf_size)
-            {
-                DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                         return -1;
-            }
-
-           }
-               DEBUG_PRINT("AUDIO_START called for PCM \n");
-            ioctl(m_pcmdrv_fd, AUDIO_START, 0);
-           if (spill_length != 0)
-           {
-                   if (write(m_pcmdrv_fd, pBuffer->pBuffer+((pBuffer->nFilledLen)-spill_length), spill_length) != spill_length)
-               {
-                   DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                return -1;
-               }
-           }
-               if (pBuffer_tmp)
-               {
-                   free(pBuffer_tmp);
-               pBuffer_tmp =NULL;
-               }
-               copy_done = 0;
-               start_done = 1;
-            }
-        }
-        else
-        {
-            if (write(m_pcmdrv_fd, pBuffer->pBuffer, pBuffer->nFilledLen ) !=
-                (ssize_t)pBuffer->nFilledLen)
-            {
-                DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                return OMX_ErrorNone;
-            }
-        }
-
-        DEBUG_PRINT(" FillBufferDone: writing data to pcm device for play succesfull \n");
-    }
-#endif   // PCM_PLAYBACK
-
-
-    if(pBuffer->nFlags != OMX_BUFFERFLAG_EOS)
-    {
-        DEBUG_PRINT(" FBD calling FTB");
-        OMX_FillThisBuffer(hComponent,pBuffer);
-    }
-    else
-    {
-        DEBUG_PRINT(" FBD EOS REACHED...........\n");
-        bEosOnOutputBuf = true;
-        return OMX_ErrorNone;
-    }
-        return OMX_ErrorNone;
-}
-
-
-OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                              OMX_IN OMX_PTR pAppData,
-                              OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
-{
-    int readBytes =0;
-
-    /* To remove warning for unused variable to keep prototype same */
-    (void)pAppData;
-    DEBUG_PRINT("\nFunction %s cnt[%d]\n", __FUNCTION__, ebd_cnt);
-    ebd_cnt++;
-    used_ip_buf_cnt--;
-    pthread_mutex_lock(&etb_lock1);
-    if(!etb_done)
-    {
-        DEBUG_PRINT("\n*********************************************\n");
-        DEBUG_PRINT("Wait till first set of buffers are given to component\n");
-        DEBUG_PRINT("\n*********************************************\n");
-        etb_done++;
-        pthread_mutex_unlock(&etb_lock1);
-	etb_wait_for_event();
-    }
-    else
-    {
-        pthread_mutex_unlock(&etb_lock1);
-    }
-    if(bEosOnInputBuf)
-    {
-        DEBUG_PRINT("\n*********************************************\n");
-        DEBUG_PRINT("   EBD::EOS on input port\n ");
-        DEBUG_PRINT("*********************************************\n");
-        return OMX_ErrorNone;
-    }
-    else if (true == bFlushing)
-    {
-        DEBUG_PRINT("omx_amr_adec_test: bFlushing is set to TRUE used_ip_buf_cnt=%d\n",used_ip_buf_cnt);
-        if (0 == used_ip_buf_cnt)
-        {
-            //fseek(inputBufferFile, 0, 0);
-            bFlushing = false;
-        }
-        else
-        {
-            DEBUG_PRINT("omx_amr_adec_test: more buffer to come back\n");
-            return OMX_ErrorNone;
-        }
-    }
-    if((readBytes = Read_Buffer(pBuffer)) > 0)
-    {
-        pBuffer->nFilledLen = readBytes;
-        used_ip_buf_cnt++;
-	DEBUG_PRINT("pBuffer->nFilledLen = %d,used_ip_buf_cnt:%d\n", readBytes,used_ip_buf_cnt);
-        timeStampLfile += timestampInterval;
-        pBuffer->nTimeStamp = timeStampLfile;
-        OMX_EmptyThisBuffer(hComponent,pBuffer);
-    }
-    else
-    {
-	DEBUG_PRINT("OMX_BUFFERFLAG_EOS\n");
-        pBuffer->nFlags |= OMX_BUFFERFLAG_EOS;
-        used_ip_buf_cnt++;
-        bEosOnInputBuf = true;
-        pBuffer->nFilledLen = 0;
-        timeStampLfile += timestampInterval;
-        pBuffer->nTimeStamp = timeStampLfile;
-        OMX_EmptyThisBuffer(hComponent,pBuffer);
-        DEBUG_PRINT("EBD..Either EOS or Some Error while reading file\n");
-    }
-    return OMX_ErrorNone;
-}
-
-void signal_handler(int sig_id) {
-
-  /* Flush */
-   if (sig_id == SIGUSR1) {
-    DEBUG_PRINT("%s Initiate flushing\n", __FUNCTION__);
-    bFlushing = true;
-    OMX_SendCommand(amr_dec_handle, OMX_CommandFlush, OMX_ALL, NULL);
-  } else if (sig_id == SIGUSR2) {
-    if (bPause == true) {
-      DEBUG_PRINT("%s resume playback\n", __FUNCTION__);
-      bPause = false;
-      OMX_SendCommand(amr_dec_handle, OMX_CommandStateSet, OMX_StateExecuting, NULL);
-    } else {
-      DEBUG_PRINT("%s pause playback\n", __FUNCTION__);
-      bPause = true;
-      OMX_SendCommand(amr_dec_handle, OMX_CommandStateSet, OMX_StatePause, NULL);
-    }
-  }
-}
-
-int main(int argc, char **argv)
-{
-    int bufCnt=0;
-    OMX_ERRORTYPE result;
-    struct sigaction sa;
-
-
-    struct wav_header hdr;
-    int bytes_writen = 0;
-
-    memset(&sa, 0, sizeof(sa));
-    sa.sa_handler = &signal_handler;
-    sigaction(SIGABRT, &sa, NULL);
-    sigaction(SIGUSR1, &sa, NULL);
-    sigaction(SIGUSR2, &sa, NULL);
-
-
-    pthread_cond_init(&cond, 0);
-    pthread_mutex_init(&lock, 0);
-
-    pthread_cond_init(&etb_cond, 0);
-    pthread_mutex_init(&etb_lock, 0);
-    pthread_mutex_init(&etb_lock1, 0);
-
-    pthread_mutexattr_init(&lock1_attr);
-    pthread_mutex_init(&lock1, &lock1_attr);
-
-    if (argc >= 7)
-    {
-      in_filename = argv[1];
-      DEBUG_PRINT("argv[1]- file name = %s\n", argv[1]);
-      samplerate = atoi(argv[2]);
-      DEBUG_PRINT("argv[2]- sample rate = %d\n", samplerate);
-      channels = atoi(argv[3]);
-      DEBUG_PRINT("argv[3]- channels = %d\n", channels);
-      pcmplayback = atoi(argv[4]);
-      DEBUG_PRINT("argv[4]- PCM play y/n = %d\n", pcmplayback);
-      filewrite = atoi(argv[5]);
-      frameFormat = atoi(argv[6]);
-      DEBUG_PRINT("argv[7]- frameFormat = %d\n", frameFormat);
-      strlcpy((char *)out_filename,argv[1],sizeof((char *)out_filename));
-      strlcat((char *)out_filename,".wav",sizeof((char *)out_filename));
-
-    }
-    else
-    {
-        DEBUG_PRINT("invalid format: ex: ");
-        DEBUG_PRINT("ex: ./sw-adec-omxamr-test AMRINPUTFILE SAMPFREQ CHANNEL\n");
-        DEBUG_PRINT("PCMPLAYBACK FILEWRITE FRAMEFORMAT\n");
-        DEBUG_PRINT( "PCMPLAYBACK = 1 (ENABLES PCM PLAYBACK IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT( "PCMPLAYBACK = 0 (DISABLES PCM PLAYBACK IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT( "FILEWRITE = 1 (ENABLES PCM FILEWRITE IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT( "FILEWRITE = 0 (DISABLES PCM FILEWRITE IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT("FRAMEFORMAT = 1 (IF1 format) \n");
-        DEBUG_PRINT("FRAMEFORMAT = 2 (IF2 format) \n");
-        DEBUG_PRINT("FRAMEFORMAT = 3 (FSF format) \n");
-        DEBUG_PRINT("FRAMEFORMAT = 4 (RTP format) \n");
-
-        return 0;
-    }
-    aud_comp = "OMX.PV.amrdec";
-
-    DEBUG_PRINT(" OMX test app : aud_comp = %s\n",aud_comp);
-
-    if(Init_Decoder(aud_comp)!= 0x00)
-    {
-        DEBUG_PRINT("Decoder Init failed\n");
-        return -1;
-    }
-
-    if(Play_Decoder() != 0x00)
-    {
-        DEBUG_PRINT("Play_Decoder failed\n");
-        return -1;
-    }
-
-    // Wait till EOS is reached...
-    wait_for_event();
-
-    DEBUG_PRINT("\nAfter wait event .....\n");
-    if(bOutputEosReached)
-    {
-#ifdef PCM_PLAYBACK
-        if(1 == pcmplayback)
-        {
-            sleep(1);
-            ioctl(m_pcmdrv_fd, AUDIO_STOP, 0);
-#ifdef AUDIOV2
-            if(devmgr_fd >= 0)
-            {
-               write_devctlcmd(devmgr_fd, "-cmd=unregister_session_rx -sid=", session_id_hpcm);
-            }
-            else
-            {
-               if (msm_route_stream(1, session_id_hpcm, device_id, 0))
-               {
-                  DEBUG_PRINT("\ncould not set stream routing\n");
-               }
-        }
-#endif
-        if(m_pcmdrv_fd >= 0)
-        {
-            close(m_pcmdrv_fd);
-            m_pcmdrv_fd = -1;
-            DEBUG_PRINT(" PCM device closed succesfully \n");
-        }
-        else
-        {
-            DEBUG_PRINT(" PCM device close failure \n");
-        }
-     }
-#endif // PCM_PLAYBACK
-
-     if(1 == filewrite)
-     {
-            hdr.riff_id = ID_RIFF;
-            hdr.riff_sz = 0;
-            hdr.riff_fmt = ID_WAVE;
-            hdr.fmt_id = ID_FMT;
-            hdr.fmt_sz = 16;
-            hdr.audio_format = FORMAT_PCM;
-            hdr.num_channels = channels;//2;
-            hdr.sample_rate = samplerate; //SAMPLE_RATE;  //44100;
-            hdr.byte_rate = hdr.sample_rate * hdr.num_channels * 2;
-            hdr.block_align = hdr.num_channels * 2;
-            hdr.bits_per_sample = 16;
-            hdr.data_id = ID_DATA;
-            hdr.data_sz = 0;
-
-            DEBUG_PRINT("output file closed and EOS reached total decoded data length %d\n",totaldatalen);
-            hdr.data_sz = totaldatalen;
-            hdr.riff_sz = totaldatalen + 8 + 16 + 8;
-            fseek(outputBufferFile, 0L , SEEK_SET);
-            bytes_writen = fwrite(&hdr,1,sizeof(hdr),outputBufferFile);
-            if (bytes_writen <= 0)
-            {
-                DEBUG_PRINT("Invalid Wav header write failed\n");
-            }
-            bFileclose = 1;
-            fclose(outputBufferFile);
-     }
-        /************************************************************************************/
-
-        DEBUG_PRINT("\nMoving the decoder to idle state \n");
-        OMX_SendCommand(amr_dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
-        wait_for_event();
-
-        DEBUG_PRINT("\nMoving the decoder to loaded state \n");
-        OMX_SendCommand(amr_dec_handle, OMX_CommandStateSet, OMX_StateLoaded,0);
-
-        DEBUG_PRINT("\nFillBufferDone: Deallocating i/p buffers \n");
-        for(bufCnt=0; bufCnt < input_buf_cnt; ++bufCnt)
-        {
-            OMX_FreeBuffer(amr_dec_handle, 0, pInputBufHdrs[bufCnt]);
-        }
-
-        DEBUG_PRINT("\nFillBufferDone: Deallocating o/p buffers \n");
-        for(bufCnt=0; bufCnt < output_buf_cnt; ++bufCnt) {
-            OMX_FreeBuffer(amr_dec_handle, 1, pOutputBufHdrs[bufCnt]);
-        }
-
-        ebd_cnt=0;
-        wait_for_event();
-        ebd_cnt=0;
-        result = OMX_FreeHandle(amr_dec_handle);
-        if (result != OMX_ErrorNone)
-        {
-            DEBUG_PRINT("\nOMX_FreeHandle error. Error code: %d\n", result);
-        }
-#ifdef AUDIOV2
-        if(devmgr_fd >= 0)
-        {
-           write_devctlcmd(devmgr_fd, "-cmd=unregister_session_rx -sid=", session_id);
-           close(devmgr_fd);
-        }
-        else
-        {
-           if (msm_route_stream(1,session_id,device_id, 0))
-           {
-              DEBUG_PRINT("\ncould not set stream routing\n");
-              return -1;
-           }
-           if (msm_en_device(device_id, 0))
-           {
-              DEBUG_PRINT("\ncould not enable device\n");
-              return -1;
-           }
-           msm_mixer_close();
-        }
-#endif
-
-        /* Deinit OpenMAX */
-        OMX_Deinit();
-        fclose(inputBufferFile);
-        timeStampLfile = 0;
-        amr_dec_handle = NULL;
-        bInputEosReached = false;
-        bOutputEosReached = false;
-        bEosOnInputBuf = 0;
-        bEosOnOutputBuf = 0;
-        pthread_cond_destroy(&cond);
-        pthread_mutex_destroy(&lock);
-        pthread_mutexattr_destroy(&lock1_attr);
-        pthread_mutex_destroy(&lock1);
-        pthread_mutex_destroy(&etb_lock1);
-        pthread_cond_destroy(&etb_cond);
-        pthread_mutex_destroy(&etb_lock);
-        etb_done = 0;
-        DEBUG_PRINT("*****************************************\n");
-        DEBUG_PRINT("******...TEST COMPLETED...***************\n");
-        DEBUG_PRINT("*****************************************\n");
-    }
-  
-    DEBUG_PRINT("\nClosing Session\n");
-    return 0;
-}
-
-int Init_Decoder(OMX_STRING audio_component)
-{
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    OMX_ERRORTYPE omxresult;
-    OMX_U32 total = 0,total1 = 0;
-    unsigned int i = 0;
-    OMX_U8** audCompNames;
-    typedef OMX_U8* OMX_U8_PTR;
-    OMX_STRING role ="audio_decoder.amrnb";
-
-    static OMX_CALLBACKTYPE call_back = {
-        &EventHandler,&EmptyBufferDone,&FillBufferDone
-    };
-
-    DEBUG_PRINT("Inside Play_Decoder - samplerate = %d\n", samplerate);
-    DEBUG_PRINT("Inside Play_Decoder - channels = %d\n", channels);
-    DEBUG_PRINT("Inside Play_Decoder - pcmplayback = %d\n", pcmplayback);
-
-    /* Init. the OpenMAX Core */
-    DEBUG_PRINT("\nInitializing OpenMAX Core....\n");
-    omxresult = OMX_Init();
-
-    if(OMX_ErrorNone != omxresult) {
-        DEBUG_PRINT("\n Failed to Init OpenMAX core");
-          return -1;
-    }
-    else {
-        DEBUG_PRINT("\nOpenMAX Core Init Done\n");
-    }
-
-    char* audiocomponent ="OMX.PV.amrdec";
-    int componentfound = false;
-    /* Query for audio decoders*/
-    DEBUG_PRINT("Amr_test: Before entering OMX_GetComponentOfRole");
-    OMX_GetComponentsOfRole(role, &total, 0);
-    DEBUG_PRINT("\nTotal components of role=%s :%lu", role, total);
-
-    if(total)
-    {
-        DEBUG_PRINT("Total number of components = %lu\n", total);
-        /* Allocate memory for pointers to component name */
-        audCompNames = (OMX_U8**)malloc((sizeof(OMX_U8))*total);
-
-        if(NULL == audCompNames)
-        {
-            return -1;
-        }
-
-        for (i = 0; i < total; ++i)
-        {
-            audCompNames[i] =
-                (OMX_U8*)malloc(sizeof(OMX_U8)*OMX_MAX_STRINGNAME_SIZE);
-            if(NULL == audCompNames[i] )
-            {
-                while (i > 0)
-                {
-                    free(audCompNames[--i]);
-                }
-                free(audCompNames);
-                return -1;
-            }
-            memset(&audCompNames[i],0,sizeof(audCompNames[i]));
-        }
-	total1 = total;
-        DEBUG_PRINT("Before calling OMX_GetComponentsOfRole()\n");
-        OMX_GetComponentsOfRole(role, &total, audCompNames);
-        DEBUG_PRINT("\nComponents of Role:%s\n", role);
-        for (i = 0; i < total; ++i)
-        {
-            if(i<total1)
-            DEBUG_PRINT("\n Found Component[%s]\n",audCompNames[i]);
-            {
-                componentfound = true;
-                audio_component = audiocomponent;
-                DEBUG_PRINT("\n audiocomponent = %p\n",audiocomponent);
-            }
-        }
-    }
-    else
-    {
-        DEBUG_PRINT("No components found with Role:%s", role);
-    }
-    if(componentfound == false)
-    {
-        DEBUG_PRINT("\n Not found audiocomponent = %p\n",audiocomponent);
-        for (i = 0; i < total1; ++i)
-                    free(audCompNames[i]);
-        free(audCompNames);
-        return -1;
-    }
-
-    omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&amr_dec_handle),
-                        (OMX_STRING)audio_component, NULL, &call_back);
-    if (FAILED(omxresult)) {
-        DEBUG_PRINT("\nFailed to Load the component:%s\n", audio_component);
-        for (i = 0; i < total1; ++i)
-                    free(audCompNames[i]);
-    return -1;
-    }
-    else
-    {
-        DEBUG_PRINT("\nComponent is in LOADED state\n");
-    }
-
-    /* Get the port information */
-    CONFIG_VERSION_SIZE(portParam);
-    omxresult = OMX_GetParameter(amr_dec_handle, OMX_IndexParamAudioInit,
-                                (OMX_PTR)&portParam);
-
-    if(FAILED(omxresult)) {
-        DEBUG_PRINT("\nFailed to get Port Param\n");
-        for (i = 0; i < total1; ++i)
-                    free(audCompNames[i]);
-    free(audCompNames);
-    return -1;
-    }
-    else
-    {
-        DEBUG_PRINT("\nportParam.nPorts:%lu\n", portParam.nPorts);
-        DEBUG_PRINT("\nportParam.nStartPortNumber:%lu\n",
-                                             portParam.nStartPortNumber);
-    }
-    for (i = 0; i < total1; ++i)
-                free(audCompNames[i]);
-    free(audCompNames);
-    return 0;
-}
-
-int Play_Decoder()
-{
-    int i;
-    int Size=0;
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    OMX_ERRORTYPE ret;
-    OMX_INDEXTYPE index;
-
-    DEBUG_PRINT("sizeof[%d]\n", sizeof(OMX_BUFFERHEADERTYPE));
-
-    /* open the i/p and o/p files based on the video file format passed */
-    if(open_audio_file()) {
-        DEBUG_PRINT("\n Returning -1");
-    return -1;
-    }
-    /* Query the decoder input min buf requirements */
-    CONFIG_VERSION_SIZE(inputportFmt);
-
-    /* Port for which the Client needs to obtain info */
-    inputportFmt.nPortIndex = portParam.nStartPortNumber;
-
-    OMX_GetParameter(amr_dec_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-    DEBUG_PRINT ("\nDec: Input Buffer Count %lu\n", inputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nDec: Input Buffer Size %lu\n", inputportFmt.nBufferSize);
-
-    if(OMX_DirInput != inputportFmt.eDir) {
-        DEBUG_PRINT ("\nDec: Expect Input Port\n");
-        return -1;
-    }
-    // Modified to Set the Actual Buffer Count for input port
-    inputportFmt.nBufferCountActual = inputportFmt.nBufferCountMin + 3;
-    OMX_SetParameter(amr_dec_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-    OMX_GetExtensionIndex(amr_dec_handle,"OMX.Qualcomm.index.audio.sessionId",&index);
-    OMX_GetParameter(amr_dec_handle,index,&streaminfoparam);
-#ifdef AUDIOV2
-    session_id = streaminfoparam.sessionId;
-    devmgr_fd = open("/data/omx_devmgr", O_WRONLY);
-    if(devmgr_fd >= 0)
-    {
-	control = 0;
-	write_devctlcmd(devmgr_fd, "-cmd=register_session_rx -sid=", session_id);
-    }
-#endif
-    /* Query the decoder outport's min buf requirements */
-    CONFIG_VERSION_SIZE(outputportFmt);
-    /* Port for which the Client needs to obtain info */
-    outputportFmt.nPortIndex = portParam.nStartPortNumber + 1;
-
-    OMX_GetParameter(amr_dec_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-    DEBUG_PRINT ("\nDec: Output Buffer Count %lu\n", outputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nDec: Output Buffer Size %lu\n", outputportFmt.nBufferSize);
-
-    if(OMX_DirOutput != outputportFmt.eDir) {
-        DEBUG_PRINT ("\nDec: Expect Output Port\n");
-        return -1;
-    }
-    // Modified to Set the Actual Buffer Count for output port
-    outputportFmt.nBufferCountActual = outputportFmt.nBufferCountMin + 1;
-    OMX_SetParameter(amr_dec_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-
-    CONFIG_VERSION_SIZE(amrparam);
-
-    OMX_GetParameter(amr_dec_handle,OMX_IndexParamAudioAmr,&amrparam);
-    amrparam.nPortIndex   =  0;
-    amrparam.nChannels    =  1; //2 ; /* 1-> mono 2-> stereo*/
-    amrparam.nBitRate     =  8000; //SAMPLE_RATE;
-    amrparam.eAMRBandMode = OMX_AUDIO_AMRBandModeNB0; //default mode 
-    if (frameFormat == 1)
-    {
-        amrparam.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatIF1;
-    }
-    else if (frameFormat == 2)
-    {
-        amrparam.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatIF2;
-    }
-    else if (frameFormat == 3)
-    {
-         amrparam.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;
-    }
-    else if (frameFormat == 4)
-    {
-         amrparam.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatRTPPayload;
-    }
-    OMX_SetParameter(amr_dec_handle,OMX_IndexParamAudioAmr,&amrparam);
-
-
-    DEBUG_PRINT ("\nOMX_SendCommand Decoder -> IDLE\n");
-    OMX_SendCommand(amr_dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
-    /* wait_for_event(); should not wait here event complete status will
-       not come until enough buffer are allocated */
-
-    input_buf_cnt = inputportFmt.nBufferCountMin + 3;
-    DEBUG_PRINT("Transition to Idle State succesful...\n");
-    /* Allocate buffer on decoder's i/p port */
-    error = Allocate_Buffer(amr_dec_handle, &pInputBufHdrs, inputportFmt.nPortIndex,
-                            input_buf_cnt, inputportFmt.nBufferSize);
-    if (error != OMX_ErrorNone) {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Input buffer error\n");
-        return -1;
-    }
-    else {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Input buffer success\n");
-    }
-
-    output_buf_cnt = outputportFmt.nBufferCountMin + 1 ;
-
-    /* Allocate buffer on decoder's O/Pp port */
-    error = Allocate_Buffer(amr_dec_handle, &pOutputBufHdrs, outputportFmt.nPortIndex,
-                            output_buf_cnt, outputportFmt.nBufferSize);
-    if (error != OMX_ErrorNone) {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer error\n");
-    return -1;
-    }
-    else {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer success\n");
-    }
-
-    wait_for_event();
-
-    DEBUG_PRINT ("\nOMX_SendCommand Decoder -> Executing\n");
-    OMX_SendCommand(amr_dec_handle, OMX_CommandStateSet, OMX_StateExecuting,0);
-    wait_for_event();
-
-    DEBUG_PRINT(" Start sending OMX_FILLthisbuffer\n");
-
-    for(i=0; i < output_buf_cnt; i++) {
-        DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
-        pOutputBufHdrs[i]->nOutputPortIndex = 1;
-        pOutputBufHdrs[i]->nFlags &= ~OMX_BUFFERFLAG_EOS;
-        ret = OMX_FillThisBuffer(amr_dec_handle, pOutputBufHdrs[i]);
-        if (OMX_ErrorNone != ret) {
-            DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
-        }
-        else {
-            DEBUG_PRINT("OMX_FillThisBuffer success!\n");
-        }
-    }
-
-    DEBUG_PRINT(" Start sending OMX_emptythisbuffer\n");
-    for (i = 0;i < input_buf_cnt;i++) {
-
-        DEBUG_PRINT ("\nOMX_EmptyThisBuffer on Input buf no.%d\n",i);
-        pInputBufHdrs[i]->nInputPortIndex = 0;
-        Size = Read_Buffer(pInputBufHdrs[i]);
-        if(Size <=0 ){
-          DEBUG_PRINT("NO DATA READ\n");
-          bInputEosReached = true;
-          pInputBufHdrs[i]->nFlags= OMX_BUFFERFLAG_EOS;
-        }
-        pInputBufHdrs[i]->nFilledLen = Size;
-        pInputBufHdrs[i]->nInputPortIndex = 0;
-        used_ip_buf_cnt++;
-        timeStampLfile += timestampInterval;
-        pInputBufHdrs[i]->nTimeStamp = timeStampLfile;
-        ret = OMX_EmptyThisBuffer(amr_dec_handle, pInputBufHdrs[i]);
-        if (OMX_ErrorNone != ret) {
-            DEBUG_PRINT("OMX_EmptyThisBuffer failed with result %d\n", ret);
-        }
-        else {
-            DEBUG_PRINT("OMX_EmptyThisBuffer success!\n");
-        }
-        if(Size <=0 ){
-            break;//eos reached
-        }
-    }
-    pthread_mutex_lock(&etb_lock1);
-    if(etb_done)
-    {
-        DEBUG_PRINT("\n****************************\n");
-        DEBUG_PRINT("Component is waiting for EBD to be releases, BC signal\n");
-        DEBUG_PRINT("\n****************************\n");
-	etb_event_complete();
-    }
-    else
-    {
-        DEBUG_PRINT("\n****************************\n");
-        DEBUG_PRINT("EBD not yet happened ...\n");
-        DEBUG_PRINT("\n****************************\n");
-        etb_done++;
-    }
-    pthread_mutex_unlock(&etb_lock1);
-
-    return 0;
-}
-
-
-
-static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *avc_dec_handle,
-                                       OMX_BUFFERHEADERTYPE  ***pBufHdrs,
-                                       OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize)
-{
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    OMX_ERRORTYPE error=OMX_ErrorNone;
-    long bufCnt=0;
-
-    /* To remove warning for unused variable to keep prototype same */
-    (void)avc_dec_handle;
-    *pBufHdrs= (OMX_BUFFERHEADERTYPE **)
-                   malloc(sizeof(OMX_BUFFERHEADERTYPE*)*bufCntMin);
-
-    for(bufCnt=0; bufCnt < bufCntMin; ++bufCnt) {
-        DEBUG_PRINT("\n OMX_AllocateBuffer No %ld \n", bufCnt);
-        error = OMX_AllocateBuffer(amr_dec_handle, &((*pBufHdrs)[bufCnt]),
-                                   nPortIndex, NULL, bufSize);
-    }
-
-    return error;
-}
-
-
-
-
-static int Read_Buffer (OMX_BUFFERHEADERTYPE  *pBufHdr )
-{
-
-    int bytes_read=0;
-    static int totalbytes_read =0;
-
-    DEBUG_PRINT ("\nInside Read_Buffer\n");
-
-    pBufHdr->nFilledLen = 0;
-    pBufHdr->nFlags |= OMX_BUFFERFLAG_EOS;
-
-    DEBUG_PRINT("AllocLen:%lu\n", pBufHdr->nAllocLen);
-    
-    bytes_read = fread(pBufHdr->pBuffer,1,pBufHdr->nAllocLen ,inputBufferFile);
-
-    totalbytes_read += bytes_read;
-    DEBUG_PRINT ("bytes_read = %d\n",bytes_read);
-    DEBUG_PRINT ("totalbytes_read = %d\n",totalbytes_read);
-    pBufHdr->nFilledLen = bytes_read;
-    if( bytes_read <= 0)
-    {
-        pBufHdr->nFlags |= OMX_BUFFERFLAG_EOS;
-        DEBUG_PRINT ("\nBytes read zero\n");
-    }
-    else
-    {
-        pBufHdr->nFlags &= ~OMX_BUFFERFLAG_EOS;
-        DEBUG_PRINT ("\nBytes read is Non zero\n");
-    }
-    return bytes_read;
-}
-
-static int open_audio_file ()
-{
-    int error_code = 0;
-    struct wav_header hdr;
-    int header_len = 0;
-    memset(&hdr,0,sizeof(hdr));
-
-    hdr.riff_id = ID_RIFF;
-    hdr.riff_sz = 0;
-    hdr.riff_fmt = ID_WAVE;
-    hdr.fmt_id = ID_FMT;
-    hdr.fmt_sz = 16;
-    hdr.audio_format = FORMAT_PCM;
-    hdr.num_channels = channels;
-    hdr.sample_rate = samplerate;
-    hdr.byte_rate = hdr.sample_rate * hdr.num_channels * 2;
-    hdr.block_align = hdr.num_channels * 2;
-    hdr.bits_per_sample = 16;
-    hdr.data_id = ID_DATA;
-    hdr.data_sz = 0;
-
-    DEBUG_PRINT("Inside %s filename=%s\n", __FUNCTION__, in_filename);
-    inputBufferFile = fopen (in_filename, "rb");
-    if (inputBufferFile == NULL) {
-        DEBUG_PRINT("\ni/p file %s could NOT be opened\n",
-                                         in_filename);
-        error_code = -1;
-        return error_code;
-    }
-    DEBUG_PRINT("Setting the file pointer to the beginging of the byte");
-    fseek(inputBufferFile, 0, SEEK_SET);
-
-    if(filewrite == 1)
-    {
-        DEBUG_PRINT("output file is opened\n");
-
-        outputBufferFile = fopen(out_filename,"wb");
-        if (outputBufferFile == NULL)
-        {
-            DEBUG_PRINT("\no/p file %s could NOT be opened\n",
-                                             out_filename);
-            error_code = -1;
-            return error_code;
-        }
-
-        header_len = fwrite(&hdr,1,sizeof(hdr),outputBufferFile);
-        if (header_len <= 0)
-        {
-            DEBUG_PRINT("Invalid Wav header \n");
-        }
-        DEBUG_PRINT(" Length og wav header is %d \n",header_len );
-    }
-    return error_code;
-}
-
-static void write_devctlcmd(int fd, const void *buf, int param){
-	int nbytes, nbytesWritten;
-	char cmdstr[128];
-	snprintf(cmdstr, 128, "%s%d\n", (char *)buf, param);
-	nbytes = strlen(cmdstr);
-	nbytesWritten = write(fd, cmdstr, nbytes);
-
-	if(nbytes != nbytesWritten)
-		printf("Failed to write string \"%s\" to omx_devmgr\n", cmdstr);
-}
-
-
-
diff --git a/mm-audio/adec-amrwb/Android.mk b/mm-audio/adec-amrwb/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/mm-audio/adec-amrwb/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/mm-audio/adec-amrwb/sw/Android.mk b/mm-audio/adec-amrwb/sw/Android.mk
deleted file mode 100644
index 5de1d9d..0000000
--- a/mm-audio/adec-amrwb/sw/Android.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-ifneq ($(BUILD_TINY_ANDROID),true)
-ifneq ($(BUILD_WITHOUT_PV),true)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# ---------------------------------------------------------------------------------
-#                 Common definitons
-# ---------------------------------------------------------------------------------
-
-libOmxAmrDec-def := -g -O3
-libOmxAmrDec-def += -DQC_MODIFIED
-libOmxAmrDec-def += -D_ANDROID_
-libOmxAmrDec-def += -D_ENABLE_QC_MSG_LOG_
-libOmxAmrDec-def += -DVERBOSE
-libOmxAmrDec-def += -D_DEBUG
-libOmxAmrDec-def += -DAUDIOV2
-
-ifeq ($(BOARD_USES_QCOM_AUDIO_V2), true)
-libOmxAmrDec-def += -DAUDIOV2
-endif
-
-# ---------------------------------------------------------------------------------
-#             Make the apps-test (sw-adec-omxamr-test)
-# ---------------------------------------------------------------------------------
-
-include $(CLEAR_VARS)
-
-ifeq ($(BOARD_USES_QCOM_AUDIO_V2), true)
-mm-amr-dec-test-inc   += $(TARGET_OUT_HEADERS)/mm-audio/audio-alsa
-mm-amr-dec-test-inc   += $(TARGET_OUT_HEADERS)/mm-core/omxcore
-mm-amr-dec-test-inc   += $(PV_TOP)/codecs_v2/omx/omx_mastercore/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_common/include \
-        		 $(PV_TOP)/extern_libs_v2/khronos/openmax/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_baseclass/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_amr/include \
-        		 $(PV_TOP)/codecs_v2/audio/amr/dec/include \
-
-LOCAL_MODULE            := sw-adec-omxamrwb-test
-LOCAL_MODULE_TAGS       := optional
-LOCAL_CFLAGS            := $(libOmxAmrDec-def)
-LOCAL_C_INCLUDES        := $(mm-amr-dec-test-inc)
-LOCAL_PRELINK_MODULE    := false
-LOCAL_SHARED_LIBRARIES  := libopencore_common
-LOCAL_SHARED_LIBRARIES  += libomx_sharedlibrary
-LOCAL_SHARED_LIBRARIES  += libomx_amrdec_sharedlibrary
-LOCAL_SHARED_LIBRARIES  += libaudioalsa
-LOCAL_SRC_FILES         := test/omx_amrwb_dec_test.c
-
-include $(BUILD_EXECUTABLE)
-endif
-
-endif #BUILD_WITHOUT_PV
-endif #BUILD_TINY_ANDROID
-
-# ---------------------------------------------------------------------------------
-#                     END
-# ---------------------------------------------------------------------------------
diff --git a/mm-audio/adec-amrwb/sw/test/omx_amrwb_dec_test.c b/mm-audio/adec-amrwb/sw/test/omx_amrwb_dec_test.c
deleted file mode 100644
index 5e9d748..0000000
--- a/mm-audio/adec-amrwb/sw/test/omx_amrwb_dec_test.c
+++ /dev/null
@@ -1,1283 +0,0 @@
-
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-    * Neither the name of The Linux Foundation nor
-      the names of its contributors may be used to endorse or promote
-      products derived from this software without specific prior written
-      permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-
-/*
-	An Open max test application ....
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include "OMX_Core.h"
-#include "QOMX_AudioExtensions.h"
-#include "QOMX_AudioIndexExtensions.h"
-#include "OMX_Component.h"
-#include "pthread.h"
-#include <signal.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <stdint.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <linux/msm_audio.h>
-#include<unistd.h>
-#include<string.h>
-#include <pthread.h>
-#ifdef AUDIOV2
-#include "control.h"
-#endif
-
-#ifdef AUDIOV2
-unsigned short session_id;
-unsigned short session_id_hpcm;
-int device_id;
-int control = 0;
-const char *device="handset_rx";
-int devmgr_fd;
-#endif
-
-#include <linux/ioctl.h>
-
-#define SAMPLE_RATE 8000
-#define STEREO      2
-uint32_t samplerate = 8000;
-uint32_t channels = 1;
-uint32_t pcmplayback = 0;
-uint32_t tunnel      = 0;
-uint32_t filewrite   = 0;
-
-QOMX_AUDIO_STREAM_INFO_DATA streaminfoparam;
-
-int sf = 0;
-int ch = 0;
-int format = 0;
-
-#ifdef _DEBUG
-
-#define DEBUG_PRINT(args...) printf("%s:%d ", __FUNCTION__, __LINE__); \
-    printf(args)
-
-#define DEBUG_PRINT_ERROR(args...) printf("%s:%d ", __FUNCTION__, __LINE__); \
-    printf(args)
-
-#else
-
-#define DEBUG_PRINT
-#define DEBUG_PRINT_ERROR
-
-#endif
-
-
-#define PCM_PLAYBACK /* To write the pcm decoded data to the msm_pcm device for playback*/
-
-int   m_pcmdrv_fd;
-
-/************************************************************************/
-/*                #DEFINES                            */
-/************************************************************************/
-#define false 0
-#define true 1
-
-#define CONFIG_VERSION_SIZE(param) \
-    param.nVersion.nVersion = CURRENT_OMX_SPEC_VERSION;\
-    param.nSize = sizeof(param);
-
-#define FAILED(result) (result != OMX_ErrorNone)
-
-#define SUCCEEDED(result) (result == OMX_ErrorNone)
-
-/************************************************************************/
-/*                GLOBAL DECLARATIONS                     */
-/************************************************************************/
-
-pthread_mutex_t lock;
-pthread_mutex_t lock1;
-pthread_mutexattr_t lock1_attr;
-pthread_mutex_t etb_lock1;
-pthread_mutex_t etb_lock;
-pthread_cond_t etb_cond;
-
-pthread_cond_t cond;
-pthread_mutex_t elock;
-pthread_cond_t econd;
-pthread_cond_t fcond;
-FILE * inputBufferFile;
-FILE * outputBufferFile;
-OMX_PARAM_PORTDEFINITIONTYPE inputportFmt;
-OMX_PARAM_PORTDEFINITIONTYPE outputportFmt;
-
-OMX_AUDIO_PARAM_AMRTYPE amrparam;
-QOMX_AUDIO_PARAM_AMRWBPLUSTYPE amrwbPlusparam;
-
-OMX_PORT_PARAM_TYPE portParam;
-OMX_ERRORTYPE error;
-OMX_U8* pBuffer_tmp = NULL;
-
-/* AMRWB specific macros */
-
-//AMR-WB Number of channels
-#define AMRWB_CHANNELS 1
-
-//AMR-WB Sampling rate
-#define AMRWB_SAMPLE_RATE 16000
-
-//AMR-WB File Header size
-#define AMRWB_FILE_HEADER_SIZE 9
-
-/* http://ccrma.stanford.edu/courses/422/projects/WaveFormat/ */
-
-#define ID_RIFF 0x46464952
-#define ID_WAVE 0x45564157
-#define ID_FMT  0x20746d66
-#define ID_DATA 0x61746164
-
-#define FORMAT_PCM 1
-
-static int bFileclose = 0;
-
-struct wav_header {
-  uint32_t riff_id;
-  uint32_t riff_sz;
-  uint32_t riff_fmt;
-  uint32_t fmt_id;
-  uint32_t fmt_sz;
-  uint16_t audio_format;
-  uint16_t num_channels;
-  uint32_t sample_rate;
-  uint32_t byte_rate;       /* sample_rate * num_channels * bps / 8 */
-  uint16_t block_align;     /* num_channels * bps / 8 */
-  uint16_t bits_per_sample;
-  uint32_t data_id;
-  uint32_t data_sz;
-};
-
-static unsigned totaldatalen = 0;
-
-/************************************************************************/
-/*                GLOBAL INIT                    */
-/************************************************************************/
-
-int input_buf_cnt = 0;
-int output_buf_cnt = 0;
-int used_ip_buf_cnt = 0;
-volatile int event_is_done = 0;
-volatile int ebd_event_is_done = 0;
-volatile int fbd_event_is_done = 0;
-int ebd_cnt;
-int bOutputEosReached = 0;
-int bInputEosReached = 0;
-int bEosOnInputBuf = 0;
-int bEosOnOutputBuf = 0;
-static int etb_done = 0;
-static int etb_event_is_done = 0;
-
-int bFlushing = false;
-int bPause    = false;
-const char *in_filename;
-
-
-int timeStampLfile = 0;
-int timestampInterval = 100;
-
-//* OMX Spec Version supported by the wrappers. Version = 1.1 */
-const OMX_U32 CURRENT_OMX_SPEC_VERSION = 0x00000101;
-OMX_COMPONENTTYPE* amrwb_dec_handle = 0;
-
-OMX_BUFFERHEADERTYPE  **pInputBufHdrs = NULL;
-OMX_BUFFERHEADERTYPE  **pOutputBufHdrs = NULL;
-
-/************************************************************************/
-/*				GLOBAL FUNC DECL                        */
-/************************************************************************/
-int Init_Decoder(OMX_STRING audio_component);
-int Play_Decoder();
-
-OMX_STRING aud_comp;
-
-/**************************************************************************/
-/*				STATIC DECLARATIONS                       */
-/**************************************************************************/
-
-static int open_audio_file ();
-static int Read_Buffer(OMX_BUFFERHEADERTYPE  *pBufHdr );
-static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *amrwb_dec_handle,
-                                       OMX_BUFFERHEADERTYPE  ***pBufHdrs,
-                                       OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize);
-
-
-static OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
-                                  OMX_IN OMX_PTR pAppData,
-                                  OMX_IN OMX_EVENTTYPE eEvent,
-                                  OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
-                                  OMX_IN OMX_PTR pEventData);
-static OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                                     OMX_IN OMX_PTR pAppData,
-                                     OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
-static OMX_ERRORTYPE FillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                                     OMX_IN OMX_PTR pAppData,
-                                     OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
-static void write_devctlcmd(int fd, const void *buf, int param);
-
-void wait_for_event(void)
-{
-    pthread_mutex_lock(&lock);
-    DEBUG_PRINT("%s: event_is_done=%d", __FUNCTION__, event_is_done);
-    while (event_is_done == 0) {
-        pthread_cond_wait(&cond, &lock);
-    }
-    event_is_done = 0;
-    pthread_mutex_unlock(&lock);
-}
-
-void event_complete(void )
-{
-    pthread_mutex_lock(&lock);
-    if (event_is_done == 0) {
-        event_is_done = 1;
-        pthread_cond_broadcast(&cond);
-    }
-    pthread_mutex_unlock(&lock);
-}
-
-
-void etb_wait_for_event(void)
-{
-    pthread_mutex_lock(&etb_lock);
-    DEBUG_PRINT("%s: etb_event_is_done=%d", __FUNCTION__, etb_event_is_done);
-    while (etb_event_is_done == 0) {
-        pthread_cond_wait(&etb_cond, &etb_lock);
-    }
-    etb_event_is_done = 0;
-    pthread_mutex_unlock(&etb_lock);
-}
-
-void etb_event_complete(void )
-{
-    pthread_mutex_lock(&etb_lock);
-    if (etb_event_is_done == 0) {
-        etb_event_is_done = 1;
-        DEBUG_PRINT("%s: etb_event_is_done=%d", __FUNCTION__, etb_event_is_done);
-        pthread_cond_broadcast(&etb_cond);
-    }
-    pthread_mutex_unlock(&etb_lock);
-}
-
-
-OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
-                           OMX_IN OMX_PTR pAppData,
-                           OMX_IN OMX_EVENTTYPE eEvent,
-                           OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
-                           OMX_IN OMX_PTR pEventData)
-{
-    DEBUG_PRINT("Function %s \n", __FUNCTION__);
-    int bufCnt = 0;
-    /* To remove warning for unused variable to keep prototype same */
-    (void)hComponent;
-    (void)pAppData;
-    (void)pEventData;
-
-    switch(eEvent)
-    {
-    case OMX_EventCmdComplete:
-        DEBUG_PRINT("*********************************************\n");
-        DEBUG_PRINT("\n OMX_EventCmdComplete \n");
-        DEBUG_PRINT("*********************************************\n");
-        if(OMX_CommandPortDisable == (OMX_COMMANDTYPE)nData1)
-        {
-            DEBUG_PRINT("******************************************\n");
-            DEBUG_PRINT("Recieved DISABLE Event Command Complete[%lu]\n",nData2);
-            DEBUG_PRINT("******************************************\n");
-        }
-        else if(OMX_CommandPortEnable == (OMX_COMMANDTYPE)nData1)
-        {
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("Recieved ENABLE Event Command Complete[%lu]\n",nData2);
-            DEBUG_PRINT("*********************************************\n");
-        }
-        else if(OMX_CommandFlush== (OMX_COMMANDTYPE)nData1)
-        {
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("Recieved FLUSH Event Command Complete[%lu]\n",nData2);
-            DEBUG_PRINT("*********************************************\n");
-        }
-        event_complete();
-        break;
-    case OMX_EventError:
-        DEBUG_PRINT("*********************************************\n");
-        DEBUG_PRINT("\n OMX_EventError \n");
-        DEBUG_PRINT("*********************************************\n");
-        if(OMX_ErrorInvalidState == (OMX_ERRORTYPE)nData1)
-        {
-            DEBUG_PRINT("\n OMX_ErrorInvalidState \n");
-            for(bufCnt=0; bufCnt < input_buf_cnt; ++bufCnt)
-            {
-                OMX_FreeBuffer(amrwb_dec_handle, 0, pInputBufHdrs[bufCnt]);
-            }
-            for(bufCnt=0; bufCnt < output_buf_cnt; ++bufCnt)
-            {
-                    OMX_FreeBuffer(amrwb_dec_handle, 1, pOutputBufHdrs[bufCnt]);
-            }
-
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("\n Component Deinitialized \n");
-            DEBUG_PRINT("*********************************************\n");
-            exit(0);
-        }
-        break;
-
-    case OMX_EventPortSettingsChanged:
-        DEBUG_PRINT("*********************************************\n");
-        DEBUG_PRINT("\n OMX_EventPortSettingsChanged \n");
-        DEBUG_PRINT("*********************************************\n");
-        event_complete();
-        break;
-    case OMX_EventBufferFlag:
-        DEBUG_PRINT("*********************************************\n");
-        DEBUG_PRINT("\n OMX_Bufferflag \n");
-        DEBUG_PRINT("*********************************************\n");
-        bOutputEosReached = true;
-        event_complete();
-        break;
-    default:
-        DEBUG_PRINT("\n Unknown Event \n");
-        break;
-    }
-    return OMX_ErrorNone;
-}
-
-
-OMX_ERRORTYPE FillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                              OMX_IN OMX_PTR pAppData,
-                              OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
-{
-   unsigned int i=0;
-   int bytes_writen = 0;
-   static int count = 0;
-   static int copy_done = 0;
-   static int start_done = 0;
-   static int length_filled = 0;
-   static int spill_length = 0;
-   static int pcm_buf_size = 4800;
-   static unsigned int pcm_buf_count = 2;
-   struct msm_audio_config drv_pcm_config;
-
-    /* To remove warning for unused variable to keep prototype same */
-   (void)pAppData;
-
-   if(count == 0 && pcmplayback)
-   {
-       DEBUG_PRINT(" open pcm device \n");
-       m_pcmdrv_fd = open("/dev/msm_pcm_out", O_RDWR);
-       if (m_pcmdrv_fd < 0)
-       {
-          DEBUG_PRINT("Cannot open audio device\n");
-          return -1;
-       }
-       else
-       {
-          DEBUG_PRINT("Open pcm device successfull\n");
-          DEBUG_PRINT("Configure Driver for PCM playback \n");
-          ioctl(m_pcmdrv_fd, AUDIO_GET_CONFIG, &drv_pcm_config);
-          DEBUG_PRINT("drv_pcm_config.buffer_count %d \n", drv_pcm_config.buffer_count);
-          DEBUG_PRINT("drv_pcm_config.buffer_size %d \n", drv_pcm_config.buffer_size);
-          drv_pcm_config.sample_rate = sf;//SAMPLE_RATE; //m_adec_param.nSampleRate;
-          drv_pcm_config.channel_count = ch;//channels;  /* 1-> mono 2-> stereo*/
-          ioctl(m_pcmdrv_fd, AUDIO_SET_CONFIG, &drv_pcm_config);
-          DEBUG_PRINT("Configure Driver for PCM playback \n");
-          ioctl(m_pcmdrv_fd, AUDIO_GET_CONFIG, &drv_pcm_config);
-          DEBUG_PRINT("drv_pcm_config.buffer_count %d \n", drv_pcm_config.buffer_count);
-          DEBUG_PRINT("drv_pcm_config.buffer_size %d \n", drv_pcm_config.buffer_size);
-          pcm_buf_size = drv_pcm_config.buffer_size;
-          pcm_buf_count = drv_pcm_config.buffer_count;
-#ifdef AUDIOV2
-          ioctl(m_pcmdrv_fd, AUDIO_GET_SESSION_ID, &session_id_hpcm);
-          DEBUG_PRINT("session id 0x%4x \n", session_id_hpcm);
-	  if(devmgr_fd >= 0)
-	  {
-	     write_devctlcmd(devmgr_fd, "-cmd=register_session_rx -sid=",  session_id_hpcm);
-	  }
-          else
-          {
-             control = msm_mixer_open("/dev/snd/controlC0", 0);
-             if(control < 0)
-                printf("ERROR opening the device\n");
-             device_id = msm_get_device(device);
-             DEBUG_PRINT ("\ndevice_id = %d\n",device_id);
-             DEBUG_PRINT("\nsession_id = %d\n",session_id);
-             if (msm_en_device(device_id, 1))
-             {
-                perror("could not enable device\n");
-                return -1;
-             }
-             if (msm_route_stream(1, session_id_hpcm,device_id, 1))
-             {
-                 DEBUG_PRINT("could not set stream routing\n");
-                 return -1;
-             }	
-          }
-#endif
-       }
-       pBuffer_tmp= (OMX_U8*)malloc(pcm_buf_count*sizeof(OMX_U8)*pcm_buf_size);
-       if (pBuffer_tmp == NULL)
-       {
-         return -1;
-       }
-       else
-       {
-         memset(pBuffer_tmp, 0, pcm_buf_count*pcm_buf_size);
-       }
-   }
-   DEBUG_PRINT(" FillBufferDone #%d size %lu\n", count++,pBuffer->nFilledLen);
-
-    if(bEosOnOutputBuf)
-        return OMX_ErrorNone;
-
-    if(filewrite == 1)
-    {
-        bytes_writen =
-        fwrite(pBuffer->pBuffer,1,pBuffer->nFilledLen,outputBufferFile);
-        DEBUG_PRINT(" FillBufferDone size writen to file  %d\n",bytes_writen);
-        totaldatalen += bytes_writen ;
-    }
-
-#ifdef PCM_PLAYBACK
-    if(pcmplayback && pBuffer->nFilledLen)
-    {
-        if(start_done == 0)
-        {
-            if((length_filled+pBuffer->nFilledLen)>=(pcm_buf_count*pcm_buf_size))
-            {
-                spill_length = (pBuffer->nFilledLen-(pcm_buf_count*pcm_buf_size)+length_filled);
-                memcpy (pBuffer_tmp+length_filled, pBuffer->pBuffer, ((pcm_buf_count*pcm_buf_size)-length_filled));
-                length_filled = (pcm_buf_count*pcm_buf_size);
-                copy_done = 1;
-            }
-            else
-            {
-                memcpy (pBuffer_tmp+length_filled, pBuffer->pBuffer, pBuffer->nFilledLen);
-               length_filled +=pBuffer->nFilledLen;
-            }
-            if (copy_done == 1)
-            {
-                for (i=0; i<pcm_buf_count; i++)
-                {
-                   if (write(m_pcmdrv_fd, pBuffer_tmp+i*pcm_buf_size, pcm_buf_size ) != pcm_buf_size)
-                   {
-                      DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                           return -1;
-                   }
-
-                }
-             DEBUG_PRINT("AUDIO_START called for PCM \n");
-             ioctl(m_pcmdrv_fd, AUDIO_START, 0);
-             if (spill_length != 0)
-             {
-                if (write(m_pcmdrv_fd, pBuffer->pBuffer+((pBuffer->nFilledLen)-spill_length), spill_length) != spill_length)
-                {
-                   DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                   return -1;
-                }
-             }
-             if (pBuffer_tmp)
-             {
-                 free(pBuffer_tmp);
-                 pBuffer_tmp =NULL;
-             }
-             copy_done = 0;
-             start_done = 1;
-            }
-        }
-        else
-        {
-            if (write(m_pcmdrv_fd, pBuffer->pBuffer, pBuffer->nFilledLen ) !=
-                (ssize_t)pBuffer->nFilledLen)
-            {
-                DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                return OMX_ErrorNone;
-            }
-        }
-
-        DEBUG_PRINT(" FillBufferDone: writing data to pcm device for play succesfull \n");
-    }
-#endif   // PCM_PLAYBACK
-
-
-    if(pBuffer->nFlags != OMX_BUFFERFLAG_EOS)
-    {
-        DEBUG_PRINT(" FBD calling FTB");
-        OMX_FillThisBuffer(hComponent,pBuffer);
-    }
-    else
-    {
-        DEBUG_PRINT(" FBD EOS REACHED...........\n");
-        bEosOnOutputBuf = true;
-        return OMX_ErrorNone;
-    }
-    return OMX_ErrorNone;
-}
-
-
-OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                              OMX_IN OMX_PTR pAppData,
-                              OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
-{
-    int readBytes =0;
-
-    /* To remove warning for unused variable to keep prototype same */
-    (void)pAppData;
-
-    DEBUG_PRINT("\nFunction %s cnt[%d]\n", __FUNCTION__, ebd_cnt);
-    ebd_cnt++;
-    used_ip_buf_cnt--;
-    pthread_mutex_lock(&etb_lock1);
-    if(!etb_done)
-    {
-        DEBUG_PRINT("\n*********************************************\n");
-        DEBUG_PRINT("Wait till first set of buffers are given to component\n");
-        DEBUG_PRINT("\n*********************************************\n");
-        etb_done++;
-        pthread_mutex_unlock(&etb_lock1);
-	DEBUG_PRINT("EBD: Before etb_wait_for_event.....\n");
-        etb_wait_for_event();
-    }
-    else
-    {
-        pthread_mutex_unlock(&etb_lock1);
-    }
-    if(bEosOnInputBuf)
-    {
-        DEBUG_PRINT("\n*********************************************\n");
-        DEBUG_PRINT("   EBD::EOS on input port\n ");
-        DEBUG_PRINT("*********************************************\n");
-        return OMX_ErrorNone;
-    }
-    else if (true == bFlushing)
-    {
-        DEBUG_PRINT("omx_amrwb_adec_test: bFlushing is set to TRUE used_ip_buf_cnt=%d\n",used_ip_buf_cnt);
-        if (0 == used_ip_buf_cnt)
-        {
-            bFlushing = false;
-        }
-        else
-        {
-            DEBUG_PRINT("omx_amr_adec_test: more buffer to come back\n");
-            return OMX_ErrorNone;
-        }
-    }
-    if((readBytes = Read_Buffer(pBuffer)) > 0)
-    {
-        pBuffer->nFilledLen = readBytes;
-        used_ip_buf_cnt++;
-        timeStampLfile += timestampInterval;
-        pBuffer->nTimeStamp = timeStampLfile;
-        OMX_EmptyThisBuffer(hComponent,pBuffer);
-    }
-    else
-    {
-        pBuffer->nFlags |= OMX_BUFFERFLAG_EOS;
-        used_ip_buf_cnt++;
-        bEosOnInputBuf = true;
-        pBuffer->nFilledLen = 0;
-        timeStampLfile += timestampInterval;
-        pBuffer->nTimeStamp = timeStampLfile;
-        OMX_EmptyThisBuffer(hComponent,pBuffer);
-        DEBUG_PRINT("EBD..Either EOS or Some Error while reading file\n");
-    }
-    return OMX_ErrorNone;
-}
-
-void signal_handler(int sig_id)
-{
-   if (sig_id == SIGUSR1)
-   {
-        DEBUG_PRINT("%s Initiate flushing\n", __FUNCTION__);
-        bFlushing = true;
-        OMX_SendCommand(amrwb_dec_handle, OMX_CommandFlush, OMX_ALL, NULL);
-   }
-   else if (sig_id == SIGUSR2)
-   {
-        if (bPause == true)
-        {
-            DEBUG_PRINT("%s resume playback\n", __FUNCTION__);
-            bPause = false;
-            OMX_SendCommand(amrwb_dec_handle, OMX_CommandStateSet, OMX_StateExecuting, NULL);
-        }
-        else
-        {
-            DEBUG_PRINT("%s pause playback\n", __FUNCTION__);
-            bPause = true;
-            OMX_SendCommand(amrwb_dec_handle, OMX_CommandStateSet, OMX_StatePause, NULL);
-        }
-    }
-}
-
-int main(int argc, char **argv)
-{
-    int bufCnt=0;
-    OMX_ERRORTYPE result;
-    struct sigaction sa;
-    struct wav_header hdr;
-    int bytes_writen = 0;
-
-    memset(&sa, 0, sizeof(sa));
-    sa.sa_handler = &signal_handler;
-    sigaction(SIGABRT, &sa, NULL);
-    sigaction(SIGUSR1, &sa, NULL);
-    sigaction(SIGUSR2, &sa, NULL);
-
-
-    pthread_cond_init(&cond, 0);
-    pthread_mutex_init(&lock, 0);
-    pthread_cond_init(&etb_cond, 0);
-    pthread_mutex_init(&etb_lock, 0);
-    pthread_mutex_init(&etb_lock1, 0);
-
-    pthread_mutexattr_init(&lock1_attr);
-    pthread_mutex_init(&lock1, &lock1_attr);
-
-    if (argc == 6)
-    {
-        in_filename = argv[1];
-        DEBUG_PRINT("argv[1]- file name = %s\n", argv[1]);
-        pcmplayback = atoi(argv[2]);
-        DEBUG_PRINT("argv[2]- PCM play y/n = %d\n", pcmplayback);
-        filewrite = atoi(argv[3]);
-        sf = atoi(argv[4]);
-        ch = atoi(argv[5]);
-    }
-    else
-    {
-        DEBUG_PRINT("\ninvalid format\n");
-        DEBUG_PRINT("ex: ./sw-adec-omxamrwb-test AMRINPUTFILE PCMPLAYBACK");
-        DEBUG_PRINT("FILEWRITE SAMP-FREQ CHANNELS\n");
-	DEBUG_PRINT( "PCMPLAYBACK = 1 (ENABLES PCM PLAYBACK IN NON TUNNEL MODE) \n");
-	DEBUG_PRINT( "PCMPLAYBACK = 0 (DISABLES PCM PLAYBACK IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT( "FILEWRITE = 1 (ENABLES PCM FILEWRITE IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT( "FILEWRITE = 0 (DISABLES PCM FILEWRITE IN NON TUNNEL MODE) \n");
-        DEBUG_PRINT( "SAMPLING FREQUENCY:\n");
-        DEBUG_PRINT( "CHANNELS = 1 (MONO)\n");
-        DEBUG_PRINT( "CHANNELS = 2 (STEREO)\n");
-        return 0;
-    }
-
-    aud_comp = "OMX.PV.amrdec";
-
-    DEBUG_PRINT(" OMX test app : aud_comp = %s\n",aud_comp);
-
-    if(Init_Decoder(aud_comp)!= 0x00)
-    {
-        DEBUG_PRINT("Decoder Init failed\n");
-        return -1;
-    }
-
-    if(Play_Decoder() != 0x00)
-    {
-        DEBUG_PRINT("Play_Decoder failed\n");
-        return -1;
-    }
-
-    // Wait till EOS is reached...
-    wait_for_event();
-
-    if(bOutputEosReached)
-    {
-#ifdef PCM_PLAYBACK
-        if(1 == pcmplayback)
-        {
-            sleep(1);
-            ioctl(m_pcmdrv_fd, AUDIO_STOP, 0);
-
-#ifdef AUDIOV2
-	    if(devmgr_fd >= 0)
-	    {
-		write_devctlcmd(devmgr_fd, "-cmd=unregister_session_rx -sid=", session_id_hpcm);
-	    }
-	    else
-	     {
-		if (msm_route_stream(1, session_id_hpcm, device_id, 0))
-		{
-			DEBUG_PRINT("\ncould not set stream routing\n");
-		}
-	    }
-#endif
-            if(m_pcmdrv_fd >= 0)
-            {
-                close(m_pcmdrv_fd);
-                m_pcmdrv_fd = -1;
-                DEBUG_PRINT(" PCM device closed succesfully \n");
-            }
-            else
-            {
-                DEBUG_PRINT(" PCM device close failure \n");
-            }
-        }
-#endif // PCM_PLAYBACK
-
-        if(1 == filewrite)
-        {
-            hdr.riff_id = ID_RIFF;
-            hdr.riff_sz = 0;
-            hdr.riff_fmt = ID_WAVE;
-            hdr.fmt_id = ID_FMT;
-            hdr.fmt_sz = 16;
-            hdr.audio_format = FORMAT_PCM;
-            hdr.num_channels = AMRWB_CHANNELS;
-            hdr.sample_rate  = AMRWB_SAMPLE_RATE;
-            hdr.byte_rate = hdr.sample_rate * hdr.num_channels * 2;
-            hdr.block_align = hdr.num_channels * 2;
-            hdr.bits_per_sample = 16;
-            hdr.data_id = ID_DATA;
-            hdr.data_sz = 0;
-
-            DEBUG_PRINT("output file closed and EOS reached total decoded data length %d\n",totaldatalen);
-            hdr.data_sz = totaldatalen;
-            hdr.riff_sz = totaldatalen + 8 + 16 + 8;
-            fseek(outputBufferFile, 0L , SEEK_SET);
-            bytes_writen = fwrite(&hdr,1,sizeof(hdr),outputBufferFile);
-            if (bytes_writen <= 0)
-            {
-                DEBUG_PRINT("Invalid Wav header write failed\n");
-            }
-            bFileclose = 1;
-            fclose(outputBufferFile);
-        }
-
-        DEBUG_PRINT("\nMoving the decoder to idle state \n");
-        OMX_SendCommand(amrwb_dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
-        wait_for_event();
-
-        DEBUG_PRINT("\nMoving the decoder to loaded state \n");
-        OMX_SendCommand(amrwb_dec_handle, OMX_CommandStateSet, OMX_StateLoaded,0);
-
-        DEBUG_PRINT("\nFillBufferDone: Deallocating i/p buffers \n");
-        for(bufCnt=0; bufCnt < input_buf_cnt; ++bufCnt)
-        {
-            OMX_FreeBuffer(amrwb_dec_handle, 0, pInputBufHdrs[bufCnt]);
-        }
-
-        DEBUG_PRINT("\nFillBufferDone: Deallocating o/p buffers \n");
-        for(bufCnt=0; bufCnt < output_buf_cnt; ++bufCnt) {
-                OMX_FreeBuffer(amrwb_dec_handle, 1, pOutputBufHdrs[bufCnt]);
-        }
-
-        ebd_cnt=0;
-        wait_for_event();
-        ebd_cnt=0;
-
-        result = OMX_FreeHandle(amrwb_dec_handle);
-        if (result != OMX_ErrorNone)
-        {
-            DEBUG_PRINT("\nOMX_FreeHandle error. Error code: %d\n", result);
-        }
-#ifdef AUDIOV2
-        if(devmgr_fd >= 0)
-        {
-           write_devctlcmd(devmgr_fd, "-cmd=unregister_session_rx -sid=", session_id);
-           close(devmgr_fd);
-        }
-        else
-        {
-           if (msm_route_stream(1,session_id,device_id, 0))
-           {
-               DEBUG_PRINT("\ncould not set stream routing\n");
-               return -1;
-           }
-           if (msm_en_device(device_id, 0))
-           {
-               DEBUG_PRINT("\ncould not enable device\n");
-               return -1;
-           }
-           msm_mixer_close();
-        }
-#endif
-        /* Deinit OpenMAX */
-        OMX_Deinit();
-        fclose(inputBufferFile);
-        timeStampLfile = 0;
-        amrwb_dec_handle = NULL;
-        bInputEosReached = false;
-        bOutputEosReached = false;
-        bEosOnInputBuf = 0;
-        bEosOnOutputBuf = 0;
-        pthread_cond_destroy(&cond);
-        pthread_cond_destroy(&etb_cond);
-        pthread_mutex_destroy(&lock);
-        pthread_mutexattr_destroy(&lock1_attr);
-        pthread_mutex_destroy(&lock1);
-        pthread_mutex_destroy(&etb_lock);
-        pthread_mutex_destroy(&etb_lock1);
-        etb_done = 0;
-        DEBUG_PRINT("*****************************************\n");
-        DEBUG_PRINT("******...TEST COMPLETED...***************\n");
-        DEBUG_PRINT("*****************************************\n");
-    }
-    return 0;
-}
-
-//int Init_Decoder()
-int Init_Decoder(OMX_STRING audio_component)
-{
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    OMX_ERRORTYPE omxresult;
-    OMX_U32 total = 0;
-    OMX_U8** audCompNames;
-    typedef OMX_U8* OMX_U8_PTR;
-    unsigned int i = 0;
-    OMX_STRING role ="audio_decoder.amrwb";
-
-    static OMX_CALLBACKTYPE call_back = {
-        &EventHandler,&EmptyBufferDone,&FillBufferDone
-    };
-
-    DEBUG_PRINT(" Play_Decoder - pcmplayback = %d\n", pcmplayback);
-
-    /* Init. the OpenMAX Core */
-    DEBUG_PRINT("\nInitializing OpenMAX Core....\n");
-    omxresult = OMX_Init();
-
-    if(OMX_ErrorNone != omxresult)
-    {
-        DEBUG_PRINT("\n Failed to Init OpenMAX core");
-        return -1;
-    }
-    else
-    {
-        DEBUG_PRINT("\nOpenMAX Core Init Done\n");
-    }
-
-    /* Query for audio decoders*/
-    DEBUG_PRINT("Amrwb_test: Before entering OMX_GetComponentOfRole");
-    OMX_GetComponentsOfRole(role, &total, 0);
-    DEBUG_PRINT("\nTotal components of role=%s :%lu\n", role, total);
-
-    if(total)
-    {
-        DEBUG_PRINT("Total number of components = %lu\n", total);
-        /* Allocate memory for pointers to component name */
-        audCompNames = (OMX_U8**)malloc((sizeof(OMX_U8))*total);
-
-        if(NULL == audCompNames)
-        {
-            return -1;
-        }
-
-        for (i = 0; i < total; ++i)
-        {
-            audCompNames[i] =
-                (OMX_U8*)malloc(sizeof(OMX_U8)*OMX_MAX_STRINGNAME_SIZE);
-            if(NULL == audCompNames[i] )
-            {
-                while (i > 0)
-                {
-                    free(audCompNames[--i]);
-                }
-                free(audCompNames);
-                return -1;
-            }
-        }
-        DEBUG_PRINT("Before calling OMX_GetComponentsOfRole()\n");
-        OMX_GetComponentsOfRole(role, &total, audCompNames);
-        DEBUG_PRINT("\nComponents of Role:%s\n", role);
-    }
-    else
-    {
-        DEBUG_PRINT("No components found with Role:%s", role);
-    }
-    omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&amrwb_dec_handle),
-                        (OMX_STRING)audio_component, NULL, &call_back);
-    if (FAILED(omxresult))
-    {
-        DEBUG_PRINT("\nFailed to Load the component:%s\n", audio_component);
-        for (i = 0; i < total; ++i)
-            free(audCompNames[i]);
-	free(audCompNames);
-            return -1;
-    }
-    else
-    {
-        DEBUG_PRINT("\nComponent is in LOADED state\n");
-    }
-
-    /* Get the port information */
-    CONFIG_VERSION_SIZE(portParam);
-    omxresult = OMX_GetParameter(amrwb_dec_handle, OMX_IndexParamAudioInit,
-                                (OMX_PTR)&portParam);
-
-    if(FAILED(omxresult))
-    {
-        DEBUG_PRINT("\nFailed to get Port Param\n");
-        for (i = 0; i < total; ++i)
-            free(audCompNames[i]);
-	free(audCompNames);
-        return -1;
-    }
-    else
-    {
-        DEBUG_PRINT("\nportParam.nPorts:%lu\n", portParam.nPorts);
-        DEBUG_PRINT("\nportParam.nStartPortNumber:%lu\n",
-                                             portParam.nStartPortNumber);
-    }
-    for (i = 0; i < total; ++i)
-        free(audCompNames[i]);
-    free(audCompNames);
-    return 0;
-}
-
-int Play_Decoder()
-{
-    int i;
-    int Size=0;
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    OMX_ERRORTYPE ret;
-    OMX_INDEXTYPE index;
-
-    DEBUG_PRINT("sizeof[%d]\n", sizeof(OMX_BUFFERHEADERTYPE));
-
-    /* open the i/p and o/p files based on the video file format passed */
-    if(open_audio_file())
-    {
-        DEBUG_PRINT("\n Returning -1");
-        return -1;
-    }
-    /* Query the decoder input min buf requirements */
-    CONFIG_VERSION_SIZE(inputportFmt);
-
-    /* Port for which the Client needs to obtain info */
-    inputportFmt.nPortIndex = portParam.nStartPortNumber;
-
-    OMX_GetParameter(amrwb_dec_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-    DEBUG_PRINT ("\nDec: Input Buffer Count %lu\n", inputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nDec: Input Buffer Size %lu\n", inputportFmt.nBufferSize);
-
-    if(OMX_DirInput != inputportFmt.eDir)
-    {
-        DEBUG_PRINT ("\nDec: Expect Input Port\n");
-        return -1;
-    }
-// Modified to Set the Actual Buffer Count for input port
-    inputportFmt.nBufferCountActual = inputportFmt.nBufferCountMin + 3;
-    OMX_SetParameter(amrwb_dec_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-
-    /* Query the decoder outport's min buf requirements */
-    CONFIG_VERSION_SIZE(outputportFmt);
-    /* Port for which the Client needs to obtain info */
-    outputportFmt.nPortIndex = portParam.nStartPortNumber + 1;
-
-    OMX_GetParameter(amrwb_dec_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-    DEBUG_PRINT ("\nDec: Output Buffer Count %lu\n", outputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nDec: Output Buffer Size %lu\n", outputportFmt.nBufferSize);
-
-    if(OMX_DirOutput != outputportFmt.eDir)
-    {
-        DEBUG_PRINT ("\nDec: Expect Output Port\n");
-        return -1;
-    }
-        // Modified to Set the Actual Buffer Count for output port
-    outputportFmt.nBufferCountActual = outputportFmt.nBufferCountMin + 1;
-    OMX_SetParameter(amrwb_dec_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-
-    CONFIG_VERSION_SIZE(amrparam);
-    OMX_GetExtensionIndex(amrwb_dec_handle,"OMX.Qualcomm.index.audio.sessionId",&index);
-    OMX_GetParameter(amrwb_dec_handle,index,&streaminfoparam);
-#ifdef AUDIOV2
-    session_id = streaminfoparam.sessionId;
-    devmgr_fd = open("/data/omx_devmgr", O_WRONLY);
-    if(devmgr_fd >= 0)
-    {
-        control = 0;
-        write_devctlcmd(devmgr_fd, "-cmd=register_session_rx -sid=", session_id);
-    }
-    else
-    {
-	/*
-		control = msm_mixer_open("/dev/snd/controlC0", 0);
-		if(control < 0)
-			printf("ERROR opening the device\n");
-		device_id = msm_get_device(device);
-		DEBUG_PRINT ("\ndevice_id = %d\n",device_id);
-		DEBUG_PRINT("\nsession_id = %d\n",session_id);
-		if (msm_en_device(device_id, 1))
-		{
-			perror("could not enable device\n");
-			return -1;
-		}
-
-		if (msm_route_stream(1,session_id,device_id, 1))
-		{
-			perror("could not set stream routing\n");
-			return -1;
-		}
-	*/
-    }
-#endif
-
-     OMX_GetParameter(amrwb_dec_handle,OMX_IndexParamAudioAmr,&amrparam);
-     amrparam.nPortIndex   =  0;
-     amrparam.nChannels    =  ch;
-     amrparam.eAMRBandMode = OMX_AUDIO_AMRBandModeWB0; //default
-     amrparam.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;
-     OMX_SetParameter(amrwb_dec_handle,OMX_IndexParamAudioAmr,&amrparam);
-
-    DEBUG_PRINT ("\nOMX_SendCommand Decoder -> IDLE\n");
-    OMX_SendCommand(amrwb_dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
-
-    input_buf_cnt = inputportFmt.nBufferCountMin + 3;
-    DEBUG_PRINT("Transition to Idle State succesful...\n");
-    /* Allocate buffer on decoder's i/p port */
-    error = Allocate_Buffer(amrwb_dec_handle, &pInputBufHdrs, inputportFmt.nPortIndex,
-                            input_buf_cnt, inputportFmt.nBufferSize);
-    if (error != OMX_ErrorNone)
-    {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Input buffer error\n");
-        return -1;
-    }
-    else
-    {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Input buffer success\n");
-    }
-
-    
-    output_buf_cnt = outputportFmt.nBufferCountMin  + 1;
-
-    /* Allocate buffer on decoder's O/Pp port */
-    error = Allocate_Buffer(amrwb_dec_handle, &pOutputBufHdrs, outputportFmt.nPortIndex,
-                                output_buf_cnt, outputportFmt.nBufferSize);
-    if (error != OMX_ErrorNone)
-    {
-        DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer error\n");
-        return -1;
-    }
-    else
-    {
-            DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer success\n");
-    }
-
-    wait_for_event();
-
-    DEBUG_PRINT ("\nOMX_SendCommand Decoder -> Executing\n");
-    OMX_SendCommand(amrwb_dec_handle, OMX_CommandStateSet, OMX_StateExecuting,0);
-    wait_for_event();
-
-    
-    DEBUG_PRINT(" Start sending OMX_FILLthisbuffer\n");
-    for(i=0; i < output_buf_cnt; i++)
-    {
-       DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
-       pOutputBufHdrs[i]->nOutputPortIndex = 1;
-       pOutputBufHdrs[i]->nFlags &= ~OMX_BUFFERFLAG_EOS;
-       ret = OMX_FillThisBuffer(amrwb_dec_handle, pOutputBufHdrs[i]);
-       if (OMX_ErrorNone != ret)
-       {
-           DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
-       }
-       else
-       {
-          DEBUG_PRINT("OMX_FillThisBuffer success!\n");
-       }
-    }
-
-    DEBUG_PRINT(" Start sending OMX_emptythisbuffer\n");
-    for (i = 0;i < input_buf_cnt;i++)
-    {
-
-		DEBUG_PRINT ("\nOMX_EmptyThisBuffer on Input buf no.%d\n",i);
-        pInputBufHdrs[i]->nInputPortIndex = 0;
-        Size = Read_Buffer(pInputBufHdrs[i]);
-        if(Size <=0 ){
-          DEBUG_PRINT("NO DATA READ\n");
-          bInputEosReached = true;
-          pInputBufHdrs[i]->nFlags= OMX_BUFFERFLAG_EOS;
-        }
-        pInputBufHdrs[i]->nFilledLen = Size;
-        pInputBufHdrs[i]->nInputPortIndex = 0;
-        used_ip_buf_cnt++;
-        timeStampLfile += timestampInterval;
-        pInputBufHdrs[i]->nTimeStamp = timeStampLfile;
-        ret = OMX_EmptyThisBuffer(amrwb_dec_handle, pInputBufHdrs[i]);
-        if (OMX_ErrorNone != ret) {
-            DEBUG_PRINT("OMX_EmptyThisBuffer failed with result %d\n", ret);
-        }
-        else {
-            DEBUG_PRINT("OMX_EmptyThisBuffer success!\n");
-        }
-        if(Size <=0 ){
-            break;//eos reached
-        }
-    }
-    pthread_mutex_lock(&etb_lock1);
-    if(etb_done)
-    {
-        DEBUG_PRINT("\n****************************\n");
-        DEBUG_PRINT("Component is waiting for EBD to be releases, BC signal\n");
-        DEBUG_PRINT("\n****************************\n");
-        etb_event_complete();
-    }
-    else
-    {
-        DEBUG_PRINT("\n****************************\n");
-        DEBUG_PRINT("EBD not yet happened ...\n");
-        DEBUG_PRINT("\n****************************\n");
-        etb_done++;
-    }
-    pthread_mutex_unlock(&etb_lock1);
-
-    return 0;
-}
-
-static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *avc_dec_handle,
-                                       OMX_BUFFERHEADERTYPE  ***pBufHdrs,
-                                       OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize)
-{
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    OMX_ERRORTYPE error=OMX_ErrorNone;
-    long bufCnt=0;
-
-    /* To remove warning for unused variable to keep prototype same */
-    (void)avc_dec_handle;
-
-    *pBufHdrs= (OMX_BUFFERHEADERTYPE **)
-                   malloc(sizeof(OMX_BUFFERHEADERTYPE*)*bufCntMin);
-
-    for(bufCnt=0; bufCnt < bufCntMin; ++bufCnt)
-    {
-        DEBUG_PRINT("\n OMX_AllocateBuffer No %ld \n", bufCnt);
-        error = OMX_AllocateBuffer(amrwb_dec_handle, &((*pBufHdrs)[bufCnt]),
-                                   nPortIndex, NULL, bufSize);
-    }
-
-    return error;
-}
-
-static int Read_Buffer (OMX_BUFFERHEADERTYPE  *pBufHdr )
-{
-
-    int bytes_read=0;
-    static int totalbytes_read =0;
-
-    DEBUG_PRINT ("\nInside Read_Buffer nAllocLen:%lu\n", pBufHdr->nAllocLen);
-
-    pBufHdr->nFilledLen = 0;
-    pBufHdr->nFlags |= OMX_BUFFERFLAG_EOS;
-    bytes_read = fread(pBufHdr->pBuffer,
-                            1, pBufHdr->nAllocLen, inputBufferFile);
-    pBufHdr->nFilledLen = bytes_read;
-    totalbytes_read += bytes_read;
-
-    DEBUG_PRINT ("\bytes_read = %d\n",bytes_read);
-    DEBUG_PRINT ("\totalbytes_read = %d\n",totalbytes_read);
-    if( bytes_read <= 0)
-    {
-        pBufHdr->nFlags |= OMX_BUFFERFLAG_EOS;
-        DEBUG_PRINT ("\nBytes read zero\n");
-    }
-    else
-    {
-        pBufHdr->nFlags &= ~OMX_BUFFERFLAG_EOS;
-        DEBUG_PRINT ("\nBytes read is Non zero\n");
-    }
-    return bytes_read;
-}
-
-static int open_audio_file ()
-{
-    int error_code = 0;
-    const char *outfilename = "Audio_amrwb.wav";
-    struct wav_header hdr;
-    int header_len = 0;
-
-    memset(&hdr,0,sizeof(hdr));
-
-    hdr.riff_id = ID_RIFF;
-    hdr.riff_sz = 0;
-    hdr.riff_fmt = ID_WAVE;
-    hdr.fmt_id = ID_FMT;
-    hdr.fmt_sz = 16;
-    hdr.audio_format = FORMAT_PCM;
-    hdr.num_channels = AMRWB_CHANNELS;
-    hdr.sample_rate  = AMRWB_SAMPLE_RATE;
-    hdr.byte_rate = hdr.sample_rate * hdr.num_channels * 2;
-    hdr.block_align = hdr.num_channels * 2;
-    hdr.bits_per_sample = 16;
-    hdr.data_id = ID_DATA;
-    hdr.data_sz = 0;
-
-    DEBUG_PRINT("Inside %s filename=%s\n", __FUNCTION__, in_filename);
-    inputBufferFile = fopen (in_filename, "rb");
-    if (inputBufferFile == NULL) {
-        DEBUG_PRINT("\ni/p file %s could NOT be opened\n",
-                                         in_filename);
-        error_code = -1;
-    }
-
-    if(filewrite == 1)
-    {
-        DEBUG_PRINT("output file is opened\n");
-        outputBufferFile = fopen(outfilename,"wb");
-        if (outputBufferFile == NULL)
-        {
-            DEBUG_PRINT("\no/p file %s could NOT be opened\n",
-                                             outfilename);
-            error_code = -1;
-            return error_code;
-        }
-
-        header_len = fwrite(&hdr,1,sizeof(hdr),outputBufferFile);
-
-        if (header_len <= 0)
-        {
-            DEBUG_PRINT("Invalid Wav header \n");
-        }
-        DEBUG_PRINT(" Length og wav header is %d \n",header_len );
-    }
-    return error_code;
-}
-
-static void write_devctlcmd(int fd, const void *buf, int param){
-	int nbytes, nbytesWritten;
-	char cmdstr[128];
-	snprintf(cmdstr, 128, "%s%d\n", (char *)buf, param);
-	nbytes = strlen(cmdstr);
-	nbytesWritten = write(fd, cmdstr, nbytes);
-
-	if(nbytes != nbytesWritten)
-		printf("Failed to write string \"%s\" to omx_devmgr\n", cmdstr);
-}
-
diff --git a/mm-audio/adec-mp3/Android.mk b/mm-audio/adec-mp3/Android.mk
deleted file mode 100644
index 5053e7d..0000000
--- a/mm-audio/adec-mp3/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(call all-subdir-makefiles)
diff --git a/mm-audio/adec-mp3/Makefile b/mm-audio/adec-mp3/Makefile
deleted file mode 100644
index 83d822b..0000000
--- a/mm-audio/adec-mp3/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-all:
-	@echo "invoking omxaudio make"
-	$(MAKE) -C qdsp6
-
-install:
-	$(MAKE) -C qdsp6 install
diff --git a/mm-audio/adec-mp3/Makefile.am b/mm-audio/adec-mp3/Makefile.am
deleted file mode 100644
index 24c1af2..0000000
--- a/mm-audio/adec-mp3/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = qdsp6
diff --git a/mm-audio/adec-mp3/sw/Android.mk b/mm-audio/adec-mp3/sw/Android.mk
deleted file mode 100644
index 3773a88..0000000
--- a/mm-audio/adec-mp3/sw/Android.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-ifneq ($(BUILD_TINY_ANDROID),true)
-ifneq ($(BUILD_WITHOUT_PV),true)
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# ---------------------------------------------------------------------------------
-#                 Common definitons
-# ---------------------------------------------------------------------------------
-
-libOmxMp3Dec-def := -g -O3
-libOmxMp3Dec-def += -DQC_MODIFIED
-libOmxMp3Dec-def += -D_ANDROID_
-libOmxMp3Dec-def += -D_ENABLE_QC_MSG_LOG_
-libOmxMp3Dec-def += -DVERBOSE
-libOmxMp3Dec-def += -D_DEBUG
-libOmxMp3Dec-def += -DAUDIOV2
-
-ifeq ($(BOARD_USES_QCOM_AUDIO_V2), true)
-libOmxMp3Dec-def += -DAUDIOV2
-endif
-
-# ---------------------------------------------------------------------------------
-#             Make the apps-test (mm-adec-omxmp3-test)
-# ---------------------------------------------------------------------------------
-
-include $(CLEAR_VARS)
-
-ifeq ($(BOARD_USES_QCOM_AUDIO_V2), true)
-mm-mp3-dec-test-inc   += $(TARGET_OUT_HEADERS)/mm-audio/audio-alsa
-mm-mp3-dec-test-inc   += $(TARGET_OUT_HEADERS)/mm-core/omxcore
-mm-mp3-dec-test-inc   += $(PV_TOP)/codecs_v2/omx/omx_mastercore/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_common/include \
-        		 $(PV_TOP)/extern_libs_v2/khronos/openmax/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_baseclass/include \
-        		 $(PV_TOP)/codecs_v2/omx/omx_mp3/include \
-        		 $(PV_TOP)/codecs_v2/audio/mp3/dec/include \
-
-LOCAL_MODULE            := sw-adec-omxmp3-test
-LOCAL_MODULE_TAGS       := optional
-LOCAL_CFLAGS            := $(libOmxMp3Dec-def)
-LOCAL_C_INCLUDES        := $(mm-mp3-dec-test-inc)
-LOCAL_PRELINK_MODULE    := false
-LOCAL_SHARED_LIBRARIES  := libopencore_common
-LOCAL_SHARED_LIBRARIES  += libomx_sharedlibrary
-LOCAL_SHARED_LIBRARIES  += libomx_mp3dec_sharedlibrary
-LOCAL_SHARED_LIBRARIES  += libaudioalsa
-
-LOCAL_SRC_FILES         := test/omx_mp3_dec_test.c
-
-include $(BUILD_EXECUTABLE)
-endif
-
-endif #BUILD_WITHOUT_PV
-endif #BUILD_TINY_ANDROID
-
-# ---------------------------------------------------------------------------------
-#                     END
-# ---------------------------------------------------------------------------------
diff --git a/mm-audio/adec-mp3/sw/test/omx_mp3_dec_test.c b/mm-audio/adec-mp3/sw/test/omx_mp3_dec_test.c
deleted file mode 100644
index 31931d7..0000000
--- a/mm-audio/adec-mp3/sw/test/omx_mp3_dec_test.c
+++ /dev/null
@@ -1,2159 +0,0 @@
-
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-    * Neither the name of The Linux Foundation nor
-      the names of its contributors may be used to endorse or promote
-      products derived from this software without specific prior written
-      permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-
-/*
-    An Open max test application ....
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include "OMX_Core.h"
-#include "OMX_Component.h"
-#include "QOMX_AudioExtensions.h"
-#include "QOMX_AudioIndexExtensions.h"
-#ifdef AUDIOV2
-#include "control.h"
-#endif
-#include "pthread.h"
-#include <signal.h>
-#include <stdint.h>
-#include<string.h>
-#include <pthread.h>
-#include <linux/ioctl.h>
-#include <linux/msm_audio.h>
-#include <errno.h>
-
-#define USE_BUFFER_CASE 1
-#define HOST_PCM_DEVICE 0
-#define PCM_DEC_DEVICE 1
-
-OMX_U32 mp3_frequency_index[3][4] = {
-   {11025,0,22050,44100},
-   {12000,0,24000,48000},
-   {8000,0,16000,32000}
-};
-
-int is_multi_inst = 0;
-
-#define DEBUG_PRINT       printf
-#define DEBUG_PRINT_ERROR printf
-#define PCM_PLAYBACK /* To write the pcm decoded data to the msm_pcm device for playback*/
-
-#ifdef PCM_PLAYBACK
-
-struct mp3_header
-{
-    OMX_U8 sync;
-    OMX_U8 version;
-    uint8_t Layer;
-    OMX_U8 protection;
-    OMX_U32  bitrate;
-    OMX_U32 sampling_rate;
-    OMX_U8 padding;
-    OMX_U8 private_bit;
-    OMX_U8 channel_mode;
-};
-
-
-#define DEFAULT_SAMPLING_RATE  44100
-#define DEFAULT_CHANNEL_MODE   2
-
-#endif  // PCM_PLAYBACK
-
-
-/************************************************************************/
-/*                #DEFINES                            */
-/************************************************************************/
-#define false 0
-#define true 1
-
-#define CONFIG_VERSION_SIZE(param) \
-    param.nVersion.nVersion = CURRENT_OMX_SPEC_VERSION;\
-    param.nSize = sizeof(param);
-
-#define FAILED(result) (result != OMX_ErrorNone)
-
-#define SUCCEEDED(result) (result == OMX_ErrorNone)
-
-OMX_ERRORTYPE  parse_mp3_frameheader(OMX_BUFFERHEADERTYPE* buffer,
-                                     struct mp3_header *header);
-
-unsigned int extract_id3_header_size(OMX_U8* buffer);
-
-/* http://ccrma.stanford.edu/courses/422/projects/WaveFormat/ */
-
-#define ID_RIFF 0x46464952
-#define ID_WAVE 0x45564157
-#define ID_FMT  0x20746d66
-#define ID_DATA 0x61746164
-
-#define FORMAT_PCM 1
-
-struct wav_header {
-  uint32_t riff_id;
-  uint32_t riff_sz;
-  uint32_t riff_fmt;
-  uint32_t fmt_id;
-  uint32_t fmt_sz;
-  uint16_t audio_format;
-  uint16_t num_channels;
-  uint32_t sample_rate;
-  uint32_t byte_rate;       /* sample_rate * num_channels * bps / 8 */
-  uint16_t block_align;     /* num_channels * bps / 8 */
-  uint16_t bits_per_sample;
-  uint32_t data_id;
-  uint32_t data_sz;
-};
-
-typedef struct hpcm
-{
-    int          pipe_in;
-    int          pipe_out;
-}hpcm;
-
-typedef enum msg
-{
-    CTRL = 0,
-    DATA = 1
-}MSG;
-
-typedef struct hpcm_info
-{
-    MSG                  msg_type;
-    int                  fd;
-    OMX_COMPONENTTYPE    *hComponent;
-    OMX_BUFFERHEADERTYPE *bufHdr;
-}hpcm_info;
-
-struct adec_appdata
-{
-   uint32_t pcmplayback;
-   uint32_t tunnel;
-   uint32_t filewrite;
-   uint32_t flushinprogress;
-   uint32_t buffer_option;
-   uint32_t pcm_device_type;
-   pthread_mutex_t lock;
-   pthread_cond_t cond;
-   pthread_mutex_t elock;
-   pthread_cond_t econd;
-   pthread_cond_t fcond;
-   FILE * inputBufferFile;
-   FILE * outputBufferFile;
-   OMX_PARAM_PORTDEFINITIONTYPE inputportFmt;
-   OMX_PARAM_PORTDEFINITIONTYPE outputportFmt;
-   OMX_AUDIO_PARAM_MP3TYPE mp3param;
-   QOMX_AUDIO_STREAM_INFO_DATA streaminfoparam;
-   OMX_PORT_PARAM_TYPE portParam;
-   OMX_ERRORTYPE error;
-   int input_buf_cnt;
-   int output_buf_cnt;
-   int used_ip_buf_cnt;
-   int event_is_done;
-   int ebd_event_is_done;
-   int fbd_event_is_done;
-   int ebd_cnt;
-   int bOutputEosReached ;
-   int bInputEosReached ;
-   int bFlushing;
-   int bPause;
-   #ifdef AUDIOV2
-   unsigned short session_id;
-   unsigned short session_id_hpcm;
-   int device_id ;
-   int control ;
-   char device[44];
-   int devmgr_fd;
-   #endif
-   const char *in_filename;
-   unsigned totaldatalen;
-   OMX_STRING aud_comp;
-   OMX_COMPONENTTYPE* mp3_dec_handle;
-   OMX_BUFFERHEADERTYPE  **pInputBufHdrs ;
-   OMX_BUFFERHEADERTYPE  **pOutputBufHdrs;
-   int m_pcmdrv_fd;
-   int num_pcm_buffers;
-   pthread_mutex_t pcm_buf_lock;
-   pthread_t m_pcmdrv_evt_thread_id;
-   const char *out_filename;
-   int bReconfigureOutputPort;
-   int bEosOnInputBuf;
-   int bEosOnOutputBuf;
-   int bParseHeader;
-   struct mp3_header mp3Header;
-   OMX_U8* pBuffer_tmp;
-   int count;
-   int copy_done;
-   int start_done;
-   unsigned int length_filled;
-   int spill_length;
-   unsigned int pcm_buf_size;
-   unsigned int pcm_buf_count;
-   int first_buffer;
-   hpcm mp3_hpcm;
-};
-
-struct adec_appdata adec_mp3_inst1;
-
-//* OMX Spec Version supported by the wrappers. Version = 1.1 */
-const OMX_U32 CURRENT_OMX_SPEC_VERSION = 0x00000101;
-
-
-/************************************************************************/
-/*                GLOBAL FUNC DECL                        */
-/************************************************************************/
-int Init_Decoder(struct adec_appdata* adec_appdata);
-int Play_Decoder(struct adec_appdata* adec_appdata);
-void process_portreconfig(struct adec_appdata* adec_appdata);
-/**************************************************************************/
-/*                STATIC DECLARATIONS                       */
-/**************************************************************************/
-
-static int open_audio_file (struct adec_appdata* adec_appdata);
-static int Read_Buffer(OMX_BUFFERHEADERTYPE  *pBufHdr,FILE * inputBufferFile);
-static OMX_ERRORTYPE Use_Buffer ( struct adec_appdata* adec_appdata,
-                                  OMX_U32 nPortIndex );
-
-static OMX_ERRORTYPE Free_Buffer ( struct adec_appdata* adec_appdata,
-                                   OMX_U32 nPortIndex,
-                                   OMX_BUFFERHEADERTYPE *bufHdr
-                                  );
-
-static OMX_ERRORTYPE Allocate_Buffer ( struct adec_appdata* adec_appdata,
-                                       OMX_U32 nPortIndex );
-
-static OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
-                                  OMX_IN OMX_PTR pAppData,
-                                  OMX_IN OMX_EVENTTYPE eEvent,
-                                  OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
-                                  OMX_IN OMX_PTR pEventData);
-
-static OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                                     OMX_IN OMX_PTR pAppData,
-                                     OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
-static OMX_ERRORTYPE FillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                                     OMX_IN OMX_PTR pAppData,
-                                     OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-void write_devctlcmd(int fd, const void *buf, int param);
-
-void adec_appdata_init(struct adec_appdata* adec_appdata)
-{
-    adec_appdata->totaldatalen = 0;
-    adec_appdata->input_buf_cnt = 0;
-    adec_appdata->output_buf_cnt = 0;
-    adec_appdata->used_ip_buf_cnt = 0;
-    adec_appdata->event_is_done = 0;
-    adec_appdata->ebd_event_is_done = 0;
-    adec_appdata->fbd_event_is_done = 0;
-    adec_appdata->ebd_cnt = 0;
-    adec_appdata->bOutputEosReached = 0;
-    adec_appdata->bInputEosReached = 0;
-    adec_appdata->bFlushing = false;
-    adec_appdata->bPause= false;
-    adec_appdata->pcmplayback = 0;
-    adec_appdata->tunnel      = 0;
-    adec_appdata->filewrite   = 0;
-    adec_appdata->flushinprogress = 0;
-    adec_appdata->buffer_option = 0;
-    adec_appdata->pcm_device_type = HOST_PCM_DEVICE;
-    adec_appdata->bReconfigureOutputPort = 0;
-    adec_appdata->bEosOnInputBuf = 0;
-    adec_appdata->bEosOnOutputBuf = 0;
-    adec_appdata->bParseHeader = 0;
-    adec_appdata->mp3_dec_handle = NULL;
-    adec_appdata->pInputBufHdrs = NULL;
-    adec_appdata->pOutputBufHdrs = NULL;
-    adec_appdata->pBuffer_tmp = NULL;
-    adec_appdata->count = 0;
-    adec_appdata->copy_done = 0;
-    adec_appdata->start_done = 0;
-    adec_appdata->length_filled = 0;
-    adec_appdata->spill_length = 0;
-    adec_appdata->pcm_buf_size = 4800;
-    adec_appdata->pcm_buf_count = 2;
-    adec_appdata->first_buffer = 1;
-    adec_appdata->mp3Header.sync = 0;
-    adec_appdata->mp3Header.version = 0;
-    adec_appdata->mp3Header.Layer = 0;
-    adec_appdata->mp3Header.protection = 0;
-    adec_appdata->mp3Header.bitrate = 0;
-    adec_appdata->mp3Header.sampling_rate = 0;
-    adec_appdata->mp3Header.padding = 0;
-    adec_appdata->mp3Header.private_bit = 0;
-    adec_appdata->mp3Header.channel_mode = 0;
-    adec_appdata->m_pcmdrv_fd = -1;
-    adec_appdata->num_pcm_buffers = 0;
-    adec_appdata->inputBufferFile = NULL;
-    adec_appdata->outputBufferFile = NULL;
-    adec_appdata->error = 0;
-}
-
-void wait_for_event(struct adec_appdata * adec_appdata)
-{
-   pthread_mutex_lock(&adec_appdata->lock);
-   DEBUG_PRINT("%s: event_is_done=%d", __FUNCTION__, adec_appdata->event_is_done);
-   while (adec_appdata->event_is_done == 0) {
-      pthread_cond_wait(&adec_appdata->cond, &adec_appdata->lock);
-   }
-   adec_appdata->event_is_done = 0;
-   pthread_mutex_unlock(&adec_appdata->lock);
-}
-
-void event_complete(struct adec_appdata * adec_appdata)
-{
-   pthread_mutex_lock(&adec_appdata->lock);
-   if (adec_appdata->event_is_done == 0) {
-      adec_appdata->event_is_done = 1;
-      pthread_cond_broadcast(&adec_appdata->cond);
-   }
-   pthread_mutex_unlock(&adec_appdata->lock);
-}
-
-void *process_hpcm_drv_events( void* data)
-{
-    struct adec_appdata *adec_data = (struct adec_appdata *)data;
-    hpcm_info ftb;
-
-    int n=0;
-    hpcm_info p;
-    DEBUG_PRINT("%s adec_data=%p pipe_in=%d pipe_out=%d\n",__FUNCTION__,
-                                                      adec_data,
-                                                      adec_data->mp3_hpcm.pipe_in,
-                                                      adec_data->mp3_hpcm.pipe_out);
-    while(1)
-    {
-        DEBUG_PRINT("\n Waiting for next FBD from OMX.....\n");
-        n = read(adec_data->mp3_hpcm.pipe_in,&p,sizeof(struct hpcm_info));
-        if(n <= 0){
-            DEBUG_PRINT("*********************\n");
-            DEBUG_PRINT("KILLING HPCM THREAD...\n");
-            DEBUG_PRINT("***********************\n");
-            return (void*) -1;
-        }
-        if(p.msg_type == CTRL)
-        {
-            event_complete(adec_data);
-            DEBUG_PRINT("DATA EMPTY\n");
-        }
-        else
-        {
-            DEBUG_PRINT("***********************\n");
-          DEBUG_PRINT("\n%s-->pipe_in=%d pipe_out=%d n=%d\n",__FUNCTION__,
-                                               adec_data->mp3_hpcm.pipe_in,
-                                               adec_data->mp3_hpcm.pipe_out,n);
-            DEBUG_PRINT("***********************\n");
-        ftb.hComponent = p.hComponent;
-        ftb.bufHdr = p.bufHdr;
-
-        if ( write(adec_data->m_pcmdrv_fd, ftb.bufHdr->pBuffer, ftb.bufHdr->nFilledLen ) !=
-                 (ssize_t)(ftb.bufHdr->nFilledLen) )
-        {
-            DEBUG_PRINT_ERROR("%s: Write data to PCM failed\n",__FUNCTION__);
-        }
-        DEBUG_PRINT("drvfd=%d bufHdr[%p] buffer[%p] len[%lu] hComponent[%p] bOutputEos=%d\n",
-                                          adec_data->m_pcmdrv_fd,
-                                          ftb.bufHdr,ftb.bufHdr->pBuffer,
-                                          ftb.bufHdr->nFilledLen,
-                                          ftb.hComponent,adec_data->bOutputEosReached);
-        if(!(adec_data->bOutputEosReached))
-            OMX_FillThisBuffer(ftb.hComponent,ftb.bufHdr);
-        }
-    }
-    return 0;
-}
-
-/* Thread for handling the events from PCM_DEC driver */
-void* process_pcm_drv_events( void* data)
-{
-    struct adec_appdata *adec_data = (struct adec_appdata *)data;
-    OMX_BUFFERHEADERTYPE *bufHdr = NULL;
-    struct msm_audio_event tcxo_event;
-    int rc = 0, buf_count = 0;
-
-    if(data == NULL)
-    {
-        DEBUG_PRINT("\n PPDE: data is NULL\n");
-        return (void*)(-1);
-    }
-
-    while(1)
-    {
-        DEBUG_PRINT("\nPPDE:Calling ioctl AUDIO_GET_EVENT ...\n");
-        rc = ioctl(adec_data->m_pcmdrv_fd, AUDIO_GET_EVENT, &tcxo_event);
-        if((rc == -1) && (errno == ENODEV ))
-        {
-            DEBUG_PRINT("\nPPDE:Exiting with rc %d and error %d", rc, errno);
-            return (void*)(-1);
-        }
-        DEBUG_PRINT("\nPPDE:Event Type[%d]", tcxo_event.event_type);
-
-        switch(tcxo_event.event_type)
-        {
-            case AUDIO_EVENT_WRITE_DONE:
-            {
-                bufHdr = (OMX_BUFFERHEADERTYPE*)tcxo_event.event_payload.
-                    aio_buf.private_data;
-
-                if(bufHdr)
-                {
-                    buf_count++;
-                    DEBUG_PRINT("\nPPDE:PCMDEC-ASYNC_WRITE DONE for bufHdr[%p], \
-                        buf_count = %d\n", bufHdr, buf_count);
-
-                    pthread_mutex_lock(&adec_data->pcm_buf_lock);
-                    adec_data->num_pcm_buffers--;
-                    pthread_mutex_unlock(&adec_data->pcm_buf_lock);
-
-                    if(adec_data->bOutputEosReached == true)
-                    {
-                        if(adec_data->num_pcm_buffers == 0)
-                        {
-                            DEBUG_PRINT("\nPPDE: Output EOS reached in PCMDEC\n");
-                            DEBUG_PRINT("\nPPDE::: OUTPUT EOS REACHED....\n");
-                            event_complete(adec_data);
-                            return 0;
-                        }
-                        else
-                        {
-                            DEBUG_PRINT("\nWaiting for PCM to play remaining \
-                                %d buffers ...\n", adec_data->num_pcm_buffers);
-                        }
-                    }
-                    else
-                    {
-                        DEBUG_PRINT("\nPPDE calling FTB");
-                        OMX_FillThisBuffer(adec_data->mp3_dec_handle, bufHdr);
-                    }
-                }
-                else
-                {
-                    DEBUG_PRINT("\nPPDE: Invalid bufHdr[%p] in WRITE_DONE\n",
-                        bufHdr);
-                }
-            }
-            break;
-
-            default:
-                DEBUG_PRINT("PPDE: Received Invalid Event");
-            break;
-        }
-    }
-    return 0;
-}
-
-OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
-                           OMX_IN OMX_PTR pAppData,
-                           OMX_IN OMX_EVENTTYPE eEvent,
-                           OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
-                           OMX_IN OMX_PTR pEventData)
-{
-   //DEBUG_PRINT("Function %s \n command %d  Event complete %d", __FUNCTION__,(OMX_COMMANDTYPE)nData1,nData2);
-   int bufCnt=0;
-   struct adec_appdata* adec_appdata;
-    /* To remove warning for unused variable to keep prototype same */
-   (void)hComponent;
-   (void)pEventData;
-
-   if(NULL != pAppData)
-       adec_appdata = (struct adec_appdata*) pAppData;
-   else
-       return OMX_ErrorBadParameter;
-   switch(eEvent) {
-      case OMX_EventCmdComplete:
-         DEBUG_PRINT("*********************************************\n");
-         DEBUG_PRINT("\n OMX_EventCmdComplete \n");
-         DEBUG_PRINT("*********************************************\n");
-         if(OMX_CommandPortDisable == (OMX_COMMANDTYPE)nData1) {
-            DEBUG_PRINT("******************************************\n");
-            DEBUG_PRINT("Recieved DISABLE Event Command Complete[%d]\n",(signed)nData2);
-            DEBUG_PRINT("******************************************\n");
-         }
-         else if(OMX_CommandPortEnable == (OMX_COMMANDTYPE)nData1) {
-            DEBUG_PRINT("*********************************************\n");
-            DEBUG_PRINT("Recieved ENABLE Event Command Complete[%d]\n",(signed)nData2);
-            DEBUG_PRINT("*********************************************\n");
-         }
-         else if(OMX_CommandFlush== (OMX_COMMANDTYPE)nData1)
-         {
-             DEBUG_PRINT("*********************************************\n");
-             DEBUG_PRINT("Recieved FLUSH Event Command Complete[%d]\n",(signed)nData2);
-             DEBUG_PRINT("*********************************************\n");
-         }
-         event_complete(adec_appdata);
-      break;
-
-      case OMX_EventError:
-         DEBUG_PRINT("*********************************************\n");
-         DEBUG_PRINT("\n OMX_EventError \n");
-         DEBUG_PRINT("*********************************************\n");
-         if(OMX_ErrorInvalidState == (OMX_ERRORTYPE)nData1)
-             {
-                DEBUG_PRINT("\n OMX_ErrorInvalidState \n");
-                for(bufCnt=0; bufCnt < adec_appdata->input_buf_cnt; ++bufCnt)
-                {
-                   OMX_FreeBuffer(adec_appdata->mp3_dec_handle, 0, adec_appdata->pInputBufHdrs[bufCnt]);
-                }
-                if(adec_appdata->tunnel == 0)
-                {
-                    for(bufCnt=0; bufCnt < adec_appdata->output_buf_cnt; ++bufCnt)
-                    {
-                      OMX_FreeBuffer(adec_appdata->mp3_dec_handle, 1, adec_appdata->pOutputBufHdrs[bufCnt]);
-                    }
-                }
-
-                DEBUG_PRINT("*********************************************\n");
-                DEBUG_PRINT("\n Component Deinitialized \n");
-                DEBUG_PRINT("*********************************************\n");
-                exit(0);
-             }
-             else if(OMX_ErrorComponentSuspended == (OMX_ERRORTYPE)nData1)
-             {
-                DEBUG_PRINT("*********************************************\n");
-                DEBUG_PRINT("\n Component Received Suspend Event \n");
-                DEBUG_PRINT("*********************************************\n");
-             }
-      break;
-
-       case OMX_EventPortSettingsChanged:
-          if(adec_appdata->tunnel == 0)
-          {
-              adec_appdata->bReconfigureOutputPort = 1;
-              DEBUG_PRINT("*********************************************\n");
-              DEBUG_PRINT("\n OMX_EventPortSettingsChanged \n");
-              DEBUG_PRINT("*********************************************\n");
-              event_complete(adec_appdata);
-          }
-      break;
-
-      case OMX_EventBufferFlag:
-         DEBUG_PRINT("\n *********************************************\n");
-         DEBUG_PRINT("\n OMX_EventBufferFlag \n");
-         DEBUG_PRINT("\n *********************************************\n");
-         adec_appdata->bOutputEosReached = true;
-         if((!adec_appdata->pcmplayback && adec_appdata->filewrite)
-                || (adec_appdata->pcmplayback &&
-                 (adec_appdata->pcm_device_type == HOST_PCM_DEVICE ||
-                 (adec_appdata->pcm_device_type == PCM_DEC_DEVICE
-                 && !adec_appdata->num_pcm_buffers))))
-         {
-                 event_complete(adec_appdata);
-         }
-      break;
-      case OMX_EventComponentResumed:
-         DEBUG_PRINT("*********************************************\n");
-         DEBUG_PRINT("\n Component Received Resume Event \n");
-         DEBUG_PRINT("*********************************************\n");
-         break;
-      default:
-         DEBUG_PRINT("\n Unknown Event \n");
-      break;
-   }
-   return OMX_ErrorNone;
-}
-
-
-OMX_ERRORTYPE FillBufferDone(OMX_IN OMX_HANDLETYPE          hComponent,
-                             OMX_IN OMX_PTR                 pAppData,
-                             OMX_IN OMX_BUFFERHEADERTYPE*   pBuffer)
-{
-    struct msm_audio_aio_buf audio_aio_buf;
-    unsigned int i=0;
-    int bytes_writen = 0;
-    struct msm_audio_config drv_pcm_config;
-    struct adec_appdata* adec_appdata;
-
-    if(NULL != pAppData)
-       adec_appdata = (struct adec_appdata*) pAppData;
-    else
-       return OMX_ErrorBadParameter;
-
-    if (adec_appdata->flushinprogress == 1 )
-    {
-        DEBUG_PRINT(" FillBufferDone: flush is in progress so hold the buffers\n");
-        return OMX_ErrorNone;
-    }
-    if ( (adec_appdata->count == 0) &&
-        (adec_appdata->pcm_device_type == HOST_PCM_DEVICE) &&
-        (adec_appdata->pcmplayback))
-    {
-        DEBUG_PRINT(" open pcm device \n");
-        adec_appdata->m_pcmdrv_fd = open("/dev/msm_pcm_out", O_RDWR);
-        if ( adec_appdata->m_pcmdrv_fd < 0 )
-        {
-            DEBUG_PRINT("Cannot open audio device\n");
-            return -1;
-        }
-        else
-        {
-            DEBUG_PRINT("Open pcm device successfull\n");
-            DEBUG_PRINT("Configure Driver for PCM playback \n");
-            ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_GET_CONFIG, &drv_pcm_config);
-            DEBUG_PRINT("drv_pcm_config.buffer_count %d \n", drv_pcm_config.buffer_count);
-            DEBUG_PRINT("drv_pcm_config.buffer_size %d \n",  drv_pcm_config.buffer_size);
-            drv_pcm_config.sample_rate   = adec_appdata->mp3Header.sampling_rate;
-            drv_pcm_config.channel_count = adec_appdata->mp3Header.channel_mode;
-            ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_SET_CONFIG, &drv_pcm_config);
-            DEBUG_PRINT("Configure Driver for PCM playback \n");
-            ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_GET_CONFIG, &drv_pcm_config);
-            DEBUG_PRINT("drv_pcm_config.buffer_count %d \n", drv_pcm_config.buffer_count);
-            DEBUG_PRINT("drv_pcm_config.buffer_size %d \n",  drv_pcm_config.buffer_size);
-            adec_appdata->pcm_buf_size = drv_pcm_config.buffer_size;
-            adec_appdata->pcm_buf_count = drv_pcm_config.buffer_count;
-#ifdef AUDIOV2
-            ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_GET_SESSION_ID, &adec_appdata->session_id_hpcm);
-            DEBUG_PRINT("session id 0x%4x \n", adec_appdata->session_id_hpcm);
-            if(adec_appdata->devmgr_fd >= 0)
-            {
-               write_devctlcmd(adec_appdata->devmgr_fd, "-cmd=register_session_rx -sid=", adec_appdata->session_id_hpcm);
-            }
-            else
-            {
-               adec_appdata->control = msm_mixer_open("/dev/snd/controlC0", 0);
-               if (adec_appdata->control < 0)
-                  printf("ERROR opening the device\n");
-               adec_appdata->device_id = msm_get_device(adec_appdata->device);
-               DEBUG_PRINT ("\ndevice_id = %d\n", adec_appdata->device_id);
-               DEBUG_PRINT("\nsessionid = %d\n", adec_appdata->session_id);
-               if (msm_en_device(adec_appdata->device_id, 1))
-               {
-                  perror("could not enable device\n");
-                  return -1;
-               }
-               if (msm_route_stream(1, adec_appdata->session_id_hpcm, adec_appdata->device_id, 1))
-               {
-                  DEBUG_PRINT("could not set stream routing\n");
-                  return -1;
-               }
-            }
-#endif
-        }
-        adec_appdata->pBuffer_tmp= (OMX_U8*)malloc(adec_appdata->pcm_buf_count*sizeof(OMX_U8)*adec_appdata->pcm_buf_size);
-        if ( adec_appdata->pBuffer_tmp == NULL )
-        {
-            return -1;
-        }
-        else
-        {
-            memset(adec_appdata->pBuffer_tmp, 0, adec_appdata->pcm_buf_count*adec_appdata->pcm_buf_size);
-        }
-    }
-    DEBUG_PRINT(" FillBufferDone #%d size %u\n", adec_appdata->count++,(unsigned)(pBuffer->nFilledLen));
-
-    if ( adec_appdata->bEosOnOutputBuf )
-    {
-        return OMX_ErrorNone;
-    }
-
-    if ( (adec_appdata->tunnel == 0) && (adec_appdata->filewrite == 1) )
-    {
-        bytes_writen =
-        fwrite(pBuffer->pBuffer,1,pBuffer->nFilledLen,adec_appdata->outputBufferFile);
-        DEBUG_PRINT(" FillBufferDone size writen to file  %d\n",bytes_writen);
-        adec_appdata->totaldatalen += bytes_writen ;
-    }
-
-#ifdef PCM_PLAYBACK
-    if ( adec_appdata->pcmplayback && pBuffer->nFilledLen )
-    {
-      if(adec_appdata->pcm_device_type == HOST_PCM_DEVICE)
-      {
-        if ( adec_appdata->start_done == 0 )
-        {
-            if ( (adec_appdata->length_filled+ pBuffer->nFilledLen)>=(adec_appdata->pcm_buf_count*adec_appdata->pcm_buf_size) )
-            {
-                adec_appdata->spill_length = (pBuffer->nFilledLen-(adec_appdata->pcm_buf_count*adec_appdata->pcm_buf_size)+adec_appdata->length_filled);
-                memcpy (adec_appdata->pBuffer_tmp+adec_appdata->length_filled, pBuffer->pBuffer,
-                        ((adec_appdata->pcm_buf_count*adec_appdata->pcm_buf_size)-adec_appdata->length_filled));
-                adec_appdata->length_filled = (adec_appdata->pcm_buf_count*adec_appdata->pcm_buf_size);
-                adec_appdata->copy_done = 1;
-            }
-            else
-            {
-                memcpy (adec_appdata->pBuffer_tmp+adec_appdata->length_filled, pBuffer->pBuffer, pBuffer->nFilledLen);
-                adec_appdata->length_filled +=pBuffer->nFilledLen;
-            }
-            if (adec_appdata->copy_done == 1 )
-            {
-                for ( i=0; i<adec_appdata->pcm_buf_count; i++ )
-                {
-                    if ( write(adec_appdata->m_pcmdrv_fd,adec_appdata->pBuffer_tmp+i*adec_appdata->pcm_buf_size, adec_appdata->pcm_buf_size )
-                         != (ssize_t)(adec_appdata->pcm_buf_size) )
-                    {
-                        DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                        return -1;
-                    }
-
-                }
-                DEBUG_PRINT("AUDIO_START called for PCM \n");
-                ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_START, 0);
-                if (adec_appdata->spill_length != 0 )
-                {
-                    if ( write(adec_appdata->m_pcmdrv_fd, pBuffer->pBuffer+((pBuffer->nFilledLen)-adec_appdata->spill_length),adec_appdata->spill_length)
-                         != adec_appdata->spill_length )
-                    {
-                        DEBUG_PRINT("FillBufferDone: Write data to PCM failed\n");
-                        return -1;
-                    }
-                }
-
-
-
-
-                adec_appdata->copy_done = 0;
-                adec_appdata->start_done = 1;
-            }
-            if((adec_appdata->pcmplayback && (adec_appdata->pcm_device_type == HOST_PCM_DEVICE)) ||
-                (!adec_appdata->pcmplayback && adec_appdata->filewrite))
-            {
-                DEBUG_PRINT(" FBD calling FTB");
-                OMX_FillThisBuffer(hComponent,pBuffer);
-            }
-        }
-        else
-        {
-            unsigned int len=0;
-            hpcm_info ftb;
-            ftb.msg_type = DATA;
-            ftb.hComponent = hComponent;
-            ftb.bufHdr = pBuffer;
-            len= write(adec_appdata->mp3_hpcm.pipe_out,&ftb,sizeof(hpcm_info));
-            DEBUG_PRINT(" FillBufferDone: writing data to hpcm thread len=%d\n",len);
-
-        }
-
-      }
-
-        /* Write o/p data in Async manner to PCM Dec Driver */
-        if(adec_appdata->pcm_device_type == PCM_DEC_DEVICE)
-        {
-            if(adec_appdata->count == 1)
-            {
-               DEBUG_PRINT("FillBufferDone: PCM AUDIO_START\n");
-               ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_START, 0);
-            }
-
-            audio_aio_buf.buf_len = pBuffer->nAllocLen;
-            audio_aio_buf.data_len = pBuffer->nFilledLen;
-            audio_aio_buf.buf_addr = pBuffer->pBuffer;
-            audio_aio_buf.private_data = pBuffer;
-
-            DEBUG_PRINT("FBD:Calling PCMDEC ASYNC_WRITE for bufhdr[%p]\n", pBuffer);
-
-            if(0 > ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_ASYNC_WRITE, &audio_aio_buf))
-            {
-                DEBUG_PRINT("\nERROR in PCMDEC ASYNC WRITE call\n");
-                return OMX_ErrorHardware;
-            }
-
-            pthread_mutex_lock(&adec_appdata->pcm_buf_lock);
-            adec_appdata->num_pcm_buffers++;
-            DEBUG_PRINT("FBD: Bufcnt with PCMDEC  = %d\n", adec_appdata->num_pcm_buffers);
-            pthread_mutex_unlock(&adec_appdata->pcm_buf_lock);
-
-            DEBUG_PRINT("FBD: PCMDEC ASYNC_WRITE call is succesfull\n");
-        }
-    }
-    else if(adec_appdata->pcmplayback && !pBuffer->nFilledLen)
-    {
-        DEBUG_PRINT(" FBD calling FTB...special case");
-        OMX_FillThisBuffer(hComponent,pBuffer);
-
-    }
-    else if(!(adec_appdata->pcmplayback) && (adec_appdata->filewrite))
-    {
-        DEBUG_PRINT(" FBD calling FTB");
-        OMX_FillThisBuffer(hComponent,pBuffer);
-
-    }
-#endif   // PCM_PLAYBACK
-
-    if(pBuffer->nFlags & OMX_BUFFERFLAG_EOS)
-    {
-        DEBUG_PRINT("FBD EOS REACHED...........\n");
-        adec_appdata->bEosOnOutputBuf = true;
-    }
-
-    return OMX_ErrorNone;
-}
-
-
-OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
-                              OMX_IN OMX_PTR pAppData,
-                              OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
-{
-   int readBytes =0;
-   struct adec_appdata* adec_appdata;
-
-   if(NULL != pAppData)
-       adec_appdata = (struct adec_appdata*) pAppData;
-   else
-       return OMX_ErrorBadParameter;
-   DEBUG_PRINT("\nFunction %s cnt[%d]\n", __FUNCTION__,adec_appdata->ebd_cnt);
-   adec_appdata->ebd_cnt++;
-   adec_appdata->used_ip_buf_cnt--;
-   if(adec_appdata->bEosOnInputBuf) {
-      DEBUG_PRINT("\n*********************************************\n");
-      DEBUG_PRINT("   EBD::EOS on input port\n ");
-      DEBUG_PRINT("   TBD:::De Init the open max here....!!!\n");
-      DEBUG_PRINT("*********************************************\n");
-
-     return OMX_ErrorNone;
-   }
-   else if (adec_appdata->bFlushing == true) {
-      if (adec_appdata->used_ip_buf_cnt == 0) {
-         fseek(adec_appdata->inputBufferFile, 0, 0);
-         adec_appdata->bFlushing = false;
-      }
-      else {
-         DEBUG_PRINT("omx_mp3_adec_test: more buffer to come back\n");
-         return OMX_ErrorNone;
-      }
-   }
-   if((readBytes = Read_Buffer(pBuffer,adec_appdata->inputBufferFile)) > 0) {
-      pBuffer->nFilledLen = readBytes;
-      adec_appdata->used_ip_buf_cnt++;
-      OMX_EmptyThisBuffer(hComponent,pBuffer);
-   }
-   else {
-        DEBUG_PRINT("\n readBytes = %d\n", readBytes);
-        pBuffer->nFlags |= OMX_BUFFERFLAG_EOS;
-        adec_appdata->bEosOnInputBuf = true;
-        adec_appdata->used_ip_buf_cnt++;
-        pBuffer->nFilledLen = 0;
-        OMX_EmptyThisBuffer(hComponent,pBuffer);
-        DEBUG_PRINT("EBD..Either EOS or Some Error while reading file\n");
-   }
-   return OMX_ErrorNone;
-}
-
-
-void signal_handler(int sig_id)
-{
-   /* Flush */
-
-   if (sig_id == SIGUSR1) {
-      DEBUG_PRINT("SIGUSR1 Invoked\n");
-      if(!is_multi_inst)
-      {
-          DEBUG_PRINT("%s Initiate flushing\n", __FUNCTION__);
-          adec_mp3_inst1.bFlushing = true;
-          OMX_SendCommand(adec_mp3_inst1.mp3_dec_handle, OMX_CommandFlush, OMX_ALL, NULL);
-      }
-   }
-   else if (sig_id == SIGUSR2) {
-      DEBUG_PRINT("SIGUSR2 Invoked\n");
-      if(!is_multi_inst)
-      {
-         if (adec_mp3_inst1.bPause == true) {
-             DEBUG_PRINT("%s resume playback\n", __FUNCTION__);
-             adec_mp3_inst1.bPause = false;
-             OMX_SendCommand(adec_mp3_inst1.mp3_dec_handle, OMX_CommandStateSet, OMX_StateExecuting, NULL);
-         }
-         else {
-             DEBUG_PRINT("%s pause playback\n", __FUNCTION__);
-             adec_mp3_inst1.bPause = true;
-             OMX_SendCommand(adec_mp3_inst1.mp3_dec_handle, OMX_CommandStateSet, OMX_StatePause, NULL);
-         }
-      }
-   }
-}
-
-
-void* thread_function(void* data)
-{
-   struct adec_appdata *adec_mp3_inst = (struct adec_appdata *)data;
-   struct wav_header hdr;
-   int bufCnt=0;
-   OMX_ERRORTYPE result;
-   int bytes_writen = 0;
-
-#ifdef AUDIOV2
-strlcpy(adec_mp3_inst1.device,"speaker_stereo_rx",
-			sizeof(adec_mp3_inst1.device));
-adec_mp3_inst1.control=0;
-#endif
-
-   if(Init_Decoder(adec_mp3_inst)!= 0x00) {
-      DEBUG_PRINT("Decoder Init failed\n");
-      return (void*)(-1);
-   }
-
-   if(Play_Decoder(adec_mp3_inst) != 0x00) {
-      DEBUG_PRINT("Play_Decoder failed\n");
-      return (void*) (-1);
-   }
-
-   // Wait till EOS is reached...
-   if(adec_mp3_inst->bReconfigureOutputPort)
-   {
-      wait_for_event(adec_mp3_inst);
-   }
-
-   DEBUG_PRINT(" bOutputEosReached = %d bInputEosReached = %d \n",
-       adec_mp3_inst->bOutputEosReached, adec_mp3_inst->bInputEosReached);
-   if(adec_mp3_inst->bOutputEosReached) {
-
-      #ifdef PCM_PLAYBACK
-      if(adec_mp3_inst->pcmplayback == 1) {
-         sleep(1);
-         if(adec_mp3_inst->pcm_device_type == PCM_DEC_DEVICE)
-         {
-             fsync(adec_mp3_inst->m_pcmdrv_fd);
-         }
-
-
-         if(adec_mp3_inst->pcm_device_type == PCM_DEC_DEVICE)
-         {
-             DEBUG_PRINT("\n Calling ABORT_GET_EVENT for PCMDEC driver\n");
-             if(0 > ioctl(adec_mp3_inst->m_pcmdrv_fd, AUDIO_ABORT_GET_EVENT, NULL))
-             {
-                 DEBUG_PRINT("\n Error in ioctl AUDIO_ABORT_GET_EVENT\n");
-             }
-
-             DEBUG_PRINT("\n Waiting for PCMDrv Event Thread complete\n");
-             pthread_join(adec_mp3_inst->m_pcmdrv_evt_thread_id, NULL);
-         }
-         else
-         {
-             DEBUG_PRINT("*******************************\n");
-             DEBUG_PRINT("\n HPCMDrv Event Thread complete %d %d\n",
-                                adec_mp3_inst->mp3_hpcm.pipe_in,
-                                adec_mp3_inst->mp3_hpcm.pipe_out);
-             close(adec_mp3_inst->mp3_hpcm.pipe_in);
-             close(adec_mp3_inst->mp3_hpcm.pipe_out);
-             adec_mp3_inst->mp3_hpcm.pipe_in=-1;
-             adec_mp3_inst->mp3_hpcm.pipe_out=-1;
-             pthread_join(adec_mp3_inst->m_pcmdrv_evt_thread_id, NULL);
-             DEBUG_PRINT("*******************************\n");
-         }
-         ioctl(adec_mp3_inst->m_pcmdrv_fd, AUDIO_STOP, 0);
-#ifdef AUDIOV2
-        if(adec_mp3_inst->devmgr_fd >= 0)
-        {
-            write_devctlcmd(adec_mp3_inst->devmgr_fd, "-cmd=unregister_session_rx -sid=", adec_mp3_inst->session_id_hpcm);
-        }
-        else
-        {
-	     if (msm_route_stream(1, adec_mp3_inst->session_id_hpcm, adec_mp3_inst->device_id, 0))
-             {
-                DEBUG_PRINT("\ncould not set stream routing\n");
-             }
-        }
-#endif
-         if(adec_mp3_inst->m_pcmdrv_fd >= 0) {
-            close(adec_mp3_inst->m_pcmdrv_fd);
-            adec_mp3_inst->m_pcmdrv_fd = -1;
-            DEBUG_PRINT(" PCM device closed succesfully \n");
-         }
-         else {
-            DEBUG_PRINT(" PCM device close failure \n");
-         }
-      }
-      #endif // PCM_PLAYBACK
-
-      if((adec_mp3_inst->tunnel == 0) && (adec_mp3_inst->filewrite == 1)) {
-         hdr.riff_id = ID_RIFF;
-         hdr.riff_sz = 0;
-         hdr.riff_fmt = ID_WAVE;
-         hdr.fmt_id = ID_FMT;
-         hdr.fmt_sz = 16;
-         hdr.audio_format = FORMAT_PCM;
-         hdr.num_channels = adec_mp3_inst->mp3Header.channel_mode;
-         hdr.sample_rate = adec_mp3_inst->mp3Header.sampling_rate;
-         hdr.byte_rate = hdr.sample_rate * hdr.num_channels * 2;
-         hdr.block_align = hdr.num_channels * 2;
-         hdr.bits_per_sample = 16;
-         hdr.data_id = ID_DATA;
-         hdr.data_sz = 0;
-
-         DEBUG_PRINT("output file closed and EOS reached total decoded data length %d\n",adec_mp3_inst->totaldatalen);
-         hdr.data_sz = adec_mp3_inst->totaldatalen;
-         hdr.riff_sz = adec_mp3_inst->totaldatalen + 8 + 16 + 8;
-         fseek(adec_mp3_inst->outputBufferFile, 0L , SEEK_SET);
-         bytes_writen = fwrite(&hdr,1,sizeof(hdr),adec_mp3_inst->outputBufferFile);
-         if (bytes_writen <= 0) {
-            DEBUG_PRINT("Invalid Wav header write failed\n");
-         }
-         fclose(adec_mp3_inst->outputBufferFile);
-      }
-      /************************************************************************************/
-
-      DEBUG_PRINT("\nMoving the decoder to idle state \n");
-      OMX_SendCommand(adec_mp3_inst->mp3_dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
-      wait_for_event(adec_mp3_inst);
-
-      DEBUG_PRINT("\nMoving the decoder to loaded state \n");
-      OMX_SendCommand(adec_mp3_inst->mp3_dec_handle, OMX_CommandStateSet, OMX_StateLoaded,0);
-
-      DEBUG_PRINT("\nFillBufferDone: Deallocating i/p buffers \n");
-      for(bufCnt=0; bufCnt < adec_mp3_inst->input_buf_cnt; ++bufCnt) {
-         Free_Buffer(adec_mp3_inst, 0, adec_mp3_inst->pInputBufHdrs[bufCnt]);
-      }
-
-      free(adec_mp3_inst->pInputBufHdrs);
-      adec_mp3_inst->pInputBufHdrs = NULL;
-
-      if(adec_mp3_inst->tunnel == 0) {
-         DEBUG_PRINT("\nFillBufferDone: Deallocating o/p buffers \n");
-         for(bufCnt=0; bufCnt < adec_mp3_inst->output_buf_cnt; ++bufCnt) {
-            Free_Buffer(adec_mp3_inst, 1, adec_mp3_inst->pOutputBufHdrs[bufCnt]);
-         }
-         free(adec_mp3_inst->pOutputBufHdrs);
-         adec_mp3_inst->pOutputBufHdrs = NULL;
-      }
-
-      DEBUG_PRINT("*******************************************\n");
-      wait_for_event(adec_mp3_inst);
-      adec_mp3_inst->ebd_cnt=0;
-      adec_mp3_inst->bOutputEosReached = false;
-      adec_mp3_inst->bInputEosReached = false;
-      adec_mp3_inst->bEosOnInputBuf = 0;
-      adec_mp3_inst->bEosOnOutputBuf = 0;
-      adec_mp3_inst->bReconfigureOutputPort = 0;
-      if (adec_mp3_inst->pBuffer_tmp )
-      {
-          free(adec_mp3_inst->pBuffer_tmp);
-          adec_mp3_inst->pBuffer_tmp =NULL;
-      }
-      result = OMX_FreeHandle(adec_mp3_inst->mp3_dec_handle);
-      if (result != OMX_ErrorNone) {
-         DEBUG_PRINT_ERROR("\nOMX_FreeHandle error. Error code: %d\n", result);
-      }
-      else DEBUG_PRINT("OMX_FreeHandle success...\n");
-
-      adec_mp3_inst->mp3_dec_handle = NULL;
-#ifdef AUDIOV2
-      if(adec_mp3_inst->devmgr_fd >= 0)
-      {
-         write_devctlcmd(adec_mp3_inst->devmgr_fd, "-cmd=unregister_session_rx -sid=", adec_mp3_inst->session_id);
-         close(adec_mp3_inst->devmgr_fd);
-      }
-      else
-      {
-         if (msm_route_stream(1, adec_mp3_inst->session_id, adec_mp3_inst->device_id, 0))
-         {
-            DEBUG_PRINT("\ncould not set stream routing\n");
-            return (void *)-1;
-         }
-         if (msm_en_device(adec_mp3_inst->device_id, 0))
-         {
-            DEBUG_PRINT("\ncould not enable device\n");
-            return (void *)-1;
-         }
-         msm_mixer_close();
-       }
-#endif
-      pthread_cond_destroy(&adec_mp3_inst->cond);
-      pthread_mutex_destroy(&adec_mp3_inst->lock);
-
-      if(adec_mp3_inst->pcmplayback &&
-          adec_mp3_inst->pcm_device_type == PCM_DEC_DEVICE)
-      {
-          pthread_mutex_destroy(&adec_mp3_inst->pcm_buf_lock);
-      }
-   }
-   return 0;
-}
-
-int main(int argc, char **argv)
-{
-    struct sigaction sa;
-    pthread_t thread1_id;
-    int thread1_ret=0;
-
-    memset(&sa, 0, sizeof(sa));
-    sa.sa_handler = &signal_handler;
-    sigaction(SIGABRT, &sa, NULL);
-    sigaction(SIGUSR1, &sa, NULL);
-    sigaction(SIGUSR2, &sa, NULL);
-
-    if(argc == 7)
-    {
-            adec_appdata_init(&adec_mp3_inst1);
-            pthread_cond_init(&adec_mp3_inst1.cond, 0);
-            pthread_mutex_init(&adec_mp3_inst1.lock, 0);
-            adec_mp3_inst1.in_filename = argv[1];
-            adec_mp3_inst1.bParseHeader = atoi(argv[2]);
-            adec_mp3_inst1.pcmplayback = atoi(argv[3]);
-            adec_mp3_inst1.filewrite = atoi(argv[4]);
-            adec_mp3_inst1.out_filename = argv[5];
-            adec_mp3_inst1.buffer_option = atoi(argv[6]);
-
-            //adec_mp3_inst1.out_filename = (char*)malloc(sizeof("audio.wav"));
-            //strncpy(adec_mp3_inst1.out_filename,"audio.wav",strlen("audio.wav"));
-            if(adec_mp3_inst1.tunnel == 0)
-               adec_mp3_inst1.aud_comp = "OMX.PV.mp3dec";
-
-            if(adec_mp3_inst1.pcmplayback &&
-                adec_mp3_inst1.pcm_device_type == PCM_DEC_DEVICE)
-            {
-               pthread_mutex_init(&adec_mp3_inst1.pcm_buf_lock, 0);
-            }
-            DEBUG_PRINT(" OMX test app : aud_comp instance = %s\n",adec_mp3_inst1.aud_comp);
-
-    }
-    else
-    {
-            DEBUG_PRINT( "invalid format: \n");
-            DEBUG_PRINT( "ex: ./sw-adec-omxmp3-test MP3INPUTFILE ParseHeader PCMPLAYBACK \n");
-            DEBUG_PRINT( "FILEWRITE OUTFILENAME BUFFEROPTION PCMDEVICETYPE\n");
-            DEBUG_PRINT( "ParseHeader= 1 (Parses MP3 Header) \n");
-            DEBUG_PRINT( "ParseHeader= 0 (Uses Default Sampling rate and channel) \n");
-            DEBUG_PRINT( "PCMPLAYBACK = 1 (ENABLES PCM PLAYBACK IN NON TUNNEL MODE) \n");
-            DEBUG_PRINT( "PCMPLAYBACK = 0 (DISABLES PCM PLAYBACK IN NON TUNNEL MODE) \n");
-            DEBUG_PRINT( "FILEWRITE = 1 (ENABLES PCM FILEWRITE IN NON TUNNEL MODE) \n");
-            DEBUG_PRINT( "FILEWRITE = 0 (DISABLES PCM FILEWRITE IN NON TUNNEL MODE) \n");
-            DEBUG_PRINT( "BUFFER OPTION = 0 (AllocateBuffer case)\n");
-            DEBUG_PRINT( "BUFFER OPTION = 1 (UseBuffer case)\n");
-            return 0;
-    }
-
-   if(adec_mp3_inst1.tunnel == 0)
-     adec_mp3_inst1.aud_comp = "OMX.PV.mp3dec";
-
-   DEBUG_PRINT(" OMX test app : aud_comp instance 1= %s\n",adec_mp3_inst1.aud_comp);
-   pthread_create (&thread1_id, NULL, &thread_function, &adec_mp3_inst1);
-   pthread_join(thread1_id,(void**) &thread1_ret);
-   if(0 == thread1_ret)
-     DEBUG_PRINT(" Thread 1 ended successfully\n");
-   
-    /* Deinit OpenMAX */
-    OMX_Deinit();
-
-    DEBUG_PRINT("*****************************************\n");
-    DEBUG_PRINT("******...TEST COMPLETED...***************\n");
-    DEBUG_PRINT("*****************************************\n");
-    return 0;
-}
-
-
-int Init_Decoder(struct adec_appdata* adec_appdata)
-{
-   DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-   OMX_ERRORTYPE omxresult;
-   OMX_U32 total = 0;
-   typedef OMX_U8* OMX_U8_PTR;
-   char *role ="audio_decoder.mp3";
-
-   static OMX_CALLBACKTYPE call_back = {
-      &EventHandler,&EmptyBufferDone,&FillBufferDone
-   };
-
-   /* Init. the OpenMAX Core */
-   DEBUG_PRINT("\nInitializing OpenMAX Core....\n");
-   omxresult = OMX_Init();
-
-   if(OMX_ErrorNone != omxresult) {
-      DEBUG_PRINT("\n Failed to Init OpenMAX core");
-      return -1;
-   }
-   else {
-      DEBUG_PRINT("\nOpenMAX Core Init Done\n");
-   }
-
-   /* Query for audio decoders*/
-   DEBUG_PRINT("Mp3_test: Before entering OMX_GetComponentOfRole");
-   OMX_GetComponentsOfRole(role, &total, 0);
-   DEBUG_PRINT("\nTotal components of role = %s :%u \n", role ,(unsigned)total);
-
-   DEBUG_PRINT("\nComponent before GEThandle %s \n", adec_appdata->aud_comp);
-
-   omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&adec_appdata->mp3_dec_handle),
-                        (OMX_STRING)adec_appdata->aud_comp, adec_appdata, &call_back);
-
-   if (FAILED(omxresult)) {
-      DEBUG_PRINT("\nFailed to Load the  component:%s\n", adec_appdata->aud_comp);
-      return -1;
-   }
-   else {
-      DEBUG_PRINT("\nComponent %s is in LOADED state with handle: %p\n", adec_appdata->aud_comp,adec_appdata->mp3_dec_handle);
-   }
-
-   /* Get the port information */
-   CONFIG_VERSION_SIZE(adec_appdata->portParam);
-   omxresult = OMX_GetParameter(adec_appdata->mp3_dec_handle, OMX_IndexParamAudioInit,
-                                (OMX_PTR)&(adec_appdata->portParam));
-
-   if(FAILED(omxresult)) {
-      DEBUG_PRINT("\nFailed to get Port Param\n");
-      return -1;
-   }
-   else {
-      DEBUG_PRINT("\nportParam.nPorts:%u\n", (unsigned)(adec_appdata->portParam.nPorts));
-      DEBUG_PRINT("\nportParam.nStartPortNumber:%u\n",
-                                          (unsigned)(adec_appdata->portParam.nStartPortNumber));
-   }
-   return 0;
-}
-
-int Play_Decoder(struct adec_appdata* adec_appdata)
-{
-   int i;
-   int Size=0;
-   DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-   OMX_ERRORTYPE ret;
-   OMX_INDEXTYPE index;
-   #ifdef PCM_PLAYBACK
-   struct msm_audio_config drv_pcm_config;
-   #endif  // PCM_PLAYBACK
-
-   DEBUG_PRINT("sizeof[%d]\n", sizeof(OMX_BUFFERHEADERTYPE));
-
-   /* open the i/p and o/p files based on the video file format passed */
-   if(open_audio_file(adec_appdata)) {
-      DEBUG_PRINT("\n Returning -1");
-      return -1;
-   }
-   /* Query the decoder input min buf requirements */
-   CONFIG_VERSION_SIZE(adec_appdata->inputportFmt);
-
-   /* Port for which the Client needs to obtain info */
-   adec_appdata->inputportFmt.nPortIndex = adec_appdata->portParam.nStartPortNumber;
-
-   OMX_GetParameter(adec_appdata->mp3_dec_handle,OMX_IndexParamPortDefinition,&adec_appdata->inputportFmt);
-   DEBUG_PRINT ("\nDec: Input Buffer Count %u\n",(unsigned) (adec_appdata->inputportFmt.nBufferCountMin));
-   DEBUG_PRINT ("\nDec: Input Buffer Size %u\n", (unsigned) (adec_appdata->inputportFmt.nBufferSize));
-
-   if(OMX_DirInput != adec_appdata->inputportFmt.eDir) {
-      DEBUG_PRINT ("\nDec: Expect Input Port\n");
-      return -1;
-   }
-
-   adec_appdata->inputportFmt.nBufferCountActual = adec_appdata->inputportFmt.nBufferCountMin +  5;
-   OMX_SetParameter(adec_appdata->mp3_dec_handle,OMX_IndexParamPortDefinition,&adec_appdata->inputportFmt);
-   OMX_GetExtensionIndex(adec_appdata->mp3_dec_handle,"OMX.Qualcomm.index.audio.sessionid",&index);
-   OMX_GetParameter(adec_appdata->mp3_dec_handle,index,&adec_appdata->streaminfoparam);
-#ifdef AUDIOV2
-	adec_appdata->session_id = adec_appdata->streaminfoparam.sessionId;
-	adec_appdata->devmgr_fd = open("/data/omx_devmgr", O_WRONLY);
-	if(adec_appdata->devmgr_fd >= 0)
-	{
-           adec_appdata->control = 0;
-	   write_devctlcmd(adec_appdata->devmgr_fd, "-cmd=register_session_rx -sid=", adec_appdata->session_id);
-        }
-#endif
-   if(adec_appdata->tunnel == 0) {
-      /* Query the decoder outport's min buf requirements */
-      CONFIG_VERSION_SIZE(adec_appdata->outputportFmt);
-      /* Port for which the Client needs to obtain info */
-      adec_appdata->outputportFmt.nPortIndex = adec_appdata->portParam.nStartPortNumber + 1;
-
-      OMX_GetParameter(adec_appdata->mp3_dec_handle,OMX_IndexParamPortDefinition,&adec_appdata->outputportFmt);
-      DEBUG_PRINT ("\nDec: Output Buffer Count %u\n",(unsigned)( adec_appdata->outputportFmt.nBufferCountMin));
-      DEBUG_PRINT ("\nDec: Output Buffer Size %u\n",(unsigned)( adec_appdata->outputportFmt.nBufferSize));
-
-      if(OMX_DirOutput != adec_appdata->outputportFmt.eDir) {
-         DEBUG_PRINT ("\nDec: Expect Output Port\n");
-         return -1;
-      }
-    adec_appdata->outputportFmt.nBufferCountActual = adec_appdata->outputportFmt.nBufferCountMin + 3;
-    OMX_SetParameter(adec_appdata->mp3_dec_handle,OMX_IndexParamPortDefinition,&adec_appdata->outputportFmt);
-   }
-
-   CONFIG_VERSION_SIZE(adec_appdata->mp3param);
-
-   DEBUG_PRINT(" adec_appdata->pcm_device_type = %d\n", adec_appdata->pcm_device_type);
-   #ifdef PCM_PLAYBACK
-   if(adec_appdata->pcmplayback && adec_appdata->pcm_device_type == PCM_DEC_DEVICE)
-   {
-      DEBUG_PRINT(" open pcm dec device \n");
-      adec_appdata->m_pcmdrv_fd = open("/dev/msm_pcm_dec", O_WRONLY | O_NONBLOCK);
-      if (adec_appdata->m_pcmdrv_fd < 0)
-      {
-          DEBUG_PRINT("Play_Decoder: cannot open pcm_dec device");
-          return -1;
-      }
-      DEBUG_PRINT(" Play_Decoder: open pcm device successfull\n");
-
-      /* Create the Event Thread for PCM Dec driver */
-      if (pthread_create(&adec_appdata->m_pcmdrv_evt_thread_id, 0, process_pcm_drv_events,
-          adec_appdata) < 0)
-      {
-          DEBUG_PRINT("\n Event Thread creation for PCM Dec driver FAILED\n");
-          return -1;
-      }
-   }
-   else
-   {
-        int fds[2];
-        if (pipe(fds)) {
-            DEBUG_PRINT("\n%s: pipe creation failed\n", __FUNCTION__);
-        }
-        adec_appdata->mp3_hpcm.pipe_in=fds[0];
-        adec_appdata->mp3_hpcm.pipe_out=fds[1];
-        DEBUG_PRINT("********************************\n");
-        DEBUG_PRINT("HPCM PIPES %d %d\n",fds[0],fds[1]);
-        DEBUG_PRINT("********************************\n");
-
-      if (pthread_create(&adec_appdata->m_pcmdrv_evt_thread_id, 0, process_hpcm_drv_events,
-          adec_appdata) < 0)
-      {
-          DEBUG_PRINT_ERROR("\n Event Thread creation for PCM Dec driver FAILED\n");
-          return -1;
-      }
-   }
-   #endif  // PCM_PLAYBACK
-
-   DEBUG_PRINT ("\nOMX_SendCommand Decoder -> IDLE\n");
-   OMX_SendCommand(adec_appdata->mp3_dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
-   /* wait_for_event(); should not wait here event complete status will
-      not come until enough buffer are allocated */
-
-   adec_appdata->input_buf_cnt = adec_appdata->inputportFmt.nBufferCountActual; //inputportFmt.nBufferCountMin + 5;
-   DEBUG_PRINT("Transition to Idle State succesful...\n");
-
-   if(adec_appdata->buffer_option == USE_BUFFER_CASE)
-   {
-        /* Use buffer on decoder's I/P port */
-        adec_appdata->error = Use_Buffer(adec_appdata,
-           adec_appdata->inputportFmt.nPortIndex);
-        if (adec_appdata->error != OMX_ErrorNone)
-        {
-           DEBUG_PRINT ("\nOMX_UseBuffer Input buffer error\n");
-           return -1;
-        }
-        else
-        {
-            DEBUG_PRINT ("\nOMX_UseBuffer Input buffer success\n");
-        }
-   }
-   else
-   {
-       /* Allocate buffer on decoder's i/p port */
-       adec_appdata->error = Allocate_Buffer(adec_appdata,
-           adec_appdata->inputportFmt.nPortIndex);
-       if (adec_appdata->error != OMX_ErrorNone) {
-           DEBUG_PRINT ("\nOMX_AllocateBuffer Input buffer error\n");
-           return -1;
-       }
-       else {
-           DEBUG_PRINT ("\nOMX_AllocateBuffer Input buffer success\n");
-       }
-   }
-
-   if(adec_appdata->tunnel == 0) {
-      adec_appdata->output_buf_cnt = adec_appdata->outputportFmt.nBufferCountActual ;
-
-      if(adec_appdata->buffer_option == USE_BUFFER_CASE)
-      {
-          /* Use buffer on decoder's O/P port */
-          adec_appdata->error = Use_Buffer(adec_appdata,
-              adec_appdata->outputportFmt.nPortIndex);
-          if (adec_appdata->error != OMX_ErrorNone)
-          {
-             DEBUG_PRINT ("\nOMX_UseBuffer Output buffer error\n");
-             return -1;
-          }
-          else
-          {
-             DEBUG_PRINT ("\nOMX_UseBuffer Output buffer success\n");
-          }
-      }
-      else
-      {
-          /* Allocate buffer on decoder's O/Pp port */
-          adec_appdata->error = Allocate_Buffer(adec_appdata,
-              adec_appdata->outputportFmt.nPortIndex);
-          if (adec_appdata->error != OMX_ErrorNone) {
-             DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer error\n");
-             return -1;
-          }
-          else {
-             DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer success\n");
-          }
-      }
-   }
-
-   wait_for_event(adec_appdata);
-
-   DEBUG_PRINT ("\nOMX_SendCommand Decoder -> Executing\n");
-   OMX_SendCommand(adec_appdata->mp3_dec_handle, OMX_CommandStateSet, OMX_StateExecuting,0);
-   wait_for_event(adec_appdata);
-
-   if((adec_appdata->tunnel == 0))
-   {
-      DEBUG_PRINT(" Start sending OMX_FILLthisbuffer\n");
-
-      for(i=0; i < adec_appdata->output_buf_cnt; i++) {
-         DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
-         adec_appdata->pOutputBufHdrs[i]->nOutputPortIndex = 1;
-         adec_appdata->pOutputBufHdrs[i]->nFlags &= ~OMX_BUFFERFLAG_EOS;
-         ret = OMX_FillThisBuffer(adec_appdata->mp3_dec_handle, adec_appdata->pOutputBufHdrs[i]);
-         if (OMX_ErrorNone != ret) {
-            DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
-         }
-         else {
-            DEBUG_PRINT("OMX_FillThisBuffer success!\n");
-         }
-      }
-   }
-
-
-   DEBUG_PRINT(" Start sending OMX_emptythisbuffer\n");
-   for (i = 0;i < adec_appdata->input_buf_cnt;i++) {
-      DEBUG_PRINT ("\nOMX_EmptyThisBuffer on Input buf no.%d\n",i);
-      adec_appdata->pInputBufHdrs[i]->nInputPortIndex = 0;
-      Size = Read_Buffer(adec_appdata->pInputBufHdrs[i],adec_appdata->inputBufferFile);
-      if(Size <=0 ) {
-         DEBUG_PRINT("\n readBytes = %d\n", Size);
-         DEBUG_PRINT("NO DATA READ\n");
-         adec_appdata->bEosOnInputBuf = true;
-         Size = 0;
-         adec_appdata->pInputBufHdrs[i]->nFlags |= OMX_BUFFERFLAG_EOS;
-         DEBUG_PRINT("Play_decoder::EOS or Error while reading file\n");
-      }
-      adec_appdata->pInputBufHdrs[i]->nFilledLen = Size;
-      adec_appdata->pInputBufHdrs[i]->nInputPortIndex = 0;
-      adec_appdata->used_ip_buf_cnt++;
-
-      if(adec_appdata->first_buffer)
-      {
-          adec_appdata->first_buffer = 0;
-          ret = parse_mp3_frameheader(adec_appdata->pInputBufHdrs[i],&adec_appdata->mp3Header);
-          if(ret != OMX_ErrorNone)
-          {
-              DEBUG_PRINT("parse_mp3_frameheader return failure\n");
-              adec_appdata->mp3Header.sampling_rate = DEFAULT_SAMPLING_RATE;
-              adec_appdata->mp3Header.channel_mode  = DEFAULT_CHANNEL_MODE;
-          }
-
-          /* Get the Output port PCM configuration details */
-          adec_appdata->mp3param.nPortIndex   = 0;
-          adec_appdata->mp3param.nSampleRate  = adec_appdata->mp3Header.sampling_rate;
-          adec_appdata->mp3param.nChannels    = adec_appdata->mp3Header.channel_mode;
-          adec_appdata->mp3param.nBitRate     = 0;
-          adec_appdata->mp3param.eChannelMode = OMX_AUDIO_ChannelModeStereo;
-          adec_appdata->mp3param.eFormat      = OMX_AUDIO_MP3StreamFormatMP1Layer3;
-
-          if(!adec_appdata->bParseHeader)
-          {
-              adec_appdata->mp3param.nSampleRate = DEFAULT_SAMPLING_RATE;
-              adec_appdata->mp3param.nChannels   = DEFAULT_CHANNEL_MODE;
-          }
-
-          OMX_SetParameter(adec_appdata->mp3_dec_handle, OMX_IndexParamAudioMp3,
-                          (OMX_PTR)&adec_appdata->mp3param);
-
-          if(adec_appdata->pcmplayback &&
-              adec_appdata->pcm_device_type == PCM_DEC_DEVICE)
-          {
-              DEBUG_PRINT("configure Driver for PCM playback \n");
-              ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_GET_CONFIG, &drv_pcm_config);
-              drv_pcm_config.sample_rate   = adec_appdata->mp3Header.sampling_rate;
-              drv_pcm_config.channel_count = adec_appdata->mp3Header.channel_mode;
-              ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_SET_CONFIG, &drv_pcm_config);
-          }
-      }
-
-      ret = OMX_EmptyThisBuffer(adec_appdata->mp3_dec_handle, adec_appdata->pInputBufHdrs[i]);
-      if (OMX_ErrorNone != ret) {
-         DEBUG_PRINT("OMX_EmptyThisBuffer failed with result %d\n", ret);
-      }
-      else {
-         DEBUG_PRINT("OMX_EmptyThisBuffer success!\n");
-      }
-   }
-
-    /* Waiting for EOS or PortSettingsChange*/
-    while(1)
-    {
-        wait_for_event(adec_appdata);
-        if(adec_appdata->bOutputEosReached)
-        {
-           adec_appdata->bReconfigureOutputPort = 0;
-           printf("bOutputEosReached breaking\n");
-           break;
-        }
-        else
-        {
-            if(adec_appdata->tunnel == 0 && adec_appdata->bReconfigureOutputPort)
-                process_portreconfig(adec_appdata);
-        }
-    }
-
-   return 0;
-}
-
-unsigned int extract_id3_header_size(OMX_U8* buffer)
-{
-    unsigned int size = 0;
-    OMX_U8* pTemp = NULL;
-
-    if(!buffer)
-    {
-        return 0;
-    }
-
-    pTemp = buffer+6;
-    size = ((pTemp[0]&0x7F) << 21);
-    size |= ((pTemp[1]&0x7F) << 14);
-    size |= ((pTemp[2]&0x7F) << 7);
-    size |= ((pTemp[3]&0x7F));
-
-    return (size+10);
-}
-
-OMX_ERRORTYPE  parse_mp3_frameheader(OMX_BUFFERHEADERTYPE* buffer,
-                                     struct mp3_header *header)
-{
-    OMX_U8* temp_pBuf1 = NULL;
-    unsigned int i = 0;
-    unsigned int id3_size = 0;
-    OMX_U8 temp;
-
-
-    for(i=0;i<10;i++)
-     DEBUG_PRINT ("\n buffer[%d] = 0x%x",i,buffer->pBuffer[i]);
-    if ( buffer->nFilledLen == 0 )
-    {
-        DEBUG_PRINT ("\n Length is zero hence no point in processing \n");
-        return OMX_ErrorNone;
-    }
-
-    temp_pBuf1 = buffer->pBuffer;
-
-    i = 0;
-    while (i<buffer->nFilledLen)
-    {
-        if((i < buffer->nFilledLen-2) && (temp_pBuf1[0] == 0x49) &&
-            (temp_pBuf1[1] == 0x44) && (temp_pBuf1[2] == 0x33))
-        {
-            if(i < buffer->nFilledLen-10)
-            {
-                id3_size = extract_id3_header_size(temp_pBuf1);
-                DEBUG_PRINT("\n ID3 tag size = %u\n", id3_size);
-            }
-            else
-            {
-                DEBUG_PRINT("\nFull ID3 tag header not available\n");
-                return OMX_ErrorMax;
-            }
-
-            if(id3_size && i < buffer->nFilledLen-id3_size)
-            {
-                i += id3_size;
-                temp_pBuf1 += id3_size;
-
-                DEBUG_PRINT("\n Skipping valid ID3 tag\n");
-                break;
-            }
-            else
-            {
-                DEBUG_PRINT("\n ID3 Tag size 0 or exceeds 1st buffer\n");
-                return OMX_ErrorMax;
-            }
-        }
-        else if(*temp_pBuf1 == 0xFF )
-        {
-            break;
-        }
-
-        i++;
-        temp_pBuf1++;
-    }
-
-    if ( i==buffer->nFilledLen )
-       return OMX_ErrorMax;
-
-    temp = temp_pBuf1[0];
-    header->sync = temp & 0xFF;
-    if ( header->sync == 0xFF )
-    {
-        temp = temp_pBuf1[1];
-        header->sync = temp & 0xC0;
-        if ( header->sync != 0xC0 )
-        {
-            DEBUG_PRINT("parse_mp3_frameheader failure");
-            return OMX_ErrorMax;
-        }
-    }
-    else
-    {
-        DEBUG_PRINT("parse_mp3_frameheader failure");
-        return OMX_ErrorMax;
-    }
-    temp = temp_pBuf1[1];
-    header->version = (temp & 0x18)>>3;
-    header->Layer = (temp & 0x06)>>1;
-    temp = temp_pBuf1[2];
-    header->sampling_rate = (temp & 0x0C)>>2;
-    temp = temp_pBuf1[3];
-    header->channel_mode = (temp & 0xC0)>>6;
-
-    DEBUG_PRINT("Channel Mode: %u, Sampling rate: %u and header version: %u from the header\n",
-                (unsigned)(header->channel_mode),(unsigned) (header->sampling_rate),(unsigned)( header->version));
-    // Stereo, Joint Stereo,Dual Mono)
-    if ( (header->channel_mode == 0)||(header->channel_mode == 1)||(header->channel_mode == 2) )
-    {
-        header->channel_mode = 2;  // stereo
-    }
-    else if ( header->channel_mode == 3 )
-    {
-        header->channel_mode = 1; // for all other cases configuring as mono TBD
-    }
-    else
-    {
-        header->channel_mode = 2; // if the channel is not recog. making the channel by default to Stereo.
-        DEBUG_PRINT("Defauting the channel mode to Stereo");
-    }
-    header->sampling_rate = mp3_frequency_index[header->sampling_rate][header->version];
-    DEBUG_PRINT(" frequency = %u, channels = %u\n",(unsigned)(header->sampling_rate),(unsigned)(header->channel_mode));
-    return OMX_ErrorNone;
-}
-
-
-static OMX_ERRORTYPE Allocate_Buffer ( struct adec_appdata* adec_appdata,
-                                       OMX_U32 nPortIndex )
-{
-   OMX_BUFFERHEADERTYPE  ***pBufHdrs = NULL;
-   OMX_BUFFERHEADERTYPE *bufHdr = NULL;
-   struct msm_audio_pmem_info pmem_info;
-   DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-   OMX_ERRORTYPE error=OMX_ErrorNone;
-   long bufCnt=0;
-   long bufCntMin = 0;
-   long bufSize = 0;
-
-   if(!adec_appdata || !adec_appdata->mp3_dec_handle)
-   {
-       DEBUG_PRINT("\nAllocate_Buffer:Invalid i/p parameter\n");
-       return OMX_ErrorBadParameter;
-   }
-
-   if(nPortIndex == 0)
-   {
-       pBufHdrs = &adec_appdata->pInputBufHdrs;
-       bufCntMin = adec_appdata->input_buf_cnt;
-       bufSize = adec_appdata->inputportFmt.nBufferSize;
-   }
-   else if(nPortIndex == 1)
-   {
-       pBufHdrs = &adec_appdata->pOutputBufHdrs;
-       bufCntMin = adec_appdata->output_buf_cnt;
-       bufSize = adec_appdata->outputportFmt.nBufferSize;
-   }
-   else
-   {
-       DEBUG_PRINT("\nAllocate_Buffer:Invalid PortIndex\n");
-       return OMX_ErrorBadPortIndex;
-   }
-
-   *pBufHdrs= (OMX_BUFFERHEADERTYPE **)
-                   malloc(sizeof(OMX_BUFFERHEADERTYPE*)*bufCntMin);
-
-   if(*pBufHdrs == NULL)
-   {
-       DEBUG_PRINT ("\nAllocate_Buffer: *pBufHdrs allocation failed!\n");
-       return OMX_ErrorInsufficientResources;
-   }
-
-   for(bufCnt=0; bufCnt < bufCntMin; ++bufCnt) {
-      DEBUG_PRINT("\n OMX_AllocateBuffer No %ld \n", bufCnt);
-      error = OMX_AllocateBuffer(adec_appdata->mp3_dec_handle, &((*pBufHdrs)[bufCnt]),
-                                   nPortIndex, NULL, bufSize);
-
-      if(error != OMX_ErrorNone)
-      {
-          DEBUG_PRINT("\nOMX_AllocateBuffer ERROR\n");
-          break;
-      }
-
-#ifdef PCM_PLAYBACK
-      if(adec_appdata->pcmplayback == 1 && adec_appdata->pcm_device_type == PCM_DEC_DEVICE)
-      {
-         if(nPortIndex == 1)
-         {
-             bufHdr = (*pBufHdrs)[bufCnt];
-
-             if(bufHdr)
-             {
-                  pmem_info.fd = (int)bufHdr->pOutputPortPrivate;
-                  pmem_info.vaddr = bufHdr->pBuffer;
-
-                  DEBUG_PRINT ("\n PCMDEC REGISTER_PMEM fd = %d, vaddr = %x",
-                      pmem_info.fd,(unsigned) (pmem_info.vaddr));
-                  if(0 > ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_REGISTER_PMEM, &pmem_info))
-                  {
-                      DEBUG_PRINT("\n Error in ioctl AUDIO_REGISTER_PMEM\n");
-                      error = OMX_ErrorHardware;
-                      break;
-                  }
-              }
-              else
-              {
-                  DEBUG_PRINT("\nbufHdr is NULL, couldnt REGISTER PMEM\n");
-                  error = OMX_ErrorUndefined;
-                  break;
-              }
-          }
-      }
-#endif
-
-   }
-
-   if(error != OMX_ErrorNone && bufCnt < bufCntMin)
-   {
-       while(bufCnt)
-       {
-            bufCnt--;
-            bufHdr = (*pBufHdrs)[bufCnt];
-            Free_Buffer(adec_appdata, nPortIndex, bufHdr);
-       }
-       free(*pBufHdrs);
-       *pBufHdrs = NULL;
-   }
-
-   return error;
-}
-
-static OMX_ERRORTYPE Use_Buffer ( struct adec_appdata* adec_appdata,
-                                  OMX_U32 nPortIndex )
-{
-    OMX_BUFFERHEADERTYPE  ***pBufHdrs = NULL;
-    OMX_BUFFERHEADERTYPE *bufHdr = NULL;
-    OMX_U8 *buffer = NULL;
-    struct msm_audio_pmem_info pmem_info;
-    OMX_ERRORTYPE error = OMX_ErrorNone;
-    long bufCnt = 0;
-    long bufCntMin = 0;
-    long bufSize = 0;
-    int pmem_fd = -1;
-
-    if(!adec_appdata || !adec_appdata->mp3_dec_handle)
-    {
-       DEBUG_PRINT("\nUse_Buffer:Invalid i/p parameter\n");
-       return OMX_ErrorBadParameter;
-    }
-
-    if(nPortIndex == 0)
-    {
-       pBufHdrs = &adec_appdata->pInputBufHdrs;
-       bufCntMin = adec_appdata->input_buf_cnt;
-       bufSize = adec_appdata->inputportFmt.nBufferSize;
-    }
-    else if(nPortIndex == 1)
-    {
-       pBufHdrs = &adec_appdata->pOutputBufHdrs;
-       bufCntMin = adec_appdata->output_buf_cnt;
-       bufSize = adec_appdata->outputportFmt.nBufferSize;
-    }
-    else
-    {
-        DEBUG_PRINT("\nUse_Buffer:Invalid PortIndex\n");
-        return OMX_ErrorBadPortIndex;
-    }
-
-    DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-    *pBufHdrs = (OMX_BUFFERHEADERTYPE **)calloc
-        (sizeof(OMX_BUFFERHEADERTYPE*)*bufCntMin, 1);
-
-    if(*pBufHdrs == NULL)
-    {
-        DEBUG_PRINT ("\nUse_Buffer: *pBufHdrs allocation failed!\n");
-        return OMX_ErrorInsufficientResources;
-    }
-
-    DEBUG_PRINT("\nUse_Buffer::*pBufHdrs = %p", *pBufHdrs);
-    for(bufCnt = 0; bufCnt < bufCntMin; ++bufCnt)
-    {
-        pmem_fd = open("/dev/pmem_adsp", O_RDWR);
-
-        if (pmem_fd < 0)
-        {
-            DEBUG_PRINT ("\n pmem_adsp open failed");
-            error = OMX_ErrorInsufficientResources;
-            break;
-        }
-
-        DEBUG_PRINT("\nUse_Buffer:: For Buffer %ld, pmem_fd = %d \n", bufCnt,
-           pmem_fd);
-
-        /* Map the PMEM file descriptor into current process address space */
-        buffer = (OMX_U8*) mmap( NULL,
-                                 bufSize,
-                                 PROT_READ | PROT_WRITE,
-                                 MAP_SHARED,
-                                 pmem_fd,
-                                 0
-                                );
-
-        if(MAP_FAILED == buffer)
-        {
-            DEBUG_PRINT ("\n mmap() failed");
-            buffer = NULL;
-            close(pmem_fd);
-            error = OMX_ErrorInsufficientResources;
-            break;
-        }
-
-        DEBUG_PRINT("\n Use_Buffer::Client Buf = %p", buffer);
-        DEBUG_PRINT("\n OMX_UseBuffer No %ld \n", bufCnt);
-        error = OMX_UseBuffer( adec_appdata->mp3_dec_handle, &((*pBufHdrs)[bufCnt]),
-                               nPortIndex, (void*)pmem_fd, bufSize, buffer
-                              );
-        DEBUG_PRINT("\nUse_Buffer::Buf ret = %p", (*pBufHdrs)[bufCnt]);
-
-        if(error != OMX_ErrorNone)
-        {
-            DEBUG_PRINT("\nOMX_AllocateBuffer ERROR\n");
-            munmap(buffer, bufSize);
-            buffer = NULL;
-            close(pmem_fd);
-            break;
-        }
-
-#ifdef PCM_PLAYBACK
-      if(adec_appdata->pcmplayback == 1 && adec_appdata->pcm_device_type == PCM_DEC_DEVICE)
-      {
-          if(nPortIndex == 1)
-          {
-              bufHdr = (*pBufHdrs)[bufCnt];
-              if(bufHdr)
-              {
-                  pmem_info.fd = pmem_fd;
-                  pmem_info.vaddr = buffer;
-                  DEBUG_PRINT ("\n PCMDEC REGISTER_PMEM fd = %d, vaddr = %x",
-                      pmem_info.fd, (unsigned)(pmem_info.vaddr));
-                  if(0 > ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_REGISTER_PMEM, &pmem_info))
-                  {
-                      DEBUG_PRINT("\n Error in ioctl AUDIO_REGISTER_PMEM\n");
-                      error = OMX_ErrorHardware;
-                      break;
-                  }
-              }
-              else
-              {
-                  DEBUG_PRINT("\nbufHdr is NULL, couldnt REGISTER PMEM\n");
-                  error = OMX_ErrorUndefined;
-                  break;
-              }
-          }
-      }
-#endif
-
-    }
-
-    if(error != OMX_ErrorNone && bufCnt != bufCntMin)
-    {
-        while(bufCnt)
-        {
-            bufCnt--;
-            bufHdr = (*pBufHdrs)[bufCnt];
-            Free_Buffer(adec_appdata, nPortIndex, bufHdr);
-        }
-        free(*pBufHdrs);
-        *pBufHdrs = NULL;
-    }
-
-    return error;
-}
-
-static OMX_ERRORTYPE Free_Buffer ( struct adec_appdata* adec_appdata,
-                                   OMX_U32 nPortIndex,
-                                   OMX_BUFFERHEADERTYPE *bufHdr
-                                  )
-{
-    struct msm_audio_pmem_info audio_pmem_buf;
-    OMX_ERRORTYPE error = OMX_ErrorNone;
-    int pmem_fd = -1;
-
-    if(!adec_appdata || !adec_appdata->mp3_dec_handle || !bufHdr
-        || (nPortIndex > 1))
-    {
-       DEBUG_PRINT("\nFree_Buffer:Invalid i/p parameters\n");
-       return OMX_ErrorBadParameter;
-    }
-
-    DEBUG_PRINT("\nFree_Buffer::bufHdr = %p", bufHdr);
-    if(adec_appdata->buffer_option == USE_BUFFER_CASE)
-    {
-        pmem_fd = (int)bufHdr->pAppPrivate;
-    }
-    else
-    {
-        if(nPortIndex == 1)
-        {
-            pmem_fd = (int)bufHdr->pOutputPortPrivate;
-        }
-    }
-
-#ifdef PCM_PLAYBACK
-    if(adec_appdata->pcmplayback && adec_appdata->pcm_device_type == PCM_DEC_DEVICE)
-    {
-        if(nPortIndex == 1 && pmem_fd > 0)
-        {
-            audio_pmem_buf.fd = pmem_fd;
-            audio_pmem_buf.vaddr = bufHdr->pBuffer;
-            DEBUG_PRINT ("\n PCMDEC DEREGISTER_PMEM fd = %d, vaddr = %x",
-                audio_pmem_buf.fd,(unsigned)( audio_pmem_buf.vaddr));
-            if(0 > ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_DEREGISTER_PMEM, &audio_pmem_buf))
-            {
-                DEBUG_PRINT("\n Error in ioctl AUDIO_DEREGISTER_PMEM\n");
-                error = OMX_ErrorHardware;
-            }
-        }
-    }
-#endif
-
-    if(adec_appdata->buffer_option == USE_BUFFER_CASE)
-    {
-        if (bufHdr->pBuffer &&
-            (EINVAL == munmap (bufHdr->pBuffer, bufHdr->nAllocLen)))
-        {
-            DEBUG_PRINT ("\n Error in Unmapping the buffer %p",
-              bufHdr);
-        }
-        bufHdr->pBuffer = NULL;
-        close(pmem_fd);
-        DEBUG_PRINT("FREED CLIENT BUFHDR[%p], pmem_fd[%d]", bufHdr, pmem_fd);
-    }
-    return(OMX_FreeBuffer(adec_appdata->mp3_dec_handle, nPortIndex, bufHdr));
-}
-
-static int Read_Buffer (OMX_BUFFERHEADERTYPE  *pBufHdr,FILE* inputBufferFile)
-{
-   int bytes_read=0;
-
-   pBufHdr->nFilledLen = 0;
-   pBufHdr->nFlags |= OMX_BUFFERFLAG_EOS;
-
-   bytes_read = fread(pBufHdr->pBuffer, 1, pBufHdr->nAllocLen , inputBufferFile);
-   DEBUG_PRINT ("\nBytes read :%d\n",bytes_read);
-   pBufHdr->nFilledLen = bytes_read;
-   if(bytes_read == 0) {
-      pBufHdr->nFlags |= OMX_BUFFERFLAG_EOS;
-      DEBUG_PRINT ("\nBytes read zero\n");
-   }
-   else {
-      pBufHdr->nFlags &= ~OMX_BUFFERFLAG_EOS;
-      DEBUG_PRINT ("\nBytes read is Non zero\n");
-   }
-
-   return bytes_read;;
-}
-
-static int open_audio_file (struct adec_appdata* adec_appdata)
-{
-   int error_code = 0;
-   struct wav_header hdr;
-   int header_len = 0;
-   memset(&hdr,0,sizeof(hdr));
-
-   hdr.riff_id = ID_RIFF;
-   hdr.riff_sz = 0;
-   hdr.riff_fmt = ID_WAVE;
-   hdr.fmt_id = ID_FMT;
-   hdr.fmt_sz = 16;
-   hdr.audio_format = FORMAT_PCM;
-   hdr.num_channels = 2; // Will be updated in the end
-   hdr.sample_rate = 44100; // Will be updated in the end
-   hdr.byte_rate = hdr.sample_rate * hdr.num_channels * 2;
-   hdr.block_align = hdr.num_channels * 2;
-   hdr.bits_per_sample = 16;
-   hdr.data_id = ID_DATA;
-   hdr.data_sz = 0;
-
-   DEBUG_PRINT("Inside %s filename=%s\n", __FUNCTION__, adec_appdata->in_filename);
-   adec_appdata->inputBufferFile = fopen (adec_appdata->in_filename, "rb");
-   if (adec_appdata->inputBufferFile == NULL) {
-      DEBUG_PRINT("\ni/p file %s could NOT be opened\n",
-                     adec_appdata->in_filename);
-      error_code = -1;
-   }
-
-   if((adec_appdata->tunnel == 0) && (adec_appdata->filewrite == 1)) {
-      DEBUG_PRINT("output file is opened\n");
-      adec_appdata->outputBufferFile = fopen(adec_appdata->out_filename,"wb");
-      if (adec_appdata->outputBufferFile == NULL) {
-         DEBUG_PRINT("\no/p file %s could NOT be opened\n",
-                       adec_appdata->out_filename);
-         error_code = -1;
-         return error_code;
-      }
-
-      header_len = fwrite(&hdr,1,sizeof(hdr),adec_appdata->outputBufferFile);
-
-      if (header_len <= 0) {
-         DEBUG_PRINT("Invalid Wav header \n");
-      }
-      DEBUG_PRINT(" Length og wav header is %d \n",header_len );
-   }
-   return error_code;
-}
-
-void process_portreconfig(struct adec_appdata* adec_appdata)
-{
-         int bufCnt,i=0;
-         OMX_ERRORTYPE ret;
-         struct msm_audio_config drv_pcm_config;
-
-         unsigned int len=0;
-         hpcm_info ftb;
-         ftb.msg_type = CTRL;
-         ftb.hComponent = NULL;
-         ftb.bufHdr = NULL;
-
-         DEBUG_PRINT("************************************");
-         DEBUG_PRINT("RECIEVED EVENT PORT SETTINGS CHANGED EVENT\n");
-         DEBUG_PRINT("******************************************\n");
-         if(adec_appdata->start_done)
-         sleep(1);
-         len= write(adec_appdata->mp3_hpcm.pipe_out,&ftb,sizeof(hpcm_info));
-         wait_for_event(adec_appdata);
-         DEBUG_PRINT("*PORT SETTINGS CHANGED: FLUSHCOMMAND TO COMPONENT*******\n");
-         adec_appdata->flushinprogress = 1;
-         OMX_SendCommand(adec_appdata->mp3_dec_handle, OMX_CommandFlush, 1, NULL);
-         wait_for_event(adec_appdata);  // output port
-
-         // Send DISABLE command
-        OMX_SendCommand(adec_appdata->mp3_dec_handle, OMX_CommandPortDisable, 1, 0);
-        DEBUG_PRINT("******************************************\n");
-        DEBUG_PRINT("FREEING BUFFERS output_buf_cnt=%d\n",adec_appdata->output_buf_cnt);
-        DEBUG_PRINT("******************************************\n");
-
-         // Free output Buffer
-         for(bufCnt=0; bufCnt < adec_appdata->output_buf_cnt; ++bufCnt) {
-             Free_Buffer(adec_appdata, 1, adec_appdata->pOutputBufHdrs[bufCnt]);
-         }
-
-         free(adec_appdata->pOutputBufHdrs);
-         adec_appdata->pOutputBufHdrs = NULL;
-         // wait for Disable event to come back
-         wait_for_event(adec_appdata);
-         DEBUG_PRINT("******************************************\n");
-         DEBUG_PRINT("DISABLE EVENT RECD\n");
-         DEBUG_PRINT("******************************************\n");
-
-         // Send Enable command
-         OMX_SendCommand(adec_appdata->mp3_dec_handle, OMX_CommandPortEnable, 1, 0);
-
-         adec_appdata->flushinprogress = 0;
-
-         // AllocateBuffers
-         DEBUG_PRINT("******************************************\n");
-         DEBUG_PRINT("ALLOC BUFFER AFTER PORT REENABLE");
-         DEBUG_PRINT("******************************************\n");
-
-         if(adec_appdata->buffer_option == USE_BUFFER_CASE)
-         {
-
-             /* Use buffer on decoder's o/p port */
-             adec_appdata->error = Use_Buffer(adec_appdata,
-                 adec_appdata->outputportFmt.nPortIndex);
-             if (adec_appdata->error != OMX_ErrorNone)
-             {
-                 DEBUG_PRINT ("\nOMX_UseBuffer Output buffer error\n");
-                 return;
-             }
-             else
-             {
-                 DEBUG_PRINT ("\nOMX_UseBuffer Output buffer success\n");
-             }
-         }
-         else
-         {
-             /* Allocate buffer on decoder's o/p port */
-             adec_appdata->error = Allocate_Buffer(adec_appdata,
-                 adec_appdata->outputportFmt.nPortIndex);
-             if (adec_appdata->error != OMX_ErrorNone) {
-               DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer error output_buf_cnt=%d\n",adec_appdata->output_buf_cnt);
-               return;
-             }
-             else {
-               DEBUG_PRINT ("\nOMX_AllocateBuffer Output buffer success output_buf_cnt=%d\n",adec_appdata->output_buf_cnt);
-             }
-         }
-
-         DEBUG_PRINT("******************************************\n");
-         DEBUG_PRINT("ENABLE EVENTiHANDLER RECD\n");
-         DEBUG_PRINT("******************************************\n");
-         // wait for enable event to come back
-         wait_for_event(adec_appdata);
-         if(adec_appdata->pcmplayback && adec_appdata->pcm_device_type == HOST_PCM_DEVICE
-                && adec_appdata->start_done)
-
-         {
-            DEBUG_PRINT(" Calling fsync on pcm driver...\n");
-            while (fsync(adec_appdata->m_pcmdrv_fd) < 0) {
-            printf(" fsync failed\n");
-            sleep(1);
-         }
-         DEBUG_PRINT(" Calling stop on pcm driver...\n");
-         ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_STOP, 0);
-          DEBUG_PRINT(" Calling flush on pcm driver...\n");
-         ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_FLUSH, 0);
-         sleep(3);
-         OMX_GetParameter(adec_appdata->mp3_dec_handle,OMX_IndexParamAudioMp3,&adec_appdata->mp3param);
-         drv_pcm_config.sample_rate = adec_appdata->mp3param.nSampleRate;
-         drv_pcm_config.channel_count =adec_appdata-> mp3param.nChannels;
-         printf("sample =%lu channel = %lu\n",adec_appdata->mp3param.nSampleRate,adec_appdata->mp3param.nChannels);
-         ioctl(adec_appdata->m_pcmdrv_fd, AUDIO_SET_CONFIG, &drv_pcm_config);
-
-
-         DEBUG_PRINT("Configure Driver for PCM playback \n");
-         adec_appdata->start_done = 0;
-         adec_appdata->bReconfigureOutputPort = 0;
-         }
-         DEBUG_PRINT("******************************************\n");
-         DEBUG_PRINT("FTB after PORT RENABLE\n");
-         DEBUG_PRINT("******************************************\n");
-         for(i=0; i < adec_appdata->output_buf_cnt; i++) {
-           DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
-           adec_appdata->pOutputBufHdrs[i]->nOutputPortIndex = 1;
-           adec_appdata->pOutputBufHdrs[i]->nFlags &= ~OMX_BUFFERFLAG_EOS;
-           ret = OMX_FillThisBuffer(adec_appdata->mp3_dec_handle, adec_appdata->pOutputBufHdrs[i]);
-           if (OMX_ErrorNone != ret) {
-             DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
-           }
-           else {
-             DEBUG_PRINT("OMX_FillThisBuffer success!\n");
-           }
-        }
-}
-
-void write_devctlcmd(int fd, const void *buf, int param){
-	int nbytes, nbytesWritten;
-	char cmdstr[128];
-	snprintf(cmdstr, 128, "%s%d\n", (char *)buf, param);
-	nbytes = strlen(cmdstr);
-	nbytesWritten = write(fd, cmdstr, nbytes);
-
-	if(nbytes != nbytesWritten)
-		printf("Failed to write string \"%s\" to omx_devmgr\n", cmdstr);
-}
-
-
diff --git a/mm-audio/aenc-aac/Android.mk b/mm-audio/aenc-aac/Android.mk
index 7cd804a..cb582ff 100644
--- a/mm-audio/aenc-aac/Android.mk
+++ b/mm-audio/aenc-aac/Android.mk
@@ -1,4 +1,4 @@
-ifeq ($(TARGET_ARCH),arm)
+ifneq ($(filter arm aarch64 arm64, $(TARGET_ARCH)),)
 
 
 AENC_AAC_PATH:= $(call my-dir)
@@ -27,5 +27,8 @@
 ifeq ($(call is-board-platform,msm8916),true)
 include $(AENC_AAC_PATH)/qdsp6/Android.mk
 endif
+ifeq ($(call is-board-platform,msm8994),true)
+include $(AENC_AAC_PATH)/qdsp6/Android.mk
+endif
 
 endif
diff --git a/mm-audio/aenc-aac/qdsp6/Android.mk b/mm-audio/aenc-aac/qdsp6/Android.mk
index e339f5d..ac9e0cc 100644
--- a/mm-audio/aenc-aac/qdsp6/Android.mk
+++ b/mm-audio/aenc-aac/qdsp6/Android.mk
@@ -13,6 +13,7 @@
 libOmxAacEnc-def += -D_ENABLE_QC_MSG_LOG_
 libOmxAacEnc-def += -DVERBOSE
 libOmxAacEnc-def += -D_DEBUG
+libOmxAacEnc-def += -Wconversion
 ifeq ($(strip $(TARGET_USES_QCOM_MM_AUDIO)),true)
 libOmxAacEnc-def += -DAUDIOV2
 endif
diff --git a/mm-audio/aenc-aac/qdsp6/inc/omx_aac_aenc.h b/mm-audio/aenc-aac/qdsp6/inc/omx_aac_aenc.h
index 623caa8..f3d9547 100644
--- a/mm-audio/aenc-aac/qdsp6/inc/omx_aac_aenc.h
+++ b/mm-audio/aenc-aac/qdsp6/inc/omx_aac_aenc.h
@@ -81,10 +81,10 @@
 
 
 #define PrintFrameHdr(i,bufHdr) \
-                           DEBUG_PRINT("i=%d OMX bufHdr[%x]buf[%x]size[%d]TS[%lld]nFlags[0x%x]\n",\
+                           DEBUG_PRINT("i=%d OMX bufHdr[%p]buf[%p]size[%d]TS[%lld]nFlags[0x%x]\n",\
                            i,\
-                           (unsigned) bufHdr,                                     \
-                           (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,   \
+                           bufHdr,                                     \
+                           ((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,   \
                            (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFilledLen,\
                            ((OMX_BUFFERHEADERTYPE *)bufHdr)->nTimeStamp, \
                            (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFlags)
@@ -314,7 +314,7 @@
                                 void *                  eglImage);
 
     bool post_command(unsigned int p1, unsigned int p2,
-        unsigned int id);
+        unsigned char id);
 
     // Deferred callback identifiers
     enum
@@ -376,9 +376,9 @@
 
     struct omx_event
     {
-        unsigned param1;
-        unsigned param2;
-        unsigned id;
+        unsigned long param1;
+        unsigned long param2;
+        unsigned char id;
     };
 
     struct omx_cmd_queue
@@ -390,16 +390,16 @@
 
         omx_cmd_queue();
         ~omx_cmd_queue();
-        bool insert_entry(unsigned p1, unsigned p2, unsigned id);
-        bool pop_entry(unsigned *p1,unsigned *p2, unsigned *id);
-        bool get_msg_id(unsigned *id);
+        bool insert_entry(unsigned long p1, unsigned long p2, unsigned char id);
+        bool pop_entry(unsigned long *p1,unsigned long *p2, unsigned char *id);
+        bool get_msg_id(unsigned char *id);
         bool get_msg_with_id(unsigned *p1,unsigned *p2, unsigned id);
     };
 
     typedef struct TIMESTAMP
     {
-        unsigned long LowPart;
-        unsigned long HighPart;
+        unsigned int LowPart;
+        unsigned int HighPart;
     }__attribute__((packed)) TIMESTAMP;
 
     typedef struct metadata_input
@@ -423,7 +423,7 @@
     {
         OMX_U32 tot_in_buf_len;
         OMX_U32 tot_out_buf_len;
-        OMX_U32 tot_pb_time;
+        OMX_TICKS tot_pb_time;
         OMX_U32 fbd_cnt;
         OMX_U32 ftb_cnt;
         OMX_U32 etb_cnt;
@@ -588,11 +588,11 @@
 
     bool search_output_bufhdr(OMX_BUFFERHEADERTYPE *buffer);
 
-    bool post_input(unsigned int p1, unsigned int p2,
-                    unsigned int id);
+    bool post_input(unsigned long p1, unsigned long p2,
+                    unsigned char id);
 
-    bool post_output(unsigned int p1, unsigned int p2,
-                     unsigned int id);
+    bool post_output(unsigned long p1, unsigned long p2,
+                     unsigned char id);
 
     void process_events(omx_aac_aenc *client_data);
 
diff --git a/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp b/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp
index 6521265..c918268 100644
--- a/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp
+++ b/mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp
@@ -58,9 +58,9 @@
 }
 
 // omx cmd queue insert
-bool omx_aac_aenc::omx_cmd_queue::insert_entry(unsigned p1,
-                                                unsigned p2,
-                                                unsigned id)
+bool omx_aac_aenc::omx_cmd_queue::insert_entry(unsigned long p1,
+                                                unsigned long p2,
+                                                unsigned char id)
 {
     bool ret = true;
     if (m_size < OMX_CORE_CONTROL_CMDQ_SIZE)
@@ -82,8 +82,8 @@
     return ret;
 }
 
-bool omx_aac_aenc::omx_cmd_queue::pop_entry(unsigned *p1,
-                                             unsigned *p2, unsigned *id)
+bool omx_aac_aenc::omx_cmd_queue::pop_entry(unsigned long *p1,
+                                             unsigned long *p2, unsigned char *id)
 {
     bool ret = true;
     if (m_size > 0)
@@ -112,7 +112,7 @@
 {
     return(new omx_aac_aenc);
 }
-bool omx_aac_aenc::omx_cmd_queue::get_msg_id(unsigned *id)
+bool omx_aac_aenc::omx_cmd_queue::get_msg_id(unsigned char *id)
 {
    if(m_size > 0)
    {
@@ -260,6 +260,7 @@
         adif_flag(0),
         mp4ff_flag(0),
         m_app_data(NULL),
+        nNumOutputBuf(0),
         m_drv_fd(-1),
         bFlushinprogress(0),
         is_in_th_sleep(false),
@@ -272,8 +273,9 @@
         m_out_act_buf_count (OMX_CORE_NUM_OUTPUT_BUFFERS),
         m_inp_current_buf_count(0),
         m_out_current_buf_count(0),
-        output_buffer_size(OMX_AAC_OUTPUT_BUFFER_SIZE),
+        output_buffer_size((OMX_U32)OMX_AAC_OUTPUT_BUFFER_SIZE),
         input_buffer_size(OMX_CORE_INPUT_BUFFER_SIZE),
+        m_session_id(0),
         m_inp_bEnabled(OMX_TRUE),
         m_out_bEnabled(OMX_TRUE),
         m_inp_bPopulated(OMX_FALSE),
@@ -282,9 +284,7 @@
         m_state(OMX_StateInvalid),
         m_ipc_to_in_th(NULL),
         m_ipc_to_out_th(NULL),
-        m_ipc_to_cmd_th(NULL),
-        nNumOutputBuf(0),
-        m_session_id(0)
+        m_ipc_to_cmd_th(NULL)
 {
     int cond_ret = 0;
     component_Role.nSize = 0;
@@ -505,13 +505,13 @@
         m_aac_pb_stats.fbd_cnt++;
         pthread_mutex_lock(&out_buf_count_lock);
         nNumOutputBuf--;
-        DEBUG_PRINT("FBD CB:: nNumOutputBuf=%d out_buf_len=%lu fbd_cnt=%lu\n",\
+        DEBUG_PRINT("FBD CB:: nNumOutputBuf=%d out_buf_len=%u fbd_cnt=%u\n",\
                     nNumOutputBuf,
                     m_aac_pb_stats.tot_out_buf_len,
                     m_aac_pb_stats.fbd_cnt);
         m_aac_pb_stats.tot_out_buf_len += bufHdr->nFilledLen;
         m_aac_pb_stats.tot_pb_time     = bufHdr->nTimeStamp;
-        DEBUG_PRINT("FBD:in_buf_len=%lu out_buf_len=%lu\n",
+        DEBUG_PRINT("FBD:in_buf_len=%u out_buf_len=%u\n",
                     m_aac_pb_stats.tot_in_buf_len,
                     m_aac_pb_stats.tot_out_buf_len);
         pthread_mutex_unlock(&out_buf_count_lock);
@@ -544,9 +544,9 @@
 =============================================================================*/
 void omx_aac_aenc::process_out_port_msg(void *client_data, unsigned char id)
 {
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize     = 0;                 // qsize
     unsigned      tot_qsize = 0;
     omx_aac_aenc  *pThis    = (omx_aac_aenc *) client_data;
@@ -749,9 +749,9 @@
 =============================================================================*/
 void omx_aac_aenc::process_command_msg(void *client_data, unsigned char id)
 {
-    unsigned     p1;                             // Parameter - 1
-    unsigned     p2;                             // Parameter - 2
-    unsigned     ident;
+    unsigned long p1 = 0;                             // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned     qsize  = 0;
     omx_aac_aenc *pThis = (omx_aac_aenc*)client_data;
     pthread_mutex_lock(&pThis->m_commandlock);
@@ -823,15 +823,15 @@
                 pThis->m_cb.EventHandler(&pThis->m_cmp,
                                          pThis->m_app_data,
                                          OMX_EventError,
-                                         p2,
-                                         NULL,
-                                         NULL );
+                                         (OMX_U32)p2,
+                                         0,
+                                         0);
             } else
             {
                 pThis->m_cb.EventHandler(&pThis->m_cmp,
                                          pThis->m_app_data,
                                          OMX_EventCmdComplete,
-                                         p1, p2, NULL );
+                                         (OMX_U32)p1, (OMX_U32)p2, NULL );
             }
         } else
         {
@@ -879,9 +879,9 @@
 =============================================================================*/
 void omx_aac_aenc::process_in_port_msg(void *client_data, unsigned char id)
 {
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize     = 0;
     unsigned      tot_qsize = 0;
     omx_aac_aenc  *pThis    = (omx_aac_aenc *) client_data;
@@ -1059,14 +1059,14 @@
     randomly assign the value right now. Query will result in
     incorrect param */
     memset(&m_aac_param, 0, sizeof(m_aac_param));
-    m_aac_param.nSize = sizeof(m_aac_param);
+    m_aac_param.nSize = (OMX_U32)sizeof(m_aac_param);
     m_aac_param.nChannels = DEFAULT_CH_CFG;
     m_aac_param.nSampleRate = DEFAULT_SF;
     m_aac_param.nBitRate = DEFAULT_BITRATE;
     m_volume = OMX_AAC_DEFAULT_VOL;             /* Close to unity gain */
     memset(&m_aac_pb_stats,0,sizeof(AAC_PB_STATS));
     memset(&m_pcm_param, 0, sizeof(m_pcm_param));
-    m_pcm_param.nSize = sizeof(m_pcm_param);
+    m_pcm_param.nSize = (OMX_U32)sizeof(m_pcm_param);
     m_pcm_param.nChannels = DEFAULT_CH_CFG;
     m_pcm_param.nSamplingRate = DEFAULT_SF;
 
@@ -1099,20 +1099,20 @@
     if (!strcmp(role,"OMX.qcom.audio.encoder.aac"))
     {
         pcm_input = 1;
-        component_Role.nSize = sizeof(role);
+        component_Role.nSize = (OMX_U32)sizeof(role);
         strlcpy((char *)component_Role.cRole, (const char*)role,
 		sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED \n", role);
     } else if (!strcmp(role,"OMX.qcom.audio.encoder.tunneled.aac"))
     {
         pcm_input = 0;
-        component_Role.nSize = sizeof(role);
+        component_Role.nSize = (OMX_U32)sizeof(role);
         strlcpy((char *)component_Role.cRole, (const char*)role,
 		sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED \n", role);
     } else
     {
-        component_Role.nSize = sizeof("\0");
+        component_Role.nSize = (OMX_U32)sizeof("\0");
         strlcpy((char *)component_Role.cRole, (const char*)"\0",
 		sizeof(component_Role.cRole));
         DEBUG_PRINT_ERROR("\ncomponent_init: Component %s LOADED is invalid\n",
@@ -1256,7 +1256,7 @@
 
     if(hComp == NULL)
     {
-        cmdData = NULL;
+        cmdData = cmdData;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -1270,7 +1270,7 @@
     }
     post_command((unsigned)cmd,(unsigned)param1,OMX_COMPONENT_GENERATE_COMMAND);
     DEBUG_PRINT("Send Command : returns with OMX_ErrorNone \n");
-    DEBUG_PRINT("send_command : recieved state before semwait= %lu\n",param1);
+    DEBUG_PRINT("send_command : recieved state before semwait= %u\n",param1);
     sem_wait (&sem_States);
     DEBUG_PRINT("send_command : recieved state after semwait\n");
     return OMX_ErrorNone;
@@ -1300,7 +1300,7 @@
 
     if(hComp == NULL)
     {
-        cmdData = NULL;
+        cmdData = cmdData;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -1440,7 +1440,7 @@
                 drv_aac_enc_config.sample_rate = m_aac_param.nSampleRate;
                 drv_aac_enc_config.bit_rate =
                 get_updated_bit_rate(m_aac_param.nBitRate);
-                DEBUG_PRINT("aac config %lu,%lu,%lu %d updated bitrate %d\n",
+                DEBUG_PRINT("aac config %u,%u,%u %d updated bitrate %d\n",
                             m_aac_param.nChannels,m_aac_param.nSampleRate,
 			    m_aac_param.nBitRate,m_aac_param.eAACStreamFormat,
                             drv_aac_enc_config.bit_rate);
@@ -1546,7 +1546,7 @@
                     pcm_cfg.sample_rate  =  m_pcm_param.nSamplingRate;
                     pcm_cfg.buffer_size =  input_buffer_size;
                     pcm_cfg.buffer_count =  m_inp_current_buf_count;
-                    DEBUG_PRINT("pcm config %lu %lu\n",m_pcm_param.nChannels,
+                    DEBUG_PRINT("pcm config %u %u\n",m_pcm_param.nChannels,
 				m_pcm_param.nSamplingRate);
 
                     if (ioctl(m_drv_fd, AUDIO_SET_CONFIG, &pcm_cfg) == -1)
@@ -1809,7 +1809,7 @@
     } else if (OMX_CommandFlush == cmd)
     {
         DEBUG_DETAIL("*************************\n");
-        DEBUG_PRINT("SCP-->RXED FLUSH COMMAND port=%lu\n",param1);
+        DEBUG_PRINT("SCP-->RXED FLUSH COMMAND port=%u\n",param1);
         DEBUG_DETAIL("*************************\n");
         bFlag = 0;
         if ( param1 == OMX_CORE_INPUT_PORT_INDEX ||
@@ -1848,7 +1848,7 @@
                 if (m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
                 {
                     DEBUG_PRINT("SCP: execute_omx_flush in Disable in "\
-                                " param1=%lu m_state=%d \n",param1, m_state);
+                                " param1=%u m_state=%d \n",param1, m_state);
                     execute_omx_flush(param1);
                 }
                 DEBUG_PRINT("send_command_proxy:OMX_CommandPortDisable:\
@@ -1880,7 +1880,7 @@
                 if (m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
                 {
                     DEBUG_PRINT("SCP: execute_omx_flush in Disable out "\
-                                "param1=%lu m_state=%d \n",param1, m_state);
+                                "param1=%u m_state=%d \n",param1, m_state);
                     execute_omx_flush(param1);
                 }
                 BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_DISABLE_PENDING);
@@ -1997,7 +1997,7 @@
 {
     bool bRet = true;
 
-    DEBUG_PRINT("Execute_omx_flush Port[%lu]", param1);
+    DEBUG_PRINT("Execute_omx_flush Port[%u]", param1);
     struct timespec abs_timeout;
     abs_timeout.tv_sec = 1;
     abs_timeout.tv_nsec = 0;
@@ -2046,7 +2046,7 @@
         DEBUG_DETAIL("WAITING FOR FLUSH ACK's param1=%d",param1);
         wait_for_event();
 
-        DEBUG_PRINT("RECIEVED BOTH FLUSH ACK's param1=%lu cmd_cmpl=%d",\
+        DEBUG_PRINT("RECIEVED BOTH FLUSH ACK's param1=%u cmd_cmpl=%d",\
                     param1,cmd_cmpl);
 
         // If not going to idle state, Send FLUSH complete message 
@@ -2160,7 +2160,7 @@
         DEBUG_DETAIL("RECIEVED FLUSH ACK FOR O/P PORT param1=%d",param1);
     } else
     {
-        DEBUG_PRINT("Invalid Port ID[%lu]",param1);
+        DEBUG_PRINT("Invalid Port ID[%u]",param1);
     }
     return bRet;
 }
@@ -2188,9 +2188,9 @@
 bool omx_aac_aenc::execute_input_omx_flush()
 {
     OMX_BUFFERHEADERTYPE *omx_buf;
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize=0;                       // qsize
     unsigned      tot_qsize=0;                   // qsize
 
@@ -2268,9 +2268,9 @@
 bool omx_aac_aenc::execute_output_omx_flush()
 {
     OMX_BUFFERHEADERTYPE *omx_buf;
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize=0;                       // qsize
     unsigned      tot_qsize=0;                   // qsize
 
@@ -2351,9 +2351,9 @@
 SIDE EFFECTS:
   None
 =============================================================================*/
-bool omx_aac_aenc::post_input(unsigned int p1,
-                               unsigned int p2,
-                               unsigned int id)
+bool omx_aac_aenc::post_input(unsigned long p1,
+                               unsigned long p2,
+                               unsigned char id)
 {
     bool bRet = false;
     pthread_mutex_lock(&m_lock);
@@ -2414,7 +2414,7 @@
 =============================================================================*/
 bool omx_aac_aenc::post_command(unsigned int p1,
                                  unsigned int p2,
-                                 unsigned int id)
+                                 unsigned char id)
 {
     bool bRet  = false;
 
@@ -2461,9 +2461,9 @@
 SIDE EFFECTS:
   None
 =============================================================================*/
-bool omx_aac_aenc::post_output(unsigned int p1,
-                                unsigned int p2,
-                                unsigned int id)
+bool omx_aac_aenc::post_output(unsigned long p1,
+                                unsigned long p2,
+                                unsigned char id)
 {
     bool bRet = false;
 
@@ -2527,7 +2527,7 @@
         return OMX_ErrorBadParameter;
     }
 
-    switch (paramIndex)
+    switch ((int)paramIndex)
     {
         case OMX_IndexParamPortDefinition:
             {
@@ -2535,11 +2535,11 @@
                 portDefn = (OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
 
                 DEBUG_PRINT("OMX_IndexParamPortDefinition " \
-                            "portDefn->nPortIndex = %lu\n",
+                            "portDefn->nPortIndex = %u\n",
 				portDefn->nPortIndex);
 
                 portDefn->nVersion.nVersion = OMX_SPEC_VERSION;
-                portDefn->nSize = sizeof(portDefn);
+                portDefn->nSize = (OMX_U32)sizeof(portDefn);
                 portDefn->eDomain    = OMX_PortDomainAudio;
 
                 if (0 == portDefn->nPortIndex)
@@ -2581,7 +2581,7 @@
                 DEBUG_PRINT("OMX_IndexParamAudioInit\n");
 
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 2;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2593,7 +2593,7 @@
                 (OMX_AUDIO_PARAM_PORTFORMATTYPE *) paramData;
                 DEBUG_PRINT("OMX_IndexParamAudioPortFormat\n");
                 portFormatType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portFormatType->nSize = sizeof(portFormatType);
+                portFormatType->nSize = (OMX_U32)sizeof(portFormatType);
 
                 if (OMX_CORE_INPUT_PORT_INDEX == portFormatType->nPortIndex)
                 {
@@ -2603,7 +2603,7 @@
 				portFormatType->nPortIndex)
                 {
                     DEBUG_PRINT("get_parameter: OMX_IndexParamAudioFormat: "\
-                                "%lu\n", portFormatType->nIndex);
+                                "%u\n", portFormatType->nIndex);
 
                     portFormatType->eEncoding = OMX_AUDIO_CodingAAC;
                 } else
@@ -2638,7 +2638,7 @@
     {
        QOMX_AUDIO_STREAM_INFO_DATA *streaminfoparam =
                (QOMX_AUDIO_STREAM_INFO_DATA *) paramData;
-       streaminfoparam->sessionId = m_session_id;
+       streaminfoparam->sessionId = (OMX_U8)m_session_id;
        break;
     }
 
@@ -2652,9 +2652,9 @@
                     memcpy(pcmparam,&m_pcm_param,\
                         sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
 
-                    DEBUG_PRINT("get_parameter: Sampling rate %lu",\
+                    DEBUG_PRINT("get_parameter: Sampling rate %u",\
                                  pcmparam->nSamplingRate);
-                    DEBUG_PRINT("get_parameter: Number of channels %lu",\
+                    DEBUG_PRINT("get_parameter: Number of channels %u",\
                                  pcmparam->nChannels);
                 } else
                 {
@@ -2679,7 +2679,7 @@
                     (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamVideoInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2689,7 +2689,7 @@
                 OMX_PRIORITYMGMTTYPE *priorityMgmtType =
                 (OMX_PRIORITYMGMTTYPE*)paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamPriorityMgmt\n");
-                priorityMgmtType->nSize = sizeof(priorityMgmtType);
+                priorityMgmtType->nSize = (OMX_U32)sizeof(priorityMgmtType);
                 priorityMgmtType->nVersion.nVersion = OMX_SPEC_VERSION;
                 priorityMgmtType->nGroupID = m_priority_mgm.nGroupID;
                 priorityMgmtType->nGroupPriority =
@@ -2702,7 +2702,7 @@
                 (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamImageInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2717,7 +2717,7 @@
                 DEBUG_PRINT("get_parameter: \
 				OMX_IndexParamCompBufferSupplier\n");
 
-                bufferSupplierType->nSize = sizeof(bufferSupplierType);
+                bufferSupplierType->nSize = (OMX_U32)sizeof(bufferSupplierType);
                 bufferSupplierType->nVersion.nVersion = OMX_SPEC_VERSION;
                 if (OMX_CORE_INPUT_PORT_INDEX   ==
 			bufferSupplierType->nPortIndex)
@@ -2746,7 +2746,7 @@
                     (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamOtherInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2854,7 +2854,7 @@
                     return OMX_ErrorIncorrectStateOperation;
                 }
                 DEBUG_PRINT("OMX_IndexParamPortDefinition portDefn->nPortIndex "
-                            "= %lu\n",portDefn->nPortIndex);
+                            "= %u\n",portDefn->nPortIndex);
                 if (OMX_CORE_INPUT_PORT_INDEX == portDefn->nPortIndex)
                 {
                     if ( portDefn->nBufferCountActual >
@@ -2898,10 +2898,10 @@
                 }
                 OMX_PRIORITYMGMTTYPE *priorityMgmtype
                 = (OMX_PRIORITYMGMTTYPE*) paramData;
-                DEBUG_PRINT("set_parameter: OMX_IndexParamPriorityMgmt %lu\n",
+                DEBUG_PRINT("set_parameter: OMX_IndexParamPriorityMgmt %u\n",
                             priorityMgmtype->nGroupID);
 
-                DEBUG_PRINT("set_parameter: priorityMgmtype %lu\n",
+                DEBUG_PRINT("set_parameter: priorityMgmtype %u\n",
                             priorityMgmtype->nGroupPriority);
 
                 m_priority_mgm.nGroupID = priorityMgmtype->nGroupID;
@@ -2923,7 +2923,7 @@
 				portFormatType->nPortIndex)
                 {
                     DEBUG_PRINT("set_parameter: OMX_IndexParamAudioFormat:"\
-                                " %lu\n", portFormatType->nIndex);
+                                " %u\n", portFormatType->nIndex);
                     portFormatType->eEncoding = OMX_AUDIO_CodingAAC;
                 } else
                 {
@@ -2953,7 +2953,7 @@
 				bufferSupplierType->eBufferSupplier;
                 } else
                 {
-                    DEBUG_PRINT_ERROR("set_param:IndexParamCompBufferSup \ 
+                    DEBUG_PRINT_ERROR("set_param:IndexParamCompBufferSup\
 					%08x\n", eRet);
                     eRet = OMX_ErrorBadPortIndex;
                 }
@@ -2972,7 +2972,7 @@
                     memcpy(&m_pcm_param,pcmparam,\
                         sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
 
-                    DEBUG_PRINT("set_pcm_parameter: %lu %lu",\
+                    DEBUG_PRINT("set_pcm_parameter: %u %u",\
                                 m_pcm_param.nChannels,
 				m_pcm_param.nSamplingRate);
                 } else
@@ -3050,7 +3050,7 @@
 
                 if (OMX_CORE_INPUT_PORT_INDEX == volume->nPortIndex)
                 {
-                    volume->nSize = sizeof(volume);
+                    volume->nSize = (OMX_U32)sizeof(volume);
                     volume->nVersion.nVersion = OMX_SPEC_VERSION;
                     volume->bLinear = OMX_TRUE;
                     volume->sVolume.nValue = m_volume;
@@ -3070,7 +3070,7 @@
 
                 if (OMX_CORE_INPUT_PORT_INDEX == mute->nPortIndex)
                 {
-                    mute->nSize = sizeof(mute);
+                    mute->nSize = (OMX_U32)sizeof(mute);
                     mute->nVersion.nVersion = OMX_SPEC_VERSION;
                     mute->bMute = (BITMASK_PRESENT(&m_flags,
                                       OMX_COMPONENT_MUTED)?OMX_TRUE:OMX_FALSE);
@@ -3278,8 +3278,8 @@
 
     if((hComp == NULL) || (peerComponent == NULL) || (tunnelSetup == NULL))
     {
-        port = 0;
-        peerPort = 0;
+        port = port;
+        peerPort = peerPort;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3319,7 +3319,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         free(buf_ptr);
         return OMX_ErrorBadParameter;
@@ -3332,7 +3332,7 @@
 
         bufHdr->pBuffer           = (OMX_U8 *)((buf_ptr) + sizeof(META_IN)+
                                                sizeof(OMX_BUFFERHEADERTYPE));
-        bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+        bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
         bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
         bufHdr->nAllocLen         = nBufSize;
         bufHdr->pAppPrivate       = appData;
@@ -3341,7 +3341,7 @@
 
         m_inp_current_buf_count++;
         DEBUG_PRINT("AIB:bufHdr %p bufHdr->pBuffer %p m_inp_buf_cnt=%d \
-		bytes=%lu",bufHdr, bufHdr->pBuffer,m_inp_current_buf_count,
+		bytes=%u",bufHdr, bufHdr->pBuffer,m_inp_current_buf_count,
 		bytes);
 
     } else
@@ -3373,7 +3373,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3390,7 +3390,7 @@
             bufHdr->pBuffer           = (OMX_U8 *)((buf_ptr)+
 					sizeof(OMX_BUFFERHEADERTYPE));
 
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             bufHdr->pAppPrivate       = appData;
@@ -3398,7 +3398,7 @@
             m_output_buf_hdrs.insert(bufHdr, NULL);
             m_out_current_buf_count++;
             DEBUG_PRINT("AOB::bufHdr %p bufHdr->pBuffer %p m_out_buf_cnt=%d "\
-                        "bytes=%lu",bufHdr, bufHdr->pBuffer,\
+                        "bytes=%u",bufHdr, bufHdr->pBuffer,\
                         m_out_current_buf_count, bytes);
         } else
         {
@@ -3612,7 +3612,7 @@
         }
     }
   }
-    DEBUG_PRINT("Use Buffer for port[%lu] eRet[%d]\n", port,eRet);
+    DEBUG_PRINT("Use Buffer for port[%u] eRet[%d]\n", port,eRet);
     return eRet;
 }
 /*=============================================================================
@@ -3655,7 +3655,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3677,8 +3677,8 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)(buffer);
             DEBUG_PRINT("use_input_buffer:bufHdr %p bufHdr->pBuffer %p \
-			bytes=%lu", bufHdr, bufHdr->pBuffer,bytes);
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+			bytes=%u", bufHdr, bufHdr->pBuffer,bytes);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             input_buffer_size         = nBufSize;
@@ -3740,7 +3740,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3766,8 +3766,8 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)(buffer);
             DEBUG_PRINT("use_output_buffer:bufHdr %p bufHdr->pBuffer %p \
-			len=%lu\n", bufHdr, bufHdr->pBuffer,bytes);
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+			len=%u\n", bufHdr, bufHdr->pBuffer,bytes);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             output_buffer_size        = nBufSize;
@@ -3866,7 +3866,7 @@
                (m_out_bEnabled == OMX_FALSE &&
 		port == OMX_CORE_OUTPUT_PORT_INDEX))
     {
-        DEBUG_PRINT("Free Buffer while port %lu disabled\n", port);
+        DEBUG_PRINT("Free Buffer while port %u disabled\n", port);
     } else if (m_state == OMX_StateExecuting || m_state == OMX_StatePause)
     {
         DEBUG_PRINT("Invalid state to free buffer,ports need to be disabled:\
@@ -3998,7 +3998,7 @@
 {
     OMX_ERRORTYPE eRet = OMX_ErrorNone;
 
-    DEBUG_PRINT("ETB:Buf:%p Len %lu TS %lld numInBuf=%d\n", \
+    DEBUG_PRINT("ETB:Buf:%p Len %u TS %lld numInBuf=%d\n", \
                 buffer, buffer->nFilledLen, buffer->nTimeStamp, (nNumInputBuf));
     if (m_state == OMX_StateInvalid)
     {
@@ -4036,11 +4036,11 @@
     {
         if (search_input_bufhdr(buffer) == true)
         {
-            post_input((unsigned)hComp,
-                       (unsigned) buffer,OMX_COMPONENT_GENERATE_ETB);
+            post_input((unsigned long)hComp,
+                       (unsigned long) buffer,OMX_COMPONENT_GENERATE_ETB);
         } else
         {
-            DEBUG_PRINT_ERROR("Bad header %x \n", (int)buffer);
+            DEBUG_PRINT_ERROR("Bad header %p \n", buffer);
             eRet = OMX_ErrorBadParameter;
         }
     }
@@ -4082,11 +4082,11 @@
         data = m_tmp_meta_buf;
 
         // copy the metadata info from the BufHdr and insert to payload
-        meta_in.offsetVal  = sizeof(META_IN);
+        meta_in.offsetVal  = (OMX_U16)sizeof(META_IN);
         meta_in.nTimeStamp.LowPart =
-           ((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp)& 0xFFFFFFFF);
+           (unsigned int)((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp)& 0xFFFFFFFF);
         meta_in.nTimeStamp.HighPart =
-           (((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) >> 32) & 0xFFFFFFFF);
+          (unsigned int) (((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) >> 32) & 0xFFFFFFFF);
         meta_in.nFlags &= ~OMX_BUFFERFLAG_EOS;
         if(buffer->nFlags & OMX_BUFFERFLAG_EOS)
         {
@@ -4112,7 +4112,7 @@
         /* Assume empty this buffer function has already checked
         validity of buffer */
         DEBUG_PRINT("Empty buffer %p to kernel driver\n", buffer);
-        post_input((unsigned) & hComp,(unsigned) buffer,
+        post_input((unsigned long) & hComp,(unsigned long) buffer,
                    OMX_COMPONENT_GENERATE_BUFFER_DONE);
     }
     return OMX_ErrorNone;
@@ -4125,7 +4125,7 @@
 {
     OMX_STATETYPE state;
     ENC_META_OUT *meta_out = NULL;
-    int nReadbytes = 0;
+    ssize_t nReadbytes = 0;
     int szadifhr = 0;
     int numframes = 0;
     int metainfo  = 0;
@@ -4150,10 +4150,10 @@
                 return OMX_ErrorBadParameter;
             szadifhr = AUDAAC_MAX_ADIF_HEADER_LENGTH; 
             numframes =  *m_tmp_out_meta_buf;
-            metainfo  = ((sizeof(ENC_META_OUT) * numframes)+
+            metainfo  = (int)((sizeof(ENC_META_OUT) * numframes)+
 			sizeof(unsigned char));
             audaac_rec_install_adif_header_variable(0,sample_idx,
-						m_aac_param.nChannels);
+				(OMX_U8)m_aac_param.nChannels);
             memcpy(buffer->pBuffer,m_tmp_out_meta_buf,metainfo);
             memcpy(buffer->pBuffer + metainfo,&audaac_header_adif[0],szadifhr);
             memcpy(buffer->pBuffer + metainfo + szadifhr,
@@ -4177,7 +4177,7 @@
         {
             DEBUG_PRINT("OMX_AUDIO_AACStreamFormatMP4FF\n");
             audaac_rec_install_mp4ff_header_variable(0,sample_idx,
-							m_aac_param.nChannels);
+						(OMX_U8)m_aac_param.nChannels);
             memcpy(buffer->pBuffer,&audaac_header_mp4ff[0],
 			AUDAAC_MAX_MP4FF_HEADER_LENGTH);
             buffer->nFilledLen = AUDAAC_MAX_MP4FF_HEADER_LENGTH;
@@ -4215,7 +4215,7 @@
          nTimestamp = buffer->nTimeStamp;
          buffer->nFlags |= meta_out->nflags;
          buffer->nOffset =  meta_out->offset_to_frame + 1;
-         buffer->nFilledLen = nReadbytes - buffer->nOffset + szadifhr;
+         buffer->nFilledLen = (OMX_U32)(nReadbytes - buffer->nOffset + szadifhr);
          DEBUG_PRINT("nflags %d frame_size %d offset_to_frame %d \
 		timestamp %lld\n", meta_out->nflags,
 		meta_out->frame_size,
@@ -4250,7 +4250,7 @@
           {
               DEBUG_PRINT("FTBP:Post the FBD to event thread currstate=%d\n",\
                             state);
-              post_output((unsigned) & hComp,(unsigned) buffer,
+              post_output((unsigned long) & hComp,(unsigned long) buffer,
                             OMX_COMPONENT_GENERATE_FRAME_DONE);
           }
           else
@@ -4317,8 +4317,8 @@
     m_aac_pb_stats.ftb_cnt++;
     DEBUG_DETAIL("FTB:nNumOutputBuf is %d", nNumOutputBuf);
     pthread_mutex_unlock(&out_buf_count_lock);
-    post_output((unsigned)hComp,
-                (unsigned) buffer,OMX_COMPONENT_GENERATE_FTB);
+    post_output((unsigned long)hComp,
+                (unsigned long) buffer,OMX_COMPONENT_GENERATE_FTB);
     return eRet;
 }
 
@@ -4401,11 +4401,11 @@
 {
     DEBUG_PRINT("Component-deinit being processed\n");
     DEBUG_PRINT("********************************\n");
-    DEBUG_PRINT("STATS: in-buf-len[%lu]out-buf-len[%lu] tot-pb-time[%ld]",\
+    DEBUG_PRINT("STATS: in-buf-len[%u]out-buf-len[%u] tot-pb-time[%lld]",\
                 m_aac_pb_stats.tot_in_buf_len,
                 m_aac_pb_stats.tot_out_buf_len,
                 m_aac_pb_stats.tot_pb_time);
-    DEBUG_PRINT("STATS: fbd-cnt[%lu]ftb-cnt[%lu]etb-cnt[%lu]ebd-cnt[%lu]",\
+    DEBUG_PRINT("STATS: fbd-cnt[%u]ftb-cnt[%u]etb-cnt[%u]ebd-cnt[%u]",\
                 m_aac_pb_stats.fbd_cnt,m_aac_pb_stats.ftb_cnt,
                 m_aac_pb_stats.etb_cnt,
                 m_aac_pb_stats.ebd_cnt);
@@ -4547,8 +4547,8 @@
 
     if((hComp == NULL) || (appData == NULL) || (eglImage == NULL))
     {
-        bufferHdr = NULL;
-        port = 0;
+        bufferHdr = bufferHdr;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -4582,8 +4582,8 @@
     }
     if (index == 0 && role)
     {
-        memcpy(role, cmp_role, sizeof(cmp_role));
-        *(((char *) role) + sizeof(cmp_role)) = '\0';
+        memcpy(role, cmp_role, strlen(cmp_role));
+        *(((char *) role) + strlen(cmp_role) + 1) = '\0';
     } else
     {
         eRet = OMX_ErrorNoMore;
@@ -4708,7 +4708,7 @@
   audaac_hdr_bit_index = 32;
   num_fce = 1;
   /* Store Header Id "ADIF" first */
-  memcpy(&audaac_header_adif[0], "ADIF", sizeof(OMX_U32));
+  memcpy(&audaac_header_adif[0], "ADIF", sizeof(unsigned int));
 
   /* copyright_id_present field, 1 bit */
   value = 0;
@@ -4971,19 +4971,19 @@
     byte_index = (*hdr_bit_index) >> 3;
     bit_index  = (*hdr_bit_index) &  0x07;
 
-    bits_avail_in_byte = 8 - bit_index;
+    bits_avail_in_byte = (OMX_U8)(8 - bit_index);
 
     num_to_copy = min(bits_avail_in_byte, num_remaining);
 
-    byte_to_copy = ((OMX_U8)((value >> (num_remaining - num_to_copy)) & 0xFF) <<
+    byte_to_copy = (OMX_U8)((OMX_U8)((value >> (num_remaining - num_to_copy)) & 0xFF) <<
                     (bits_avail_in_byte - num_to_copy));
 
     input[byte_index] &= ((OMX_U8)(bit_mask << bits_avail_in_byte));
     input[byte_index] |= byte_to_copy;
 
-    *hdr_bit_index += num_to_copy;
+    *hdr_bit_index = (OMX_U16)(*hdr_bit_index + num_to_copy);
 
-    num_remaining -= num_to_copy;
+    num_remaining = (OMX_U8)(num_remaining - num_to_copy);
   }
 }
 void  omx_aac_aenc::audaac_rec_install_mp4ff_header_variable (OMX_U16  byte_num,
diff --git a/mm-audio/aenc-aac/qdsp6/test/omx_aac_enc_test.c b/mm-audio/aenc-aac/qdsp6/test/omx_aac_enc_test.c
index c3e4b0a..174cde6 100644
--- a/mm-audio/aenc-aac/qdsp6/test/omx_aac_enc_test.c
+++ b/mm-audio/aenc-aac/qdsp6/test/omx_aac_enc_test.c
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -110,7 +110,7 @@
 uint32_t bitrate = 128000;
 uint32_t pcmplayback = 0;
 uint32_t tunnel      = 0;
-uint32_t rectime     = -1;
+uint32_t rectime     = 0;
 uint32_t format = 1;
 uint32_t profile = OMX_AUDIO_AACObjectLC;
 #define DEBUG_PRINT printf
@@ -203,13 +203,13 @@
         unsigned int nflags;
 } __attribute__ ((packed));
 
-static unsigned totaldatalen = 0;
+static int totaldatalen = 0;
 /************************************************************************/
 /*                GLOBAL INIT                    */
 /************************************************************************/
 
-int input_buf_cnt = 0;
-int output_buf_cnt = 0;
+unsigned int input_buf_cnt = 0;
+unsigned int output_buf_cnt = 0;
 int used_ip_buf_cnt = 0;
 volatile int event_is_done = 0;
 volatile int ebd_event_is_done = 0;
@@ -250,7 +250,7 @@
 static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *aac_enc_handle,
                                        OMX_BUFFERHEADERTYPE  ***pBufHdrs,
                                        OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize);
+                                       unsigned int bufCntMin, unsigned int bufSize);
 
 
 static OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
@@ -323,7 +323,7 @@
 
     switch(eEvent) {
         case OMX_EventCmdComplete:
-        DEBUG_PRINT("\n OMX_EventCmdComplete event=%d data1=%lu data2=%lu\n",(OMX_EVENTTYPE)eEvent,
+        DEBUG_PRINT("\n OMX_EventCmdComplete event=%d data1=%u data2=%u\n",(OMX_EVENTTYPE)eEvent,
                                                                                nData1,nData2);
             event_complete();
         break;
@@ -350,8 +350,8 @@
                               OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
 {
     size_t bytes_writen = 0;
-    int total_bytes_writen = 0;
-    unsigned int len = 0;
+    size_t total_bytes_writen = 0;
+    size_t len = 0;
     struct enc_meta_out *meta = NULL;
     OMX_U8 *src = pBuffer->pBuffer;
     unsigned int num_of_frames = 1;
@@ -390,7 +390,7 @@
 
             if(format == 6)
             {
-                audaac_rec_install_adts_header_variable(len + AUDAAC_MAX_ADTS_HEADER_LENGTH);
+                audaac_rec_install_adts_header_variable((uint16_t)(len + AUDAAC_MAX_ADTS_HEADER_LENGTH));
                 bytes_writen = fwrite(audaac_header,1,AUDAAC_MAX_ADTS_HEADER_LENGTH,outputBufferFile);
                 if(bytes_writen < AUDAAC_MAX_ADTS_HEADER_LENGTH)
                 {
@@ -408,8 +408,8 @@
             num_of_frames--;
             total_bytes_writen += len;
         }
-        DEBUG_PRINT(" FillBufferDone size writen to file  %d\n",total_bytes_writen);
-        totaldatalen += total_bytes_writen ;
+        DEBUG_PRINT(" FillBufferDone size writen to file  %zu\n",total_bytes_writen);
+        totaldatalen = totaldatalen + (int)total_bytes_writen;
 
         DEBUG_PRINT(" FBD calling FTB\n");
         OMX_FillThisBuffer(hComponent,pBuffer);
@@ -461,7 +461,7 @@
     }
 
     if((readBytes = Read_Buffer(pBuffer)) > 0) {
-        pBuffer->nFilledLen = readBytes;
+        pBuffer->nFilledLen = (OMX_U32)readBytes;
         used_ip_buf_cnt++;
         OMX_EmptyThisBuffer(hComponent,pBuffer);
     }
@@ -498,7 +498,7 @@
 
 int main(int argc, char **argv)
 {
-     int bufCnt=0;
+     unsigned int bufCnt=0;
      OMX_ERRORTYPE result;
 
     struct sigaction sa;
@@ -520,13 +520,13 @@
     if (argc >= 9) {
       in_filename = argv[1];
       out_filename = argv[2];
-      samplerate = atoi(argv[3]);
-      channels = atoi(argv[4]);
-      tunnel  = atoi(argv[5]);
-      rectime = atoi(argv[6]);
-      bitrate = atoi(argv[7]);
-      format =  atoi(argv[8]);
-      profile = atoi(argv[9]);
+      samplerate = (uint32_t)atoi(argv[3]);
+      channels = (uint32_t)atoi(argv[4]);
+      tunnel  = (uint32_t)atoi(argv[5]);
+      rectime = (uint32_t)atoi(argv[6]);
+      bitrate = (uint32_t)atoi(argv[7]);
+      format =  (uint32_t)atoi(argv[8]);
+      profile = (uint32_t)atoi(argv[9]);
 
 	  DEBUG_PRINT("Input parameters: samplerate = %d, channels = %d, tunnel = %d,"
 				  " rectime = %d, bitrate = %d, format = %d, profile = %d\n",
@@ -724,7 +724,7 @@
     /* Query for audio decoders*/
     DEBUG_PRINT("Aac_test: Before entering OMX_GetComponentOfRole");
     OMX_GetComponentsOfRole(role, &total, 0);
-    DEBUG_PRINT ("\nTotal components of role=%s :%lu", role, total);
+    DEBUG_PRINT ("\nTotal components of role=%s :%u", role, total);
 
 
     omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&aac_enc_handle),
@@ -749,8 +749,8 @@
     }
     else
     {
-        DEBUG_PRINT("\nportParam.nPorts:%lu\n", portParam.nPorts);
-    DEBUG_PRINT("\nportParam.nStartPortNumber:%lu\n",
+        DEBUG_PRINT("\nportParam.nPorts:%u\n", portParam.nPorts);
+    DEBUG_PRINT("\nportParam.nStartPortNumber:%u\n",
                                              portParam.nStartPortNumber);
     }
     return 0;
@@ -758,12 +758,16 @@
 
 int Play_Encoder()
 {
-    int i;
+    unsigned int i;
     int Size=0;
     DEBUG_PRINT("Inside %s \n", __FUNCTION__);
     OMX_ERRORTYPE ret;
     OMX_INDEXTYPE index;
+#ifdef __LP64__
+    DEBUG_PRINT("sizeof[%ld]\n", sizeof(OMX_BUFFERHEADERTYPE));
+#else
     DEBUG_PRINT("sizeof[%d]\n", sizeof(OMX_BUFFERHEADERTYPE));
+#endif
 
     /* open the i/p and o/p files based on the video file format passed */
     if(open_audio_file()) {
@@ -778,8 +782,8 @@
     inputportFmt.nPortIndex = portParam.nStartPortNumber;
 
     OMX_GetParameter(aac_enc_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-    DEBUG_PRINT ("\nEnc Input Buffer Count %lu\n", inputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nEnc: Input Buffer Size %lu\n", inputportFmt.nBufferSize);
+    DEBUG_PRINT ("\nEnc Input Buffer Count %u\n", inputportFmt.nBufferCountMin);
+    DEBUG_PRINT ("\nEnc: Input Buffer Size %u\n", inputportFmt.nBufferSize);
 
     if(OMX_DirInput != inputportFmt.eDir) {
         DEBUG_PRINT ("\nEnc: Expect Input Port\n");
@@ -798,8 +802,8 @@
     outputportFmt.nPortIndex = portParam.nStartPortNumber + 1;
 
     OMX_GetParameter(aac_enc_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-    DEBUG_PRINT ("\nEnc: Output Buffer Count %lu\n", outputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nEnc: Output Buffer Size %lu\n", outputportFmt.nBufferSize);
+    DEBUG_PRINT ("\nEnc: Output Buffer Count %u\n", outputportFmt.nBufferCountMin);
+    DEBUG_PRINT ("\nEnc: Output Buffer Size %u\n", outputportFmt.nBufferSize);
 
     if(OMX_DirOutput != outputportFmt.eDir) {
         DEBUG_PRINT ("\nEnc: Expect Output Port\n");
@@ -894,7 +898,7 @@
     for(i=0; i < output_buf_cnt; i++) {
         DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
         pOutputBufHdrs[i]->nOutputPortIndex = 1;
-        pOutputBufHdrs[i]->nFlags &= ~OMX_BUFFERFLAG_EOS;
+        pOutputBufHdrs[i]->nFlags = pOutputBufHdrs[i]->nFlags & (unsigned)~OMX_BUFFERFLAG_EOS;
         ret = OMX_FillThisBuffer(aac_enc_handle, pOutputBufHdrs[i]);
         if (OMX_ErrorNone != ret) {
             DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
@@ -916,7 +920,7 @@
           bInputEosReached = true;
           pInputBufHdrs[i]->nFlags= OMX_BUFFERFLAG_EOS;
         }
-        pInputBufHdrs[i]->nFilledLen = Size;
+        pInputBufHdrs[i]->nFilledLen = (OMX_U32)Size;
         pInputBufHdrs[i]->nInputPortIndex = 0;
         used_ip_buf_cnt++;
         ret = OMX_EmptyThisBuffer(aac_enc_handle, pInputBufHdrs[i]);
@@ -954,11 +958,11 @@
 static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *avc_enc_handle,
                                        OMX_BUFFERHEADERTYPE  ***pBufHdrs,
                                        OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize)
+                                       unsigned int bufCntMin, unsigned int bufSize)
 {
     DEBUG_PRINT("Inside %s \n", __FUNCTION__);
     OMX_ERRORTYPE error=OMX_ErrorNone;
-    long bufCnt=0;
+    unsigned int bufCnt=0;
     /* To remove warning for unused variable to keep prototype same */
     (void)avc_enc_handle;
 
@@ -966,7 +970,7 @@
                    malloc(sizeof(OMX_BUFFERHEADERTYPE*)*bufCntMin);
 
     for(bufCnt=0; bufCnt < bufCntMin; ++bufCnt) {
-        DEBUG_PRINT("\n OMX_AllocateBuffer No %ld \n", bufCnt);
+        DEBUG_PRINT("\n OMX_AllocateBuffer No %d \n", bufCnt);
         error = OMX_AllocateBuffer(aac_enc_handle, &((*pBufHdrs)[bufCnt]),
                                    nPortIndex, NULL, bufSize);
     }
@@ -980,7 +984,7 @@
 static int Read_Buffer (OMX_BUFFERHEADERTYPE  *pBufHdr )
 {
 
-    int bytes_read=0;
+    size_t bytes_read=0;
 
 
     pBufHdr->nFilledLen = 0;
@@ -988,7 +992,7 @@
 
      bytes_read = fread(pBufHdr->pBuffer, 1, pBufHdr->nAllocLen , inputBufferFile);
 
-      pBufHdr->nFilledLen = bytes_read;
+      pBufHdr->nFilledLen = (OMX_U32)bytes_read;
         if(bytes_read == 0)
         {
 
@@ -997,10 +1001,10 @@
         }
         else
         {
-            pBufHdr->nFlags &= ~OMX_BUFFERFLAG_EOS;
+            pBufHdr->nFlags = pBufHdr->nFlags & (unsigned)~OMX_BUFFERFLAG_EOS;
         }
 
-    return bytes_read;;
+    return (int)bytes_read;
 }
 
 
@@ -1062,11 +1066,11 @@
     byte_index = (*hdr_bit_index) >> 3;
     bit_index  = (*hdr_bit_index) &  0x07;
 
-    bits_avail_in_byte = 8 - bit_index;
+    bits_avail_in_byte = (uint8)(8 - bit_index);
 
     num_to_copy = MIN(bits_avail_in_byte, num_remaining);
 
-    byte_to_copy = ((uint8)((value >> (num_remaining - num_to_copy)) & 0xFF) <<
+    byte_to_copy = (uint8)(((value >> (num_remaining - num_to_copy)) & 0xFF) <<
                     (bits_avail_in_byte - num_to_copy));
 
     input[byte_index] &= ((uint8)(bit_mask << bits_avail_in_byte));
@@ -1074,7 +1078,7 @@
 
     *hdr_bit_index += num_to_copy;
 
-    num_remaining -= num_to_copy;
+    num_remaining = (uint8)(num_remaining - num_to_copy);
   } /* while (num_remaining) */
 } /* audaac_rec_install_bits */
 
@@ -1138,7 +1142,7 @@
   uint32  value;
 
   uint32   sample_index = samplerate;
-  uint8   channel_config = channels;
+  uint8   channel_config = (uint8)channels;
 
   /* Store Sync word first */
   audaac_header[0] = 0xFF;
diff --git a/mm-audio/aenc-amrnb/Android.mk b/mm-audio/aenc-amrnb/Android.mk
index 79474c6..285ad9d 100644
--- a/mm-audio/aenc-amrnb/Android.mk
+++ b/mm-audio/aenc-amrnb/Android.mk
@@ -1,4 +1,4 @@
-ifeq ($(TARGET_ARCH),arm)
+ifneq ($(filter arm aarch64 arm64, $(TARGET_ARCH)),)
 
 
 AENC_AMR_PATH:= $(call my-dir)
@@ -27,5 +27,8 @@
 ifeq ($(call is-board-platform,msm8916),true)
 include $(AENC_AMR_PATH)/qdsp6/Android.mk
 endif
+ifeq ($(call is-board-platform,msm8994),true)
+include $(AENC_AMR_PATH)/qdsp6/Android.mk
+endif
 
 endif
diff --git a/mm-audio/aenc-amrnb/qdsp6/Android.mk b/mm-audio/aenc-amrnb/qdsp6/Android.mk
index b97e2e5..21efdfd 100644
--- a/mm-audio/aenc-amrnb/qdsp6/Android.mk
+++ b/mm-audio/aenc-amrnb/qdsp6/Android.mk
@@ -13,6 +13,7 @@
 libOmxAmrEnc-def += -D_ENABLE_QC_MSG_LOG_
 libOmxAmrEnc-def += -DVERBOSE
 libOmxAmrEnc-def += -D_DEBUG
+libOmxAmrEnc-def += -Wconversion
 ifeq ($(strip $(TARGET_USES_QCOM_MM_AUDIO)),true)
 libOmxAmrEnc-def += -DAUDIOV2
 endif
diff --git a/mm-audio/aenc-amrnb/qdsp6/inc/omx_amr_aenc.h b/mm-audio/aenc-amrnb/qdsp6/inc/omx_amr_aenc.h
index 4b89765..ed7f758 100644
--- a/mm-audio/aenc-amrnb/qdsp6/inc/omx_amr_aenc.h
+++ b/mm-audio/aenc-amrnb/qdsp6/inc/omx_amr_aenc.h
@@ -1,6 +1,6 @@
 /*--------------------------------------------------------------------------
 
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
+Copyright (c) 2010,2014 The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -82,10 +82,10 @@
 
 
 #define PrintFrameHdr(i,bufHdr) \
-                           DEBUG_PRINT("i=%d OMX bufHdr[%x]buf[%x]size[%d]TS[%lld]nFlags[0x%x]\n",\
+                           DEBUG_PRINT("i=%d OMX bufHdr[%p]buf[%p]size[%d]TS[%lld]nFlags[0x%x]\n",\
                            i,\
-                           (unsigned) bufHdr,                                     \
-                           (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,   \
+                           bufHdr,                                     \
+                           ((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,   \
                            (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFilledLen,\
                            ((OMX_BUFFERHEADERTYPE *)bufHdr)->nTimeStamp, \
                            (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFlags)
@@ -244,7 +244,7 @@
                                 void *                  eglImage);
 
     bool post_command(unsigned int p1, unsigned int p2,
-        unsigned int id);
+        unsigned char id);
 
     // Deferred callback identifiers
     enum
@@ -303,9 +303,9 @@
 
     struct omx_event
     {
-        unsigned param1;
-        unsigned param2;
-        unsigned id;
+        unsigned long param1;
+        unsigned long param2;
+        unsigned char id;
     };
 
     struct omx_cmd_queue
@@ -317,16 +317,16 @@
 
         omx_cmd_queue();
         ~omx_cmd_queue();
-        bool insert_entry(unsigned p1, unsigned p2, unsigned id);
-        bool pop_entry(unsigned *p1,unsigned *p2, unsigned *id);
-        bool get_msg_id(unsigned *id);
+        bool insert_entry(unsigned long p1, unsigned long p2, unsigned char id);
+        bool pop_entry(unsigned long *p1,unsigned long *p2, unsigned char *id);
+        bool get_msg_id(unsigned char *id);
         bool get_msg_with_id(unsigned *p1,unsigned *p2, unsigned id);
     };
 
     typedef struct TIMESTAMP
     {
-        unsigned long LowPart;
-        unsigned long HighPart;
+        unsigned int LowPart;
+        unsigned int HighPart;
     }__attribute__((packed)) TIMESTAMP;
 
     typedef struct metadata_input
@@ -350,7 +350,7 @@
     {
         OMX_U32 tot_in_buf_len;
         OMX_U32 tot_out_buf_len;
-        OMX_U32 tot_pb_time;
+        OMX_TICKS tot_pb_time;
         OMX_U32 fbd_cnt;
         OMX_U32 ftb_cnt;
         OMX_U32 etb_cnt;
@@ -507,11 +507,11 @@
 
     bool search_output_bufhdr(OMX_BUFFERHEADERTYPE *buffer);
 
-    bool post_input(unsigned int p1, unsigned int p2,
-                    unsigned int id);
+    bool post_input(unsigned long p1, unsigned long p2,
+                    unsigned char id);
 
-    bool post_output(unsigned int p1, unsigned int p2,
-                     unsigned int id);
+    bool post_output(unsigned long p1, unsigned long p2,
+                     unsigned char id);
 
     void process_events(omx_amr_aenc *client_data);
 
diff --git a/mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp b/mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp
index c6233f8..f322b40 100644
--- a/mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp
+++ b/mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
+Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -57,9 +57,9 @@
 }
 
 // omx cmd queue insert
-bool omx_amr_aenc::omx_cmd_queue::insert_entry(unsigned p1,
-                                                unsigned p2,
-                                                unsigned id)
+bool omx_amr_aenc::omx_cmd_queue::insert_entry(unsigned long p1,
+                                                unsigned long p2,
+                                                unsigned char id)
 {
     bool ret = true;
     if (m_size < OMX_CORE_CONTROL_CMDQ_SIZE)
@@ -81,8 +81,8 @@
     return ret;
 }
 
-bool omx_amr_aenc::omx_cmd_queue::pop_entry(unsigned *p1,
-                                             unsigned *p2, unsigned *id)
+bool omx_amr_aenc::omx_cmd_queue::pop_entry(unsigned long *p1,
+                                             unsigned long *p2, unsigned char *id)
 {
     bool ret = true;
     if (m_size > 0)
@@ -111,7 +111,7 @@
 {
     return(new omx_amr_aenc);
 }
-bool omx_amr_aenc::omx_cmd_queue::get_msg_id(unsigned *id)
+bool omx_amr_aenc::omx_cmd_queue::get_msg_id(unsigned char *id)
 {
    if(m_size > 0)
    {
@@ -256,7 +256,10 @@
         m_tmp_out_meta_buf(NULL),
         m_flush_cnt(255),
         m_comp_deinit(0),
+        m_volume(25),
         m_app_data(NULL),
+        nNumInputBuf(0),
+        nNumOutputBuf(0),
         m_drv_fd(-1),
         bFlushinprogress(0),
         is_in_th_sleep(false),
@@ -264,12 +267,14 @@
         m_flags(0),
         nTimestamp(0),
         ts(0),
+        pcm_input(0),
         m_inp_act_buf_count (OMX_CORE_NUM_INPUT_BUFFERS),
         m_out_act_buf_count (OMX_CORE_NUM_OUTPUT_BUFFERS),
         m_inp_current_buf_count(0),
         m_out_current_buf_count(0),
-        output_buffer_size(OMX_AMR_OUTPUT_BUFFER_SIZE),
+        output_buffer_size((OMX_U32)OMX_AMR_OUTPUT_BUFFER_SIZE),
         input_buffer_size(OMX_CORE_INPUT_BUFFER_SIZE),
+        m_session_id(0),
         m_inp_bEnabled(OMX_TRUE),
         m_out_bEnabled(OMX_TRUE),
         m_inp_bPopulated(OMX_FALSE),
@@ -278,12 +283,7 @@
         m_state(OMX_StateInvalid),
         m_ipc_to_in_th(NULL),
         m_ipc_to_out_th(NULL),
-        m_ipc_to_cmd_th(NULL),
-        pcm_input(0),
-        m_volume(25),
-        m_session_id(0),
-        nNumOutputBuf(0),
-        nNumInputBuf(0)
+        m_ipc_to_cmd_th(NULL)
 {
     int cond_ret = 0;
     component_Role.nSize = 0;
@@ -504,13 +504,13 @@
         m_amr_pb_stats.fbd_cnt++;
         pthread_mutex_lock(&out_buf_count_lock);
         nNumOutputBuf--;
-        DEBUG_PRINT("FBD CB:: nNumOutputBuf=%d out_buf_len=%lu fbd_cnt=%lu\n",\
+        DEBUG_PRINT("FBD CB:: nNumOutputBuf=%d out_buf_len=%u fbd_cnt=%u\n",\
                     nNumOutputBuf,
                     m_amr_pb_stats.tot_out_buf_len,
                     m_amr_pb_stats.fbd_cnt);
         m_amr_pb_stats.tot_out_buf_len += bufHdr->nFilledLen;
         m_amr_pb_stats.tot_pb_time     = bufHdr->nTimeStamp;
-        DEBUG_PRINT("FBD:in_buf_len=%lu out_buf_len=%lu\n",
+        DEBUG_PRINT("FBD:in_buf_len=%u out_buf_len=%u\n",
                     m_amr_pb_stats.tot_in_buf_len,
                     m_amr_pb_stats.tot_out_buf_len);
 
@@ -544,9 +544,9 @@
 =============================================================================*/
 void omx_amr_aenc::process_out_port_msg(void *client_data, unsigned char id)
 {
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize     = 0;                 // qsize
     unsigned      tot_qsize = 0;
     omx_amr_aenc  *pThis    = (omx_amr_aenc *) client_data;
@@ -748,9 +748,9 @@
 =============================================================================*/
 void omx_amr_aenc::process_command_msg(void *client_data, unsigned char id)
 {
-    unsigned     p1;                             // Parameter - 1
-    unsigned     p2;                             // Parameter - 2
-    unsigned     ident;
+    unsigned long  p1 = 0;                             // Parameter - 1
+    unsigned long  p2 = 0;                             // Parameter - 2
+    unsigned char ident = 0;
     unsigned     qsize  = 0;
     omx_amr_aenc *pThis = (omx_amr_aenc*)client_data;
     pthread_mutex_lock(&pThis->m_commandlock);
@@ -822,15 +822,15 @@
                 pThis->m_cb.EventHandler(&pThis->m_cmp,
                                          pThis->m_app_data,
                                          OMX_EventError,
-                                         p2,
-                                         NULL,
-                                         NULL );
+                                         (OMX_U32)p2,
+                                         0,
+                                         0 );
             } else
             {
                 pThis->m_cb.EventHandler(&pThis->m_cmp,
                                          pThis->m_app_data,
                                          OMX_EventCmdComplete,
-                                         p1, p2, NULL );
+                                         (OMX_U32)p1, (OMX_U32)p2, NULL );
             }
         } else
         {
@@ -878,9 +878,9 @@
 =============================================================================*/
 void omx_amr_aenc::process_in_port_msg(void *client_data, unsigned char id)
 {
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize     = 0;
     unsigned      tot_qsize = 0;
     omx_amr_aenc  *pThis    = (omx_amr_aenc *) client_data;
@@ -1058,12 +1058,12 @@
     randomly assign the value right now. Query will result in
     incorrect param */
     memset(&m_amr_param, 0, sizeof(m_amr_param));
-    m_amr_param.nSize = sizeof(m_amr_param);
+    m_amr_param.nSize = (OMX_U32)sizeof(m_amr_param);
     m_amr_param.nChannels = OMX_AMR_DEFAULT_CH_CFG;
     m_volume = OMX_AMR_DEFAULT_VOL;             /* Close to unity gain */
     memset(&m_amr_pb_stats,0,sizeof(AMR_PB_STATS));
     memset(&m_pcm_param, 0, sizeof(m_pcm_param));
-    m_pcm_param.nSize = sizeof(m_pcm_param);
+    m_pcm_param.nSize = (OMX_U32)sizeof(m_pcm_param);
     m_pcm_param.nChannels = OMX_AMR_DEFAULT_CH_CFG;
     m_pcm_param.nSamplingRate = OMX_AMR_DEFAULT_SF;
     nTimestamp = 0;
@@ -1094,20 +1094,20 @@
     if (!strcmp(role,"OMX.qcom.audio.encoder.amrnb"))
     {
         pcm_input = 1;
-        component_Role.nSize = sizeof(role);
+        component_Role.nSize = (OMX_U32)sizeof(role);
         strlcpy((char *)component_Role.cRole, (const char*)role,
 		sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED \n", role);
     } else if (!strcmp(role,"OMX.qcom.audio.encoder.tunneled.amrnb"))
     {
         pcm_input = 0;
-        component_Role.nSize = sizeof(role);
+        component_Role.nSize = (OMX_U32)sizeof(role);
         strlcpy((char *)component_Role.cRole, (const char*)role,
 		sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED \n", role);
     } else
     {
-        component_Role.nSize = sizeof("\0");
+        component_Role.nSize = (OMX_U32)sizeof("\0");
         strlcpy((char *)component_Role.cRole, (const char*)"\0",
 		sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED is invalid\n", role);
@@ -1251,7 +1251,7 @@
 
     if(hComp == NULL)
     {
-        cmdData = NULL;
+        cmdData = cmdData;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -1265,7 +1265,7 @@
     }
     post_command((unsigned)cmd,(unsigned)param1,OMX_COMPONENT_GENERATE_COMMAND);
     DEBUG_PRINT("Send Command : returns with OMX_ErrorNone \n");
-    DEBUG_PRINT("send_command : recieved state before semwait= %lu\n",param1);
+    DEBUG_PRINT("send_command : recieved state before semwait= %u\n",param1);
     sem_wait (&sem_States);
     DEBUG_PRINT("send_command : recieved state after semwait\n");
     return OMX_ErrorNone;
@@ -1295,7 +1295,7 @@
 
     if(hComp == NULL)
     {
-        cmdData = NULL;
+        cmdData = cmdData;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -1461,7 +1461,7 @@
                     }
                     pcm_cfg.channel_count = m_pcm_param.nChannels;
                     pcm_cfg.sample_rate  =  m_pcm_param.nSamplingRate;
-                    DEBUG_PRINT("pcm config %lu %lu\n",m_pcm_param.nChannels,
+                    DEBUG_PRINT("pcm config %u %u\n",m_pcm_param.nChannels,
 				m_pcm_param.nSamplingRate);
 
                     if (ioctl(m_drv_fd, AUDIO_SET_CONFIG, &pcm_cfg) == -1)
@@ -1723,7 +1723,7 @@
     } else if (OMX_CommandFlush == cmd)
     {
         DEBUG_DETAIL("*************************\n");
-        DEBUG_PRINT("SCP-->RXED FLUSH COMMAND port=%lu\n",param1);
+        DEBUG_PRINT("SCP-->RXED FLUSH COMMAND port=%u\n",param1);
         DEBUG_DETAIL("*************************\n");
         bFlag = 0;
         if ( param1 == OMX_CORE_INPUT_PORT_INDEX ||
@@ -1762,7 +1762,7 @@
                 if (m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
                 {
                     DEBUG_PRINT("SCP: execute_omx_flush in Disable in "\
-                                " param1=%lu m_state=%d \n",param1, m_state);
+                                " param1=%u m_state=%d \n",param1, m_state);
                     execute_omx_flush(param1);
                 }
                 DEBUG_PRINT("send_command_proxy:OMX_CommandPortDisable:\
@@ -1794,7 +1794,7 @@
                 if (m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
                 {
                     DEBUG_PRINT("SCP: execute_omx_flush in Disable out "\
-                                "param1=%lu m_state=%d \n",param1, m_state);
+                                "param1=%u m_state=%d \n",param1, m_state);
                     execute_omx_flush(param1);
                 }
                 BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_DISABLE_PENDING);
@@ -1911,7 +1911,7 @@
 {
     bool bRet = true;
 
-    DEBUG_PRINT("Execute_omx_flush Port[%lu]", param1);
+    DEBUG_PRINT("Execute_omx_flush Port[%u]", param1);
     struct timespec abs_timeout;
     abs_timeout.tv_sec = 1;
     abs_timeout.tv_nsec = 0;
@@ -1961,7 +1961,7 @@
         DEBUG_DETAIL("WAITING FOR FLUSH ACK's param1=%d",param1);
         wait_for_event();
 
-        DEBUG_PRINT("RECIEVED BOTH FLUSH ACK's param1=%lu cmd_cmpl=%d",\
+        DEBUG_PRINT("RECIEVED BOTH FLUSH ACK's param1=%u cmd_cmpl=%d",\
                     param1,cmd_cmpl);
 
         // If not going to idle state, Send FLUSH complete message
@@ -2075,7 +2075,7 @@
         DEBUG_DETAIL("RECIEVED FLUSH ACK FOR O/P PORT param1=%d",param1);
     } else
     {
-        DEBUG_PRINT("Invalid Port ID[%lu]",param1);
+        DEBUG_PRINT("Invalid Port ID[%u]",param1);
     }
     return bRet;
 }
@@ -2103,9 +2103,9 @@
 bool omx_amr_aenc::execute_input_omx_flush()
 {
     OMX_BUFFERHEADERTYPE *omx_buf;
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize=0;                       // qsize
     unsigned      tot_qsize=0;                   // qsize
 
@@ -2183,9 +2183,9 @@
 bool omx_amr_aenc::execute_output_omx_flush()
 {
     OMX_BUFFERHEADERTYPE *omx_buf;
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize=0;                       // qsize
     unsigned      tot_qsize=0;                   // qsize
 
@@ -2266,9 +2266,9 @@
 SIDE EFFECTS:
   None
 =============================================================================*/
-bool omx_amr_aenc::post_input(unsigned int p1,
-                               unsigned int p2,
-                               unsigned int id)
+bool omx_amr_aenc::post_input(unsigned long p1,
+                               unsigned long p2,
+                               unsigned char id)
 {
     bool bRet = false;
     pthread_mutex_lock(&m_lock);
@@ -2329,7 +2329,7 @@
 =============================================================================*/
 bool omx_amr_aenc::post_command(unsigned int p1,
                                  unsigned int p2,
-                                 unsigned int id)
+                                 unsigned char id)
 {
     bool bRet  = false;
 
@@ -2376,9 +2376,9 @@
 SIDE EFFECTS:
   None
 =============================================================================*/
-bool omx_amr_aenc::post_output(unsigned int p1,
-                                unsigned int p2,
-                                unsigned int id)
+bool omx_amr_aenc::post_output(unsigned long p1,
+                                unsigned long p2,
+                                unsigned char id)
 {
     bool bRet = false;
 
@@ -2442,7 +2442,7 @@
         return OMX_ErrorBadParameter;
     }
 
-    switch (paramIndex)
+    switch ((int)paramIndex)
     {
         case OMX_IndexParamPortDefinition:
             {
@@ -2450,11 +2450,11 @@
                 portDefn = (OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
 
                 DEBUG_PRINT("OMX_IndexParamPortDefinition " \
-                            "portDefn->nPortIndex = %lu\n",
+                            "portDefn->nPortIndex = %u\n",
 				portDefn->nPortIndex);
 
                 portDefn->nVersion.nVersion = OMX_SPEC_VERSION;
-                portDefn->nSize = sizeof(portDefn);
+                portDefn->nSize = (OMX_U32)sizeof(portDefn);
                 portDefn->eDomain    = OMX_PortDomainAudio;
 
                 if (0 == portDefn->nPortIndex)
@@ -2496,7 +2496,7 @@
                 DEBUG_PRINT("OMX_IndexParamAudioInit\n");
 
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 2;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2508,7 +2508,7 @@
                 (OMX_AUDIO_PARAM_PORTFORMATTYPE *) paramData;
                 DEBUG_PRINT("OMX_IndexParamAudioPortFormat\n");
                 portFormatType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portFormatType->nSize = sizeof(portFormatType);
+                portFormatType->nSize = (OMX_U32)sizeof(portFormatType);
 
                 if (OMX_CORE_INPUT_PORT_INDEX == portFormatType->nPortIndex)
                 {
@@ -2518,7 +2518,7 @@
 				portFormatType->nPortIndex)
                 {
                     DEBUG_PRINT("get_parameter: OMX_IndexParamAudioFormat: "\
-                                "%lu\n", portFormatType->nIndex);
+                                "%u\n", portFormatType->nIndex);
 
             portFormatType->eEncoding = OMX_AUDIO_CodingAMR;
                 } else
@@ -2552,7 +2552,7 @@
     {
        QOMX_AUDIO_STREAM_INFO_DATA *streaminfoparam =
                (QOMX_AUDIO_STREAM_INFO_DATA *) paramData;
-       streaminfoparam->sessionId = m_session_id;
+       streaminfoparam->sessionId = (OMX_U8)m_session_id;
        break;
     }
 
@@ -2565,9 +2565,9 @@
                 {
                     memcpy(pcmparam,&m_pcm_param,\
                         sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
-                    DEBUG_PRINT("get_parameter: Sampling rate %lu",\
+                    DEBUG_PRINT("get_parameter: Sampling rate %u",\
                                  pcmparam->nSamplingRate);
-                    DEBUG_PRINT("get_parameter: Number of channels %lu",\
+                    DEBUG_PRINT("get_parameter: Number of channels %u",\
                                  pcmparam->nChannels);
                 } else
                 {
@@ -2592,7 +2592,7 @@
                     (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamVideoInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2602,7 +2602,7 @@
                 OMX_PRIORITYMGMTTYPE *priorityMgmtType =
                 (OMX_PRIORITYMGMTTYPE*)paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamPriorityMgmt\n");
-                priorityMgmtType->nSize = sizeof(priorityMgmtType);
+                priorityMgmtType->nSize = (OMX_U32)sizeof(priorityMgmtType);
                 priorityMgmtType->nVersion.nVersion = OMX_SPEC_VERSION;
                 priorityMgmtType->nGroupID = m_priority_mgm.nGroupID;
                 priorityMgmtType->nGroupPriority =
@@ -2615,7 +2615,7 @@
                 (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamImageInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2630,7 +2630,7 @@
                 DEBUG_PRINT("get_parameter: \
 				OMX_IndexParamCompBufferSupplier\n");
 
-                bufferSupplierType->nSize = sizeof(bufferSupplierType);
+                bufferSupplierType->nSize = (OMX_U32)sizeof(bufferSupplierType);
                 bufferSupplierType->nVersion.nVersion = OMX_SPEC_VERSION;
                 if (OMX_CORE_INPUT_PORT_INDEX   ==
 				bufferSupplierType->nPortIndex)
@@ -2659,7 +2659,7 @@
                     (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamOtherInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2757,7 +2757,7 @@
                     return OMX_ErrorIncorrectStateOperation;
                 }
                 DEBUG_PRINT("OMX_IndexParamPortDefinition portDefn->nPortIndex "
-                            "= %lu\n",portDefn->nPortIndex);
+                            "= %u\n",portDefn->nPortIndex);
                 if (OMX_CORE_INPUT_PORT_INDEX == portDefn->nPortIndex)
                 {
                     if ( portDefn->nBufferCountActual >
@@ -2801,10 +2801,10 @@
                 }
                 OMX_PRIORITYMGMTTYPE *priorityMgmtype
                 = (OMX_PRIORITYMGMTTYPE*) paramData;
-                DEBUG_PRINT("set_parameter: OMX_IndexParamPriorityMgmt %lu\n",
+                DEBUG_PRINT("set_parameter: OMX_IndexParamPriorityMgmt %u\n",
                             priorityMgmtype->nGroupID);
 
-                DEBUG_PRINT("set_parameter: priorityMgmtype %lu\n",
+                DEBUG_PRINT("set_parameter: priorityMgmtype %u\n",
                             priorityMgmtype->nGroupPriority);
 
                 m_priority_mgm.nGroupID = priorityMgmtype->nGroupID;
@@ -2826,7 +2826,7 @@
 				portFormatType->nPortIndex)
                 {
                     DEBUG_PRINT("set_parameter: OMX_IndexParamAudioFormat:"\
-                                " %lu\n", portFormatType->nIndex);
+                                " %u\n", portFormatType->nIndex);
                     portFormatType->eEncoding = OMX_AUDIO_CodingAMR;
                 } else
                 {
@@ -2874,7 +2874,7 @@
                 {
                     memcpy(&m_pcm_param,pcmparam,\
                         sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
-                    DEBUG_PRINT("set_pcm_parameter: %lu %lu",\
+                    DEBUG_PRINT("set_pcm_parameter: %u %u",\
                                  m_pcm_param.nChannels,
 				m_pcm_param.nSamplingRate);
                 } else
@@ -2952,7 +2952,7 @@
 
                 if (OMX_CORE_INPUT_PORT_INDEX == volume->nPortIndex)
                 {
-                    volume->nSize = sizeof(volume);
+                    volume->nSize = (OMX_U32)sizeof(volume);
                     volume->nVersion.nVersion = OMX_SPEC_VERSION;
                     volume->bLinear = OMX_TRUE;
                     volume->sVolume.nValue = m_volume;
@@ -2972,7 +2972,7 @@
 
                 if (OMX_CORE_INPUT_PORT_INDEX == mute->nPortIndex)
                 {
-                    mute->nSize = sizeof(mute);
+                    mute->nSize = (OMX_U32)sizeof(mute);
                     mute->nVersion.nVersion = OMX_SPEC_VERSION;
                     mute->bMute = (BITMASK_PRESENT(&m_flags,
                                       OMX_COMPONENT_MUTED)?OMX_TRUE:OMX_FALSE);
@@ -3180,8 +3180,8 @@
 
     if((hComp == NULL) || (peerComponent == NULL) || (tunnelSetup == NULL))
     {
-        port = 0;
-        peerPort = 0;
+        port = port;
+        peerPort = peerPort;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3221,7 +3221,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         free(buf_ptr);
         return OMX_ErrorBadParameter;
@@ -3234,7 +3234,7 @@
 
         bufHdr->pBuffer           = (OMX_U8 *)((buf_ptr) + sizeof(META_IN)+
                                                sizeof(OMX_BUFFERHEADERTYPE));
-        bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+        bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
         bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
         bufHdr->nAllocLen         = nBufSize;
         bufHdr->pAppPrivate       = appData;
@@ -3243,7 +3243,7 @@
 
         m_inp_current_buf_count++;
         DEBUG_PRINT("AIB:bufHdr %p bufHdr->pBuffer %p m_inp_buf_cnt=%d \
-		bytes=%lu", bufHdr, bufHdr->pBuffer,m_inp_current_buf_count,
+		bytes=%u", bufHdr, bufHdr->pBuffer,m_inp_current_buf_count,
                     bytes);
 
     } else
@@ -3275,7 +3275,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3291,7 +3291,7 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)((buf_ptr) +
 					sizeof(OMX_BUFFERHEADERTYPE));
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             bufHdr->pAppPrivate       = appData;
@@ -3299,7 +3299,7 @@
             m_output_buf_hdrs.insert(bufHdr, NULL);
             m_out_current_buf_count++;
             DEBUG_PRINT("AOB::bufHdr %p bufHdr->pBuffer %p m_out_buf_cnt=%d"\
-                        "bytes=%lu",bufHdr, bufHdr->pBuffer,\
+                        "bytes=%u",bufHdr, bufHdr->pBuffer,\
                         m_out_current_buf_count, bytes);
         } else
         {
@@ -3513,7 +3513,7 @@
         }
     }
   }
-    DEBUG_PRINT("Use Buffer for port[%lu] eRet[%d]\n", port,eRet);
+    DEBUG_PRINT("Use Buffer for port[%u] eRet[%d]\n", port,eRet);
     return eRet;
 }
 /*=============================================================================
@@ -3556,7 +3556,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3578,8 +3578,8 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)(buffer);
             DEBUG_PRINT("use_input_buffer:bufHdr %p bufHdr->pBuffer %p \
-			bytes=%lu", bufHdr, bufHdr->pBuffer,bytes);
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+			bytes=%u", bufHdr, bufHdr->pBuffer,bytes);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             input_buffer_size         = nBufSize;
@@ -3641,7 +3641,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3667,8 +3667,8 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)(buffer);
             DEBUG_PRINT("use_output_buffer:bufHdr %p bufHdr->pBuffer %p \
-			len=%lu", bufHdr, bufHdr->pBuffer,bytes);
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+			len=%u", bufHdr, bufHdr->pBuffer,bytes);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             output_buffer_size        = nBufSize;
@@ -3767,7 +3767,7 @@
                (m_out_bEnabled == OMX_FALSE &&
 		port == OMX_CORE_OUTPUT_PORT_INDEX))
     {
-        DEBUG_PRINT("Free Buffer while port %lu disabled\n", port);
+        DEBUG_PRINT("Free Buffer while port %u disabled\n", port);
     } else if (m_state == OMX_StateExecuting || m_state == OMX_StatePause)
     {
         DEBUG_PRINT("Invalid state to free buffer,ports need to be disabled:\
@@ -3901,7 +3901,7 @@
 {
     OMX_ERRORTYPE eRet = OMX_ErrorNone;
 
-    DEBUG_PRINT("ETB:Buf:%p Len %lu TS %lld numInBuf=%d\n", \
+    DEBUG_PRINT("ETB:Buf:%p Len %u TS %lld numInBuf=%d\n", \
                 buffer, buffer->nFilledLen, buffer->nTimeStamp, (nNumInputBuf));
     if (m_state == OMX_StateInvalid)
     {
@@ -3939,11 +3939,11 @@
     {
         if (search_input_bufhdr(buffer) == true)
         {
-            post_input((unsigned)hComp,
-                       (unsigned) buffer,OMX_COMPONENT_GENERATE_ETB);
+            post_input((unsigned long)hComp,
+                       (unsigned long) buffer,OMX_COMPONENT_GENERATE_ETB);
         } else
         {
-            DEBUG_PRINT_ERROR("Bad header %x \n", (int)buffer);
+            DEBUG_PRINT_ERROR("Bad header %p \n", buffer);
             eRet = OMX_ErrorBadParameter;
         }
     }
@@ -3985,11 +3985,11 @@
         data = m_tmp_meta_buf;
 
         // copy the metadata info from the BufHdr and insert to payload
-        meta_in.offsetVal  = sizeof(META_IN);
+        meta_in.offsetVal  = (OMX_U16)sizeof(META_IN);
         meta_in.nTimeStamp.LowPart =
-           ((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp)& 0xFFFFFFFF);
+          (unsigned int)((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp)& 0xFFFFFFFF);
         meta_in.nTimeStamp.HighPart =
-           (((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) >> 32) & 0xFFFFFFFF);
+          (unsigned int) (((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) >> 32) & 0xFFFFFFFF);
         meta_in.nFlags &= ~OMX_BUFFERFLAG_EOS;
         if(buffer->nFlags & OMX_BUFFERFLAG_EOS)
         {
@@ -4016,7 +4016,7 @@
         /* Assume empty this buffer function has already checked
         validity of buffer */
         DEBUG_PRINT("Empty buffer %p to kernel driver\n", buffer);
-        post_input((unsigned) & hComp,(unsigned) buffer,
+        post_input((unsigned long) & hComp,(unsigned long) buffer,
                    OMX_COMPONENT_GENERATE_BUFFER_DONE);
     }
     return OMX_ErrorNone;
@@ -4029,7 +4029,7 @@
 {
     OMX_STATETYPE state;
     ENC_META_OUT *meta_out = NULL;
-    int nReadbytes = 0;
+    ssize_t nReadbytes = 0;
 
     pthread_mutex_lock(&m_state_lock);
     get_state(&m_cmp, &state);
@@ -4059,8 +4059,9 @@
           buffer->nTimeStamp = (((OMX_TICKS)meta_out->msw_ts << 32)+
 					meta_out->lsw_ts);
           buffer->nFlags |= meta_out->nflags;
-          buffer->nOffset =  meta_out->offset_to_frame + sizeof(unsigned char);
-          buffer->nFilledLen = nReadbytes - buffer->nOffset;
+          buffer->nOffset = (OMX_U32)(meta_out->offset_to_frame +
+                                    sizeof(unsigned char));
+          buffer->nFilledLen = (OMX_U32)(nReadbytes - buffer->nOffset);
           ts += FRAMEDURATION;
           buffer->nTimeStamp = ts;
           nTimestamp = buffer->nTimeStamp;
@@ -4095,7 +4096,7 @@
           {
               DEBUG_PRINT("FTBP:Post the FBD to event thread currstate=%d\n",\
                             state);
-              post_output((unsigned) & hComp,(unsigned) buffer,
+              post_output((unsigned long) & hComp,(unsigned long) buffer,
                             OMX_COMPONENT_GENERATE_FRAME_DONE);
           }
           else
@@ -4160,8 +4161,8 @@
     m_amr_pb_stats.ftb_cnt++;
     DEBUG_DETAIL("FTB:nNumOutputBuf is %d", nNumOutputBuf);
     pthread_mutex_unlock(&out_buf_count_lock);
-    post_output((unsigned)hComp,
-                (unsigned) buffer,OMX_COMPONENT_GENERATE_FTB);
+    post_output((unsigned long)hComp,
+                (unsigned long) buffer,OMX_COMPONENT_GENERATE_FTB);
     return eRet;
 }
 
@@ -4244,11 +4245,11 @@
 {
     DEBUG_PRINT("Component-deinit being processed\n");
     DEBUG_PRINT("********************************\n");
-    DEBUG_PRINT("STATS: in-buf-len[%lu]out-buf-len[%lu] tot-pb-time[%ld]",\
+    DEBUG_PRINT("STATS: in-buf-len[%u]out-buf-len[%u] tot-pb-time[%lld]",\
                 m_amr_pb_stats.tot_in_buf_len,
                 m_amr_pb_stats.tot_out_buf_len,
                 m_amr_pb_stats.tot_pb_time);
-    DEBUG_PRINT("STATS: fbd-cnt[%lu]ftb-cnt[%lu]etb-cnt[%lu]ebd-cnt[%lu]",\
+    DEBUG_PRINT("STATS: fbd-cnt[%u]ftb-cnt[%u]etb-cnt[%u]ebd-cnt[%u]",\
                 m_amr_pb_stats.fbd_cnt,m_amr_pb_stats.ftb_cnt,
                 m_amr_pb_stats.etb_cnt,
                 m_amr_pb_stats.ebd_cnt);
@@ -4390,8 +4391,8 @@
 
     if((hComp == NULL) || (appData == NULL) || (eglImage == NULL))
     {
-        bufferHdr = NULL;
-        port = 0;
+        bufferHdr = bufferHdr;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -4425,8 +4426,8 @@
     }
     if (index == 0 && role)
     {
-        memcpy(role, cmp_role, sizeof(cmp_role));
-        *(((char *) role) + sizeof(cmp_role)) = '\0';
+        memcpy(role, cmp_role, strlen(cmp_role));
+        *(((char *) role) + strlen(cmp_role) +1) = '\0';
     } else
     {
         eRet = OMX_ErrorNoMore;
diff --git a/mm-audio/aenc-amrnb/qdsp6/test/omx_amr_enc_test.c b/mm-audio/aenc-amrnb/qdsp6/test/omx_amr_enc_test.c
index a3c91b1..e509748 100644
--- a/mm-audio/aenc-amrnb/qdsp6/test/omx_amr_enc_test.c
+++ b/mm-audio/aenc-amrnb/qdsp6/test/omx_amr_enc_test.c
@@ -1,6 +1,6 @@
 
 /*--------------------------------------------------------------------------
-Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -84,8 +84,8 @@
 uint32_t channels = 1;
 uint32_t bandmode = 7;
 uint32_t dtxenable = 0;
-uint32_t rectime = -1;
-uint32_t recpath = -1;
+uint32_t rectime = 0;
+uint32_t recpath = 0;
 uint32_t pcmplayback = 0;
 uint32_t tunnel      = 0;
 uint32_t format = 1;
@@ -208,14 +208,14 @@
         unsigned int s_data;
 } __attribute__ ((packed));
 
-static unsigned totaldatalen = 0;
-static unsigned framecnt = 0;
+static int totaldatalen = 0;
+static int framecnt = 0;
 /************************************************************************/
 /*                GLOBAL INIT                    */
 /************************************************************************/
 
-int input_buf_cnt = 0;
-int output_buf_cnt = 0;
+unsigned int input_buf_cnt = 0;
+unsigned int output_buf_cnt = 0;
 int used_ip_buf_cnt = 0;
 volatile int event_is_done = 0;
 volatile int ebd_event_is_done = 0;
@@ -256,7 +256,7 @@
 static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *amr_enc_handle,
                                        OMX_BUFFERHEADERTYPE  ***pBufHdrs,
                                        OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize);
+                                       unsigned int bufCntMin, unsigned int bufSize);
 
 
 static OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
@@ -329,7 +329,7 @@
     (void)pEventData;
     switch(eEvent) {
         case OMX_EventCmdComplete:
-        DEBUG_PRINT("\n OMX_EventCmdComplete event=%d data1=%lu data2=%lu\n",(OMX_EVENTTYPE)eEvent,
+        DEBUG_PRINT("\n OMX_EventCmdComplete event=%d data1=%u data2=%u\n",(OMX_EVENTTYPE)eEvent,
                                                                                nData1,nData2);
             event_complete();
         break;
@@ -356,8 +356,8 @@
                               OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
 {
     size_t bytes_writen = 0;
-    int total_bytes_writen = 0;
-    unsigned int len = 0;
+    size_t total_bytes_writen = 0;
+    size_t len = 0;
     struct enc_meta_out *meta = NULL;
     OMX_U8 *src = pBuffer->pBuffer;
     unsigned int num_of_frames = 1;
@@ -404,8 +404,8 @@
             num_of_frames--;
             total_bytes_writen += len;
         }
-        DEBUG_PRINT(" FillBufferDone size writen to file  %d count %d\n",total_bytes_writen, framecnt);
-        totaldatalen += total_bytes_writen ;
+        DEBUG_PRINT(" FillBufferDone size writen to file  %zu count %d\n",total_bytes_writen, framecnt);
+        totaldatalen = totaldatalen + (int)total_bytes_writen;
     framecnt++;
 
         DEBUG_PRINT(" FBD calling FTB\n");
@@ -457,7 +457,7 @@
     }
 
     if((readBytes = Read_Buffer(pBuffer)) > 0) {
-        pBuffer->nFilledLen = readBytes;
+        pBuffer->nFilledLen = (OMX_U32)readBytes;
         used_ip_buf_cnt++;
         OMX_EmptyThisBuffer(hComponent,pBuffer);
     }
@@ -494,7 +494,7 @@
 
 int main(int argc, char **argv)
 {
-     int bufCnt=0;
+     unsigned int bufCnt=0;
      OMX_ERRORTYPE result;
 
     struct sigaction sa;
@@ -516,11 +516,11 @@
     if (argc >= 8) {
         in_filename = argv[1];
           out_filename = argv[2];
-    tunnel =  atoi(argv[3]);
-        bandmode  = atoi(argv[4]);
-        dtxenable  = atoi(argv[5]);
-        recpath      = atoi(argv[6]); // No configuration support yet..
-        rectime      = atoi(argv[7]);
+    tunnel =  (uint32_t)atoi(argv[3]);
+        bandmode  = (uint32_t)atoi(argv[4]);
+        dtxenable  = (uint32_t)atoi(argv[5]);
+        recpath      = (uint32_t)atoi(argv[6]); // No configuration support yet..
+        rectime      = (uint32_t)atoi(argv[7]);
 
     } else {
           DEBUG_PRINT(" invalid format: \n");
@@ -690,7 +690,7 @@
     /* Query for audio decoders*/
     DEBUG_PRINT("Amr_test: Before entering OMX_GetComponentOfRole");
     OMX_GetComponentsOfRole(role, &total, 0);
-    DEBUG_PRINT ("\nTotal components of role=%s :%lu", role, total);
+    DEBUG_PRINT ("\nTotal components of role=%s :%u", role, total);
 
 
     omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&amr_enc_handle),
@@ -715,8 +715,8 @@
     }
     else
     {
-        DEBUG_PRINT("\nportParam.nPorts:%lu\n", portParam.nPorts);
-    DEBUG_PRINT("\nportParam.nStartPortNumber:%lu\n",
+        DEBUG_PRINT("\nportParam.nPorts:%u\n", portParam.nPorts);
+    DEBUG_PRINT("\nportParam.nStartPortNumber:%u\n",
                                              portParam.nStartPortNumber);
     }
 
@@ -730,12 +730,16 @@
 
 int Play_Encoder()
 {
-    int i;
+    unsigned int i;
     int Size=0;
     DEBUG_PRINT("Inside %s \n", __FUNCTION__);
     OMX_ERRORTYPE ret;
     OMX_INDEXTYPE index;
+#ifdef __LP64__
+    DEBUG_PRINT("sizeof[%ld]\n", sizeof(OMX_BUFFERHEADERTYPE));
+#else
     DEBUG_PRINT("sizeof[%d]\n", sizeof(OMX_BUFFERHEADERTYPE));
+#endif
 
     /* open the i/p and o/p files based on the video file format passed */
     if(open_audio_file()) {
@@ -750,8 +754,8 @@
     inputportFmt.nPortIndex = portParam.nStartPortNumber;
 
     OMX_GetParameter(amr_enc_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-    DEBUG_PRINT ("\nEnc Input Buffer Count %lu\n", inputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nEnc: Input Buffer Size %lu\n", inputportFmt.nBufferSize);
+    DEBUG_PRINT ("\nEnc Input Buffer Count %u\n", inputportFmt.nBufferCountMin);
+    DEBUG_PRINT ("\nEnc: Input Buffer Size %u\n", inputportFmt.nBufferSize);
 
     if(OMX_DirInput != inputportFmt.eDir) {
         DEBUG_PRINT ("\nEnc: Expect Input Port\n");
@@ -770,8 +774,8 @@
     outputportFmt.nPortIndex = portParam.nStartPortNumber + 1;
 
     OMX_GetParameter(amr_enc_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-    DEBUG_PRINT ("\nEnc: Output Buffer Count %lu\n", outputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nEnc: Output Buffer Size %lu\n", outputportFmt.nBufferSize);
+    DEBUG_PRINT ("\nEnc: Output Buffer Count %u\n", outputportFmt.nBufferCountMin);
+    DEBUG_PRINT ("\nEnc: Output Buffer Size %u\n", outputportFmt.nBufferSize);
 
     if(OMX_DirOutput != outputportFmt.eDir) {
         DEBUG_PRINT ("\nEnc: Expect Output Port\n");
@@ -861,7 +865,7 @@
     for(i=0; i < output_buf_cnt; i++) {
         DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
         pOutputBufHdrs[i]->nOutputPortIndex = 1;
-        pOutputBufHdrs[i]->nFlags &= ~OMX_BUFFERFLAG_EOS;
+        pOutputBufHdrs[i]->nFlags = pOutputBufHdrs[i]->nFlags & (unsigned)~OMX_BUFFERFLAG_EOS;
         ret = OMX_FillThisBuffer(amr_enc_handle, pOutputBufHdrs[i]);
         if (OMX_ErrorNone != ret) {
             DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
@@ -883,7 +887,7 @@
           bInputEosReached = true;
           pInputBufHdrs[i]->nFlags= OMX_BUFFERFLAG_EOS;
         }
-        pInputBufHdrs[i]->nFilledLen = Size;
+        pInputBufHdrs[i]->nFilledLen = (OMX_U32)Size;
         pInputBufHdrs[i]->nInputPortIndex = 0;
         used_ip_buf_cnt++;
         ret = OMX_EmptyThisBuffer(amr_enc_handle, pInputBufHdrs[i]);
@@ -921,11 +925,11 @@
 static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *avc_enc_handle,
                                        OMX_BUFFERHEADERTYPE  ***pBufHdrs,
                                        OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize)
+                                       unsigned int bufCntMin, unsigned int bufSize)
 {
     DEBUG_PRINT("Inside %s \n", __FUNCTION__);
     OMX_ERRORTYPE error=OMX_ErrorNone;
-    long bufCnt=0;
+    unsigned int bufCnt=0;
 
     /* To remove warning for unused variable to keep prototype same */
     (void)avc_enc_handle;
@@ -933,7 +937,7 @@
                    malloc(sizeof(OMX_BUFFERHEADERTYPE*)*bufCntMin);
 
     for(bufCnt=0; bufCnt < bufCntMin; ++bufCnt) {
-        DEBUG_PRINT("\n OMX_AllocateBuffer No %ld \n", bufCnt);
+        DEBUG_PRINT("\n OMX_AllocateBuffer No %d \n", bufCnt);
         error = OMX_AllocateBuffer(amr_enc_handle, &((*pBufHdrs)[bufCnt]),
                                    nPortIndex, NULL, bufSize);
     }
@@ -947,7 +951,7 @@
 static int Read_Buffer (OMX_BUFFERHEADERTYPE  *pBufHdr )
 {
 
-    int bytes_read=0;
+    size_t bytes_read=0;
 
 
     pBufHdr->nFilledLen = 0;
@@ -955,11 +959,11 @@
 
      bytes_read = fread(pBufHdr->pBuffer, 1, pBufHdr->nAllocLen , inputBufferFile);
 
-      pBufHdr->nFilledLen = bytes_read;
+      pBufHdr->nFilledLen = (OMX_U32)bytes_read;
       // Time stamp logic
     ((OMX_BUFFERHEADERTYPE *)pBufHdr)->nTimeStamp = \
 
-    (unsigned long) ((total_pcm_bytes * 1000)/(samplerate * channels *2));
+    (OMX_TICKS) ((total_pcm_bytes * 1000)/(samplerate * channels *2));
 
        DEBUG_PRINT ("\n--time stamp -- %ld\n",  (unsigned long)((OMX_BUFFERHEADERTYPE *)pBufHdr)->nTimeStamp);
         if(bytes_read == 0)
@@ -969,12 +973,12 @@
         }
         else
         {
-            pBufHdr->nFlags &= ~OMX_BUFFERFLAG_EOS;
+            pBufHdr->nFlags = pBufHdr->nFlags & (unsigned)~OMX_BUFFERFLAG_EOS;
 
-            total_pcm_bytes += bytes_read;
+            total_pcm_bytes = (unsigned)(total_pcm_bytes + bytes_read);
         }
 
-    return bytes_read;;
+    return (int)bytes_read;;
 }
 
 
diff --git a/mm-audio/aenc-evrc/Android.mk b/mm-audio/aenc-evrc/Android.mk
index 649f860..09c9ebd 100644
--- a/mm-audio/aenc-evrc/Android.mk
+++ b/mm-audio/aenc-evrc/Android.mk
@@ -1,5 +1,4 @@
-ifeq ($(TARGET_ARCH),arm)
-
+ifneq ($(filter arm aarch64 arm64, $(TARGET_ARCH)),)
 
 AENC_EVRC_PATH:= $(call my-dir)
 
@@ -27,5 +26,8 @@
 ifeq ($(call is-board-platform,msm8916),true)
 include $(AENC_EVRC_PATH)/qdsp6/Android.mk
 endif
+ifeq ($(call is-board-platform,msm8994),true)
+include $(AENC_EVRC_PATH)/qdsp6/Android.mk
+endif
 
 endif
diff --git a/mm-audio/aenc-evrc/qdsp6/Android.mk b/mm-audio/aenc-evrc/qdsp6/Android.mk
index d38d004..98d95b1 100644
--- a/mm-audio/aenc-evrc/qdsp6/Android.mk
+++ b/mm-audio/aenc-evrc/qdsp6/Android.mk
@@ -13,6 +13,7 @@
 libOmxEvrcEnc-def += -D_ENABLE_QC_MSG_LOG_
 libOmxEvrcEnc-def += -DVERBOSE
 libOmxEvrcEnc-def += -D_DEBUG
+libOmxEvrcEnc-def += -Wconversion
 ifeq ($(strip $(TARGET_USES_QCOM_MM_AUDIO)),true)
 libOmxEvrcEnc-def += -DAUDIOV2
 endif
diff --git a/mm-audio/aenc-evrc/qdsp6/inc/omx_evrc_aenc.h b/mm-audio/aenc-evrc/qdsp6/inc/omx_evrc_aenc.h
index fa83230..09ffb2d 100644
--- a/mm-audio/aenc-evrc/qdsp6/inc/omx_evrc_aenc.h
+++ b/mm-audio/aenc-evrc/qdsp6/inc/omx_evrc_aenc.h
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
+Copyright (c) 2010,2014 The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -81,10 +81,10 @@
 
 
 #define PrintFrameHdr(i,bufHdr) \
-                           DEBUG_PRINT("i=%d OMX bufHdr[%x]buf[%x]size[%d]TS[%lld]nFlags[0x%x]\n",\
+                           DEBUG_PRINT("i=%d OMX bufHdr[%p]buf[%p]size[%d]TS[%lld]nFlags[0x%x]\n",\
                            i,\
-                           (unsigned) bufHdr,                                     \
-                           (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,   \
+                           bufHdr,                                     \
+                           ((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,   \
                            (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFilledLen,\
                            ((OMX_BUFFERHEADERTYPE *)bufHdr)->nTimeStamp, \
                            (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFlags)
@@ -245,7 +245,7 @@
                                 void *                  eglImage);
 
     bool post_command(unsigned int p1, unsigned int p2,
-        unsigned int id);
+        unsigned char id);
 
     // Deferred callback identifiers
     enum
@@ -304,9 +304,9 @@
 
     struct omx_event
     {
-        unsigned param1;
-        unsigned param2;
-        unsigned id;
+        unsigned long param1;
+        unsigned long param2;
+        unsigned char id;
     };
 
     struct omx_cmd_queue
@@ -318,16 +318,16 @@
 
         omx_cmd_queue();
         ~omx_cmd_queue();
-        bool insert_entry(unsigned p1, unsigned p2, unsigned id);
-        bool pop_entry(unsigned *p1,unsigned *p2, unsigned *id);
-        bool get_msg_id(unsigned *id);
-        bool get_msg_with_id(unsigned *p1,unsigned *p2, unsigned id);
+        bool insert_entry(unsigned long p1, unsigned long p2, unsigned char id);
+        bool pop_entry(unsigned long *p1,unsigned long *p2, unsigned char *id);
+        bool get_msg_id(unsigned char *id);
+        bool get_msg_with_id(unsigned *p1,unsigned *p2, unsigned char id);
     };
 
     typedef struct TIMESTAMP
     {
-        unsigned long LowPart;
-        unsigned long HighPart;
+        unsigned int LowPart;
+        unsigned int HighPart;
     }__attribute__((packed)) TIMESTAMP;
 
     typedef struct metadata_input
@@ -351,7 +351,7 @@
     {
         OMX_U32 tot_in_buf_len;
         OMX_U32 tot_out_buf_len;
-        OMX_U32 tot_pb_time;
+        OMX_TICKS tot_pb_time;
         OMX_U32 fbd_cnt;
         OMX_U32 ftb_cnt;
         OMX_U32 etb_cnt;
@@ -376,7 +376,7 @@
     bool                           is_in_th_sleep;
     bool                           is_out_th_sleep;
     unsigned int                   m_flags;      //encapsulate the waiting states.
-    unsigned int                   nTimestamp;
+    OMX_TICKS                      nTimestamp;
     unsigned int                   pcm_input; //tunnel or non-tunnel
     unsigned int                   m_inp_act_buf_count;    // Num of Input Buffers
     unsigned int                   m_out_act_buf_count;    // Numb of Output Buffers
@@ -508,11 +508,11 @@
 
     bool search_output_bufhdr(OMX_BUFFERHEADERTYPE *buffer);
 
-    bool post_input(unsigned int p1, unsigned int p2,
-                    unsigned int id);
+    bool post_input(unsigned long p1, unsigned long p2,
+                    unsigned char id);
 
-    bool post_output(unsigned int p1, unsigned int p2,
-                     unsigned int id);
+    bool post_output(unsigned long p1, unsigned long p2,
+                     unsigned char id);
 
     void process_events(omx_evrc_aenc *client_data);
 
diff --git a/mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp b/mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp
index 073f1ac..d19320f 100644
--- a/mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp
+++ b/mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
+Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -57,9 +57,9 @@
 }
 
 // omx cmd queue insert
-bool omx_evrc_aenc::omx_cmd_queue::insert_entry(unsigned p1,
-                                                unsigned p2,
-                                                unsigned id)
+bool omx_evrc_aenc::omx_cmd_queue::insert_entry(unsigned long p1,
+                                                unsigned long p2,
+                                                unsigned char id)
 {
     bool ret = true;
     if (m_size < OMX_CORE_CONTROL_CMDQ_SIZE)
@@ -81,8 +81,8 @@
     return ret;
 }
 
-bool omx_evrc_aenc::omx_cmd_queue::pop_entry(unsigned *p1,
-                                             unsigned *p2, unsigned *id)
+bool omx_evrc_aenc::omx_cmd_queue::pop_entry(unsigned long *p1,
+                                 unsigned long *p2, unsigned char *id)
 {
     bool ret = true;
     if (m_size > 0)
@@ -111,7 +111,7 @@
 {
     return(new omx_evrc_aenc);
 }
-bool omx_evrc_aenc::omx_cmd_queue::get_msg_id(unsigned *id)
+bool omx_evrc_aenc::omx_cmd_queue::get_msg_id(unsigned char *id)
 {
    if(m_size > 0)
    {
@@ -256,7 +256,10 @@
         m_tmp_out_meta_buf(NULL),
         m_flush_cnt(255),
         m_comp_deinit(0),
+        m_volume(25),
         m_app_data(NULL),
+        nNumInputBuf(0),
+        nNumOutputBuf(0),
         m_drv_fd(-1),
         bFlushinprogress(0),
         is_in_th_sleep(false),
@@ -267,7 +270,7 @@
         m_out_act_buf_count (OMX_CORE_NUM_OUTPUT_BUFFERS),
         m_inp_current_buf_count(0),
         m_out_current_buf_count(0),
-        output_buffer_size(OMX_EVRC_OUTPUT_BUFFER_SIZE),
+        output_buffer_size((OMX_U32)OMX_EVRC_OUTPUT_BUFFER_SIZE),
         input_buffer_size(OMX_CORE_INPUT_BUFFER_SIZE),
         m_inp_bEnabled(OMX_TRUE),
         m_out_bEnabled(OMX_TRUE),
@@ -277,10 +280,7 @@
         m_state(OMX_StateInvalid),
         m_ipc_to_in_th(NULL),
         m_ipc_to_out_th(NULL),
-        m_ipc_to_cmd_th(NULL),
-        nNumOutputBuf(0),
-        nNumInputBuf(0),
-        m_volume(25)
+        m_ipc_to_cmd_th(NULL)
 {
     int cond_ret = 0;
     memset(&m_cmp, 0, sizeof(m_cmp));
@@ -500,13 +500,13 @@
         m_evrc_pb_stats.fbd_cnt++;
         pthread_mutex_lock(&out_buf_count_lock);
         nNumOutputBuf--;
-        DEBUG_PRINT("FBD CB:: nNumOutputBuf=%d out_buf_len=%lu fbd_cnt=%lu\n",\
+        DEBUG_PRINT("FBD CB:: nNumOutputBuf=%d out_buf_len=%u fbd_cnt=%u\n",\
                     nNumOutputBuf,
                     m_evrc_pb_stats.tot_out_buf_len,
                     m_evrc_pb_stats.fbd_cnt);
         m_evrc_pb_stats.tot_out_buf_len += bufHdr->nFilledLen;
         m_evrc_pb_stats.tot_pb_time     = bufHdr->nTimeStamp;
-        DEBUG_PRINT("FBD:in_buf_len=%lu out_buf_len=%lu\n",
+        DEBUG_PRINT("FBD:in_buf_len=%u out_buf_len=%u\n",
                     m_evrc_pb_stats.tot_in_buf_len,
                     m_evrc_pb_stats.tot_out_buf_len);
 
@@ -540,9 +540,9 @@
 =============================================================================*/
 void omx_evrc_aenc::process_out_port_msg(void *client_data, unsigned char id)
 {
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize     = 0;                 // qsize
     unsigned      tot_qsize = 0;
     omx_evrc_aenc  *pThis    = (omx_evrc_aenc *) client_data;
@@ -744,9 +744,9 @@
 =============================================================================*/
 void omx_evrc_aenc::process_command_msg(void *client_data, unsigned char id)
 {
-    unsigned     p1;                             // Parameter - 1
-    unsigned     p2;                             // Parameter - 2
-    unsigned     ident;
+    unsigned long p1 = 0;                             // Parameter - 1
+    unsigned long p2 = 0;                             // Parameter - 2
+    unsigned char ident = 0;
     unsigned     qsize  = 0;
     omx_evrc_aenc *pThis = (omx_evrc_aenc*)client_data;
     pthread_mutex_lock(&pThis->m_commandlock);
@@ -818,15 +818,15 @@
                 pThis->m_cb.EventHandler(&pThis->m_cmp,
                                          pThis->m_app_data,
                                          OMX_EventError,
-                                         p2,
-                                         NULL,
-                                         NULL );
+                                         (OMX_U32)p2,
+                                         0,
+                                         0 );
             } else
             {
                 pThis->m_cb.EventHandler(&pThis->m_cmp,
                                          pThis->m_app_data,
                                          OMX_EventCmdComplete,
-                                         p1, p2, NULL );
+                                         (OMX_U32)p1, (OMX_U32)p2, NULL );
             }
         } else
         {
@@ -874,9 +874,9 @@
 =============================================================================*/
 void omx_evrc_aenc::process_in_port_msg(void *client_data, unsigned char id)
 {
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize     = 0;
     unsigned      tot_qsize = 0;
     omx_evrc_aenc  *pThis    = (omx_evrc_aenc *) client_data;
@@ -1054,7 +1054,7 @@
     randomly assign the value right now. Query will result in
     incorrect param */
     memset(&m_evrc_param, 0, sizeof(m_evrc_param));
-    m_evrc_param.nSize = sizeof(m_evrc_param);
+    m_evrc_param.nSize = (OMX_U32)sizeof(m_evrc_param);
     m_evrc_param.nChannels = OMX_EVRC_DEFAULT_CH_CFG;
     //Current DSP does not have config
     m_evrc_param.eCDMARate = OMX_AUDIO_CDMARateFull;
@@ -1063,7 +1063,7 @@
     m_volume = OMX_EVRC_DEFAULT_VOL;             /* Close to unity gain */
     memset(&m_evrc_pb_stats,0,sizeof(EVRC_PB_STATS));
     memset(&m_pcm_param, 0, sizeof(m_pcm_param));
-    m_pcm_param.nSize = sizeof(m_pcm_param);
+    m_pcm_param.nSize = (OMX_U32)sizeof(m_pcm_param);
     m_pcm_param.nChannels = OMX_EVRC_DEFAULT_CH_CFG;
     m_pcm_param.nSamplingRate = OMX_EVRC_DEFAULT_SF;
     nTimestamp = 0;
@@ -1094,20 +1094,20 @@
     if (!strcmp(role,"OMX.qcom.audio.encoder.evrc"))
     {
         pcm_input = 1;
-        component_Role.nSize = sizeof(role);
+        component_Role.nSize = (OMX_U32)sizeof(role);
         strlcpy((char *)component_Role.cRole,
 		(const char*)role, sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED \n", role);
     } else if (!strcmp(role,"OMX.qcom.audio.encoder.tunneled.evrc"))
     {
         pcm_input = 0;
-        component_Role.nSize = sizeof(role);
+        component_Role.nSize = (OMX_U32)sizeof(role);
         strlcpy((char *)component_Role.cRole,
 		(const char*)role, sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED \n", role);
     } else
     {
-        component_Role.nSize = sizeof("\0");
+        component_Role.nSize = (OMX_U32)sizeof("\0");
         strlcpy((char *)component_Role.cRole,
 		(const char*)"\0",sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED is invalid\n", role);
@@ -1253,7 +1253,7 @@
 
     if(hComp == NULL)
     {
-        cmdData = NULL;
+        cmdData = cmdData;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -1267,7 +1267,7 @@
     }
     post_command((unsigned)cmd,(unsigned)param1,OMX_COMPONENT_GENERATE_COMMAND);
     DEBUG_PRINT("Send Command : returns with OMX_ErrorNone \n");
-    DEBUG_PRINT("send_command : recieved state before semwait= %lu\n",param1);
+    DEBUG_PRINT("send_command : recieved state before semwait= %u\n",param1);
     sem_wait (&sem_States);
     DEBUG_PRINT("send_command : recieved state after semwait\n");
     return OMX_ErrorNone;
@@ -1297,7 +1297,7 @@
 
     if(hComp == NULL)
     {
-        cmdData = NULL;
+        cmdData = cmdData;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -1462,7 +1462,7 @@
                     }
                     pcm_cfg.channel_count = m_pcm_param.nChannels;
                     pcm_cfg.sample_rate  =  m_pcm_param.nSamplingRate;
-                    DEBUG_PRINT("pcm config %lu %lu\n",m_pcm_param.nChannels,
+                    DEBUG_PRINT("pcm config %u %u\n",m_pcm_param.nChannels,
 				m_pcm_param.nSamplingRate);
 
                     if (ioctl(m_drv_fd, AUDIO_SET_CONFIG, &pcm_cfg) == -1)
@@ -1725,7 +1725,7 @@
     } else if (OMX_CommandFlush == cmd)
     {
         DEBUG_DETAIL("*************************\n");
-        DEBUG_PRINT("SCP-->RXED FLUSH COMMAND port=%lu\n",param1);
+        DEBUG_PRINT("SCP-->RXED FLUSH COMMAND port=%u\n",param1);
         DEBUG_DETAIL("*************************\n");
         bFlag = 0;
         if ( param1 == OMX_CORE_INPUT_PORT_INDEX ||
@@ -1764,7 +1764,7 @@
                 if (m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
                 {
                     DEBUG_PRINT("SCP: execute_omx_flush in Disable in "\
-                                " param1=%lu m_state=%d \n",param1, m_state);
+                                " param1=%u m_state=%d \n",param1, m_state);
                     execute_omx_flush(param1);
                 }
                 DEBUG_PRINT("send_command_proxy:OMX_CommandPortDisable:\
@@ -1796,7 +1796,7 @@
                 if (m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
                 {
                     DEBUG_PRINT("SCP: execute_omx_flush in Disable out "\
-                                "param1=%lu m_state=%d \n",param1, m_state);
+                                "param1=%u m_state=%d \n",param1, m_state);
                     execute_omx_flush(param1);
                 }
                 BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_DISABLE_PENDING);
@@ -1913,7 +1913,7 @@
 {
     bool bRet = true;
 
-    DEBUG_PRINT("Execute_omx_flush Port[%lu]", param1);
+    DEBUG_PRINT("Execute_omx_flush Port[%u]", param1);
     struct timespec abs_timeout;
     abs_timeout.tv_sec = 1;
     abs_timeout.tv_nsec = 0;
@@ -1963,7 +1963,7 @@
         DEBUG_DETAIL("WAITING FOR FLUSH ACK's param1=%d",param1);
         wait_for_event();
 
-        DEBUG_PRINT("RECIEVED BOTH FLUSH ACK's param1=%lu cmd_cmpl=%d",\
+        DEBUG_PRINT("RECIEVED BOTH FLUSH ACK's param1=%u cmd_cmpl=%d",\
                     param1,cmd_cmpl);
 
         // If not going to idle state, Send FLUSH complete message
@@ -2077,7 +2077,7 @@
         DEBUG_DETAIL("RECIEVED FLUSH ACK FOR O/P PORT param1=%d",param1);
     } else
     {
-        DEBUG_PRINT("Invalid Port ID[%lu]",param1);
+        DEBUG_PRINT("Invalid Port ID[%u]",param1);
     }
     return bRet;
 }
@@ -2105,9 +2105,9 @@
 bool omx_evrc_aenc::execute_input_omx_flush()
 {
     OMX_BUFFERHEADERTYPE *omx_buf;
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize=0;                       // qsize
     unsigned      tot_qsize=0;                   // qsize
 
@@ -2185,9 +2185,9 @@
 bool omx_evrc_aenc::execute_output_omx_flush()
 {
     OMX_BUFFERHEADERTYPE *omx_buf;
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1;                            // Parameter - 1
+    unsigned long p2;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize=0;                       // qsize
     unsigned      tot_qsize=0;                   // qsize
 
@@ -2268,9 +2268,9 @@
 SIDE EFFECTS:
   None
 =============================================================================*/
-bool omx_evrc_aenc::post_input(unsigned int p1,
-                               unsigned int p2,
-                               unsigned int id)
+bool omx_evrc_aenc::post_input(unsigned long p1,
+                               unsigned long p2,
+                               unsigned char id)
 {
     bool bRet = false;
     pthread_mutex_lock(&m_lock);
@@ -2331,7 +2331,7 @@
 =============================================================================*/
 bool omx_evrc_aenc::post_command(unsigned int p1,
                                  unsigned int p2,
-                                 unsigned int id)
+                                 unsigned char id)
 {
     bool bRet  = false;
 
@@ -2378,9 +2378,9 @@
 SIDE EFFECTS:
   None
 =============================================================================*/
-bool omx_evrc_aenc::post_output(unsigned int p1,
-                                unsigned int p2,
-                                unsigned int id)
+bool omx_evrc_aenc::post_output(unsigned long p1,
+                                unsigned long p2,
+                                unsigned char id)
 {
     bool bRet = false;
 
@@ -2444,7 +2444,7 @@
         return OMX_ErrorBadParameter;
     }
 
-    switch (paramIndex)
+    switch ((int)paramIndex)
     {
         case OMX_IndexParamPortDefinition:
             {
@@ -2452,11 +2452,11 @@
                 portDefn = (OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
 
                 DEBUG_PRINT("OMX_IndexParamPortDefinition " \
-                            "portDefn->nPortIndex = %lu\n",
+                            "portDefn->nPortIndex = %u\n",
 				portDefn->nPortIndex);
 
                 portDefn->nVersion.nVersion = OMX_SPEC_VERSION;
-                portDefn->nSize = sizeof(portDefn);
+                portDefn->nSize = (OMX_U32)sizeof(portDefn);
                 portDefn->eDomain    = OMX_PortDomainAudio;
 
                 if (0 == portDefn->nPortIndex)
@@ -2498,7 +2498,7 @@
                 DEBUG_PRINT("OMX_IndexParamAudioInit\n");
 
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 2;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2510,7 +2510,7 @@
                 (OMX_AUDIO_PARAM_PORTFORMATTYPE *) paramData;
                 DEBUG_PRINT("OMX_IndexParamAudioPortFormat\n");
                 portFormatType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portFormatType->nSize = sizeof(portFormatType);
+                portFormatType->nSize = (OMX_U32)sizeof(portFormatType);
 
                 if (OMX_CORE_INPUT_PORT_INDEX == portFormatType->nPortIndex)
                 {
@@ -2520,7 +2520,7 @@
 				portFormatType->nPortIndex)
                 {
                     DEBUG_PRINT("get_parameter: OMX_IndexParamAudioFormat: "\
-                                "%lu\n", portFormatType->nIndex);
+                                "%u\n", portFormatType->nIndex);
 
             portFormatType->eEncoding = OMX_AUDIO_CodingEVRC;
                 } else
@@ -2554,7 +2554,7 @@
     {
        QOMX_AUDIO_STREAM_INFO_DATA *streaminfoparam =
                (QOMX_AUDIO_STREAM_INFO_DATA *) paramData;
-       streaminfoparam->sessionId = m_session_id;
+       streaminfoparam->sessionId = (OMX_U8)m_session_id;
        break;
     }
 
@@ -2567,9 +2567,9 @@
                 {
                     memcpy(pcmparam,&m_pcm_param,\
                         sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
-                    DEBUG_PRINT("get_parameter: Sampling rate %lu",\
+                    DEBUG_PRINT("get_parameter: Sampling rate %u",\
                                  pcmparam->nSamplingRate);
-                    DEBUG_PRINT("get_parameter: Number of channels %lu",\
+                    DEBUG_PRINT("get_parameter: Number of channels %u",\
                                  pcmparam->nChannels);
                 } else
                 {
@@ -2594,7 +2594,7 @@
                     (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamVideoInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2604,7 +2604,7 @@
                 OMX_PRIORITYMGMTTYPE *priorityMgmtType =
                 (OMX_PRIORITYMGMTTYPE*)paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamPriorityMgmt\n");
-                priorityMgmtType->nSize = sizeof(priorityMgmtType);
+                priorityMgmtType->nSize = (OMX_U32)sizeof(priorityMgmtType);
                 priorityMgmtType->nVersion.nVersion = OMX_SPEC_VERSION;
                 priorityMgmtType->nGroupID = m_priority_mgm.nGroupID;
                 priorityMgmtType->nGroupPriority =
@@ -2617,7 +2617,7 @@
                 (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamImageInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2632,7 +2632,7 @@
                 DEBUG_PRINT("get_parameter: \
 				OMX_IndexParamCompBufferSupplier\n");
 
-                bufferSupplierType->nSize = sizeof(bufferSupplierType);
+                bufferSupplierType->nSize = (OMX_U32)sizeof(bufferSupplierType);
                 bufferSupplierType->nVersion.nVersion = OMX_SPEC_VERSION;
                 if (OMX_CORE_INPUT_PORT_INDEX   ==
 				bufferSupplierType->nPortIndex)
@@ -2661,7 +2661,7 @@
                     (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamOtherInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2759,7 +2759,7 @@
                     return OMX_ErrorIncorrectStateOperation;
                 }
                 DEBUG_PRINT("OMX_IndexParamPortDefinition portDefn->nPortIndex "
-                            "= %lu\n",portDefn->nPortIndex);
+                            "= %u\n",portDefn->nPortIndex);
                 if (OMX_CORE_INPUT_PORT_INDEX == portDefn->nPortIndex)
                 {
                     if ( portDefn->nBufferCountActual >
@@ -2803,10 +2803,10 @@
                 }
                 OMX_PRIORITYMGMTTYPE *priorityMgmtype
                 = (OMX_PRIORITYMGMTTYPE*) paramData;
-                DEBUG_PRINT("set_parameter: OMX_IndexParamPriorityMgmt %lu\n",
+                DEBUG_PRINT("set_parameter: OMX_IndexParamPriorityMgmt %u\n",
                             priorityMgmtype->nGroupID);
 
-                DEBUG_PRINT("set_parameter: priorityMgmtype %lu\n",
+                DEBUG_PRINT("set_parameter: priorityMgmtype %u\n",
                             priorityMgmtype->nGroupPriority);
 
                 m_priority_mgm.nGroupID = priorityMgmtype->nGroupID;
@@ -2828,7 +2828,7 @@
 					portFormatType->nPortIndex)
                 {
                     DEBUG_PRINT("set_parameter: OMX_IndexParamAudioFormat:"\
-                                " %lu\n", portFormatType->nIndex);
+                                " %u\n", portFormatType->nIndex);
                     portFormatType->eEncoding = OMX_AUDIO_CodingEVRC;
                 } else
                 {
@@ -2876,7 +2876,7 @@
                 {
                     memcpy(&m_pcm_param,pcmparam,\
                         sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
-                    DEBUG_PRINT("set_pcm_parameter: %lu %lu",\
+                    DEBUG_PRINT("set_pcm_parameter: %u %u",\
                                  m_pcm_param.nChannels,
 				m_pcm_param.nSamplingRate);
                 } else
@@ -2954,7 +2954,7 @@
 
                 if (OMX_CORE_INPUT_PORT_INDEX == volume->nPortIndex)
                 {
-                    volume->nSize = sizeof(volume);
+                    volume->nSize = (OMX_U32)sizeof(volume);
                     volume->nVersion.nVersion = OMX_SPEC_VERSION;
                     volume->bLinear = OMX_TRUE;
                     volume->sVolume.nValue = m_volume;
@@ -2974,7 +2974,7 @@
 
                 if (OMX_CORE_INPUT_PORT_INDEX == mute->nPortIndex)
                 {
-                    mute->nSize = sizeof(mute);
+                    mute->nSize = (OMX_U32)sizeof(mute);
                     mute->nVersion.nVersion = OMX_SPEC_VERSION;
                     mute->bMute = (BITMASK_PRESENT(&m_flags,
                                       OMX_COMPONENT_MUTED)?OMX_TRUE:OMX_FALSE);
@@ -3182,8 +3182,8 @@
 
     if((hComp == NULL) || (peerComponent == NULL) || (tunnelSetup == NULL))
     {
-        port = 0;
-        peerPort = 0;
+        port = port;
+        peerPort = peerPort;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3223,7 +3223,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         free(buf_ptr);
         return OMX_ErrorBadParameter;
@@ -3236,7 +3236,7 @@
 
         bufHdr->pBuffer           = (OMX_U8 *)((buf_ptr) + sizeof(META_IN)+
                                                sizeof(OMX_BUFFERHEADERTYPE));
-        bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+        bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
         bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
         bufHdr->nAllocLen         = nBufSize;
         bufHdr->pAppPrivate       = appData;
@@ -3245,7 +3245,7 @@
 
         m_inp_current_buf_count++;
         DEBUG_PRINT("AIB:bufHdr %p bufHdr->pBuffer %p m_inp_buf_cnt=%u \
-			bytes=%lu", bufHdr, bufHdr->pBuffer,
+			bytes=%u", bufHdr, bufHdr->pBuffer,
 			m_inp_current_buf_count, bytes);
 
     } else
@@ -3277,7 +3277,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3293,7 +3293,7 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)((buf_ptr) +
 					sizeof(OMX_BUFFERHEADERTYPE));
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             bufHdr->pAppPrivate       = appData;
@@ -3301,7 +3301,7 @@
             m_output_buf_hdrs.insert(bufHdr, NULL);
             m_out_current_buf_count++;
             DEBUG_PRINT("AOB::bufHdr %p bufHdr->pBuffer %p m_out_buf_cnt=%d "\
-                        "bytes=%lu",bufHdr, bufHdr->pBuffer,\
+                        "bytes=%u",bufHdr, bufHdr->pBuffer,\
                         m_out_current_buf_count, bytes);
         } else
         {
@@ -3515,7 +3515,7 @@
         }
     }
   }
-    DEBUG_PRINT("Use Buffer for port[%lu] eRet[%d]\n", port,eRet);
+    DEBUG_PRINT("Use Buffer for port[%u] eRet[%d]\n", port,eRet);
     return eRet;
 }
 /*=============================================================================
@@ -3558,7 +3558,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3580,8 +3580,8 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)(buffer);
             DEBUG_PRINT("use_input_buffer:bufHdr %p bufHdr->pBuffer %p \
-			bytes=%lu", bufHdr, bufHdr->pBuffer,bytes);
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+			bytes=%u", bufHdr, bufHdr->pBuffer,bytes);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             input_buffer_size         = nBufSize;
@@ -3643,7 +3643,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3669,8 +3669,8 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)(buffer);
             DEBUG_PRINT("use_output_buffer:bufHdr %p bufHdr->pBuffer %p \
-			len=%lu\n", bufHdr, bufHdr->pBuffer,bytes);
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+			len=%u\n", bufHdr, bufHdr->pBuffer,bytes);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             output_buffer_size        = nBufSize;
@@ -3769,7 +3769,7 @@
                (m_out_bEnabled == OMX_FALSE &&
 		port == OMX_CORE_OUTPUT_PORT_INDEX))
     {
-        DEBUG_PRINT("Free Buffer while port %lu disabled\n", port);
+        DEBUG_PRINT("Free Buffer while port %u disabled\n", port);
     } else if (m_state == OMX_StateExecuting || m_state == OMX_StatePause)
     {
         DEBUG_PRINT("Invalid state to free buffer,ports need to be disabled:\
@@ -3903,7 +3903,7 @@
 {
     OMX_ERRORTYPE eRet = OMX_ErrorNone;
 
-    DEBUG_PRINT("ETB:Buf:%p Len %lu TS %lld numInBuf=%d\n", \
+    DEBUG_PRINT("ETB:Buf:%p Len %u TS %lld numInBuf=%d\n", \
                 buffer, buffer->nFilledLen, buffer->nTimeStamp, (nNumInputBuf));
     if (m_state == OMX_StateInvalid)
     {
@@ -3941,11 +3941,11 @@
     {
         if (search_input_bufhdr(buffer) == true)
         {
-            post_input((unsigned)hComp,
-                       (unsigned) buffer,OMX_COMPONENT_GENERATE_ETB);
+            post_input((unsigned long)hComp,
+                       (unsigned long) buffer,OMX_COMPONENT_GENERATE_ETB);
         } else
         {
-            DEBUG_PRINT_ERROR("Bad header %x \n", (int)buffer);
+            DEBUG_PRINT_ERROR("Bad header %p \n", buffer);
             eRet = OMX_ErrorBadParameter;
         }
     }
@@ -3987,11 +3987,11 @@
         data = m_tmp_meta_buf;
 
         // copy the metadata info from the BufHdr and insert to payload
-        meta_in.offsetVal  = sizeof(META_IN);
+        meta_in.offsetVal  = (OMX_U16)sizeof(META_IN);
         meta_in.nTimeStamp.LowPart =
-           ((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp)& 0xFFFFFFFF);
+          (unsigned int) ((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) & 0xFFFFFFFF);
         meta_in.nTimeStamp.HighPart =
-           (((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) >> 32) & 0xFFFFFFFF);
+          (unsigned int) (((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) >> 32) & 0xFFFFFFFF);
         meta_in.nFlags &= ~OMX_BUFFERFLAG_EOS;
         if(buffer->nFlags & OMX_BUFFERFLAG_EOS)
         {
@@ -4018,7 +4018,7 @@
         /* Assume empty this buffer function has already checked
         validity of buffer */
         DEBUG_PRINT("Empty buffer %p to kernel driver\n", buffer);
-        post_input((unsigned) & hComp,(unsigned) buffer,
+        post_input((unsigned long) & hComp,(unsigned long) buffer,
                    OMX_COMPONENT_GENERATE_BUFFER_DONE);
     }
     return OMX_ErrorNone;
@@ -4031,7 +4031,7 @@
 {
     OMX_STATETYPE state;
     ENC_META_OUT *meta_out = NULL;
-    int nReadbytes = 0;
+    ssize_t nReadbytes = 0;
 
     pthread_mutex_lock(&m_state_lock);
     get_state(&m_cmp, &state);
@@ -4061,8 +4061,9 @@
           buffer->nTimeStamp = (((OMX_TICKS) meta_out->msw_ts << 32)+
 				meta_out->lsw_ts);
           buffer->nFlags |= meta_out->nflags;
-          buffer->nOffset =  meta_out->offset_to_frame + sizeof(unsigned char);
-          buffer->nFilledLen = nReadbytes - buffer->nOffset;
+          buffer->nOffset =  (OMX_U32)(meta_out->offset_to_frame +
+                                            sizeof(unsigned char));
+          buffer->nFilledLen = (OMX_U32)(nReadbytes - buffer->nOffset);
           nTimestamp = buffer->nTimeStamp;
           DEBUG_PRINT("nflags %d frame_size %d offset_to_frame %d \
 			timestamp %lld\n", meta_out->nflags,
@@ -4096,7 +4097,7 @@
           {
               DEBUG_PRINT("FTBP:Post the FBD to event thread currstate=%d\n",\
                             state);
-              post_output((unsigned) & hComp,(unsigned) buffer,
+              post_output((unsigned long) & hComp,(unsigned long) buffer,
                             OMX_COMPONENT_GENERATE_FRAME_DONE);
           }
           else
@@ -4161,8 +4162,8 @@
     m_evrc_pb_stats.ftb_cnt++;
     DEBUG_DETAIL("FTB:nNumOutputBuf is %d", nNumOutputBuf);
     pthread_mutex_unlock(&out_buf_count_lock);
-    post_output((unsigned)hComp,
-                (unsigned) buffer,OMX_COMPONENT_GENERATE_FTB);
+    post_output((unsigned long)hComp,
+                (unsigned long) buffer,OMX_COMPONENT_GENERATE_FTB);
     return eRet;
 }
 
@@ -4245,11 +4246,11 @@
 {
     DEBUG_PRINT("Component-deinit being processed\n");
     DEBUG_PRINT("********************************\n");
-    DEBUG_PRINT("STATS: in-buf-len[%lu]out-buf-len[%lu] tot-pb-time[%ld]",\
+    DEBUG_PRINT("STATS: in-buf-len[%u]out-buf-len[%u] tot-pb-time[%lld]",\
                 m_evrc_pb_stats.tot_in_buf_len,
                 m_evrc_pb_stats.tot_out_buf_len,
                 m_evrc_pb_stats.tot_pb_time);
-    DEBUG_PRINT("STATS: fbd-cnt[%lu]ftb-cnt[%lu]etb-cnt[%lu]ebd-cnt[%lu]",\
+    DEBUG_PRINT("STATS: fbd-cnt[%u]ftb-cnt[%u]etb-cnt[%u]ebd-cnt[%u]",\
                 m_evrc_pb_stats.fbd_cnt,m_evrc_pb_stats.ftb_cnt,
                 m_evrc_pb_stats.etb_cnt,
                 m_evrc_pb_stats.ebd_cnt);
@@ -4389,8 +4390,8 @@
 
     if((hComp == NULL) || (appData == NULL) || (eglImage == NULL))
     {
-        bufferHdr = NULL;
-        port = 0;
+        bufferHdr = bufferHdr;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -4424,8 +4425,8 @@
     }
     if (index == 0 && role)
     {
-        memcpy(role, cmp_role, sizeof(cmp_role));
-        *(((char *) role) + sizeof(cmp_role)) = '\0';
+        memcpy(role, cmp_role, strlen(cmp_role));
+        *(((char *) role) + strlen(cmp_role) + 1) = '\0';
     } else
     {
         eRet = OMX_ErrorNoMore;
diff --git a/mm-audio/aenc-evrc/qdsp6/test/omx_evrc_enc_test.c b/mm-audio/aenc-evrc/qdsp6/test/omx_evrc_enc_test.c
index e01759e..63d953b 100644
--- a/mm-audio/aenc-evrc/qdsp6/test/omx_evrc_enc_test.c
+++ b/mm-audio/aenc-evrc/qdsp6/test/omx_evrc_enc_test.c
@@ -1,6 +1,6 @@
 
 /*--------------------------------------------------------------------------
-Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -85,9 +85,9 @@
 uint32_t min_bitrate = 0;
 uint32_t max_bitrate = 0;
 uint32_t cdmarate = 0;
-uint32_t rectime = -1;
-uint32_t recpath = -1;
-uint32_t pcmplayback = 0;
+uint32_t rectime = 0;
+uint32_t recpath = 0;
+int32_t pcmplayback = 0;
 uint32_t tunnel      = 0;
 uint32_t format = 1;
 #define DEBUG_PRINT printf
@@ -217,14 +217,14 @@
          {'v','r','a','t'},0, 0, 0,{'d','a','t','a'},0
  };
 
-static unsigned totaldatalen = 0;
-static unsigned framecnt = 0;
+static int totaldatalen = 0;
+static int framecnt = 0;
 /************************************************************************/
 /*                GLOBAL INIT                    */
 /************************************************************************/
 
-int input_buf_cnt = 0;
-int output_buf_cnt = 0;
+unsigned int input_buf_cnt = 0;
+unsigned int output_buf_cnt = 0;
 int used_ip_buf_cnt = 0;
 volatile int event_is_done = 0;
 volatile int ebd_event_is_done = 0;
@@ -265,7 +265,7 @@
 static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *evrc_enc_handle,
                                        OMX_BUFFERHEADERTYPE  ***pBufHdrs,
                                        OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize);
+                                       unsigned int bufCntMin, unsigned int bufSize);
 
 
 static OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
@@ -325,7 +325,7 @@
 
 static void create_qcp_header(int Datasize, int Frames)
 {
-        append_header.s_riff = Datasize + QCP_HEADER_SIZE - 8;
+        append_header.s_riff = (unsigned)(Datasize + (int)QCP_HEADER_SIZE - 8);
         /* exclude riff id and size field */
     append_header.data1 = 0xe689d48d;
     append_header.data2 = 0x9076;
@@ -349,8 +349,8 @@
     append_header.vr_bytes_per_pkt[3] = 0x0102;
     append_header.s_vrat = 0x00000008;
     append_header.v_rate = 0x00000001;
-        append_header.size_in_pkts = Frames;
-        append_header.s_data = Datasize;
+        append_header.size_in_pkts = (unsigned)Frames;
+        append_header.s_data = (unsigned)Datasize;
         return;
 }
 
@@ -368,7 +368,7 @@
     (void)pEventData;
     switch(eEvent) {
         case OMX_EventCmdComplete:
-        DEBUG_PRINT("\n OMX_EventCmdComplete event=%d data1=%lu data2=%lu\n",(OMX_EVENTTYPE)eEvent,
+        DEBUG_PRINT("\n OMX_EventCmdComplete event=%d data1=%u data2=%u\n",(OMX_EVENTTYPE)eEvent,
                                                                                nData1,nData2);
             event_complete();
         break;
@@ -395,8 +395,8 @@
                               OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
 {
     size_t bytes_writen = 0;
-    int total_bytes_writen = 0;
-    unsigned int len = 0;
+    size_t total_bytes_writen = 0;
+    size_t len = 0;
     struct enc_meta_out *meta = NULL;
     OMX_U8 *src = pBuffer->pBuffer;
     unsigned int num_of_frames = 1;
@@ -443,8 +443,8 @@
             num_of_frames--;
             total_bytes_writen += len;
         }
-        DEBUG_PRINT(" FillBufferDone size writen to file  %d count %d\n",total_bytes_writen, framecnt);
-        totaldatalen += total_bytes_writen ;
+        DEBUG_PRINT(" FillBufferDone size writen to file  %zu count %d\n",total_bytes_writen, framecnt);
+        totaldatalen = totaldatalen + (int)total_bytes_writen;
     framecnt++;
 
         DEBUG_PRINT(" FBD calling FTB\n");
@@ -497,7 +497,7 @@
     }
 
     if((readBytes = Read_Buffer(pBuffer)) > 0) {
-        pBuffer->nFilledLen = readBytes;
+        pBuffer->nFilledLen = (OMX_U32)readBytes;
         used_ip_buf_cnt++;
         OMX_EmptyThisBuffer(hComponent,pBuffer);
     }
@@ -534,7 +534,7 @@
 
 int main(int argc, char **argv)
 {
-     int bufCnt=0;
+     unsigned int bufCnt=0;
      OMX_ERRORTYPE result;
 
     struct sigaction sa;
@@ -556,12 +556,12 @@
     if (argc >= 9) {
         in_filename = argv[1];
           out_filename = argv[2];
-    tunnel =  atoi(argv[3]);
-        min_bitrate  = atoi(argv[4]);
-        max_bitrate  = atoi(argv[5]);
-        cdmarate     = atoi(argv[6]);
-        recpath      = atoi(argv[7]); // No configuration support yet..
-        rectime      = atoi(argv[8]);
+    tunnel =  (uint32_t)atoi(argv[3]);
+        min_bitrate  = (uint32_t)atoi(argv[4]);
+        max_bitrate  = (uint32_t)atoi(argv[5]);
+        cdmarate     = (uint32_t)atoi(argv[6]);
+        recpath      = (uint32_t)atoi(argv[7]); // No configuration support yet..
+        rectime      = (uint32_t)atoi(argv[8]);
 
     } else {
           DEBUG_PRINT(" invalid format: \n");
@@ -733,7 +733,7 @@
     /* Query for audio decoders*/
     DEBUG_PRINT("Evrc_test: Before entering OMX_GetComponentOfRole");
     OMX_GetComponentsOfRole(role, &total, 0);
-    DEBUG_PRINT ("\nTotal components of role=%s :%lu", role, total);
+    DEBUG_PRINT ("\nTotal components of role=%s :%u", role, total);
 
 
     omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&evrc_enc_handle),
@@ -758,8 +758,8 @@
     }
     else
     {
-        DEBUG_PRINT("\nportParam.nPorts:%lu\n", portParam.nPorts);
-    DEBUG_PRINT("\nportParam.nStartPortNumber:%lu\n",
+        DEBUG_PRINT("\nportParam.nPorts:%u\n", portParam.nPorts);
+    DEBUG_PRINT("\nportParam.nStartPortNumber:%u\n",
                                              portParam.nStartPortNumber);
     }
 
@@ -773,12 +773,16 @@
 
 int Play_Encoder()
 {
-    int i;
+    unsigned int i;
     int Size=0;
     DEBUG_PRINT("Inside %s \n", __FUNCTION__);
     OMX_ERRORTYPE ret;
     OMX_INDEXTYPE index;
+#ifdef __LP64__
+    DEBUG_PRINT("sizeof[%ld]\n", sizeof(OMX_BUFFERHEADERTYPE));
+#else
     DEBUG_PRINT("sizeof[%d]\n", sizeof(OMX_BUFFERHEADERTYPE));
+#endif
 
     /* open the i/p and o/p files based on the video file format passed */
     if(open_audio_file()) {
@@ -793,8 +797,8 @@
     inputportFmt.nPortIndex = portParam.nStartPortNumber;
 
     OMX_GetParameter(evrc_enc_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-    DEBUG_PRINT ("\nEnc Input Buffer Count %lu\n", inputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nEnc: Input Buffer Size %lu\n", inputportFmt.nBufferSize);
+    DEBUG_PRINT ("\nEnc Input Buffer Count %u\n", inputportFmt.nBufferCountMin);
+    DEBUG_PRINT ("\nEnc: Input Buffer Size %u\n", inputportFmt.nBufferSize);
 
     if(OMX_DirInput != inputportFmt.eDir) {
         DEBUG_PRINT ("\nEnc: Expect Input Port\n");
@@ -813,8 +817,8 @@
     outputportFmt.nPortIndex = portParam.nStartPortNumber + 1;
 
     OMX_GetParameter(evrc_enc_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-    DEBUG_PRINT ("\nEnc: Output Buffer Count %lu\n", outputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nEnc: Output Buffer Size %lu\n", outputportFmt.nBufferSize);
+    DEBUG_PRINT ("\nEnc: Output Buffer Count %u\n", outputportFmt.nBufferCountMin);
+    DEBUG_PRINT ("\nEnc: Output Buffer Size %u\n", outputportFmt.nBufferSize);
 
     if(OMX_DirOutput != outputportFmt.eDir) {
         DEBUG_PRINT ("\nEnc: Expect Output Port\n");
@@ -904,7 +908,7 @@
     for(i=0; i < output_buf_cnt; i++) {
         DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
         pOutputBufHdrs[i]->nOutputPortIndex = 1;
-        pOutputBufHdrs[i]->nFlags &= ~OMX_BUFFERFLAG_EOS;
+        pOutputBufHdrs[i]->nFlags = pOutputBufHdrs[i]->nFlags & (unsigned)~OMX_BUFFERFLAG_EOS;
         ret = OMX_FillThisBuffer(evrc_enc_handle, pOutputBufHdrs[i]);
         if (OMX_ErrorNone != ret) {
             DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
@@ -926,7 +930,7 @@
           bInputEosReached = true;
           pInputBufHdrs[i]->nFlags= OMX_BUFFERFLAG_EOS;
         }
-        pInputBufHdrs[i]->nFilledLen = Size;
+        pInputBufHdrs[i]->nFilledLen = (OMX_U32)Size;
         pInputBufHdrs[i]->nInputPortIndex = 0;
         used_ip_buf_cnt++;
         ret = OMX_EmptyThisBuffer(evrc_enc_handle, pInputBufHdrs[i]);
@@ -964,11 +968,11 @@
 static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *avc_enc_handle,
                                        OMX_BUFFERHEADERTYPE  ***pBufHdrs,
                                        OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize)
+                                       unsigned int bufCntMin, unsigned int bufSize)
 {
     DEBUG_PRINT("Inside %s \n", __FUNCTION__);
     OMX_ERRORTYPE error=OMX_ErrorNone;
-    long bufCnt=0;
+    unsigned int bufCnt=0;
 
     /* To remove warning for unused variable to keep prototype same */
     (void)avc_enc_handle;
@@ -976,7 +980,7 @@
                    malloc(sizeof(OMX_BUFFERHEADERTYPE*)*bufCntMin);
 
     for(bufCnt=0; bufCnt < bufCntMin; ++bufCnt) {
-        DEBUG_PRINT("\n OMX_AllocateBuffer No %ld \n", bufCnt);
+        DEBUG_PRINT("\n OMX_AllocateBuffer No %d \n", bufCnt);
         error = OMX_AllocateBuffer(evrc_enc_handle, &((*pBufHdrs)[bufCnt]),
                                    nPortIndex, NULL, bufSize);
     }
@@ -990,7 +994,7 @@
 static int Read_Buffer (OMX_BUFFERHEADERTYPE  *pBufHdr )
 {
 
-    int bytes_read=0;
+    size_t bytes_read=0;
 
 
     pBufHdr->nFilledLen = 0;
@@ -998,11 +1002,11 @@
 
      bytes_read = fread(pBufHdr->pBuffer, 1, pBufHdr->nAllocLen , inputBufferFile);
 
-      pBufHdr->nFilledLen = bytes_read;
+      pBufHdr->nFilledLen = (OMX_U32)bytes_read;
       // Time stamp logic
     ((OMX_BUFFERHEADERTYPE *)pBufHdr)->nTimeStamp = \
 
-    (unsigned long) ((total_pcm_bytes * 1000)/(samplerate * channels *2));
+    (OMX_TICKS) ((total_pcm_bytes * 1000)/(samplerate * channels *2));
 
        DEBUG_PRINT ("\n--time stamp -- %ld\n",  (unsigned long)((OMX_BUFFERHEADERTYPE *)pBufHdr)->nTimeStamp);
         if(bytes_read == 0)
@@ -1012,12 +1016,12 @@
         }
         else
         {
-            pBufHdr->nFlags &= ~OMX_BUFFERFLAG_EOS;
+            pBufHdr->nFlags = pBufHdr->nFlags & (unsigned)~OMX_BUFFERFLAG_EOS;
 
-            total_pcm_bytes += bytes_read;
+            total_pcm_bytes = (unsigned)(total_pcm_bytes + bytes_read);
         }
 
-    return bytes_read;;
+    return (int)bytes_read;;
 }
 
 
diff --git a/mm-audio/aenc-qcelp13/Android.mk b/mm-audio/aenc-qcelp13/Android.mk
index c919f19..2400c47 100644
--- a/mm-audio/aenc-qcelp13/Android.mk
+++ b/mm-audio/aenc-qcelp13/Android.mk
@@ -1,5 +1,4 @@
-ifeq ($(TARGET_ARCH),arm)
-
+ifneq ($(filter arm aarch64 arm64, $(TARGET_ARCH)),)
 
 AENC_QCELP13_PATH:= $(call my-dir)
 
@@ -27,5 +26,8 @@
 ifeq ($(call is-board-platform,msm8916),true)
 include $(AENC_QCELP13_PATH)/qdsp6/Android.mk
 endif
+ifeq ($(call is-board-platform,msm8994),true)
+include $(AENC_QCELP13_PATH)/qdsp6/Android.mk
+endif
 
 endif
diff --git a/mm-audio/aenc-qcelp13/qdsp6/Android.mk b/mm-audio/aenc-qcelp13/qdsp6/Android.mk
index 5aaa3bf..1c9ffe1 100644
--- a/mm-audio/aenc-qcelp13/qdsp6/Android.mk
+++ b/mm-audio/aenc-qcelp13/qdsp6/Android.mk
@@ -13,6 +13,7 @@
 libOmxQcelp13Enc-def += -D_ENABLE_QC_MSG_LOG_
 libOmxQcelp13Enc-def += -DVERBOSE
 libOmxQcelp13Enc-def += -D_DEBUG
+libOmxQcelp13Enc-def += -Wconversion
 ifeq ($(strip $(TARGET_USES_QCOM_MM_AUDIO)),true)
 libOmxQcelp13Enc-def += -DAUDIOV2
 endif
diff --git a/mm-audio/aenc-qcelp13/qdsp6/inc/omx_qcelp13_aenc.h b/mm-audio/aenc-qcelp13/qdsp6/inc/omx_qcelp13_aenc.h
index c547809..22cc9ed 100644
--- a/mm-audio/aenc-qcelp13/qdsp6/inc/omx_qcelp13_aenc.h
+++ b/mm-audio/aenc-qcelp13/qdsp6/inc/omx_qcelp13_aenc.h
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
+Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -81,10 +81,10 @@
 
 
 #define PrintFrameHdr(i,bufHdr) \
-                           DEBUG_PRINT("i=%d OMX bufHdr[%x]buf[%x]size[%d]TS[%lld]nFlags[0x%x]\n",\
+                           DEBUG_PRINT("i=%d OMX bufHdr[%p]buf[%p]size[%d]TS[%lld]nFlags[0x%x]\n",\
                            i,\
-                           (unsigned) bufHdr,                                     \
-                           (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,   \
+                           bufHdr,                                     \
+                           ((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,   \
                            (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFilledLen,\
                            ((OMX_BUFFERHEADERTYPE *)bufHdr)->nTimeStamp, \
                            (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFlags)
@@ -245,7 +245,7 @@
                                 void *                  eglImage);
 
     bool post_command(unsigned int p1, unsigned int p2,
-        unsigned int id);
+        unsigned char id);
 
     // Deferred callback identifiers
     enum
@@ -304,9 +304,9 @@
 
     struct omx_event
     {
-        unsigned param1;
-        unsigned param2;
-        unsigned id;
+        unsigned long param1;
+        unsigned long param2;
+        unsigned char id;
     };
 
     struct omx_cmd_queue
@@ -318,16 +318,16 @@
 
         omx_cmd_queue();
         ~omx_cmd_queue();
-        bool insert_entry(unsigned p1, unsigned p2, unsigned id);
-        bool pop_entry(unsigned *p1,unsigned *p2, unsigned *id);
-        bool get_msg_id(unsigned *id);
+        bool insert_entry(unsigned long p1, unsigned long p2, unsigned char id);
+        bool pop_entry(unsigned long *p1,unsigned long *p2, unsigned char *id);
+        bool get_msg_id(unsigned char *id);
         bool get_msg_with_id(unsigned *p1,unsigned *p2, unsigned id);
     };
 
     typedef struct TIMESTAMP
     {
-        unsigned long LowPart;
-        unsigned long HighPart;
+        unsigned int LowPart;
+        unsigned int HighPart;
     }__attribute__((packed)) TIMESTAMP;
 
     typedef struct metadata_input
@@ -351,7 +351,7 @@
     {
         OMX_U32 tot_in_buf_len;
         OMX_U32 tot_out_buf_len;
-        OMX_U32 tot_pb_time;
+        OMX_TICKS tot_pb_time;
         OMX_U32 fbd_cnt;
         OMX_U32 ftb_cnt;
         OMX_U32 etb_cnt;
@@ -376,7 +376,7 @@
     bool                           is_in_th_sleep;
     bool                           is_out_th_sleep;
     unsigned int                   m_flags;      //encapsulate the waiting states.
-    unsigned int                   nTimestamp;
+    OMX_TICKS                      nTimestamp;
     unsigned int                   pcm_input; //tunnel or non-tunnel
     unsigned int                   m_inp_act_buf_count;    // Num of Input Buffers
     unsigned int                   m_out_act_buf_count;    // Numb of Output Buffers
@@ -508,11 +508,11 @@
 
     bool search_output_bufhdr(OMX_BUFFERHEADERTYPE *buffer);
 
-    bool post_input(unsigned int p1, unsigned int p2,
-                    unsigned int id);
+    bool post_input(unsigned long p1, unsigned long p2,
+                    unsigned char id);
 
-    bool post_output(unsigned int p1, unsigned int p2,
-                     unsigned int id);
+    bool post_output(unsigned long p1, unsigned long p2,
+                     unsigned char id);
 
     void process_events(omx_qcelp13_aenc *client_data);
 
diff --git a/mm-audio/aenc-qcelp13/qdsp6/src/omx_qcelp13_aenc.cpp b/mm-audio/aenc-qcelp13/qdsp6/src/omx_qcelp13_aenc.cpp
index f080e1f..b63f5a2 100644
--- a/mm-audio/aenc-qcelp13/qdsp6/src/omx_qcelp13_aenc.cpp
+++ b/mm-audio/aenc-qcelp13/qdsp6/src/omx_qcelp13_aenc.cpp
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2010, The Linux Foundation. All rights reserved.
+Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -57,9 +57,9 @@
 }
 
 // omx cmd queue insert
-bool omx_qcelp13_aenc::omx_cmd_queue::insert_entry(unsigned p1,
-                                                unsigned p2,
-                                                unsigned id)
+bool omx_qcelp13_aenc::omx_cmd_queue::insert_entry(unsigned long p1,
+                                                unsigned long p2,
+                                                unsigned char id)
 {
     bool ret = true;
     if (m_size < OMX_CORE_CONTROL_CMDQ_SIZE)
@@ -81,8 +81,8 @@
     return ret;
 }
 
-bool omx_qcelp13_aenc::omx_cmd_queue::pop_entry(unsigned *p1,
-                                             unsigned *p2, unsigned *id)
+bool omx_qcelp13_aenc::omx_cmd_queue::pop_entry(unsigned long *p1,
+                                        unsigned long *p2, unsigned char *id)
 {
     bool ret = true;
     if (m_size > 0)
@@ -111,7 +111,7 @@
 {
     return(new omx_qcelp13_aenc);
 }
-bool omx_qcelp13_aenc::omx_cmd_queue::get_msg_id(unsigned *id)
+bool omx_qcelp13_aenc::omx_cmd_queue::get_msg_id(unsigned char *id)
 {
    if(m_size > 0)
    {
@@ -256,19 +256,24 @@
         m_tmp_out_meta_buf(NULL),
         m_flush_cnt(255),
         m_comp_deinit(0),
+        m_volume(25),
         m_app_data(NULL),
+        nNumInputBuf(0),
+        nNumOutputBuf(0),
         m_drv_fd(-1),
         bFlushinprogress(0),
         is_in_th_sleep(false),
         is_out_th_sleep(false),
         m_flags(0),
         nTimestamp(0),
+        pcm_input(0),
         m_inp_act_buf_count (OMX_CORE_NUM_INPUT_BUFFERS),
         m_out_act_buf_count (OMX_CORE_NUM_OUTPUT_BUFFERS),
         m_inp_current_buf_count(0),
         m_out_current_buf_count(0),
-        output_buffer_size(OMX_QCELP13_OUTPUT_BUFFER_SIZE),
+        output_buffer_size((OMX_U32)OMX_QCELP13_OUTPUT_BUFFER_SIZE),
         input_buffer_size(OMX_CORE_INPUT_BUFFER_SIZE),
+        m_session_id(0),
         m_inp_bEnabled(OMX_TRUE),
         m_out_bEnabled(OMX_TRUE),
         m_inp_bPopulated(OMX_FALSE),
@@ -278,12 +283,7 @@
         m_ipc_to_in_th(NULL),
         m_ipc_to_out_th(NULL),
         m_ipc_to_cmd_th(NULL),
-        m_volume(25),
-        pcm_input(0),
-        nNumOutputBuf(0),
-        m_session_id(0),
-        m_ipc_to_event_th(NULL),
-        nNumInputBuf(0)
+        m_ipc_to_event_th(NULL)
 {
     int cond_ret = 0;
     component_Role.nSize = 0;
@@ -502,13 +502,13 @@
         m_qcelp13_pb_stats.fbd_cnt++;
         pthread_mutex_lock(&out_buf_count_lock);
         nNumOutputBuf--;
-        DEBUG_PRINT("FBD CB:: nNumOutputBuf=%d out_buf_len=%lu fbd_cnt=%lu\n",\
+        DEBUG_PRINT("FBD CB:: nNumOutputBuf=%d out_buf_len=%u fbd_cnt=%u\n",\
                     nNumOutputBuf,
                     m_qcelp13_pb_stats.tot_out_buf_len,
                     m_qcelp13_pb_stats.fbd_cnt);
         m_qcelp13_pb_stats.tot_out_buf_len += bufHdr->nFilledLen;
-        m_qcelp13_pb_stats.tot_pb_time     = bufHdr->nTimeStamp;
-        DEBUG_PRINT("FBD:in_buf_len=%lu out_buf_len=%lu\n",
+        m_qcelp13_pb_stats.tot_pb_time  = bufHdr->nTimeStamp;
+        DEBUG_PRINT("FBD:in_buf_len=%u out_buf_len=%u\n",
                     m_qcelp13_pb_stats.tot_in_buf_len,
                     m_qcelp13_pb_stats.tot_out_buf_len);
 
@@ -542,9 +542,9 @@
 =============================================================================*/
 void omx_qcelp13_aenc::process_out_port_msg(void *client_data, unsigned char id)
 {
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize     = 0;                 // qsize
     unsigned      tot_qsize = 0;
     omx_qcelp13_aenc  *pThis    = (omx_qcelp13_aenc *) client_data;
@@ -746,9 +746,9 @@
 =============================================================================*/
 void omx_qcelp13_aenc::process_command_msg(void *client_data, unsigned char id)
 {
-    unsigned     p1;                             // Parameter - 1
-    unsigned     p2;                             // Parameter - 2
-    unsigned     ident;
+    unsigned long p1 = 0;                             // Parameter - 1
+    unsigned long p2 = 0;                             // Parameter - 2
+    unsigned char ident = 0;
     unsigned     qsize  = 0;
     omx_qcelp13_aenc *pThis = (omx_qcelp13_aenc*)client_data;
     pthread_mutex_lock(&pThis->m_commandlock);
@@ -820,15 +820,15 @@
                 pThis->m_cb.EventHandler(&pThis->m_cmp,
                                          pThis->m_app_data,
                                          OMX_EventError,
-                                         p2,
-                                         NULL,
-                                         NULL );
+                                         (OMX_U32)p2,
+                                         0,
+                                         0 );
             } else
             {
                 pThis->m_cb.EventHandler(&pThis->m_cmp,
                                          pThis->m_app_data,
                                          OMX_EventCmdComplete,
-                                         p1, p2, NULL );
+                                         (OMX_U32)p1, (OMX_U32)p2, NULL );
             }
         } else
         {
@@ -876,9 +876,9 @@
 =============================================================================*/
 void omx_qcelp13_aenc::process_in_port_msg(void *client_data, unsigned char id)
 {
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize     = 0;
     unsigned      tot_qsize = 0;
     omx_qcelp13_aenc  *pThis    = (omx_qcelp13_aenc *) client_data;
@@ -1056,7 +1056,7 @@
     randomly assign the value right now. Query will result in
     incorrect param */
     memset(&m_qcelp13_param, 0, sizeof(m_qcelp13_param));
-    m_qcelp13_param.nSize = sizeof(m_qcelp13_param);
+    m_qcelp13_param.nSize = (OMX_U32)sizeof(m_qcelp13_param);
     m_qcelp13_param.nChannels = OMX_QCELP13_DEFAULT_CH_CFG;
     //Current DSP does not have config
     m_qcelp13_param.eCDMARate = OMX_AUDIO_CDMARateFull;
@@ -1065,7 +1065,7 @@
     m_volume = OMX_QCELP13_DEFAULT_VOL;             /* Close to unity gain */
     memset(&m_qcelp13_pb_stats,0,sizeof(QCELP13_PB_STATS));
     memset(&m_pcm_param, 0, sizeof(m_pcm_param));
-    m_pcm_param.nSize = sizeof(m_pcm_param);
+    m_pcm_param.nSize = (OMX_U32)sizeof(m_pcm_param);
     m_pcm_param.nChannels = OMX_QCELP13_DEFAULT_CH_CFG;
     m_pcm_param.nSamplingRate = OMX_QCELP13_DEFAULT_SF;
     nTimestamp = 0;
@@ -1096,20 +1096,20 @@
     if (!strcmp(role,"OMX.qcom.audio.encoder.qcelp13"))
     {
         pcm_input = 1;
-        component_Role.nSize = sizeof(role);
+        component_Role.nSize = (OMX_U32)sizeof(role);
         strlcpy((char *)component_Role.cRole, (const char*)role,
 		sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED \n", role);
     } else if (!strcmp(role,"OMX.qcom.audio.encoder.tunneled.qcelp13"))
     {
         pcm_input = 0;
-        component_Role.nSize = sizeof(role);
+        component_Role.nSize = (OMX_U32)sizeof(role);
         strlcpy((char *)component_Role.cRole, (const char*)role,
 		sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED \n", role);
     } else
     {
-        component_Role.nSize = sizeof("\0");
+        component_Role.nSize = (OMX_U32)sizeof("\0");
         strlcpy((char *)component_Role.cRole, (const char*)"\0",
 		sizeof(component_Role.cRole));
         DEBUG_PRINT("\ncomponent_init: Component %s LOADED is invalid\n", role);
@@ -1255,7 +1255,7 @@
 
     if(hComp == NULL)
     {
-        cmdData = NULL;
+        cmdData = cmdData;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -1269,7 +1269,7 @@
     }
     post_command((unsigned)cmd,(unsigned)param1,OMX_COMPONENT_GENERATE_COMMAND);
     DEBUG_PRINT("Send Command : returns with OMX_ErrorNone \n");
-    DEBUG_PRINT("send_command : recieved state before semwait= %lu\n",param1);
+    DEBUG_PRINT("send_command : recieved state before semwait= %u\n",param1);
     sem_wait (&sem_States);
     DEBUG_PRINT("send_command : recieved state after semwait\n");
     return OMX_ErrorNone;
@@ -1299,7 +1299,7 @@
 
     if(hComp == NULL)
     {
-        cmdData = NULL;
+        cmdData = cmdData;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -1464,7 +1464,7 @@
                     }
                     pcm_cfg.channel_count = m_pcm_param.nChannels;
                     pcm_cfg.sample_rate  =  m_pcm_param.nSamplingRate;
-                    DEBUG_PRINT("pcm config %lu %lu\n",m_pcm_param.nChannels,
+                    DEBUG_PRINT("pcm config %u %u\n",m_pcm_param.nChannels,
 				m_pcm_param.nSamplingRate);
 
                     if (ioctl(m_drv_fd, AUDIO_SET_CONFIG, &pcm_cfg) == -1)
@@ -1721,7 +1721,7 @@
     } else if (OMX_CommandFlush == cmd)
     {
         DEBUG_DETAIL("*************************\n");
-        DEBUG_PRINT("SCP-->RXED FLUSH COMMAND port=%lu\n",param1);
+        DEBUG_PRINT("SCP-->RXED FLUSH COMMAND port=%u\n",param1);
         DEBUG_DETAIL("*************************\n");
         bFlag = 0;
         if ( param1 == OMX_CORE_INPUT_PORT_INDEX ||
@@ -1760,7 +1760,7 @@
                 if (m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
                 {
                     DEBUG_PRINT("SCP: execute_omx_flush in Disable in "\
-                                " param1=%lu m_state=%d \n",param1, m_state);
+                                " param1=%u m_state=%d \n",param1, m_state);
                     execute_omx_flush(param1);
                 }
                 DEBUG_PRINT("send_command_proxy:OMX_CommandPortDisable:\
@@ -1792,7 +1792,7 @@
                 if (m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
                 {
                     DEBUG_PRINT("SCP: execute_omx_flush in Disable out "\
-                                "param1=%lu m_state=%d \n",param1, m_state);
+                                "param1=%u m_state=%d \n",param1, m_state);
                     execute_omx_flush(param1);
                 }
                 BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_DISABLE_PENDING);
@@ -1909,7 +1909,7 @@
 {
     bool bRet = true;
 
-    DEBUG_PRINT("Execute_omx_flush Port[%lu]", param1);
+    DEBUG_PRINT("Execute_omx_flush Port[%u]", param1);
     struct timespec abs_timeout;
     abs_timeout.tv_sec = 1;
     abs_timeout.tv_nsec = 0;
@@ -1959,7 +1959,7 @@
         DEBUG_DETAIL("WAITING FOR FLUSH ACK's param1=%d",param1);
         wait_for_event();
 
-        DEBUG_PRINT("RECIEVED BOTH FLUSH ACK's param1=%lu cmd_cmpl=%d",\
+        DEBUG_PRINT("RECIEVED BOTH FLUSH ACK's param1=%u cmd_cmpl=%d",\
                     param1,cmd_cmpl);
 
         // If not going to idle state, Send FLUSH complete message
@@ -2073,7 +2073,7 @@
         DEBUG_DETAIL("RECIEVED FLUSH ACK FOR O/P PORT param1=%d",param1);
     } else
     {
-        DEBUG_PRINT("Invalid Port ID[%lu]",param1);
+        DEBUG_PRINT("Invalid Port ID[%u]",param1);
     }
     return bRet;
 }
@@ -2101,9 +2101,9 @@
 bool omx_qcelp13_aenc::execute_input_omx_flush()
 {
     OMX_BUFFERHEADERTYPE *omx_buf;
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize=0;                       // qsize
     unsigned      tot_qsize=0;                   // qsize
 
@@ -2181,9 +2181,9 @@
 bool omx_qcelp13_aenc::execute_output_omx_flush()
 {
     OMX_BUFFERHEADERTYPE *omx_buf;
-    unsigned      p1;                            // Parameter - 1
-    unsigned      p2;                            // Parameter - 2
-    unsigned      ident;
+    unsigned long p1 = 0;                            // Parameter - 1
+    unsigned long p2 = 0;                            // Parameter - 2
+    unsigned char ident = 0;
     unsigned      qsize=0;                       // qsize
     unsigned      tot_qsize=0;                   // qsize
 
@@ -2264,9 +2264,9 @@
 SIDE EFFECTS:
   None
 =============================================================================*/
-bool omx_qcelp13_aenc::post_input(unsigned int p1,
-                               unsigned int p2,
-                               unsigned int id)
+bool omx_qcelp13_aenc::post_input(unsigned long p1,
+                               unsigned long p2,
+                               unsigned char id)
 {
     bool bRet = false;
     pthread_mutex_lock(&m_lock);
@@ -2327,7 +2327,7 @@
 =============================================================================*/
 bool omx_qcelp13_aenc::post_command(unsigned int p1,
                                  unsigned int p2,
-                                 unsigned int id)
+                                 unsigned char id)
 {
     bool bRet  = false;
 
@@ -2374,9 +2374,9 @@
 SIDE EFFECTS:
   None
 =============================================================================*/
-bool omx_qcelp13_aenc::post_output(unsigned int p1,
-                                unsigned int p2,
-                                unsigned int id)
+bool omx_qcelp13_aenc::post_output(unsigned long p1,
+                                unsigned long p2,
+                                unsigned char id)
 {
     bool bRet = false;
 
@@ -2440,7 +2440,7 @@
         return OMX_ErrorBadParameter;
     }
 
-    switch (paramIndex)
+    switch ((int)paramIndex)
     {
         case OMX_IndexParamPortDefinition:
             {
@@ -2448,11 +2448,11 @@
                 portDefn = (OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
 
                 DEBUG_PRINT("OMX_IndexParamPortDefinition " \
-                            "portDefn->nPortIndex = %lu\n",
+                            "portDefn->nPortIndex = %u\n",
 				portDefn->nPortIndex);
 
                 portDefn->nVersion.nVersion = OMX_SPEC_VERSION;
-                portDefn->nSize = sizeof(portDefn);
+                portDefn->nSize = (OMX_U32)sizeof(portDefn);
                 portDefn->eDomain    = OMX_PortDomainAudio;
 
                 if (0 == portDefn->nPortIndex)
@@ -2494,7 +2494,7 @@
                 DEBUG_PRINT("OMX_IndexParamAudioInit\n");
 
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 2;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2506,7 +2506,7 @@
                 (OMX_AUDIO_PARAM_PORTFORMATTYPE *) paramData;
                 DEBUG_PRINT("OMX_IndexParamAudioPortFormat\n");
                 portFormatType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portFormatType->nSize = sizeof(portFormatType);
+                portFormatType->nSize = (OMX_U32)sizeof(portFormatType);
 
                 if (OMX_CORE_INPUT_PORT_INDEX == portFormatType->nPortIndex)
                 {
@@ -2516,7 +2516,7 @@
 				portFormatType->nPortIndex)
                 {
                     DEBUG_PRINT("get_parameter: OMX_IndexParamAudioFormat: "\
-                                "%lu\n", portFormatType->nIndex);
+                                "%u\n", portFormatType->nIndex);
 
             portFormatType->eEncoding = OMX_AUDIO_CodingQCELP13;
                 } else
@@ -2551,7 +2551,7 @@
     {
        QOMX_AUDIO_STREAM_INFO_DATA *streaminfoparam =
                (QOMX_AUDIO_STREAM_INFO_DATA *) paramData;
-       streaminfoparam->sessionId = m_session_id;
+       streaminfoparam->sessionId = (OMX_U8)m_session_id;
        break;
     }
 
@@ -2564,9 +2564,9 @@
                 {
                     memcpy(pcmparam,&m_pcm_param,\
                         sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
-                    DEBUG_PRINT("get_parameter: Sampling rate %lu",\
+                    DEBUG_PRINT("get_parameter: Sampling rate %u",\
                                  pcmparam->nSamplingRate);
-                    DEBUG_PRINT("get_parameter: Number of channels %lu",\
+                    DEBUG_PRINT("get_parameter: Number of channels %u",\
                                  pcmparam->nChannels);
                 } else
                 {
@@ -2591,7 +2591,7 @@
                     (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamVideoInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2601,7 +2601,7 @@
                 OMX_PRIORITYMGMTTYPE *priorityMgmtType =
                 (OMX_PRIORITYMGMTTYPE*)paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamPriorityMgmt\n");
-                priorityMgmtType->nSize = sizeof(priorityMgmtType);
+                priorityMgmtType->nSize = (OMX_U32)sizeof(priorityMgmtType);
                 priorityMgmtType->nVersion.nVersion = OMX_SPEC_VERSION;
                 priorityMgmtType->nGroupID = m_priority_mgm.nGroupID;
                 priorityMgmtType->nGroupPriority =
@@ -2614,7 +2614,7 @@
                 (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamImageInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2629,7 +2629,7 @@
                 DEBUG_PRINT("get_parameter: \
 				OMX_IndexParamCompBufferSupplier\n");
 
-                bufferSupplierType->nSize = sizeof(bufferSupplierType);
+                bufferSupplierType->nSize = (OMX_U32)sizeof(bufferSupplierType);
                 bufferSupplierType->nVersion.nVersion = OMX_SPEC_VERSION;
                 if (OMX_CORE_INPUT_PORT_INDEX   ==
 				bufferSupplierType->nPortIndex)
@@ -2658,7 +2658,7 @@
                     (OMX_PORT_PARAM_TYPE *) paramData;
                 DEBUG_PRINT("get_parameter: OMX_IndexParamOtherInit\n");
                 portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
-                portParamType->nSize = sizeof(portParamType);
+                portParamType->nSize = (OMX_U32)sizeof(portParamType);
                 portParamType->nPorts           = 0;
                 portParamType->nStartPortNumber = 0;
                 break;
@@ -2756,7 +2756,7 @@
                     return OMX_ErrorIncorrectStateOperation;
                 }
                 DEBUG_PRINT("OMX_IndexParamPortDefinition portDefn->nPortIndex "
-                            "= %lu\n",portDefn->nPortIndex);
+                            "= %u\n",portDefn->nPortIndex);
                 if (OMX_CORE_INPUT_PORT_INDEX == portDefn->nPortIndex)
                 {
                     if ( portDefn->nBufferCountActual >
@@ -2800,10 +2800,10 @@
                 }
                 OMX_PRIORITYMGMTTYPE *priorityMgmtype
                 = (OMX_PRIORITYMGMTTYPE*) paramData;
-                DEBUG_PRINT("set_parameter: OMX_IndexParamPriorityMgmt %lu\n",
+                DEBUG_PRINT("set_parameter: OMX_IndexParamPriorityMgmt %u\n",
                             priorityMgmtype->nGroupID);
 
-                DEBUG_PRINT("set_parameter: priorityMgmtype %lu\n",
+                DEBUG_PRINT("set_parameter: priorityMgmtype %u\n",
                             priorityMgmtype->nGroupPriority);
 
                 m_priority_mgm.nGroupID = priorityMgmtype->nGroupID;
@@ -2825,7 +2825,7 @@
 					 portFormatType->nPortIndex)
                 {
                     DEBUG_PRINT("set_parameter: OMX_IndexParamAudioFormat:"\
-                                " %lu\n", portFormatType->nIndex);
+                                " %u\n", portFormatType->nIndex);
                     portFormatType->eEncoding = OMX_AUDIO_CodingQCELP13;
                 } else
                 {
@@ -2873,7 +2873,7 @@
                 {
                     memcpy(&m_pcm_param,pcmparam,\
                         sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
-                    DEBUG_PRINT("set_pcm_parameter: %lu %lu",\
+                    DEBUG_PRINT("set_pcm_parameter: %u %u",\
                                  m_pcm_param.nChannels,
 				m_pcm_param.nSamplingRate);
                 } else
@@ -2951,7 +2951,7 @@
 
                 if (OMX_CORE_INPUT_PORT_INDEX == volume->nPortIndex)
                 {
-                    volume->nSize = sizeof(volume);
+                    volume->nSize = (OMX_U32)sizeof(volume);
                     volume->nVersion.nVersion = OMX_SPEC_VERSION;
                     volume->bLinear = OMX_TRUE;
                     volume->sVolume.nValue = m_volume;
@@ -2971,7 +2971,7 @@
 
                 if (OMX_CORE_INPUT_PORT_INDEX == mute->nPortIndex)
                 {
-                    mute->nSize = sizeof(mute);
+                    mute->nSize = (OMX_U32)sizeof(mute);
                     mute->nVersion.nVersion = OMX_SPEC_VERSION;
                     mute->bMute = (BITMASK_PRESENT(&m_flags,
                                       OMX_COMPONENT_MUTED)?OMX_TRUE:OMX_FALSE);
@@ -3179,8 +3179,8 @@
 
     if((hComp == NULL) || (peerComponent == NULL) || (tunnelSetup == NULL))
     {
-        port = 0;
-        peerPort = 0;
+        port = port;
+        peerPort = peerPort;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3220,7 +3220,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         free(buf_ptr);
         return OMX_ErrorBadParameter;
@@ -3233,7 +3233,7 @@
 
         bufHdr->pBuffer           = (OMX_U8 *)((buf_ptr) + sizeof(META_IN)+
                                                sizeof(OMX_BUFFERHEADERTYPE));
-        bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+        bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
         bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
         bufHdr->nAllocLen         = nBufSize;
         bufHdr->pAppPrivate       = appData;
@@ -3242,7 +3242,7 @@
 
         m_inp_current_buf_count++;
         DEBUG_PRINT("AIB:bufHdr %p bufHdr->pBuffer %p m_inp_buf_cnt=%d \
-		bytes=%lu", bufHdr, bufHdr->pBuffer,m_inp_current_buf_count,
+		bytes=%u", bufHdr, bufHdr->pBuffer,m_inp_current_buf_count,
                     bytes);
 
     } else
@@ -3274,7 +3274,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3290,7 +3290,7 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)((buf_ptr) +
 					sizeof(OMX_BUFFERHEADERTYPE));
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             bufHdr->pAppPrivate       = appData;
@@ -3298,7 +3298,7 @@
             m_output_buf_hdrs.insert(bufHdr, NULL);
             m_out_current_buf_count++;
             DEBUG_PRINT("AOB::bufHdr %p bufHdr->pBuffer %p m_out_buf_cnt=%d "\
-                        "bytes=%lu",bufHdr, bufHdr->pBuffer,\
+                        "bytes=%u",bufHdr, bufHdr->pBuffer,\
                         m_out_current_buf_count, bytes);
         } else
         {
@@ -3512,7 +3512,7 @@
         }
     }
   }
-    DEBUG_PRINT("Use Buffer for port[%lu] eRet[%d]\n", port,eRet);
+    DEBUG_PRINT("Use Buffer for port[%u] eRet[%d]\n", port,eRet);
     return eRet;
 }
 /*=============================================================================
@@ -3555,7 +3555,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3577,8 +3577,8 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)(buffer);
             DEBUG_PRINT("use_input_buffer:bufHdr %p bufHdr->pBuffer %p \
-			bytes=%lu", bufHdr, bufHdr->pBuffer,bytes);
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+			bytes=%u", bufHdr, bufHdr->pBuffer,bytes);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             input_buffer_size         = nBufSize;
@@ -3640,7 +3640,7 @@
 
     if(hComp == NULL)
     {
-        port = 0;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -3666,8 +3666,8 @@
 
             bufHdr->pBuffer           = (OMX_U8 *)(buffer);
             DEBUG_PRINT("use_output_buffer:bufHdr %p bufHdr->pBuffer %p \
-			len=%lu\n", bufHdr, bufHdr->pBuffer,bytes);
-            bufHdr->nSize             = sizeof(OMX_BUFFERHEADERTYPE);
+			len=%u\n", bufHdr, bufHdr->pBuffer,bytes);
+            bufHdr->nSize             = (OMX_U32)sizeof(OMX_BUFFERHEADERTYPE);
             bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
             bufHdr->nAllocLen         = nBufSize;
             output_buffer_size        = nBufSize;
@@ -3767,7 +3767,7 @@
                (m_out_bEnabled == OMX_FALSE &&
 		port == OMX_CORE_OUTPUT_PORT_INDEX))
     {
-        DEBUG_PRINT("Free Buffer while port %lu disabled\n", port);
+        DEBUG_PRINT("Free Buffer while port %u disabled\n", port);
     } else if (m_state == OMX_StateExecuting || m_state == OMX_StatePause)
     {
         DEBUG_PRINT("Invalid state to free buffer,ports need to be disabled:\
@@ -3901,7 +3901,7 @@
 {
     OMX_ERRORTYPE eRet = OMX_ErrorNone;
 
-    DEBUG_PRINT("ETB:Buf:%p Len %lu TS %lld numInBuf=%d\n", \
+    DEBUG_PRINT("ETB:Buf:%p Len %u TS %lld numInBuf=%d\n", \
                 buffer, buffer->nFilledLen, buffer->nTimeStamp, (nNumInputBuf));
     if (m_state == OMX_StateInvalid)
     {
@@ -3939,11 +3939,11 @@
     {
         if (search_input_bufhdr(buffer) == true)
         {
-            post_input((unsigned)hComp,
-                       (unsigned) buffer,OMX_COMPONENT_GENERATE_ETB);
+            post_input((unsigned long)hComp,
+                       (unsigned long) buffer,OMX_COMPONENT_GENERATE_ETB);
         } else
         {
-            DEBUG_PRINT_ERROR("Bad header %x \n", (int)buffer);
+            DEBUG_PRINT_ERROR("Bad header %p \n", buffer);
             eRet = OMX_ErrorBadParameter;
         }
     }
@@ -3985,11 +3985,11 @@
         data = m_tmp_meta_buf;
 
         // copy the metadata info from the BufHdr and insert to payload
-        meta_in.offsetVal  = sizeof(META_IN);
+        meta_in.offsetVal  = (OMX_U16)sizeof(META_IN);
         meta_in.nTimeStamp.LowPart =
-           ((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp)& 0xFFFFFFFF);
+           (unsigned int)((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) & 0xFFFFFFFF);
         meta_in.nTimeStamp.HighPart =
-           (((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) >> 32) & 0xFFFFFFFF);
+           (unsigned int)(((((OMX_BUFFERHEADERTYPE*)buffer)->nTimeStamp) >> 32) & 0xFFFFFFFF);
         meta_in.nFlags &= ~OMX_BUFFERFLAG_EOS;
         if(buffer->nFlags & OMX_BUFFERFLAG_EOS)
         {
@@ -4016,7 +4016,7 @@
         /* Assume empty this buffer function has already checked
         validity of buffer */
         DEBUG_PRINT("Empty buffer %p to kernel driver\n", buffer);
-        post_input((unsigned) & hComp,(unsigned) buffer,
+        post_input((unsigned long) & hComp,(unsigned long) buffer,
                    OMX_COMPONENT_GENERATE_BUFFER_DONE);
     }
     return OMX_ErrorNone;
@@ -4029,7 +4029,7 @@
 {
     OMX_STATETYPE state;
     ENC_META_OUT *meta_out = NULL;
-    int nReadbytes = 0;
+    ssize_t nReadbytes = 0;
 
     pthread_mutex_lock(&m_state_lock);
     get_state(&m_cmp, &state);
@@ -4060,8 +4060,9 @@
           buffer->nTimeStamp = (((OMX_TICKS)meta_out->msw_ts << 32)+
 				meta_out->lsw_ts);
           buffer->nFlags |= meta_out->nflags;
-          buffer->nOffset =  meta_out->offset_to_frame + sizeof(unsigned char);
-          buffer->nFilledLen = nReadbytes - buffer->nOffset;
+          buffer->nOffset = (OMX_U32) (meta_out->offset_to_frame +
+                              sizeof(unsigned char));
+          buffer->nFilledLen = (OMX_U32)(nReadbytes - buffer->nOffset);
           nTimestamp = buffer->nTimeStamp;
           DEBUG_PRINT("nflags %d frame_size %d offset_to_frame %d \
 			timestamp %lld\n", meta_out->nflags,
@@ -4095,7 +4096,7 @@
           {
               DEBUG_PRINT("FTBP:Post the FBD to event thread currstate=%d\n",\
                             state);
-              post_output((unsigned) & hComp,(unsigned) buffer,
+              post_output((unsigned long) & hComp,(unsigned long) buffer,
                             OMX_COMPONENT_GENERATE_FRAME_DONE);
           }
           else
@@ -4160,8 +4161,8 @@
     m_qcelp13_pb_stats.ftb_cnt++;
     DEBUG_DETAIL("FTB:nNumOutputBuf is %d", nNumOutputBuf);
     pthread_mutex_unlock(&out_buf_count_lock);
-    post_output((unsigned)hComp,
-                (unsigned) buffer,OMX_COMPONENT_GENERATE_FTB);
+    post_output((unsigned long)hComp,
+                (unsigned long) buffer,OMX_COMPONENT_GENERATE_FTB);
     return eRet;
 }
 
@@ -4245,11 +4246,11 @@
 {
     DEBUG_PRINT("Component-deinit being processed\n");
     DEBUG_PRINT("********************************\n");
-    DEBUG_PRINT("STATS: in-buf-len[%lu]out-buf-len[%lu] tot-pb-time[%ld]",\
+    DEBUG_PRINT("STATS: in-buf-len[%u]out-buf-len[%u] tot-pb-time[%lld]",\
                 m_qcelp13_pb_stats.tot_in_buf_len,
                 m_qcelp13_pb_stats.tot_out_buf_len,
                 m_qcelp13_pb_stats.tot_pb_time);
-    DEBUG_PRINT("STATS: fbd-cnt[%lu]ftb-cnt[%lu]etb-cnt[%lu]ebd-cnt[%lu]",\
+    DEBUG_PRINT("STATS: fbd-cnt[%u]ftb-cnt[%u]etb-cnt[%u]ebd-cnt[%u]",\
                 m_qcelp13_pb_stats.fbd_cnt,m_qcelp13_pb_stats.ftb_cnt,
                 m_qcelp13_pb_stats.etb_cnt,
                 m_qcelp13_pb_stats.ebd_cnt);
@@ -4389,8 +4390,8 @@
 
     if((hComp == NULL) || (appData == NULL) || (eglImage == NULL))
     {
-        bufferHdr = NULL;
-        port = 0;
+        bufferHdr = bufferHdr;
+        port = port;
         DEBUG_PRINT_ERROR("Returning OMX_ErrorBadParameter\n");
         return OMX_ErrorBadParameter;
     }
@@ -4425,8 +4426,8 @@
     }
     if (index == 0 && role)
     {
-        memcpy(role, cmp_role, sizeof(cmp_role));
-        *(((char *) role) + sizeof(cmp_role)) = '\0';
+        memcpy(role, cmp_role, strlen(cmp_role));
+        *(((char *) role) + strlen(cmp_role) + 1) = '\0';
     } else
     {
         eRet = OMX_ErrorNoMore;
diff --git a/mm-audio/aenc-qcelp13/qdsp6/test/omx_qcelp13_enc_test.c b/mm-audio/aenc-qcelp13/qdsp6/test/omx_qcelp13_enc_test.c
index 5c59349..432c07a 100644
--- a/mm-audio/aenc-qcelp13/qdsp6/test/omx_qcelp13_enc_test.c
+++ b/mm-audio/aenc-qcelp13/qdsp6/test/omx_qcelp13_enc_test.c
@@ -1,6 +1,6 @@
 
 /*--------------------------------------------------------------------------
-Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -85,8 +85,8 @@
 uint32_t min_bitrate = 0;
 uint32_t max_bitrate = 0;
 uint32_t cdmarate = 0;
-uint32_t rectime = -1;
-uint32_t recpath = -1;
+uint32_t rectime = 0;
+uint32_t recpath = 0;
 uint32_t pcmplayback = 0;
 uint32_t tunnel      = 0;
 uint32_t format = 1;
@@ -217,14 +217,14 @@
          {'v','r','a','t'},0, 0, 0,{'d','a','t','a'},0
  };
 
-static unsigned totaldatalen = 0;
-static unsigned framecnt = 0;
+static int totaldatalen = 0;
+static int framecnt = 0;
 /************************************************************************/
 /*                GLOBAL INIT                    */
 /************************************************************************/
 
-int input_buf_cnt = 0;
-int output_buf_cnt = 0;
+unsigned int input_buf_cnt = 0;
+unsigned int output_buf_cnt = 0;
 int used_ip_buf_cnt = 0;
 volatile int event_is_done = 0;
 volatile int ebd_event_is_done = 0;
@@ -265,7 +265,7 @@
 static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *qcelp13_enc_handle,
                                        OMX_BUFFERHEADERTYPE  ***pBufHdrs,
                                        OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize);
+                                       unsigned int bufCntMin, unsigned int bufSize);
 
 
 static OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
@@ -325,7 +325,7 @@
 
 static void create_qcp_header(int Datasize, int Frames)
 {
-        append_header.s_riff = Datasize + QCP_HEADER_SIZE - 8;
+        append_header.s_riff = (unsigned)(Datasize + (int)QCP_HEADER_SIZE - 8);
         /* exclude riff id and size field */
         append_header.data1 = 0x5E7F6D41;
         append_header.data2 = 0xB115;
@@ -349,8 +349,8 @@
         append_header.vr_bytes_per_pkt[3] = 0x0103;
         append_header.s_vrat = 0x00000008;
         append_header.v_rate = 0x00000001;
-        append_header.size_in_pkts = Frames;
-        append_header.s_data = Datasize;
+        append_header.size_in_pkts = (unsigned)Frames;
+        append_header.s_data = (unsigned)Datasize;
         return;
 }
 
@@ -369,7 +369,7 @@
 
     switch(eEvent) {
         case OMX_EventCmdComplete:
-        DEBUG_PRINT("\n OMX_EventCmdComplete event=%d data1=%lu data2=%lu\n",(OMX_EVENTTYPE)eEvent,
+        DEBUG_PRINT("\n OMX_EventCmdComplete event=%d data1=%u data2=%u\n",(OMX_EVENTTYPE)eEvent,
                                                                                nData1,nData2);
             event_complete();
         break;
@@ -396,8 +396,8 @@
                               OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
 {
     size_t bytes_writen = 0;
-    int total_bytes_writen = 0;
-    unsigned int len = 0;
+    size_t total_bytes_writen = 0;
+    size_t len = 0;
     struct enc_meta_out *meta = NULL;
     OMX_U8 *src = pBuffer->pBuffer;
     unsigned int num_of_frames = 1;
@@ -444,8 +444,8 @@
             num_of_frames--;
             total_bytes_writen += len;
         }
-        DEBUG_PRINT(" FillBufferDone size writen to file  %d count %d\n",total_bytes_writen, framecnt);
-        totaldatalen += total_bytes_writen ;
+        DEBUG_PRINT(" FillBufferDone size writen to file  %zu count %d\n",total_bytes_writen, framecnt);
+        totaldatalen = totaldatalen + (int)total_bytes_writen;
     framecnt++;
 
         DEBUG_PRINT(" FBD calling FTB\n");
@@ -498,7 +498,7 @@
     }
 
     if((readBytes = Read_Buffer(pBuffer)) > 0) {
-        pBuffer->nFilledLen = readBytes;
+        pBuffer->nFilledLen = (OMX_U32)readBytes;
         used_ip_buf_cnt++;
         OMX_EmptyThisBuffer(hComponent,pBuffer);
     }
@@ -535,7 +535,7 @@
 
 int main(int argc, char **argv)
 {
-     int bufCnt=0;
+     unsigned int bufCnt=0;
      OMX_ERRORTYPE result;
 
     struct sigaction sa;
@@ -557,12 +557,12 @@
     if (argc >= 9) {
         in_filename = argv[1];
           out_filename = argv[2];
-    tunnel =  atoi(argv[3]);
-        min_bitrate  = atoi(argv[4]);
-        max_bitrate  = atoi(argv[5]);
-        cdmarate     = atoi(argv[6]);
-        recpath      = atoi(argv[7]); // No configuration support yet..
-        rectime      = atoi(argv[8]);
+    tunnel =  (uint32_t)atoi(argv[3]);
+        min_bitrate  = (uint32_t)atoi(argv[4]);
+        max_bitrate  = (uint32_t)atoi(argv[5]);
+        cdmarate     = (uint32_t)atoi(argv[6]);
+        recpath      = (uint32_t)atoi(argv[7]); // No configuration support yet..
+        rectime      = (uint32_t)atoi(argv[8]);
 
     } else {
           DEBUG_PRINT(" invalid format: \n");
@@ -735,7 +735,7 @@
     /* Query for audio decoders*/
     DEBUG_PRINT("Qcelp13_test: Before entering OMX_GetComponentOfRole");
     OMX_GetComponentsOfRole(role, &total, 0);
-    DEBUG_PRINT ("\nTotal components of role=%s :%lu", role, total);
+    DEBUG_PRINT ("\nTotal components of role=%s :%u", role, total);
 
 
     omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&qcelp13_enc_handle),
@@ -760,8 +760,8 @@
     }
     else
     {
-        DEBUG_PRINT("\nportParam.nPorts:%lu\n", portParam.nPorts);
-    DEBUG_PRINT("\nportParam.nStartPortNumber:%lu\n",
+        DEBUG_PRINT("\nportParam.nPorts:%u\n", portParam.nPorts);
+    DEBUG_PRINT("\nportParam.nStartPortNumber:%u\n",
                                              portParam.nStartPortNumber);
     }
 
@@ -775,12 +775,16 @@
 
 int Play_Encoder()
 {
-    int i;
+    unsigned int i;
     int Size=0;
     DEBUG_PRINT("Inside %s \n", __FUNCTION__);
     OMX_ERRORTYPE ret;
     OMX_INDEXTYPE index;
+#ifdef __LP64__
+    DEBUG_PRINT("sizeof[%ld]\n", sizeof(OMX_BUFFERHEADERTYPE));
+#else
     DEBUG_PRINT("sizeof[%d]\n", sizeof(OMX_BUFFERHEADERTYPE));
+#endif
 
     /* open the i/p and o/p files based on the video file format passed */
     if(open_audio_file()) {
@@ -795,8 +799,8 @@
     inputportFmt.nPortIndex = portParam.nStartPortNumber;
 
     OMX_GetParameter(qcelp13_enc_handle,OMX_IndexParamPortDefinition,&inputportFmt);
-    DEBUG_PRINT ("\nEnc Input Buffer Count %lu\n", inputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nEnc: Input Buffer Size %lu\n", inputportFmt.nBufferSize);
+    DEBUG_PRINT ("\nEnc Input Buffer Count %u\n", inputportFmt.nBufferCountMin);
+    DEBUG_PRINT ("\nEnc: Input Buffer Size %u\n", inputportFmt.nBufferSize);
 
     if(OMX_DirInput != inputportFmt.eDir) {
         DEBUG_PRINT ("\nEnc: Expect Input Port\n");
@@ -815,8 +819,8 @@
     outputportFmt.nPortIndex = portParam.nStartPortNumber + 1;
 
     OMX_GetParameter(qcelp13_enc_handle,OMX_IndexParamPortDefinition,&outputportFmt);
-    DEBUG_PRINT ("\nEnc: Output Buffer Count %lu\n", outputportFmt.nBufferCountMin);
-    DEBUG_PRINT ("\nEnc: Output Buffer Size %lu\n", outputportFmt.nBufferSize);
+    DEBUG_PRINT ("\nEnc: Output Buffer Count %u\n", outputportFmt.nBufferCountMin);
+    DEBUG_PRINT ("\nEnc: Output Buffer Size %u\n", outputportFmt.nBufferSize);
 
     if(OMX_DirOutput != outputportFmt.eDir) {
         DEBUG_PRINT ("\nEnc: Expect Output Port\n");
@@ -906,7 +910,7 @@
     for(i=0; i < output_buf_cnt; i++) {
         DEBUG_PRINT ("\nOMX_FillThisBuffer on output buf no.%d\n",i);
         pOutputBufHdrs[i]->nOutputPortIndex = 1;
-        pOutputBufHdrs[i]->nFlags &= ~OMX_BUFFERFLAG_EOS;
+        pOutputBufHdrs[i]->nFlags = pOutputBufHdrs[i]->nFlags & (unsigned)~OMX_BUFFERFLAG_EOS;
         ret = OMX_FillThisBuffer(qcelp13_enc_handle, pOutputBufHdrs[i]);
         if (OMX_ErrorNone != ret) {
             DEBUG_PRINT("OMX_FillThisBuffer failed with result %d\n", ret);
@@ -928,7 +932,7 @@
           bInputEosReached = true;
           pInputBufHdrs[i]->nFlags= OMX_BUFFERFLAG_EOS;
         }
-        pInputBufHdrs[i]->nFilledLen = Size;
+        pInputBufHdrs[i]->nFilledLen = (OMX_U32)Size;
         pInputBufHdrs[i]->nInputPortIndex = 0;
         used_ip_buf_cnt++;
         ret = OMX_EmptyThisBuffer(qcelp13_enc_handle, pInputBufHdrs[i]);
@@ -966,11 +970,11 @@
 static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *avc_enc_handle,
                                        OMX_BUFFERHEADERTYPE  ***pBufHdrs,
                                        OMX_U32 nPortIndex,
-                                       long bufCntMin, long bufSize)
+                                       unsigned int bufCntMin, unsigned int bufSize)
 {
     DEBUG_PRINT("Inside %s \n", __FUNCTION__);
     OMX_ERRORTYPE error=OMX_ErrorNone;
-    long bufCnt=0;
+    unsigned int bufCnt=0;
 
     /* To remove warning for unused variable to keep prototype same */
     (void)avc_enc_handle;
@@ -979,7 +983,7 @@
                    malloc(sizeof(OMX_BUFFERHEADERTYPE*)*bufCntMin);
 
     for(bufCnt=0; bufCnt < bufCntMin; ++bufCnt) {
-        DEBUG_PRINT("\n OMX_AllocateBuffer No %ld \n", bufCnt);
+        DEBUG_PRINT("\n OMX_AllocateBuffer No %d \n", bufCnt);
         error = OMX_AllocateBuffer(qcelp13_enc_handle, &((*pBufHdrs)[bufCnt]),
                                    nPortIndex, NULL, bufSize);
     }
@@ -993,7 +997,7 @@
 static int Read_Buffer (OMX_BUFFERHEADERTYPE  *pBufHdr )
 {
 
-    int bytes_read=0;
+    size_t bytes_read=0;
 
 
     pBufHdr->nFilledLen = 0;
@@ -1001,11 +1005,11 @@
 
      bytes_read = fread(pBufHdr->pBuffer, 1, pBufHdr->nAllocLen , inputBufferFile);
 
-      pBufHdr->nFilledLen = bytes_read;
+      pBufHdr->nFilledLen = (OMX_U32)bytes_read;
       // Time stamp logic
     ((OMX_BUFFERHEADERTYPE *)pBufHdr)->nTimeStamp = \
 
-    (unsigned long) ((total_pcm_bytes * 1000)/(samplerate * channels *2));
+    (OMX_TICKS) ((total_pcm_bytes * 1000)/(samplerate * channels *2));
 
        DEBUG_PRINT ("\n--time stamp -- %ld\n",  (unsigned long)((OMX_BUFFERHEADERTYPE *)pBufHdr)->nTimeStamp);
         if(bytes_read == 0)
@@ -1015,12 +1019,12 @@
         }
         else
         {
-            pBufHdr->nFlags &= ~OMX_BUFFERFLAG_EOS;
+            pBufHdr->nFlags = pBufHdr->nFlags & (unsigned)~OMX_BUFFERFLAG_EOS;
 
-            total_pcm_bytes += bytes_read;
+            total_pcm_bytes = (unsigned)(total_pcm_bytes + bytes_read);
         }
 
-    return bytes_read;;
+    return (int)bytes_read;;
 }
 
 
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 275d0c5..303540c 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1241,7 +1241,7 @@
 // of the system.
 bool AudioPolicyManager::isOffloadSupported(const audio_offload_info_t& offloadInfo)
 {
-    ALOGV(" isOffloadSupported: SR=%u, CM=0x%x, Format=0x%x, StreamType=%d,"
+    ALOGD("copl: isOffloadSupported: SR=%u, CM=0x%x, Format=0x%x, StreamType=%d,"
      " BitRate=%u, duration=%lld us, has_video=%d",
      offloadInfo.sample_rate, offloadInfo.channel_mask,
      offloadInfo.format,
@@ -1255,7 +1255,7 @@
          if (propenabled) {
             if(isInCall())
             {
-                ALOGD("\n  blocking  compress offload on call mode\n");
+                ALOGD("\n copl: blocking  compress offload on call mode\n");
                 return false;
             }
          }
@@ -1265,7 +1265,7 @@
     // Check if stream type is music, then only allow offload as of now.
     if (offloadInfo.stream_type != AUDIO_STREAM_MUSIC)
     {
-        ALOGV("isOffloadSupported: stream_type != MUSIC, returning false");
+        ALOGD("copl: isOffloadSupported: stream_type != MUSIC, returning false");
         return false;
     }
 
@@ -1280,7 +1280,7 @@
             }
         }
         if (!pcmOffload) {
-            ALOGV("PCM offload disabled by property audio.offload.pcm.enable");
+            ALOGD("copl: PCM offload disabled by property audio.offload.pcm.enable");
             return false;
         }
     }
@@ -1289,7 +1289,7 @@
         // Check if offload has been disabled
         if (property_get("audio.offload.disable", propValue, "0")) {
             if (atoi(propValue) != 0) {
-                ALOGV("offload disabled by audio.offload.disable=%s", propValue );
+                ALOGD("copl: offload disabled by audio.offload.disable=%s", propValue );
                 return false;
             }
         }
@@ -1297,7 +1297,7 @@
         //check if it's multi-channel AAC format
         if (AudioSystem::popCount(offloadInfo.channel_mask) > 2
               && offloadInfo.format == AUDIO_FORMAT_AAC) {
-            ALOGV("offload disabled for multi-channel AAC format");
+            ALOGD("copl: offload disabled for multi-channel AAC format");
             return false;
         }
 
@@ -1325,7 +1325,7 @@
                     return false;
                 }
             }
-            ALOGV("isOffloadSupported: has_video == true, property\
+            ALOGD("copl: isOffloadSupported: has_video == true, property\
                     set to enable offload");
         }
     }
@@ -1333,11 +1333,11 @@
     //If duration is less than minimum value defined in property, return false
     if (property_get("audio.offload.min.duration.secs", propValue, NULL)) {
         if (offloadInfo.duration_us < (atoi(propValue) * 1000000 )) {
-            ALOGV("Offload denied by duration < audio.offload.min.duration.secs(=%s)", propValue);
+            ALOGD("copl: Offload denied by duration < audio.offload.min.duration.secs(=%s)", propValue);
             return false;
         }
     } else if (offloadInfo.duration_us < OFFLOAD_DEFAULT_MIN_DURATION_SECS * 1000000) {
-        ALOGV("Offload denied by duration < default min(=%u)", OFFLOAD_DEFAULT_MIN_DURATION_SECS);
+        ALOGD("copl: Offload denied by duration < default min(=%u)", OFFLOAD_DEFAULT_MIN_DURATION_SECS);
         //duration checks only valid for MP3/AAC formats,
         //do not check duration for other audio formats, e.g. dolby AAC/AC3 and amrwb+ formats
         if (offloadInfo.format == AUDIO_FORMAT_MP3 || offloadInfo.format == AUDIO_FORMAT_AAC || pcmOffload)
@@ -1361,7 +1361,7 @@
                                             offloadInfo.format,
                                             offloadInfo.channel_mask,
                                             AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD);
-    ALOGV("isOffloadSupported() profile %sfound", profile != NULL ? "" : "NOT ");
+    ALOGD("copl: isOffloadSupported() profile %sfound", profile != NULL ? "" : "NOT ");
     return (profile != NULL);
 }
 
@@ -1505,6 +1505,10 @@
         //suspend  PCM (deep-buffer) output & close  compress & direct tracks
         for (size_t i = 0; i < mOutputs.size(); i++) {
             AudioOutputDescriptor *outputDesc = mOutputs.valueAt(i);
+            if (!outputDesc || !outputDesc->mProfile) {
+               ALOGD("ouput desc / profile is NULL");
+               continue;
+            }
             if (((!outputDesc->isDuplicated() &&outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_PRIMARY))
                         && prop_playback_enabled) {
                 ALOGD(" calling suspendOutput on call mdoe for primary output");
@@ -1529,6 +1533,10 @@
         //restore PCM (deep-buffer) output after call termination
         for (size_t i = 0; i < mOutputs.size(); i++) {
             AudioOutputDescriptor *outputDesc = mOutputs.valueAt(i);
+            if (!outputDesc || !outputDesc->mProfile) {
+               ALOGD("ouput desc / profile is NULL");
+               continue;
+            }
             if (!outputDesc->isDuplicated() &&outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_PRIMARY) {
                 ALOGD("calling restoreOutput after call mode for primary output");
                 mpClientInterface->restoreOutput(mOutputs.keyAt(i));
diff --git a/post_proc/bass_boost.c b/post_proc/bass_boost.c
index 341f145..8d96e90 100644
--- a/post_proc/bass_boost.c
+++ b/post_proc/bass_boost.c
@@ -47,13 +47,14 @@
 
 int bassboost_get_strength(bassboost_context_t *context)
 {
-    ALOGV("%s: strength: %d", __func__, context->strength);
+    ALOGV("%s: ctxt %p, strength: %d", __func__,
+                      context,  context->strength);
     return context->strength;
 }
 
 int bassboost_set_strength(bassboost_context_t *context, uint32_t strength)
 {
-    ALOGV("%s: strength: %d", __func__, strength);
+    ALOGV("%s: ctxt %p, strength: %d", __func__, context, strength);
     context->strength = strength;
 
     offload_bassboost_set_strength(&(context->offload_bass), strength);
@@ -74,7 +75,7 @@
     void *value = p->data + voffset;
     int i;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, param %d", __func__, bass_ctxt, param);
 
     p->status = 0;
 
@@ -100,12 +101,10 @@
 
     switch (param) {
     case BASSBOOST_PARAM_STRENGTH_SUPPORTED:
-        ALOGV("%s: BASSBOOST_PARAM_STRENGTH_SUPPORTED", __func__);
         *(uint32_t *)value = 1;
         break;
 
     case BASSBOOST_PARAM_STRENGTH:
-        ALOGV("%s: BASSBOOST_PARAM_STRENGTH", __func__);
         *(int16_t *)value = bassboost_get_strength(bass_ctxt);
         break;
 
@@ -127,13 +126,12 @@
     int32_t param = *param_tmp++;
     uint32_t strength;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, param %d", __func__, bass_ctxt, param);
 
     p->status = 0;
 
     switch (param) {
     case BASSBOOST_PARAM_STRENGTH:
-        ALOGV("%s BASSBOOST_PARAM_STRENGTH", __func__);
         strength = (uint32_t)(*(int16_t *)value);
         bassboost_set_strength(bass_ctxt, strength);
         break;
@@ -149,7 +147,7 @@
 {
     bassboost_context_t *bass_ctxt = (bassboost_context_t *)context;
 
-    ALOGV("%s: device: %d", __func__, device);
+    ALOGV("%s: ctxt %p, device 0x%x", __func__, bass_ctxt, device);
     bass_ctxt->device = device;
     if((device == AUDIO_DEVICE_OUT_SPEAKER) ||
        (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) ||
@@ -166,6 +164,7 @@
                 offload_bassboost_send_params(bass_ctxt->ctl,
                                               bass_ctxt->offload_bass,
                                               OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG);
+            ALOGI("%s: ctxt %p, disabled based on device", __func__, bass_ctxt);
         }
     } else {
         if (!offload_bassboost_get_enable_flag(&(bass_ctxt->offload_bass)) &&
@@ -193,7 +192,7 @@
 {
     bassboost_context_t *bass_ctxt = (bassboost_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, bass_ctxt);
     context->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
     context->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
     context->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT;
@@ -223,7 +222,7 @@
 {
     bassboost_context_t *bass_ctxt = (bassboost_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, strength %d", __func__, bass_ctxt, bass_ctxt->strength);
 
     if (!offload_bassboost_get_enable_flag(&(bass_ctxt->offload_bass)) &&
         !(bass_ctxt->temp_disabled)) {
@@ -241,7 +240,7 @@
 {
     bassboost_context_t *bass_ctxt = (bassboost_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, bass_ctxt);
     if (offload_bassboost_get_enable_flag(&(bass_ctxt->offload_bass))) {
         offload_bassboost_set_enable_flag(&(bass_ctxt->offload_bass), false);
         if (bass_ctxt->ctl)
@@ -256,9 +255,9 @@
 {
     bassboost_context_t *bass_ctxt = (bassboost_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, ctl %p, strength %d", __func__, bass_ctxt,
+                                   output->ctl, bass_ctxt->strength);
     bass_ctxt->ctl = output->ctl;
-    ALOGV("output->ctl: %p", output->ctl);
     if (offload_bassboost_get_enable_flag(&(bass_ctxt->offload_bass)))
         if (bass_ctxt->ctl)
             offload_bassboost_send_params(bass_ctxt->ctl, bass_ctxt->offload_bass,
@@ -271,7 +270,7 @@
 {
     bassboost_context_t *bass_ctxt = (bassboost_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, bass_ctxt);
     bass_ctxt->ctl = NULL;
     return 0;
 }
diff --git a/post_proc/bundle.c b/post_proc/bundle.c
index 8e2bce8..b11a700 100644
--- a/post_proc/bundle.c
+++ b/post_proc/bundle.c
@@ -121,6 +121,7 @@
 {
     struct listnode *fx_node;
 
+    ALOGV("%s: e_ctxt %p, o_ctxt %p", __func__, context, output);
     list_for_each(fx_node, &output->effects_list) {
         effect_context_t *fx_ctxt = node_to_item(fx_node,
                                                  effect_context_t,
@@ -139,6 +140,7 @@
 {
     struct listnode *fx_node;
 
+    ALOGV("%s: e_ctxt %p, o_ctxt %p", __func__, context, output);
     list_for_each(fx_node, &output->effects_list) {
         effect_context_t *fx_ctxt = node_to_item(fx_node,
                                                  effect_context_t,
@@ -512,7 +514,7 @@
     effect_context_t * context = (effect_context_t *)self;
     int status = 0;
 
-    ALOGW("%s Called ?????", __func__);
+    ALOGW("%s: ctxt %p, Called ?????", __func__, context);
 
     pthread_mutex_lock(&lock);
     if (!effect_exists(context)) {
@@ -545,6 +547,7 @@
         goto exit;
     }
 
+    ALOGV("%s: ctxt %p, cmd %d", __func__, context, cmdCode);
     if (context == NULL || context->state == EFFECT_STATE_UNINITIALIZED) {
         status = -EINVAL;
         goto exit;
@@ -598,7 +601,6 @@
         context->state = EFFECT_STATE_ACTIVE;
         if (context->ops.enable)
             context->ops.enable(context);
-        ALOGV("%s EFFECT_CMD_ENABLE", __func__);
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_DISABLE:
@@ -613,7 +615,6 @@
         context->state = EFFECT_STATE_INITIALIZED;
         if (context->ops.disable)
             context->ops.disable(context);
-        ALOGV("%s EFFECT_CMD_DISABLE", __func__);
         *(int *)pReplyData = 0;
         break;
     case EFFECT_CMD_GET_PARAM: {
@@ -623,7 +624,7 @@
             *replySize < (int)(sizeof(effect_param_t) + sizeof(uint32_t) +
                                sizeof(uint16_t))) {
             status = -EINVAL;
-            ALOGV("EFFECT_CMD_GET_PARAM invalid command cmdSize %d *replySize %d",
+            ALOGW("EFFECT_CMD_GET_PARAM invalid command cmdSize %d *replySize %d",
                   cmdSize, *replySize);
             goto exit;
         }
@@ -643,7 +644,7 @@
                             sizeof(uint16_t)) ||
             pReplyData == NULL || *replySize != sizeof(int32_t)) {
             status = -EINVAL;
-            ALOGV("EFFECT_CMD_SET_PARAM invalid command cmdSize %d *replySize %d",
+            ALOGW("EFFECT_CMD_SET_PARAM invalid command cmdSize %d *replySize %d",
                   cmdSize, *replySize);
             goto exit;
         }
@@ -659,7 +660,7 @@
         ALOGV("\t EFFECT_CMD_SET_DEVICE start");
         if (pCmdData == NULL || cmdSize < sizeof(uint32_t)) {
             status = -EINVAL;
-            ALOGV("EFFECT_CMD_SET_DEVICE invalid command cmdSize %d", cmdSize);
+            ALOGW("EFFECT_CMD_SET_DEVICE invalid command cmdSize %d", cmdSize);
             goto exit;
         }
         device = *(uint32_t *)pCmdData;
@@ -675,7 +676,7 @@
 
         if (cmdSize != sizeof(effect_offload_param_t) || pCmdData == NULL
                 || pReplyData == NULL || *replySize != sizeof(int)) {
-            ALOGV("%s EFFECT_CMD_OFFLOAD bad format", __func__);
+            ALOGW("%s EFFECT_CMD_OFFLOAD bad format", __func__);
             status = -EINVAL;
             break;
         }
diff --git a/post_proc/effect_api.c b/post_proc/effect_api.c
index b7cf469..bad6ee1 100644
--- a/post_proc/effect_api.c
+++ b/post_proc/effect_api.c
@@ -29,6 +29,12 @@
 
 #define LOG_TAG "offload_effect_api"
 #define LOG_NDEBUG 0
+//#define VERY_VERY_VERBOSE_LOGGING
+#ifdef VERY_VERY_VERBOSE_LOGGING
+#define ALOGVV ALOGV
+#else
+#define ALOGVV(a...) do { } while(0)
+#endif
 
 #include <stdbool.h>
 #include <cutils/log.h>
@@ -99,34 +105,34 @@
 void offload_bassboost_set_device(struct bass_boost_params *bassboost,
                                   uint32_t device)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: device 0x%x", __func__, device);
     bassboost->device = device;
 }
 
 void offload_bassboost_set_enable_flag(struct bass_boost_params *bassboost,
                                        bool enable)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: enable=%d", __func__, (int)enable);
     bassboost->enable_flag = enable;
 }
 
 int offload_bassboost_get_enable_flag(struct bass_boost_params *bassboost)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: enable=%d", __func__, (int)bassboost->enable_flag);
     return bassboost->enable_flag;
 }
 
 void offload_bassboost_set_strength(struct bass_boost_params *bassboost,
                                     int strength)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: strength %d", __func__, strength);
     bassboost->strength = strength;
 }
 
 void offload_bassboost_set_mode(struct bass_boost_params *bassboost,
                                 int mode)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: mode %d", __func__, mode);
     bassboost->mode = mode;
 }
 
@@ -137,7 +143,7 @@
     int param_values[128] = {0};
     int *p_param_values = param_values;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: flags 0x%x", __func__, param_send_flags);
     *p_param_values++ = BASS_BOOST_MODULE;
     *p_param_values++ = bassboost.device;
     *p_param_values++ = 0; /* num of commands*/
@@ -175,41 +181,41 @@
 void offload_virtualizer_set_device(struct virtualizer_params *virtualizer,
                                     uint32_t device)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: device=0x%x", __func__, device);
     virtualizer->device = device;
 }
 
 void offload_virtualizer_set_enable_flag(struct virtualizer_params *virtualizer,
                                          bool enable)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: enable=%d", __func__, (int)enable);
     virtualizer->enable_flag = enable;
 }
 
 int offload_virtualizer_get_enable_flag(struct virtualizer_params *virtualizer)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: enabled %d", __func__, (int)virtualizer->enable_flag);
     return virtualizer->enable_flag;
 }
 
 void offload_virtualizer_set_strength(struct virtualizer_params *virtualizer,
                                       int strength)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: strength %d", __func__, strength);
     virtualizer->strength = strength;
 }
 
 void offload_virtualizer_set_out_type(struct virtualizer_params *virtualizer,
                                       int out_type)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: out_type %d", __func__, out_type);
     virtualizer->out_type = out_type;
 }
 
 void offload_virtualizer_set_gain_adjust(struct virtualizer_params *virtualizer,
                                          int gain_adjust)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: gain %d", __func__, gain_adjust);
     virtualizer->gain_adjust = gain_adjust;
 }
 
@@ -220,7 +226,7 @@
     int param_values[128] = {0};
     int *p_param_values = param_values;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: flags 0x%x", __func__, param_send_flags);
     *p_param_values++ = VIRTUALIZER_MODULE;
     *p_param_values++ = virtualizer.device;
     *p_param_values++ = 0; /* num of commands*/
@@ -265,25 +271,25 @@
 
 void offload_eq_set_device(struct eq_params *eq, uint32_t device)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: device 0x%x", __func__, device);
     eq->device = device;
 }
 
 void offload_eq_set_enable_flag(struct eq_params *eq, bool enable)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: enable=%d", __func__, (int)enable);
     eq->enable_flag = enable;
 }
 
 int offload_eq_get_enable_flag(struct eq_params *eq)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: enabled=%d", __func__, (int)eq->enable_flag);
     return eq->enable_flag;
 }
 
 void offload_eq_set_preset(struct eq_params *eq, int preset)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: preset %d", __func__, preset);
     eq->config.preset_id = preset;
     eq->config.eq_pregain = Q27_UNITY;
 }
@@ -293,7 +299,7 @@
                                 int *band_gain_list)
 {
     int i;
-    ALOGV("%s", __func__);
+    ALOGVV("%s", __func__);
     eq->config.num_bands = num_bands;
     for (i=0; i<num_bands; i++) {
         eq->per_band_cfg[i].band_idx = i;
@@ -311,7 +317,7 @@
     int *p_param_values = param_values;
     uint32_t i;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: flags 0x%x", __func__, param_send_flags);
     if (eq.config.preset_id < -1 ) {
         ALOGV("No Valid preset to set");
         return 0;
@@ -365,110 +371,110 @@
 
 void offload_reverb_set_device(struct reverb_params *reverb, uint32_t device)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: device 0x%x", __func__, device);
     reverb->device = device;
 }
 
 void offload_reverb_set_enable_flag(struct reverb_params *reverb, bool enable)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: enable=%d", __func__, (int)enable);
     reverb->enable_flag = enable;
 }
 
 int offload_reverb_get_enable_flag(struct reverb_params *reverb)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: enabled=%d", __func__, reverb->enable_flag);
     return reverb->enable_flag;
 }
 
 void offload_reverb_set_mode(struct reverb_params *reverb, int mode)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s", __func__);
     reverb->mode = mode;
 }
 
 void offload_reverb_set_preset(struct reverb_params *reverb, int preset)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: preset %d", __func__, preset);
     if (preset && (preset <= NUM_OSL_REVERB_PRESETS_SUPPORTED))
         reverb->preset = map_reverb_opensl_preset_2_offload_preset[preset-1][1];
 }
 
 void offload_reverb_set_wet_mix(struct reverb_params *reverb, int wet_mix)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: wet_mix %d", __func__, wet_mix);
     reverb->wet_mix = wet_mix;
 }
 
 void offload_reverb_set_gain_adjust(struct reverb_params *reverb,
                                     int gain_adjust)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: gain %d", __func__, gain_adjust);
     reverb->gain_adjust = gain_adjust;
 }
 
 void offload_reverb_set_room_level(struct reverb_params *reverb, int room_level)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: level %d", __func__, room_level);
     reverb->room_level = room_level;
 }
 
 void offload_reverb_set_room_hf_level(struct reverb_params *reverb,
                                       int room_hf_level)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: level %d", __func__, room_hf_level);
     reverb->room_hf_level = room_hf_level;
 }
 
 void offload_reverb_set_decay_time(struct reverb_params *reverb, int decay_time)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: decay time %d", __func__, decay_time);
     reverb->decay_time = decay_time;
 }
 
 void offload_reverb_set_decay_hf_ratio(struct reverb_params *reverb,
                                        int decay_hf_ratio)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: decay_hf_ratio %d", __func__, decay_hf_ratio);
     reverb->decay_hf_ratio = decay_hf_ratio;
 }
 
 void offload_reverb_set_reflections_level(struct reverb_params *reverb,
                                           int reflections_level)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: ref level %d", __func__, reflections_level);
     reverb->reflections_level = reflections_level;
 }
 
 void offload_reverb_set_reflections_delay(struct reverb_params *reverb,
                                           int reflections_delay)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: ref delay", __func__, reflections_delay);
     reverb->reflections_delay = reflections_delay;
 }
 
 void offload_reverb_set_reverb_level(struct reverb_params *reverb,
                                      int reverb_level)
 {
-    ALOGV("%s", __func__);
+    ALOGD("%s: reverb level %d", __func__, reverb_level);
     reverb->level = reverb_level;
 }
 
 void offload_reverb_set_delay(struct reverb_params *reverb, int delay)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: delay %d", __func__, delay);
     reverb->delay = delay;
 }
 
 void offload_reverb_set_diffusion(struct reverb_params *reverb, int diffusion)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: diffusion %d", __func__, diffusion);
     reverb->diffusion = diffusion;
 }
 
 void offload_reverb_set_density(struct reverb_params *reverb, int density)
 {
-    ALOGV("%s", __func__);
+    ALOGVV("%s: density %d", __func__, density);
     reverb->density = density;
 }
 
@@ -479,7 +485,7 @@
     int param_values[128] = {0};
     int *p_param_values = param_values;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: flags 0x%x", __func__, param_send_flags);
     *p_param_values++ = REVERB_MODULE;
     *p_param_values++ = reverb.device;
     *p_param_values++ = 0; /* num of commands*/
diff --git a/post_proc/equalizer.c b/post_proc/equalizer.c
index bde8ef8..4cdd81d 100644
--- a/post_proc/equalizer.c
+++ b/post_proc/equalizer.c
@@ -87,7 +87,7 @@
 
 int equalizer_get_band_level(equalizer_context_t *context, int32_t band)
 {
-    ALOGV("%s: band: %d level: %d", __func__, band,
+    ALOGV("%s: ctxt %p, band: %d level: %d", __func__, context, band,
            context->band_levels[band] * 100);
     return context->band_levels[band] * 100;
 }
@@ -95,7 +95,7 @@
 int equalizer_set_band_level(equalizer_context_t *context, int32_t band,
                              int32_t level)
 {
-    ALOGV("%s: band: %d, level: %d", __func__, band, level);
+    ALOGV("%s: ctxt %p, band: %d, level: %d", __func__, context, band, level);
     if (level > 0) {
         level = (int)((level+50)/100);
     } else {
@@ -118,7 +118,7 @@
 
 int equalizer_get_center_frequency(equalizer_context_t *context, int32_t band)
 {
-    ALOGV("%s: band: %d", __func__, band);
+    ALOGV("%s: ctxt %p, band: %d", __func__, context, band);
     return (equalizer_band_freq_range[band][0] +
             equalizer_band_freq_range[band][1]) / 2;
 }
@@ -126,7 +126,7 @@
 int equalizer_get_band_freq_range(equalizer_context_t *context, int32_t band,
                                   uint32_t *low, uint32_t *high)
 {
-    ALOGV("%s: band: %d", __func__, band);
+    ALOGV("%s: ctxt %p, band: %d", __func__, context, band);
     *low = equalizer_band_freq_range[band][0];
     *high = equalizer_band_freq_range[band][1];
    return 0;
@@ -136,7 +136,7 @@
 {
     int i;
 
-    ALOGV("%s: freq: %d", __func__, freq);
+    ALOGV("%s: ctxt %p, freq: %d", __func__, context, freq);
     for(i = 0; i < NUM_EQ_BANDS; i++) {
         if (freq <= equalizer_band_freq_range[i][1]) {
             return i;
@@ -147,7 +147,7 @@
 
 int equalizer_get_preset(equalizer_context_t *context)
 {
-    ALOGV("%s: preset: %d", __func__, context->preset);
+    ALOGV("%s: ctxt %p, preset: %d", __func__, context, context->preset);
     return context->preset;
 }
 
@@ -155,7 +155,7 @@
 {
     int i;
 
-    ALOGV("%s: preset: %d", __func__, preset);
+    ALOGV("%s: ctxt %p, preset: %d", __func__, context, preset);
     context->preset = preset;
     for (i=0; i<NUM_EQ_BANDS; i++)
         context->band_levels[i] =
@@ -176,7 +176,8 @@
 const char * equalizer_get_preset_name(equalizer_context_t *context,
                                        int32_t preset)
 {
-    ALOGV("%s: preset: %s", __func__, equalizer_preset_names[preset]);
+    ALOGV("%s: ctxt %p, preset: %s", __func__, context,
+                        equalizer_preset_names[preset]);
     if (preset == PRESET_CUSTOM) {
         return "Custom";
     } else {
@@ -186,7 +187,7 @@
 
 int equalizer_get_num_presets(equalizer_context_t *context)
 {
-    ALOGV("%s: presets_num: %d", __func__,
+    ALOGV("%s: ctxt %p, presets_num: %d", __func__, context,
            sizeof(equalizer_preset_names)/sizeof(char *));
     return sizeof(equalizer_preset_names)/sizeof(char *);
 }
@@ -203,7 +204,7 @@
     void *value = p->data + voffset;
     int i;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, param %d", __func__, eq_ctxt, param);
 
     p->status = 0;
 
@@ -255,18 +256,15 @@
 
     switch (param) {
     case EQ_PARAM_NUM_BANDS:
-	ALOGV("%s: EQ_PARAM_NUM_BANDS", __func__);
         *(uint16_t *)value = (uint16_t)NUM_EQ_BANDS;
         break;
 
     case EQ_PARAM_LEVEL_RANGE:
-	ALOGV("%s: EQ_PARAM_LEVEL_RANGE", __func__);
         *(int16_t *)value = -1500;
         *((int16_t *)value + 1) = 1500;
         break;
 
     case EQ_PARAM_BAND_LEVEL:
-	ALOGV("%s: EQ_PARAM_BAND_LEVEL", __func__);
         param2 = *param_tmp;
         if (param2 >= NUM_EQ_BANDS) {
             p->status = -EINVAL;
@@ -276,7 +274,6 @@
         break;
 
     case EQ_PARAM_CENTER_FREQ:
-	ALOGV("%s: EQ_PARAM_CENTER_FREQ", __func__);
         param2 = *param_tmp;
         if (param2 >= NUM_EQ_BANDS) {
            p->status = -EINVAL;
@@ -286,7 +283,6 @@
         break;
 
     case EQ_PARAM_BAND_FREQ_RANGE:
-	ALOGV("%s: EQ_PARAM_BAND_FREQ_RANGE", __func__);
         param2 = *param_tmp;
         if (param2 >= NUM_EQ_BANDS) {
             p->status = -EINVAL;
@@ -297,25 +293,21 @@
         break;
 
     case EQ_PARAM_GET_BAND:
-	ALOGV("%s: EQ_PARAM_GET_BAND", __func__);
         param2 = *param_tmp;
         *(uint16_t *)value = (uint16_t)equalizer_get_band(eq_ctxt, param2);
         break;
 
     case EQ_PARAM_CUR_PRESET:
-	ALOGV("%s: EQ_PARAM_CUR_PRESET", __func__);
         *(uint16_t *)value = (uint16_t)equalizer_get_preset(eq_ctxt);
         break;
 
     case EQ_PARAM_GET_NUM_OF_PRESETS:
-	ALOGV("%s: EQ_PARAM_GET_NUM_OF_PRESETS", __func__);
         *(uint16_t *)value = (uint16_t)equalizer_get_num_presets(eq_ctxt);
         break;
 
     case EQ_PARAM_GET_PRESET_NAME:
-	ALOGV("%s: EQ_PARAM_GET_PRESET_NAME", __func__);
         param2 = *param_tmp;
-	ALOGV("param2: %d", param2);
+        ALOGV("%s: EQ_PARAM_GET_PRESET_NAME: param2: %d", __func__, param2);
         if (param2 >= equalizer_get_num_presets(eq_ctxt)) {
             p->status = -EINVAL;
             break;
@@ -327,7 +319,6 @@
         break;
 
     case EQ_PARAM_PROPERTIES: {
-	ALOGV("%s: EQ_PARAM_PROPERTIES", __func__);
         int16_t *prop = (int16_t *)value;
         prop[0] = (int16_t)equalizer_get_preset(eq_ctxt);
         prop[1] = (int16_t)NUM_EQ_BANDS;
@@ -357,13 +348,12 @@
     int32_t level;
     int i;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, param %d", __func__, eq_ctxt, param);
 
     p->status = 0;
 
     switch (param) {
     case EQ_PARAM_CUR_PRESET:
-	ALOGV("EQ_PARAM_CUR_PRESET");
         preset = (int32_t)(*(uint16_t *)value);
 
         if ((preset >= equalizer_get_num_presets(eq_ctxt)) || (preset < 0)) {
@@ -373,7 +363,6 @@
         equalizer_set_preset(eq_ctxt, preset);
         break;
     case EQ_PARAM_BAND_LEVEL:
-	ALOGV("EQ_PARAM_BAND_LEVEL");
         band =  *param_tmp;
         level = (int32_t)(*(int16_t *)value);
         if (band >= NUM_EQ_BANDS) {
@@ -383,7 +372,6 @@
         equalizer_set_band_level(eq_ctxt, band, level);
         break;
     case EQ_PARAM_PROPERTIES: {
-	ALOGV("EQ_PARAM_PROPERTIES");
         int16_t *prop = (int16_t *)value;
         if ((int)prop[0] >= equalizer_get_num_presets(eq_ctxt)) {
             p->status = -EINVAL;
@@ -411,7 +399,7 @@
 
 int equalizer_set_device(effect_context_t *context,  uint32_t device)
 {
-    ALOGV("%s: device: %d", __func__, device);
+    ALOGV("%s: ctxt %p, device: 0x%x", __func__, context, device);
     equalizer_context_t *eq_ctxt = (equalizer_context_t *)context;
     eq_ctxt->device = device;
     offload_eq_set_device(&(eq_ctxt->offload_eq), device);
@@ -427,7 +415,7 @@
 
 int equalizer_init(effect_context_t *context)
 {
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, context);
     equalizer_context_t *eq_ctxt = (equalizer_context_t *)context;
 
     context->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
@@ -459,7 +447,7 @@
 {
     equalizer_context_t *eq_ctxt = (equalizer_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, context);
 
     if (!offload_eq_get_enable_flag(&(eq_ctxt->offload_eq))) {
         offload_eq_set_enable_flag(&(eq_ctxt->offload_eq), true);
@@ -475,7 +463,7 @@
 {
     equalizer_context_t *eq_ctxt = (equalizer_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s:ctxt %p", __func__, eq_ctxt);
     if (offload_eq_get_enable_flag(&(eq_ctxt->offload_eq))) {
         offload_eq_set_enable_flag(&(eq_ctxt->offload_eq), false);
         if (eq_ctxt->ctl)
@@ -489,7 +477,7 @@
 {
     equalizer_context_t *eq_ctxt = (equalizer_context_t *)context;
 
-    ALOGV("%s: %p", __func__, output->ctl);
+    ALOGV("%s: ctxt %p, ctl %p", __func__, eq_ctxt, output->ctl);
     eq_ctxt->ctl = output->ctl;
     if (offload_eq_get_enable_flag(&(eq_ctxt->offload_eq)))
         if (eq_ctxt->ctl)
@@ -503,7 +491,7 @@
 {
     equalizer_context_t *eq_ctxt = (equalizer_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, eq_ctxt);
     eq_ctxt->ctl = NULL;
     return 0;
 }
diff --git a/post_proc/reverb.c b/post_proc/reverb.c
index 7c50430..81bcb97 100644
--- a/post_proc/reverb.c
+++ b/post_proc/reverb.c
@@ -115,13 +115,13 @@
  */
 int16_t reverb_get_room_level(reverb_context_t *context)
 {
-    ALOGV("%s: room level: %d", __func__, context->reverb_settings.roomLevel);
+    ALOGV("%s: ctxt %p, room level: %d", __func__, context, context->reverb_settings.roomLevel);
     return context->reverb_settings.roomLevel;
 }
 
 void reverb_set_room_level(reverb_context_t *context, int16_t room_level)
 {
-    ALOGV("%s: room level: %d", __func__, room_level);
+    ALOGV("%s: ctxt %p, room level: %d", __func__, context, room_level);
     context->reverb_settings.roomLevel = room_level;
     offload_reverb_set_room_level(&(context->offload_reverb), room_level);
     if (context->ctl)
@@ -132,14 +132,14 @@
 
 int16_t reverb_get_room_hf_level(reverb_context_t *context)
 {
-    ALOGV("%s: room hf level: %d", __func__,
+    ALOGV("%s: ctxt %p, room hf level: %d", __func__, context,
           context->reverb_settings.roomHFLevel);
     return context->reverb_settings.roomHFLevel;
 }
 
 void reverb_set_room_hf_level(reverb_context_t *context, int16_t room_hf_level)
 {
-    ALOGV("%s: room hf level: %d", __func__, room_hf_level);
+    ALOGV("%s: ctxt %p, room hf level: %d", __func__, context, room_hf_level);
     context->reverb_settings.roomHFLevel = room_hf_level;
     offload_reverb_set_room_hf_level(&(context->offload_reverb), room_hf_level);
     if (context->ctl)
@@ -150,13 +150,14 @@
 
 uint32_t reverb_get_decay_time(reverb_context_t *context)
 {
-    ALOGV("%s: decay time: %d", __func__, context->reverb_settings.decayTime);
+    ALOGV("%s: ctxt %p, decay time: %d", __func__, context,
+                         context->reverb_settings.decayTime);
     return context->reverb_settings.decayTime;
 }
 
 void reverb_set_decay_time(reverb_context_t *context, uint32_t decay_time)
 {
-    ALOGV("%s: decay_time: %d", __func__, decay_time);
+    ALOGV("%s: ctxt %p, decay_time: %d", __func__, context, decay_time);
     context->reverb_settings.decayTime = decay_time;
     offload_reverb_set_decay_time(&(context->offload_reverb), decay_time);
     if (context->ctl)
@@ -167,14 +168,14 @@
 
 int16_t reverb_get_decay_hf_ratio(reverb_context_t *context)
 {
-    ALOGV("%s: decay hf ratio: %d", __func__,
+    ALOGV("%s: ctxt %p, decay hf ratio: %d", __func__, context,
           context->reverb_settings.decayHFRatio);
     return context->reverb_settings.decayHFRatio;
 }
 
 void reverb_set_decay_hf_ratio(reverb_context_t *context, int16_t decay_hf_ratio)
 {
-    ALOGV("%s: decay_hf_ratio: %d", __func__, decay_hf_ratio);
+    ALOGV("%s: ctxt %p, decay_hf_ratio: %d", __func__, context, decay_hf_ratio);
     context->reverb_settings.decayHFRatio = decay_hf_ratio;
     offload_reverb_set_decay_hf_ratio(&(context->offload_reverb), decay_hf_ratio);
     if (context->ctl)
@@ -185,13 +186,14 @@
 
 int16_t reverb_get_reverb_level(reverb_context_t *context)
 {
-    ALOGV("%s: reverb level: %d", __func__, context->reverb_settings.reverbLevel);
+    ALOGV("%s: ctxt %p, reverb level: %d", __func__, context,
+                         context->reverb_settings.reverbLevel);
     return context->reverb_settings.reverbLevel;
 }
 
 void reverb_set_reverb_level(reverb_context_t *context, int16_t reverb_level)
 {
-    ALOGV("%s: reverb level: %d", __func__, reverb_level);
+    ALOGV("%s: ctxt %p, reverb level: %d", __func__, context, reverb_level);
     context->reverb_settings.reverbLevel = reverb_level;
     offload_reverb_set_reverb_level(&(context->offload_reverb), reverb_level);
     if (context->ctl)
@@ -202,13 +204,14 @@
 
 int16_t reverb_get_diffusion(reverb_context_t *context)
 {
-    ALOGV("%s: diffusion: %d", __func__, context->reverb_settings.diffusion);
+    ALOGV("%s: ctxt %p, diffusion: %d", __func__, context,
+                        context->reverb_settings.diffusion);
     return context->reverb_settings.diffusion;
 }
 
 void reverb_set_diffusion(reverb_context_t *context, int16_t diffusion)
 {
-    ALOGV("%s: diffusion: %d", __func__, diffusion);
+    ALOGV("%s: ctxt %p, diffusion: %d", __func__, context, diffusion);
     context->reverb_settings.diffusion = diffusion;
     offload_reverb_set_diffusion(&(context->offload_reverb), diffusion);
     if (context->ctl)
@@ -219,13 +222,14 @@
 
 int16_t reverb_get_density(reverb_context_t *context)
 {
-    ALOGV("%s: density: %d", __func__, context->reverb_settings.density);
+    ALOGV("%s: ctxt %p, density: %d", __func__, context,
+                          context->reverb_settings.density);
     return context->reverb_settings.density;
 }
 
 void reverb_set_density(reverb_context_t *context, int16_t density)
 {
-    ALOGV("%s: density: %d", __func__, density);
+    ALOGV("%s: ctxt %p, density: %d", __func__, density, density);
     context->reverb_settings.density = density;
     offload_reverb_set_density(&(context->offload_reverb), density);
     if (context->ctl)
@@ -237,7 +241,7 @@
 void reverb_set_preset(reverb_context_t *context, int16_t preset)
 {
     bool enable;
-    ALOGV("%s: preset: %d", __func__, preset);
+    ALOGV("%s: ctxt %p, preset: %d", __func__, context, preset);
     context->next_preset = preset;
     offload_reverb_set_preset(&(context->offload_reverb), preset);
 
@@ -253,7 +257,7 @@
 void reverb_set_all_properties(reverb_context_t *context,
                                reverb_settings_t *reverb_settings)
 {
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, context);
     context->reverb_settings.roomLevel = reverb_settings->roomLevel;
     context->reverb_settings.roomHFLevel = reverb_settings->roomHFLevel;
     context->reverb_settings.decayTime = reverb_settings->decayTime;
@@ -300,7 +304,7 @@
     reverb_settings_t *reverb_settings;
     int i;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, param %d", __func__, reverb_ctxt, param);
 
     p->status = 0;
 
@@ -378,7 +382,6 @@
 
     switch (param) {
     case REVERB_PARAM_PROPERTIES:
-	ALOGV("%s: REVERB_PARAM_PROPERTIES", __func__);
         reverb_settings = (reverb_settings_t *)value;
         reverb_settings->roomLevel = reverb_get_room_level(reverb_ctxt);
         reverb_settings->roomHFLevel = reverb_get_room_hf_level(reverb_ctxt);
@@ -392,43 +395,33 @@
         reverb_settings->density = reverb_get_density(reverb_ctxt);
         break;
     case REVERB_PARAM_ROOM_LEVEL:
-	ALOGV("%s: REVERB_PARAM_ROOM_LEVEL", __func__);
         *(int16_t *)value = reverb_get_room_level(reverb_ctxt);
         break;
     case REVERB_PARAM_ROOM_HF_LEVEL:
-	ALOGV("%s: REVERB_PARAM_ROOM_HF_LEVEL", __func__);
         *(int16_t *)value = reverb_get_room_hf_level(reverb_ctxt);
         break;
     case REVERB_PARAM_DECAY_TIME:
-	ALOGV("%s: REVERB_PARAM_DECAY_TIME", __func__);
         *(uint32_t *)value = reverb_get_decay_time(reverb_ctxt);
         break;
     case REVERB_PARAM_DECAY_HF_RATIO:
-	ALOGV("%s: REVERB_PARAM_DECAY_HF_RATIO", __func__);
         *(int16_t *)value = reverb_get_decay_hf_ratio(reverb_ctxt);
         break;
     case REVERB_PARAM_REVERB_LEVEL:
-	ALOGV("%s: REVERB_PARAM_REVERB_LEVEL", __func__);
         *(int16_t *)value = reverb_get_reverb_level(reverb_ctxt);
         break;
     case REVERB_PARAM_DIFFUSION:
-	ALOGV("%s: REVERB_PARAM_DIFFUSION", __func__);
         *(int16_t *)value = reverb_get_diffusion(reverb_ctxt);
         break;
     case REVERB_PARAM_DENSITY:
-	ALOGV("%s: REVERB_PARAM_DENSITY", __func__);
         *(int16_t *)value = reverb_get_density(reverb_ctxt);
         break;
     case REVERB_PARAM_REFLECTIONS_LEVEL:
-	ALOGV("%s: REVERB_PARAM_REFLECTIONS_LEVEL", __func__);
         *(uint16_t *)value = 0;
         break;
     case REVERB_PARAM_REFLECTIONS_DELAY:
-	ALOGV("%s: REVERB_PARAM_REFLECTIONS_DELAY", __func__);
         *(uint32_t *)value = 0;
         break;
     case REVERB_PARAM_REVERB_DELAY:
-	ALOGV("%s: REVERB_PARAM_REVERB_DELAY", __func__);
         *(uint32_t *)value = 0;
         break;
     default:
@@ -452,7 +445,7 @@
     int16_t ratio;
     uint32_t time;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, param %d", __func__, reverb_ctxt, param);
 
     p->status = 0;
 
@@ -469,41 +462,33 @@
     }
     switch (param) {
     case REVERB_PARAM_PROPERTIES:
-	ALOGV("%s: REVERB_PARAM_PROPERTIES", __func__);
         reverb_settings = (reverb_settings_t *)value;
         break;
     case REVERB_PARAM_ROOM_LEVEL:
-	ALOGV("%s: REVERB_PARAM_ROOM_LEVEL", __func__);
         level = *(int16_t *)value;
         reverb_set_room_level(reverb_ctxt, level);
         break;
     case REVERB_PARAM_ROOM_HF_LEVEL:
-	ALOGV("%s: REVERB_PARAM_ROOM_HF_LEVEL", __func__);
         level = *(int16_t *)value;
         reverb_set_room_hf_level(reverb_ctxt, level);
         break;
     case REVERB_PARAM_DECAY_TIME:
-	ALOGV("%s: REVERB_PARAM_DECAY_TIME", __func__);
         time = *(uint32_t *)value;
         reverb_set_decay_time(reverb_ctxt, time);
         break;
     case REVERB_PARAM_DECAY_HF_RATIO:
-	ALOGV("%s: REVERB_PARAM_DECAY_HF_RATIO", __func__);
         ratio = *(int16_t *)value;
         reverb_set_decay_hf_ratio(reverb_ctxt, ratio);
         break;
     case REVERB_PARAM_REVERB_LEVEL:
-	ALOGV("%s: REVERB_PARAM_REVERB_LEVEL", __func__);
         level = *(int16_t *)value;
         reverb_set_reverb_level(reverb_ctxt, level);
         break;
     case REVERB_PARAM_DIFFUSION:
-	ALOGV("%s: REVERB_PARAM_DIFFUSION", __func__);
         ratio = *(int16_t *)value;
         reverb_set_diffusion(reverb_ctxt, ratio);
         break;
     case REVERB_PARAM_DENSITY:
-	ALOGV("%s: REVERB_PARAM_DENSITY", __func__);
         ratio = *(int16_t *)value;
         reverb_set_density(reverb_ctxt, ratio);
         break;
@@ -523,7 +508,7 @@
 {
     reverb_context_t *reverb_ctxt = (reverb_context_t *)context;
 
-    ALOGV("%s: device: %d", __func__, device);
+    ALOGV("%s: ctxt %p, device: 0x%x", __func__, reverb_ctxt, device);
     reverb_ctxt->device = device;
     offload_reverb_set_device(&(reverb_ctxt->offload_reverb), device);
     return 0;
@@ -540,6 +525,7 @@
 {
     reverb_context_t *reverb_ctxt = (reverb_context_t *)context;
 
+    ALOGV("%s: ctxt %p", __func__, reverb_ctxt);
     context->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
     /*
        FIXME: channel mode is mono for auxiliary. is it needed for offload ?
@@ -577,7 +563,7 @@
 {
     reverb_context_t *reverb_ctxt = (reverb_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, reverb_ctxt);
 
     if (!offload_reverb_get_enable_flag(&(reverb_ctxt->offload_reverb)))
         offload_reverb_set_enable_flag(&(reverb_ctxt->offload_reverb), true);
@@ -588,7 +574,7 @@
 {
     reverb_context_t *reverb_ctxt = (reverb_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, reverb_ctxt);
     if (offload_reverb_get_enable_flag(&(reverb_ctxt->offload_reverb))) {
         offload_reverb_set_enable_flag(&(reverb_ctxt->offload_reverb), false);
         if (reverb_ctxt->ctl)
@@ -603,7 +589,7 @@
 {
     reverb_context_t *reverb_ctxt = (reverb_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, ctl %p", __func__, reverb_ctxt, output->ctl);
     reverb_ctxt->ctl = output->ctl;
     if (offload_reverb_get_enable_flag(&(reverb_ctxt->offload_reverb))) {
         if (reverb_ctxt->ctl && reverb_ctxt->preset) {
@@ -620,7 +606,7 @@
 {
     reverb_context_t *reverb_ctxt = (reverb_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, reverb_ctxt);
     reverb_ctxt->ctl = NULL;
     return 0;
 }
diff --git a/post_proc/virtualizer.c b/post_proc/virtualizer.c
index 205b250..bd52062 100644
--- a/post_proc/virtualizer.c
+++ b/post_proc/virtualizer.c
@@ -47,13 +47,13 @@
 
 int virtualizer_get_strength(virtualizer_context_t *context)
 {
-    ALOGV("%s: strength: %d", __func__, context->strength);
+    ALOGV("%s: ctxt %p, strength: %d", __func__, context, context->strength);
     return context->strength;
 }
 
 int virtualizer_set_strength(virtualizer_context_t *context, uint32_t strength)
 {
-    ALOGV("%s: strength: %d", __func__, strength);
+    ALOGV("%s: ctxt %p, strength: %d", __func__, context, strength);
     context->strength = strength;
 
     offload_virtualizer_set_strength(&(context->offload_virt), strength);
@@ -74,7 +74,7 @@
     void *value = p->data + voffset;
     int i;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, param %d", __func__, virt_ctxt, param);
 
     p->status = 0;
 
@@ -100,12 +100,10 @@
 
     switch (param) {
     case VIRTUALIZER_PARAM_STRENGTH_SUPPORTED:
-        ALOGV("%s: VIRTUALIZER_PARAM_STRENGTH_SUPPORTED", __func__);
         *(uint32_t *)value = 1;
         break;
 
     case VIRTUALIZER_PARAM_STRENGTH:
-        ALOGV("%s: VIRTUALIZER_PARAM_STRENGTH", __func__);
         *(int16_t *)value = virtualizer_get_strength(virt_ctxt);
         break;
 
@@ -127,13 +125,12 @@
     int32_t param = *param_tmp++;
     uint32_t strength;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, param %d", __func__, virt_ctxt, param);
 
     p->status = 0;
 
     switch (param) {
     case VIRTUALIZER_PARAM_STRENGTH:
-        ALOGV("%s VIRTUALIZER_PARAM_STRENGTH", __func__);
         strength = (uint32_t)(*(int16_t *)value);
         virtualizer_set_strength(virt_ctxt, strength);
         break;
@@ -149,7 +146,7 @@
 {
     virtualizer_context_t *virt_ctxt = (virtualizer_context_t *)context;
 
-    ALOGV("%s: device: %d", __func__, device);
+    ALOGV("%s: ctxt %p, device: 0x%x", __func__, virt_ctxt, device);
     virt_ctxt->device = device;
     if((device == AUDIO_DEVICE_OUT_SPEAKER) ||
        (device == AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT) ||
@@ -166,6 +163,7 @@
                 offload_virtualizer_send_params(virt_ctxt->ctl,
                                               virt_ctxt->offload_virt,
                                               OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG);
+            ALOGI("%s: ctxt %p, disabled based on device", __func__, virt_ctxt);
         }
     } else {
         if (!offload_virtualizer_get_enable_flag(&(virt_ctxt->offload_virt)) &&
@@ -191,7 +189,7 @@
 
 int virtualizer_init(effect_context_t *context)
 {
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, context);
     virtualizer_context_t *virt_ctxt = (virtualizer_context_t *)context;
 
     context->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
@@ -222,7 +220,7 @@
 {
     virtualizer_context_t *virt_ctxt = (virtualizer_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, strength %d", __func__, virt_ctxt, virt_ctxt->strength);
 
     if (!offload_virtualizer_get_enable_flag(&(virt_ctxt->offload_virt)) &&
         !(virt_ctxt->temp_disabled)) {
@@ -240,7 +238,7 @@
 {
     virtualizer_context_t *virt_ctxt = (virtualizer_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, virt_ctxt);
     if (offload_virtualizer_get_enable_flag(&(virt_ctxt->offload_virt))) {
         offload_virtualizer_set_enable_flag(&(virt_ctxt->offload_virt), false);
         if (virt_ctxt->ctl)
@@ -255,7 +253,7 @@
 {
     virtualizer_context_t *virt_ctxt = (virtualizer_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p, ctl %p", __func__, virt_ctxt, output->ctl);
     virt_ctxt->ctl = output->ctl;
     if (offload_virtualizer_get_enable_flag(&(virt_ctxt->offload_virt)))
         if (virt_ctxt->ctl)
@@ -269,7 +267,7 @@
 {
     virtualizer_context_t *virt_ctxt = (virtualizer_context_t *)context;
 
-    ALOGV("%s", __func__);
+    ALOGV("%s: ctxt %p", __func__, virt_ctxt);
     virt_ctxt->ctl = NULL;
     return 0;
 }