initial commit, taken and modified from linaro/insignal
diff --git a/exynos4/multimedia/Android.mk b/exynos4/multimedia/Android.mk
new file mode 100644
index 0000000..f739953
--- /dev/null
+++ b/exynos4/multimedia/Android.mk
@@ -0,0 +1,3 @@
+ifeq ($(TARGET_BOARD_PLATFORM),exynos4)
+include $(all-subdir-makefiles)
+endif
diff --git a/exynos4/multimedia/codecs/Android.mk b/exynos4/multimedia/codecs/Android.mk
new file mode 100644
index 0000000..6571161
--- /dev/null
+++ b/exynos4/multimedia/codecs/Android.mk
@@ -0,0 +1 @@
+include $(all-subdir-makefiles)
diff --git a/exynos4/multimedia/codecs/sec_codecs/Android.mk b/exynos4/multimedia/codecs/sec_codecs/Android.mk
new file mode 100644
index 0000000..6571161
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/Android.mk
@@ -0,0 +1 @@
+include $(all-subdir-makefiles)
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/Android.mk b/exynos4/multimedia/codecs/sec_codecs/audio/Android.mk
new file mode 100644
index 0000000..3bc3577
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
+include   $(LOCAL_PATH)/exynos4/Android.mk
+endif
+
+ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
+include   $(LOCAL_PATH)/exynos5/Android.mk
+endif
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/Android.mk b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/Android.mk
new file mode 100644
index 0000000..df938be
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/Android.mk
@@ -0,0 +1,14 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_AUDIO_PATH :=$(LOCAL_PATH)
+
+ifeq ($(BOARD_USE_ALP_AUDIO), true)
+  include $(LOCAL_AUDIO_PATH)/srp/alp/Android.mk
+else
+  ifeq ($(USE_ULP_AUDIO), true)
+    include $(LOCAL_AUDIO_PATH)/srp/ulp/Android.mk
+    include $(LOCAL_AUDIO_PATH)/srp/libsa_jni/Android.mk
+  endif
+endif
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/Android.mk b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/Android.mk
new file mode 100644
index 0000000..7393f68
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/Android.mk
@@ -0,0 +1,26 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_COPY_HEADERS_TO := libsecmm
+LOCAL_COPY_HEADERS := \
+	include/srp_api.h \
+	include/srp_ioctl.h \
+	include/srp_error.h
+
+LOCAL_SRC_FILES := \
+	src/srp_api.c
+
+LOCAL_C_INCLUDES := \
+	$(LOCAL_PATH)/include
+
+LOCAL_MODULE := libsrpapi
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES :=
+
+LOCAL_SHARED_LIBRARIES :=
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/include/srp_api.h b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/include/srp_api.h
new file mode 100644
index 0000000..ad65b90
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/include/srp_api.h
@@ -0,0 +1,52 @@
+#ifndef __SRP_API_H__
+#define __SRP_API_H__
+
+#include "srp_ioctl.h"
+#include "srp_error.h"
+
+#define SRP_DEV_NAME                    "dev/srp"
+
+#define SRP_INIT_BLOCK_MODE             0
+#define SRP_INIT_NONBLOCK_MODE          1
+
+#define SRP_PENDING_STATE_RUNNING       0
+#define SRP_PENDING_STATE_PENDING       1
+
+struct srp_buf_info {
+    void *mmapped_addr;
+    void *addr;
+    unsigned int mmapped_size;
+    unsigned int size;
+    int num;
+};
+
+struct srp_dec_info {
+    unsigned int sample_rate;
+    unsigned int channels;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int SRP_Create(int block_mode);
+int SRP_Init();
+int SRP_Decode(void *buff, int size_byte);
+int SRP_Send_EOS(void);
+int SRP_SetParams(int id, unsigned long val);
+int SRP_GetParams(int id, unsigned long *pval);
+int SRP_Deinit(void);
+int SRP_Terminate(void);
+int SRP_IsOpen(void);
+
+int SRP_Get_Ibuf_Info(void **addr, unsigned int *size, unsigned int *num);
+int SRP_Get_Obuf_Info(void **addr, unsigned int *size, unsigned int *num);
+int SRP_Get_Dec_Info(struct srp_dec_info *dec_info);
+int SRP_Get_PCM(void **addr, unsigned int *size);
+int SRP_Flush(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__SRP_API_H__ */
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/include/srp_error.h b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/include/srp_error.h
new file mode 100644
index 0000000..7f79452
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/include/srp_error.h
@@ -0,0 +1,22 @@
+#ifndef _SRP_ERROR_H_
+#define _SRP_ERROR_H_
+
+typedef enum {
+    SRP_RETURN_OK = 0,
+
+    SRP_ERROR_OPEN_FAIL       = -1000,
+    SRP_ERROR_ALREADY_OPEN    = -1001,
+    SRP_ERROR_NOT_READY       = -1002,
+
+    SRP_ERROR_IBUF_OVERFLOW   = -2000,
+    SRP_ERROR_IBUF_INFO       = -2001,
+
+    SRP_ERROR_OBUF_READ       = -3000,
+    SRP_ERROR_OBUF_INFO       = -3001,
+    SRP_ERROR_OBUF_MMAP       = -3002,
+
+    SRP_ERROR_INVALID_SETTING = -4000,
+    SRP_ERROR_GETINFO_FAIL    = -4001
+} SRP_ERRORTYPE;
+
+#endif /* _SRP_ERROR_H_ */
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/include/srp_ioctl.h b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/include/srp_ioctl.h
new file mode 100644
index 0000000..21d55df
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/include/srp_ioctl.h
@@ -0,0 +1,23 @@
+#ifndef __SRP_IOCTL_H__
+#define __SRP_IOCTL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SRP_INIT                             (0x10000)
+#define SRP_DEINIT                           (0x10001)
+#define SRP_GET_MMAP_SIZE                    (0x10002)
+#define SRP_FLUSH                            (0x20002)
+#define SRP_SEND_EOS                         (0x20005)
+#define SRP_GET_IBUF_INFO                    (0x20007)
+#define SRP_GET_OBUF_INFO                    (0x20008)
+#define SRP_STOP_EOS_STATE                   (0x30007)
+#define SRP_GET_DEC_INFO                     (0x30008)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SRP_IOCTL_H__ */
+
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/src/srp_api.c b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/src/srp_api.c
new file mode 100644
index 0000000..56125fb
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/alp/src/srp_api.c
@@ -0,0 +1,265 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include "srp_api.h"
+
+#define LOG_NDEBUG 1
+#define LOG_TAG "libsrpapi"
+#include <utils/Log.h>
+
+static struct srp_buf_info ibuf_info;
+static struct srp_buf_info obuf_info;
+static struct srp_buf_info pcm_info;
+
+static int srp_dev = -1;
+static int srp_block_mode = SRP_INIT_BLOCK_MODE;
+
+int SRP_Create(int block_mode)
+{
+    if (srp_dev == -1) {
+        srp_block_mode = block_mode;
+        srp_dev = open(SRP_DEV_NAME, O_RDWR |
+                    ((block_mode == SRP_INIT_NONBLOCK_MODE) ? O_NDELAY : 0));
+        if (srp_dev > 0)
+            return srp_dev;
+        else
+            return SRP_ERROR_OPEN_FAIL;
+    }
+
+    LOGE("%s: Device is already opened", __func__);
+    return SRP_ERROR_ALREADY_OPEN;
+}
+
+int SRP_Init()
+{
+    int ret = SRP_RETURN_OK;
+    unsigned int mmapped_size = 0;
+
+    if (srp_dev != -1) {
+        ret = ioctl(srp_dev, SRP_INIT);
+        if (ret < 0)
+            return ret;
+
+        /* mmap for OBUF */
+        ret = ioctl(srp_dev, SRP_GET_MMAP_SIZE, &mmapped_size);
+        if (ret < 0) {
+            LOGE("%s: SRP_GET_MMAP_SIZE is failed", __func__);
+            return SRP_ERROR_OBUF_MMAP;
+        }
+        obuf_info.mmapped_addr = mmap(0, mmapped_size,
+                    PROT_READ | PROT_WRITE, MAP_SHARED, srp_dev, 0);
+        if (!obuf_info.mmapped_addr) {
+            LOGE("%s: mmap is failed", __func__);
+            return SRP_ERROR_OBUF_MMAP;
+        }
+        obuf_info.mmapped_size = mmapped_size;
+
+        ret = SRP_RETURN_OK;
+    } else {
+        LOGE("%s: Device is not ready", __func__);
+        ret = SRP_ERROR_NOT_READY; /* device is not created */
+    }
+
+    return ret;
+}
+
+int SRP_Decode(void *buff, int size_byte)
+{
+    int ret = SRP_RETURN_OK;
+
+    if (srp_dev != -1) {
+        if (size_byte > 0) {
+            LOGV("%s: Send data to RP (%d bytes)", __func__, size_byte);
+
+            ret = write(srp_dev, buff, size_byte);  /* Write Buffer to RP Driver */
+            if (ret < 0) {
+                if (ret != SRP_ERROR_IBUF_OVERFLOW)
+                    LOGE("SRP_Decode returned error code: %d", ret);
+            }
+            return ret; /* Write Success */
+        } else {
+            return ret;
+        }
+    }
+
+    LOGE("%s: Device is not ready", __func__);
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_Send_EOS(void)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, SRP_SEND_EOS);
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_SetParams(int id, unsigned long val)
+{
+    if (srp_dev != -1)
+        return 0; /* not yet */
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_GetParams(int id, unsigned long *pval)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, id, pval);
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_Flush(void)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, SRP_FLUSH);
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_Get_PCM(void **addr, unsigned int *size)
+{
+    int ret = SRP_RETURN_OK;
+
+    if (srp_dev != -1) {
+        ret = read(srp_dev, &pcm_info, 0);
+        if (ret == -1) {
+            *size = 0;
+            LOGE("%s: PCM read fail", __func__);
+            return SRP_ERROR_OBUF_READ;
+        }
+
+        *addr = pcm_info.addr;
+        *size = pcm_info.size;
+    } else {
+        return SRP_ERROR_NOT_READY;
+    }
+
+    return ret; /* Read Success */
+}
+
+int SRP_Get_Dec_Info(struct srp_dec_info *dec_info)
+{
+    int ret;
+
+    if (srp_dev != -1) {
+        ret = ioctl(srp_dev, SRP_GET_DEC_INFO, dec_info);
+        if (ret < 0) {
+            LOGE("%s: Failed to get dec info", __func__);
+            return SRP_ERROR_GETINFO_FAIL;
+        }
+
+        LOGV("numChannels(%d), samplingRate(%d)", dec_info->channels, dec_info->sample_rate);
+
+        ret = SRP_RETURN_OK;
+    } else {
+        ret = SRP_ERROR_NOT_READY;
+    }
+
+    return ret;
+}
+
+int SRP_Get_Ibuf_Info(void **addr, unsigned int *size, unsigned int *num)
+{
+    int ret = SRP_RETURN_OK;
+
+    if (srp_dev != -1) {
+        ret = ioctl(srp_dev, SRP_GET_IBUF_INFO, &ibuf_info);
+        if (ret == -1) {
+            LOGE("%s: Failed to get Ibuf info", __func__);
+            return SRP_ERROR_IBUF_INFO;
+        }
+
+        *addr = ibuf_info.addr;
+        *size = ibuf_info.size;
+        *num = ibuf_info.num;
+
+        if (*num == 0) {
+            LOGE("%s: IBUF num is 0", __func__);
+            return SRP_ERROR_INVALID_SETTING;
+        }
+
+        ret = SRP_RETURN_OK;
+    } else {
+        ret = SRP_ERROR_NOT_READY;
+    }
+
+    return ret;
+}
+
+int SRP_Get_Obuf_Info(void **addr, unsigned int *size, unsigned int *num)
+{
+    int ret = SRP_RETURN_OK;
+
+    if (srp_dev != -1) {
+        if (obuf_info.addr == NULL) {
+            ret = ioctl(srp_dev, SRP_GET_OBUF_INFO, &obuf_info);
+            if (ret < 0) {
+                LOGE("%s: SRP_GET_OBUF_INFO is failed", __func__);
+                return SRP_ERROR_OBUF_INFO;
+            }
+        }
+
+        *addr = obuf_info.addr;
+        *size = obuf_info.size;
+        *num = obuf_info.num;
+
+        if (*num == 0) {
+            LOGE("%s: OBUF num is 0", __func__);
+            return SRP_ERROR_INVALID_SETTING;
+        }
+
+        ret = SRP_RETURN_OK;
+    } else {
+        ret = SRP_ERROR_NOT_READY;
+    }
+
+    return ret;
+}
+
+int SRP_Deinit(void)
+{
+    if (srp_dev != -1) {
+        munmap(obuf_info.mmapped_addr, obuf_info.mmapped_size);
+        return ioctl(srp_dev, SRP_DEINIT);
+    }
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_Terminate(void)
+{
+    int ret;
+
+    if (srp_dev != -1) {
+        ret = close(srp_dev);
+
+        if (ret == 0) {
+            srp_dev = -1; /* device closed */
+            return SRP_RETURN_OK;
+        }
+    }
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_IsOpen(void)
+{
+    if (srp_dev == -1) {
+        LOGV("%s: Device is not opened", __func__);
+        return 0;
+    }
+
+    LOGV("%s: Device is opened", __func__);
+    return 1;
+}
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/libsa_jni/Android.mk b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/libsa_jni/Android.mk
new file mode 100644
index 0000000..8450845
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/libsa_jni/Android.mk
@@ -0,0 +1,13 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_MODULE := libsa_jni
+LOCAL_SRC_FILES := SACtrl.c
+
+LOCAL_SHARED_LIBRARIES :=  libcutils
+LOCAL_STATIC_LIBRARIES := libsrpapi
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/libsa_jni/SACtrl.c b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/libsa_jni/SACtrl.c
new file mode 100644
index 0000000..6b99dc3
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/libsa_jni/SACtrl.c
@@ -0,0 +1,33 @@
+#include <jni.h>
+#include <time.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "srp_api_ctrl.h"
+
+#define LOG_TAG "libsa_jni"
+#include <cutils/log.h>
+
+void Java_com_android_music_SetSACtrlJNI_set(JNIEnv * env, jobject obj, int effect_num)
+{
+    unsigned long effect_enable = effect_num ? 1 : 0;
+    unsigned int ret;
+
+    LOGD("Sound effect[%d]", effect_num);
+
+    ret = SRP_Ctrl_Enable_Effect(effect_enable);
+    if (ret < 0) {
+        LOGE("%s: Couldn't enabled effect\n", __func__);
+        return;
+    }
+
+    SRP_Ctrl_Set_Effect_Def(effect_num << 5);
+    if (ret < 0) {
+        LOGE("%s: Couldn't defined effect\n", __func__);
+        return;
+    }
+
+    return;
+}
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/Android.mk b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/Android.mk
new file mode 100644
index 0000000..5b1d397
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/Android.mk
@@ -0,0 +1,23 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+	src/srp_api.c \
+	src/srp_api_ctrl.c
+
+LOCAL_MODULE := libsrpapi
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES :=
+
+LOCAL_SHARED_LIBRARIES :=
+
+LOCAL_COPY_HEADERS := \
+	include/srp_api.h \
+	include/srp_api_ctrl.h \
+	include/srp_ioctl.h
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/include/srp_api.h b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/include/srp_api.h
new file mode 100644
index 0000000..74598e5
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/include/srp_api.h
@@ -0,0 +1,55 @@
+#ifndef __SRP_API_H__
+#define __SRP_API_H__
+
+#include "srp_ioctl.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int SRP_Create(int block_mode);
+int SRP_Init(unsigned int ibuf_size);
+int SRP_Decode(void *buff, int size_byte);
+int SRP_Send_EOS(void);
+int SRP_Resume_EOS(void);
+int SRP_Pause(void);
+int SRP_Stop(void);
+int SRP_Flush(void);
+int SRP_SetParams(int id, unsigned long val);
+int SRP_GetParams(int id, unsigned long *pval);
+int SRP_Deinit(void);
+int SRP_Terminate(void);
+int SRP_IsOpen(void);
+
+#define SRP_DEV_NAME                         "dev/srp"
+
+#define SRP_INIT_BLOCK_MODE                  0
+#define SRP_INIT_NONBLOCK_MODE               1
+
+#define SRP_PENDING_STATE_RUNNING            0
+#define SRP_PENDING_STATE_PENDING            1
+
+#define SRP_ERROR_LOSTSYNC                   0x00101
+#define SRP_ERROR_BADLAYER                   0x00102
+#define SRP_ERROR_BADBITRATE                 0x00103
+#define SRP_ERROR_BADSAMPLERATE              0x00104
+#define SRP_ERROR_BADEMPHASIS                0x00105
+
+#define SRP_ERROR_BADCRC                     0x00201
+#define SRP_ERROR_BADBITALLOC                0x00211
+#define SRP_ERROR_BADBADSCALEFACTOR          0x00221
+#define SRP_ERROR_BADFRAMELEN                0x00231
+#define SRP_ERROR_BADBIGVALUES               0x00232
+#define SRP_ERROR_BADBLOCKTYPE               0x00233
+#define SRP_ERROR_BADSCFSI                   0x00234
+#define SRP_ERROR_BADDATAPTR                 0x00235
+#define SRP_ERROR_BADPART3LEN                0x00236
+#define SRP_ERROR_BADHUFFTABLE               0x00237
+#define SRP_ERROR_BADHUFFDATA                0x00238
+#define SRP_ERROR_BADSTEREO                  0x00239
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__SRP_API_H__ */
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/include/srp_api_ctrl.h b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/include/srp_api_ctrl.h
new file mode 100644
index 0000000..3b17acf
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/include/srp_api_ctrl.h
@@ -0,0 +1,25 @@
+#ifndef __SRP_API_CTRL_H__
+#define __SRP_API_CTRL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SRP_CTRL_DEV_NAME    "dev/srp_ctrl"
+
+int SRP_Ctrl_Set_Effect(int effect);    /* test only */
+int SRP_Ctrl_Enable_Effect(int on);
+int SRP_Ctrl_Set_Effect_Def(unsigned long effect_def);
+int SRP_Ctrl_Set_Effect_EQ_User(unsigned long eq_user);
+int SRP_Ctrl_Set_Pcm_Dump(int on);
+int SRP_Ctrl_Get_Pcm_Dump_State(void);
+int SRP_Ctrl_Set_Gain(float value);
+int SRP_Ctrl_Get_Running_Stat(void);
+int SRP_Ctrl_Get_Open_Stat(void);
+short *SRP_Ctrl_Get_Pcm(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SRP_API_CTRL_H__ */
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/include/srp_ioctl.h b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/include/srp_ioctl.h
new file mode 100644
index 0000000..a20b1ac
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/include/srp_ioctl.h
@@ -0,0 +1,66 @@
+#ifndef __SRP_IOCTL_H__
+#define __SRP_IOCTL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* constants for srp device node */
+#define SRP_INIT                             (0x10000)
+#define SRP_DEINIT                           (0x10001)
+
+#define SRP_PAUSE                            (0x20000)
+#define SRP_STOP                             (0x20001)
+#define SRP_FLUSH                            (0x20002)
+#define SRP_WAIT_EOS                         (0x20003)
+#define SRP_EFFECT                           (0x20004)
+#define SRP_SEND_EOS                         (0x20005)
+#define SRP_RESUME_EOS                       (0x20006)
+
+#define SRP_PENDING_STATE                    (0x30000)
+#define SRP_ERROR_STATE                      (0x30001)
+#define SRP_DECODED_FRAME_NO                 (0x30002)
+#define SRP_DECODED_ONE_FRAME_SIZE           (0x30003)
+#define SRP_DECODED_FRAME_SIZE               (0x30004)
+#define SRP_DECODED_PCM_SIZE                 (0x30005)
+#define SRP_CHANNEL_COUNT                    (0x30006)
+#define SRP_STOP_EOS_STATE                   (0x30007)
+
+/* constants for srp_ctrl device node*/
+#define SRP_CTRL_SET_GAIN                    (0xFF000)
+#define SRP_CTRL_SET_EFFECT                  (0xFF001)
+#define SRP_CTRL_GET_PCM_1KFRAME             (0xFF002)
+#define SRP_CTRL_PCM_DUMP_OP                 (0xFF003)
+
+#define SRP_CTRL_EFFECT_ENABLE               (0xFF010)
+#define SRP_CTRL_EFFECT_DEF                  (0xFF011)
+#define SRP_CTRL_EFFECT_EQ_USR               (0xFF012)
+#define SRP_CTRL_EFFECT_SPEAKER              (0xFF013)
+
+#define SRP_CTRL_IS_RUNNING                  (0xFF100)
+#define SRP_CTRL_IS_OPENED                   (0xFF101)
+#define SRP_CTRL_GET_OP_LEVEL                (0xFF102)
+#define SRP_CTRL_IS_PCM_DUMP                 (0xFF103)
+
+#define SRP_CTRL_ALTFW_STATE                 (0xFF200)
+#define SRP_CTRL_ALTFW_LOAD                  (0xFF201)
+
+/* constants for SRP firmware */
+#define SRP_FW_CODE1                         0
+#define SRP_FW_CODE20                        1
+#define SRP_FW_CODE21                        2
+#define SRP_FW_CODE22                        3
+#define SRP_FW_CODE30                        4
+#define SRP_FW_CODE31                        5
+
+#define SRP_FW_VLIW                          0
+#define SRP_FW_CGA                           1
+#define SRP_FW_CGA_SA                        2
+#define SRP_FW_DATA                          3
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SRP_IOCTL_H__ */
+
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/src/srp_api.c b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/src/srp_api.c
new file mode 100644
index 0000000..b0c0e5e
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/src/srp_api.c
@@ -0,0 +1,381 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include "srp_api.h"
+
+#define LOG_TAG "libsrpapi"
+#include <cutils/log.h>
+
+/* Disable LOGD message */
+#ifdef LOGD
+#undef LOGD
+#endif
+#define LOGD(...)
+
+//#define _USE_WBUF_            /* Buffering before writing srp-rp device */
+//#define _DUMP_TO_FILE_
+//#define _USE_FW_FROM_DISK_
+
+#ifdef _USE_WBUF_
+#define WBUF_LEN_MUL        2
+#endif
+
+static int srp_dev = -1;
+static int srp_ibuf_size = 0;
+static int srp_block_mode = SRP_INIT_BLOCK_MODE;
+
+static unsigned char *wbuf;
+static int wbuf_size;
+static int wbuf_pos;
+
+#ifdef _DUMP_TO_FILE_
+static FILE *fp_dump = NULL;
+#endif
+
+#ifdef _USE_WBUF_
+static int WriteBuff_Init(void)
+{
+    if (wbuf == NULL) {
+        wbuf_size = srp_ibuf_size * WBUF_LEN_MUL;
+        wbuf_pos = 0;
+        wbuf = (unsigned char *)malloc(wbuf_size);
+        LOGD("%s: WriteBuffer %dbytes allocated", __func__, wbuf_size);
+        return 0;
+    }
+
+    LOGE("%s: WriteBuffer already allocated", __func__);
+    return -1;
+}
+
+static int WriteBuff_Deinit(void)
+{
+    if (wbuf != NULL) {
+        free(wbuf);
+        wbuf = NULL;
+        return 0;
+    }
+
+    LOGE("%s: WriteBuffer is not ready", __func__);
+    return -1;
+}
+
+static int WriteBuff_Write(unsigned char *buff, int size_byte)
+{
+    int write_byte;
+
+    if ((wbuf_pos + size_byte) < wbuf_size) {
+        memcpy(&wbuf[wbuf_pos], buff, size_byte);
+        wbuf_pos += size_byte;
+    } else {
+        LOGE("%s: WriteBuffer is filled [%d], ignoring write [%d]", __func__, wbuf_pos, size_byte);
+        return -1;    /* Insufficient buffer */
+    }
+
+    return wbuf_pos;
+}
+
+static void WriteBuff_Consume(void)
+{
+    memcpy(wbuf, &wbuf[srp_ibuf_size], srp_ibuf_size * (WBUF_LEN_MUL - 1));
+    wbuf_pos -= srp_ibuf_size;
+}
+
+static void WriteBuff_Flush(void)
+{
+    wbuf_pos = 0;
+}
+#endif
+
+int SRP_Create(int block_mode)
+{
+    if (srp_dev == -1) {
+#ifdef _USE_FW_FROM_DISK_
+        SRP_Check_AltFirmware();
+#endif
+
+        srp_block_mode = block_mode;
+        srp_dev = open(SRP_DEV_NAME, O_RDWR |
+                    ((block_mode == SRP_INIT_NONBLOCK_MODE) ? O_NDELAY : 0));
+
+        return srp_dev;
+    }
+
+    LOGE("%s: Device is not ready", __func__);
+    return -1;    /* device alreay opened */
+}
+
+int SRP_Init(unsigned int ibuf_size)
+{
+    int ret;
+
+    if (srp_dev != -1) {
+        srp_ibuf_size = ibuf_size;
+        ret = ioctl(srp_dev, SRP_INIT, srp_ibuf_size); /* Initialize IBUF size (4KB ~ 18KB) */
+
+#ifdef _DUMP_TO_FILE_
+        char outname[256];
+        int cnt = 0;
+
+        while (1) {
+            sprintf(outname, "/data/rp_dump_%04d.mp3", cnt++);
+            if (fp_dump = fopen(outname, "rb")) { /* file exist? */
+                fclose(fp_dump);
+            } else {
+                break;
+            }
+        }
+
+        LOGD("%s: Dump MP3 to %s", __func__, outname);
+        if (fp_dump = fopen(outname, "wb"))
+            LOGD("%s: Success to open %s", __func__, outname);
+        else
+            LOGD("%s: Fail to open %s", __func__, outname);
+#endif
+
+#ifdef _USE_WBUF_
+        if (ret != -1)
+            return WriteBuff_Init();
+#else
+        return ret;
+#endif
+    }
+
+    LOGE("%s: Device is not ready", __func__);
+    return -1;  /* device is not created */
+}
+
+#ifdef _USE_WBUF_
+int SRP_Decode(void *buff, int size_byte)
+{
+    int ret;
+    int val;
+    int err_code = 0;
+
+    if (srp_dev != -1) {
+        /* Check wbuf before writing buff */
+        while (wbuf_pos >= srp_ibuf_size) { /* Write_Buffer filled? (IBUF Size)*/
+            LOGD("%s: Write Buffer is full, Send data to RP", __func__);
+
+            ret = write(srp_dev, wbuf, srp_ibuf_size); /* Write Buffer to RP Driver */
+            if (ret == -1) { /* Fail? */
+                ioctl(srp_dev, SRP_ERROR_STATE, &val);
+                if (!val) {    /* Write error? */
+                    LOGE("%s: IBUF write fail", __func__);
+                    return -1;
+                } else {       /* Write OK, but RP decode error? */
+                    err_code = val;
+                    LOGE("%s: RP decode error [0x%05X]", __func__, err_code);
+                }
+            }
+#ifdef _DUMP_TO_FILE_
+            if (fp_dump)
+                fwrite(wbuf, srp_ibuf_size, 1, fp_dump);
+#endif
+            WriteBuff_Consume();
+        }
+
+        ret = WriteBuff_Write((unsigned char *)buff, size_byte);
+        if (ret == -1)
+            return -1;  /* Buffering error */
+
+        LOGD("%s: Write Buffer remain [%d]", __func__, wbuf_pos);
+        return err_code;  /* Write Success */
+    }
+
+    LOGE("%s: Device is not ready", __func__);
+    return -1;  /* device is not created */
+}
+
+int SRP_Send_EOS(void)
+{
+    int ret;
+    int val;
+
+    if (srp_dev != -1) {
+        /* Check wbuf before writing buff */
+        while (wbuf_pos) { /* Write_Buffer ramain?*/
+            if (wbuf_pos < srp_ibuf_size) {
+                memset(wbuf + wbuf_pos, 0xFF, srp_ibuf_size - wbuf_pos); /* Fill dummy data */
+                wbuf_pos = srp_ibuf_size;
+            }
+
+            ret = write(srp_dev, wbuf, srp_ibuf_size); /* Write Buffer to RP Driver */
+            if (ret == -1) {  /* Fail? */
+                ret = ioctl(srp_dev, SRP_ERROR_STATE, &val);
+                if (!val) {   /* Write error? */
+                    LOGE("%s: IBUF write fail", __func__);
+                    return -1;
+                } else {      /* RP decoe error? */
+                    LOGE("%s: RP decode error [0x%05X]", __func__, val);
+                    return -1;
+                }
+            } else {          /* Success? */
+#ifdef _DUMP_TO_FILE_
+                if (fp_dump)
+                    fwrite(wbuf, srp_ibuf_size, 1, fp_dump);
+#endif
+                WriteBuff_Consume();
+            }
+        }
+
+        memset(wbuf, 0xFF, srp_ibuf_size);      /* Fill dummy data */
+        write(srp_dev, wbuf, srp_ibuf_size); /* Write Buffer to RP Driver */
+
+        /* Wait until RP decoding over */
+        return ioctl(srp_dev, SRP_WAIT_EOS);
+    }
+
+    return -1; /* device is not created */
+}
+#else  /* Without WBUF */
+int SRP_Decode(void *buff, int size_byte)
+{
+    int ret;
+    int val;
+    int err_code = 0;
+
+    if (srp_dev != -1) {
+        LOGD("%s: Send data to RP (%d bytes)", __func__, size_byte);
+
+        ret = write(srp_dev, buff, size_byte);  /* Write Buffer to RP Driver */
+        if (ret == -1) {  /* Fail? */
+            ioctl(srp_dev, SRP_ERROR_STATE, &val);
+            if (!val) {   /* Write error? */
+                LOGE("%s: IBUF write fail", __func__);
+                return -1;
+            } else {      /* Write OK, but RP decode error? */
+                err_code = val;
+                LOGE("%s: RP decode error [0x%05X]", __func__, err_code);
+            }
+        }
+#ifdef _DUMP_TO_FILE_
+        if (fp_dump)
+            fwrite(buff, size_byte, 1, fp_dump);
+#endif
+
+        return err_code; /* Write Success */
+    }
+
+    LOGE("%s: Device is not ready", __func__);
+    return -1; /* device is not created */
+}
+
+int SRP_Send_EOS(void)
+{
+    /* Wait until RP decoding over */
+    if (srp_dev != -1)
+        return ioctl(srp_dev, SRP_SEND_EOS);
+
+    return -1; /* device is not created */
+}
+
+int SRP_Resume_EOS(void)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, SRP_RESUME_EOS);
+
+    return -1; /* device is not created */
+}
+#endif
+
+int SRP_Pause(void)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, SRP_PAUSE);
+
+    return -1; /* device is not created */
+}
+
+int SRP_Stop(void)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, SRP_STOP);
+
+    return -1; /* device is not created */
+}
+
+int SRP_Flush(void)
+{
+    if (srp_dev != -1) {
+        if (ioctl(srp_dev, SRP_FLUSH) != -1) {
+#ifdef _USE_WBUF_
+            WriteBuff_Flush();
+#endif
+            return 0;
+        }
+    }
+
+    return -1; /* device is not created */
+}
+
+
+int SRP_SetParams(int id, unsigned long val)
+{
+    if (srp_dev != -1)
+        return 0; /* not yet */
+
+    return -1;    /* device is not created */
+}
+
+int SRP_GetParams(int id, unsigned long *pval)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, id, pval);
+
+    return -1;    /* device is not created */
+}
+
+int SRP_Deinit(void)
+{
+    if (srp_dev != -1) {
+#ifdef _DUMP_TO_FILE_
+        if (fp_dump)
+            fclose(fp_dump);
+#endif
+
+#ifdef _USE_WBUF_
+        WriteBuff_Deinit();
+#endif
+        return ioctl(srp_dev, SRP_DEINIT); /* Deinialize */
+    }
+
+    LOGE("%s: Device is not ready", __func__);
+    return -1;    /* device is not created */
+}
+
+int SRP_Terminate(void)
+{
+    int ret;
+
+    if (srp_dev != -1) {
+        ret = close(srp_dev);
+
+        if (ret == 0) {
+            srp_dev = -1; /* device closed */
+            return 0;
+        }
+    }
+
+    LOGE("%s: Device is not ready", __func__);
+    return -1; /* device is not created or close error*/
+}
+
+int SRP_IsOpen(void)
+{
+    if (srp_dev == -1) {
+        LOGD("%s: Device is not opened", __func__);
+        return 0;
+    }
+
+    LOGD("%s: Device is opened", __func__);
+    return 1;
+}
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/src/srp_api_ctrl.c b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/src/srp_api_ctrl.c
new file mode 100644
index 0000000..bdc2310
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos4/srp/ulp/src/srp_api_ctrl.c
@@ -0,0 +1,331 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include "srp_api_ctrl.h"
+#include "srp_ioctl.h"
+
+#define LOG_TAG "libsrpapi"
+#include <cutils/log.h>
+
+/* Disable LOGD message */
+#ifdef LOGD
+#undef LOGD
+#endif
+#define LOGD(...)
+
+static int srp_ctrl = -1;
+static int srp_ctrl_cnt = 0;
+static short pcm_buf[2048]; /* 4KBytes data, 1K frames (16bit stereo data) */
+
+#ifdef _USE_FW_FROM_DISK_
+static char srp_alt_fw_name_pre[6][32] = {
+    "sdcard/rp_fw/rp_fw_code1",
+    "sdcard/rp_fw/rp_fw_code20",
+    "sdcard/rp_fw/rp_fw_code21",
+    "sdcard/rp_fw/rp_fw_code22",
+    "sdcard/rp_fw/rp_fw_code30",
+    "sdcard/rp_fw/rp_fw_code31",
+};
+#endif
+
+static int SRP_Ctrl_Open(void)
+{
+    if (srp_ctrl_cnt == 0) {
+        srp_ctrl = open(SRP_CTRL_DEV_NAME, O_RDWR | O_NDELAY);
+        if (srp_ctrl < 0) {
+            LOGE("%s: Failed open device file %d", __func__, srp_ctrl);
+            return -1;
+        }
+        srp_ctrl_cnt++;
+        LOGV("%s: Device is opened[%d]: cnt %d", __func__, srp_ctrl, srp_ctrl_cnt);
+    }
+
+    return srp_ctrl;
+}
+
+static int SRP_Ctrl_Close(void)
+{
+    int ret = 0;
+
+    if (srp_ctrl_cnt == 1) {
+        ret = close(srp_ctrl);
+        if (ret < 0) {
+            LOGE("%s: Failed closen device file %d", __func__, srp_ctrl);
+            return -1;
+        }
+        srp_ctrl_cnt--;
+        LOGV("%s: Device is closed[%d]: cnt %d", __func__, srp_ctrl, srp_ctrl_cnt);
+        srp_ctrl = -1;
+    }
+
+    return ret;
+}
+
+#ifdef _USE_FW_FROM_DISK_
+/* This will check & download alternate firmware */
+static int SRP_Check_AltFirmware(void)
+{
+    unsigned long *temp_buff;
+    FILE *fp = NULL;
+
+    char alt_fw_name[128];
+    unsigned long alt_fw_set;
+    unsigned long alt_fw_loaded = 0;
+    int alt_fw_text_ok,alt_fw_data_ok;
+
+    if ((srp_ctrl = SRP_Ctrl_Open()) >= 0) {
+        ioctl(srp_ctrl, SRP_CTRL_ALTFW_STATE, &alt_fw_loaded);
+
+        if (!alt_fw_loaded) {    /* Not loaded yet? */
+            LOGE("Try to download alternate RP firmware");
+            temp_buff = (unsigned long *)malloc(256*1024);    /* temp buffer */
+
+            for (alt_fw_set = 0; alt_fw_set < 6; alt_fw_set++) {
+                sprintf(alt_fw_name, "%s_text.bin", srp_alt_fw_name_pre[alt_fw_set]);
+                if (fp = fopen(alt_fw_name, "rb")) {
+                    LOGE("RP Alt-Firmware Loading: %s", alt_fw_name);
+                    fread(temp_buff, 64*1024, 1, fp);
+                    close(fp);
+                    alt_fw_text_ok = 1;
+                } else {
+                    alt_fw_text_ok = 0;
+                }
+
+                sprintf(alt_fw_name, "%s_data.bin", srp_alt_fw_name_pre[alt_fw_set]);
+                if (fp = fopen(alt_fw_name, "rb")) {
+                    LOGE("RP Alt-Firmware Loading: %s", alt_fw_name);
+                    fread(&temp_buff[64*1024/4], 96*1024, 1, fp);
+                    close(fp);
+                    alt_fw_data_ok = 1;
+                } else {
+                    alt_fw_data_ok = 0;
+                }
+
+                if (alt_fw_text_ok && alt_fw_data_ok) {
+                    temp_buff[160*1024/4] = alt_fw_set;
+                    ioctl(srp_ctrl, SRP_CTRL_ALTFW_LOAD, temp_buff);
+                }
+            }
+            free(temp_buff);
+        }
+        SRP_Ctrl_Close();
+    }
+
+    return 0;
+}
+#endif
+
+int SRP_Ctrl_Set_Effect(int effect)
+{
+    int ret;
+    unsigned long effect_mode = (unsigned long)effect;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return -1;
+    }
+
+    ioctl(srp_ctrl, SRP_CTRL_SET_EFFECT, effect_mode);
+
+    SRP_Ctrl_Close();
+
+    return 0;
+}
+
+int SRP_Ctrl_Enable_Effect(int on)
+{
+    int ret;
+    unsigned long effect_switch = on ? 1 : 0;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return -1;
+    }
+
+    ioctl(srp_ctrl, SRP_CTRL_EFFECT_ENABLE, effect_switch);
+
+    SRP_Ctrl_Close();
+
+    return 0;
+}
+
+int SRP_Ctrl_Set_Effect_Def(unsigned long effect_def)
+{
+    int ret;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return -1;
+    }
+
+    ioctl(srp_ctrl, SRP_CTRL_EFFECT_DEF, effect_def);
+
+    SRP_Ctrl_Close();
+
+    return 0;
+}
+
+int SRP_Ctrl_Set_Effect_EQ_User(unsigned long eq_user)
+{
+    int ret;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return -1;
+    }
+
+    ioctl(srp_ctrl, SRP_CTRL_EFFECT_EQ_USR, eq_user);
+
+    SRP_Ctrl_Close();
+
+    return 0;
+}
+
+int SRP_Ctrl_Set_Pcm_Dump(int on)
+{
+    int ret;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return -1;
+    }
+
+    ioctl(srp_ctrl, SRP_CTRL_PCM_DUMP_OP, on);
+
+    LOGV("dump_op: %d", on);
+
+    SRP_Ctrl_Close();
+
+    return 0;
+}
+
+int SRP_Ctrl_Get_Pcm_Dump_State(void)
+{
+    int ret;
+    int srp_dump_stat = 0;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return -1;
+    }
+
+    ioctl(srp_ctrl, SRP_CTRL_IS_PCM_DUMP, &srp_dump_stat);
+
+    LOGV("srp_dump_stat: %d", srp_dump_stat);
+
+    SRP_Ctrl_Close();
+
+    return srp_dump_stat;
+}
+
+int SRP_Ctrl_Set_Gain(float value)
+{
+    int ret;
+    unsigned long gain = 0;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return -1;
+    }
+
+    gain = (unsigned long)((1 << 24) * value);
+    ioctl(srp_ctrl, SRP_CTRL_SET_GAIN, gain);
+
+    SRP_Ctrl_Close();
+
+    return 0;
+}
+
+int SRP_Ctrl_Get_Running_Stat(void)
+{
+    int ret;
+    int srp_running_stat = 0;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return -1;
+    }
+
+    ioctl(srp_ctrl, SRP_CTRL_IS_RUNNING, &srp_running_stat);
+
+    LOGV("srp_running_stat: %d", srp_running_stat);
+
+    SRP_Ctrl_Close();
+
+    return srp_running_stat;
+}
+
+int SRP_Ctrl_Get_Open_Stat(void)
+{
+    int ret;
+    int srp_open_stat = 0;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return -1;
+    }
+
+    ioctl(srp_ctrl, SRP_CTRL_IS_OPENED, &srp_open_stat);
+
+    LOGV("srp_open_stat: %d", srp_open_stat);
+
+    SRP_Ctrl_Close();
+
+    return srp_open_stat;
+}
+
+short *SRP_Ctrl_Get_Pcm(void)
+{
+    int ret;
+    int rp_is_running = 0;
+    int dump_is_on = 0;
+    int rp_is_opened = 0;
+
+    ret = SRP_Ctrl_Open();
+    if (ret < 0) {
+        LOGE("%s: SRP_Ctrl_Open error", __func__);
+        return NULL;
+    }
+
+    ioctl(srp_ctrl, SRP_CTRL_IS_RUNNING, &rp_is_running);
+    if (rp_is_running) {
+        ioctl(srp_ctrl, SRP_CTRL_IS_PCM_DUMP, &dump_is_on);
+        if (dump_is_on == 0) {
+            ioctl(srp_ctrl, SRP_CTRL_PCM_DUMP_OP, 1);
+            dump_is_on = 1;
+        }
+
+        ioctl(srp_ctrl, SRP_CTRL_GET_PCM_1KFRAME, pcm_buf);
+        return pcm_buf;
+    }
+
+    /* SRP is not running */
+    if (srp_ctrl > 0) {
+        if (dump_is_on) {
+            ioctl(srp_ctrl, SRP_CTRL_IS_OPENED, &rp_is_opened);
+            if (rp_is_opened)
+                ioctl(srp_ctrl, SRP_CTRL_PCM_DUMP_OP, 0);
+        }
+        SRP_Ctrl_Close();
+    }
+
+    return NULL;
+}
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/Android.mk b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/Android.mk
new file mode 100644
index 0000000..4b113e7
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/Android.mk
@@ -0,0 +1,9 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_AUDIO_PATH :=$(LOCAL_PATH)
+
+ifeq ($(BOARD_USE_ALP_AUDIO), true)
+  include $(LOCAL_AUDIO_PATH)/srp/alp/Android.mk
+endif
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/Android.mk b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/Android.mk
new file mode 100644
index 0000000..7393f68
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/Android.mk
@@ -0,0 +1,26 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_COPY_HEADERS_TO := libsecmm
+LOCAL_COPY_HEADERS := \
+	include/srp_api.h \
+	include/srp_ioctl.h \
+	include/srp_error.h
+
+LOCAL_SRC_FILES := \
+	src/srp_api.c
+
+LOCAL_C_INCLUDES := \
+	$(LOCAL_PATH)/include
+
+LOCAL_MODULE := libsrpapi
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES :=
+
+LOCAL_SHARED_LIBRARIES :=
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/include/srp_api.h b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/include/srp_api.h
new file mode 100644
index 0000000..ad65b90
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/include/srp_api.h
@@ -0,0 +1,52 @@
+#ifndef __SRP_API_H__
+#define __SRP_API_H__
+
+#include "srp_ioctl.h"
+#include "srp_error.h"
+
+#define SRP_DEV_NAME                    "dev/srp"
+
+#define SRP_INIT_BLOCK_MODE             0
+#define SRP_INIT_NONBLOCK_MODE          1
+
+#define SRP_PENDING_STATE_RUNNING       0
+#define SRP_PENDING_STATE_PENDING       1
+
+struct srp_buf_info {
+    void *mmapped_addr;
+    void *addr;
+    unsigned int mmapped_size;
+    unsigned int size;
+    int num;
+};
+
+struct srp_dec_info {
+    unsigned int sample_rate;
+    unsigned int channels;
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int SRP_Create(int block_mode);
+int SRP_Init();
+int SRP_Decode(void *buff, int size_byte);
+int SRP_Send_EOS(void);
+int SRP_SetParams(int id, unsigned long val);
+int SRP_GetParams(int id, unsigned long *pval);
+int SRP_Deinit(void);
+int SRP_Terminate(void);
+int SRP_IsOpen(void);
+
+int SRP_Get_Ibuf_Info(void **addr, unsigned int *size, unsigned int *num);
+int SRP_Get_Obuf_Info(void **addr, unsigned int *size, unsigned int *num);
+int SRP_Get_Dec_Info(struct srp_dec_info *dec_info);
+int SRP_Get_PCM(void **addr, unsigned int *size);
+int SRP_Flush(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*__SRP_API_H__ */
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/include/srp_error.h b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/include/srp_error.h
new file mode 100644
index 0000000..7f79452
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/include/srp_error.h
@@ -0,0 +1,22 @@
+#ifndef _SRP_ERROR_H_
+#define _SRP_ERROR_H_
+
+typedef enum {
+    SRP_RETURN_OK = 0,
+
+    SRP_ERROR_OPEN_FAIL       = -1000,
+    SRP_ERROR_ALREADY_OPEN    = -1001,
+    SRP_ERROR_NOT_READY       = -1002,
+
+    SRP_ERROR_IBUF_OVERFLOW   = -2000,
+    SRP_ERROR_IBUF_INFO       = -2001,
+
+    SRP_ERROR_OBUF_READ       = -3000,
+    SRP_ERROR_OBUF_INFO       = -3001,
+    SRP_ERROR_OBUF_MMAP       = -3002,
+
+    SRP_ERROR_INVALID_SETTING = -4000,
+    SRP_ERROR_GETINFO_FAIL    = -4001
+} SRP_ERRORTYPE;
+
+#endif /* _SRP_ERROR_H_ */
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/include/srp_ioctl.h b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/include/srp_ioctl.h
new file mode 100644
index 0000000..21d55df
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/include/srp_ioctl.h
@@ -0,0 +1,23 @@
+#ifndef __SRP_IOCTL_H__
+#define __SRP_IOCTL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SRP_INIT                             (0x10000)
+#define SRP_DEINIT                           (0x10001)
+#define SRP_GET_MMAP_SIZE                    (0x10002)
+#define SRP_FLUSH                            (0x20002)
+#define SRP_SEND_EOS                         (0x20005)
+#define SRP_GET_IBUF_INFO                    (0x20007)
+#define SRP_GET_OBUF_INFO                    (0x20008)
+#define SRP_STOP_EOS_STATE                   (0x30007)
+#define SRP_GET_DEC_INFO                     (0x30008)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SRP_IOCTL_H__ */
+
diff --git a/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/src/srp_api.c b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/src/srp_api.c
new file mode 100644
index 0000000..56125fb
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/audio/exynos5/srp/alp/src/srp_api.c
@@ -0,0 +1,265 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include "srp_api.h"
+
+#define LOG_NDEBUG 1
+#define LOG_TAG "libsrpapi"
+#include <utils/Log.h>
+
+static struct srp_buf_info ibuf_info;
+static struct srp_buf_info obuf_info;
+static struct srp_buf_info pcm_info;
+
+static int srp_dev = -1;
+static int srp_block_mode = SRP_INIT_BLOCK_MODE;
+
+int SRP_Create(int block_mode)
+{
+    if (srp_dev == -1) {
+        srp_block_mode = block_mode;
+        srp_dev = open(SRP_DEV_NAME, O_RDWR |
+                    ((block_mode == SRP_INIT_NONBLOCK_MODE) ? O_NDELAY : 0));
+        if (srp_dev > 0)
+            return srp_dev;
+        else
+            return SRP_ERROR_OPEN_FAIL;
+    }
+
+    LOGE("%s: Device is already opened", __func__);
+    return SRP_ERROR_ALREADY_OPEN;
+}
+
+int SRP_Init()
+{
+    int ret = SRP_RETURN_OK;
+    unsigned int mmapped_size = 0;
+
+    if (srp_dev != -1) {
+        ret = ioctl(srp_dev, SRP_INIT);
+        if (ret < 0)
+            return ret;
+
+        /* mmap for OBUF */
+        ret = ioctl(srp_dev, SRP_GET_MMAP_SIZE, &mmapped_size);
+        if (ret < 0) {
+            LOGE("%s: SRP_GET_MMAP_SIZE is failed", __func__);
+            return SRP_ERROR_OBUF_MMAP;
+        }
+        obuf_info.mmapped_addr = mmap(0, mmapped_size,
+                    PROT_READ | PROT_WRITE, MAP_SHARED, srp_dev, 0);
+        if (!obuf_info.mmapped_addr) {
+            LOGE("%s: mmap is failed", __func__);
+            return SRP_ERROR_OBUF_MMAP;
+        }
+        obuf_info.mmapped_size = mmapped_size;
+
+        ret = SRP_RETURN_OK;
+    } else {
+        LOGE("%s: Device is not ready", __func__);
+        ret = SRP_ERROR_NOT_READY; /* device is not created */
+    }
+
+    return ret;
+}
+
+int SRP_Decode(void *buff, int size_byte)
+{
+    int ret = SRP_RETURN_OK;
+
+    if (srp_dev != -1) {
+        if (size_byte > 0) {
+            LOGV("%s: Send data to RP (%d bytes)", __func__, size_byte);
+
+            ret = write(srp_dev, buff, size_byte);  /* Write Buffer to RP Driver */
+            if (ret < 0) {
+                if (ret != SRP_ERROR_IBUF_OVERFLOW)
+                    LOGE("SRP_Decode returned error code: %d", ret);
+            }
+            return ret; /* Write Success */
+        } else {
+            return ret;
+        }
+    }
+
+    LOGE("%s: Device is not ready", __func__);
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_Send_EOS(void)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, SRP_SEND_EOS);
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_SetParams(int id, unsigned long val)
+{
+    if (srp_dev != -1)
+        return 0; /* not yet */
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_GetParams(int id, unsigned long *pval)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, id, pval);
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_Flush(void)
+{
+    if (srp_dev != -1)
+        return ioctl(srp_dev, SRP_FLUSH);
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_Get_PCM(void **addr, unsigned int *size)
+{
+    int ret = SRP_RETURN_OK;
+
+    if (srp_dev != -1) {
+        ret = read(srp_dev, &pcm_info, 0);
+        if (ret == -1) {
+            *size = 0;
+            LOGE("%s: PCM read fail", __func__);
+            return SRP_ERROR_OBUF_READ;
+        }
+
+        *addr = pcm_info.addr;
+        *size = pcm_info.size;
+    } else {
+        return SRP_ERROR_NOT_READY;
+    }
+
+    return ret; /* Read Success */
+}
+
+int SRP_Get_Dec_Info(struct srp_dec_info *dec_info)
+{
+    int ret;
+
+    if (srp_dev != -1) {
+        ret = ioctl(srp_dev, SRP_GET_DEC_INFO, dec_info);
+        if (ret < 0) {
+            LOGE("%s: Failed to get dec info", __func__);
+            return SRP_ERROR_GETINFO_FAIL;
+        }
+
+        LOGV("numChannels(%d), samplingRate(%d)", dec_info->channels, dec_info->sample_rate);
+
+        ret = SRP_RETURN_OK;
+    } else {
+        ret = SRP_ERROR_NOT_READY;
+    }
+
+    return ret;
+}
+
+int SRP_Get_Ibuf_Info(void **addr, unsigned int *size, unsigned int *num)
+{
+    int ret = SRP_RETURN_OK;
+
+    if (srp_dev != -1) {
+        ret = ioctl(srp_dev, SRP_GET_IBUF_INFO, &ibuf_info);
+        if (ret == -1) {
+            LOGE("%s: Failed to get Ibuf info", __func__);
+            return SRP_ERROR_IBUF_INFO;
+        }
+
+        *addr = ibuf_info.addr;
+        *size = ibuf_info.size;
+        *num = ibuf_info.num;
+
+        if (*num == 0) {
+            LOGE("%s: IBUF num is 0", __func__);
+            return SRP_ERROR_INVALID_SETTING;
+        }
+
+        ret = SRP_RETURN_OK;
+    } else {
+        ret = SRP_ERROR_NOT_READY;
+    }
+
+    return ret;
+}
+
+int SRP_Get_Obuf_Info(void **addr, unsigned int *size, unsigned int *num)
+{
+    int ret = SRP_RETURN_OK;
+
+    if (srp_dev != -1) {
+        if (obuf_info.addr == NULL) {
+            ret = ioctl(srp_dev, SRP_GET_OBUF_INFO, &obuf_info);
+            if (ret < 0) {
+                LOGE("%s: SRP_GET_OBUF_INFO is failed", __func__);
+                return SRP_ERROR_OBUF_INFO;
+            }
+        }
+
+        *addr = obuf_info.addr;
+        *size = obuf_info.size;
+        *num = obuf_info.num;
+
+        if (*num == 0) {
+            LOGE("%s: OBUF num is 0", __func__);
+            return SRP_ERROR_INVALID_SETTING;
+        }
+
+        ret = SRP_RETURN_OK;
+    } else {
+        ret = SRP_ERROR_NOT_READY;
+    }
+
+    return ret;
+}
+
+int SRP_Deinit(void)
+{
+    if (srp_dev != -1) {
+        munmap(obuf_info.mmapped_addr, obuf_info.mmapped_size);
+        return ioctl(srp_dev, SRP_DEINIT);
+    }
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_Terminate(void)
+{
+    int ret;
+
+    if (srp_dev != -1) {
+        ret = close(srp_dev);
+
+        if (ret == 0) {
+            srp_dev = -1; /* device closed */
+            return SRP_RETURN_OK;
+        }
+    }
+
+    return SRP_ERROR_NOT_READY;
+}
+
+int SRP_IsOpen(void)
+{
+    if (srp_dev == -1) {
+        LOGV("%s: Device is not opened", __func__);
+        return 0;
+    }
+
+    LOGV("%s: Device is opened", __func__);
+    return 1;
+}
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/Android.mk b/exynos4/multimedia/codecs/sec_codecs/video/Android.mk
new file mode 100644
index 0000000..3bc3577
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
+include   $(LOCAL_PATH)/exynos4/Android.mk
+endif
+
+ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
+include   $(LOCAL_PATH)/exynos5/Android.mk
+endif
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/Android.mk b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/Android.mk
new file mode 100644
index 0000000..1a8c419
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_VIDEO_PATH :=$(LOCAL_PATH)
+
+ifeq ($(BOARD_USE_V4L2), true)
+include    $(LOCAL_VIDEO_PATH)/mfc_v4l2/Android.mk
+else
+include    $(LOCAL_VIDEO_PATH)/mfc/Android.mk
+endif
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/Android.mk b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/Android.mk
new file mode 100644
index 0000000..b23f603
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/Android.mk
@@ -0,0 +1,38 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_COPY_HEADERS_TO := libsecmm
+LOCAL_COPY_HEADERS := \
+	include/mfc_errno.h \
+	include/mfc_interface.h \
+	include/SsbSipMfcApi.h
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	dec/src/SsbSipMfcDecAPI.c \
+	enc/src/SsbSipMfcEncAPI.c
+
+LOCAL_C_INCLUDES := \
+	$(LOCAL_PATH)/include/
+
+LOCAL_MODULE := libsecmfcapi
+
+LOCAL_PRELINK_MODULE := false
+
+ifeq ($(BOARD_USES_MFC_FPS),true)
+LOCAL_CFLAGS := -DCONFIG_MFC_FPS
+#LOCAL_CFLAGS += -DCONFIG_MFC_PERF_LOG
+endif
+
+ifeq ($(BOARD_USE_S3D_SUPPORT), true)
+LOCAL_CFLAGS += -DS3D_SUPPORT
+endif
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES :=
+LOCAL_SHARED_LIBRARIES := liblog
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/dec/src/SsbSipMfcDecAPI.c b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/dec/src/SsbSipMfcDecAPI.c
new file mode 100644
index 0000000..5cc7c88
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/dec/src/SsbSipMfcDecAPI.c
@@ -0,0 +1,1165 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+#include "mfc_interface.h"
+#include "SsbSipMfcApi.h"
+
+#include <utils/Log.h>
+/*#define LOG_NDEBUG 0*/
+#undef  LOG_TAG
+#define LOG_TAG "MFC_DEC_APP"
+
+#ifdef CONFIG_MFC_FPS
+#include <sys/time.h>
+#endif
+
+#define _MFCLIB_MAGIC_NUMBER    0x92241000
+
+#define USR_DATA_START_CODE     (0x000001B2)
+#define VOP_START_CODE          (0x000001B6)
+#define MP4_START_CODE          (0x000001)
+
+#ifdef CONFIG_MFC_FPS
+unsigned int framecount, over30ms;
+struct timeval mDec1, mDec2, mAvg;
+#endif
+
+static char *mfc_dev_name = SAMSUNG_MFC_DEV_NAME;
+
+static void getAByte(char *buff, int *code)
+{
+    int byte;
+
+    *code = (*code << 8);
+    byte = (int)*buff;
+    byte &= 0xFF;
+    *code |= byte;
+}
+
+static int isPBPacked(_MFCLIB *pCtx, int Frameleng)
+{
+    char *strmBuffer = NULL;
+    int startCode = 0xFFFFFFFF;
+    int leng_idx = 1;
+
+    strmBuffer = (char*)pCtx->virStrmBuf;
+
+    while (1) {
+        while (startCode != USR_DATA_START_CODE) {
+            if ((startCode == VOP_START_CODE) || (leng_idx == Frameleng)) {
+                LOGI("isPBPacked] VOP START Found !!.....return");
+                LOGW("isPBPacked] Non Packed PB");
+                return 0;
+            }
+            getAByte(strmBuffer, &startCode);
+            LOGV(">> StartCode = 0x%08x <<\n", startCode);
+            strmBuffer++;
+            leng_idx++;
+        }
+        LOGI("isPBPacked] User Data Found !!");
+
+        do {
+            if (*strmBuffer == 'p') {
+                /*LOGI(">> peter strmBuffer = 0x%08x <<\n", *strmBuffer);*/
+                LOGW("isPBPacked] Packed PB\n");
+                return 1;
+            }
+            getAByte(strmBuffer, &startCode);
+            strmBuffer++; leng_idx++;
+        } while ((leng_idx <= Frameleng) && ((startCode >> 8) != MP4_START_CODE));
+
+        if (leng_idx > Frameleng)
+            break;
+    }
+
+    LOGW("isPBPacked] Non Packed PB");
+
+    return 0;
+}
+
+void SsbSipMfcDecSetMFCName(char *devicename)
+{
+    mfc_dev_name = devicename;
+}
+
+void *SsbSipMfcDecOpen(void)
+{
+    int hMFCOpen;
+    unsigned int mapped_addr;
+    _MFCLIB *pCTX = NULL;
+    int mapped_size;
+    struct mfc_common_args CommonArg;
+
+    LOGI("[%s] MFC Library Ver %d.%02d\n",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
+#ifdef CONFIG_MFC_FPS
+    framecount = 0;
+    over30ms = 0;
+    mAvg.tv_sec = 0;
+    mAvg.tv_usec = 0;
+#endif
+    pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
+    if (pCTX == NULL) {
+        LOGE("SsbSipMfcDecOpen] malloc failed.\n");
+        return NULL;
+    }
+    memset(pCTX, 0, sizeof(_MFCLIB));
+
+    if (access(mfc_dev_name, F_OK) != 0) {
+        LOGE("SsbSipMfcDecOpen] MFC device node not exists");
+        free(pCTX);
+        return NULL;
+    }
+
+    hMFCOpen = open(mfc_dev_name, O_RDWR | O_NDELAY);
+    if (hMFCOpen < 0) {
+        LOGE("SsbSipMfcDecOpen] MFC Open failure");
+        free(pCTX);
+        return NULL;
+    }
+
+    mapped_size = ioctl(hMFCOpen, IOCTL_MFC_GET_MMAP_SIZE, &CommonArg);
+    if ((mapped_size < 0) || (CommonArg.ret_code != MFC_OK)) {
+        LOGE("SsbSipMfcDecOpen] IOCTL_MFC_GET_MMAP_SIZE failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    mapped_addr = (unsigned int)mmap(0, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
+    if (!mapped_addr) {
+        LOGE("SsbSipMfcDecOpen] FIMV5.x driver address mapping failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    pCTX->magic = _MFCLIB_MAGIC_NUMBER;
+    pCTX->hMFC = hMFCOpen;
+    pCTX->mapped_addr = mapped_addr;
+    pCTX->mapped_size = mapped_size;
+    pCTX->inter_buff_status = MFC_USE_NONE;
+
+    return (void *)pCTX;
+}
+
+void *SsbSipMfcDecOpenExt(void *value)
+{
+    int hMFCOpen;
+    unsigned int mapped_addr;
+    _MFCLIB *pCTX = NULL;
+    int mapped_size;
+    int err;
+    struct mfc_common_args CommonArg;
+
+    LOGI("[%s] MFC Library Ver %d.%02d\n",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
+
+    pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
+    if (pCTX == NULL) {
+        LOGE("SsbSipMfcDecOpenExt] malloc failed.\n");
+        return NULL;
+    }
+    memset(pCTX, 0, sizeof(_MFCLIB));
+
+    if (access(mfc_dev_name, F_OK) != 0) {
+        LOGE("SsbSipMfcDecOpen] MFC device node not exists");
+        free(pCTX);
+        return NULL;
+    }
+
+    hMFCOpen = open(mfc_dev_name, O_RDWR | O_NDELAY);
+    if (hMFCOpen < 0) {
+        LOGE("SsbSipMfcDecOpenExt] MFC Open failure");
+        free(pCTX);
+        return NULL;
+    }
+
+    CommonArg.args.mem_alloc.buf_cache_type = *(SSBIP_MFC_BUFFER_TYPE *)value;
+
+    err = ioctl(hMFCOpen, IOCTL_MFC_SET_BUF_CACHE, &CommonArg);
+    if ((err < 0) || (CommonArg.ret_code != MFC_OK)) {
+        LOGE("SsbSipMfcDecOpenExt] IOCTL_MFC_SET_BUF_CACHE failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    mapped_size = ioctl(hMFCOpen, IOCTL_MFC_GET_MMAP_SIZE, &CommonArg);
+    if ((mapped_size < 0) || (CommonArg.ret_code != MFC_OK)) {
+        LOGE("SsbSipMfcDecOpenExt] IOCTL_MFC_GET_MMAP_SIZE failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    mapped_addr = (unsigned int)mmap(0, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
+    if (!mapped_addr) {
+        LOGE("SsbSipMfcDecOpenExt] FIMV5.x driver address mapping failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    pCTX->magic = _MFCLIB_MAGIC_NUMBER;
+    pCTX->hMFC = hMFCOpen;
+    pCTX->mapped_addr = mapped_addr;
+    pCTX->mapped_size = mapped_size;
+    pCTX->inter_buff_status = MFC_USE_NONE;
+
+    return (void *)pCTX;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit (void *openHandle, SSBSIP_MFC_CODEC_TYPE codec_type, int Frameleng)
+{
+    int r;
+    int packedPB = 0;
+    struct mfc_common_args DecArg;
+    _MFCLIB *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecInit] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *)openHandle;
+    memset(&DecArg, 0x00, sizeof(DecArg));
+
+    if ((codec_type != MPEG4_DEC)  &&
+        (codec_type != H264_DEC)   &&
+        (codec_type != H263_DEC)   &&
+        (codec_type != MPEG1_DEC)  &&
+        (codec_type != MPEG2_DEC)  &&
+        (codec_type != FIMV1_DEC)  &&
+        (codec_type != FIMV2_DEC)  &&
+        (codec_type != FIMV3_DEC)  &&
+        (codec_type != FIMV4_DEC)  &&
+        (codec_type != XVID_DEC)   &&
+        (codec_type != VC1RCV_DEC) &&
+        (codec_type != VC1_DEC)) {
+        LOGE("SsbSipMfcDecInit] Undefined codec type");
+        return MFC_RET_INVALID_PARAM;
+    }
+    pCTX->codecType = codec_type;
+
+    if ((pCTX->codecType == MPEG4_DEC) ||
+        (pCTX->codecType == XVID_DEC)  ||
+        (pCTX->codecType == FIMV1_DEC) ||
+        (pCTX->codecType == FIMV2_DEC) ||
+        (pCTX->codecType == FIMV3_DEC) ||
+        (pCTX->codecType == FIMV4_DEC))
+        packedPB = isPBPacked(pCTX, Frameleng);
+
+    /* init args */
+    DecArg.args.dec_init.in_codec_type = pCTX->codecType;
+    DecArg.args.dec_init.in_strm_size = Frameleng;
+    DecArg.args.dec_init.in_strm_buf = pCTX->phyStrmBuf;
+
+    DecArg.args.dec_init.in_numextradpb = pCTX->dec_numextradpb;
+    DecArg.args.dec_init.in_slice= pCTX->dec_slice;
+    DecArg.args.dec_init.in_crc = pCTX->dec_crc;
+    DecArg.args.dec_init.in_pixelcache = pCTX->dec_pixelcache;
+
+    DecArg.args.dec_init.in_packed_PB = packedPB;
+
+    /* mem alloc args */
+    DecArg.args.dec_init.in_mapped_addr = pCTX->mapped_addr;
+
+    /* get pyhs addr args */
+    /* no needs */
+
+    /* sequence start args */
+    /* no needs */
+
+    r = ioctl(pCTX->hMFC, IOCTL_MFC_DEC_INIT, &DecArg);
+    if (DecArg.ret_code != MFC_OK) {
+        LOGE("SsbSipMfcDecInit] IOCTL_MFC_DEC_INIT failed");
+        return MFC_RET_DEC_INIT_FAIL;
+    }
+
+    pCTX->decOutInfo.img_width = DecArg.args.dec_init.out_frm_width;
+    pCTX->decOutInfo.img_height = DecArg.args.dec_init.out_frm_height;
+    pCTX->decOutInfo.buf_width = DecArg.args.dec_init.out_buf_width;
+    pCTX->decOutInfo.buf_height = DecArg.args.dec_init.out_buf_height;
+
+    pCTX->decOutInfo.crop_top_offset = DecArg.args.dec_init.out_crop_top_offset;
+    pCTX->decOutInfo.crop_bottom_offset = DecArg.args.dec_init.out_crop_bottom_offset;
+    pCTX->decOutInfo.crop_left_offset = DecArg.args.dec_init.out_crop_left_offset;
+    pCTX->decOutInfo.crop_right_offset = DecArg.args.dec_init.out_crop_right_offset;
+
+    /*
+    pCTX->virFrmBuf.luma = DecArg.args.dec_init.out_u_addr.luma;
+    pCTX->virFrmBuf.chroma = DecArg.args.dec_init.out_u_addr.chroma;
+
+    pCTX->phyFrmBuf.luma = DecArg.args.dec_init.out_p_addr.luma;
+    pCTX->phyFrmBuf.chroma = DecArg.args.dec_init.out_p_addr.chroma;
+    pCTX->sizeFrmBuf.luma = DecArg.args.dec_init.out_frame_buf_size.luma;
+    pCTX->sizeFrmBuf.chroma = DecArg.args.dec_init.out_frame_buf_size.chroma;
+    */
+
+    pCTX->inter_buff_status |= MFC_USE_YUV_BUFF;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
+{
+    int ret;
+    int Yoffset;
+    int Coffset;
+    _MFCLIB *pCTX;
+    struct mfc_common_args DecArg;
+
+#ifdef CONFIG_MFC_FPS
+    long int diffTime, avgTime;
+#endif
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecExe] openHandle is NULL\n");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
+        LOGE("SsbSipMfcDecExe] lengthBufFill is invalid. (lengthBufFill=%d)", lengthBufFill);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+    memset(&DecArg, 0x00, sizeof(DecArg));
+
+    DecArg.args.dec_exe.in_codec_type = pCTX->codecType;
+    DecArg.args.dec_exe.in_strm_buf = pCTX->phyStrmBuf;
+    DecArg.args.dec_exe.in_strm_size = lengthBufFill;
+    DecArg.args.dec_exe.in_frm_buf.luma = pCTX->phyFrmBuf.luma;
+    DecArg.args.dec_exe.in_frm_buf.chroma = pCTX->phyFrmBuf.chroma;
+    DecArg.args.dec_exe.in_frm_size.luma = pCTX->sizeFrmBuf.luma;
+    DecArg.args.dec_exe.in_frm_size.chroma = pCTX->sizeFrmBuf.chroma;
+    DecArg.args.dec_exe.in_frametag = pCTX->inframetag;
+    DecArg.args.dec_exe.in_immediately_disp = pCTX->immediatelydisp;
+
+#ifdef CONFIG_MFC_FPS
+    gettimeofday(&mDec1, NULL);
+
+#ifdef CONFIG_MFC_PERF_LOG
+    if (framecount != 0) {
+        if (mDec2.tv_sec == mDec1.tv_sec)
+            LOGI("SsbSipMfcDecExe] Interval between IOCTL_MFC_DEC_EXE's (end to start) = %8d", (mDec1.tv_usec - mDec2.tv_usec));
+        else
+            LOGI("SsbSipMfcDecExe] Interval between IOCTL_MFC_DEC_EXE's (end to start) = %8d", (1000000 + (mDec1.tv_usec - mDec2.tv_usec)));
+    }
+#endif
+#endif
+
+    ret = ioctl(pCTX->hMFC, IOCTL_MFC_DEC_EXE, &DecArg);
+
+    if (DecArg.ret_code != MFC_OK) {
+        LOGE("SsbSipMfcDecExe] IOCTL_MFC_DEC_EXE failed(ret : %d)", DecArg.ret_code);
+        return MFC_RET_DEC_EXE_ERR;
+    }
+
+#ifdef CONFIG_MFC_FPS
+    gettimeofday(&mDec2, NULL);
+    framecount++;
+
+    if (mDec1.tv_sec == mDec2.tv_sec) {
+        if (mDec2.tv_usec - mDec1.tv_usec > 30000)
+            over30ms++;
+#ifdef CONFIG_MFC_PERF_LOG
+        LOGI("SsbSipMfcDecExe] Time consumed for IOCTL_MFC_DEC_EXE = %8d", ((mDec2.tv_usec - mDec1.tv_usec)));
+#endif
+    } else {
+        if (1000000 + mDec2.tv_usec - mDec1.tv_usec > 30000)
+            over30ms++;
+#ifdef CONFIG_MFC_PERF_LOG
+        LOGI("SsbSipMfcDecExe] Time consumed for IOCTL_MFC_DEC_EXE = %8d", (1000000 + (mDec2.tv_usec - mDec1.tv_usec)));
+#endif
+    }
+
+    diffTime = ((mDec2.tv_sec * 1000000) + mDec2.tv_usec) - ((mDec1.tv_sec * 1000000) + mDec1.tv_usec);
+    avgTime = (mAvg.tv_sec * 1000000) + mAvg.tv_usec;
+    avgTime = ((framecount - 1) * avgTime + diffTime) / framecount;
+
+    mAvg.tv_sec = avgTime / 1000000;
+    mAvg.tv_usec = avgTime % 1000000;
+#endif
+
+    /* FIXME: dynamic resolution change */
+    if (DecArg.args.dec_exe.out_display_status == 4) {
+        LOGI("SsbSipMfcDecExe] Resolution is chagned");
+        /*
+        pCTX->virFrmBuf.chroma = DecArg.args.dec_exe.out_u_addr.chroma;
+        pCTX->virFrmBuf.luma = DecArg.args.dec_exe.out_u_addr.luma;
+        pCTX->phyFrmBuf.chroma = DecArg.args.dec_exe.out_p_addr.chroma;
+        pCTX->phyFrmBuf.luma = DecArg.args.dec_exe.out_p_addr.luma;
+        pCTX->sizeFrmBuf.chroma = DecArg.args.dec_exe.out_frame_buf_size.chroma;
+        pCTX->sizeFrmBuf.luma = DecArg.args.dec_exe.out_frame_buf_size.luma;
+        */
+        pCTX->decOutInfo.img_width =  DecArg.args.dec_exe.out_img_width;
+        pCTX->decOutInfo.img_height = DecArg.args.dec_exe.out_img_height;
+        pCTX->decOutInfo.buf_width = DecArg.args.dec_exe.out_buf_width;
+        pCTX->decOutInfo.buf_height = DecArg.args.dec_exe.out_buf_height;
+    }
+
+    Yoffset = DecArg.args.dec_exe.out_display_Y_addr - DecArg.args.dec_exe.in_frm_buf.luma;
+    Coffset = DecArg.args.dec_exe.out_display_C_addr - DecArg.args.dec_exe.in_frm_buf.chroma;
+
+    pCTX->decOutInfo.YPhyAddr = (void*)(DecArg.args.dec_exe.out_display_Y_addr);
+    pCTX->decOutInfo.CPhyAddr = (void*)(DecArg.args.dec_exe.out_display_C_addr);
+
+    pCTX->decOutInfo.YVirAddr = (void*)(pCTX->virFrmBuf.luma + Yoffset);
+    pCTX->decOutInfo.CVirAddr = (void*)(pCTX->virFrmBuf.chroma + Coffset);
+
+    /* for new driver */
+    pCTX->decOutInfo.YVirAddr = (void*)(pCTX->mapped_addr + DecArg.args.dec_exe.out_y_offset);
+    pCTX->decOutInfo.CVirAddr = (void*)(pCTX->mapped_addr + DecArg.args.dec_exe.out_c_offset);
+
+    pCTX->displayStatus = DecArg.args.dec_exe.out_display_status;
+
+    pCTX->decOutInfo.disp_pic_frame_type = DecArg.args.dec_exe.out_disp_pic_frame_type;
+
+    /* clear immediately display flag */
+    pCTX->immediatelydisp = 0;
+    pCTX->outframetagtop = DecArg.args.dec_exe.out_frametag_top;
+    pCTX->outframetagbottom = DecArg.args.dec_exe.out_frametag_bottom;
+    pCTX->decOutInfo.timestamp_top = DecArg.args.dec_exe.out_pic_time_top;
+    pCTX->decOutInfo.timestamp_bottom = DecArg.args.dec_exe.out_pic_time_bottom;
+    pCTX->decOutInfo.consumedByte =  DecArg.args.dec_exe.out_consumed_byte;
+
+    pCTX->decOutInfo.crop_right_offset =  DecArg.args.dec_exe.out_crop_right_offset;
+    pCTX->decOutInfo.crop_left_offset =  DecArg.args.dec_exe.out_crop_left_offset;
+    pCTX->decOutInfo.crop_bottom_offset =  DecArg.args.dec_exe.out_crop_bottom_offset;
+    pCTX->decOutInfo.crop_top_offset =  DecArg.args.dec_exe.out_crop_top_offset;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
+{
+    int ret;
+    _MFCLIB  *pCTX;
+    struct mfc_common_args free_arg;
+
+#ifdef CONFIG_MFC_FPS
+    LOGI(">>> Statistics in MFC API:");
+    LOGI(">>> Total number of IOCTL_MFC_DEC_EXE = %d", framecount);
+    LOGI(">>> Number of IOCTL_MFC_DEC_EXE taking more than 30ms = %d", over30ms);
+    LOGI(">>> Avg IOCTL_MFC_DEC_EXE time = %dsec %.2fmsec", (int)mAvg.tv_sec, (float)(mAvg.tv_usec / 1000.0));
+#endif
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecClose] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    /* FIXME: free buffer? */
+#if 0
+    if (pCTX->inter_buff_status & MFC_USE_YUV_BUFF) {
+        free_arg.args.mem_free.key = pCTX->virFrmBuf.luma;
+        ret = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg);
+        free_arg.args.mem_free.key = pCTX->virFrmBuf.chroma;
+        ret = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg);
+    }
+#endif
+
+    if (pCTX->inter_buff_status & MFC_USE_STRM_BUFF) {
+        free_arg.args.mem_free.key = pCTX->virStrmBuf;
+        ret = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg);
+    }
+
+    pCTX->inter_buff_status = MFC_USE_NONE;
+
+    munmap((void *)pCTX->mapped_addr, pCTX->mapped_size);
+    close(pCTX->hMFC);
+    free(pCTX);
+
+    return MFC_RET_OK;
+}
+
+
+void  *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSize)
+{
+    int ret_code;
+    _MFCLIB *pCTX;
+    struct mfc_common_args user_addr_arg, phys_addr_arg;
+
+    if (inputBufferSize < 0) {
+        LOGE("SsbSipMfcDecGetInBuf] inputBufferSize = %d is invalid", inputBufferSize);
+        return NULL;
+    }
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecGetInBuf] openHandle is NULL\n");
+        return NULL;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    /*user_addr_arg.args.mem_alloc.codec_type = pCTX->codec_type; */
+    user_addr_arg.args.mem_alloc.type = DECODER;
+    user_addr_arg.args.mem_alloc.buff_size = inputBufferSize;
+    user_addr_arg.args.mem_alloc.mapped_addr = pCTX->mapped_addr;
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_IN_BUF, &user_addr_arg);
+    if (ret_code < 0) {
+        LOGE("SsbSipMfcDecGetInBuf] IOCTL_MFC_GET_IN_BUF failed");
+        return NULL;
+    }
+
+    phys_addr_arg.args.real_addr.key = user_addr_arg.args.mem_alloc.offset;
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_REAL_ADDR, &phys_addr_arg);
+    if (ret_code < 0) {
+        LOGE("SsbSipMfcDecGetInBuf] IOCTL_MFC_GET_PHYS_ADDR failed");
+        return NULL;
+    }
+
+    /*
+    pCTX->virStrmBuf = user_addr_arg.args.mem_alloc.offset;
+    */
+    pCTX->virStrmBuf = pCTX->mapped_addr + user_addr_arg.args.mem_alloc.offset;
+    pCTX->phyStrmBuf = phys_addr_arg.args.real_addr.addr;
+
+    pCTX->sizeStrmBuf = inputBufferSize;
+    pCTX->inter_buff_status |= MFC_USE_STRM_BUFF;
+
+    *phyInBuf = (void *)pCTX->phyStrmBuf;
+
+    return (void *)pCTX->virStrmBuf;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, void *virInBuf, int size)
+{
+    _MFCLIB *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecSetInBuf] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    pCTX->phyStrmBuf = (int)phyInBuf;
+    pCTX->virStrmBuf = (int)virInBuf;
+    pCTX->sizeStrmBuf = size;
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info)
+{
+    _MFCLIB *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecGetOutBuf] openHandle is NULL");
+        return MFC_GETOUTBUF_DISPLAY_END;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    output_info->YPhyAddr = pCTX->decOutInfo.YPhyAddr;
+    output_info->CPhyAddr = pCTX->decOutInfo.CPhyAddr;
+
+    output_info->YVirAddr = pCTX->decOutInfo.YVirAddr;
+    output_info->CVirAddr = pCTX->decOutInfo.CVirAddr;
+
+    output_info->img_width = pCTX->decOutInfo.img_width;
+    output_info->img_height= pCTX->decOutInfo.img_height;
+
+    output_info->buf_width = pCTX->decOutInfo.buf_width;
+    output_info->buf_height= pCTX->decOutInfo.buf_height;
+
+    output_info->timestamp_top =  pCTX->decOutInfo.timestamp_top;
+    output_info->timestamp_bottom =  pCTX->decOutInfo.timestamp_bottom;
+    output_info->consumedByte =  pCTX->decOutInfo.consumedByte;
+
+    output_info->crop_right_offset =  pCTX->decOutInfo.crop_right_offset;
+    output_info->crop_left_offset =  pCTX->decOutInfo.crop_left_offset;
+    output_info->crop_bottom_offset =  pCTX->decOutInfo.crop_bottom_offset;
+    output_info->crop_top_offset =  pCTX->decOutInfo.crop_top_offset;
+
+    output_info->disp_pic_frame_type = pCTX->decOutInfo.disp_pic_frame_type;
+
+    if (pCTX->displayStatus == 3)
+        return MFC_GETOUTBUF_DISPLAY_END;
+    else if (pCTX->displayStatus == 1)
+        return MFC_GETOUTBUF_DISPLAY_DECODING;
+    else if (pCTX->displayStatus == 2)
+        return MFC_GETOUTBUF_DISPLAY_ONLY;
+    else if (pCTX->displayStatus == 0)
+        return MFC_GETOUTBUF_DECODING_ONLY;
+    else if (pCTX->displayStatus == 4)
+        return MFC_GETOUTBUF_CHANGE_RESOL;
+    else
+        return MFC_GETOUTBUF_DISPLAY_END;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value)
+{
+    int ret_code;
+    _MFCLIB *pCTX;
+    struct mfc_common_args DecArg;
+    struct mfc_dec_fimv1_info *fimv1_res;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecSetConfig] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if (value == NULL) {
+        LOGE("SsbSipMfcDecSetConfig] value is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *)openHandle;
+    memset(&DecArg, 0x00, sizeof(DecArg));
+#ifdef S3D_SUPPORT
+    DecArg.args.config.type = conf_type;
+#else
+    DecArg.args.set_config.in_config_param = conf_type;
+#endif
+    switch (conf_type) {
+    case MFC_DEC_SETCONF_EXTRA_BUFFER_NUM:
+        pCTX->dec_numextradpb = *((unsigned int *) value);
+        return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_SLICE_ENABLE:
+        pCTX->dec_slice = *((unsigned int *) value);
+        return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_CRC_ENABLE:
+        pCTX->dec_crc = *((unsigned int *) value);
+        return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_PIXEL_CACHE:
+        pCTX->dec_pixelcache = *((unsigned int *) value);
+        return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_FRAME_TAG: /* be set before calling SsbSipMfcDecExe */
+        pCTX->inframetag = *((unsigned int *) value);
+        return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_IMMEDIATELY_DISPLAY: /* be set before calling SsbSipMfcDecExe */
+        pCTX->immediatelydisp  = *((unsigned int *) value);
+        return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT:
+        fimv1_res = (struct mfc_dec_fimv1_info *)value;
+        LOGI("fimv1->width  = %d\n", fimv1_res->width);
+        LOGI("fimv1->height = %d\n", fimv1_res->height);
+#ifdef S3D_SUPPORT
+        DecArg.args.config.args.basic.values[0]  = (int)(fimv1_res->width);
+        DecArg.args.config.args.basic.values[1]  = (int)(fimv1_res->height);
+#else
+        DecArg.args.set_config.in_config_value[0]  = (int)(fimv1_res->width);
+        DecArg.args.set_config.in_config_value[1]  = (int)(fimv1_res->height);
+#endif
+        break;
+    case MFC_DEC_SETCONF_IS_LAST_FRAME:
+    case MFC_DEC_SETCONF_DPB_FLUSH:
+#ifdef S3D_SUPPORT
+    case MFC_DEC_SETCONF_SEI_PARSE:
+    default:
+        DecArg.args.config.args.basic.values[0] = *((int *) value);
+        DecArg.args.config.args.basic.values[1]  = 0;
+#else
+    default:
+        DecArg.args.set_config.in_config_value[0]  = *((unsigned int *) value);
+        DecArg.args.set_config.in_config_value[1]  = 0;
+#endif
+        break;
+    }
+
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_SET_CONFIG, &DecArg);
+    if (DecArg.ret_code != MFC_OK) {
+        LOGE("SsbSipMfcDecSetConfig] IOCTL_MFC_SET_CONFIG failed(ret : %d, conf_type: 0x%08x)", DecArg.ret_code, conf_type);
+        return MFC_RET_DEC_SET_CONF_FAIL;
+    }
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value)
+{
+    int ret_code;
+    _MFCLIB *pCTX;
+    struct mfc_common_args DecArg;
+
+    /*
+    s3c_mfc_common_args phys_addr_arg;
+    SSBSIP_MFC_BUFFER_ADDR *buf_addr;
+    */
+
+    SSBSIP_MFC_IMG_RESOLUTION *img_resolution;
+    SSBSIP_MFC_CRC_DATA *crc_data;
+    SSBSIP_MFC_CROP_INFORMATION *crop_information;
+#ifdef S3D_SUPPORT
+    SSBSIP_MFC_FRAME_PACKING *frame_packing;
+#endif
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecGetConfig] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if (value == NULL) {
+        LOGE("SsbSipMfcDecGetConfig] value is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    switch (conf_type) {
+#if 0
+    case MFC_DEC_GETCONF_PHYS_ADDR:
+        buf_addr = (SSBSIP_MFC_BUFFER_ADDR *)value;
+        phys_addr_arg.args.get_phys_addr.u_addr = buf_addr->u_addr;
+        r = ioctl(pCTX->hMFC, IOCTL_MFC_GET_PHYS_ADDR, &phys_addr_arg);
+        if (r < 0) {
+            LOGE("SsbSipMfcDecGetConfig] IOCTL_MFC_GET_PHYS_ADDR failed");
+            return MFC_API_FAIL;
+        }
+        buf_addr->p_addr = phys_addr_arg.args.get_phys_addr.p_addr;
+        break;
+#endif
+    case MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT:
+        img_resolution = (SSBSIP_MFC_IMG_RESOLUTION *)value;
+        img_resolution->width = pCTX->decOutInfo.img_width;
+        img_resolution->height = pCTX->decOutInfo.img_height;
+        img_resolution->buf_width = pCTX->decOutInfo.buf_width;
+        img_resolution->buf_height = pCTX->decOutInfo.buf_height;
+        break;
+    case MFC_DEC_GETCONF_FRAME_TAG:
+        *((unsigned int *)value) = pCTX->outframetagtop;
+        break;
+    case MFC_DEC_GETCONF_CROP_INFO:
+        crop_information = (SSBSIP_MFC_CROP_INFORMATION *)value;
+        crop_information->crop_top_offset = pCTX->decOutInfo.crop_top_offset;
+        crop_information->crop_bottom_offset = pCTX->decOutInfo.crop_bottom_offset;
+        crop_information->crop_left_offset = pCTX->decOutInfo.crop_left_offset;
+        crop_information->crop_right_offset = pCTX->decOutInfo.crop_right_offset;
+        break;
+    case MFC_DEC_GETCONF_CRC_DATA:
+#ifdef S3D_SUPPORT
+    case MFC_DEC_GETCONF_FRAME_PACKING:
+        memset(&DecArg, 0x00, sizeof(DecArg));
+        DecArg.args.config.type = conf_type;
+
+        ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_CONFIG, &DecArg);
+        if (DecArg.ret_code != MFC_OK) {
+            LOGE("SsbSipMfcDecGetConfig] IOCTL_MFC_GET_CONFIG failed(ret : %d, conf_type: 0x%08x)", DecArg.ret_code, conf_type);
+            return MFC_RET_DEC_GET_CONF_FAIL;
+        }
+
+        if (conf_type == MFC_DEC_GETCONF_CRC_DATA) {
+            crc_data = (SSBSIP_MFC_CRC_DATA *)value;
+
+            crc_data->luma0 = DecArg.args.config.args.basic.values[0];
+            crc_data->chroma0 = DecArg.args.config.args.basic.values[1];
+        } else {
+            frame_packing = (SSBSIP_MFC_FRAME_PACKING *)value;
+            memcpy(frame_packing, &DecArg.args.config.args.frame_packing,
+                sizeof(SSBSIP_MFC_FRAME_PACKING));
+        }
+#else
+        crc_data = (SSBSIP_MFC_CRC_DATA *)value;
+
+        memset(&DecArg, 0x00, sizeof(DecArg));
+        DecArg.args.get_config.in_config_param = conf_type;
+
+        ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_CONFIG, &DecArg);
+        if (DecArg.ret_code != MFC_OK) {
+            LOGE("SsbSipMfcDecGetConfig] IOCTL_MFC_GET_CONFIG failed(ret : %d, conf_type: 0x%08x)", DecArg.ret_code, conf_type);
+            return MFC_RET_DEC_GET_CONF_FAIL;
+        }
+        crc_data->luma0 = DecArg.args.get_config.out_config_value[0];
+        crc_data->chroma0 = DecArg.args.get_config.out_config_value[1];
+#endif
+        break;
+    default:
+        LOGE("SsbSipMfcDecGetConfig] No such conf_type is supported");
+        return MFC_RET_DEC_GET_CONF_FAIL;
+    }
+
+    return MFC_RET_OK;
+}
+
+void *SsbSipMfcDecAllocInputBuffer(void *openHandle, void **phyInBuf, int inputBufferSize)
+{
+    int ret_code;
+    _MFCLIB *pCTX;
+    struct mfc_common_args user_addr_arg, phys_addr_arg;
+
+    if (inputBufferSize < 0) {
+        LOGE("SsbSipMfcDecAllocInputBuffer] inputBufferSize = %d is invalid\n", inputBufferSize);
+        return NULL;
+    }
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecAllocInputBuffer] openHandle is NULL\n");
+        return NULL;
+    }
+
+    pCTX = (_MFCLIB *)openHandle;
+
+    user_addr_arg.args.mem_alloc.type = DECODER;
+    user_addr_arg.args.mem_alloc.buff_size = inputBufferSize;
+    user_addr_arg.args.mem_alloc.mapped_addr = pCTX->mapped_addr;
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_IN_BUF, &user_addr_arg);
+    if (ret_code < 0) {
+        LOGE("SsbSipMfcDecAllocInputBuffer] IOCTL_MFC_GET_IN_BUF failed");
+        return NULL;
+    }
+
+    phys_addr_arg.args.real_addr.key = user_addr_arg.args.mem_alloc.offset;
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_REAL_ADDR, &phys_addr_arg);
+    if (ret_code < 0) {
+        LOGE("SsbSipMfcDecGetInBuf] IOCTL_MFC_GET_PHYS_ADDR failed");
+        return NULL;
+    }
+
+    pCTX->virStrmBuf = pCTX->mapped_addr + user_addr_arg.args.mem_alloc.offset;
+    pCTX->phyStrmBuf = phys_addr_arg.args.real_addr.addr;
+    pCTX->sizeStrmBuf = inputBufferSize;
+    pCTX->inter_buff_status |= MFC_USE_STRM_BUFF;
+
+    *phyInBuf = (void *)pCTX->phyStrmBuf;
+
+    return (void *)pCTX->virStrmBuf;
+}
+
+void SsbSipMfcDecFreeInputBuffer(void *openHandle, void *phyInBuf)
+{
+    int ret;
+    _MFCLIB  *pCTX;
+    struct mfc_common_args free_arg;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcDecFreeInputBuffer] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *)openHandle;
+
+    if (pCTX->inter_buff_status & MFC_USE_STRM_BUFF) {
+        free_arg.args.mem_free.key = pCTX->virStrmBuf;
+        ret = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg);
+    }
+    pCTX->inter_buff_status = MFC_USE_NONE;
+    return MFC_RET_OK;
+}
+
+/* CRESPO */
+#if 1
+int tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos)
+{
+    int pixel_x_m1, pixel_y_m1;
+    int roundup_x, roundup_y;
+    int linear_addr0, linear_addr1, bank_addr ;
+    int x_addr;
+    int trans_addr;
+
+    pixel_x_m1 = x_size -1;
+    pixel_y_m1 = y_size -1;
+
+    roundup_x = ((pixel_x_m1 >> 7) + 1);
+    roundup_y = ((pixel_x_m1 >> 6) + 1);
+
+    x_addr = x_pos >> 2;
+
+    if ((y_size <= y_pos+32) && ( y_pos < y_size) &&
+        (((pixel_y_m1 >> 5) & 0x1) == 0) && (((y_pos >> 5) & 0x1) == 0)) {
+        linear_addr0 = (((y_pos & 0x1f) <<4) | (x_addr & 0xf));
+        linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 6) & 0x3f));
+
+        if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
+            bank_addr = ((x_addr >> 4) & 0x1);
+        else
+            bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
+    } else {
+        linear_addr0 = (((y_pos & 0x1f) << 4) | (x_addr & 0xf));
+        linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 5) & 0x7f));
+
+        if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
+            bank_addr = ((x_addr >> 4) & 0x1);
+        else
+            bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
+    }
+
+    linear_addr0 = linear_addr0 << 2;
+    trans_addr = (linear_addr1 <<13) | (bank_addr << 11) | linear_addr0;
+
+    return trans_addr;
+}
+
+void Y_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size)
+{
+    int trans_addr;
+    unsigned int i, j, k, index;
+    unsigned char data8[4];
+    unsigned int max_index = x_size * y_size;
+
+    for (i = 0; i < y_size; i = i + 16) {
+        for (j = 0; j < x_size; j = j + 16) {
+            trans_addr = tile_4x2_read(x_size, y_size, j, i);
+            for (k = 0; k < 16; k++) {
+                /* limit check - prohibit segmentation fault */
+                index = (i * x_size) + (x_size * k) + j;
+                /* remove equal condition to solve thumbnail bug */
+                if (index + 16 > max_index) {
+                    continue;
+                }
+
+                data8[0] = p_tiled_addr[trans_addr + 64 * k + 0];
+                data8[1] = p_tiled_addr[trans_addr + 64 * k + 1];
+                data8[2] = p_tiled_addr[trans_addr + 64 * k + 2];
+                data8[3] = p_tiled_addr[trans_addr + 64 * k + 3];
+
+                p_linear_addr[index] = data8[0];
+                p_linear_addr[index + 1] = data8[1];
+                p_linear_addr[index + 2] = data8[2];
+                p_linear_addr[index + 3] = data8[3];
+
+                data8[0] = p_tiled_addr[trans_addr + 64 * k + 4];
+                data8[1] = p_tiled_addr[trans_addr + 64 * k + 5];
+                data8[2] = p_tiled_addr[trans_addr + 64 * k + 6];
+                data8[3] = p_tiled_addr[trans_addr + 64 * k + 7];
+
+                p_linear_addr[index + 4] = data8[0];
+                p_linear_addr[index + 5] = data8[1];
+                p_linear_addr[index + 6] = data8[2];
+                p_linear_addr[index + 7] = data8[3];
+
+                data8[0] = p_tiled_addr[trans_addr + 64 * k + 8];
+                data8[1] = p_tiled_addr[trans_addr + 64 * k + 9];
+                data8[2] = p_tiled_addr[trans_addr + 64 * k + 10];
+                data8[3] = p_tiled_addr[trans_addr + 64 * k + 11];
+
+                p_linear_addr[index + 8] = data8[0];
+                p_linear_addr[index + 9] = data8[1];
+                p_linear_addr[index + 10] = data8[2];
+                p_linear_addr[index + 11] = data8[3];
+
+                data8[0] = p_tiled_addr[trans_addr + 64 * k + 12];
+                data8[1] = p_tiled_addr[trans_addr + 64 * k + 13];
+                data8[2] = p_tiled_addr[trans_addr + 64 * k + 14];
+                data8[3] = p_tiled_addr[trans_addr + 64 * k + 15];
+
+                p_linear_addr[index + 12] = data8[0];
+                p_linear_addr[index + 13] = data8[1];
+                p_linear_addr[index + 14] = data8[2];
+                p_linear_addr[index + 15] = data8[3];
+            }
+        }
+    }
+}
+
+void CbCr_tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size)
+{
+    int trans_addr;
+    unsigned int i, j, k, index;
+    unsigned char data8[4];
+    unsigned int half_y_size = y_size / 2;
+    unsigned int max_index = x_size * half_y_size;
+    unsigned char *pUVAddr[2];
+
+    pUVAddr[0] = p_linear_addr;
+    pUVAddr[1] = p_linear_addr + ((x_size * half_y_size) / 2);
+
+    for (i = 0; i < half_y_size; i = i + 16) {
+        for (j = 0; j < x_size; j = j + 16) {
+            trans_addr = tile_4x2_read(x_size, half_y_size, j, i);
+            for (k = 0; k < 16; k++) {
+                /* limit check - prohibit segmentation fault */
+                index = (i * x_size) + (x_size * k) + j;
+                /* remove equal condition to solve thumbnail bug */
+                if (index + 16 > max_index) {
+                    continue;
+                }
+
+                data8[0] = p_tiled_addr[trans_addr + 64 * k + 0];
+                data8[1] = p_tiled_addr[trans_addr + 64 * k + 1];
+                data8[2] = p_tiled_addr[trans_addr + 64 * k + 2];
+                data8[3] = p_tiled_addr[trans_addr + 64 * k + 3];
+
+                pUVAddr[index%2][index/2] = data8[0];
+                pUVAddr[(index+1)%2][(index+1)/2] = data8[1];
+                pUVAddr[(index+2)%2][(index+2)/2] = data8[2];
+                pUVAddr[(index+3)%2][(index+3)/2] = data8[3];
+
+                data8[0] = p_tiled_addr[trans_addr + 64 * k + 4];
+                data8[1] = p_tiled_addr[trans_addr + 64 * k + 5];
+                data8[2] = p_tiled_addr[trans_addr + 64 * k + 6];
+                data8[3] = p_tiled_addr[trans_addr + 64 * k + 7];
+
+                pUVAddr[(index+4)%2][(index+4)/2] = data8[0];
+                pUVAddr[(index+5)%2][(index+5)/2] = data8[1];
+                pUVAddr[(index+6)%2][(index+6)/2] = data8[2];
+                pUVAddr[(index+7)%2][(index+7)/2] = data8[3];
+
+                data8[0] = p_tiled_addr[trans_addr + 64 * k + 8];
+                data8[1] = p_tiled_addr[trans_addr + 64 * k + 9];
+                data8[2] = p_tiled_addr[trans_addr + 64 * k + 10];
+                data8[3] = p_tiled_addr[trans_addr + 64 * k + 11];
+
+                pUVAddr[(index+8)%2][(index+8)/2] = data8[0];
+                pUVAddr[(index+9)%2][(index+9)/2] = data8[1];
+                pUVAddr[(index+10)%2][(index+10)/2] = data8[2];
+                pUVAddr[(index+11)%2][(index+11)/2] = data8[3];
+
+                data8[0] = p_tiled_addr[trans_addr + 64 * k + 12];
+                data8[1] = p_tiled_addr[trans_addr + 64 * k + 13];
+                data8[2] = p_tiled_addr[trans_addr + 64 * k + 14];
+                data8[3] = p_tiled_addr[trans_addr + 64 * k + 15];
+
+                pUVAddr[(index+12)%2][(index+12)/2] = data8[0];
+                pUVAddr[(index+13)%2][(index+13)/2] = data8[1];
+                pUVAddr[(index+14)%2][(index+14)/2] = data8[2];
+                pUVAddr[(index+15)%2][(index+15)/2] = data8[3];
+            }
+        }
+    }
+}
+#else
+int tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos)
+{
+    int pixel_x_m1, pixel_y_m1;
+    int roundup_x, roundup_y;
+    int linear_addr0, linear_addr1, bank_addr;
+    int x_addr;
+    int trans_addr;
+
+    pixel_x_m1 = x_size -1;
+    pixel_y_m1 = y_size -1;
+
+    roundup_x = ((pixel_x_m1 >> 7) + 1);
+    roundup_y = ((pixel_x_m1 >> 6) + 1);
+
+    x_addr = x_pos >> 2;
+
+    if ((y_size <= y_pos+32)             &&
+        ( y_pos < y_size)                &&
+        (((pixel_y_m1 >> 5) & 0x1) == 0) &&
+        (((y_pos >> 5) & 0x1) == 0)) {
+        linear_addr0 = (((y_pos & 0x1f) <<4) | (x_addr & 0xf));
+        linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 6) & 0x3f));
+
+        if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
+            bank_addr = ((x_addr >> 4) & 0x1);
+        else
+            bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
+    } else {
+        linear_addr0 = (((y_pos & 0x1f) << 4) | (x_addr & 0xf));
+        linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 5) & 0x7f));
+
+        if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
+            bank_addr = ((x_addr >> 4) & 0x1);
+        else
+            bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
+    }
+
+    linear_addr0 = linear_addr0 << 2;
+    trans_addr = (linear_addr1 <<13) | (bank_addr << 11) | linear_addr0;
+
+    return trans_addr;
+}
+
+
+void tile_to_linear_4x2(unsigned char *p_linear_addr, unsigned char *p_tiled_addr, unsigned int x_size, unsigned int y_size)
+{
+    int trans_addr;
+    unsigned int i, j, k, nn, mm;
+    unsigned int ix,iy, nx, ny;
+
+    nx = x_size % 16;
+    ny = y_size % 16;
+
+    if (nx != 0)
+        ix = 16;
+    else
+        ix = 1;
+
+    if (ny != 0)
+        iy = 16;
+    else
+        iy = 1;
+
+    for (i = 0; i < y_size - iy; i = i + 16) {
+        for (j = 0; j < x_size -ix; j = j + 16)	{
+            trans_addr = tile_4x2_read(x_size, y_size, j, i);
+
+            k = 0;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 1;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 2;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 3;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 4;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 5;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 6;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 7;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 8;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 9;        nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 10;       nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 11;       nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 12;       nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 13;       nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 14;       nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+
+            k = 15;       nn = trans_addr + (k << 6);        mm =x_size*(i+k) + j;
+            memcpy(p_linear_addr+mm, p_tiled_addr+nn, 16);
+        }
+    }
+}
+#endif
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/enc/src/SsbSipMfcEncAPI.c b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/enc/src/SsbSipMfcEncAPI.c
new file mode 100644
index 0000000..4b9df6c
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/enc/src/SsbSipMfcEncAPI.c
@@ -0,0 +1,865 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <math.h>
+
+#include "mfc_interface.h"
+#include "SsbSipMfcApi.h"
+
+#include <utils/Log.h>
+/* #define LOG_NDEBUG 0 */
+#undef  LOG_TAG
+#define LOG_TAG "MFC_ENC_APP"
+
+#define _MFCLIB_MAGIC_NUMBER	0x92241001
+
+static char *mfc_dev_name = SAMSUNG_MFC_DEV_NAME;
+
+void SsbSipMfcEncSetMFCName(char *devicename)
+{
+    mfc_dev_name = devicename;
+}
+
+void *SsbSipMfcEncOpen(void)
+{
+    int hMFCOpen;
+    _MFCLIB *pCTX = NULL;
+    unsigned int mapped_addr;
+    int mapped_size;
+    struct mfc_common_args CommonArg;
+
+    LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
+
+#if 0
+    if ((codecType != MPEG4_ENC) &&
+        (codecType != H264_ENC) &&
+        (codecType != H263_ENC)) {
+        LOGE("SsbSipMfcEncOpen] Undefined codec type");
+        return NULL;
+    }
+#endif
+
+    if (access(mfc_dev_name, F_OK) != 0) {
+        LOGE("SsbSipMfcEncOpen] MFC device node not exists");
+        return NULL;
+    }
+
+    hMFCOpen = open(mfc_dev_name, O_RDWR | O_NDELAY);
+    if (hMFCOpen < 0) {
+        LOGE("SsbSipMfcEncOpen] MFC Open failure");
+        return NULL;
+    }
+
+    pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
+    if (pCTX == NULL) {
+        LOGE("SsbSipMfcEncOpen] malloc failed.");
+        close(hMFCOpen);
+        return NULL;
+    }
+    memset(pCTX, 0, sizeof(_MFCLIB));
+
+    mapped_size = ioctl(hMFCOpen, IOCTL_MFC_GET_MMAP_SIZE, &CommonArg);
+    if ((mapped_size < 0) || (CommonArg.ret_code != MFC_OK)) {
+        LOGE("SsbSipMfcEncOpen] IOCTL_MFC_GET_MMAP_SIZE failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    mapped_addr = (unsigned int)mmap(0, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
+    if (!mapped_addr) {
+        LOGE("SsbSipMfcEncOpen] FIMV5.x driver address mapping failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    pCTX->magic = _MFCLIB_MAGIC_NUMBER;
+    pCTX->hMFC = hMFCOpen;
+    pCTX->mapped_addr = mapped_addr;
+    pCTX->mapped_size = mapped_size;
+    pCTX->inter_buff_status = MFC_USE_NONE;
+
+    return (void *) pCTX;
+}
+
+
+void *SsbSipMfcEncOpenExt(void *value)
+{
+    int hMFCOpen;
+    _MFCLIB *pCTX = NULL;
+    unsigned int mapped_addr;
+    int mapped_size;
+    int err;
+    struct mfc_common_args CommonArg;
+
+    LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
+
+#if 0
+    if ((codecType != MPEG4_ENC) &&
+        (codecType != H264_ENC) &&
+        (codecType != H263_ENC)) {
+        LOGE("SsbSipMfcEncOpen] Undefined codec type");
+        return NULL;
+    }
+#endif
+
+    if (access(mfc_dev_name, F_OK) != 0) {
+        LOGE("SsbSipMfcEncOpenExt] MFC device node not exists");
+        return NULL;
+    }
+
+    hMFCOpen = open(mfc_dev_name, O_RDWR | O_NDELAY);
+    if (hMFCOpen < 0) {
+        LOGE("SsbSipMfcEncOpenExt] MFC Open failure");
+        return NULL;
+    }
+
+    pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
+    if (pCTX == NULL) {
+        LOGE("SsbSipMfcEncOpenExt] malloc failed.");
+        close(hMFCOpen);
+        return NULL;
+    }
+    memset(pCTX, 0, sizeof(_MFCLIB));
+
+    CommonArg.args.mem_alloc.buf_cache_type = *(SSBIP_MFC_BUFFER_TYPE *)value;
+
+    err = ioctl(hMFCOpen, IOCTL_MFC_SET_BUF_CACHE, &CommonArg);
+    if ((err < 0) || (CommonArg.ret_code != MFC_OK)) {
+        LOGE("SsbSipMfcEncOpenExt] IOCTL_MFC_SET_BUF_CACHE failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    mapped_size = ioctl(hMFCOpen, IOCTL_MFC_GET_MMAP_SIZE, &CommonArg);
+    if ((mapped_size < 0) || (CommonArg.ret_code != MFC_OK)) {
+        LOGE("SsbSipMfcEncOpenExt] IOCTL_MFC_GET_MMAP_SIZE failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    mapped_addr = (unsigned int)mmap(0, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
+    if (!mapped_addr) {
+        LOGE("SsbSipMfcEncOpenExt] FIMV5.x driver address mapping failed");
+        free(pCTX);
+        close(hMFCOpen);
+        return NULL;
+    }
+
+    pCTX->magic = _MFCLIB_MAGIC_NUMBER;
+    pCTX->hMFC = hMFCOpen;
+    pCTX->mapped_addr = mapped_addr;
+    pCTX->mapped_size = mapped_size;
+    pCTX->inter_buff_status = MFC_USE_NONE;
+
+    return (void *) pCTX;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
+{
+    int ret_code;
+
+    _MFCLIB *pCTX;
+    struct mfc_common_args EncArg;
+    SSBSIP_MFC_ENC_H264_PARAM *h264_arg;
+    SSBSIP_MFC_ENC_MPEG4_PARAM *mpeg4_arg;
+    SSBSIP_MFC_ENC_H263_PARAM *h263_arg;
+
+    pCTX  = (_MFCLIB *) openHandle;
+    memset(&EncArg, 0, sizeof(struct mfc_common_args));
+
+    pCTX->encode_cnt = 0;
+
+    mpeg4_arg = (SSBSIP_MFC_ENC_MPEG4_PARAM*)param;
+    if (mpeg4_arg->codecType == MPEG4_ENC) {
+        pCTX->codecType= MPEG4_ENC;
+    } else {
+        h263_arg = (SSBSIP_MFC_ENC_H263_PARAM*)param;
+        if (h263_arg->codecType == H263_ENC) {
+            pCTX->codecType = H263_ENC;
+        } else {
+            h264_arg = (SSBSIP_MFC_ENC_H264_PARAM*)param;
+            if (h264_arg->codecType == H264_ENC) {
+                pCTX->codecType = H264_ENC;
+            } else {
+                LOGE("SsbSipMfcEncInit] Undefined codec type");
+                return MFC_RET_INVALID_PARAM;
+            }
+        }
+    }
+
+    LOGI("SsbSipMfcEncInit] Encode Init start");
+
+    switch (pCTX->codecType) {
+    case MPEG4_ENC:
+        LOGI("SsbSipMfcEncInit] MPEG4 Encode");
+        mpeg4_arg = (SSBSIP_MFC_ENC_MPEG4_PARAM *)param;
+
+        pCTX->width = mpeg4_arg->SourceWidth;
+        pCTX->height = mpeg4_arg->SourceHeight;
+        break;
+
+    case H263_ENC:
+        LOGI("SsbSipMfcEncInit] H263 Encode");
+        h263_arg = (SSBSIP_MFC_ENC_H263_PARAM *)param;
+
+        pCTX->width = h263_arg->SourceWidth;
+        pCTX->height = h263_arg->SourceHeight;
+        break;
+
+    case H264_ENC:
+        LOGI("SsbSipMfcEncInit] H264 Encode");
+        h264_arg = (SSBSIP_MFC_ENC_H264_PARAM *)param;
+
+        pCTX->width = h264_arg->SourceWidth;
+        pCTX->height = h264_arg->SourceHeight;
+        break;
+
+    default:
+        break;
+    }
+
+    switch (pCTX->codecType) {
+    case MPEG4_ENC:
+        mpeg4_arg = (SSBSIP_MFC_ENC_MPEG4_PARAM *)param;
+
+        EncArg.args.enc_init.cmn.in_codec_type = pCTX->codecType;
+
+        EncArg.args.enc_init.cmn.in_width = mpeg4_arg->SourceWidth;
+        EncArg.args.enc_init.cmn.in_height = mpeg4_arg->SourceHeight;
+        EncArg.args.enc_init.cmn.in_gop_num = mpeg4_arg->IDRPeriod;
+
+        EncArg.args.enc_init.cmn.in_ms_mode = mpeg4_arg->SliceMode;
+        EncArg.args.enc_init.cmn.in_ms_arg = mpeg4_arg->SliceArgument;
+        EncArg.args.enc_init.cmn.in_output_mode = mpeg4_arg->OutputMode;
+
+        EncArg.args.enc_init.cmn.in_mb_refresh = mpeg4_arg->RandomIntraMBRefresh;
+
+        /* rate control*/
+        EncArg.args.enc_init.cmn.in_rc_fr_en = mpeg4_arg->EnableFRMRateControl;
+        if ((mpeg4_arg->QSCodeMin > 31) || (mpeg4_arg->QSCodeMax > 31)) {
+            LOGE("SsbSipMfcEncInit] No such Min/Max QP is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_rc_qbound_min = mpeg4_arg->QSCodeMin;
+        EncArg.args.enc_init.cmn.in_rc_qbound_max = mpeg4_arg->QSCodeMax;
+        EncArg.args.enc_init.cmn.in_rc_rpara = mpeg4_arg->CBRPeriodRf;
+
+        /* pad control */
+        EncArg.args.enc_init.cmn.in_pad_ctrl_on = mpeg4_arg->PadControlOn;
+        if ((mpeg4_arg->LumaPadVal > 255) || (mpeg4_arg->CbPadVal > 255) || (mpeg4_arg->CrPadVal > 255)) {
+            LOGE("SsbSipMfcEncInit] No such Pad value is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_y_pad_val = mpeg4_arg->LumaPadVal;
+        EncArg.args.enc_init.cmn.in_cb_pad_val = mpeg4_arg->CbPadVal;
+        EncArg.args.enc_init.cmn.in_cr_pad_val = mpeg4_arg->CrPadVal;
+
+        /* Input stream Mode  NV12_Linear or NV12_Tile*/
+        EncArg.args.enc_init.cmn.in_frame_map = mpeg4_arg->FrameMap;
+
+        EncArg.args.enc_init.cmn.in_rc_bitrate = mpeg4_arg->Bitrate;
+        if ((mpeg4_arg->FrameQp > 31) || (mpeg4_arg->FrameQp_P > 31)) {
+            LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_vop_quant = mpeg4_arg->FrameQp;
+        EncArg.args.enc_init.cmn.in_vop_quant_p = mpeg4_arg->FrameQp_P;
+
+        /* MPEG4 only */
+        EncArg.args.enc_init.codec.mpeg4.in_profile = mpeg4_arg->ProfileIDC;
+        EncArg.args.enc_init.codec.mpeg4.in_level = mpeg4_arg->LevelIDC;
+
+        if (mpeg4_arg->FrameQp_B > 31) {
+            LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.codec.mpeg4.in_vop_quant_b = mpeg4_arg->FrameQp_B;
+
+        if (mpeg4_arg->NumberBFrames > 2) {
+            LOGE("SsbSipMfcEncInit] No such BframeNum is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.codec.mpeg4.in_bframenum = mpeg4_arg->NumberBFrames;
+
+        EncArg.args.enc_init.codec.mpeg4.in_quart_pixel = mpeg4_arg->DisableQpelME;
+
+        EncArg.args.enc_init.codec.mpeg4.in_TimeIncreamentRes = mpeg4_arg->TimeIncreamentRes;
+        EncArg.args.enc_init.codec.mpeg4.in_VopTimeIncreament = mpeg4_arg->VopTimeIncreament;
+
+        break;
+
+    case H263_ENC:
+        h263_arg = (SSBSIP_MFC_ENC_H263_PARAM *)param;
+
+        EncArg.args.enc_init.cmn.in_codec_type = pCTX->codecType;
+
+        EncArg.args.enc_init.cmn.in_width = h263_arg->SourceWidth;
+        EncArg.args.enc_init.cmn.in_height = h263_arg->SourceHeight;
+        EncArg.args.enc_init.cmn.in_gop_num = h263_arg->IDRPeriod;
+
+        EncArg.args.enc_init.cmn.in_ms_mode = h263_arg->SliceMode;
+        EncArg.args.enc_init.cmn.in_ms_arg = 0;
+        EncArg.args.enc_init.cmn.in_output_mode = FRAME;  /* not support to slice output mode */
+
+        EncArg.args.enc_init.cmn.in_mb_refresh = h263_arg->RandomIntraMBRefresh;
+
+        /* rate control*/
+        EncArg.args.enc_init.cmn.in_rc_fr_en = h263_arg->EnableFRMRateControl;
+        if ((h263_arg->QSCodeMin > 31) || (h263_arg->QSCodeMax > 31)) {
+            LOGE("SsbSipMfcEncInit] No such Min/Max QP is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_rc_qbound_min = h263_arg->QSCodeMin;
+        EncArg.args.enc_init.cmn.in_rc_qbound_max = h263_arg->QSCodeMax;
+        EncArg.args.enc_init.cmn.in_rc_rpara = h263_arg->CBRPeriodRf;
+
+        /* pad control */
+        EncArg.args.enc_init.cmn.in_pad_ctrl_on = h263_arg->PadControlOn;
+        if ((h263_arg->LumaPadVal > 255) || (h263_arg->CbPadVal > 255) || (h263_arg->CrPadVal > 255)) {
+            LOGE("SsbSipMfcEncInit] No such Pad value is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_y_pad_val = h263_arg->LumaPadVal;
+        EncArg.args.enc_init.cmn.in_cb_pad_val = h263_arg->CbPadVal;
+        EncArg.args.enc_init.cmn.in_cr_pad_val = h263_arg->CrPadVal;
+
+        /* Input stream Mode  NV12_Linear or NV12_Tile*/
+        EncArg.args.enc_init.cmn.in_frame_map = h263_arg->FrameMap;
+
+        EncArg.args.enc_init.cmn.in_rc_bitrate = h263_arg->Bitrate;
+        if ((h263_arg->FrameQp > 31) || (h263_arg->FrameQp_P > 31)) {
+            LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_vop_quant = h263_arg->FrameQp;
+        EncArg.args.enc_init.cmn.in_vop_quant_p = h263_arg->FrameQp_P;
+
+        /* H.263 only */
+        EncArg.args.enc_init.codec.h263.in_rc_framerate = h263_arg->FrameRate;
+
+        break;
+
+    case H264_ENC:
+        h264_arg = (SSBSIP_MFC_ENC_H264_PARAM *)param;
+
+        EncArg.args.enc_init.cmn.in_codec_type = H264_ENC;
+
+        EncArg.args.enc_init.cmn.in_width = h264_arg->SourceWidth;
+        EncArg.args.enc_init.cmn.in_height = h264_arg->SourceHeight;
+        EncArg.args.enc_init.cmn.in_gop_num = h264_arg->IDRPeriod;
+
+        if ((h264_arg->SliceMode == 0)||(h264_arg->SliceMode == 1)||
+            (h264_arg->SliceMode == 2)||(h264_arg->SliceMode == 4)) {
+            EncArg.args.enc_init.cmn.in_ms_mode = h264_arg->SliceMode;
+        } else {
+            LOGE("SsbSipMfcEncInit] No such slice mode is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_ms_arg = h264_arg->SliceArgument;
+        EncArg.args.enc_init.cmn.in_output_mode = h264_arg->OutputMode;
+
+        EncArg.args.enc_init.cmn.in_mb_refresh = h264_arg->RandomIntraMBRefresh;
+        /* pad control */
+        EncArg.args.enc_init.cmn.in_pad_ctrl_on = h264_arg->PadControlOn;
+        if ((h264_arg->LumaPadVal > 255) || (h264_arg->CbPadVal > 255) || (h264_arg->CrPadVal > 255)) {
+            LOGE("SsbSipMfcEncInit] No such Pad value is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_y_pad_val = h264_arg->LumaPadVal;
+        EncArg.args.enc_init.cmn.in_cb_pad_val = h264_arg->CbPadVal;
+        EncArg.args.enc_init.cmn.in_cr_pad_val = h264_arg->CrPadVal;
+
+        /* Input stream Mode  NV12_Linear or NV12_Tile*/
+        EncArg.args.enc_init.cmn.in_frame_map = h264_arg->FrameMap;
+
+        /* rate control*/
+        EncArg.args.enc_init.cmn.in_rc_fr_en = h264_arg->EnableFRMRateControl;
+        EncArg.args.enc_init.cmn.in_rc_bitrate = h264_arg->Bitrate;
+        if ((h264_arg->FrameQp > 51) || (h264_arg->FrameQp_P > 51)) {
+            LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_vop_quant = h264_arg->FrameQp;
+        EncArg.args.enc_init.cmn.in_vop_quant_p = h264_arg->FrameQp_P;
+
+        if ((h264_arg->QSCodeMin > 51) || (h264_arg->QSCodeMax > 51)) {
+            LOGE("SsbSipMfcEncInit] No such Min/Max QP is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.cmn.in_rc_qbound_min = h264_arg->QSCodeMin;
+        EncArg.args.enc_init.cmn.in_rc_qbound_max = h264_arg->QSCodeMax;
+        EncArg.args.enc_init.cmn.in_rc_rpara = h264_arg->CBRPeriodRf;
+
+
+        /* H.264 Only */
+        EncArg.args.enc_init.codec.h264.in_profile = h264_arg->ProfileIDC;
+        EncArg.args.enc_init.codec.h264.in_level = h264_arg->LevelIDC;
+
+        if (h264_arg->FrameQp_B > 51) {
+            LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.codec.h264.in_vop_quant_b = h264_arg->FrameQp_B;
+
+        if (h264_arg->NumberBFrames > 2) {
+            LOGE("SsbSipMfcEncInit] No such BframeNum is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.codec.h264.in_bframenum = h264_arg->NumberBFrames;
+
+        EncArg.args.enc_init.codec.h264.in_interlace_mode = h264_arg->PictureInterlace;
+
+        if ((h264_arg->NumberRefForPframes > 2)||(h264_arg->NumberReferenceFrames >2)) {
+            LOGE("SsbSipMfcEncInit] No such ref Num is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.codec.h264.in_reference_num = h264_arg->NumberReferenceFrames;
+        EncArg.args.enc_init.codec.h264.in_ref_num_p = h264_arg->NumberRefForPframes;
+
+        EncArg.args.enc_init.codec.h264.in_rc_framerate = h264_arg->FrameRate;
+
+        EncArg.args.enc_init.codec.h264.in_rc_mb_en = h264_arg->EnableMBRateControl;
+        EncArg.args.enc_init.codec.h264.in_rc_mb_dark_dis = h264_arg->DarkDisable;
+        EncArg.args.enc_init.codec.h264.in_rc_mb_smooth_dis = h264_arg->SmoothDisable;
+        EncArg.args.enc_init.codec.h264.in_rc_mb_static_dis = h264_arg->StaticDisable;
+        EncArg.args.enc_init.codec.h264.in_rc_mb_activity_dis = h264_arg->ActivityDisable;
+
+        EncArg.args.enc_init.codec.h264.in_deblock_dis = h264_arg->LoopFilterDisable;
+        if ((abs(h264_arg->LoopFilterAlphaC0Offset) > 6) || (abs(h264_arg->LoopFilterBetaOffset) > 6)) {
+            LOGE("SsbSipMfcEncInit] No such AlphaC0Offset or BetaOffset is supported");
+            return MFC_RET_INVALID_PARAM;
+        }
+        EncArg.args.enc_init.codec.h264.in_deblock_alpha_c0 = h264_arg->LoopFilterAlphaC0Offset;
+        EncArg.args.enc_init.codec.h264.in_deblock_beta = h264_arg->LoopFilterBetaOffset;
+
+        EncArg.args.enc_init.codec.h264.in_symbolmode = h264_arg->SymbolMode;
+        EncArg.args.enc_init.codec.h264.in_transform8x8_mode = h264_arg->Transform8x8Mode;
+
+        /* FIXME: is it removed? */
+        EncArg.args.enc_init.codec.h264.in_md_interweight_pps = 300;
+        EncArg.args.enc_init.codec.h264.in_md_intraweight_pps = 170;
+
+        break;
+
+    default:
+        LOGE("SsbSipMfcEncInit] No such codec type is supported");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    EncArg.args.enc_init.cmn.in_mapped_addr = pCTX->mapped_addr;
+
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_ENC_INIT, &EncArg);
+    if (EncArg.ret_code != MFC_OK) {
+        LOGE("SsbSipMfcEncInit] IOCTL_MFC_ENC_INIT failed");
+        return MFC_RET_ENC_INIT_FAIL;
+    }
+
+    pCTX->virStrmBuf = EncArg.args.enc_init.cmn.out_u_addr.strm_ref_y;
+    pCTX->phyStrmBuf = EncArg.args.enc_init.cmn.out_p_addr.strm_ref_y;
+
+    pCTX->sizeStrmBuf = MAX_ENCODER_OUTPUT_BUFFER_SIZE;
+    pCTX->encodedHeaderSize = EncArg.args.enc_init.cmn.out_header_size;
+
+    pCTX->virMvRefYC = EncArg.args.enc_init.cmn.out_u_addr.mv_ref_yc;
+
+    pCTX->inter_buff_status |= MFC_USE_STRM_BUFF;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
+{
+    int ret_code;
+    _MFCLIB *pCTX;
+    struct mfc_common_args EncArg;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcEncExe] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *)openHandle;
+
+    memset(&EncArg, 0x00, sizeof(struct mfc_common_args));
+
+    EncArg.args.enc_exe.in_codec_type = pCTX->codecType;
+    EncArg.args.enc_exe.in_Y_addr    = (unsigned int)pCTX->phyFrmBuf.luma;
+    EncArg.args.enc_exe.in_CbCr_addr = (unsigned int)pCTX->phyFrmBuf.chroma;
+#if 0 /* peter for debug */
+    EncArg.args.enc_exe.in_Y_addr_vir    = (unsigned int)pCTX->virFrmBuf.luma;
+    EncArg.args.enc_exe.in_CbCr_addr_vir = (unsigned int)pCTX->virFrmBuf.chroma;
+#endif
+    EncArg.args.enc_exe.in_frametag = pCTX->inframetag;
+    if (pCTX->encode_cnt == 0) {
+        EncArg.args.enc_exe.in_strm_st   = (unsigned int)pCTX->phyStrmBuf;
+        EncArg.args.enc_exe.in_strm_end  = (unsigned int)pCTX->phyStrmBuf + pCTX->sizeStrmBuf;
+    } else {
+        EncArg.args.enc_exe.in_strm_st = (unsigned int)pCTX->phyStrmBuf + (MAX_ENCODER_OUTPUT_BUFFER_SIZE / 2);
+        EncArg.args.enc_exe.in_strm_end = (unsigned int)pCTX->phyStrmBuf + pCTX->sizeStrmBuf + (MAX_ENCODER_OUTPUT_BUFFER_SIZE / 2);
+    }
+
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_ENC_EXE, &EncArg);
+    if (EncArg.ret_code != MFC_OK) {
+        LOGE("SsbSipMfcEncExe] IOCTL_MFC_ENC_EXE failed(ret : %d)", EncArg.ret_code);
+        return MFC_RET_ENC_EXE_ERR;
+    }
+
+    pCTX->encodedDataSize = EncArg.args.enc_exe.out_encoded_size;
+    pCTX->encodedframeType = EncArg.args.enc_exe.out_frame_type;
+    pCTX->encodedphyFrmBuf.luma = EncArg.args.enc_exe.out_Y_addr;
+    pCTX->encodedphyFrmBuf.chroma = EncArg.args.enc_exe.out_CbCr_addr;
+    pCTX->outframetagtop = EncArg.args.enc_exe.out_frametag_top;
+    pCTX->outframetagbottom = EncArg.args.enc_exe.out_frametag_bottom;
+
+    LOGV("SsbSipMfcEncExe] Encode success ==================");
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
+{
+    int ret_code;
+    _MFCLIB *pCTX;
+    struct mfc_common_args free_arg;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcEncClose] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *)openHandle;
+
+    /* FIXME: free buffer? */
+    if (pCTX->inter_buff_status & MFC_USE_YUV_BUFF) {
+        free_arg.args.mem_free.key = pCTX->virFrmBuf.luma;
+        ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg);
+    }
+
+    if (pCTX->inter_buff_status & MFC_USE_STRM_BUFF) {
+        free_arg.args.mem_free.key = pCTX->virStrmBuf;
+        ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg);
+        free_arg.args.mem_free.key = pCTX->virMvRefYC;
+        ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_FREE_BUF, &free_arg);
+    }
+
+    pCTX->inter_buff_status = MFC_USE_NONE;
+
+    munmap((void *)pCTX->mapped_addr, pCTX->mapped_size);
+
+    close(pCTX->hMFC);
+
+    free(pCTX);
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info)
+{
+    int ret_code;
+    _MFCLIB *pCTX;
+    struct mfc_common_args user_addr_arg, real_addr_arg;
+    int y_size, c_size;
+    int aligned_y_size, aligned_c_size;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcEncGetInBuf] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    /* FIXME: */
+    y_size = pCTX->width * pCTX->height;
+    c_size = (pCTX->width * pCTX->height) >> 1;
+
+    /* lenear: 2KB, tile: 8KB */
+    aligned_y_size = Align(y_size, 64 * BUF_L_UNIT);
+    aligned_c_size = Align(c_size, 64 * BUF_L_UNIT);
+
+    /* Allocate luma & chroma buf */
+    user_addr_arg.args.mem_alloc.type = ENCODER;
+    user_addr_arg.args.mem_alloc.buff_size = aligned_y_size + aligned_c_size;
+    user_addr_arg.args.mem_alloc.mapped_addr = pCTX->mapped_addr;
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_IN_BUF, &user_addr_arg);
+    if (ret_code < 0) {
+        LOGE("SsbSipMfcEncGetInBuf] IOCTL_MFC_GET_IN_BUF failed");
+        return MFC_RET_ENC_GET_INBUF_FAIL;
+    }
+
+    pCTX->virFrmBuf.luma = pCTX->mapped_addr + user_addr_arg.args.mem_alloc.offset;
+    pCTX->virFrmBuf.chroma = pCTX->mapped_addr + user_addr_arg.args.mem_alloc.offset + (unsigned int)aligned_y_size;
+
+    real_addr_arg.args.real_addr.key = user_addr_arg.args.mem_alloc.offset;
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_REAL_ADDR, &real_addr_arg);
+    if (ret_code  < 0) {
+        LOGE("SsbSipMfcEncGetInBuf] IOCTL_MFC_GET_REAL_ADDR failed");
+        return MFC_RET_ENC_GET_INBUF_FAIL;
+    }
+    pCTX->phyFrmBuf.luma = real_addr_arg.args.real_addr.addr;
+    pCTX->phyFrmBuf.chroma = real_addr_arg.args.real_addr.addr + (unsigned int)aligned_y_size;
+
+    pCTX->sizeFrmBuf.luma = (unsigned int)y_size;
+    pCTX->sizeFrmBuf.chroma = (unsigned int)c_size;
+    pCTX->inter_buff_status |= MFC_USE_YUV_BUFF;
+
+    input_info->YPhyAddr = (void*)pCTX->phyFrmBuf.luma;
+    input_info->CPhyAddr = (void*)pCTX->phyFrmBuf.chroma;
+    input_info->YVirAddr = (void*)pCTX->virFrmBuf.luma;
+    input_info->CVirAddr = (void*)pCTX->virFrmBuf.chroma;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info)
+{
+    _MFCLIB *pCTX;
+    int ret_code;
+    struct mfc_common_args user_addr_arg, real_addr_arg;
+    int y_size, c_size;
+    int aligned_y_size, aligned_c_size;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcEncSetInBuf] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    LOGV("SsbSipMfcEncSetInBuf] input_info->YPhyAddr & input_info->CPhyAddr should be 64KB aligned");
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    /* FIXME: */
+    y_size = pCTX->width * pCTX->height;
+    c_size = (pCTX->width * pCTX->height) >> 1;
+
+    /* lenear: 2KB, tile: 8KB */
+    aligned_y_size = Align(y_size, 64 * BUF_L_UNIT);
+    aligned_c_size = Align(c_size, 64 * BUF_L_UNIT);
+
+    pCTX->phyFrmBuf.luma = (unsigned int)input_info->YPhyAddr;
+    pCTX->phyFrmBuf.chroma = (unsigned int)input_info->CPhyAddr;
+
+    pCTX->sizeFrmBuf.luma = (unsigned int)input_info->YSize;
+    pCTX->sizeFrmBuf.chroma = (unsigned int)input_info->CSize;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUTPUT_INFO *output_info)
+{
+    _MFCLIB *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcEncGetOutBuf] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *)openHandle;
+
+    output_info->headerSize = pCTX->encodedHeaderSize;
+    output_info->dataSize = pCTX->encodedDataSize;
+    output_info->frameType = pCTX->encodedframeType;
+
+    if (pCTX->encode_cnt == 0) {
+        output_info->StrmPhyAddr = (void *)pCTX->phyStrmBuf;
+        output_info->StrmVirAddr = (unsigned char *)pCTX->virStrmBuf + pCTX->mapped_addr;
+    } else {
+        output_info->StrmPhyAddr = (unsigned char *)pCTX->phyStrmBuf + (MAX_ENCODER_OUTPUT_BUFFER_SIZE / 2);
+        output_info->StrmVirAddr = (unsigned char *)pCTX->virStrmBuf + pCTX->mapped_addr + (MAX_ENCODER_OUTPUT_BUFFER_SIZE / 2);
+    }
+
+    pCTX->encode_cnt ++;
+    pCTX->encode_cnt %= 2;
+
+    output_info->encodedYPhyAddr = (void*)pCTX->encodedphyFrmBuf.luma;
+    output_info->encodedCPhyAddr = (void*)pCTX->encodedphyFrmBuf.chroma;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetOutBuf(void *openHandle, void *phyOutbuf, void *virOutbuf, int outputBufferSize)
+{
+    _MFCLIB *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcEncSetOutBuf] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    pCTX->phyStrmBuf = (int)phyOutbuf;
+    pCTX->virStrmBuf = (int)virOutbuf;
+    pCTX->sizeStrmBuf = outputBufferSize;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value)
+{
+    int ret_code;
+    _MFCLIB *pCTX;
+    struct mfc_common_args EncArg;
+    struct mfc_enc_vui_info vui_info;
+    struct mfc_enc_hier_p_qp hier_p_qp;
+#ifdef S3D_SUPPORT
+    struct mfc_enc_set_config set_info;
+    struct mfc_frame_packing *frame_packing;
+#endif
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcEncSetConfig] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if (value == NULL) {
+        LOGE("SsbSipMfcEncSetConfig] value is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+    memset(&EncArg, 0x00, sizeof(struct mfc_common_args));
+
+#ifdef S3D_SUPPORT
+    EncArg.args.config.type = conf_type;
+
+    switch (conf_type) {
+    case MFC_ENC_SETCONF_FRAME_TAG:
+        pCTX->inframetag = *((unsigned int *)value);
+        return MFC_RET_OK;
+    case MFC_ENC_SETCONF_ALLOW_FRAME_SKIP:
+        set_info = *((struct mfc_enc_set_config *) value);
+        EncArg.args.config.args.basic.values[0] = set_info.enable;
+        if (set_info.enable == 2)
+            EncArg.args.config.args.basic.values[1] = set_info.number;
+        else
+            EncArg.args.config.args.basic.values[1] = 0;
+        break;
+    case MFC_ENC_SETCONF_VUI_INFO:
+        set_info = *((struct mfc_enc_set_config *) value);
+        EncArg.args.config.args.basic.values[0] = set_info.enable;
+        if (set_info.enable == 255) //Re-check this part of code with Jeongtae Park
+            EncArg.args.config.args.basic.values[1] = set_info.number;
+        else
+            EncArg.args.config.args.basic.values[1] = 0;
+
+        EncArg.args.config.args.basic.values[1] = set_info.number;
+        break;
+    case MFC_ENC_SETCONF_FRAME_PACKING:
+        frame_packing = (struct mfc_frame_packing *)value;
+        /*
+        memcpy(&EncArg.args.config.args.frame_packing, frame_packing,
+            sizeof(struct mfc_frame_packing));
+        */
+        EncArg.args.config.args.basic.values[0] = frame_packing->arrangement_type;
+        EncArg.args.config.args.basic.values[1] = frame_packing->current_frame_is_frame0_flag;
+        break;
+    case MFC_ENC_SETCONF_FRAME_TYPE:
+    case MFC_ENC_SETCONF_CHANGE_FRAME_RATE:
+    case MFC_ENC_SETCONF_CHANGE_BIT_RATE:
+    case MFC_ENC_SETCONF_I_PERIOD:
+    case MFC_ENC_SETCONF_HIER_P:
+    case MFC_ENC_SETCONF_SEI_GEN:
+        EncArg.args.config.args.basic.values[0] = *((int *) value);
+        EncArg.args.config.args.basic.values[1] = 0;
+        break;
+    default:
+        LOGE("SsbSipMfcEncSetConfig] not supported type");
+        return MFC_RET_ENC_SET_CONF_FAIL;
+    }
+#else
+    EncArg.args.set_config.in_config_param = conf_type;
+    switch (conf_type) {
+    case MFC_ENC_SETCONF_FRAME_TAG:
+        pCTX->inframetag = *((unsigned int *)value);
+        return MFC_RET_OK;
+    case MFC_ENC_SETCONF_VUI_INFO:
+        vui_info = *((struct mfc_enc_vui_info *) value);
+        EncArg.args.set_config.in_config_value[0]  = (int)(vui_info.aspect_ratio_idc);
+        EncArg.args.set_config.in_config_value[1]  = 0;
+        break;
+    case MFC_ENC_SETCONF_HIER_P:
+        hier_p_qp = *((struct mfc_enc_hier_p_qp *) value);
+        EncArg.args.set_config.in_config_value[0]  = (int)(hier_p_qp.t0_frame_qp);
+        EncArg.args.set_config.in_config_value[1]  = (int)(hier_p_qp.t2_frame_qp);
+        EncArg.args.set_config.in_config_value[2]  = (int)(hier_p_qp.t3_frame_qp);
+        break;
+    default:
+        EncArg.args.set_config.in_config_value[0]  = *((int *) value);
+        EncArg.args.set_config.in_config_value[1]  = 0;
+        break;
+    }
+#endif
+
+    ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_SET_CONFIG, &EncArg);
+    if (EncArg.ret_code != MFC_OK) {
+        LOGE("SsbSipMfcEncSetConfig] IOCTL_MFC_SET_CONFIG failed(ret : %d)", EncArg.ret_code);
+        return MFC_RET_ENC_SET_CONF_FAIL;
+    }
+
+    return MFC_RET_OK;
+}
+
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value)
+{
+    _MFCLIB *pCTX;
+    /*
+    unsigned int *encoded_header_size;
+    */
+
+    pCTX = (_MFCLIB *)openHandle;
+
+    if (openHandle == NULL) {
+        LOGE("SsbSipMfcEncGetConfig] openHandle is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+    if (value == NULL) {
+        LOGE("SsbSipMfcEncGetConfig] value is NULL");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    switch (conf_type) {
+    case MFC_ENC_GETCONF_FRAME_TAG:
+        *((unsigned int *)value) = pCTX->outframetagtop;
+        break;
+#if 0
+    case MFC_ENC_GETCONF_HEADER_SIZE:
+        encoded_header_size = (unsigned int *)value;
+        *encoded_header_size = pCTX->encodedHeaderSize;
+        break;
+#endif
+    default:
+        LOGE("SsbSipMfcEncGetConfig] No such conf_type is supported.");
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    return MFC_RET_OK;
+}
+
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/include/SsbSipMfcApi.h b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/include/SsbSipMfcApi.h
new file mode 100644
index 0000000..fed3e34
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/include/SsbSipMfcApi.h
@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * Global header for Samsung MFC (Multi Function Codec - FIMV) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _SSBSIP_MFC_API_H_
+#define _SSBSIP_MFC_API_H_
+
+/*--------------------------------------------------------------------------------*/
+/* Definition                                                                     */
+/*--------------------------------------------------------------------------------*/
+#define MAX_DECODER_INPUT_BUFFER_SIZE  (1024 * 3072)
+#define MAX_ENCODER_OUTPUT_BUFFER_SIZE (1024 * 3072)
+
+#define SUPPORT_1080P        1
+
+#if SUPPORT_1080P
+#define MMAP_BUFFER_SIZE_MMAP          (70*1024*1024) /* only C110 use this value. in C210, memory size is decided in menuconfig*/
+#else
+#define MMAP_BUFFER_SIZE_MMAP          (62*1024*1024)
+#endif
+
+#define SAMSUNG_MFC_DEV_NAME           "/dev/s3c-mfc"
+
+
+/*--------------------------------------------------------------------------------*/
+/* Structure and Type                                                             */
+/*--------------------------------------------------------------------------------*/
+typedef enum {
+    H264_DEC,
+    VC1_DEC,     /* VC1 advaced Profile decoding  */
+    MPEG4_DEC,
+    XVID_DEC,
+    MPEG1_DEC,
+    MPEG2_DEC,
+    H263_DEC,
+    VC1RCV_DEC,  /* VC1 simple/main profile decoding  */
+    FIMV1_DEC,
+    FIMV2_DEC,
+    FIMV3_DEC,
+    FIMV4_DEC,
+    H264_ENC,
+    MPEG4_ENC,
+    H263_ENC,
+    UNKNOWN_TYPE
+} SSBSIP_MFC_CODEC_TYPE;
+
+typedef enum {
+    DONT_CARE = 0,
+    I_FRAME = 1,
+    NOT_CODED = 2
+} SSBSIP_MFC_FORCE_SET_FRAME_TYPE;
+
+typedef enum {
+    NV12_LINEAR = 0,
+    NV12_TILE,
+    NV21_LINEAR
+} SSBSIP_MFC_INSTRM_MODE_TYPE;
+
+typedef enum {
+    FRAME = 0,
+    SLICE,
+} SSBSIP_MFC_OUTSTRM_MODE_TYPE;
+
+typedef enum {
+    NO_CACHE = 0,
+    CACHE = 1
+} SSBIP_MFC_BUFFER_TYPE;
+
+typedef enum {
+    MFC_DEC_SETCONF_POST_ENABLE = 1,
+    MFC_DEC_SETCONF_EXTRA_BUFFER_NUM,
+    MFC_DEC_SETCONF_DISPLAY_DELAY,
+    MFC_DEC_SETCONF_IS_LAST_FRAME,
+    MFC_DEC_SETCONF_SLICE_ENABLE,
+    MFC_DEC_SETCONF_CRC_ENABLE,
+    MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT,
+    MFC_DEC_SETCONF_FRAME_TAG,
+    MFC_DEC_GETCONF_CRC_DATA,
+    MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT,
+    MFC_DEC_GETCONF_CROP_INFO,
+    MFC_DEC_GETCONF_FRAME_TAG,
+
+    /* C210 specific feature */
+    MFC_DEC_SETCONF_IMMEDIATELY_DISPLAY,
+    MFC_DEC_SETCONF_DPB_FLUSH,
+    MFC_DEC_SETCONF_PIXEL_CACHE,
+#ifndef S3D_SUPPORT
+    MFC_DEC_GETCONF_WIDTH_HEIGHT
+#else
+    MFC_DEC_GETCONF_WIDTH_HEIGHT,
+    MFC_DEC_SETCONF_SEI_PARSE,
+    MFC_DEC_GETCONF_FRAME_PACKING
+#endif
+} SSBSIP_MFC_DEC_CONF;
+
+typedef enum {
+    MFC_ENC_SETCONF_FRAME_TYPE = 100,
+    MFC_ENC_SETCONF_CHANGE_FRAME_RATE,
+    MFC_ENC_SETCONF_CHANGE_BIT_RATE,
+    MFC_ENC_SETCONF_FRAME_TAG,
+    MFC_ENC_SETCONF_ALLOW_FRAME_SKIP,
+    MFC_ENC_GETCONF_FRAME_TAG,
+
+    /* C210 specific feature */
+    MFC_ENC_SETCONF_VUI_INFO,
+    MFC_ENC_SETCONF_I_PERIOD,
+#ifndef S3D_SUPPORT
+    MFC_ENC_SETCONF_HIER_P
+#else
+    MFC_ENC_SETCONF_HIER_P,
+    MFC_ENC_SETCONF_SEI_GEN,
+    MFC_ENC_SETCONF_FRAME_PACKING
+#endif
+} SSBSIP_MFC_ENC_CONF;
+
+typedef enum {
+    MFC_GETOUTBUF_STATUS_NULL = 0,
+    MFC_GETOUTBUF_DECODING_ONLY = 1,
+    MFC_GETOUTBUF_DISPLAY_DECODING,
+    MFC_GETOUTBUF_DISPLAY_ONLY,
+    MFC_GETOUTBUF_DISPLAY_END,
+    MFC_GETOUTBUF_CHANGE_RESOL
+} SSBSIP_MFC_DEC_OUTBUF_STATUS;
+
+typedef enum {
+    MFC_FRAME_TYPE_NOT_CODED,
+    MFC_FRAME_TYPE_I_FRAME,
+    MFC_FRAME_TYPE_P_FRAME,
+    MFC_FRAME_TYPE_B_FRAME,
+    MFC_FRAME_TYPE_OTHERS
+} SSBSIP_MFC_FRAME_TYPE;
+
+typedef enum {
+    MFC_RET_OK                      = 1,
+    MFC_RET_FAIL                    = -1000,
+    MFC_RET_OPEN_FAIL               = -1001,
+    MFC_RET_CLOSE_FAIL              = -1002,
+
+    MFC_RET_DEC_INIT_FAIL           = -2000,
+    MFC_RET_DEC_EXE_TIME_OUT        = -2001,
+    MFC_RET_DEC_EXE_ERR             = -2002,
+    MFC_RET_DEC_GET_INBUF_FAIL      = -2003,
+    MFC_RET_DEC_SET_INBUF_FAIL      = -2004,
+    MFC_RET_DEC_GET_OUTBUF_FAIL     = -2005,
+    MFC_RET_DEC_GET_CONF_FAIL       = -2006,
+    MFC_RET_DEC_SET_CONF_FAIL       = -2007,
+
+    MFC_RET_ENC_INIT_FAIL           = -3000,
+    MFC_RET_ENC_EXE_TIME_OUT        = -3001,
+    MFC_RET_ENC_EXE_ERR             = -3002,
+    MFC_RET_ENC_GET_INBUF_FAIL      = -3003,
+    MFC_RET_ENC_SET_INBUF_FAIL      = -3004,
+    MFC_RET_ENC_GET_OUTBUF_FAIL     = -3005,
+    MFC_RET_ENC_SET_OUTBUF_FAIL     = -3006,
+    MFC_RET_ENC_GET_CONF_FAIL       = -3007,
+    MFC_RET_ENC_SET_CONF_FAIL       = -3008,
+
+    MFC_RET_INVALID_PARAM           = -4000
+} SSBSIP_MFC_ERROR_CODE;
+
+typedef struct {
+    void *YPhyAddr;                     /* [OUT] physical address of Y */
+    void *CPhyAddr;                     /* [OUT] physical address of CbCr */
+    void *YVirAddr;                     /* [OUT] virtual address of Y */
+    void *CVirAddr;                     /* [OUT] virtual address of CbCr */
+
+    int img_width;                      /* [OUT] width of real image */
+    int img_height;                     /* [OUT] height of real image */
+    int buf_width;                      /* [OUT] width aligned to 16 */
+    int buf_height;                     /* [OUT] height alighed to 16 */
+
+    int timestamp_top;                  /* [OUT] timestamp of top filed(This is used for interlaced stream) */
+    int timestamp_bottom;               /* [OUT] timestamp of bottom filed(This is used for interlaced stream) */
+    int consumedByte;                   /* [OUT] the number of byte consumed during decoding */
+    int res_change;                     /* [OUT] whether resolution is changed or not. 0: not change, 1: increased, 2: decreased */
+    int crop_top_offset;                /* [OUT] crop information, top_offset */
+    int crop_bottom_offset;             /* [OUT] crop information, bottom_offset */
+    int crop_left_offset;               /* [OUT] crop information, left_offset */
+    int crop_right_offset;              /* [OUT] crop information, right_offset */
+    int disp_pic_frame_type;            /* [OUT] display picture frame type information */
+
+    /* C210 UMP feature */
+    unsigned int y_cookie;              /* [OUT] cookie for Y address */
+    unsigned int c_cookie;              /* [OUT] cookie for CbCr address, If it is 0, Y and CbCr is in continous memory */
+} SSBSIP_MFC_DEC_OUTPUT_INFO;
+
+typedef struct {
+    void *YPhyAddr;                     /* [IN/OUT] physical address of Y */
+    void *CPhyAddr;                     /* [IN/OUT] physical address of CbCr */
+    void *YVirAddr;                     /* [IN/OUT] virtual address of Y */
+    void *CVirAddr;                     /* [IN/OUT] virtual address of CbCr */
+    int YSize;                          /* [IN/OUT] input size of Y data */
+    int CSize;                          /* [IN/OUT] input size of CbCr data */
+
+    /* C210 UMP feature */
+    unsigned int y_cookie;              /* [OUT] cookie for Y address */
+    unsigned int c_cookie;              /* [OUT] cookie for CbCr address, If it is 0, Y and CbCr is in continous memory */
+} SSBSIP_MFC_ENC_INPUT_INFO;
+
+typedef struct {
+    unsigned int dataSize;              /* [OUT] encoded data size(without header) */
+    unsigned int headerSize;            /* [OUT] encoded header size */
+    unsigned int frameType;             /* [OUT] frame type of encoded stream */
+    void *StrmPhyAddr;                  /* [OUT] physical address of Y */
+    void *StrmVirAddr;                  /* [OUT] virtual address of Y */
+    void *encodedYPhyAddr;              /* [OUT] physical address of Y which is flushed */
+    void *encodedCPhyAddr;              /* [OUT] physical address of C which is flushed */
+
+    /* C210 UMP feature */
+    unsigned int strm_cookie;           /* [OUT] cooke for stream buffer */
+    unsigned int y_encoded_cookie;      /* [OUT] cookie for Y address */
+    unsigned int c_encoded_cookie;      /* [OUT] cookie for CbCr address, If it is 0, Y and CbCr is in continous memory */
+} SSBSIP_MFC_ENC_OUTPUT_INFO;
+
+typedef struct {
+    /* common parameters */
+    SSBSIP_MFC_CODEC_TYPE codecType;            /* [IN] codec type */
+    int SourceWidth;                            /* [IN] width of video to be encoded */
+    int SourceHeight;                           /* [IN] height of video to be encoded */
+    int IDRPeriod;                              /* [IN] GOP number(interval of I-frame) */
+    int SliceMode;                              /* [IN] Multi slice mode */
+    int RandomIntraMBRefresh;                   /* [IN] cyclic intra refresh */
+    int EnableFRMRateControl;                   /* [IN] frame based rate control enable */
+    int Bitrate;                                /* [IN] rate control parameter(bit rate) */
+    int FrameQp;                                /* [IN] The quantization parameter of the frame */
+    int FrameQp_P;                              /* [IN] The quantization parameter of the P frame */
+    int QSCodeMax;                              /* [IN] Maximum Quantization value */
+    int QSCodeMin;                              /* [IN] Minimum Quantization value */
+    int CBRPeriodRf;                            /* [IN] Reaction coefficient parameter for rate control */
+    int PadControlOn;                           /* [IN] Enable padding control */
+    int LumaPadVal;                             /* [IN] Luma pel value used to fill padding area */
+    int CbPadVal;                               /* [IN] CB pel value used to fill padding area */
+    int CrPadVal;                               /* [IN] CR pel value used to fill padding area */
+    int FrameMap;                               /* [IN] Encoding input mode(tile mode or linear mode) */
+    SSBSIP_MFC_OUTSTRM_MODE_TYPE OutputMode;    /* [IN] Output mode: Frame/Slice */
+
+    /* H.264 specific parameters */
+    int ProfileIDC;                     /* [IN] profile */
+    int LevelIDC;                       /* [IN] level */
+    int FrameQp_B;                      /* [IN] The quantization parameter of the B frame */
+    int FrameRate;                      /* [IN] rate control parameter(frame rate) */
+    int SliceArgument;                  /* [IN] MB number or byte number */
+    int NumberBFrames;                  /* [IN] The number of consecutive B frame inserted */
+    int NumberReferenceFrames;          /* [IN] The number of reference pictures used */
+    int NumberRefForPframes;            /* [IN] The number of reference pictures used for encoding P pictures */
+    int LoopFilterDisable;              /* [IN] disable the loop filter */
+    int LoopFilterAlphaC0Offset;        /* [IN] Alpha & C0 offset for H.264 loop filter */
+    int LoopFilterBetaOffset;           /* [IN] Beta offset for H.264 loop filter */
+    int SymbolMode;                     /* [IN] The mode of entropy coding(CABAC, CAVLC) */
+    int PictureInterlace;               /* [IN] Enables the interlace mode */
+    int Transform8x8Mode;               /* [IN] Allow 8x8 transform(This is allowed only for high profile) */
+    int EnableMBRateControl;            /* [IN] Enable macroblock-level rate control */
+    int DarkDisable;                    /* [IN] Disable adaptive rate control on dark region */
+    int SmoothDisable;                  /* [IN] Disable adaptive rate control on smooth region */
+    int StaticDisable;                  /* [IN] Disable adaptive rate control on static region */
+    int ActivityDisable;                /* [IN] Disable adaptive rate control on high activity region */
+} SSBSIP_MFC_ENC_H264_PARAM;
+
+typedef struct {
+    /* common parameters */
+    SSBSIP_MFC_CODEC_TYPE codecType;            /* [IN] codec type */
+    int SourceWidth;                            /* [IN] width of video to be encoded */
+    int SourceHeight;                           /* [IN] height of video to be encoded */
+    int IDRPeriod;                              /* [IN] GOP number(interval of I-frame) */
+    int SliceMode;                              /* [IN] Multi slice mode */
+    int RandomIntraMBRefresh;                   /* [IN] cyclic intra refresh */
+    int EnableFRMRateControl;                   /* [IN] frame based rate control enable */
+    int Bitrate;                                /* [IN] rate control parameter(bit rate) */
+    int FrameQp;                                /* [IN] The quantization parameter of the frame */
+    int FrameQp_P;                              /* [IN] The quantization parameter of the P frame */
+    int QSCodeMax;                              /* [IN] Maximum Quantization value */
+    int QSCodeMin;                              /* [IN] Minimum Quantization value */
+    int CBRPeriodRf;                            /* [IN] Reaction coefficient parameter for rate control */
+    int PadControlOn;                           /* [IN] Enable padding control */
+    int LumaPadVal;                             /* [IN] Luma pel value used to fill padding area */
+    int CbPadVal;                               /* [IN] CB pel value used to fill padding area */
+    int CrPadVal;                               /* [IN] CR pel value used to fill padding area */
+    int FrameMap;                               /* [IN] Encoding input mode(tile mode or linear mode) */
+    SSBSIP_MFC_OUTSTRM_MODE_TYPE OutputMode;    /* [IN] Output mode: Frame/Slice */
+
+    /* MPEG4 specific parameters */
+    int ProfileIDC;                     /* [IN] profile */
+    int LevelIDC;                       /* [IN] level */
+    int FrameQp_B;                      /* [IN] The quantization parameter of the B frame */
+    int TimeIncreamentRes;              /* [IN] frame rate */
+    int VopTimeIncreament;              /* [IN] frame rate */
+    int SliceArgument;                  /* [IN] MB number or byte number */
+    int NumberBFrames;                  /* [IN] The number of consecutive B frame inserted */
+    int DisableQpelME;                  /* [IN] disable quarter-pixel motion estimation */
+} SSBSIP_MFC_ENC_MPEG4_PARAM;
+
+typedef struct {
+    /* common parameters */
+    SSBSIP_MFC_CODEC_TYPE codecType;            /* [IN] codec type */
+    int SourceWidth;                            /* [IN] width of video to be encoded */
+    int SourceHeight;                           /* [IN] height of video to be encoded */
+    int IDRPeriod;                              /* [IN] GOP number(interval of I-frame) */
+    int SliceMode;                              /* [IN] Multi slice mode */
+    int RandomIntraMBRefresh;                   /* [IN] cyclic intra refresh */
+    int EnableFRMRateControl;                   /* [IN] frame based rate control enable */
+    int Bitrate;                                /* [IN] rate control parameter(bit rate) */
+    int FrameQp;                                /* [IN] The quantization parameter of the frame */
+    int FrameQp_P;                              /* [IN] The quantization parameter of the P frame */
+    int QSCodeMax;                              /* [IN] Maximum Quantization value */
+    int QSCodeMin;                              /* [IN] Minimum Quantization value */
+    int CBRPeriodRf;                            /* [IN] Reaction coefficient parameter for rate control */
+    int PadControlOn;                           /* [IN] Enable padding control */
+    int LumaPadVal;                             /* [IN] Luma pel value used to fill padding area */
+    int CbPadVal;                               /* [IN] CB pel value used to fill padding area */
+    int CrPadVal;                               /* [IN] CR pel value used to fill padding area */
+    int FrameMap;                               /* [IN] Encoding input mode(tile mode or linear mode) */
+
+    /* H.263 specific parameters */
+    int FrameRate;                      /* [IN] rate control parameter(frame rate) */
+} SSBSIP_MFC_ENC_H263_PARAM;
+
+typedef struct {
+    int width;
+    int height;
+    int buf_width;
+    int buf_height;
+} SSBSIP_MFC_IMG_RESOLUTION;
+
+typedef struct {
+    int crop_top_offset;
+    int crop_bottom_offset;
+    int crop_left_offset;
+    int crop_right_offset;
+} SSBSIP_MFC_CROP_INFORMATION;
+
+#ifdef S3D_SUPPORT
+typedef struct {
+    int           available;
+    unsigned int  arrangement_id;
+    int           arrangement_cancel_flag;
+    unsigned char arrangement_type;
+    int           quincunx_sampling_flag;
+    unsigned char content_interpretation_type;
+    int           spatial_flipping_flag;
+    int           frame0_flipped_flag;
+    int           field_views_flag;
+    int           current_frame_is_frame0_flag;
+    unsigned char frame0_grid_pos_x;
+    unsigned char frame0_grid_pos_y;
+    unsigned char frame1_grid_pos_x;
+    unsigned char frame1_grid_pos_y;
+} SSBSIP_MFC_FRAME_PACKING;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------------*/
+/* Decoding APIs                                                                  */
+/*--------------------------------------------------------------------------------*/
+void *SsbSipMfcDecOpen(void);
+void *SsbSipMfcDecOpenExt(void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE codec_type, int Frameleng);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle);
+void  *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSize);
+
+
+#if (defined(CONFIG_VIDEO_MFC_VCM_UMP) || defined(USE_UMP))
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, unsigned int secure_id, int size);
+#else
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, void *virInBuf, int size);
+#endif
+
+SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value);
+
+void *SsbSipMfcDecAllocInputBuffer(void *openHandle, void **phyInBuf, int inputBufferSize);
+void SsbSipMfcDecFreeInputBuffer(void *openHandle, void *phyInBuf);
+
+/*--------------------------------------------------------------------------------*/
+/* Encoding APIs                                                                  */
+/*--------------------------------------------------------------------------------*/
+void *SsbSipMfcEncOpen(void);
+void *SsbSipMfcEncOpenExt(void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUTPUT_INFO *output_info);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetOutBuf(void *openHandle, void *phyOutbuf, void *virOutbuf, int outputBufferSize);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SSBSIP_MFC_API_H_ */
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/include/mfc_errno.h b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/include/mfc_errno.h
new file mode 100644
index 0000000..305a28e
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/include/mfc_errno.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * Global header for Samsung MFC (Multi Function Codec - FIMV) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MFC_ERRNO_H
+#define __MFC_ERRNO_H __FILE__
+
+enum mfc_ret_code {
+    MFC_OK = 1,
+    MFC_FAIL = -1000,
+    MFC_OPEN_FAIL = -1001,
+    MFC_CLOSE_FAIL = -1002,
+
+    MFC_DEC_INIT_FAIL = -2000,
+    MFC_DEC_EXE_TIME_OUT = -2001,
+    MFC_DEC_EXE_ERR = -2002,
+    MFC_DEC_GET_INBUF_FAIL = 2003,
+    MFC_DEC_SET_INBUF_FAIL = 2004,
+    MFC_DEC_GET_OUTBUF_FAIL = -2005,
+    MFC_DEC_GET_CONF_FAIL = -2006,
+    MFC_DEC_SET_CONF_FAIL = -2007,
+
+    MFC_ENC_INIT_FAIL = -3000,
+    MFC_ENC_EXE_TIME_OUT = -3001,
+    MFC_ENC_EXE_ERR = -3002,
+    MFC_ENC_GET_INBUF_FAIL = -3003,
+    MFC_ENC_SET_INBUF_FAIL = -3004,
+    MFC_ENC_GET_OUTBUF_FAIL = -3005,
+    MFC_ENC_SET_OUTBUF_FAIL = -3006,
+    MFC_ENC_GET_CONF_FAIL = -3007,
+    MFC_ENC_SET_CONF_FAIL = -3008,
+
+    MFC_STATE_INVALID = -4000,
+    MFC_DEC_HEADER_FAIL = -4001,
+    MFC_DEC_INIT_BUF_FAIL = -4002,
+    MFC_ENC_HEADER_FAIL = -5000,
+    MFC_ENC_PARAM_FAIL = -5001,
+    MFC_FRM_BUF_SIZE_FAIL = -6000,
+    MFC_FW_LOAD_FAIL = -6001,
+    MFC_FW_INIT_FAIL = -6002,
+    MFC_INST_NUM_EXCEEDED_FAIL = -6003,
+    MFC_MEM_ALLOC_FAIL = -6004,
+    MFC_MEM_INVALID_ADDR_FAIL = -6005,
+    MFC_MEM_MAPPING_FAIL = -6006,
+    MFC_GET_CONF_FAIL = -6007,
+    MFC_SET_CONF_FAIL = -6008,
+    MFC_INVALID_PARAM_FAIL = -6009,
+    MFC_API_FAIL = -9000,
+
+    MFC_CMD_FAIL = -1003,
+    MFC_SLEEP_FAIL = -1010,
+    MFC_WAKEUP_FAIL = -1020,
+
+    MFC_CLK_ON_FAIL = -1030,
+    MFC_CLK_OFF_FAIL = -1030,
+    MFC_PWR_ON_FAIL = -1040,
+    MFC_PWR_OFF_FAIL = -1041,
+} ;
+
+#endif /* __MFC_ERRNO_H */
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/include/mfc_interface.h b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/include/mfc_interface.h
new file mode 100644
index 0000000..5212dc1
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc/include/mfc_interface.h
@@ -0,0 +1,526 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * Global header for Samsung MFC (Multi Function Codec - FIMV) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MFC_INTERFACE_H
+#define __MFC_INTERFACE_H __FILE__
+
+#include "mfc_errno.h"
+#include "SsbSipMfcApi.h"
+
+#define IOCTL_MFC_DEC_INIT              (0x00800001)
+#define IOCTL_MFC_ENC_INIT              (0x00800002)
+#define IOCTL_MFC_DEC_EXE               (0x00800003)
+#define IOCTL_MFC_ENC_EXE               (0x00800004)
+
+#define IOCTL_MFC_GET_IN_BUF            (0x00800010)
+#define IOCTL_MFC_FREE_BUF              (0x00800011)
+#define IOCTL_MFC_GET_REAL_ADDR         (0x00800012)
+#define IOCTL_MFC_GET_MMAP_SIZE         (0x00800014)
+#define IOCTL_MFC_SET_IN_BUF            (0x00800018)
+
+#define IOCTL_MFC_SET_CONFIG            (0x00800101)
+#define IOCTL_MFC_GET_CONFIG            (0x00800102)
+
+#define IOCTL_MFC_SET_BUF_CACHE         (0x00800201)
+
+/* MFC H/W support maximum 32 extra DPB. */
+#define MFC_MAX_EXTRA_DPB               5
+#define MFC_MAX_DISP_DELAY              0xF
+
+#define MFC_LIB_VER_MAJOR               1
+#define MFC_LIB_VER_MINOR               00
+
+#define BUF_L_UNIT                      (1024)
+#define Align(x, alignbyte)             (((x)+(alignbyte)-1)/(alignbyte)*(alignbyte))
+
+enum inst_type {
+    DECODER = 0x1,
+    ENCODER = 0x2,
+};
+
+typedef enum {
+    MFC_UNPACKED_PB = 0,
+    MFC_PACKED_PB = 1
+} mfc_packed_mode;
+
+
+typedef enum
+{
+    MFC_USE_NONE = 0x00,
+    MFC_USE_YUV_BUFF = 0x01,
+    MFC_USE_STRM_BUFF = 0x10
+} s3c_mfc_interbuff_status;
+
+typedef struct
+{
+    int luma0;   /* per frame (or top field) */
+    int chroma0; /* per frame (or top field) */
+    int luma1;   /* per frame (or bottom field) */
+    int chroma1; /* per frame (or bottom field) */
+} SSBSIP_MFC_CRC_DATA;
+
+struct mfc_strm_ref_buf_arg {
+    unsigned int strm_ref_y;
+    unsigned int mv_ref_yc;
+};
+
+struct mfc_frame_buf_arg {
+    unsigned int luma;
+    unsigned int chroma;
+};
+
+
+struct mfc_enc_init_common_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN] codec type */
+
+    int in_width;               /* [IN] width of YUV420 frame to be encoded */
+    int in_height;              /* [IN] height of YUV420 frame to be encoded */
+
+    int in_gop_num;             /* [IN] GOP Number (interval of I-frame) */
+    int in_vop_quant;           /* [IN] VOP quant */
+    int in_vop_quant_p;	        /* [IN] VOP quant for P frame */
+
+    /* [IN] RC enable */
+    /* [IN] RC enable (0:disable, 1:frame level RC) */
+    int in_rc_fr_en;
+    int in_rc_bitrate;          /* [IN]  RC parameter (bitrate in kbps) */
+
+    int in_rc_qbound_min;       /* [IN]  RC parameter (Q bound Min) */
+    int in_rc_qbound_max;       /* [IN]  RC parameter (Q bound Max) */
+    int in_rc_rpara;            /* [IN]  RC parameter (Reaction Coefficient) */
+
+    /* [IN] Multi-slice mode (0:single, 1:multiple) */
+    int in_ms_mode;
+    /* [IN] Multi-slice size (in num. of mb or byte) */
+    int in_ms_arg;
+
+    int in_mb_refresh;          /* [IN] Macroblock refresh */
+
+    /* [IN] Enable (1) / Disable (0) padding with the specified values */
+    int in_pad_ctrl_on;
+
+    /* [IN] pad value if pad_ctrl_on is Enable */
+    int in_y_pad_val;
+    int in_cb_pad_val;
+    int in_cr_pad_val;
+
+    /* linear or tiled */
+    int in_frame_map;
+
+    unsigned int in_pixelcache;
+
+    SSBSIP_MFC_OUTSTRM_MODE_TYPE in_output_mode;
+
+    unsigned int in_mapped_addr;
+    struct mfc_strm_ref_buf_arg out_u_addr;
+    struct mfc_strm_ref_buf_arg out_p_addr;
+    struct mfc_strm_ref_buf_arg out_buf_size;
+    unsigned int out_header_size;
+};
+
+struct mfc_enc_init_h263_arg {
+    int in_rc_framerate; /* [IN]  RC parameter (framerate) */
+};
+
+struct mfc_enc_init_mpeg4_arg {
+    int in_profile; /* [IN] profile */
+    int in_level;   /* [IN] level */
+
+    int in_vop_quant_b; /* [IN] VOP quant for B frame */
+
+    /* [IN] B frame number */
+    int in_bframenum;
+
+    /* [IN] Quarter-pel MC enable (1:enabled, 0:disabled) */
+    int in_quart_pixel;
+
+    int in_TimeIncreamentRes; /* [IN] VOP time resolution */
+    int in_VopTimeIncreament; /* [IN] Frame delta */
+};
+
+struct mfc_enc_init_h264_arg {
+    int in_profile; /* [IN] profile */
+    int in_level;   /* [IN] level */
+
+    int in_vop_quant_b;	/* [IN] VOP quant for B frame */
+
+    /* [IN] B frame number */
+    int in_bframenum;
+
+    /* [IN] interlace mode(0:progressive, 1:interlace) */
+    int in_interlace_mode;
+
+    /* [IN]  reference number */
+    int in_reference_num;
+    /* [IN]  reference number of P frame */
+    int in_ref_num_p;
+
+    int in_rc_framerate; /* [IN]  RC parameter (framerate) */
+    int in_rc_mb_en;     /* [IN] RC enable (0:disable, 1:MB level RC) */
+    /* [IN] MB level rate control dark region adaptive feature */
+    int in_rc_mb_dark_dis;     /* (0:enable, 1:disable) */
+    /* [IN] MB level rate control smooth region adaptive feature */
+    int in_rc_mb_smooth_dis;   /* (0:enable, 1:disable) */
+    /* [IN] MB level rate control static region adaptive feature */
+    int in_rc_mb_static_dis;   /* (0:enable, 1:disable) */
+    /* [IN] MB level rate control activity region adaptive feature */
+    int in_rc_mb_activity_dis; /* (0:enable, 1:disable) */
+
+    /* [IN]  disable deblocking filter idc */
+    int in_deblock_dis;	/* (0: enable,1: disable, 2:Disable at slice boundary) */
+    /* [IN]  slice alpha c0 offset of deblocking filter */
+    int in_deblock_alpha_c0;
+    /* [IN]  slice beta offset of deblocking filter */
+    int in_deblock_beta;
+
+    /* [IN]  ( 0 : CAVLC, 1 : CABAC ) */
+    int in_symbolmode;
+    /* [IN] (0: only 4x4 transform, 1: allow using 8x8 transform) */
+    int in_transform8x8_mode;
+
+    /* [IN] Inter weighted parameter for mode decision */
+    int in_md_interweight_pps;
+    /* [IN] Intra weighted parameter for mode decision */
+    int in_md_intraweight_pps;
+};
+
+struct mfc_enc_init_arg {
+    struct mfc_enc_init_common_arg cmn;
+    union {
+        struct mfc_enc_init_h264_arg h264;
+        struct mfc_enc_init_mpeg4_arg mpeg4;
+        struct mfc_enc_init_h263_arg h263;
+    } codec;
+};
+
+struct mfc_enc_exe_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN]  codec type */
+    unsigned int in_Y_addr;              /* [IN]  In-buffer addr of Y component */
+    unsigned int in_CbCr_addr;           /* [IN]  In-buffer addr of CbCr component */
+    unsigned int in_Y_addr_vir;          /* [IN]  In-buffer addr of Y component */
+    unsigned int in_CbCr_addr_vir;       /* [IN]  In-buffer addr of CbCr component */
+    unsigned int in_strm_st;             /* [IN]  Out-buffer start addr of encoded strm */
+    unsigned int in_strm_end;            /* [IN]  Out-buffer end addr of encoded strm */
+    unsigned int in_frametag;            /* [IN]  unique frame ID */
+
+    unsigned int out_frame_type;         /* [OUT] frame type */
+    int out_encoded_size;                /* [OUT] Length of Encoded video stream */
+    unsigned int out_Y_addr;             /* [OUT]Out-buffer addr of encoded Y component */
+    unsigned int out_CbCr_addr;          /* [OUT]Out-buffer addr of encoded CbCr component */
+    unsigned int out_frametag_top;       /* [OUT] unique frame ID of an output frame or top field */
+    unsigned int out_frametag_bottom;    /* [OUT] unique frame ID of bottom field */
+
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    unsigned int out_y_secure_id;
+    unsigned int out_c_secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int out_y_cookie;
+    unsigned int out_c_cookie;
+#endif
+};
+
+struct mfc_dec_init_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN] codec type */
+    int in_strm_buf;  /* [IN] address of stream buffer */
+    int in_strm_size; /* [IN] filled size in stream buffer */
+    int in_packed_PB; /* [IN]  Is packed PB frame or not, 1: packedPB  0: unpacked    */
+
+    unsigned int in_crc;         /* [IN] */
+    unsigned int in_pixelcache;	 /* [IN] */
+    unsigned int in_slice;       /* [IN] */
+    unsigned int in_numextradpb; /* [IN] */
+
+    unsigned int in_mapped_addr;
+
+    int out_frm_width;  /* [OUT] width  of YUV420 frame */
+    int out_frm_height; /* [OUT] height of YUV420 frame */
+    int out_buf_width;  /* [OUT] width  of YUV420 frame */
+    int out_buf_height; /* [OUT] height of YUV420 frame */
+
+    int out_dpb_cnt;    /* [OUT] the number of buffers which is nessary during decoding. */
+
+    int out_crop_right_offset; /* [OUT] crop information for h264 */
+    int out_crop_left_offset;
+    int out_crop_bottom_offset;
+    int out_crop_top_offset;
+};
+
+struct mfc_dec_exe_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN]  codec type */
+    int in_strm_buf; /* [IN]  the physical address of STRM_BUF */
+    /* [IN]  Size of video stream filled in STRM_BUF */
+    int in_strm_size;
+    /* [IN] the address of dpb FRAME_BUF */
+    struct mfc_frame_buf_arg in_frm_buf;
+    /* [IN] size of dpb FRAME_BUF */
+    struct mfc_frame_buf_arg in_frm_size;
+    /* [IN] Unique frame ID eg. application specific timestamp */
+    unsigned int in_frametag;
+    /* [IN] immdiate Display for seek,thumbnail and one frame */
+    int in_immediately_disp;
+    /* [OUT]  the physical address of display buf */
+    int out_display_Y_addr;
+    /* [OUT]  the physical address of display buf */
+    int out_display_C_addr;
+    int out_display_status;
+    /* [OUT] unique frame ID of an output frame or top field */
+    unsigned int out_frametag_top;
+    /* [OUT] unique frame ID of bottom field */
+    unsigned int out_frametag_bottom;
+    int out_pic_time_top;
+    int out_pic_time_bottom;
+    int out_consumed_byte;
+
+    int out_crop_right_offset;
+    int out_crop_left_offset;
+    int out_crop_bottom_offset;
+    int out_crop_top_offset;
+
+    /* in new driver, each buffer offset must be return to the user */
+    int out_y_offset;
+    int out_c_offset;
+
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    unsigned int out_y_secure_id;
+    unsigned int out_c_secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int out_y_cookie;
+    unsigned int out_c_cookie;
+#endif
+    int out_img_width;  /* [OUT] width  of YUV420 frame */
+    int out_img_height; /* [OUT] height of YUV420 frame	*/
+    int out_buf_width;  /* [OUT] width  of YUV420 frame	*/
+    int out_buf_height; /* [OUT] height of YUV420 frame	*/
+
+    int out_disp_pic_frame_type; /* [OUT] display picture frame type information */
+};
+
+#ifdef S3D_SUPPORT
+struct mfc_basic_config {
+    int values[4];
+};
+
+struct mfc_frame_packing {
+    int           available;
+    unsigned int  arrangement_id;
+    int           arrangement_cancel_flag;
+    unsigned char arrangement_type;
+    int           quincunx_sampling_flag;
+    unsigned char content_interpretation_type;
+    int           spatial_flipping_flag;
+    int           frame0_flipped_flag;
+    int           field_views_flag;
+    int           current_frame_is_frame0_flag;
+    unsigned char frame0_grid_pos_x;
+    unsigned char frame0_grid_pos_y;
+    unsigned char frame1_grid_pos_x;
+    unsigned char frame1_grid_pos_y;
+};
+
+union _mfc_config_arg {
+    struct mfc_basic_config basic;
+    struct mfc_frame_packing frame_packing;
+};
+
+struct mfc_config_arg {
+    int type;
+    union _mfc_config_arg args;
+};
+#else
+struct mfc_get_config_arg {
+    /* [IN] Configurable parameter type */
+    int in_config_param;
+
+    /* [IN] Values to get for the configurable parameter. */
+    /* Maximum four integer values can be obtained; */
+    int out_config_value[4];
+};
+
+struct mfc_set_config_arg {
+    /* [IN] Configurable parameter type */
+    int in_config_param;
+
+    /* [IN]  Values to be set for the configurable parameter. */
+    /* Maximum four integer values can be set. */
+    int in_config_value[4];
+};
+#endif
+
+struct mfc_get_real_addr_arg {
+    unsigned int key;
+    unsigned int addr;
+};
+
+struct mfc_buf_alloc_arg {
+    enum inst_type type;
+    int size;
+    /*
+    unsigned int mapped;
+    */
+    unsigned int align;
+
+    unsigned int addr;
+    /*
+    unsigned int phys;
+    */
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    /* FIMXE: invalid secure id == -1 */
+    unsigned int secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int cookie;
+#else
+    unsigned int offset;
+#endif
+};
+
+struct mfc_buf_free_arg {
+    unsigned int addr;
+};
+
+
+/* RMVME */
+struct mfc_mem_alloc_arg {
+    enum inst_type type;
+    int buff_size;
+    SSBIP_MFC_BUFFER_TYPE buf_cache_type;
+    unsigned int mapped_addr;
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    unsigned int secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int cookie;
+#else
+    unsigned int offset;
+#endif
+};
+
+struct mfc_mem_free_arg {
+    unsigned int key;
+};
+/* RMVME */
+
+union mfc_args {
+    /*
+    struct mfc_enc_init_arg enc_init;
+
+    struct mfc_enc_init_mpeg4_arg enc_init_mpeg4;
+    struct mfc_enc_init_mpeg4_arg enc_init_h263;
+    struct mfc_enc_init_h264_arg enc_init_h264;
+    */
+    struct mfc_enc_init_arg enc_init;
+    struct mfc_enc_exe_arg enc_exe;
+
+    struct mfc_dec_init_arg dec_init;
+    struct mfc_dec_exe_arg dec_exe;
+
+#ifdef S3D_SUPPORT
+    struct mfc_config_arg config;
+#else
+    struct mfc_get_config_arg get_config;
+    struct mfc_set_config_arg set_config;
+#endif
+
+    struct mfc_buf_alloc_arg buf_alloc;
+    struct mfc_buf_free_arg buf_free;
+    struct mfc_get_real_addr_arg real_addr;
+
+    /* RMVME */
+    struct mfc_mem_alloc_arg mem_alloc;
+    struct mfc_mem_free_arg mem_free;
+    /* RMVME */
+};
+
+struct mfc_common_args {
+    enum mfc_ret_code ret_code;	/* [OUT] error code */
+    union mfc_args args;
+};
+
+struct mfc_enc_vui_info {
+    int aspect_ratio_idc;
+};
+
+struct mfc_dec_fimv1_info {
+    int width;
+    int height;
+};
+
+struct mfc_enc_hier_p_qp {
+    int t0_frame_qp;
+    int t2_frame_qp;
+    int t3_frame_qp;
+};
+
+#ifdef S3D_SUPPORT
+struct mfc_enc_set_config {
+    int enable;
+    int number;
+};
+#endif
+
+typedef struct
+{
+    int magic;
+    int hMFC;
+    int hVMEM;
+    int width;
+    int height;
+    int sizeStrmBuf;
+    struct mfc_frame_buf_arg sizeFrmBuf;
+    int displayStatus;
+    int inter_buff_status;
+    unsigned int virFreeStrmAddr;
+    unsigned int phyStrmBuf;
+    unsigned int virStrmBuf;
+    unsigned int virMvRefYC;
+    struct mfc_frame_buf_arg phyFrmBuf;
+    struct mfc_frame_buf_arg virFrmBuf;
+    unsigned int mapped_addr;
+    unsigned int mapped_size;
+    struct mfc_common_args MfcArg;
+    SSBSIP_MFC_CODEC_TYPE codecType;
+    SSBSIP_MFC_DEC_OUTPUT_INFO decOutInfo;
+    unsigned int inframetag;
+    unsigned int outframetagtop;
+    unsigned int outframetagbottom;
+    unsigned int immediatelydisp;
+    unsigned int encodedHeaderSize;
+    int encodedDataSize;
+    unsigned int encodedframeType;
+    struct mfc_frame_buf_arg encodedphyFrmBuf;
+
+    unsigned int dec_crc;
+    unsigned int dec_pixelcache;
+    unsigned int dec_slice;
+    unsigned int dec_numextradpb;
+
+    int input_cookie;
+    int input_secure_id;
+    int input_size;
+
+    /* to support non-blocking mode */
+    unsigned int encode_cnt;
+} _MFCLIB;
+
+#define ENC_PROFILE_LEVEL(profile, level)      ((profile) | ((level) << 8))
+#define ENC_RC_QBOUND(min_qp, max_qp)          ((min_qp) | ((max_qp) << 8))
+
+#endif /* __MFC_INTERFACE_H */
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/Android.mk b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/Android.mk
new file mode 100644
index 0000000..f135163
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/Android.mk
@@ -0,0 +1,34 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_COPY_HEADERS_TO := libsecmm
+LOCAL_COPY_HEADERS := \
+	include/mfc_errno.h \
+	include/mfc_interface.h \
+	include/SsbSipMfcApi.h
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	dec/src/SsbSipMfcDecAPI.c \
+	enc/src/SsbSipMfcEncAPI.c
+
+LOCAL_C_INCLUDES := \
+	$(LOCAL_PATH)/include \
+	$(BOARD_HAL_PATH)/include
+
+LOCAL_MODULE := libsecmfcapi
+
+LOCAL_PRELINK_MODULE := false
+
+ifeq ($(BOARD_USES_MFC_FPS),true)
+LOCAL_CFLAGS := -DCONFIG_MFC_FPS
+endif
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES :=
+LOCAL_SHARED_LIBRARIES := liblog
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/dec/src/SsbSipMfcDecAPI.c b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/dec/src/SsbSipMfcDecAPI.c
new file mode 100644
index 0000000..510a351
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/dec/src/SsbSipMfcDecAPI.c
@@ -0,0 +1,1352 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+#include <sys/poll.h>
+#include "videodev2.h"
+
+#include "mfc_interface.h"
+#include "SsbSipMfcApi.h"
+
+/* #define LOG_NDEBUG 0 */
+#define LOG_TAG "MFC_DEC_APP"
+#include <utils/Log.h>
+
+#ifdef CONFIG_MFC_FPS
+#include <sys/time.h>
+#endif
+
+/*#define CRC_ENABLE
+#define SLICE_MODE_ENABLE */
+#define POLL_DEC_WAIT_TIMEOUT 25
+
+#define USR_DATA_START_CODE (0x000001B2)
+#define VOP_START_CODE      (0x000001B6)
+#define MP4_START_CODE      (0x000001)
+
+#ifdef CONFIG_MFC_FPS
+unsigned int framecount, over30ms;
+struct timeval mTS1, mTS2, mDec1, mDec2;
+#endif
+
+#define DEFAULT_NUMBER_OF_EXTRA_DPB 5
+
+static char *mfc_dev_name = SAMSUNG_MFC_DEV_NAME;
+static int mfc_dev_node = 6;
+
+static void getAByte(char *buff, int *code)
+{
+    int byte;
+
+    *code = (*code << 8);
+    byte = (int)*buff;
+    byte &= 0xFF;
+    *code |= byte;
+}
+
+static int isPBPacked(_MFCLIB *pCtx, int Frameleng)
+{
+    char *strmBuffer = NULL;
+    int startCode = 0xFFFFFFFF;
+    int leng_idx = 1;
+
+    strmBuffer = (char*)pCtx->virStrmBuf;
+
+    while (1) {
+        while (startCode != USR_DATA_START_CODE) {
+            if ((startCode == VOP_START_CODE) || (leng_idx == Frameleng)) {
+                LOGI("[%s] VOP START Found !!.....return",__func__);
+                LOGW("[%s] Non Packed PB",__func__);
+                return 0;
+            }
+            getAByte(strmBuffer, &startCode);
+            LOGV(">> StartCode = 0x%08x <<\n", startCode);
+            strmBuffer++;
+            leng_idx++;
+        }
+        LOGI("[%s] User Data Found !!",__func__);
+
+        do {
+            if (*strmBuffer == 'p') {
+                LOGW("[%s] Packed PB",__func__);
+                return 1;
+            }
+            getAByte(strmBuffer, &startCode);
+            strmBuffer++; leng_idx++;
+        } while ((leng_idx <= Frameleng) && ((startCode >> 8) != MP4_START_CODE));
+
+        if (leng_idx > Frameleng)
+            break;
+    }
+
+    LOGW("[%s] Non Packed PB",__func__);
+
+    return 0;
+}
+
+static void getMFCName(char *devicename, int size)
+{
+    snprintf(devicename, size, "%s%d", SAMSUNG_MFC_DEV_NAME, mfc_dev_node);
+}
+
+void SsbSipMfcDecSetMFCNode(int devicenode)
+{
+    mfc_dev_node = devicenode;
+}
+
+void SsbSipMfcDecSetMFCName(char *devicename)
+{
+    mfc_dev_name = devicename;
+}
+
+void *SsbSipMfcDecOpen(void)
+{
+    int hMFCOpen;
+    _MFCLIB *pCTX;
+
+    char mfc_dev_name[64];
+
+    int ret;
+    unsigned int i, j;
+    struct v4l2_capability cap;
+    struct v4l2_format fmt;
+
+    struct v4l2_requestbuffers reqbuf;
+    struct v4l2_buffer buf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+
+    LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
+#ifdef CONFIG_MFC_FPS
+    framecount = 0;
+    over30ms = 0;
+    gettimeofday(&mTS1, NULL);
+#endif
+    pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
+    if (pCTX == NULL) {
+        LOGE("[%s] malloc failed.",__func__);
+        return NULL;
+    }
+
+    memset(pCTX, 0, sizeof(_MFCLIB));
+
+    getMFCName(mfc_dev_name, 64);
+    LOGI("[%s] dev name is %s",__func__,mfc_dev_name);
+
+    if (access(mfc_dev_name, F_OK) != 0) {
+        LOGE("[%s] MFC device node not exists",__func__);
+        goto error_case1;
+    }
+
+    hMFCOpen = open(mfc_dev_name, O_RDWR|O_NONBLOCK, 0);
+    if (hMFCOpen < 0) {
+        LOGE("[%s] Failed to open MFC device",__func__);
+        goto error_case1;
+    }
+
+    pCTX->hMFC = hMFCOpen;
+
+    memset(&cap, 0, sizeof(cap));
+    ret = ioctl(pCTX->hMFC, VIDIOC_QUERYCAP, &cap);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QUERYCAP failed",__func__);
+        goto error_case2;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
+        LOGE("[%s] Device does not support capture",__func__);
+        goto error_case2;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
+        LOGE("[%s] Device does not support output",__func__);
+        goto error_case2;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
+        LOGE("[%s] Device does not support streaming",__func__);
+        goto error_case2;
+    }
+
+    pCTX->inter_buff_status = MFC_USE_NONE;
+    memset(&fmt, 0, sizeof(fmt));
+    fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264; /* Default is set to H264 */
+    fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    fmt.fmt.pix_mp.plane_fmt[0].sizeimage = MAX_DECODER_INPUT_BUFFER_SIZE;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
+    if (ret != 0) {
+        LOGE("[%s] S_FMT failed",__func__);
+        goto error_case2;
+    }
+
+    pCTX->v4l2_dec.mfc_src_bufs_len = MAX_DECODER_INPUT_BUFFER_SIZE;
+
+    memset(&(reqbuf), 0, sizeof (reqbuf));
+    reqbuf.count = MFC_DEC_NUM_SRC_BUFS;
+    reqbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    reqbuf.memory = V4L2_MEMORY_MMAP;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_REQBUFS failed",__func__);
+        goto error_case2;
+    }
+
+    pCTX->v4l2_dec.mfc_num_src_bufs   = reqbuf.count;
+
+    for (i = 0; i < pCTX->v4l2_dec.mfc_num_src_bufs; ++i) {
+        memset(&(buf), 0, sizeof (buf));
+        buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        buf.memory = V4L2_MEMORY_MMAP;
+        buf.index = i;
+        buf.m.planes = planes;
+        buf.length = 1;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QUERYBUF failed",__func__);
+            goto error_case3;
+        }
+
+        pCTX->v4l2_dec.mfc_src_bufs[i] = mmap(NULL, buf.m.planes[0].length,
+        PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
+        if (pCTX->v4l2_dec.mfc_src_bufs[i] == MAP_FAILED) {
+            LOGE("[%s] mmap failed (%d)",__func__,i);
+            goto error_case3;
+        }
+    }
+    pCTX->inter_buff_status |= MFC_USE_STRM_BUFF;
+
+    /* set extra DPB size to 5 as default for optimal performce (heuristic method) */
+    pCTX->dec_numextradpb = DEFAULT_NUMBER_OF_EXTRA_DPB;
+
+    pCTX->v4l2_dec.bBeingFinalized = 0;
+    pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_NOT_RECEIVED;
+
+    pCTX->cacheablebuffer = NO_CACHE;
+
+    for (i = 0; i<MFC_DEC_NUM_SRC_BUFS; i++)
+        pCTX->v4l2_dec.mfc_src_buf_flags[i] = BUF_DEQUEUED;
+
+    pCTX->v4l2_dec.beingUsedIndex = 0;
+
+    return (void *) pCTX;
+
+error_case3:
+    for (j = 0; j < i; j++)
+        munmap(pCTX->v4l2_dec.mfc_src_bufs[j], pCTX->v4l2_dec.mfc_src_bufs_len);
+
+error_case2:
+    close(pCTX->hMFC);
+
+error_case1:
+    free(pCTX);
+
+    return NULL;
+}
+
+void *SsbSipMfcDecOpenExt(void *value)
+{
+    _MFCLIB *pCTX;
+
+    pCTX = SsbSipMfcDecOpen();
+
+    if (pCTX == NULL)
+        return NULL;
+
+    if (NO_CACHE == (*(SSBIP_MFC_BUFFER_TYPE *)value)) {
+        pCTX->cacheablebuffer = NO_CACHE;
+        LOGI("[%s] non cacheable buffer",__func__);
+    } else {
+        pCTX->cacheablebuffer = CACHE;
+        LOGI("[%s] cacheable buffer",__func__);
+    }
+
+    return (void *)pCTX;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
+{
+    int ret, i;
+    _MFCLIB  *pCTX;
+
+    enum v4l2_buf_type type;
+#ifdef CONFIG_MFC_FPS
+    LOGI(">>> MFC");
+    gettimeofday(&mTS2, NULL);
+    LOGI(">>> time=%d", mTS2.tv_sec-mTS1.tv_sec);
+    LOGI(">>> framecount=%d", framecount);
+    LOGI(">>> 30ms over=%d", over30ms);
+#endif
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    if (pCTX->inter_buff_status & MFC_USE_DST_STREAMON) {
+        type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
+            return MFC_RET_CLOSE_FAIL;
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
+    }
+
+    if (pCTX->inter_buff_status & MFC_USE_SRC_STREAMON) {
+        type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMOFF failed (source buffers)",__func__);
+            return MFC_RET_CLOSE_FAIL;
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_SRC_STREAMON);
+    }
+
+    if (pCTX->inter_buff_status & MFC_USE_STRM_BUFF) {
+        for (i = 0; i < pCTX->v4l2_dec.mfc_num_src_bufs; i++)
+            munmap(pCTX->v4l2_dec.mfc_src_bufs[i], pCTX->v4l2_dec.mfc_src_bufs_len);
+        pCTX->inter_buff_status &= ~(MFC_USE_STRM_BUFF);
+    }
+
+    if (pCTX->inter_buff_status & MFC_USE_YUV_BUFF) {
+        for (i = 0; i < pCTX->v4l2_dec.mfc_num_dst_bufs; i++) {
+            munmap(pCTX->v4l2_dec.mfc_dst_bufs[i][0], pCTX->v4l2_dec.mfc_dst_bufs_len[0]);
+            munmap(pCTX->v4l2_dec.mfc_dst_bufs[i][1], pCTX->v4l2_dec.mfc_dst_bufs_len[1]);
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_YUV_BUFF);
+    }
+
+    close(pCTX->hMFC);
+    free(pCTX);
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE codec_type, int Frameleng)
+{
+    int packedPB = 0;
+    _MFCLIB *pCTX;
+    int ret;
+    unsigned int i, j;
+
+    struct v4l2_requestbuffers reqbuf;
+    struct v4l2_buffer qbuf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+
+    struct v4l2_format fmt;
+    struct v4l2_pix_format_mplane pix_mp;
+    struct v4l2_control ctrl;
+    struct v4l2_crop crop;
+    enum v4l2_buf_type type;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    pCTX->codecType = codec_type;
+
+    if ((pCTX->codecType == MPEG4_DEC) || (pCTX->codecType == XVID_DEC) ||
+    (pCTX->codecType == FIMV1_DEC) || (pCTX->codecType == FIMV2_DEC) ||
+    (pCTX->codecType == FIMV3_DEC) || (pCTX->codecType == FIMV4_DEC))
+        packedPB = isPBPacked(pCTX, Frameleng);
+
+    memset(&fmt, 0, sizeof(fmt));
+
+    switch (pCTX->codecType) {
+    case H264_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
+        break;
+    case MPEG4_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG4;
+        break;
+    case H263_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H263;
+        break;
+    case XVID_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_XVID;
+        break;
+    case MPEG2_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG12;
+        break;
+    case FIMV1_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_FIMV1;
+        fmt.fmt.pix_mp.width =  pCTX->fimv1_res.width;
+        fmt.fmt.pix_mp.height = pCTX->fimv1_res.height;
+        break;
+    case FIMV2_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_FIMV2;
+        break;
+    case FIMV3_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_FIMV3;
+        break;
+    case FIMV4_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_FIMV4;
+        break;
+    case VC1_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VC1;
+        break;
+    case VC1RCV_DEC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VC1_RCV;
+        break;
+    default:
+        LOGE("[%s] Does NOT support the standard (%d)",__func__,pCTX->codecType);
+        ret = MFC_RET_INVALID_PARAM;
+        goto error_case1;
+    }
+
+    fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    fmt.fmt.pix_mp.plane_fmt[0].sizeimage = MAX_DECODER_INPUT_BUFFER_SIZE;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
+    if (ret != 0) {
+        LOGE("[%s] S_FMT failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    memset(&qbuf, 0, sizeof(qbuf));
+
+    qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    qbuf.memory = V4L2_MEMORY_MMAP;
+    qbuf.index = pCTX->v4l2_dec.beingUsedIndex;
+    qbuf.m.planes = planes;
+    qbuf.length = 1;
+    qbuf.m.planes[0].bytesused = Frameleng;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+
+    // Processing the header requires running streamon
+    // on OUTPUT queue
+    ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_STREAMON failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    pCTX->inter_buff_status |= MFC_USE_SRC_STREAMON;
+
+    fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_G_FMT, &fmt);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_G_FMT failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    pix_mp = fmt.fmt.pix_mp;
+    pCTX->decOutInfo.buf_width = pix_mp.plane_fmt[0].bytesperline;
+    pCTX->decOutInfo.buf_height =
+        pix_mp.plane_fmt[0].sizeimage / pix_mp.plane_fmt[0].bytesperline;
+
+    pCTX->decOutInfo.img_width = pix_mp.width;
+    pCTX->decOutInfo.img_height = pix_mp.height;
+
+    memset(&crop, 0, sizeof(crop));
+    crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_G_CROP, &crop);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_G_CROP failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    pCTX->decOutInfo.crop_left_offset = crop.c.left;
+    pCTX->decOutInfo.crop_top_offset = crop.c.top;
+    pCTX->decOutInfo.crop_right_offset =
+        pix_mp.width - crop.c.width - crop.c.left;
+    pCTX->decOutInfo.crop_bottom_offset =
+        pix_mp.height - crop.c.height - crop.c.top;
+
+    memset(&ctrl, 0, sizeof(ctrl));
+    ctrl.id = V4L2_CID_CODEC_REQ_NUM_BUFS;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_G_CTRL failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    pCTX->v4l2_dec.mfc_num_dst_bufs = ctrl.value + pCTX->dec_numextradpb;
+
+    /* Cacheable buffer */
+    ctrl.id = V4L2_CID_CACHEABLE;
+    if(pCTX->cacheablebuffer == NO_CACHE)
+        ctrl.value = 0;
+    else
+        ctrl.value = 1;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    memset(&reqbuf, 0, sizeof(reqbuf));
+    reqbuf.count  = pCTX->v4l2_dec.mfc_num_dst_bufs;
+    reqbuf.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    reqbuf.memory = V4L2_MEMORY_MMAP;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_REQBUFS failed (destination buffers)",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    pCTX->v4l2_dec.mfc_num_dst_bufs  = reqbuf.count;
+
+    for (i = 0;  i < pCTX->v4l2_dec.mfc_num_dst_bufs; ++i) {
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.index = i;
+        qbuf.m.planes = planes;
+        qbuf.length = 2;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &qbuf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QUERYBUF failed (destination buffers)",__func__);
+            ret = MFC_RET_DEC_INIT_FAIL;
+            goto error_case1;
+        }
+
+        pCTX->v4l2_dec.mfc_dst_bufs_len[0] = qbuf.m.planes[0].length;
+        pCTX->v4l2_dec.mfc_dst_bufs_len[1] = qbuf.m.planes[1].length;
+
+        pCTX->v4l2_dec.mfc_dst_phys[i][0] = qbuf.m.planes[0].cookie;
+        pCTX->v4l2_dec.mfc_dst_phys[i][1] = qbuf.m.planes[1].cookie;
+
+        pCTX->v4l2_dec.mfc_dst_bufs[i][0] = mmap(NULL, qbuf.m.planes[0].length,
+             PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, qbuf.m.planes[0].m.mem_offset);
+
+        if (pCTX->v4l2_dec.mfc_dst_bufs[i][0] == MAP_FAILED) {
+            LOGE("[%s] mmap failed (destination buffers (Y))",__func__);
+            ret = MFC_RET_DEC_INIT_FAIL;
+            goto error_case2;
+        }
+
+        pCTX->v4l2_dec.mfc_dst_bufs[i][1] = mmap(NULL, qbuf.m.planes[1].length,
+        PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, qbuf.m.planes[1].m.mem_offset);
+        if (pCTX->v4l2_dec.mfc_dst_bufs[i][1] == MAP_FAILED) {
+            LOGE("[%s] mmap failed (destination buffers (UV))",__func__);
+            ret = MFC_RET_DEC_INIT_FAIL;
+            goto error_case2;
+        }
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+            ret = MFC_RET_DEC_INIT_FAIL;
+            goto error_case2;
+        }
+    }
+    pCTX->inter_buff_status |= MFC_USE_YUV_BUFF;
+
+    type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_STREAMON failed (destination buffers)",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+    pCTX->inter_buff_status |= MFC_USE_DST_STREAMON;
+
+    memset(&qbuf, 0, sizeof(qbuf));
+    qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    qbuf.memory = V4L2_MEMORY_MMAP;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+    if(ret != 0) {
+        LOGE("[%s] VIDIOC_DQBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+        }
+
+    return MFC_RET_OK;
+
+error_case2:
+    for (j = 0; j < i; j++) {
+        munmap(pCTX->v4l2_dec.mfc_dst_bufs[j][0], pCTX->v4l2_dec.mfc_dst_bufs_len[0]);
+        munmap(pCTX->v4l2_dec.mfc_dst_bufs[j][1], pCTX->v4l2_dec.mfc_dst_bufs_len[1]);
+    }
+error_case1:
+    SsbSipMfcDecClose(openHandle);
+    return ret;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
+{
+    _MFCLIB *pCTX;
+    int ret;
+    struct v4l2_buffer qbuf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+
+    struct pollfd poll_events;
+    int poll_state;
+
+#ifdef CONFIG_MFC_FPS
+    framecount++;
+#endif
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
+        LOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+#ifdef CONFIG_MFC_FPS
+    gettimeofday(&mDec1, NULL);
+#endif
+    pCTX  = (_MFCLIB *) openHandle;
+
+    /* note: #define POLLOUT 0x0004 */
+    poll_events.fd = pCTX->hMFC;
+    poll_events.events = POLLOUT | POLLERR;
+    poll_events.revents = 0;
+
+    if ((lengthBufFill > 0) && (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe)) {
+        /* Queue the stream frame */
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.index = pCTX->v4l2_dec.beingUsedIndex;
+        qbuf.m.planes = planes;
+        qbuf.length = 1;
+        qbuf.m.planes[0].bytesused = lengthBufFill;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_DEC_EXE_ERR;
+        }
+
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.m.planes = planes;
+        qbuf.length = 1;
+
+        /* wait for decoding */
+        do {
+            poll_state = poll((struct pollfd*)&poll_events, 1, POLL_DEC_WAIT_TIMEOUT);
+            if (0 < poll_state) {
+                if (poll_events.revents & POLLOUT) { /* POLLOUT */
+                    ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+                    if (ret == 0) {
+                        if (qbuf.flags & V4L2_BUF_FLAG_ERROR)
+                            return MFC_RET_DEC_EXE_ERR;
+                        break;
+                    }
+                } else if (poll_events.revents & POLLERR) { /* POLLERR */
+                    LOGE("[%s] POLLERR\n",__func__);
+                    return MFC_RET_DEC_EXE_ERR;
+                } else {
+                    LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
+                    return MFC_RET_DEC_EXE_ERR;
+                }
+            } else if (0 > poll_state) {
+                return MFC_RET_DEC_EXE_ERR;
+            }
+        } while (0 == poll_state);
+
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.m.planes = planes;
+        qbuf.length = MFC_DEC_NUM_PLANES;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+
+        if (ret != 0) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DECODING_ONLY;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return MFC_RET_OK;
+        } else {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_DECODING;
+        }
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][1];
+
+        if (SSBSIP_MFC_LAST_FRAME_RECEIVED == pCTX->lastframe)
+            pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_PROCESSED;
+
+    } else if(pCTX->v4l2_dec.bBeingFinalized == 0) {
+        pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_PROCESSED;
+
+        /* Queue the stream frame */
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.index = pCTX->v4l2_dec.beingUsedIndex;
+        qbuf.m.planes = planes;
+        qbuf.length = 1;
+        qbuf.m.planes[0].bytesused = 0;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_DEC_EXE_ERR;
+        }
+
+        pCTX->v4l2_dec.bBeingFinalized = 1; /* true */
+
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.m.planes = planes;
+        qbuf.length = MFC_DEC_NUM_PLANES;
+        /* FIXME
+         wait for decoding */
+        do {
+            ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+        } while (ret != 0);
+
+        pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][1];
+    } else {
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.m.planes = planes;
+        qbuf.length = MFC_DEC_NUM_PLANES;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+
+        if (qbuf.m.planes[0].bytesused == 0) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_END;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return MFC_RET_OK;
+        } else {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+        }
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][1];
+    }
+
+    pCTX->decOutInfo.disp_pic_frame_type = (qbuf.flags & (0x7 << 3));
+
+    switch (pCTX->decOutInfo.disp_pic_frame_type) {
+    case V4L2_BUF_FLAG_KEYFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 1;
+        break;
+    case V4L2_BUF_FLAG_PFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 2;
+        break;
+    case V4L2_BUF_FLAG_BFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 3;
+        break;
+    default:
+        pCTX->decOutInfo.disp_pic_frame_type = 0;
+        break;
+    }
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+
+#ifdef CONFIG_MFC_FPS
+    gettimeofday(&mDec2, NULL);
+    if (mDec2.tv_usec-mDec1.tv_usec > 30000) over30ms++;
+#endif
+    return MFC_RET_OK;
+}
+
+#if 0
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
+{
+    _MFCLIB *pCTX;
+    int ret;
+
+    struct v4l2_buffer qbuf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+
+#ifdef CONFIG_MFC_FPS
+    framecount++;
+#endif
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
+        LOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    if ((lengthBufFill > 0) && (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe)) {
+        /* Queue the stream frame */
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.index = pCTX->v4l2_dec.beingUsedIndex;
+        qbuf.m.planes = planes;
+        qbuf.length = 1;
+        qbuf.m.planes[0].bytesused = lengthBufFill;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_DEC_EXE_ERR;
+        }
+    } else if(pCTX->v4l2_dec.bBeingFinalized == 0) {
+        /* Queue the stream frame */
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.index = pCTX->v4l2_dec.beingUsedIndex;
+        qbuf.m.planes = planes;
+        qbuf.length = 1;
+        qbuf.m.planes[0].bytesused = 0;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_DEC_EXE_ERR;
+        }
+    }
+
+    if ((SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe) && (lengthBufFill == 0))
+        pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_RECEIVED;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info)
+{
+    _MFCLIB *pCTX;
+    int ret;
+
+    struct v4l2_buffer qbuf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+
+    struct pollfd poll_events;
+    int poll_state;
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    /* note: #define POLLOUT 0x0004 */
+    poll_events.fd = pCTX->hMFC;
+    poll_events.events = POLLOUT | POLLERR;
+    poll_events.revents = 0;
+
+    if (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe) {
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.m.planes = planes;
+        qbuf.length = 1;
+
+        /* wait for decoding */
+        do {
+            poll_state = poll((struct pollfd*)&poll_events, 1, POLL_DEC_WAIT_TIMEOUT);
+            if (0 < poll_state) {
+                if (poll_events.revents & POLLOUT) { /* POLLOUT */
+                    ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+                    if (ret == 0) {
+                        if (qbuf.flags & V4L2_BUF_FLAG_ERROR)
+                            return MFC_GETOUTBUF_STATUS_NULL;
+                        break;
+                    }
+                } else if (poll_events.revents & POLLERR) { /* POLLERR */
+                    LOGE("[%s] POLLERR\n",__func__);
+                    return MFC_GETOUTBUF_STATUS_NULL;
+                } else {
+                    LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
+                    return MFC_GETOUTBUF_STATUS_NULL;
+                }
+            } else if (0 > poll_state) {
+                return MFC_GETOUTBUF_STATUS_NULL;
+            }
+        } while (0 == poll_state);
+
+        pCTX->v4l2_dec.mfc_src_buf_flags[qbuf.index] = BUF_DEQUEUED;
+
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.m.planes = planes;
+        qbuf.length = MFC_DEC_NUM_PLANES;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+
+        if (ret != 0) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DECODING_ONLY;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return SsbSipMfcDecGetOutBuf(pCTX, output_info);;
+        } else {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_DECODING;
+        }
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][1];
+
+        if (SSBSIP_MFC_LAST_FRAME_RECEIVED == pCTX->lastframe)
+            pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_PROCESSED;
+    } else if (pCTX->v4l2_dec.bBeingFinalized == 0) {
+        pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_PROCESSED;
+
+        pCTX->v4l2_dec.bBeingFinalized = 1; /* true */
+
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.m.planes = planes;
+        qbuf.length = MFC_DEC_NUM_PLANES;
+
+        /* wait for decoding */
+        do {
+            ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+        } while (ret != 0);
+
+        pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][1];
+    } else {
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.m.planes = planes;
+        qbuf.length = MFC_DEC_NUM_PLANES;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+
+        if (qbuf.m.planes[0].bytesused == 0) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_END;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return SsbSipMfcDecGetOutBuf(pCTX, output_info);;
+        } else {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+        }
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[qbuf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[qbuf.index][1];
+    }
+
+    pCTX->decOutInfo.disp_pic_frame_type = (qbuf.flags & (0x7 << 3));
+
+    switch (pCTX->decOutInfo.disp_pic_frame_type) {
+    case V4L2_BUF_FLAG_KEYFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 1;
+        break;
+    case V4L2_BUF_FLAG_PFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 2;
+        break;
+    case V4L2_BUF_FLAG_BFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 3;
+        break;
+    default:
+        pCTX->decOutInfo.disp_pic_frame_type = 0;
+        break;
+    }
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+
+    return SsbSipMfcDecGetOutBuf(pCTX, output_info);
+}
+#endif
+
+void  *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSize)
+{
+    _MFCLIB *pCTX;
+    int i;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return NULL;
+    }
+
+    if ((inputBufferSize < 0) || (inputBufferSize > MAX_DECODER_INPUT_BUFFER_SIZE)) {
+        LOGE("[%s] inputBufferSize = %d is invalid",__func__, inputBufferSize);
+        return NULL;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    for (i = 0; i < MFC_DEC_NUM_SRC_BUFS; i++)
+        if (BUF_DEQUEUED == pCTX->v4l2_dec.mfc_src_buf_flags[i])
+            break;
+
+    if (i == MFC_DEC_NUM_SRC_BUFS) {
+        LOGV("[%s] No buffer is available.",__func__);
+        return NULL;
+    } else {
+        pCTX->virStrmBuf = (unsigned int)pCTX->v4l2_dec.mfc_src_bufs[i];
+        /* Set the buffer flag as Enqueued for NB_mode_process*/
+        /* FIXME: Check this assignment in case of using New API ExeNb() */
+        pCTX->v4l2_dec.mfc_src_buf_flags[i] = BUF_ENQUEUED;
+    }
+
+    return (void *)pCTX->virStrmBuf;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, void *virInBuf, int size)
+{
+    _MFCLIB *pCTX;
+    int i;
+
+    LOGV("[%s] Enter",__func__);
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    for (i = 0; i<MFC_DEC_NUM_SRC_BUFS; i++)
+        if (pCTX->v4l2_dec.mfc_src_bufs[i] == virInBuf)
+            break;
+
+    if (i == MFC_DEC_NUM_SRC_BUFS) {
+        LOGE("[%s] Can not use the buffer",__func__);
+        return MFC_RET_INVALID_PARAM;
+    } else {
+        pCTX->virStrmBuf = (unsigned int)virInBuf;
+        pCTX->v4l2_dec.beingUsedIndex = i;
+        pCTX->v4l2_dec.mfc_src_buf_flags[i] = BUF_ENQUEUED;
+    }
+    LOGV("[%s] Exit idx %d",__func__,pCTX->v4l2_dec.beingUsedIndex);
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info)
+{
+    int ret;
+    _MFCLIB *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_GETOUTBUF_DISPLAY_END;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    output_info->YPhyAddr = pCTX->decOutInfo.YPhyAddr;
+    output_info->CPhyAddr = pCTX->decOutInfo.CPhyAddr;
+
+    output_info->YVirAddr = pCTX->decOutInfo.YVirAddr;
+    output_info->CVirAddr = pCTX->decOutInfo.CVirAddr;
+
+    output_info->img_width = pCTX->decOutInfo.img_width;
+    output_info->img_height= pCTX->decOutInfo.img_height;
+
+    output_info->buf_width = pCTX->decOutInfo.buf_width;
+    output_info->buf_height= pCTX->decOutInfo.buf_height;
+
+    output_info->crop_right_offset =  pCTX->decOutInfo.crop_right_offset;
+    output_info->crop_left_offset =  pCTX->decOutInfo.crop_left_offset;
+    output_info->crop_bottom_offset = pCTX->decOutInfo.crop_bottom_offset;
+    output_info->crop_top_offset = pCTX->decOutInfo.crop_top_offset;
+
+    output_info->disp_pic_frame_type = pCTX->decOutInfo.disp_pic_frame_type;
+
+    switch (pCTX->displayStatus) {
+    case MFC_GETOUTBUF_DISPLAY_ONLY:
+    case MFC_GETOUTBUF_DISPLAY_DECODING:
+    case MFC_GETOUTBUF_DISPLAY_END:
+#ifdef SSB_UMP
+        ret = ump_secure_id_get_from_vaddr(pCTX->decOutInfo.YVirAddr, &output_info->y_cookie);
+        if (ret) {
+            LOGV("[%s] fail to get secure id(%d) from vaddr(%x)\n",__func__, \
+            output_info->y_cookie, pCTX->decOutInfo.YVirAddr);
+        }
+
+        ret = ump_secure_id_get_from_vaddr(pCTX->decOutInfo.CVirAddr, &output_info->c_cookie);
+        if (ret) {
+            LOGV("[%s] fail to get secure id(%d) from vaddr(%x)\n",__func__, \
+            output_info->c_cookie, pCTX->decOutInfo.CVirAddr);
+        }
+        break;
+#endif
+    case MFC_GETOUTBUF_DECODING_ONLY:
+    case MFC_GETOUTBUF_CHANGE_RESOL:
+        break;
+    default:
+        return MFC_GETOUTBUF_DISPLAY_END;
+    }
+
+    return pCTX->displayStatus;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value)
+{
+    int ret, i;
+
+    _MFCLIB *pCTX;
+    struct mfc_dec_fimv1_info *fimv1_res;
+
+    struct v4l2_buffer qbuf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+    struct v4l2_control ctrl;
+
+    enum v4l2_buf_type type;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if ((value == NULL) && (MFC_DEC_SETCONF_IS_LAST_FRAME !=conf_type)) {
+        LOGE("[%s] value is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    /* First, process non-ioctl calling settings */
+    switch (conf_type) {
+    case MFC_DEC_SETCONF_EXTRA_BUFFER_NUM:
+        pCTX->dec_numextradpb = *((unsigned int *) value);
+        return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT: /* be set before calling SsbSipMfcDecInit */
+         fimv1_res = (struct mfc_dec_fimv1_info *)value;
+         LOGI("fimv1->width  = %d\n", fimv1_res->width);
+         LOGI("fimv1->height = %d\n", fimv1_res->height);
+         pCTX->fimv1_res.width  = (int)(fimv1_res->width);
+         pCTX->fimv1_res.height = (int)(fimv1_res->height);
+         return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_IS_LAST_FRAME:
+        if (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe) {
+            pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_RECEIVED;
+            return MFC_RET_OK;
+        } else {
+            return MFC_RET_FAIL;
+        }
+
+    case MFC_DEC_SETCONF_DPB_FLUSH:
+        type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
+            return MFC_RET_DEC_SET_CONF_FAIL;
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
+
+        for (i = 0;  i < pCTX->v4l2_dec.mfc_num_dst_bufs; ++i) {
+            memset(&qbuf, 0, sizeof(qbuf));
+
+            qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+            qbuf.memory = V4L2_MEMORY_MMAP;
+            qbuf.index = i;
+            qbuf.m.planes = planes;
+            qbuf.length = 2;
+
+            ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+            if (ret != 0) {
+                LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+                return MFC_RET_DEC_SET_CONF_FAIL;
+            }
+        }
+
+        type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMON failed (destination buffers)",__func__);
+            return MFC_RET_DEC_SET_CONF_FAIL;
+        }
+        pCTX->inter_buff_status |= MFC_USE_DST_STREAMON;
+        return MFC_RET_OK;
+    default:
+        /* Others will be processed next */
+        break;
+    }
+
+    /* Process ioctl calling settings */
+    memset(&ctrl, 0, sizeof(ctrl));
+    switch (conf_type) {
+    case MFC_DEC_SETCONF_DISPLAY_DELAY: /* be set before calling SsbSipMfcDecInit */
+        ctrl.id = V4L2_CID_CODEC_DISPLAY_DELAY;
+        ctrl.value = *((unsigned int *) value);
+        break;
+
+    case MFC_DEC_SETCONF_CRC_ENABLE:
+        ctrl.id = V4L2_CID_CODEC_CRC_ENABLE;
+        ctrl.value = 1;
+        break;
+
+    case MFC_DEC_SETCONF_SLICE_ENABLE:
+        ctrl.id = V4L2_CID_CODEC_SLICE_INTERFACE;
+        ctrl.value = 1;
+        break;
+
+    case MFC_DEC_SETCONF_FRAME_TAG: /*be set before calling SsbSipMfcDecExe */
+        ctrl.id = V4L2_CID_CODEC_FRAME_TAG;
+        ctrl.value = *((unsigned int*)value);
+        break;
+
+    case MFC_DEC_SETCONF_POST_ENABLE:
+        ctrl.id = V4L2_CID_CODEC_LOOP_FILTER_MPEG4_ENABLE;
+        ctrl.value = *((unsigned int*)value);
+        break;
+
+    default:
+        LOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_S_CTRL failed (conf_type = %d)",__func__, conf_type);
+        return MFC_RET_DEC_SET_CONF_FAIL;
+    }
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value)
+{
+    _MFCLIB *pCTX;
+
+    SSBSIP_MFC_IMG_RESOLUTION *img_resolution;
+    int ret;
+    SSBSIP_MFC_CRC_DATA *crc_data;
+    SSBSIP_MFC_CROP_INFORMATION *crop_information;
+    struct v4l2_control ctrl;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if (value == NULL) {
+        LOGE("[%s] value is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    switch (conf_type) {
+    case MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT:
+        img_resolution = (SSBSIP_MFC_IMG_RESOLUTION *)value;
+        img_resolution->width = pCTX->decOutInfo.img_width;
+        img_resolution->height = pCTX->decOutInfo.img_height;
+        img_resolution->buf_width = pCTX->decOutInfo.buf_width;
+        img_resolution->buf_height = pCTX->decOutInfo.buf_height;
+        break;
+
+    case MFC_DEC_GETCONF_CRC_DATA:
+        crc_data = (SSBSIP_MFC_CRC_DATA *) value;
+
+        ctrl.id = V4L2_CID_CODEC_CRC_DATA_LUMA;
+        ctrl.value = 0;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_LUMA",__func__);
+            return MFC_RET_DEC_GET_CONF_FAIL;
+        }
+        crc_data->luma0 = ctrl.value;
+
+        ctrl.id = V4L2_CID_CODEC_CRC_DATA_CHROMA;
+        ctrl.value = 0;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_CHROMA",__func__);
+            return MFC_RET_DEC_GET_CONF_FAIL;
+        }
+        crc_data->chroma0 = ctrl.value;
+
+        LOGI("[%s] crc_data->luma0=%d",__func__,ctrl.value);
+        LOGI("[%s] crc_data->chroma0=%d",__func__,ctrl.value);
+        break;
+
+    case MFC_DEC_GETCONF_FRAME_TAG:
+        ctrl.id = V4L2_CID_CODEC_FRAME_TAG;
+        ctrl.value = 0;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
+        if (ret != 0) {
+            printf("Error to do g_ctrl.\n");
+        }
+        *((unsigned int *)value) = ctrl.value;
+        break;
+
+    case MFC_DEC_GETCONF_CROP_INFO:
+        crop_information = (SSBSIP_MFC_CROP_INFORMATION *)value;
+        crop_information->crop_top_offset = pCTX->decOutInfo.crop_top_offset;
+        crop_information->crop_bottom_offset = pCTX->decOutInfo.crop_bottom_offset;
+        crop_information->crop_left_offset = pCTX->decOutInfo.crop_left_offset;
+        crop_information->crop_right_offset = pCTX->decOutInfo.crop_right_offset;
+        break;
+
+    default:
+        LOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    return MFC_RET_OK;
+}
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/enc/src/SsbSipMfcEncAPI.c b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/enc/src/SsbSipMfcEncAPI.c
new file mode 100644
index 0000000..45888c6
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/enc/src/SsbSipMfcEncAPI.c
@@ -0,0 +1,1206 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+#include <sys/poll.h>
+#include "videodev2.h"
+
+#include "mfc_interface.h"
+#include "SsbSipMfcApi.h"
+
+/* #define LOG_NDEBUG 0 */
+#define LOG_TAG "MFC_ENC_APP"
+#include <utils/Log.h>
+
+#define POLL_ENC_WAIT_TIMEOUT 25
+
+#ifndef true
+#define true  (1)
+#endif
+
+#ifndef false
+#define false (0)
+#endif
+
+#define MAX_STREAM_SIZE (2*1024*1024)
+
+static char *mfc_dev_name = SAMSUNG_MFC_DEV_NAME;
+static int mfc_dev_node = 7;
+
+static void getMFCName(char *devicename, int size)
+{
+    snprintf(devicename, size, "%s%d", SAMSUNG_MFC_DEV_NAME, mfc_dev_node);
+}
+
+void SsbSipMfcEncSetMFCName(char *devicename)
+{
+    mfc_dev_name = devicename;
+}
+
+void *SsbSipMfcEncOpen(void)
+{
+    int hMFCOpen;
+    _MFCLIB *pCTX;
+
+    char mfc_dev_name[64];
+
+    int ret;
+    struct v4l2_capability cap;
+
+    getMFCName(mfc_dev_name, 64);
+    LOGI("[%s] dev name is %s\n",__func__,mfc_dev_name);
+
+    if (access(mfc_dev_name, F_OK) != 0) {
+        LOGE("[%s] MFC device node not exists",__func__);
+        return NULL;
+    }
+
+    hMFCOpen = open(mfc_dev_name, O_RDWR | O_NONBLOCK, 0);
+    if (hMFCOpen < 0) {
+        LOGE("[%s] Failed to open MFC device",__func__);
+        return NULL;
+    }
+
+    pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
+    if (pCTX == NULL) {
+        LOGE("[%s] malloc failed.",__func__);
+        return NULL;
+    }
+    memset(pCTX, 0, sizeof(_MFCLIB));
+
+    pCTX->hMFC = hMFCOpen;
+
+    memset(&cap, 0, sizeof(cap));
+    ret = ioctl(pCTX->hMFC, VIDIOC_QUERYCAP, &cap);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QUERYCAP failed",__func__);
+        close(pCTX->hMFC);
+        free(pCTX);
+        return NULL;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
+        LOGE("[%s] Device does not support capture",__func__);
+        close(pCTX->hMFC);
+        free(pCTX);
+        return NULL;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
+        LOGE("[%s] Device does not support output",__func__);
+        close(pCTX->hMFC);
+        free(pCTX);
+        return NULL;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
+        LOGE("[%s] Device does not support streaming",__func__);
+        close(pCTX->hMFC);
+        free(pCTX);
+        return NULL;
+    }
+
+    pCTX->v4l2_enc.bRunning = 0;
+    /* physical address is used for Input source */
+    pCTX->v4l2_enc.bInputPhyVir = 1;
+
+    pCTX->cacheablebuffer = NO_CACHE;
+
+    return (void *)pCTX;
+}
+
+void *SsbSipMfcEncOpenExt(void *value)
+{
+    _MFCLIB *pCTX;
+
+    pCTX = SsbSipMfcEncOpen();
+    if (pCTX == NULL)
+        return NULL;
+
+    if (NO_CACHE == (*(SSBIP_MFC_BUFFER_TYPE *)value)) {
+        pCTX->cacheablebuffer = NO_CACHE;
+        /* physical address is used for Input source */
+        pCTX->v4l2_enc.bInputPhyVir = 1;
+        LOGI("[%s] non cacheable buffer",__func__);
+    }
+    else {
+        pCTX->cacheablebuffer = CACHE;
+        /* vitual address is used for Input source */
+        pCTX->v4l2_enc.bInputPhyVir = 0;
+        LOGI("[%s] cacheable buffer",__func__);
+    }
+
+    return (void *)pCTX;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
+{
+    _MFCLIB *pCTX;
+    int i;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    if (!pCTX->v4l2_enc.bInputPhyVir) {
+        for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++) {
+            munmap(pCTX->v4l2_enc.mfc_src_bufs[i][0], pCTX->v4l2_enc.mfc_src_bufs_len[0]);
+            munmap(pCTX->v4l2_enc.mfc_src_bufs[i][1], pCTX->v4l2_enc.mfc_src_bufs_len[1]);
+        }
+    }
+
+    for (i = 0; i < pCTX->v4l2_enc.mfc_num_dst_bufs; i++)
+        munmap(pCTX->v4l2_enc.mfc_dst_bufs[i], pCTX->v4l2_enc.mfc_dst_bufs_len);
+
+    pCTX->inter_buff_status = MFC_USE_NONE;
+
+    close(pCTX->hMFC);
+
+    free(pCTX);
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
+{
+    int ret, i, j,index;
+    _MFCLIB *pCTX;
+
+    enum v4l2_buf_type type;
+    struct v4l2_format fmt;
+    struct v4l2_plane planes[MFC_ENC_NUM_PLANES];
+
+    struct v4l2_buffer buf;
+    struct v4l2_requestbuffers reqbuf;
+
+    struct v4l2_control ctrl;
+
+    struct pollfd poll_events;
+    int poll_state;
+
+    struct v4l2_ext_control ext_ctrl_mpeg4[27];
+    struct v4l2_ext_control ext_ctrl_h263[19];
+    struct v4l2_ext_control ext_ctrl[44];
+    struct v4l2_ext_controls ext_ctrls;
+
+    SSBSIP_MFC_ENC_H264_PARAM *h264_arg;
+    SSBSIP_MFC_ENC_MPEG4_PARAM *mpeg4_arg;
+    SSBSIP_MFC_ENC_H263_PARAM *h263_arg;
+
+    if (openHandle == NULL) {
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    mpeg4_arg = (SSBSIP_MFC_ENC_MPEG4_PARAM*)param;
+    if (mpeg4_arg->codecType == MPEG4_ENC) {
+        pCTX->codecType= MPEG4_ENC;
+        pCTX->width = mpeg4_arg->SourceWidth;
+        pCTX->height = mpeg4_arg->SourceHeight;
+        pCTX->framemap = mpeg4_arg->FrameMap;
+    } else {
+        h263_arg = (SSBSIP_MFC_ENC_H263_PARAM*)param;
+        if (h263_arg->codecType == H263_ENC) {
+            pCTX->codecType = H263_ENC;
+            pCTX->width = h263_arg->SourceWidth;
+            pCTX->height = h263_arg->SourceHeight;
+            pCTX->framemap = h263_arg->FrameMap;
+        } else {
+            h264_arg = (SSBSIP_MFC_ENC_H264_PARAM*)param;
+            if (h264_arg->codecType == H264_ENC) {
+                pCTX->codecType = H264_ENC;
+                pCTX->width = h264_arg->SourceWidth;
+                pCTX->height = h264_arg->SourceHeight;
+                pCTX->framemap = h264_arg->FrameMap;
+            } else {
+                LOGE("[%s] Undefined codec type \n",__func__);
+                ret = MFC_RET_INVALID_PARAM;
+                goto error_case1;
+            }
+        }
+    }
+
+    switch (pCTX->codecType) {
+    case MPEG4_ENC:
+        ext_ctrl_mpeg4[0].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_PROFILE;
+        ext_ctrl_mpeg4[0].value = mpeg4_arg->ProfileIDC;
+        ext_ctrl_mpeg4[1].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_LEVEL;
+        ext_ctrl_mpeg4[1].value = mpeg4_arg->LevelIDC;
+        ext_ctrl_mpeg4[2].id = V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE;
+        ext_ctrl_mpeg4[2].value = mpeg4_arg->IDRPeriod;
+        ext_ctrl_mpeg4[3].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_QUARTER_PIXEL;
+        ext_ctrl_mpeg4[3].value = mpeg4_arg->DisableQpelME;
+
+        ext_ctrl_mpeg4[4].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MODE;
+        ext_ctrl_mpeg4[4].value = mpeg4_arg->SliceMode; /* 0: one, 1: fixed #mb, 3: fixed #bytes */
+        if (mpeg4_arg->SliceMode == 0) {
+            ext_ctrl_mpeg4[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl_mpeg4[5].value = 1;  /* default */
+            ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl_mpeg4[6].value = 1900; /* default */
+        } else if (mpeg4_arg->SliceMode == 1) {
+            ext_ctrl_mpeg4[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl_mpeg4[5].value = mpeg4_arg->SliceArgument;
+            ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl_mpeg4[6].value = 1900; /* default */
+        } else if (mpeg4_arg->SliceMode == 3) {
+            ext_ctrl_mpeg4[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl_mpeg4[5].value = 1; /* default */
+            ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl_mpeg4[6].value = mpeg4_arg->SliceArgument;
+        }
+        /*
+        It should be set using mpeg4_arg->NumberBFrames after being handled by appl.
+         */
+        ext_ctrl_mpeg4[7].id =  V4L2_CID_CODEC_MFC5X_ENC_MPEG4_B_FRAMES;
+        ext_ctrl_mpeg4[7].value = mpeg4_arg->NumberBFrames;
+        ext_ctrl_mpeg4[8].id = V4L2_CID_CODEC_MFC5X_ENC_INTRA_REFRESH_MB;
+        ext_ctrl_mpeg4[8].value = mpeg4_arg->RandomIntraMBRefresh;
+
+        ext_ctrl_mpeg4[9].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CTRL_ENABLE;
+        ext_ctrl_mpeg4[9].value = mpeg4_arg->PadControlOn;
+        ext_ctrl_mpeg4[10].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_LUMA_VALUE;
+        ext_ctrl_mpeg4[10].value = mpeg4_arg->LumaPadVal;
+        ext_ctrl_mpeg4[11].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CB_VALUE;
+        ext_ctrl_mpeg4[11].value = mpeg4_arg->CbPadVal;
+        ext_ctrl_mpeg4[12].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CR_VALUE;
+        ext_ctrl_mpeg4[12].value = mpeg4_arg->CrPadVal;
+
+        ext_ctrl_mpeg4[13].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FRAME_ENABLE;
+        ext_ctrl_mpeg4[13].value = mpeg4_arg->EnableFRMRateControl;
+        ext_ctrl_mpeg4[14].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_VOP_TIME_RES;
+        ext_ctrl_mpeg4[14].value = mpeg4_arg->TimeIncreamentRes;
+        ext_ctrl_mpeg4[15].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_VOP_FRM_DELTA;
+        ext_ctrl_mpeg4[15].value = mpeg4_arg->VopTimeIncreament;
+        ext_ctrl_mpeg4[16].id = V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE;
+        ext_ctrl_mpeg4[16].value = mpeg4_arg->Bitrate;
+
+        ext_ctrl_mpeg4[17].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_FRAME_QP;
+        ext_ctrl_mpeg4[17].value = mpeg4_arg->FrameQp;
+        ext_ctrl_mpeg4[18].id =  V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_P_FRAME_QP;
+        ext_ctrl_mpeg4[18].value = mpeg4_arg->FrameQp_P;
+        ext_ctrl_mpeg4[19].id =  V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_B_FRAME_QP;
+        ext_ctrl_mpeg4[19].value = mpeg4_arg->FrameQp_B;
+
+        ext_ctrl_mpeg4[20].id =  V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MAX_QP;
+        ext_ctrl_mpeg4[20].value = mpeg4_arg->QSCodeMax;
+        ext_ctrl_mpeg4[21].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MIN_QP;
+        ext_ctrl_mpeg4[21].value = mpeg4_arg->QSCodeMin;
+        ext_ctrl_mpeg4[22].id = V4L2_CID_CODEC_MFC5X_ENC_RC_REACTION_COEFF;
+        ext_ctrl_mpeg4[22].value = mpeg4_arg->CBRPeriodRf;
+
+        if (V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL == pCTX->enc_frameskip) {
+            ext_ctrl_mpeg4[23].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_mpeg4[23].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL;
+        } else if(V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE == pCTX->enc_frameskip) {
+            ext_ctrl_mpeg4[23].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_mpeg4[23].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE;
+        } else { /* ENC_FRAME_SKIP_MODE_DISABLE (default) */
+            ext_ctrl_mpeg4[23].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_mpeg4[23].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_DISABLE;
+        }
+
+        ext_ctrl_mpeg4[24].id = V4L2_CID_CODEC_MFC5X_ENC_VBV_BUF_SIZE;
+        ext_ctrl_mpeg4[24].value = 0;
+
+        ext_ctrl_mpeg4[25].id = V4L2_CID_CODEC_MFC5X_ENC_SEQ_HDR_MODE;
+        ext_ctrl_mpeg4[25].value = 0;
+
+        ext_ctrl_mpeg4[26].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT;
+        ext_ctrl_mpeg4[26].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
+        break;
+
+    case H263_ENC:
+        ext_ctrl_h263[0].id = V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE;
+        ext_ctrl_h263[0].value = h263_arg->IDRPeriod;
+
+        ext_ctrl_h263[1].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MODE;
+        ext_ctrl_h263[1].value = h263_arg->SliceMode; /* 0: one, Check is needed if h264 support multi-slice */
+
+        ext_ctrl_h263[2].id = V4L2_CID_CODEC_MFC5X_ENC_INTRA_REFRESH_MB;
+        ext_ctrl_h263[2].value = h263_arg->RandomIntraMBRefresh;
+
+        ext_ctrl_h263[3].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CTRL_ENABLE;
+        ext_ctrl_h263[3].value = h263_arg->PadControlOn;
+        ext_ctrl_h263[4].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_LUMA_VALUE;
+        ext_ctrl_h263[4].value = h263_arg->LumaPadVal;
+        ext_ctrl_h263[5].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CB_VALUE;
+        ext_ctrl_h263[5].value = h263_arg->CbPadVal;
+        ext_ctrl_h263[6].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CR_VALUE;
+        ext_ctrl_h263[6].value = h263_arg->CrPadVal;
+
+        ext_ctrl_h263[7].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FRAME_ENABLE;
+        ext_ctrl_h263[7].value = h263_arg->EnableFRMRateControl;
+
+        ext_ctrl_h263[8].id = V4L2_CID_CODEC_MFC5X_ENC_H263_RC_FRAME_RATE;
+        ext_ctrl_h263[8].value = h263_arg->FrameRate;
+
+        ext_ctrl_h263[9].id = V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE;
+        ext_ctrl_h263[9].value = h263_arg->Bitrate;
+
+        ext_ctrl_h263[10].id = V4L2_CID_CODEC_MFC5X_ENC_H263_RC_FRAME_QP;
+        ext_ctrl_h263[10].value = h263_arg->FrameQp;
+        ext_ctrl_h263[11].id =  V4L2_CID_CODEC_MFC5X_ENC_H263_RC_P_FRAME_QP;
+        ext_ctrl_h263[11].value = h263_arg->FrameQp_P;
+
+        ext_ctrl_h263[12].id =  V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MAX_QP;
+        ext_ctrl_h263[12].value = h263_arg->QSCodeMax;
+        ext_ctrl_h263[13].id = V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MIN_QP;
+        ext_ctrl_h263[13].value = h263_arg->QSCodeMin;
+        ext_ctrl_h263[14].id = V4L2_CID_CODEC_MFC5X_ENC_RC_REACTION_COEFF;
+        ext_ctrl_h263[14].value = h263_arg->CBRPeriodRf;
+
+        if (V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL == pCTX->enc_frameskip) {
+            ext_ctrl_h263[15].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_h263[15].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL;
+        } else if(V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE== pCTX->enc_frameskip) {
+            ext_ctrl_h263[15].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_h263[15].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE;
+        } else { /* ENC_FRAME_SKIP_MODE_DISABLE (default) */
+            ext_ctrl_h263[15].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_h263[15].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_DISABLE;
+        }
+
+        ext_ctrl_h263[16].id = V4L2_CID_CODEC_MFC5X_ENC_VBV_BUF_SIZE;
+        ext_ctrl_h263[16].value = 0;
+
+        ext_ctrl_h263[17].id = V4L2_CID_CODEC_MFC5X_ENC_SEQ_HDR_MODE;
+        ext_ctrl_h263[17].value = 0;
+
+        ext_ctrl_h263[18].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT;
+        ext_ctrl_h263[18].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
+        break;
+
+    case H264_ENC:
+        ext_ctrl[0].id = V4L2_CID_CODEC_MFC5X_ENC_H264_PROFILE;
+        ext_ctrl[0].value = h264_arg->ProfileIDC;
+        ext_ctrl[1].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LEVEL;
+        ext_ctrl[1].value = h264_arg->LevelIDC;
+        ext_ctrl[2].id = V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE;
+        ext_ctrl[2].value = h264_arg->IDRPeriod;
+        ext_ctrl[3].id = V4L2_CID_CODEC_MFC5X_ENC_H264_MAX_REF_PIC;
+        ext_ctrl[3].value = h264_arg->NumberReferenceFrames;
+        ext_ctrl[4].id = V4L2_CID_CODEC_MFC5X_ENC_H264_NUM_REF_PIC_4P;
+        ext_ctrl[4].value = h264_arg->NumberRefForPframes;
+        ext_ctrl[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MODE;
+        ext_ctrl[5].value = h264_arg->SliceMode;  /* 0: one, 1: fixed #mb, 3: fixed #bytes */
+        if (h264_arg->SliceMode == 0) {
+            ext_ctrl[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl[6].value = 1;  /* default */
+            ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl[7].value = 1900; /* default */
+        } else if (h264_arg->SliceMode == 1) {
+            ext_ctrl[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl[6].value = h264_arg->SliceArgument;
+            ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl[7].value = 1900; /* default */
+        } else if (h264_arg->SliceMode == 3) {
+            ext_ctrl[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl[6].value = 1; /* default */
+            ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl[7].value = h264_arg->SliceArgument;
+        }
+        /*
+        It should be set using h264_arg->NumberBFrames after being handled by appl.
+         */
+        ext_ctrl[8].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_B_FRAMES;
+        ext_ctrl[8].value = h264_arg->NumberBFrames;
+        ext_ctrl[9].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_MODE;
+        ext_ctrl[9].value = h264_arg->LoopFilterDisable;
+        ext_ctrl[10].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_ALPHA;
+        ext_ctrl[10].value = h264_arg->LoopFilterAlphaC0Offset;
+        ext_ctrl[11].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_BETA;
+        ext_ctrl[11].value = h264_arg->LoopFilterBetaOffset;
+        ext_ctrl[12].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ENTROPY_MODE;
+        ext_ctrl[12].value = h264_arg->SymbolMode;
+        ext_ctrl[13].id = V4L2_CID_CODEC_MFC5X_ENC_H264_INTERLACE;
+        ext_ctrl[13].value = h264_arg->PictureInterlace;
+        ext_ctrl[14].id = V4L2_CID_CODEC_MFC5X_ENC_H264_8X8_TRANSFORM;
+        ext_ctrl[14].value = h264_arg->Transform8x8Mode;
+        ext_ctrl[15].id = V4L2_CID_CODEC_MFC5X_ENC_INTRA_REFRESH_MB;
+        ext_ctrl[15].value = h264_arg->RandomIntraMBRefresh;
+        ext_ctrl[16].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CTRL_ENABLE;
+        ext_ctrl[16].value = h264_arg->PadControlOn;
+        ext_ctrl[17].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_LUMA_VALUE;
+        ext_ctrl[17].value = h264_arg->LumaPadVal;
+        ext_ctrl[18].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CB_VALUE;
+        ext_ctrl[18].value = h264_arg->CbPadVal;
+        ext_ctrl[19].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CR_VALUE;
+        ext_ctrl[19].value = h264_arg->CrPadVal;
+        ext_ctrl[20].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FRAME_ENABLE;
+        ext_ctrl[20].value = h264_arg->EnableFRMRateControl;
+        ext_ctrl[21].id = V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_ENABLE;
+        ext_ctrl[21].value = h264_arg->EnableMBRateControl;
+        ext_ctrl[22].id = V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_RATE;
+        ext_ctrl[22].value = h264_arg->FrameRate;
+        ext_ctrl[23].id = V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE;
+        /* FIXME temporary fix */
+        if (h264_arg->Bitrate)
+            ext_ctrl[23].value = h264_arg->Bitrate;
+        else
+            ext_ctrl[23].value = 1; /* just for testing Movi studio */
+        ext_ctrl[24].id = V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_QP;
+        ext_ctrl[24].value = h264_arg->FrameQp;
+        ext_ctrl[25].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_P_FRAME_QP;
+        ext_ctrl[25].value = h264_arg->FrameQp_P;
+        ext_ctrl[26].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_B_FRAME_QP;
+        ext_ctrl[26].value = h264_arg->FrameQp_B;
+        ext_ctrl[27].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MAX_QP;
+        ext_ctrl[27].value = h264_arg->QSCodeMax;
+        ext_ctrl[28].id = V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MIN_QP;
+        ext_ctrl[28].value = h264_arg->QSCodeMin;
+        ext_ctrl[29].id = V4L2_CID_CODEC_MFC5X_ENC_RC_REACTION_COEFF;
+        ext_ctrl[29].value = h264_arg->CBRPeriodRf;
+        ext_ctrl[30].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_DARK;
+        ext_ctrl[30].value = h264_arg->DarkDisable;
+        ext_ctrl[31].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_SMOOTH;
+        ext_ctrl[31].value = h264_arg->SmoothDisable;
+        ext_ctrl[32].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_STATIC;
+        ext_ctrl[32].value = h264_arg->StaticDisable;
+        ext_ctrl[33].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_ACTIVITY;
+        ext_ctrl[33].value = h264_arg->ActivityDisable;
+
+        /* doesn't have to be set */
+        ext_ctrl[34].id = V4L2_CID_CODEC_MFC5X_ENC_H264_OPEN_GOP;
+        ext_ctrl[34].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
+        ext_ctrl[35].id = V4L2_CID_CODEC_MFC5X_ENC_H264_I_PERIOD;
+        ext_ctrl[35].value = 10;
+
+        if (V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL == pCTX->enc_frameskip) {
+            ext_ctrl[36].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl[36].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL;
+        } else if(V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE== pCTX->enc_frameskip) {
+            ext_ctrl[36].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl[36].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE;
+        } else { /* ENC_FRAME_SKIP_MODE_DISABLE (default) */
+            ext_ctrl[36].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl[36].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_DISABLE;
+        }
+
+        ext_ctrl[37].id = V4L2_CID_CODEC_MFC5X_ENC_VBV_BUF_SIZE;
+        ext_ctrl[37].value = 0;
+
+        ext_ctrl[38].id = V4L2_CID_CODEC_MFC5X_ENC_SEQ_HDR_MODE;
+        ext_ctrl[38].value = 0; /* 0: seperated header
+                                              1: header + first frame */
+
+        ext_ctrl[39].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT;
+        ext_ctrl[39].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
+
+        ext_ctrl[40].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_ENABLE;
+        ext_ctrl[40].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
+        ext_ctrl[41].id = V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_IDC;
+        ext_ctrl[41].value = 0;
+        ext_ctrl[42].id = V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_WIDTH;
+        ext_ctrl[42].value = 0;
+        ext_ctrl[43].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_HEIGHT;
+        ext_ctrl[43].value = 0;
+
+        break;
+
+    default:
+        LOGE("[%s] Undefined codec type",__func__);
+        ret = MFC_RET_INVALID_PARAM;
+        goto error_case1;
+    }
+
+    ext_ctrls.ctrl_class = V4L2_CTRL_CLASS_CODEC;
+    if (pCTX->codecType == MPEG4_ENC) {
+        ext_ctrls.count = 27;
+        ext_ctrls.controls = ext_ctrl_mpeg4;
+    } else if (pCTX->codecType == H264_ENC) {
+        ext_ctrls.count = 44;
+        ext_ctrls.controls = ext_ctrl;
+    } else if (pCTX->codecType == H263_ENC) {
+        ext_ctrls.count = 19;
+        ext_ctrls.controls = ext_ctrl_h263;
+    }
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_EXT_CTRLS, &ext_ctrls);
+    if (ret != 0) {
+        LOGE("[%s] Failed to set extended controls",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    memset(&fmt, 0, sizeof(fmt));
+    fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+
+    fmt.fmt.pix_mp.width = pCTX->width;
+    fmt.fmt.pix_mp.height = pCTX->height;
+    fmt.fmt.pix_mp.num_planes = 2;
+    fmt.fmt.pix_mp.plane_fmt[0].bytesperline = Align(fmt.fmt.pix_mp.width, 128);
+    fmt.fmt.pix_mp.plane_fmt[1].bytesperline = Align(fmt.fmt.pix_mp.width, 128);
+
+    if (NV12_TILE == pCTX->framemap) {
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT; /* 4:2:0, 2 Planes, 64x32 Tiles */
+        fmt.fmt.pix_mp.plane_fmt[0].sizeimage =
+            Align(Align(fmt.fmt.pix_mp.width, 128) * Align(fmt.fmt.pix_mp.height, 32), 8192); /* tiled mode */
+        fmt.fmt.pix_mp.plane_fmt[1].sizeimage =
+            Align(Align(fmt.fmt.pix_mp.width, 128) * Align(fmt.fmt.pix_mp.height >> 1, 32), 8192); /* tiled mode */
+    } else { /* NV12_LINEAR (default) */
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M; /* 4:2:0, 2 Planes, linear */
+        fmt.fmt.pix_mp.plane_fmt[0].sizeimage =
+            Align((fmt.fmt.pix_mp.width * fmt.fmt.pix_mp.height), 2048); /* linear mode, 2K align */
+        fmt.fmt.pix_mp.plane_fmt[1].sizeimage =
+            Align((fmt.fmt.pix_mp.width * (fmt.fmt.pix_mp.height >> 1)), 2048); /* linear mode, 2K align */
+    }
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
+    if (ret != 0) {
+        LOGE("[%s] S_FMT failed on MFC output stream",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    /* capture (dst) */
+    memset(&fmt, 0, sizeof(fmt));
+
+    switch (pCTX->codecType) {
+    case H264_ENC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
+        break;
+    case MPEG4_ENC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG4;
+        break;
+    case H263_ENC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H263;
+        break;
+    default:
+        LOGE("[%s] Codec has not been recognised",__func__);
+        return MFC_RET_ENC_INIT_FAIL;
+    }
+
+    fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    fmt.fmt.pix_mp.plane_fmt[0].sizeimage = MAX_STREAM_SIZE;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
+    if (ret != 0) {
+        LOGE("[%s] S_FMT failed on MFC output stream",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    /* cacheable buffer */
+    ctrl.id = V4L2_CID_CACHEABLE;
+    if (pCTX->cacheablebuffer == NO_CACHE)
+        ctrl.value = 0;
+    else
+        ctrl.value = 1;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    /* Initialize streams for input */
+    memset(&reqbuf, 0, sizeof(reqbuf));
+    reqbuf.count  = MFC_ENC_NUM_SRC_BUFS;
+    reqbuf.type   = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    if (pCTX->v4l2_enc.bInputPhyVir)
+        reqbuf.memory = V4L2_MEMORY_USERPTR;
+    else
+        reqbuf.memory = V4L2_MEMORY_MMAP;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
+    if (ret != 0) {
+        LOGE("[%s] Reqbufs src ioctl failed",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+    pCTX->v4l2_enc.mfc_num_src_bufs  = reqbuf.count;
+
+    if (!pCTX->v4l2_enc.bInputPhyVir) {
+        /* Then the buffers have to be queried and mmaped */
+        for (i = 0;  i < pCTX->v4l2_enc.mfc_num_src_bufs; ++i) {
+            memset(&buf, 0, sizeof(buf));
+            buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+            buf.memory = V4L2_MEMORY_MMAP;
+            buf.index = i;
+            buf.m.planes = planes;
+            buf.length = 2;
+
+            ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
+            if (ret != 0) {
+                LOGE("[%s] Querybuf src ioctl failed",__func__);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case2;
+            }
+
+            pCTX->v4l2_enc.mfc_src_bufs_len[0] = buf.m.planes[0].length;
+            pCTX->v4l2_enc.mfc_src_bufs_len[1] = buf.m.planes[1].length;
+
+            pCTX->v4l2_enc.mfc_src_phys[i][0] = buf.m.planes[0].cookie;
+            pCTX->v4l2_enc.mfc_src_phys[i][1] = buf.m.planes[1].cookie;
+
+            pCTX->v4l2_enc.mfc_src_bufs[i][0] =
+                mmap(NULL, buf.m.planes[0].length, PROT_READ | PROT_WRITE,
+                MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
+            if (pCTX->v4l2_enc.mfc_src_bufs[i][0] == MAP_FAILED) {
+                LOGE("[%s] Mmap on src buffer (0) failed",__func__);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case2;
+            }
+
+            pCTX->v4l2_enc.mfc_src_bufs[i][1] =
+                mmap(NULL, buf.m.planes[1].length, PROT_READ | PROT_WRITE,
+                MAP_SHARED, pCTX->hMFC, buf.m.planes[1].m.mem_offset);
+            if (pCTX->v4l2_enc.mfc_src_bufs[i][1] == MAP_FAILED) {
+                munmap(pCTX->v4l2_enc.mfc_src_bufs[i][0], pCTX->v4l2_enc.mfc_src_bufs_len[0]);
+                LOGE("[%s] Mmap on src buffer (1) failed",__func__);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case2;
+            }
+        }
+    } else
+        LOGV("[%s] Camera Phys src buf %d",__func__,reqbuf.count);
+
+    for (i = 0; i<pCTX->v4l2_enc.mfc_num_src_bufs; i++)
+        pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_DEQUEUED;
+
+    pCTX->v4l2_enc.beingUsedIndex = 0;
+
+    pCTX->sizeFrmBuf.luma = (unsigned int)(pCTX->width * pCTX->height);
+    pCTX->sizeFrmBuf.chroma = (unsigned int)((pCTX->width * pCTX->height) >> 1);
+    pCTX->inter_buff_status |= MFC_USE_YUV_BUFF;
+
+    /* Initialize stream for output */
+    memset(&reqbuf, 0, sizeof(reqbuf));
+    reqbuf.count  = MFC_ENC_MAX_DST_BUFS;
+    reqbuf.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    reqbuf.memory = V4L2_MEMORY_MMAP;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
+    if (ret != 0) {
+        LOGE("[%s] Reqbufs dst ioctl failed",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case2;
+    }
+
+    pCTX->v4l2_enc.mfc_num_dst_bufs   = reqbuf.count;
+
+    for (i = 0; i<MFC_ENC_MAX_DST_BUFS; ++i) {
+        memset(&buf, 0, sizeof(buf));
+        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        buf.memory = V4L2_MEMORY_MMAP;
+        buf.index = i;
+        buf.m.planes = planes;
+        buf.length = 1;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
+        if (ret != 0) {
+            LOGE("[%s] Querybuf dst ioctl failed",__func__);
+            ret = MFC_RET_ENC_INIT_FAIL;
+            goto error_case3;
+        }
+
+        pCTX->v4l2_enc.mfc_dst_bufs_len = buf.m.planes[0].length;
+        pCTX->v4l2_enc.mfc_dst_bufs[i] =
+                mmap(NULL, buf.m.planes[0].length, PROT_READ | PROT_WRITE,
+                MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
+        if (pCTX->v4l2_enc.mfc_dst_bufs[i] == MAP_FAILED) {
+            LOGE("[%s] Mmap on dst buffer failed",__func__);
+            ret = MFC_RET_ENC_INIT_FAIL;
+            goto error_case3;
+        }
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &buf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+            ret = MFC_RET_ENC_INIT_FAIL;
+            goto error_case3;
+        }
+    }
+
+    pCTX->sizeStrmBuf = MAX_ENCODER_OUTPUT_BUFFER_SIZE;
+    pCTX->inter_buff_status |= MFC_USE_STRM_BUFF;
+
+    type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
+    if (ret != 0) {
+        LOGE("[%s] V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, VIDIOC_STREAMON failed",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case3;
+    }
+
+    memset(&buf, 0, sizeof(buf));
+    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    buf.memory = V4L2_MEMORY_MMAP;
+    buf.m.planes = planes;
+    buf.length = 1;
+
+    /* note: #define POLLOUT 0x0004 */
+    poll_events.fd = pCTX->hMFC;
+    poll_events.events = POLLIN | POLLERR;
+    poll_events.revents = 0;
+
+    /* wait for header encoding */
+    do {
+        poll_state = poll((struct pollfd*)&poll_events, 1, POLL_ENC_WAIT_TIMEOUT);
+        if (0 < poll_state) {
+            if (poll_events.revents & POLLIN) { /* POLLIN */
+                ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &buf);
+                if (ret == 0)
+                    break;
+            } else if(poll_events.revents & POLLERR) { /*POLLERR */
+                LOGE("[%s] POLLERR\n",__func__);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case3;
+            } else {
+                LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case3;
+            }
+        } else if(0 > poll_state) {
+            ret = MFC_RET_ENC_INIT_FAIL;
+            goto error_case3;
+        }
+    } while (0 == poll_state);
+
+    pCTX->v4l2_enc.mfc_dst_bufs_bytes_used_len = buf.m.planes[0].bytesused;
+    pCTX->virStrmBuf = pCTX->v4l2_enc.mfc_dst_bufs[buf.index];
+
+    /* stream dequeued index */
+    index = buf.index;
+    memset(&buf, 0, sizeof(buf));
+    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    buf.memory = V4L2_MEMORY_MMAP;
+    buf.index = index;
+    buf.m.planes = planes;
+    buf.length = 1;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &buf);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case3;
+    }
+    LOGV("[%s] Strm out idx %d",__func__,index);
+
+    return MFC_RET_OK;
+error_case3:
+    for (j = 0; j < i; j++)
+        munmap(pCTX->v4l2_enc.mfc_dst_bufs[j], pCTX->v4l2_enc.mfc_dst_bufs_len);
+
+    i = pCTX->v4l2_enc.mfc_num_src_bufs;
+error_case2:
+    if (!pCTX->v4l2_enc.bInputPhyVir) {
+        for (j = 0; j < i; j++) {
+            munmap(pCTX->v4l2_enc.mfc_src_bufs[j][0], pCTX->v4l2_enc.mfc_src_bufs_len[0]);
+            munmap(pCTX->v4l2_enc.mfc_src_bufs[j][1], pCTX->v4l2_enc.mfc_src_bufs_len[1]);
+        }
+    }
+error_case1:
+    return ret;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info)
+{
+    _MFCLIB *pCTX;
+    int i;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    if (pCTX->v4l2_enc.bInputPhyVir) {
+        input_info->YPhyAddr = (void*)0;
+        input_info->CPhyAddr = (void*)0;
+        input_info->YVirAddr = (void*)0;
+        input_info->CVirAddr = (void*)0;
+
+        if (NV12_TILE == pCTX->framemap) {
+            /* 4:2:0, 2 Planes, 64x32 Tiles */
+            input_info->YSize = Align(Align(pCTX->width, 128) * Align(pCTX->height, 32), 8192); /* tiled mode */
+            input_info->CSize = Align(Align(pCTX->width, 128) * Align(pCTX->height >> 1, 32), 8192); /* tiled mode */
+        } else { /* NV12_LINEAR (default) */
+            /* 4:2:0, 2 Planes, linear */
+            input_info->YSize = Align(Align(pCTX->width, 16) * Align(pCTX->height, 16), 2048); /* width = 16B, height = 16B align */
+            input_info->CSize = Align(Align(pCTX->width, 16) * Align(pCTX->height >> 1, 8), 2048); /* width = 16B, height = 8B align */
+        }
+    } else {
+        for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++)
+            if (BUF_DEQUEUED == pCTX->v4l2_enc.mfc_src_buf_flags[i])
+                break;
+
+        if (i == pCTX->v4l2_enc.mfc_num_src_bufs) {
+            LOGV("[%s] No buffer is available.",__func__);
+            return MFC_RET_ENC_GET_INBUF_FAIL;
+        } else {
+            /* FIXME check this for correct physical address */
+            input_info->YPhyAddr = (void*)pCTX->v4l2_enc.mfc_src_phys[i][0];
+            input_info->CPhyAddr = (void*)pCTX->v4l2_enc.mfc_src_phys[i][1];
+            input_info->YVirAddr = (void*)pCTX->v4l2_enc.mfc_src_bufs[i][0];
+            input_info->CVirAddr = (void*)pCTX->v4l2_enc.mfc_src_bufs[i][1];
+            input_info->YSize = (int)pCTX->v4l2_enc.mfc_src_bufs_len[0];
+            input_info->CSize = (int)pCTX->v4l2_enc.mfc_src_bufs_len[1];
+
+            pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_ENQUEUED;
+        }
+    }
+    LOGV("[%s] Input Buffer idx %d",__func__,i);
+    return MFC_RET_OK;
+}
+
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info)
+{
+    _MFCLIB *pCTX;
+    struct v4l2_buffer qbuf;
+    struct v4l2_plane planes[MFC_ENC_NUM_PLANES];
+    int ret,i;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    memset(&qbuf, 0, sizeof(qbuf));
+    if (pCTX->v4l2_enc.bInputPhyVir) {
+        qbuf.memory = V4L2_MEMORY_USERPTR;
+        qbuf.index = pCTX->v4l2_enc.beingUsedIndex;
+        planes[0].m.userptr = (unsigned long)input_info->YPhyAddr;
+        planes[0].length = input_info->YSize;
+        planes[0].bytesused = input_info->YSize;
+        planes[1].m.userptr = (unsigned long)input_info->CPhyAddr;
+        planes[1].length = input_info->CSize;
+        planes[1].bytesused = input_info->CSize;
+
+        /* FIXME, this is only for case of not using B frame,
+        Camera side should know which buffer is queued() refering to index of
+        MFC dqbuf() */
+        pCTX->v4l2_enc.beingUsedIndex++;
+        pCTX->v4l2_enc.beingUsedIndex %= MFC_ENC_NUM_SRC_BUFS;
+        LOGV("[%s] Phy Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
+    } else {
+        for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++)
+            if (pCTX->v4l2_enc.mfc_src_bufs[i][0] == input_info->YVirAddr)
+                break;
+
+        if (i == pCTX->v4l2_enc.mfc_num_src_bufs) {
+            LOGE("[%s] Can not use the buffer",__func__);
+            return MFC_RET_INVALID_PARAM;
+        } else {
+            pCTX->v4l2_enc.beingUsedIndex = i;
+            //pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_ENQUEUED;
+        }
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.index = pCTX->v4l2_enc.beingUsedIndex;
+        planes[0].bytesused = pCTX->width * pCTX->height;
+        planes[1].bytesused = (pCTX->width * pCTX->height) >> 1;
+        LOGV("[%s] Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
+    }
+
+    qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    qbuf.m.planes = planes;
+    qbuf.length = 2;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+        return MFC_RET_ENC_SET_INBUF_FAIL;
+    }
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUTPUT_INFO *output_info)
+{
+    _MFCLIB *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    if (pCTX->v4l2_enc.bRunning == 0) {
+        pCTX->encodedHeaderSize = pCTX->v4l2_enc.mfc_dst_bufs_bytes_used_len;
+        output_info->dataSize = 0;
+    } else {
+        output_info->dataSize = pCTX->v4l2_enc.mfc_dst_bufs_bytes_used_len;
+    }
+
+    output_info->headerSize = pCTX->encodedHeaderSize;
+    output_info->frameType = pCTX->encodedframeType;
+    output_info->StrmPhyAddr = (void *)0;
+    output_info->StrmVirAddr = (void *)pCTX->virStrmBuf;
+    output_info->encodedYPhyAddr = (void*)0;
+    output_info->encodedCPhyAddr = (void*)0;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetOutBuf(void *openHandle, void *phyOutbuf, void *virOutbuf, int outputBufferSize)
+{
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    return MFC_RET_ENC_SET_OUTBUF_FAIL;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
+{
+    int ret;
+    int dequeued_index;
+    int loopcnt = 0;
+    _MFCLIB *pCTX;
+
+    struct v4l2_buffer qbuf;
+    struct v4l2_plane planes[MFC_ENC_NUM_PLANES];
+    enum v4l2_buf_type type;
+
+    struct v4l2_control ctrl;
+
+    struct pollfd poll_events;
+    int poll_state;
+
+    LOGV("[%s] Enter \n",__func__);
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    ctrl.id = V4L2_CID_CODEC_FRAME_TAG;
+    ctrl.value = pCTX->inframetag;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
+        return MFC_RET_ENC_EXE_ERR;
+    }
+
+    if (pCTX->v4l2_enc.bRunning == 0) {
+        type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMON failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_ENC_EXE_ERR;
+        }
+
+        pCTX->v4l2_enc.bRunning = 1;
+    }
+
+    memset(&qbuf, 0, sizeof(qbuf));
+    qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    qbuf.memory = V4L2_MEMORY_MMAP;
+    qbuf.m.planes = planes;
+    qbuf.length = 1;
+
+    /* note: #define POLLOUT 0x0004 */
+    poll_events.fd = pCTX->hMFC;
+    poll_events.events = POLLIN | POLLERR;
+    poll_events.revents = 0;
+
+    /* wait for encoding */
+    do {
+        poll_state = poll((struct pollfd*)&poll_events, 1, POLL_ENC_WAIT_TIMEOUT);
+        if (0 < poll_state) {
+            if (poll_events.revents & POLLIN) { /* POLLIN */
+                ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+                if (ret == 0)
+                    break;
+            } else if (poll_events.revents & POLLERR) { /* POLLERR */
+                LOGE("[%s] POLLERR\n",__func__);
+                return MFC_RET_ENC_EXE_ERR;
+            } else {
+                LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
+                return MFC_RET_ENC_EXE_ERR;
+            }
+        } else if (0 > poll_state) {
+            LOGE("[%s] poll() Encoder POLL Timeout 0x%x\n",__func__, poll_events.revents);
+            return MFC_RET_ENC_EXE_ERR;
+        }
+        loopcnt++;
+    } while ((0 == poll_state) && (loopcnt < 5));
+
+    if (pCTX->v4l2_enc.bRunning != 0) {
+        pCTX->encodedframeType = (qbuf.flags & 0x18) >> 3; /* encoded frame type */
+
+        LOGV("[%s] encoded frame type = %d\n",__func__, pCTX->encodedframeType);
+        switch (pCTX->encodedframeType) {
+        case 1:
+            pCTX->encodedframeType = MFC_FRAME_TYPE_I_FRAME;
+            break;
+        case 2:
+            pCTX->encodedframeType = MFC_FRAME_TYPE_P_FRAME;
+            break;
+        case 4:
+            pCTX->encodedframeType = MFC_FRAME_TYPE_B_FRAME;
+            break;
+        default:
+             LOGE("[%s] VIDIOC_DQBUF failed, encoded frame type is wrong",__func__);
+        }
+    }
+
+    dequeued_index = qbuf.index;
+
+    if (qbuf.m.planes[0].bytesused > 0) { /* FIXME later */
+        pCTX->v4l2_enc.mfc_dst_bufs_bytes_used_len = qbuf.m.planes[0].bytesused;
+    }
+
+    ctrl.id = V4L2_CID_CODEC_FRAME_TAG;
+    ctrl.value = 0;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
+        return MFC_RET_ENC_EXE_ERR;
+    }
+
+    pCTX->outframetagtop = ctrl.value;
+
+    memset(&qbuf, 0, sizeof(qbuf));
+    qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    qbuf.memory = V4L2_MEMORY_MMAP;
+    qbuf.index = dequeued_index;
+    qbuf.m.planes = planes;
+    qbuf.length = 1;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+        return MFC_RET_ENC_EXE_ERR;
+    }
+
+    if (pCTX->v4l2_enc.bRunning != 0) {
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+
+        if (pCTX->v4l2_enc.bInputPhyVir)
+            qbuf.memory = V4L2_MEMORY_USERPTR;
+        else
+            qbuf.memory = V4L2_MEMORY_MMAP;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_DQBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_ENC_EXE_ERR;
+        }
+    }
+    pCTX->v4l2_enc.mfc_src_buf_flags[qbuf.index] = BUF_DEQUEUED;
+
+    /* Update context stream buffer address */
+    pCTX->virStrmBuf = pCTX->v4l2_enc.mfc_dst_bufs[dequeued_index];
+    LOGV("[%s] Strm out idx %d",__func__,dequeued_index);
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value)
+{
+    _MFCLIB *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if (value == NULL) {
+        LOGE("[%s] value is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    switch (conf_type) {
+    case MFC_ENC_SETCONF_FRAME_TAG:
+        pCTX->inframetag = *((unsigned int *)value);
+        return MFC_RET_OK;
+
+    case MFC_ENC_SETCONF_ALLOW_FRAME_SKIP:
+        pCTX->enc_frameskip = *((int *)value);
+        return MFC_RET_OK;
+#if 0
+    case MFC_ENC_SETCONF_VUI_INFO:
+        vui_info = *((struct mfc_enc_vui_info *) value);
+        EncArg.args.set_config.in_config_value[0]  = (int)(vui_info.aspect_ratio_idc);
+        EncArg.args.set_config.in_config_value[1]  = 0;
+        break;
+
+    case MFC_ENC_SETCONF_HIER_P:
+        hier_p_qp = *((struct mfc_enc_hier_p_qp *) value);
+        EncArg.args.set_config.in_config_value[0]  = (int)(hier_p_qp.t0_frame_qp);
+        EncArg.args.set_config.in_config_value[1]  = (int)(hier_p_qp.t2_frame_qp);
+        EncArg.args.set_config.in_config_value[2]  = (int)(hier_p_qp.t3_frame_qp);
+        break;
+
+    case MFC_ENC_SETCONF_I_PERIOD:
+#endif
+    default:
+        LOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value)
+{
+    _MFCLIB *pCTX;
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if (value == NULL) {
+        LOGE("[%s] value is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    switch (conf_type) {
+    case MFC_ENC_GETCONF_FRAME_TAG:
+        *((unsigned int *)value) = pCTX->outframetagtop;
+        break;
+
+    default:
+        LOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    return MFC_RET_OK;
+}
+
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/include/SsbSipMfcApi.h b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/include/SsbSipMfcApi.h
new file mode 100644
index 0000000..b85256b
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/include/SsbSipMfcApi.h
@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * Global header for Samsung MFC (Multi Function Codec - FIMV) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _SSBSIP_MFC_API_H_
+#define _SSBSIP_MFC_API_H_
+
+/*--------------------------------------------------------------------------------*/
+/* Definition                                                                     */
+/*--------------------------------------------------------------------------------*/
+#define MAX_DECODER_INPUT_BUFFER_SIZE  (1024 * 3072)
+#define MAX_ENCODER_OUTPUT_BUFFER_SIZE (1024 * 3072)
+
+#define SUPPORT_1080P        1
+
+#if SUPPORT_1080P
+#define MMAP_BUFFER_SIZE_MMAP          (70*1024*1024) /* only C110 use this value. in C210, memory size is decided in menuconfig*/
+#else
+#define MMAP_BUFFER_SIZE_MMAP          (62*1024*1024)
+#endif
+
+#define SAMSUNG_MFC_DEV_NAME           "/dev/video"
+
+#define SSBSIP_MFC_OK                   (1)
+#define SSBSIP_MFC_FAIL                 (0)
+
+/*--------------------------------------------------------------------------------*/
+/* Structure and Type                                                             */
+/*--------------------------------------------------------------------------------*/
+typedef enum {
+    H264_DEC,
+    VC1_DEC,     /* VC1 advaced Profile decoding  */
+    MPEG4_DEC,
+    XVID_DEC,
+    MPEG1_DEC,
+    MPEG2_DEC,
+    H263_DEC,
+    VC1RCV_DEC,  /* VC1 simple/main profile decoding  */
+    FIMV1_DEC,
+    FIMV2_DEC,
+    FIMV3_DEC,
+    FIMV4_DEC,
+    H264_ENC,
+    MPEG4_ENC,
+    H263_ENC,
+    UNKNOWN_TYPE
+} SSBSIP_MFC_CODEC_TYPE;
+
+typedef enum {
+    DONT_CARE = 0,
+    I_FRAME = 1,
+    NOT_CODED = 2
+} SSBSIP_MFC_FORCE_SET_FRAME_TYPE;
+
+typedef enum {
+    NV12_LINEAR = 0,
+    NV12_TILE,
+    NV21_LINEAR
+} SSBSIP_MFC_INSTRM_MODE_TYPE;
+
+typedef enum {
+    NO_CACHE = 0,
+    CACHE = 1
+} SSBIP_MFC_BUFFER_TYPE;
+
+typedef enum {
+    MFC_DEC_SETCONF_POST_ENABLE = 1,
+    MFC_DEC_SETCONF_EXTRA_BUFFER_NUM,
+    MFC_DEC_SETCONF_DISPLAY_DELAY,
+    MFC_DEC_SETCONF_IS_LAST_FRAME,
+    MFC_DEC_SETCONF_SLICE_ENABLE,
+    MFC_DEC_SETCONF_CRC_ENABLE,
+    MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT,
+    MFC_DEC_SETCONF_FRAME_TAG,
+    MFC_DEC_GETCONF_CRC_DATA,
+    MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT,
+    MFC_DEC_GETCONF_CROP_INFO,
+    MFC_DEC_GETCONF_FRAME_TAG,
+
+    /* C210 specific feature */
+    MFC_DEC_SETCONF_IMMEDIATELY_DISPLAY,
+    MFC_DEC_SETCONF_DPB_FLUSH,
+    MFC_DEC_SETCONF_PIXEL_CACHE,
+    MFC_DEC_GETCONF_WIDTH_HEIGHT
+} SSBSIP_MFC_DEC_CONF;
+
+typedef enum {
+    MFC_ENC_SETCONF_FRAME_TYPE = 100,
+    MFC_ENC_SETCONF_CHANGE_FRAME_RATE,
+    MFC_ENC_SETCONF_CHANGE_BIT_RATE,
+    MFC_ENC_SETCONF_FRAME_TAG,
+    MFC_ENC_SETCONF_ALLOW_FRAME_SKIP,
+    MFC_ENC_GETCONF_FRAME_TAG,
+
+    /* C210 specific feature */
+    MFC_ENC_SETCONF_VUI_INFO,
+    MFC_ENC_SETCONF_I_PERIOD,
+    MFC_ENC_SETCONF_HIER_P
+} SSBSIP_MFC_ENC_CONF;
+
+typedef enum {
+    MFC_GETOUTBUF_STATUS_NULL = 0,
+    MFC_GETOUTBUF_DECODING_ONLY = 1,
+    MFC_GETOUTBUF_DISPLAY_DECODING,
+    MFC_GETOUTBUF_DISPLAY_ONLY,
+    MFC_GETOUTBUF_DISPLAY_END,
+    MFC_GETOUTBUF_CHANGE_RESOL
+} SSBSIP_MFC_DEC_OUTBUF_STATUS;
+
+typedef enum {
+    MFC_FRAME_TYPE_NOT_CODED,
+    MFC_FRAME_TYPE_I_FRAME,
+    MFC_FRAME_TYPE_P_FRAME,
+    MFC_FRAME_TYPE_B_FRAME,
+    MFC_FRAME_TYPE_OTHERS
+} SSBSIP_MFC_FRAME_TYPE;
+
+typedef enum {
+    MFC_RET_OK                      = 1,
+    MFC_RET_FAIL                    = -1000,
+    MFC_RET_OPEN_FAIL               = -1001,
+    MFC_RET_CLOSE_FAIL              = -1002,
+
+    MFC_RET_DEC_INIT_FAIL           = -2000,
+    MFC_RET_DEC_EXE_TIME_OUT        = -2001,
+    MFC_RET_DEC_EXE_ERR             = -2002,
+    MFC_RET_DEC_GET_INBUF_FAIL      = -2003,
+    MFC_RET_DEC_SET_INBUF_FAIL      = -2004,
+    MFC_RET_DEC_GET_OUTBUF_FAIL     = -2005,
+    MFC_RET_DEC_GET_CONF_FAIL       = -2006,
+    MFC_RET_DEC_SET_CONF_FAIL       = -2007,
+
+    MFC_RET_ENC_INIT_FAIL           = -3000,
+    MFC_RET_ENC_EXE_TIME_OUT        = -3001,
+    MFC_RET_ENC_EXE_ERR             = -3002,
+    MFC_RET_ENC_GET_INBUF_FAIL      = -3003,
+    MFC_RET_ENC_SET_INBUF_FAIL      = -3004,
+    MFC_RET_ENC_GET_OUTBUF_FAIL     = -3005,
+    MFC_RET_ENC_SET_OUTBUF_FAIL     = -3006,
+    MFC_RET_ENC_GET_CONF_FAIL       = -3007,
+    MFC_RET_ENC_SET_CONF_FAIL       = -3008,
+
+    MFC_RET_INVALID_PARAM           = -4000
+} SSBSIP_MFC_ERROR_CODE;
+
+typedef struct {
+    void *YPhyAddr;                     /* [OUT] physical address of Y */
+    void *CPhyAddr;                     /* [OUT] physical address of CbCr */
+    void *YVirAddr;                     /* [OUT] virtual address of Y */
+    void *CVirAddr;                     /* [OUT] virtual address of CbCr */
+
+    int img_width;                      /* [OUT] width of real image */
+    int img_height;                     /* [OUT] height of real image */
+    int buf_width;                      /* [OUT] width aligned to 16 */
+    int buf_height;                     /* [OUT] height alighed to 16 */
+
+    int timestamp_top;                  /* [OUT] timestamp of top filed(This is used for interlaced stream) */
+    int timestamp_bottom;               /* [OUT] timestamp of bottom filed(This is used for interlaced stream) */
+    int consumedByte;                   /* [OUT] the number of byte consumed during decoding */
+    int res_change;                     /* [OUT] whether resolution is changed or not. 0: not change, 1: increased, 2: decreased */
+    int crop_top_offset;                /* [OUT] crop information, top_offset */
+    int crop_bottom_offset;             /* [OUT] crop information, bottom_offset */
+    int crop_left_offset;               /* [OUT] crop information, left_offset */
+    int crop_right_offset;              /* [OUT] crop information, right_offset */
+    int disp_pic_frame_type;            /* [OUT] display picture frame type information */
+
+    /* C210 UMP feature */
+    unsigned int y_cookie;              /* [OUT] cookie for Y address */
+    unsigned int c_cookie;              /* [OUT] cookie for CbCr address, If it is 0, Y and CbCr is in continous memory */
+} SSBSIP_MFC_DEC_OUTPUT_INFO;
+
+typedef struct {
+    void *YPhyAddr;                     /* [IN/OUT] physical address of Y */
+    void *CPhyAddr;                     /* [IN/OUT] physical address of CbCr */
+    void *YVirAddr;                     /* [IN/OUT] virtual address of Y */
+    void *CVirAddr;                     /* [IN/OUT] virtual address of CbCr */
+    int YSize;                          /* [IN/OUT] input size of Y data */
+    int CSize;                          /* [IN/OUT] input size of CbCr data */
+
+    /* C210 UMP feature */
+    unsigned int y_cookie;              /* [OUT] cookie for Y address */
+    unsigned int c_cookie;              /* [OUT] cookie for CbCr address, If it is 0, Y and CbCr is in continous memory */
+} SSBSIP_MFC_ENC_INPUT_INFO;
+
+typedef struct {
+    unsigned int dataSize;              /* [OUT] encoded data size(without header) */
+    unsigned int headerSize;            /* [OUT] encoded header size */
+    unsigned int frameType;             /* [OUT] frame type of encoded stream */
+    void *StrmPhyAddr;                  /* [OUT] physical address of Y */
+    void *StrmVirAddr;                  /* [OUT] virtual address of Y */
+    void *encodedYPhyAddr;              /* [OUT] physical address of Y which is flushed */
+    void *encodedCPhyAddr;              /* [OUT] physical address of C which is flushed */
+
+    /* C210 UMP feature */
+    unsigned int strm_cookie;           /* [OUT] cooke for stream buffer */
+    unsigned int y_encoded_cookie;      /* [OUT] cookie for Y address */
+    unsigned int c_encoded_cookie;      /* [OUT] cookie for CbCr address, If it is 0, Y and CbCr is in continous memory */
+} SSBSIP_MFC_ENC_OUTPUT_INFO;
+
+typedef struct {
+    /* common parameters */
+    SSBSIP_MFC_CODEC_TYPE codecType;    /* [IN] codec type */
+    int SourceWidth;                    /* [IN] width of video to be encoded */
+    int SourceHeight;                   /* [IN] height of video to be encoded */
+    int IDRPeriod;                      /* [IN] GOP number(interval of I-frame) */
+    int SliceMode;                      /* [IN] Multi slice mode */
+    int RandomIntraMBRefresh;           /* [IN] cyclic intra refresh */
+    int EnableFRMRateControl;           /* [IN] frame based rate control enable */
+    int Bitrate;                        /* [IN] rate control parameter(bit rate) */
+    int FrameQp;                        /* [IN] The quantization parameter of the frame */
+    int FrameQp_P;                      /* [IN] The quantization parameter of the P frame */
+    int QSCodeMax;                      /* [IN] Maximum Quantization value */
+    int QSCodeMin;                      /* [IN] Minimum Quantization value */
+    int CBRPeriodRf;                    /* [IN] Reaction coefficient parameter for rate control */
+    int PadControlOn;                   /* [IN] Enable padding control */
+    int LumaPadVal;                     /* [IN] Luma pel value used to fill padding area */
+    int CbPadVal;                       /* [IN] CB pel value used to fill padding area */
+    int CrPadVal;                       /* [IN] CR pel value used to fill padding area */
+    int FrameMap;                       /* [IN] Encoding input mode(tile mode or linear mode) */
+
+    /* H.264 specific parameters */
+    int ProfileIDC;                     /* [IN] profile */
+    int LevelIDC;                       /* [IN] level */
+    int FrameQp_B;                      /* [IN] The quantization parameter of the B frame */
+    int FrameRate;                      /* [IN] rate control parameter(frame rate) */
+    int SliceArgument;                  /* [IN] MB number or byte number */
+    int NumberBFrames;                  /* [IN] The number of consecutive B frame inserted */
+    int NumberReferenceFrames;          /* [IN] The number of reference pictures used */
+    int NumberRefForPframes;            /* [IN] The number of reference pictures used for encoding P pictures */
+    int LoopFilterDisable;              /* [IN] disable the loop filter */
+    int LoopFilterAlphaC0Offset;        /* [IN] Alpha & C0 offset for H.264 loop filter */
+    int LoopFilterBetaOffset;           /* [IN] Beta offset for H.264 loop filter */
+    int SymbolMode;                     /* [IN] The mode of entropy coding(CABAC, CAVLC) */
+    int PictureInterlace;               /* [IN] Enables the interlace mode */
+    int Transform8x8Mode;               /* [IN] Allow 8x8 transform(This is allowed only for high profile) */
+    int EnableMBRateControl;            /* [IN] Enable macroblock-level rate control */
+    int DarkDisable;                    /* [IN] Disable adaptive rate control on dark region */
+    int SmoothDisable;                  /* [IN] Disable adaptive rate control on smooth region */
+    int StaticDisable;                  /* [IN] Disable adaptive rate control on static region */
+    int ActivityDisable;                /* [IN] Disable adaptive rate control on high activity region */
+} SSBSIP_MFC_ENC_H264_PARAM;
+
+typedef struct {
+    /* common parameters */
+    SSBSIP_MFC_CODEC_TYPE codecType;    /* [IN] codec type */
+    int SourceWidth;                    /* [IN] width of video to be encoded */
+    int SourceHeight;                   /* [IN] height of video to be encoded */
+    int IDRPeriod;                      /* [IN] GOP number(interval of I-frame) */
+    int SliceMode;                      /* [IN] Multi slice mode */
+    int RandomIntraMBRefresh;           /* [IN] cyclic intra refresh */
+    int EnableFRMRateControl;           /* [IN] frame based rate control enable */
+    int Bitrate;                        /* [IN] rate control parameter(bit rate) */
+    int FrameQp;                        /* [IN] The quantization parameter of the frame */
+    int FrameQp_P;                      /* [IN] The quantization parameter of the P frame */
+    int QSCodeMax;                      /* [IN] Maximum Quantization value */
+    int QSCodeMin;                      /* [IN] Minimum Quantization value */
+    int CBRPeriodRf;                    /* [IN] Reaction coefficient parameter for rate control */
+    int PadControlOn;                   /* [IN] Enable padding control */
+    int LumaPadVal;                     /* [IN] Luma pel value used to fill padding area */
+    int CbPadVal;                       /* [IN] CB pel value used to fill padding area */
+    int CrPadVal;                       /* [IN] CR pel value used to fill padding area */
+    int FrameMap;                       /* [IN] Encoding input mode(tile mode or linear mode) */
+
+    /* MPEG4 specific parameters */
+    int ProfileIDC;                     /* [IN] profile */
+    int LevelIDC;                       /* [IN] level */
+    int FrameQp_B;                      /* [IN] The quantization parameter of the B frame */
+    int TimeIncreamentRes;              /* [IN] frame rate */
+    int VopTimeIncreament;              /* [IN] frame rate */
+    int SliceArgument;                  /* [IN] MB number or byte number */
+    int NumberBFrames;                  /* [IN] The number of consecutive B frame inserted */
+    int DisableQpelME;                  /* [IN] disable quarter-pixel motion estimation */
+} SSBSIP_MFC_ENC_MPEG4_PARAM;
+
+typedef struct {
+    /* common parameters */
+    SSBSIP_MFC_CODEC_TYPE codecType;    /* [IN] codec type */
+    int SourceWidth;                    /* [IN] width of video to be encoded */
+    int SourceHeight;                   /* [IN] height of video to be encoded */
+    int IDRPeriod;                      /* [IN] GOP number(interval of I-frame) */
+    int SliceMode;                      /* [IN] Multi slice mode */
+    int RandomIntraMBRefresh;           /* [IN] cyclic intra refresh */
+    int EnableFRMRateControl;           /* [IN] frame based rate control enable */
+    int Bitrate;                        /* [IN] rate control parameter(bit rate) */
+    int FrameQp;                        /* [IN] The quantization parameter of the frame */
+    int FrameQp_P;                      /* [IN] The quantization parameter of the P frame */
+    int QSCodeMax;                      /* [IN] Maximum Quantization value */
+    int QSCodeMin;                      /* [IN] Minimum Quantization value */
+    int CBRPeriodRf;                    /* [IN] Reaction coefficient parameter for rate control */
+    int PadControlOn;                   /* [IN] Enable padding control */
+    int LumaPadVal;                     /* [IN] Luma pel value used to fill padding area */
+    int CbPadVal;                       /* [IN] CB pel value used to fill padding area */
+    int CrPadVal;                       /* [IN] CR pel value used to fill padding area */
+    int FrameMap;                       /* [IN] Encoding input mode(tile mode or linear mode) */
+
+    /* H.263 specific parameters */
+    int FrameRate;                      /* [IN] rate control parameter(frame rate) */
+} SSBSIP_MFC_ENC_H263_PARAM;
+
+typedef struct {
+    int width;
+    int height;
+    int buf_width;
+    int buf_height;
+} SSBSIP_MFC_IMG_RESOLUTION;
+
+typedef struct {
+    int crop_top_offset;
+    int crop_bottom_offset;
+    int crop_left_offset;
+    int crop_right_offset;
+} SSBSIP_MFC_CROP_INFORMATION;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------------*/
+/* Decoding APIs                                                                  */
+/*--------------------------------------------------------------------------------*/
+void *SsbSipMfcDecOpen(void);
+void *SsbSipMfcDecOpenExt(void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE codec_type, int Frameleng);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill);
+//SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle);
+void  *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSize);
+//SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info);
+
+#if (defined(CONFIG_VIDEO_MFC_VCM_UMP) || defined(USE_UMP))
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, unsigned int secure_id, int size);
+#else
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, void *virInBuf, int size);
+#endif
+
+SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value);
+
+/*--------------------------------------------------------------------------------*/
+/* Encoding APIs                                                                  */
+/*--------------------------------------------------------------------------------*/
+void *SsbSipMfcEncOpen(void);
+void *SsbSipMfcEncOpenExt(void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUTPUT_INFO *output_info);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetOutBuf(void *openHandle, void *phyOutbuf, void *virOutbuf, int outputBufferSize);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SSBSIP_MFC_API_H_ */
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/include/mfc_errno.h b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/include/mfc_errno.h
new file mode 100644
index 0000000..b8e96ab
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/include/mfc_errno.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * Global header for Samsung MFC (Multi Function Codec - FIMV) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MFC_ERRNO_H
+#define __MFC_ERRNO_H __FILE__
+
+enum mfc_ret_code {
+    MFC_OK = 1,
+    MFC_FAIL = -1000,
+    MFC_OPEN_FAIL = -1001,
+    MFC_CLOSE_FAIL = -1002,
+
+    MFC_DEC_INIT_FAIL = -2000,
+    MFC_DEC_EXE_TIME_OUT = -2001,
+    MFC_DEC_EXE_ERR = -2002,
+    MFC_DEC_GET_INBUF_FAIL = 2003,
+    MFC_DEC_SET_INBUF_FAIL = 2004,
+    MFC_DEC_GET_OUTBUF_FAIL = -2005,
+    MFC_DEC_GET_CONF_FAIL = -2006,
+    MFC_DEC_SET_CONF_FAIL = -2007,
+
+    MFC_ENC_INIT_FAIL = -3000,
+    MFC_ENC_EXE_TIME_OUT = -3001,
+    MFC_ENC_EXE_ERR = -3002,
+    MFC_ENC_GET_INBUF_FAIL = -3003,
+    MFC_ENC_SET_INBUF_FAIL = -3004,
+    MFC_ENC_GET_OUTBUF_FAIL = -3005,
+    MFC_ENC_SET_OUTBUF_FAIL = -3006,
+    MFC_ENC_GET_CONF_FAIL = -3007,
+    MFC_ENC_SET_CONF_FAIL = -3008,
+
+    MFC_STATE_INVALID = -4000,
+    MFC_DEC_HEADER_FAIL = -4001,
+    MFC_DEC_INIT_BUF_FAIL = -4002,
+    MFC_ENC_HEADER_FAIL = -5000,
+    MFC_ENC_PARAM_FAIL = -5001,
+    MFC_FRM_BUF_SIZE_FAIL = -6000,
+    MFC_FW_LOAD_FAIL = -6001,
+    MFC_FW_INIT_FAIL = -6002,
+    MFC_INST_NUM_EXCEEDED_FAIL = -6003,
+    MFC_MEM_ALLOC_FAIL = -6004,
+    MFC_MEM_INVALID_ADDR_FAIL = -6005,
+    MFC_MEM_MAPPING_FAIL = -6006,
+    MFC_GET_CONF_FAIL = -6007,
+    MFC_SET_CONF_FAIL = -6008,
+    MFC_INVALID_PARAM_FAIL = -6009,
+    MFC_API_FAIL = -9000,
+
+    MFC_CMD_FAIL = -1003,
+    MFC_SLEEP_FAIL = -1010,
+    MFC_WAKEUP_FAIL = -1020,
+
+    MFC_CLK_ON_FAIL = -1030,
+    MFC_CLK_OFF_FAIL = -1030,
+    MFC_PWR_ON_FAIL = -1040,
+    MFC_PWR_OFF_FAIL = -1041,
+};
+
+#endif /* __MFC_ERRNO_H */
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/include/mfc_interface.h b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/include/mfc_interface.h
new file mode 100644
index 0000000..b7289c4
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos4/mfc_v4l2/include/mfc_interface.h
@@ -0,0 +1,541 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * Global header for Samsung MFC (Multi Function Codec - FIMV) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MFC_INTERFACE_H
+#define __MFC_INTERFACE_H
+
+#include "mfc_errno.h"
+#include "SsbSipMfcApi.h"
+
+#define IOCTL_MFC_DEC_INIT          (0x00800001)
+#define IOCTL_MFC_ENC_INIT          (0x00800002)
+#define IOCTL_MFC_DEC_EXE           (0x00800003)
+#define IOCTL_MFC_ENC_EXE           (0x00800004)
+
+#define IOCTL_MFC_GET_IN_BUF        (0x00800010)
+#define IOCTL_MFC_FREE_BUF          (0x00800011)
+#define IOCTL_MFC_GET_REAL_ADDR     (0x00800012)
+#define IOCTL_MFC_GET_MMAP_SIZE     (0x00800014)
+#define IOCTL_MFC_SET_IN_BUF        (0x00800018)
+
+#define IOCTL_MFC_SET_CONFIG        (0x00800101)
+#define IOCTL_MFC_GET_CONFIG        (0x00800102)
+
+#define IOCTL_MFC_SET_BUF_CACHE     (0x00800201)
+
+/* MFC H/W support maximum 32 extra DPB. */
+#define MFC_MAX_EXTRA_DPB                      5
+#define MFC_MAX_DISP_DELAY              0xF
+
+#define MFC_LIB_VER_MAJOR               1
+#define MFC_LIB_VER_MINOR               00
+
+#define BUF_L_UNIT          (1024)
+#define Align(x, alignbyte)     (((x)+(alignbyte)-1)/(alignbyte)*(alignbyte))
+
+#define MFC_ENC_NUM_SRC_BUFS    2 /* Number of source buffers to request */
+#define MFC_ENC_MAX_DST_BUFS    2 /* The maximum number of buffers */
+#define MFC_ENC_NUM_PLANES  2 /* Number of planes used by MFC Input */
+
+#define MFC_DEC_NUM_SRC_BUFS    2  /* Number of source buffers to request */
+#define MFC_DEC_MAX_DST_BUFS    32 /* The maximum number of buffers */
+#define MFC_DEC_NUM_PLANES  2  /* Number of planes used by MFC output */
+
+enum inst_type {
+    DECODER = 0x1,
+    ENCODER = 0x2,
+};
+
+typedef enum {
+    MFC_UNPACKED_PB = 0,
+    MFC_PACKED_PB = 1
+} mfc_packed_mode;
+
+typedef enum {
+    SSBSIP_MFC_LAST_FRAME_NOT_RECEIVED = 0,
+    SSBSIP_MFC_LAST_FRAME_RECEIVED = 1,
+    SSBSIP_MFC_LAST_FRAME_PROCESSED = 2
+} SSBSIP_MFC_LAST_FRAME_STATUS;
+
+typedef enum {
+    MFC_USE_NONE         =  0x0000,
+    MFC_USE_YUV_BUFF     =  0x0001,
+    MFC_USE_STRM_BUFF    =  0x0010,
+    MFC_USE_SRC_STREAMON =  0x0100,
+    MFC_USE_DST_STREAMON =  0x1000,
+} s3c_mfc_interbuff_status;
+
+typedef struct {
+    int luma0;  /* per frame (or top field) */
+    int chroma0;    /* per frame (or top field) */
+    int luma1;  /* per frame (or bottom field) */
+    int chroma1;    /* per frame (or bottom field) */
+} SSBSIP_MFC_CRC_DATA;
+
+struct mfc_strm_ref_buf_arg {
+    unsigned int strm_ref_y;
+    unsigned int mv_ref_yc;
+};
+
+struct mfc_frame_buf_arg {
+    unsigned int luma;
+    unsigned int chroma;
+};
+
+struct mfc_enc_init_common_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN] codec type */
+
+    int in_width;                        /* [IN] width of YUV420 frame to be encoded */
+    int in_height;                       /* [IN] height of YUV420 frame to be encoded */
+
+    int in_gop_num;                      /* [IN] GOP Number (interval of I-frame) */
+    int in_vop_quant;   /* [IN] VOP quant */
+    int in_vop_quant_p; /* [IN] VOP quant for P frame */
+
+    /* [IN] RC enable */
+    /* [IN] RC enable (0:disable, 1:frame level RC) */
+    int in_rc_fr_en;
+    int in_rc_bitrate;  /* [IN]  RC parameter (bitrate in kbps) */
+
+    int in_rc_qbound_min;   /* [IN]  RC parameter (Q bound Min) */
+    int in_rc_qbound_max;   /* [IN]  RC parameter (Q bound Max) */
+    int in_rc_rpara;    /* [IN]  RC parameter (Reaction Coefficient) */
+
+    /* [IN] Multi-slice mode (0:single, 1:multiple) */
+    int in_ms_mode;
+    /* [IN] Multi-slice size (in num. of mb or byte) */
+    int in_ms_arg;
+
+    int in_mb_refresh;                   /* [IN] Macroblock refresh */
+
+    /* [IN] Enable (1) / Disable (0) padding with the specified values */
+    int in_pad_ctrl_on;
+
+    /* [IN] pad value if pad_ctrl_on is Enable */
+    int in_y_pad_val;
+    int in_cb_pad_val;
+    int in_cr_pad_val;
+
+    /* linear or tiled */
+    int in_frame_map;
+
+    unsigned int in_pixelcache;
+
+    unsigned int in_mapped_addr;
+    struct mfc_strm_ref_buf_arg out_u_addr;
+    struct mfc_strm_ref_buf_arg out_p_addr;
+    struct mfc_strm_ref_buf_arg out_buf_size;
+    unsigned int out_header_size;
+};
+
+struct mfc_enc_init_h263_arg {
+    int in_rc_framerate;    /* [IN]  RC parameter (framerate) */
+};
+
+struct mfc_enc_init_mpeg4_arg {
+    int in_profile;     /* [IN] profile */
+    int in_level;       /* [IN] level */
+
+    int in_vop_quant_b; /* [IN] VOP quant for B frame */
+
+    /* [IN] B frame number */
+    int in_bframenum;
+
+    /* [IN] Quarter-pel MC enable (1:enabled, 0:disabled) */
+    int in_quart_pixel;
+
+    int in_TimeIncreamentRes;   /* [IN] VOP time resolution */
+    int in_VopTimeIncreament;   /* [IN] Frame delta */
+};
+
+struct mfc_enc_init_h264_arg {
+    int in_profile;     /* [IN] profile */
+    int in_level;       /* [IN] level */
+
+    int in_vop_quant_b; /* [IN] VOP quant for B frame */
+
+    /* [IN] B frame number */
+    int in_bframenum;
+
+    /* [IN] interlace mode(0:progressive, 1:interlace) */
+    int in_interlace_mode;
+
+    /* [IN]  reference number */
+    int in_reference_num;
+    /* [IN]  reference number of P frame */
+    int in_ref_num_p;
+
+    int in_rc_framerate;    /* [IN]  RC parameter (framerate) */
+    int in_rc_mb_en;    /* [IN] RC enable (0:disable, 1:MB level RC) */
+    /* [IN] MB level rate control dark region adaptive feature */
+    int in_rc_mb_dark_dis;  /* (0:enable, 1:disable) */
+    /* [IN] MB level rate control smooth region adaptive feature */
+    int in_rc_mb_smooth_dis;    /* (0:enable, 1:disable) */
+    /* [IN] MB level rate control static region adaptive feature */
+    int in_rc_mb_static_dis;    /* (0:enable, 1:disable) */
+    /* [IN] MB level rate control activity region adaptive feature */
+    int in_rc_mb_activity_dis;  /* (0:enable, 1:disable) */
+
+    /* [IN]  disable deblocking filter idc */
+    int in_deblock_dis; /* (0: enable,1: disable, 2:Disable at slice boundary) */
+    /* [IN]  slice alpha c0 offset of deblocking filter */
+    int in_deblock_alpha_c0;
+    /* [IN]  slice beta offset of deblocking filter */
+    int in_deblock_beta;
+
+    /* [IN]  ( 0 : CAVLC, 1 : CABAC ) */
+    int in_symbolmode;
+    /* [IN] (0: only 4x4 transform, 1: allow using 8x8 transform) */
+    int in_transform8x8_mode;
+
+    /* [IN] Inter weighted parameter for mode decision */
+    int in_md_interweight_pps;
+    /* [IN] Intra weighted parameter for mode decision */
+    int in_md_intraweight_pps;
+};
+
+struct mfc_enc_init_arg {
+    struct mfc_enc_init_common_arg cmn;
+    union {
+        struct mfc_enc_init_h264_arg h264;
+        struct mfc_enc_init_mpeg4_arg mpeg4;
+        struct mfc_enc_init_h263_arg h263;
+    } codec;
+};
+
+struct mfc_enc_exe_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN]  codec type */
+    unsigned int in_Y_addr;              /* [IN]  In-buffer addr of Y component */
+    unsigned int in_CbCr_addr;           /* [IN]  In-buffer addr of CbCr component */
+    unsigned int in_Y_addr_vir;          /* [IN]  In-buffer addr of Y component */
+    unsigned int in_CbCr_addr_vir;       /* [IN]  In-buffer addr of CbCr component */
+    unsigned int in_strm_st;             /* [IN]  Out-buffer start addr of encoded strm */
+    unsigned int in_strm_end;            /* [IN]  Out-buffer end addr of encoded strm */
+    unsigned int in_frametag;   /* [IN]  unique frame ID */
+
+    unsigned int out_frame_type;         /* [OUT] frame type */
+    int out_encoded_size;                /* [OUT] Length of Encoded video stream */
+    unsigned int out_Y_addr;    /*[OUT]Out-buffer addr of encoded Y component */
+    unsigned int out_CbCr_addr; /*[OUT]Out-buffer addr of encoded CbCr component */
+    unsigned int out_frametag_top;  /* [OUT] unique frame ID of an output frame or top field */
+    unsigned int out_frametag_bottom;/* [OUT] unique frame ID of bottom field */
+
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    unsigned int out_y_secure_id;
+    unsigned int out_c_secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int out_y_cookie;
+    unsigned int out_c_cookie;
+#endif
+};
+
+struct mfc_dec_init_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type;    /* [IN] codec type */
+    int in_strm_buf;        /* [IN] address of stream buffer */
+    int in_strm_size;       /* [IN] filled size in stream buffer */
+    int in_packed_PB;                    /* [IN]  Is packed PB frame or not, 1: packedPB  0: unpacked */
+
+    unsigned int in_crc;        /* [IN] */
+    unsigned int in_pixelcache; /* [IN] */
+    unsigned int in_slice;      /* [IN] */
+    unsigned int in_numextradpb;    /* [IN] */
+
+    unsigned int in_mapped_addr;
+
+    int out_frm_width;      /* [OUT] width  of YUV420 frame */
+    int out_frm_height;     /* [OUT] height of YUV420 frame */
+    int out_buf_width;  /* [OUT] width  of YUV420 frame */
+    int out_buf_height; /* [OUT] height of YUV420 frame */
+
+    int out_dpb_cnt;    /* [OUT] the number of buffers which is nessary during decoding. */
+
+    int out_crop_right_offset; /* [OUT] crop information for h264 */
+    int out_crop_left_offset;
+    int out_crop_bottom_offset;
+    int out_crop_top_offset;
+};
+
+struct mfc_dec_exe_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN]  codec type */
+    int in_strm_buf;  /* [IN]  the physical address of STRM_BUF */
+    /* [IN]  Size of video stream filled in STRM_BUF */
+    int in_strm_size;
+    /* [IN] the address of dpb FRAME_BUF */
+    struct mfc_frame_buf_arg in_frm_buf;
+    /* [IN] size of dpb FRAME_BUF */
+    struct mfc_frame_buf_arg in_frm_size;
+    /* [IN] Unique frame ID eg. application specific timestamp */
+    unsigned int in_frametag;
+    /* [IN] immdiate Display for seek,thumbnail and one frame */
+    int in_immediately_disp;
+    /* [OUT]  the physical address of display buf */
+    int out_display_Y_addr;
+    /* [OUT]  the physical address of display buf */
+    int out_display_C_addr;
+    int out_display_status;
+    /* [OUT] unique frame ID of an output frame or top field */
+    unsigned int out_frametag_top;
+     /* [OUT] unique frame ID of bottom field */
+    unsigned int out_frametag_bottom;
+    int out_pic_time_top;
+    int out_pic_time_bottom;
+    int out_consumed_byte;
+
+    int out_crop_right_offset;
+    int out_crop_left_offset;
+    int out_crop_bottom_offset;
+    int out_crop_top_offset;
+
+    /* in new driver, each buffer offset must be return to the user */
+    int out_y_offset;
+    int out_c_offset;
+
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    unsigned int out_y_secure_id;
+    unsigned int out_c_secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int out_y_cookie;
+    unsigned int out_c_cookie;
+#endif
+    int out_img_width;                   /* [OUT] width  of YUV420 frame */
+    int out_img_height;                  /* [OUT] height of YUV420 frame */
+    int out_buf_width;                   /* [OUT] width  of YUV420 frame */
+    int out_buf_height;                  /* [OUT] height of YUV420 frame */
+
+    int out_disp_pic_frame_type;        /* [OUT] display picture frame type information */
+};
+
+struct mfc_get_config_arg {
+    /* [IN] Configurable parameter type */
+    int in_config_param;
+
+    /* [IN] Values to get for the configurable parameter. */
+    /* Maximum four integer values can be obtained; */
+    int out_config_value[4];
+};
+
+struct mfc_set_config_arg {
+    /* [IN] Configurable parameter type */
+    int in_config_param;
+
+    /* [IN]  Values to be set for the configurable parameter. */
+    /* Maximum four integer values can be set. */
+    int in_config_value[4];
+};
+
+struct mfc_get_real_addr_arg {
+    unsigned int key;
+    unsigned int addr;
+};
+
+struct mfc_buf_alloc_arg {
+    enum inst_type type;
+    int size;
+    /*
+    unsigned int mapped;
+    */
+    unsigned int align;
+
+    unsigned int addr;
+    /*
+    unsigned int phys;
+    */
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    /* FIMXE: invalid secure id == -1 */
+    unsigned int secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int cookie;
+#else
+    unsigned int offset;
+#endif
+};
+
+struct mfc_buf_free_arg {
+    unsigned int addr;
+};
+
+/* RMVME */
+struct mfc_mem_alloc_arg {
+    enum inst_type type;
+    int buff_size;
+    SSBIP_MFC_BUFFER_TYPE buf_cache_type;
+    unsigned int mapped_addr;
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    unsigned int secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int cookie;
+#else
+    unsigned int offset;
+#endif
+};
+
+struct mfc_mem_free_arg {
+    unsigned int key;
+};
+/* RMVME */
+
+union mfc_args {
+    /*
+    struct mfc_enc_init_arg enc_init;
+
+    struct mfc_enc_init_mpeg4_arg enc_init_mpeg4;
+    struct mfc_enc_init_mpeg4_arg enc_init_h263;
+    struct mfc_enc_init_h264_arg enc_init_h264;
+    */
+    struct mfc_enc_init_arg enc_init;
+    struct mfc_enc_exe_arg enc_exe;
+
+    struct mfc_dec_init_arg dec_init;
+    struct mfc_dec_exe_arg dec_exe;
+
+    struct mfc_get_config_arg get_config;
+    struct mfc_set_config_arg set_config;
+
+    struct mfc_buf_alloc_arg buf_alloc;
+    struct mfc_buf_free_arg buf_free;
+    struct mfc_get_real_addr_arg real_addr;
+
+    /* RMVME */
+    struct mfc_mem_alloc_arg mem_alloc;
+    struct mfc_mem_free_arg mem_free;
+    /* RMVME */
+};
+
+struct mfc_common_args {
+    enum mfc_ret_code ret_code; /* [OUT] error code */
+    union mfc_args args;
+};
+
+struct mfc_enc_vui_info {
+    int aspect_ratio_idc;
+};
+
+struct mfc_dec_fimv1_info {
+    int width;
+    int height;
+};
+
+struct mfc_enc_hier_p_qp {
+    int t0_frame_qp;
+    int t2_frame_qp;
+    int t3_frame_qp;
+};
+
+enum BUF_STATUS {
+    BUF_ENQUEUED,
+    BUF_DEQUEUED
+};
+
+struct mfc_dec_v4l2 {
+    char *mfc_src_bufs[MFC_DEC_NUM_SRC_BUFS];                   /* information of source buffers */
+    char *mfc_dst_bufs[MFC_DEC_MAX_DST_BUFS][MFC_DEC_NUM_PLANES];   /* information of destination buffers */
+    char *mfc_dst_phys[MFC_DEC_MAX_DST_BUFS][MFC_DEC_NUM_PLANES];   /* cma information of destination buffers */
+
+    unsigned int mfc_src_bufs_len;                      /* needed for munmap */
+    unsigned int mfc_dst_bufs_len[MFC_DEC_NUM_PLANES];  /* needed for munmap */
+
+    unsigned int mfc_num_src_bufs;  /* the number of source buffers */
+    unsigned int mfc_num_dst_bufs;  /* the number of destination buffers */
+
+    char mfc_src_buf_flags[MFC_DEC_NUM_SRC_BUFS];
+    int bBeingFinalized;
+    int allocIndex;
+    int beingUsedIndex;
+};
+
+struct mfc_enc_v4l2 {
+    char *mfc_src_bufs[MFC_ENC_NUM_SRC_BUFS][MFC_ENC_NUM_PLANES];
+    char *mfc_src_phys[MFC_ENC_NUM_SRC_BUFS][MFC_ENC_NUM_PLANES];
+    char *mfc_dst_bufs[MFC_ENC_MAX_DST_BUFS];
+
+    unsigned int mfc_src_bufs_len[MFC_ENC_NUM_PLANES];
+    unsigned int mfc_dst_bufs_len;
+
+    unsigned int mfc_num_src_bufs;
+    unsigned int mfc_num_dst_bufs;
+
+    unsigned int mfc_dst_bufs_bytes_used_len;
+    char mfc_src_buf_flags[MFC_ENC_NUM_SRC_BUFS];
+    int bRunning;
+    int bInputPhyVir;               /* Flag to use MFC src as physical or virtual 0: virtual  1: physical */
+    int beingUsedIndex;
+};
+
+typedef struct {
+    int magic;
+    int hMFC;
+    int hVMEM;
+    int width;
+    int height;
+    int sizeStrmBuf;
+    struct mfc_frame_buf_arg sizeFrmBuf;
+    int displayStatus;
+    int inter_buff_status;
+    unsigned int virFreeStrmAddr;
+    unsigned int phyStrmBuf;
+    unsigned int virStrmBuf;
+    unsigned int virMvRefYC;
+    struct mfc_frame_buf_arg phyFrmBuf;
+    struct mfc_frame_buf_arg virFrmBuf;
+    unsigned int mapped_addr;
+    unsigned int mapped_size;
+    struct mfc_common_args MfcArg;
+    SSBSIP_MFC_CODEC_TYPE codecType;
+    SSBSIP_MFC_DEC_OUTPUT_INFO decOutInfo;
+    unsigned int inframetag;
+    unsigned int outframetagtop;
+    unsigned int outframetagbottom;
+    unsigned int immediatelydisp;
+    unsigned int encodedHeaderSize;
+    int encodedDataSize;
+    unsigned int encodedframeType;
+    struct mfc_frame_buf_arg encodedphyFrmBuf;
+
+    unsigned int dec_crc;
+    unsigned int dec_pixelcache;
+    unsigned int dec_slice;
+    unsigned int dec_numextradpb;
+
+    int input_cookie;
+    int input_secure_id;
+    int input_size;
+
+    /* to support non-blocking mode */
+    unsigned int encode_cnt;
+
+    struct mfc_dec_v4l2 v4l2_dec;
+    struct mfc_enc_v4l2 v4l2_enc;
+
+    int enc_frameskip;
+    int cacheablebuffer;
+    struct mfc_dec_fimv1_info fimv1_res;
+    SSBSIP_MFC_LAST_FRAME_STATUS lastframe;
+    SSBSIP_MFC_INSTRM_MODE_TYPE framemap;
+} _MFCLIB;
+
+#define ENC_PROFILE_LEVEL(profile, level)      ((profile) | ((level) << 8))
+#define ENC_RC_QBOUND(min_qp, max_qp)          ((min_qp) | ((max_qp) << 8))
+
+#define SSBSIP_MFC_FAIL                  (0)
+
+#endif /* __MFC_INTERFACE_H */
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos5/Android.mk b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/Android.mk
new file mode 100644
index 0000000..949c637
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/Android.mk
@@ -0,0 +1,7 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_VIDEO_PATH :=$(LOCAL_PATH)
+
+include    $(LOCAL_VIDEO_PATH)/mfc_v4l2/Android.mk
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/Android.mk b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/Android.mk
new file mode 100644
index 0000000..89f3e84
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/Android.mk
@@ -0,0 +1,39 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_COPY_HEADERS_TO := libsecmm
+LOCAL_COPY_HEADERS := \
+	include/mfc_errno.h \
+	include/mfc_interface.h \
+	include/SsbSipMfcApi.h
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	dec/src/SsbSipMfcDecAPI.c \
+	enc/src/SsbSipMfcEncAPI.c
+
+LOCAL_C_INCLUDES := \
+	$(LOCAL_PATH)/include \
+	$(BOARD_HAL_PATH)/include
+
+LOCAL_MODULE := libsecmfcapi
+
+LOCAL_PRELINK_MODULE := false
+
+ifeq ($(BOARD_USE_S3D_SUPPORT), true)
+LOCAL_CFLAGS += -DS3D_SUPPORT
+endif
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES :=
+LOCAL_SHARED_LIBRARIES := liblog
+
+#ifeq ($(BOARD_USE_V4L2_ION),true)
+#LOCAL_CFLAGS += -DUSE_ION
+#LOCAL_SHARED_LIBRARIES += libion
+#endif
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/dec/src/SsbSipMfcDecAPI.c b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/dec/src/SsbSipMfcDecAPI.c
new file mode 100644
index 0000000..fb04587
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/dec/src/SsbSipMfcDecAPI.c
@@ -0,0 +1,1740 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+#include <sys/poll.h>
+#include "videodev2.h"
+
+#include "mfc_interface.h"
+#include "SsbSipMfcApi.h"
+#ifdef USE_ION
+#include "ion.h"
+#endif
+
+/* #define LOG_NDEBUG 0 */
+#define LOG_TAG "MFC_DEC_APP"
+#include <utils/Log.h>
+
+/*#define CRC_ENABLE
+#define SLICE_MODE_ENABLE */
+#define POLL_DEC_WAIT_TIMEOUT 25
+
+#define USR_DATA_START_CODE (0x000001B2)
+#define VOP_START_CODE      (0x000001B6)
+#define MP4_START_CODE      (0x000001)
+
+#define DEFAULT_NUMBER_OF_EXTRA_DPB 5
+#define CLEAR(x)    memset (&(x), 0, sizeof(x))
+#ifdef S3D_SUPPORT
+#define OPERATE_BIT(x, mask, shift)    ((x & (mask << shift)) >> shift)
+#define FRAME_PACK_SEI_INFO_NUM  4
+#endif
+
+enum {
+    NV12MT_FMT = 0,
+    NV12M_FMT,
+    NV21M_FMT,
+};
+
+static char *mfc_dev_name = SAMSUNG_MFC_DEV_NAME;
+static int mfc_dev_node = 6;
+
+int read_header_data(void *openHandle);
+int init_mfc_output_stream(void *openHandle);
+int isBreak_loop(void *openHandle);
+
+int v4l2_mfc_querycap(int fd)
+{
+    struct v4l2_capability cap;
+    int ret;
+
+    CLEAR(cap);
+
+    ret = ioctl(fd, VIDIOC_QUERYCAP, &cap);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QUERYCAP failed", __func__);
+        return ret;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
+        LOGE("[%s] Device does not support capture", __func__);
+        return -1;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
+        LOGE("[%s] Device does not support output", __func__);
+        return -1;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
+        LOGE("[%s] Device does not support streaming", __func__);
+        return -1;
+    }
+
+    return 0;
+}
+
+int v4l2_mfc_s_fmt(int fd, enum v4l2_buf_type type,
+                    int pixelformat, unsigned int sizeimage, int width, int height)
+{
+    int ret;
+    struct v4l2_format fmt;
+
+    CLEAR(fmt);
+
+    fmt.type = type;
+
+    if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
+        switch (pixelformat) {
+        case H264_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
+            break;
+        case MPEG4_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG4;
+            break;
+        case H263_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H263;
+            break;
+        case XVID_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_XVID;
+            break;
+        case MPEG2_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG12;
+            break;
+        case FIMV1_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_FIMV1;
+            fmt.fmt.pix_mp.width = width;
+            fmt.fmt.pix_mp.height = height;
+            break;
+        case FIMV2_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_FIMV2;
+            break;
+        case FIMV3_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_FIMV3;
+            break;
+        case FIMV4_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_FIMV4;
+            break;
+        case VC1_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VC1;
+            break;
+        case VC1RCV_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VC1_RCV;
+            break;
+#if defined (MFC6x_VERSION)
+        case VP8_DEC:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VP8;
+            break;
+#endif
+        default:
+            LOGE("[%s] Does NOT support the codec type (%d)", __func__, pixelformat);
+            return -1;
+        }
+        fmt.fmt.pix_mp.plane_fmt[0].sizeimage = sizeimage;
+    } else if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
+        switch (pixelformat) {
+        case NV12MT_FMT:
+#if defined (MFC6x_VERSION)
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT_16X16;
+#else
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT;
+#endif
+            break;
+        case NV12M_FMT:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M;
+            break;
+        case NV21M_FMT:
+            fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV21M;
+            break;
+        default:
+            LOGE("[%s] Does NOT support the pixel format (%d)", __func__, pixelformat);
+            return -1;
+        }
+    } else {
+        LOGE("[%s] Wrong buffer type", __func__);
+        return -1;
+    }
+
+    ret = ioctl(fd, VIDIOC_S_FMT, &fmt);
+
+    return ret;
+}
+
+int v4l2_mfc_reqbufs(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int *buf_cnt)
+{
+    struct v4l2_requestbuffers reqbuf;
+    int ret;
+
+    CLEAR(reqbuf);
+
+    reqbuf.type = type;
+    reqbuf.memory = memory;
+    reqbuf.count = *buf_cnt;
+
+    ret = ioctl(fd, VIDIOC_REQBUFS, &reqbuf);
+    *buf_cnt = reqbuf.count;
+
+    return ret;
+}
+
+int v4l2_mfc_querybuf(int fd, struct v4l2_buffer *buf, enum v4l2_buf_type type,
+                        enum v4l2_memory memory, int index, struct v4l2_plane *planes)
+{
+    int length = -1, ret;
+
+    if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
+        length = 1;
+    else if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
+        length = 2;
+
+    CLEAR(*buf);
+    buf->type = type;
+    buf->memory = memory;
+    buf->index = index;
+    buf->m.planes = planes;
+    buf->length = length;
+
+    ret = ioctl(fd, VIDIOC_QUERYBUF, buf);
+
+    return ret;
+}
+
+int v4l2_mfc_streamon(int fd, enum v4l2_buf_type type)
+{
+    int ret;
+
+    ret = ioctl(fd, VIDIOC_STREAMON, &type);
+
+    return ret;
+}
+
+int v4l2_mfc_streamoff(int fd, enum v4l2_buf_type type)
+{
+    int ret;
+
+    ret = ioctl(fd, VIDIOC_STREAMOFF, &type);
+
+    return ret;
+}
+
+int v4l2_mfc_s_ctrl(int fd, int id, int value)
+{
+    struct v4l2_control ctrl;
+    int ret;
+
+    CLEAR(ctrl);
+    ctrl.id = id;
+    ctrl.value = value;
+
+    ret = ioctl(fd, VIDIOC_S_CTRL, &ctrl);
+
+    return ret;
+}
+
+int v4l2_mfc_g_ctrl(int fd, int id, int *value)
+{
+    struct v4l2_control ctrl;
+    int ret;
+
+    CLEAR(ctrl);
+    ctrl.id = id;
+
+    ret = ioctl(fd, VIDIOC_G_CTRL, &ctrl);
+    *value = ctrl.value;
+
+    return ret;
+}
+
+#ifdef S3D_SUPPORT
+int v4l2_mfc_ext_g_ctrl(int fd, SSBSIP_MFC_DEC_CONF conf_type, void *value)
+{
+    struct v4l2_ext_control ext_ctrl[FRAME_PACK_SEI_INFO_NUM];
+    struct v4l2_ext_controls ext_ctrls;
+    struct mfc_frame_pack_sei_info *sei_info;
+    int ret, i;
+
+    ext_ctrls.ctrl_class = V4L2_CTRL_CLASS_CODEC;
+
+    switch (conf_type) {
+    case MFC_DEC_GETCONF_FRAME_PACKING:
+        sei_info = (struct mfc_frame_pack_sei_info *)value;
+        for (i=0; i<FRAME_PACK_SEI_INFO_NUM; i++)
+            CLEAR(ext_ctrl[i]);
+
+        ext_ctrls.count = FRAME_PACK_SEI_INFO_NUM;
+        ext_ctrls.controls = ext_ctrl;
+        ext_ctrl[0].id =  V4L2_CID_CODEC_FRAME_PACK_SEI_AVAIL;
+        ext_ctrl[1].id =  V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_ID;
+        ext_ctrl[2].id =  V4L2_CID_CODEC_FRAME_PACK_SEI_INFO;
+        ext_ctrl[3].id =  V4L2_CID_CODEC_FRAME_PACK_GRID_POS;
+
+        ret = ioctl(fd, VIDIOC_G_EXT_CTRLS, &ext_ctrls);
+
+        sei_info->sei_avail = ext_ctrl[0].value;
+        sei_info->arrgment_id = ext_ctrl[1].value;
+        sei_info->sei_info = ext_ctrl[2].value;
+        sei_info->grid_pos = ext_ctrl[3].value;
+        break;
+    }
+
+    return ret;
+}
+#endif
+
+int v4l2_mfc_qbuf(int fd, struct v4l2_buffer *qbuf, enum v4l2_buf_type type,
+        enum v4l2_memory memory, int index,
+        struct v4l2_plane *planes, int frame_length)
+{
+    int ret, length = 0;
+
+    if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
+        CLEAR(*qbuf);
+        length = 1;
+    } else if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
+        length = 2;
+    }
+
+    qbuf->type = type;
+    qbuf->memory = memory;
+    qbuf->index = index;
+    qbuf->m.planes = planes;
+    qbuf->length = length;
+    qbuf->m.planes[0].bytesused = frame_length;
+
+    ret = ioctl(fd, VIDIOC_QBUF, qbuf);
+
+    return ret;
+}
+
+int v4l2_mfc_dqbuf(int fd, struct v4l2_buffer *dqbuf, enum v4l2_buf_type type,
+                    enum v4l2_memory memory)
+{
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+    int ret, length = 0;
+
+    CLEAR(*dqbuf);
+    if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
+        length = 1;
+    else if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
+        length = 2;
+
+    dqbuf->type = type;
+    dqbuf->memory = memory;
+    dqbuf->m.planes = planes;
+    dqbuf->length = length;
+
+    ret = ioctl(fd, VIDIOC_DQBUF, dqbuf);
+
+    return ret;
+}
+
+int v4l2_mfc_g_fmt(int fd, struct v4l2_format *fmt, enum v4l2_buf_type type)
+{
+    int ret;
+
+    CLEAR(*fmt);
+    fmt->type = type;
+    ret = ioctl(fd, VIDIOC_G_FMT, fmt);
+
+    return ret;
+}
+
+int v4l2_mfc_g_crop(int fd, struct v4l2_crop *crop, enum v4l2_buf_type type)
+{
+    int ret;
+
+    CLEAR(*crop);
+    crop->type = type;
+    ret = ioctl(fd, VIDIOC_G_CROP, crop);
+
+    return ret;
+}
+
+int v4l2_mfc_poll(int fd, int *revents, int timeout)
+{
+    struct pollfd poll_events;
+    int ret;
+
+    poll_events.fd = fd;
+    poll_events.events = POLLOUT | POLLERR;
+    poll_events.revents = 0;
+
+    ret = poll((struct pollfd*)&poll_events, 1, timeout);
+    *revents = poll_events.revents;
+
+    return ret;
+}
+
+static void getAByte(char *buff, int *code)
+{
+    int byte;
+
+    *code = (*code << 8);
+    byte = (int)*buff;
+    byte &= 0xFF;
+    *code |= byte;
+}
+
+static int isPBPacked(_MFCLIB *pCtx, int Frameleng)
+{
+    char *strmBuffer = NULL;
+    int startCode = 0xFFFFFFFF;
+    int leng_idx = 1;
+
+    strmBuffer = (char*)pCtx->virStrmBuf;
+
+    while (1) {
+        while (startCode != USR_DATA_START_CODE) {
+            if ((startCode == VOP_START_CODE) || (leng_idx == Frameleng)) {
+                LOGI("[%s] VOP START Found !!.....return",__func__);
+                LOGW("[%s] Non Packed PB",__func__);
+                return 0;
+            }
+            getAByte(strmBuffer, &startCode);
+            LOGV(">> StartCode = 0x%08x <<\n", startCode);
+            strmBuffer++;
+            leng_idx++;
+        }
+        LOGI("[%s] User Data Found !!",__func__);
+
+        do {
+            if (*strmBuffer == 'p') {
+                LOGW("[%s] Packed PB",__func__);
+                return 1;
+            }
+            getAByte(strmBuffer, &startCode);
+            strmBuffer++; leng_idx++;
+        } while ((leng_idx <= Frameleng) && ((startCode >> 8) != MP4_START_CODE));
+
+        if (leng_idx > Frameleng)
+            break;
+    }
+
+    LOGW("[%s] Non Packed PB",__func__);
+
+    return 0;
+}
+
+static void getMFCName(char *devicename, int size)
+{
+    snprintf(devicename, size, "%s%d", SAMSUNG_MFC_DEV_NAME, mfc_dev_node);
+}
+
+void SsbSipMfcDecSetMFCNode(int devicenode)
+{
+    mfc_dev_node = devicenode;
+}
+
+void SsbSipMfcDecSetMFCName(char *devicename)
+{
+    mfc_dev_name = devicename;
+}
+
+void *SsbSipMfcDecOpen(void)
+{
+    int hMFCOpen;
+    _MFCLIB *pCTX;
+    char mfc_dev_name[64];
+
+    int ret;
+    int req_count;
+    unsigned int i, j;
+
+    struct v4l2_buffer buf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+
+    LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
+
+    pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
+    if (pCTX == NULL) {
+        LOGE("[%s] malloc failed.",__func__);
+        return NULL;
+    }
+
+    memset(pCTX, 0, sizeof(_MFCLIB));
+
+    getMFCName(mfc_dev_name, 64);
+    LOGI("[%s] dev name is %s",__func__,mfc_dev_name);
+
+    if (access(mfc_dev_name, F_OK) != 0) {
+        LOGE("[%s] MFC device node not exists",__func__);
+        goto error_case1;
+    }
+
+    hMFCOpen = open(mfc_dev_name, O_RDWR|O_NONBLOCK, 0);
+    if (hMFCOpen < 0) {
+        LOGE("[%s] Failed to open MFC device",__func__);
+        goto error_case1;
+    }
+
+    pCTX->hMFC = hMFCOpen;
+
+    ret = v4l2_mfc_querycap(pCTX->hMFC);
+    if (ret != 0) {
+        LOGE("[%s] QUERYCAP failed", __func__);
+        goto error_case2;
+    }
+
+    pCTX->inter_buff_status = MFC_USE_NONE;
+    ret = v4l2_mfc_s_fmt(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+                                H264_DEC, MAX_DECODER_INPUT_BUFFER_SIZE, 0, 0);
+    if (ret != 0) {
+        LOGE("[%s] S_FMT failed",__func__);
+        goto error_case2;
+    }
+
+    pCTX->v4l2_dec.mfc_src_bufs_len = MAX_DECODER_INPUT_BUFFER_SIZE;
+
+    req_count = MFC_DEC_NUM_SRC_BUFS;
+    ret = v4l2_mfc_reqbufs(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+                            V4L2_MEMORY_MMAP, &req_count);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_REQBUFS failed",__func__);
+        goto error_case2;
+    }
+
+    pCTX->v4l2_dec.mfc_num_src_bufs = req_count;
+
+    for (i = 0; i < pCTX->v4l2_dec.mfc_num_src_bufs; ++i) {
+        ret = v4l2_mfc_querybuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+                                V4L2_MEMORY_MMAP, i, planes);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QUERYBUF failed",__func__);
+            goto error_case3;
+        }
+
+        pCTX->v4l2_dec.mfc_src_bufs[i] = mmap(NULL, buf.m.planes[0].length,
+        PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
+        if (pCTX->v4l2_dec.mfc_src_bufs[i] == MAP_FAILED) {
+            LOGE("[%s] mmap failed (%d)",__func__,i);
+            goto error_case3;
+        }
+    }
+    pCTX->inter_buff_status |= MFC_USE_STRM_BUFF;
+
+    /* set extra DPB size to 5 as default for optimal performce (heuristic method) */
+    pCTX->dec_numextradpb = DEFAULT_NUMBER_OF_EXTRA_DPB;
+
+    pCTX->v4l2_dec.bBeingFinalized = 0;
+    pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_NOT_RECEIVED;
+
+    pCTX->cacheablebuffer = NO_CACHE;
+
+    for (i = 0; i<MFC_DEC_NUM_SRC_BUFS; i++)
+        pCTX->v4l2_dec.mfc_src_buf_flags[i] = BUF_DEQUEUED;
+
+    pCTX->v4l2_dec.beingUsedIndex = 0;
+
+    return (void *) pCTX;
+
+error_case3:
+    for (j = 0; j < i; j++)
+        munmap(pCTX->v4l2_dec.mfc_src_bufs[j], pCTX->v4l2_dec.mfc_src_bufs_len);
+error_case2:
+    close(pCTX->hMFC);
+error_case1:
+    free(pCTX);
+
+    return NULL;
+}
+
+void *SsbSipMfcDecOpenExt(void *value)
+{
+    _MFCLIB *pCTX;
+
+    pCTX = SsbSipMfcDecOpen();
+
+    if (pCTX == NULL)
+        return NULL;
+
+    if (NO_CACHE == (*(SSBIP_MFC_BUFFER_TYPE *)value)) {
+        pCTX->cacheablebuffer = NO_CACHE;
+        LOGI("[%s] non cacheable buffer",__func__);
+    } else {
+        pCTX->cacheablebuffer = CACHE;
+        LOGI("[%s] cacheable buffer",__func__);
+    }
+
+    return (void *)pCTX;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
+{
+    int ret, i;
+    _MFCLIB  *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    if (pCTX->inter_buff_status & MFC_USE_DST_STREAMON) {
+        ret = v4l2_mfc_streamoff(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
+            return MFC_RET_CLOSE_FAIL;
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
+    }
+
+    if (pCTX->inter_buff_status & MFC_USE_SRC_STREAMON) {
+        ret = v4l2_mfc_streamoff(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMOFF failed (source buffers)",__func__);
+            return MFC_RET_CLOSE_FAIL;
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_SRC_STREAMON);
+    }
+
+    if (pCTX->inter_buff_status & MFC_USE_STRM_BUFF) {
+        for (i = 0; i < pCTX->v4l2_dec.mfc_num_src_bufs; i++)
+            munmap(pCTX->v4l2_dec.mfc_src_bufs[i], pCTX->v4l2_dec.mfc_src_bufs_len);
+        pCTX->inter_buff_status &= ~(MFC_USE_STRM_BUFF);
+    }
+
+    if (pCTX->inter_buff_status & MFC_USE_YUV_BUFF) {
+        for (i = 0; i < pCTX->v4l2_dec.mfc_num_dst_bufs; i++) {
+            munmap(pCTX->v4l2_dec.mfc_dst_bufs[i][0], pCTX->v4l2_dec.mfc_dst_bufs_len[0]);
+            munmap(pCTX->v4l2_dec.mfc_dst_bufs[i][1], pCTX->v4l2_dec.mfc_dst_bufs_len[1]);
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_YUV_BUFF);
+    }
+
+#ifdef USE_ION
+    ion_client_destroy(pCTX->ion_fd);
+#endif
+    close(pCTX->hMFC);
+    free(pCTX);
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE codec_type, int Frameleng)
+{
+    int packedPB = 0;
+    _MFCLIB *pCTX;
+    int ret;
+
+    int width, height;
+    int ctrl_value;
+
+    struct v4l2_buffer buf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+
+    int poll_state, poll_revents;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    pCTX->codecType = codec_type;
+
+    if ((pCTX->codecType == MPEG4_DEC) || (pCTX->codecType == XVID_DEC) ||
+    (pCTX->codecType == FIMV1_DEC) || (pCTX->codecType == FIMV2_DEC) ||
+    (pCTX->codecType == FIMV3_DEC) || (pCTX->codecType == FIMV4_DEC))
+        packedPB = isPBPacked(pCTX, Frameleng);
+
+    if (pCTX->codecType == FIMV1_DEC) {
+        width = pCTX->fimv1_res.width;
+        height = pCTX->fimv1_res.height;
+    } else {
+        width = 0;
+        height = 0;
+    }
+    ret = v4l2_mfc_s_fmt(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, pCTX->codecType,
+                            MAX_DECODER_INPUT_BUFFER_SIZE, width, height);
+    if (ret != 0) {
+        LOGE("[%s] S_FMT failed", __func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    /* Set default destination format as NV12MT */
+    ret = v4l2_mfc_s_fmt(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, NV12MT_FMT,
+                            0, width, height);
+    if (ret != 0) {
+        LOGE("[%s] S_FMT failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    /* PackedPB should be set after VIDIOC_S_FMT */
+    if (packedPB) {
+        ret = v4l2_mfc_s_ctrl(pCTX->hMFC, V4L2_CID_CODEC_PACKED_PB, 1);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_S_CTRL failed of PACKED_PB\n", __func__);
+            return MFC_RET_DEC_SET_CONF_FAIL;
+        }
+    }
+
+    ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+                    V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, Frameleng);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    /* Processing the header requires running streamon
+     on OUTPUT queue */
+    ret = v4l2_mfc_streamon(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_STREAMON failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+    pCTX->inter_buff_status |= MFC_USE_SRC_STREAMON;
+
+    ret = read_header_data(pCTX);
+    if (ret != 0)
+        goto error_case1;
+
+    /* cacheable buffer */
+    if (pCTX->cacheablebuffer == NO_CACHE)
+        ctrl_value = 0;
+    else
+        ctrl_value = 1;
+
+    ret = v4l2_mfc_s_ctrl(pCTX->hMFC, V4L2_CID_CACHEABLE, ctrl_value);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE", __func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+#ifdef USE_ION
+    pCTX->ion_fd = ion_client_create();
+    if (pCTX->ion_fd < 3) {
+        LOGE("[%s] Failed to get ion_fd : %d", __func__, pCTX->ion_fd);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+#endif
+
+    ret = init_mfc_output_stream(pCTX);
+    if (ret != 0)
+        goto error_case1;
+
+    ret = v4l2_mfc_streamon(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_STREAMON failed (destination buffers)", __func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+    pCTX->inter_buff_status |= MFC_USE_DST_STREAMON;
+
+    do {
+        poll_state = v4l2_mfc_poll(pCTX->hMFC, &poll_revents, POLL_DEC_WAIT_TIMEOUT);
+        if (poll_state > 0) {
+            if (poll_revents & POLLOUT) {
+                ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_MMAP);
+                if (ret == 0)
+                    break;
+            } else if (poll_revents & POLLERR) {
+                LOGE("[%s] POLLERR\n", __func__);
+                return MFC_GETOUTBUF_STATUS_NULL;
+            } else {
+                LOGE("[%s] poll() returns 0x%x\n", __func__, poll_revents);
+                return MFC_GETOUTBUF_STATUS_NULL;
+            }
+        } else if (poll_state < 0) {
+            return MFC_GETOUTBUF_STATUS_NULL;
+        }
+    } while (poll_state == 0);
+
+    return MFC_RET_OK;
+
+error_case1:
+    SsbSipMfcDecClose(openHandle);
+    return ret;
+}
+
+int read_header_data(void *openHandle)
+{
+    struct v4l2_format fmt;
+    struct v4l2_crop crop;
+    struct v4l2_pix_format_mplane pix_mp;
+    int ctrl_value;
+    int ret;
+
+    _MFCLIB *pCTX;
+    pCTX  = (_MFCLIB *) openHandle;
+
+    ret = v4l2_mfc_g_fmt(pCTX->hMFC, &fmt, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_G_FMT failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case;
+    }
+
+    pix_mp = fmt.fmt.pix_mp;
+    pCTX->decOutInfo.buf_width = pix_mp.plane_fmt[0].bytesperline;
+    pCTX->decOutInfo.buf_height =
+        pix_mp.plane_fmt[0].sizeimage / pix_mp.plane_fmt[0].bytesperline;
+
+    pCTX->decOutInfo.img_width = pix_mp.width;
+    pCTX->decOutInfo.img_height = pix_mp.height;
+
+    ret = v4l2_mfc_g_crop(pCTX->hMFC, &crop, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_G_CROP failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case;
+    }
+
+    pCTX->decOutInfo.crop_left_offset = crop.c.left;
+    pCTX->decOutInfo.crop_top_offset = crop.c.top;
+    pCTX->decOutInfo.crop_right_offset =
+        pix_mp.width - crop.c.width - crop.c.left;
+    pCTX->decOutInfo.crop_bottom_offset =
+        pix_mp.height - crop.c.height - crop.c.top;
+
+    ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_REQ_NUM_BUFS, &ctrl_value);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_G_CTRL failed",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case;
+    }
+
+    pCTX->v4l2_dec.mfc_num_dst_bufs = ctrl_value + pCTX->dec_numextradpb;
+
+    LOGV("[%s] Num of allocated buffers: %d\n",__func__, pCTX->v4l2_dec.mfc_num_dst_bufs);
+
+    return 0;
+
+error_case:
+    return ret;
+    }
+
+/* Initialize output stream of MFC */
+int init_mfc_output_stream(void *openHandle)
+{
+    struct v4l2_buffer buf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+    int ret;
+    int i, j;
+    _MFCLIB *pCTX;
+    pCTX  = (_MFCLIB *) openHandle;
+
+    ret = v4l2_mfc_reqbufs(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+                    V4L2_MEMORY_MMAP, (int *)&pCTX->v4l2_dec.mfc_num_dst_bufs);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_REQBUFS failed (destination buffers)",__func__);
+        ret = MFC_RET_DEC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    for (i = 0;  i < pCTX->v4l2_dec.mfc_num_dst_bufs; ++i) {
+        ret = v4l2_mfc_querybuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+                        V4L2_MEMORY_MMAP, i, planes);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QUERYBUF failed (destination buffers)",__func__);
+            ret = MFC_RET_DEC_INIT_FAIL;
+            goto error_case1;
+        }
+
+        pCTX->v4l2_dec.mfc_dst_bufs_len[0] = buf.m.planes[0].length;
+        pCTX->v4l2_dec.mfc_dst_bufs_len[1] = buf.m.planes[1].length;
+
+        pCTX->v4l2_dec.mfc_dst_phys[i][0] = buf.m.planes[0].cookie;
+        pCTX->v4l2_dec.mfc_dst_phys[i][1] = buf.m.planes[1].cookie;
+
+#ifdef USE_ION
+        pCTX->dst_ion_fd[i][0] = (int)buf.m.planes[0].share;
+        pCTX->dst_ion_fd[i][1] = (int)buf.m.planes[1].share;
+
+        pCTX->v4l2_dec.mfc_dst_bufs[i][0] =
+            ion_map(pCTX->dst_ion_fd[i][0],pCTX->v4l2_dec.mfc_dst_bufs_len[0],0);
+        pCTX->v4l2_dec.mfc_dst_bufs[i][1] =
+            ion_map(pCTX->dst_ion_fd[i][1],pCTX->v4l2_dec.mfc_dst_bufs_len[1],0);
+        if (pCTX->v4l2_dec.mfc_dst_bufs[i][0] == MAP_FAILED ||
+            pCTX->v4l2_dec.mfc_dst_bufs[i][0] == MAP_FAILED)
+            goto error_case2;
+#else
+        pCTX->v4l2_dec.mfc_dst_bufs[i][0] = mmap(NULL, buf.m.planes[0].length,
+             PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
+        if (pCTX->v4l2_dec.mfc_dst_bufs[i][0] == MAP_FAILED) {
+            LOGE("[%s] mmap failed (destination buffers (Y))",__func__);
+            ret = MFC_RET_DEC_INIT_FAIL;
+            goto error_case2;
+        }
+
+        pCTX->v4l2_dec.mfc_dst_bufs[i][1] = mmap(NULL, buf.m.planes[1].length,
+        PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, buf.m.planes[1].m.mem_offset);
+        if (pCTX->v4l2_dec.mfc_dst_bufs[i][1] == MAP_FAILED) {
+            LOGE("[%s] mmap failed (destination buffers (UV))",__func__);
+            ret = MFC_RET_DEC_INIT_FAIL;
+            goto error_case2;
+        }
+#endif
+
+        ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+                        V4L2_MEMORY_MMAP, i, planes, 0);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+            ret = MFC_RET_DEC_INIT_FAIL;
+            goto error_case2;
+        }
+    }
+    pCTX->inter_buff_status |= MFC_USE_YUV_BUFF;
+
+    return 0;
+
+error_case2:
+    for (j = 0; j < i; j++) {
+        munmap(pCTX->v4l2_dec.mfc_dst_bufs[j][0], pCTX->v4l2_dec.mfc_dst_bufs_len[0]);
+        munmap(pCTX->v4l2_dec.mfc_dst_bufs[j][1], pCTX->v4l2_dec.mfc_dst_bufs_len[1]);
+    }
+error_case1:
+    return ret;
+}
+
+int resolution_change(void *openHandle)
+{
+    int i, ret;
+    int req_count;
+    _MFCLIB *pCTX;
+    pCTX  = (_MFCLIB *) openHandle;
+
+    ret = v4l2_mfc_streamoff(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+    if (ret != 0)
+        goto error_case;
+
+    pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
+
+    for (i = 0; i < pCTX->v4l2_dec.mfc_num_dst_bufs; i++) {
+        munmap(pCTX->v4l2_dec.mfc_dst_bufs[i][0], pCTX->v4l2_dec.mfc_dst_bufs_len[0]);
+        munmap(pCTX->v4l2_dec.mfc_dst_bufs[i][1], pCTX->v4l2_dec.mfc_dst_bufs_len[1]);
+    }
+    pCTX->inter_buff_status &= ~(MFC_USE_YUV_BUFF);
+
+    req_count = 0;
+    ret = v4l2_mfc_reqbufs(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+                    V4L2_MEMORY_MMAP, &req_count);
+    if (ret != 0)
+        goto error_case;
+
+    read_header_data(pCTX);
+    init_mfc_output_stream(pCTX);
+
+    ret = v4l2_mfc_streamon(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+    if (ret != 0)
+        goto error_case;
+    pCTX->inter_buff_status |= MFC_USE_DST_STREAMON;
+
+    return 0;
+
+error_case:
+    return ret;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
+{
+    _MFCLIB *pCTX;
+    int ret;
+
+    struct v4l2_buffer buf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+    int loop_count, ctrl_value;
+
+    int poll_state;
+    int poll_revents;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
+        LOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    if ((lengthBufFill > 0) && (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe)) {
+        if (pCTX->displayStatus != MFC_GETOUTBUF_DISPLAY_ONLY) {
+            /* Queue the stream frame */
+            ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+                                V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, lengthBufFill);
+            if (ret != 0) {
+                LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+                return MFC_RET_DEC_EXE_ERR;
+            }
+
+            memset(&buf, 0, sizeof(buf));
+            buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+            buf.memory = V4L2_MEMORY_MMAP;
+            buf.m.planes = planes;
+            buf.length = 1;
+
+            /* wait for decoding */
+            do {
+                poll_state = v4l2_mfc_poll(pCTX->hMFC, &poll_revents, POLL_DEC_WAIT_TIMEOUT);
+                if (poll_state > 0) {
+                    if (poll_revents & POLLOUT) {
+                        ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_MMAP);
+                        if (ret == 0) {
+                            if (buf.flags & V4L2_BUF_FLAG_ERROR)
+                                return MFC_RET_DEC_EXE_ERR;
+                            pCTX->v4l2_dec.mfc_src_buf_flags[buf.index] = BUF_DEQUEUED;
+                            break;
+                        }
+                    } else if (poll_revents & POLLERR) {
+                        LOGE("[%s] POLLERR\n",__func__);
+                        return MFC_RET_DEC_EXE_ERR;
+                    } else {
+                        LOGE("[%s] poll() returns 0x%x\n", __func__, poll_revents);
+                        return MFC_RET_DEC_EXE_ERR;
+                    }
+                } else if (poll_state < 0) {
+                    return MFC_RET_DEC_EXE_ERR;
+                }
+
+                if (isBreak_loop(pCTX))
+                    break;
+
+            } while(0 == poll_state);
+        }
+
+        ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
+        if (ret != 0) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DECODING_ONLY;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return MFC_RET_OK;
+        } else {
+            ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_DISPLAY_STATUS, &ctrl_value);
+            if (ret != 0) {
+                LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
+                return MFC_RET_DEC_GET_CONF_FAIL;
+            }
+
+            switch (ctrl_value) {
+            case 0:
+                pCTX->displayStatus = MFC_GETOUTBUF_DECODING_ONLY;
+                break;
+            case 1:
+                pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_DECODING;
+                break;
+            case 2:
+                pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+                break;
+            case 3:
+                pCTX->displayStatus = MFC_GETOUTBUF_CHANGE_RESOL;
+                break;
+            }
+        }
+
+        if (pCTX->displayStatus == MFC_GETOUTBUF_CHANGE_RESOL) {
+            resolution_change(pCTX);
+        } else {
+            pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][0];
+            pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][1];
+
+            pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][0];
+            pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][1];
+        }
+
+        if (SSBSIP_MFC_LAST_FRAME_RECEIVED == pCTX->lastframe)
+            pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_PROCESSED;
+
+    } else if (pCTX->v4l2_dec.bBeingFinalized == 0) {
+        pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_PROCESSED;
+        pCTX->v4l2_dec.bBeingFinalized = 1; /* true */
+
+        /* Queue the stream frame */
+        ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+                            V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, 0);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_DEC_EXE_ERR;
+        }
+
+        /* wait for decoding */
+        loop_count = 0;
+        do {
+            ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
+            if (ret != 0)
+                usleep(1000);
+            loop_count++;
+            if (loop_count >= 1000) {
+                LOGE("[%s] Error in do-while loop",__func__);
+                break;
+            }
+        } while (ret != 0);
+
+        ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_DISPLAY_STATUS, &ctrl_value);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
+            return MFC_RET_DEC_EXE_ERR;
+        }
+        if (ctrl_value == 3) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_END;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return MFC_RET_OK;
+        }
+
+        pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][1];
+    } else {
+        loop_count = 0;
+        do {
+            ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
+            if (ret != 0)
+                usleep(1000);
+            loop_count++;
+            if (loop_count >= 1000) {
+                LOGE("[%s] Error in do-while loop",__func__);
+                break;
+            }
+        } while (ret != 0);
+
+        if (buf.m.planes[0].bytesused == 0) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_END;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return MFC_RET_OK;
+        } else {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+        }
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][1];
+    }
+
+    pCTX->decOutInfo.disp_pic_frame_type = (buf.flags & (0x7 << 3));
+
+    switch (pCTX->decOutInfo.disp_pic_frame_type) {
+    case V4L2_BUF_FLAG_KEYFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 1;
+        break;
+    case V4L2_BUF_FLAG_PFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 2;
+        break;
+    case V4L2_BUF_FLAG_BFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 3;
+        break;
+    default:
+        pCTX->decOutInfo.disp_pic_frame_type = 0;
+        break;
+    }
+
+    ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP,
+                        buf.index, planes, 0);
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
+{
+    _MFCLIB *pCTX;
+    int ret;
+
+    struct v4l2_buffer buf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
+        LOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    if ((lengthBufFill > 0) && (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe)
+                            && (pCTX->displayStatus != MFC_GETOUTBUF_DISPLAY_ONLY)) {
+        /* Queue the stream frame */
+        ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+                            V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, lengthBufFill);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_DEC_EXE_ERR;
+        }
+    } else if (pCTX->v4l2_dec.bBeingFinalized == 0) {
+        /* Queue the stream frame */
+        ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+                            V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, 0);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_DEC_EXE_ERR;
+        }
+    }
+
+    if ((SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe) && (lengthBufFill == 0))
+        pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_RECEIVED;
+
+    return MFC_RET_OK;
+}
+
+int isBreak_loop(void *openHandle)
+{
+    _MFCLIB *pCTX;
+    pCTX  = (_MFCLIB *) openHandle;
+    int ctrl_value;
+    int ret = 0;
+
+    if (pCTX->displayStatus == MFC_GETOUTBUF_DISPLAY_ONLY)
+        return 1;
+
+    ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_CHECK_STATE, &ctrl_value);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
+        return 0;
+    }
+
+    if (ctrl_value == MFCSTATE_DEC_RES_DETECT) {
+        LOGV("[%s] Resolution Change detect",__func__);
+        return 1;
+    } else if (ctrl_value == MFCSTATE_DEC_TERMINATING) {
+        LOGV("[%s] Decoding Finish!!!",__func__);
+        return 1;
+    }
+
+    return 0;
+}
+
+SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info)
+{
+    _MFCLIB *pCTX;
+    int ret;
+
+    struct v4l2_buffer buf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+    int loop_count, ctrl_value;
+
+    int poll_state;
+    int poll_revents;
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    if (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe) {
+        if (pCTX->displayStatus != MFC_GETOUTBUF_DISPLAY_ONLY) {
+            /* wait for decoding */
+            do {
+                poll_state = v4l2_mfc_poll(pCTX->hMFC, &poll_revents, POLL_DEC_WAIT_TIMEOUT);
+                if (poll_state > 0) {
+                    if (poll_revents & POLLOUT) {
+                        buf.m.planes = planes;
+                        buf.length = 1;
+                        ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_MMAP);
+                        if (ret == 0) {
+                            if (buf.flags & V4L2_BUF_FLAG_ERROR)
+                                return MFC_GETOUTBUF_STATUS_NULL;
+                            pCTX->v4l2_dec.mfc_src_buf_flags[buf.index] = BUF_DEQUEUED;
+                            break;
+                        }
+                    } else if (poll_revents & POLLERR) {
+                        LOGE("[%s] POLLERR\n",__func__);
+                        return MFC_GETOUTBUF_STATUS_NULL;
+                    } else {
+                        LOGE("[%s] poll() returns 0x%x\n", __func__, poll_revents);
+                        return MFC_GETOUTBUF_STATUS_NULL;
+                    }
+                } else if (poll_state < 0) {
+                    return MFC_GETOUTBUF_STATUS_NULL;
+                }
+
+                if (isBreak_loop(pCTX))
+                    break;
+
+            } while (0 == poll_state);
+        }
+
+        ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
+        if (ret != 0) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DECODING_ONLY;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return SsbSipMfcDecGetOutBuf(pCTX, output_info);;
+        } else {
+            ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_DISPLAY_STATUS, &ctrl_value);
+            if (ret != 0) {
+                LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
+                return MFC_RET_DEC_GET_CONF_FAIL;
+            }
+
+            switch (ctrl_value) {
+            case 0:
+                pCTX->displayStatus = MFC_GETOUTBUF_DECODING_ONLY;
+                break;
+            case 1:
+                pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_DECODING;
+                break;
+            case 2:
+                pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+                break;
+            case 3:
+                pCTX->displayStatus = MFC_GETOUTBUF_CHANGE_RESOL;
+                break;
+            }
+        }
+
+        if (pCTX->displayStatus == MFC_GETOUTBUF_CHANGE_RESOL) {
+            resolution_change(pCTX);
+        } else {
+            pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][0];
+            pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][1];
+
+            pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][0];
+            pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][1];
+        }
+
+        if (SSBSIP_MFC_LAST_FRAME_RECEIVED == pCTX->lastframe)
+            pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_PROCESSED;
+    } else if (pCTX->v4l2_dec.bBeingFinalized == 0) {
+        pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_PROCESSED;
+        pCTX->v4l2_dec.bBeingFinalized = 1; /* true */
+
+        /* wait for decoding */
+        loop_count = 0;
+        do {
+            ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
+            if (ret != 0)
+                usleep(1000);
+            loop_count++;
+            if (loop_count >= 1000) {
+                LOGE("[%s] Error in do-while loop",__func__);
+                break;
+            }
+        } while (ret != 0);
+
+        ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_DISPLAY_STATUS, &ctrl_value);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
+            return MFC_RET_DEC_GET_CONF_FAIL;
+        }
+        if (ctrl_value == 3) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_END;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return SsbSipMfcDecGetOutBuf(pCTX, output_info);;
+        }
+
+        pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][1];
+    } else {
+        loop_count = 0;
+        do {
+            ret = v4l2_mfc_dqbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
+            if (ret != 0)
+                usleep(1000);
+            loop_count++;
+            if (loop_count >= 1000) {
+                LOGE("[%s] Error in do-while loop",__func__);
+                break;
+            }
+        } while (ret != 0);
+
+        if (buf.m.planes[0].bytesused == 0) {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_END;
+            pCTX->decOutInfo.disp_pic_frame_type = -1;
+            return SsbSipMfcDecGetOutBuf(pCTX, output_info);;
+        } else {
+            pCTX->displayStatus = MFC_GETOUTBUF_DISPLAY_ONLY;
+        }
+
+        pCTX->decOutInfo.YVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][0];
+        pCTX->decOutInfo.CVirAddr = pCTX->v4l2_dec.mfc_dst_bufs[buf.index][1];
+
+        pCTX->decOutInfo.YPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][0];
+        pCTX->decOutInfo.CPhyAddr = (unsigned int)pCTX->v4l2_dec.mfc_dst_phys[buf.index][1];
+    }
+
+    pCTX->decOutInfo.disp_pic_frame_type = (buf.flags & (0x7 << 3));
+
+    switch (pCTX->decOutInfo.disp_pic_frame_type) {
+    case V4L2_BUF_FLAG_KEYFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 1;
+        break;
+    case V4L2_BUF_FLAG_PFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 2;
+        break;
+    case V4L2_BUF_FLAG_BFRAME:
+        pCTX->decOutInfo.disp_pic_frame_type = 3;
+        break;
+    default:
+        pCTX->decOutInfo.disp_pic_frame_type = 0;
+        break;
+    }
+
+    ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP,
+                        buf.index, planes, 0);
+
+    return SsbSipMfcDecGetOutBuf(pCTX, output_info);
+}
+
+void  *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSize)
+{
+    _MFCLIB *pCTX;
+    int i;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return NULL;
+    }
+
+    if ((inputBufferSize < 0) || (inputBufferSize > MAX_DECODER_INPUT_BUFFER_SIZE)) {
+        LOGE("[%s] inputBufferSize = %d is invalid",__func__, inputBufferSize);
+        return NULL;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    for (i = 0; i < MFC_DEC_NUM_SRC_BUFS; i++)
+        if (BUF_DEQUEUED == pCTX->v4l2_dec.mfc_src_buf_flags[i])
+            break;
+
+    if (i == MFC_DEC_NUM_SRC_BUFS) {
+        LOGV("[%s] No buffer is available.",__func__);
+        return NULL;
+    } else {
+        pCTX->virStrmBuf = (unsigned int)pCTX->v4l2_dec.mfc_src_bufs[i];
+        pCTX->v4l2_dec.beingUsedIndex = i;
+        /* Set the buffer flag as Enqueued for NB_mode_process*/
+        /* FIXME: Check this assignment in case of using New API ExeNb() */
+        pCTX->v4l2_dec.mfc_src_buf_flags[i] = BUF_ENQUEUED;
+    }
+
+    return (void *)pCTX->virStrmBuf;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, void *virInBuf, int size)
+{
+    _MFCLIB *pCTX;
+    int i;
+
+    LOGV("[%s] Enter",__func__);
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    for (i = 0; i < MFC_DEC_NUM_SRC_BUFS; i++) {
+        if (pCTX->v4l2_dec.mfc_src_bufs[i] == virInBuf)
+            break;
+    }
+
+    if (i == MFC_DEC_NUM_SRC_BUFS) {
+        LOGE("[%s] Can not use the buffer",__func__);
+        return MFC_RET_INVALID_PARAM;
+    } else {
+        pCTX->virStrmBuf = (unsigned int)virInBuf;
+        pCTX->v4l2_dec.beingUsedIndex = i;
+        pCTX->v4l2_dec.mfc_src_buf_flags[i] = BUF_ENQUEUED;
+    }
+    LOGV("[%s] Exit idx %d",__func__,pCTX->v4l2_dec.beingUsedIndex);
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info)
+{
+    _MFCLIB *pCTX;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_GETOUTBUF_DISPLAY_END;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    output_info->YPhyAddr = pCTX->decOutInfo.YPhyAddr;
+    output_info->CPhyAddr = pCTX->decOutInfo.CPhyAddr;
+
+    output_info->YVirAddr = pCTX->decOutInfo.YVirAddr;
+    output_info->CVirAddr = pCTX->decOutInfo.CVirAddr;
+
+    output_info->img_width = pCTX->decOutInfo.img_width;
+    output_info->img_height= pCTX->decOutInfo.img_height;
+
+    output_info->buf_width = pCTX->decOutInfo.buf_width;
+    output_info->buf_height= pCTX->decOutInfo.buf_height;
+
+    output_info->crop_right_offset =  pCTX->decOutInfo.crop_right_offset;
+    output_info->crop_left_offset =  pCTX->decOutInfo.crop_left_offset;
+    output_info->crop_bottom_offset = pCTX->decOutInfo.crop_bottom_offset;
+    output_info->crop_top_offset = pCTX->decOutInfo.crop_top_offset;
+
+    output_info->disp_pic_frame_type = pCTX->decOutInfo.disp_pic_frame_type;
+
+    switch (pCTX->displayStatus) {
+    case MFC_GETOUTBUF_DISPLAY_ONLY:
+    case MFC_GETOUTBUF_DISPLAY_DECODING:
+    case MFC_GETOUTBUF_DISPLAY_END:
+    case MFC_GETOUTBUF_DECODING_ONLY:
+    case MFC_GETOUTBUF_CHANGE_RESOL:
+        break;
+    default:
+        return MFC_GETOUTBUF_DISPLAY_END;
+    }
+
+    return pCTX->displayStatus;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value)
+{
+    int ret, i;
+
+    _MFCLIB *pCTX;
+    struct mfc_dec_fimv1_info *fimv1_res;
+
+    struct v4l2_buffer buf;
+    struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
+
+    int id, ctrl_value;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if ((value == NULL) && (MFC_DEC_SETCONF_IS_LAST_FRAME !=conf_type)) {
+        LOGE("[%s] value is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    /* First, process non-ioctl calling settings */
+    switch (conf_type) {
+    case MFC_DEC_SETCONF_EXTRA_BUFFER_NUM:
+        pCTX->dec_numextradpb = *((unsigned int *) value);
+        return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT: /* be set before calling SsbSipMfcDecInit */
+         fimv1_res = (struct mfc_dec_fimv1_info *)value;
+         LOGI("fimv1->width  = %d\n", fimv1_res->width);
+         LOGI("fimv1->height = %d\n", fimv1_res->height);
+         pCTX->fimv1_res.width  = (int)(fimv1_res->width);
+         pCTX->fimv1_res.height = (int)(fimv1_res->height);
+         return MFC_RET_OK;
+
+    case MFC_DEC_SETCONF_IS_LAST_FRAME:
+        if (SSBSIP_MFC_LAST_FRAME_PROCESSED != pCTX->lastframe) {
+            pCTX->lastframe = SSBSIP_MFC_LAST_FRAME_RECEIVED;
+            return MFC_RET_OK;
+        } else {
+            return MFC_RET_FAIL;
+        }
+
+    case MFC_DEC_SETCONF_DPB_FLUSH:
+        ret = v4l2_mfc_streamoff(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
+            return MFC_RET_DEC_SET_CONF_FAIL;
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
+
+        for (i = 0;  i < pCTX->v4l2_dec.mfc_num_dst_bufs; ++i) {
+            ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+                        V4L2_MEMORY_MMAP, i, planes, 0);
+            if (ret != 0) {
+                LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+                return MFC_RET_DEC_SET_CONF_FAIL;
+            }
+        }
+
+        ret = v4l2_mfc_streamon(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMON failed (destination buffers)",__func__);
+            return MFC_RET_DEC_SET_CONF_FAIL;
+        }
+        pCTX->inter_buff_status |= MFC_USE_DST_STREAMON;
+        return MFC_RET_OK;
+    default:
+        /* Others will be processed next */
+        break;
+    }
+
+    /* Process ioctl calling settings */
+    switch (conf_type) {
+    case MFC_DEC_SETCONF_DISPLAY_DELAY: /* be set before calling SsbSipMfcDecInit */
+        id = V4L2_CID_CODEC_DISPLAY_DELAY;
+        ctrl_value = *((unsigned int *) value);
+        break;
+
+    case MFC_DEC_SETCONF_CRC_ENABLE:
+        id = V4L2_CID_CODEC_CRC_ENABLE;
+        ctrl_value = 1;
+        break;
+
+    case MFC_DEC_SETCONF_SLICE_ENABLE:
+        id = V4L2_CID_CODEC_SLICE_INTERFACE;
+        ctrl_value = 1;
+        break;
+
+    case MFC_DEC_SETCONF_FRAME_TAG: /*be set before calling SsbSipMfcDecExe */
+        id = V4L2_CID_CODEC_FRAME_TAG;
+        ctrl_value = *((unsigned int*)value);
+        break;
+
+    case MFC_DEC_SETCONF_POST_ENABLE:
+        id = V4L2_CID_CODEC_LOOP_FILTER_MPEG4_ENABLE;
+        ctrl_value = *((unsigned int*)value);
+        break;
+#ifdef S3D_SUPPORT
+    case MFC_DEC_SETCONF_SEI_PARSE:
+        id = V4L2_CID_CODEC_FRAME_PACK_SEI_PARSE;
+        ctrl_value = 1;
+        break;
+#endif
+    default:
+        LOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    ret = v4l2_mfc_s_ctrl(pCTX->hMFC, id, ctrl_value);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_S_CTRL failed (conf_type = %d)",__func__, conf_type);
+        return MFC_RET_DEC_SET_CONF_FAIL;
+    }
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value)
+{
+    _MFCLIB *pCTX;
+
+    SSBSIP_MFC_IMG_RESOLUTION *img_resolution;
+    int ret;
+    SSBSIP_MFC_CRC_DATA *crc_data;
+#ifdef S3D_SUPPORT
+    SSBSIP_MFC_FRAME_PACKING *frame_packing;
+    struct mfc_frame_pack_sei_info sei_info;
+#endif
+    SSBSIP_MFC_CROP_INFORMATION *crop_information;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if (value == NULL) {
+        LOGE("[%s] value is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    switch (conf_type) {
+    case MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT:
+        img_resolution = (SSBSIP_MFC_IMG_RESOLUTION *)value;
+        img_resolution->width = pCTX->decOutInfo.img_width;
+        img_resolution->height = pCTX->decOutInfo.img_height;
+        img_resolution->buf_width = pCTX->decOutInfo.buf_width;
+        img_resolution->buf_height = pCTX->decOutInfo.buf_height;
+        break;
+
+    case MFC_DEC_GETCONF_FRAME_TAG:
+        ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_FRAME_TAG, (int*)value);
+        if (ret != 0)
+            LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_FRAME_TAG", __func__);
+        break;
+
+    case MFC_DEC_GETCONF_CRC_DATA:
+        crc_data = (SSBSIP_MFC_CRC_DATA *) value;
+
+        ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_CRC_DATA_LUMA, &crc_data->luma0);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_LUMA",__func__);
+            return MFC_RET_DEC_GET_CONF_FAIL;
+        }
+
+        ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_CRC_DATA_CHROMA, &crc_data->chroma0);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_CHROMA",__func__);
+            return MFC_RET_DEC_GET_CONF_FAIL;
+        }
+        LOGI("[%s] crc_data->luma0=0x%x\n", __func__, crc_data->luma0);
+        LOGI("[%s] crc_data->chroma0=0x%x\n", __func__, crc_data->chroma0);
+        break;
+#ifdef S3D_SUPPORT
+    case MFC_DEC_GETCONF_FRAME_PACKING:
+        frame_packing = (SSBSIP_MFC_FRAME_PACKING *)value;
+
+        ret = v4l2_mfc_ext_g_ctrl(pCTX->hMFC, conf_type, &sei_info);
+        if (ret != 0) {
+            printf("Error to do ext_g_ctrl.\n");
+        }
+        frame_packing->available = sei_info.sei_avail;
+        frame_packing->arrangement_id = sei_info.arrgment_id;
+
+        frame_packing->arrangement_cancel_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 0);
+        frame_packing->arrangement_type = OPERATE_BIT(sei_info.sei_info, 0x3f, 1);
+        frame_packing->quincunx_sampling_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 8);
+        frame_packing->content_interpretation_type = OPERATE_BIT(sei_info.sei_info, 0x3f, 9);
+        frame_packing->spatial_flipping_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 15);
+        frame_packing->frame0_flipped_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 16);
+        frame_packing->field_views_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 17);
+        frame_packing->current_frame_is_frame0_flag = OPERATE_BIT(sei_info.sei_info, 0x1, 18);
+
+        frame_packing->frame0_grid_pos_x = OPERATE_BIT(sei_info.sei_info, 0xf, 0);
+        frame_packing->frame0_grid_pos_y = OPERATE_BIT(sei_info.sei_info, 0xf, 4);
+        frame_packing->frame1_grid_pos_x = OPERATE_BIT(sei_info.sei_info, 0xf, 8);
+        frame_packing->frame1_grid_pos_y = OPERATE_BIT(sei_info.sei_info, 0xf, 12);
+        break;
+#endif
+    case MFC_DEC_GETCONF_CROP_INFO:
+        crop_information = (SSBSIP_MFC_CROP_INFORMATION *)value;
+        crop_information->crop_top_offset = pCTX->decOutInfo.crop_top_offset;
+        crop_information->crop_bottom_offset = pCTX->decOutInfo.crop_bottom_offset;
+        crop_information->crop_left_offset = pCTX->decOutInfo.crop_left_offset;
+        crop_information->crop_right_offset = pCTX->decOutInfo.crop_right_offset;
+        break;
+
+    default:
+        LOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    return MFC_RET_OK;
+}
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/enc/src/SsbSipMfcEncAPI.c b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/enc/src/SsbSipMfcEncAPI.c
new file mode 100644
index 0000000..2333b6c
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/enc/src/SsbSipMfcEncAPI.c
@@ -0,0 +1,1506 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+#include <sys/poll.h>
+#include "videodev2.h"
+
+#include "mfc_interface.h"
+#include "SsbSipMfcApi.h"
+
+/* #define LOG_NDEBUG 0 */
+#define LOG_TAG "MFC_ENC_APP"
+#include <utils/Log.h>
+
+#define POLL_ENC_WAIT_TIMEOUT 25
+
+#ifndef true
+#define true  (1)
+#endif
+
+#ifndef false
+#define false (0)
+#endif
+
+#define MAX_STREAM_SIZE (2*1024*1024)
+
+static char *mfc_dev_name = SAMSUNG_MFC_DEV_NAME;
+static int mfc_dev_node = 7;
+
+#if defined (MFC5x_VERSION)
+#define H263_CTRL_NUM   19
+#define MPEG4_CTRL_NUM  27
+#define H264_CTRL_NUM   50
+#elif defined (MFC6x_VERSION)
+#define H263_CTRL_NUM   20
+#define MPEG4_CTRL_NUM  28
+#define H264_CTRL_NUM   67
+#endif
+
+
+static void getMFCName(char *devicename, int size)
+{
+    snprintf(devicename, size, "%s%d", SAMSUNG_MFC_DEV_NAME, mfc_dev_node);
+}
+
+void SsbSipMfcEncSetMFCName(char *devicename)
+{
+    mfc_dev_name = devicename;
+}
+
+void *SsbSipMfcEncOpen(void)
+{
+    int hMFCOpen;
+    _MFCLIB *pCTX;
+
+    char mfc_dev_name[64];
+
+    int ret;
+    struct v4l2_capability cap;
+
+    LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
+    getMFCName(mfc_dev_name, 64);
+    LOGI("[%s] dev name is %s\n",__func__,mfc_dev_name);
+
+    if (access(mfc_dev_name, F_OK) != 0) {
+        LOGE("[%s] MFC device node not exists",__func__);
+        return NULL;
+    }
+
+    hMFCOpen = open(mfc_dev_name, O_RDWR | O_NONBLOCK, 0);
+    if (hMFCOpen < 0) {
+        LOGE("[%s] Failed to open MFC device",__func__);
+        return NULL;
+    }
+
+    pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
+    if (pCTX == NULL) {
+        LOGE("[%s] malloc failed.",__func__);
+        return NULL;
+    }
+    memset(pCTX, 0, sizeof(_MFCLIB));
+
+    pCTX->hMFC = hMFCOpen;
+
+    memset(&cap, 0, sizeof(cap));
+    ret = ioctl(pCTX->hMFC, VIDIOC_QUERYCAP, &cap);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QUERYCAP failed",__func__);
+        close(pCTX->hMFC);
+        free(pCTX);
+        return NULL;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
+        LOGE("[%s] Device does not support capture",__func__);
+        close(pCTX->hMFC);
+        free(pCTX);
+        return NULL;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
+        LOGE("[%s] Device does not support output",__func__);
+        close(pCTX->hMFC);
+        free(pCTX);
+        return NULL;
+    }
+
+    if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
+        LOGE("[%s] Device does not support streaming",__func__);
+        close(pCTX->hMFC);
+        free(pCTX);
+        return NULL;
+    }
+
+    pCTX->v4l2_enc.bRunning = 0;
+    /* physical address is used for Input source */
+    pCTX->v4l2_enc.bInputPhyVir = 1;
+
+    pCTX->cacheablebuffer = NO_CACHE;
+
+    return (void *)pCTX;
+}
+
+void *SsbSipMfcEncOpenExt(void *value)
+{
+    _MFCLIB *pCTX;
+
+    pCTX = SsbSipMfcEncOpen();
+    if (pCTX == NULL)
+        return NULL;
+
+    if (NO_CACHE == (*(SSBIP_MFC_BUFFER_TYPE *)value)) {
+        pCTX->cacheablebuffer = NO_CACHE;
+        /* physical address is used for Input source */
+        pCTX->v4l2_enc.bInputPhyVir = 1;
+        LOGI("[%s] non cacheable buffer",__func__);
+    }
+    else {
+        pCTX->cacheablebuffer = CACHE;
+        /* vitual address is used for Input source */
+        pCTX->v4l2_enc.bInputPhyVir = 0;
+        LOGI("[%s] cacheable buffer",__func__);
+    }
+
+    return (void *)pCTX;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
+{
+    _MFCLIB *pCTX;
+    int ret, i;
+
+    enum v4l2_buf_type type;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    if (pCTX->inter_buff_status & MFC_USE_DST_STREAMON) {
+        type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
+            return MFC_RET_CLOSE_FAIL;
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
+    }
+
+    if (pCTX->inter_buff_status & MFC_USE_SRC_STREAMON) {
+        type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMOFF failed (source buffers)",__func__);
+            return MFC_RET_CLOSE_FAIL;
+        }
+        pCTX->inter_buff_status &= ~(MFC_USE_SRC_STREAMON);
+    }
+
+    if (!pCTX->v4l2_enc.bInputPhyVir) {
+        for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++) {
+            munmap(pCTX->v4l2_enc.mfc_src_bufs[i][0], pCTX->v4l2_enc.mfc_src_bufs_len[0]);
+            munmap(pCTX->v4l2_enc.mfc_src_bufs[i][1], pCTX->v4l2_enc.mfc_src_bufs_len[1]);
+        }
+    }
+
+    for (i = 0; i < pCTX->v4l2_enc.mfc_num_dst_bufs; i++)
+        munmap(pCTX->v4l2_enc.mfc_dst_bufs[i], pCTX->v4l2_enc.mfc_dst_bufs_len);
+
+    pCTX->inter_buff_status = MFC_USE_NONE;
+
+    close(pCTX->hMFC);
+
+    free(pCTX);
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
+{
+    int ret, i, j,index;
+    _MFCLIB *pCTX;
+
+    enum v4l2_buf_type type;
+    struct v4l2_format fmt;
+    struct v4l2_plane planes[MFC_ENC_NUM_PLANES];
+
+    struct v4l2_buffer buf;
+    struct v4l2_requestbuffers reqbuf;
+
+    struct v4l2_control ctrl;
+
+    struct pollfd poll_events;
+    int poll_state;
+
+    struct v4l2_ext_control ext_ctrl_mpeg4[MPEG4_CTRL_NUM];
+    struct v4l2_ext_control ext_ctrl_h263[H263_CTRL_NUM];
+    struct v4l2_ext_control ext_ctrl[H264_CTRL_NUM];
+    struct v4l2_ext_controls ext_ctrls;
+
+    SSBSIP_MFC_ENC_H264_PARAM *h264_arg;
+    SSBSIP_MFC_ENC_MPEG4_PARAM *mpeg4_arg;
+    SSBSIP_MFC_ENC_H263_PARAM *h263_arg;
+
+    if (openHandle == NULL)
+        return MFC_RET_INVALID_PARAM;
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    mpeg4_arg = (SSBSIP_MFC_ENC_MPEG4_PARAM*)param;
+    if (mpeg4_arg->codecType == MPEG4_ENC) {
+        pCTX->codecType= MPEG4_ENC;
+        pCTX->width = mpeg4_arg->SourceWidth;
+        pCTX->height = mpeg4_arg->SourceHeight;
+        pCTX->framemap = mpeg4_arg->FrameMap;
+    } else {
+        h263_arg = (SSBSIP_MFC_ENC_H263_PARAM*)param;
+        if (h263_arg->codecType == H263_ENC) {
+            pCTX->codecType = H263_ENC;
+            pCTX->width = h263_arg->SourceWidth;
+            pCTX->height = h263_arg->SourceHeight;
+            pCTX->framemap = h263_arg->FrameMap;
+        } else {
+            h264_arg = (SSBSIP_MFC_ENC_H264_PARAM*)param;
+            if (h264_arg->codecType == H264_ENC) {
+                pCTX->codecType = H264_ENC;
+                pCTX->width = h264_arg->SourceWidth;
+                pCTX->height = h264_arg->SourceHeight;
+                pCTX->framemap = h264_arg->FrameMap;
+            } else {
+                LOGE("[%s] Undefined codec type \n",__func__);
+                ret = MFC_RET_INVALID_PARAM;
+                goto error_case1;
+            }
+        }
+    }
+
+    switch (pCTX->codecType) {
+    case MPEG4_ENC:
+        ext_ctrl_mpeg4[0].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_PROFILE;
+        ext_ctrl_mpeg4[0].value = mpeg4_arg->ProfileIDC;
+        ext_ctrl_mpeg4[1].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_LEVEL;
+        ext_ctrl_mpeg4[1].value = mpeg4_arg->LevelIDC;
+        ext_ctrl_mpeg4[2].id = V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE;
+        ext_ctrl_mpeg4[2].value = mpeg4_arg->IDRPeriod;
+        ext_ctrl_mpeg4[3].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_QUARTER_PIXEL;
+        ext_ctrl_mpeg4[3].value = mpeg4_arg->DisableQpelME;
+
+        ext_ctrl_mpeg4[4].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MODE;
+        ext_ctrl_mpeg4[4].value = mpeg4_arg->SliceMode; /* 0: one, 1: fixed #mb, 3: fixed #bytes */
+        if (mpeg4_arg->SliceMode == 0) {
+            ext_ctrl_mpeg4[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl_mpeg4[5].value = 1;  /* default */
+#if defined (MFC5x_VERSION)
+            ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl_mpeg4[6].value = 1900; /* default */
+#elif defined (MFC6x_VERSION)
+            ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl_mpeg4[6].value = 2800; /* based on MFC6.x */
+#endif
+        } else if (mpeg4_arg->SliceMode == 1) {
+            ext_ctrl_mpeg4[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl_mpeg4[5].value = mpeg4_arg->SliceArgument;
+#if defined (MFC5x_VERSION)
+            ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl_mpeg4[6].value = 1900; /* default */
+#elif defined (MFC6x_VERSION)
+            ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl_mpeg4[6].value = 2800; /* based on MFC6.x */
+#endif
+        } else if (mpeg4_arg->SliceMode == 3) {
+            ext_ctrl_mpeg4[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl_mpeg4[5].value = 1; /* default */
+            ext_ctrl_mpeg4[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl_mpeg4[6].value = mpeg4_arg->SliceArgument;
+        }
+        /*
+         * It should be set using mpeg4_arg->NumberBFrames after being handled by appl.
+         */
+        ext_ctrl_mpeg4[7].id =  V4L2_CID_CODEC_MFC5X_ENC_MPEG4_B_FRAMES;
+        ext_ctrl_mpeg4[7].value = mpeg4_arg->NumberBFrames;
+        ext_ctrl_mpeg4[8].id = V4L2_CID_CODEC_MFC5X_ENC_INTRA_REFRESH_MB;
+        ext_ctrl_mpeg4[8].value = mpeg4_arg->RandomIntraMBRefresh;
+
+        ext_ctrl_mpeg4[9].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CTRL_ENABLE;
+        ext_ctrl_mpeg4[9].value = mpeg4_arg->PadControlOn;
+        ext_ctrl_mpeg4[10].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_LUMA_VALUE;
+        ext_ctrl_mpeg4[10].value = mpeg4_arg->LumaPadVal;
+        ext_ctrl_mpeg4[11].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CB_VALUE;
+        ext_ctrl_mpeg4[11].value = mpeg4_arg->CbPadVal;
+        ext_ctrl_mpeg4[12].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CR_VALUE;
+        ext_ctrl_mpeg4[12].value = mpeg4_arg->CrPadVal;
+
+        ext_ctrl_mpeg4[13].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FRAME_ENABLE;
+        ext_ctrl_mpeg4[13].value = mpeg4_arg->EnableFRMRateControl;
+        ext_ctrl_mpeg4[14].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_VOP_TIME_RES;
+        ext_ctrl_mpeg4[14].value = mpeg4_arg->TimeIncreamentRes;
+        ext_ctrl_mpeg4[15].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_VOP_FRM_DELTA;
+        ext_ctrl_mpeg4[15].value = mpeg4_arg->VopTimeIncreament;
+        ext_ctrl_mpeg4[16].id = V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE;
+        ext_ctrl_mpeg4[16].value = mpeg4_arg->Bitrate;
+
+        ext_ctrl_mpeg4[17].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_FRAME_QP;
+        ext_ctrl_mpeg4[17].value = mpeg4_arg->FrameQp;
+        ext_ctrl_mpeg4[18].id =  V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_P_FRAME_QP;
+        ext_ctrl_mpeg4[18].value = mpeg4_arg->FrameQp_P;
+        ext_ctrl_mpeg4[19].id =  V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_B_FRAME_QP;
+        ext_ctrl_mpeg4[19].value = mpeg4_arg->FrameQp_B;
+
+        ext_ctrl_mpeg4[20].id =  V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MAX_QP;
+        ext_ctrl_mpeg4[20].value = mpeg4_arg->QSCodeMax;
+        ext_ctrl_mpeg4[21].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MIN_QP;
+        ext_ctrl_mpeg4[21].value = mpeg4_arg->QSCodeMin;
+        ext_ctrl_mpeg4[22].id = V4L2_CID_CODEC_MFC5X_ENC_RC_REACTION_COEFF;
+        ext_ctrl_mpeg4[22].value = mpeg4_arg->CBRPeriodRf;
+
+        if (V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL == pCTX->enc_frameskip) {
+            ext_ctrl_mpeg4[23].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_mpeg4[23].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL;
+        } else if (V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE == pCTX->enc_frameskip) {
+            ext_ctrl_mpeg4[23].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_mpeg4[23].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE;
+        } else { /* ENC_FRAME_SKIP_MODE_DISABLE (default) */
+            ext_ctrl_mpeg4[23].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_mpeg4[23].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_DISABLE;
+        }
+
+        ext_ctrl_mpeg4[24].id = V4L2_CID_CODEC_MFC5X_ENC_VBV_BUF_SIZE;
+        ext_ctrl_mpeg4[24].value = 0;
+
+        ext_ctrl_mpeg4[25].id = V4L2_CID_CODEC_MFC5X_ENC_SEQ_HDR_MODE;
+        ext_ctrl_mpeg4[25].value = 0;
+
+        ext_ctrl_mpeg4[26].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT;
+        ext_ctrl_mpeg4[26].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
+
+#if defined (MFC6x_VERSION)
+        ext_ctrl_mpeg4[27].id = V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MB_ENABLE; /* MFC 6.x Only */
+        ext_ctrl_mpeg4[27].value = mpeg4_arg->EnableMBRateControl;
+#endif
+        break;
+
+    case H263_ENC:
+        ext_ctrl_h263[0].id = V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE;
+        ext_ctrl_h263[0].value = h263_arg->IDRPeriod;
+
+        ext_ctrl_h263[1].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MODE;
+        ext_ctrl_h263[1].value = h263_arg->SliceMode; /* 0: one, Check is needed if h264 support multi-slice */
+
+        ext_ctrl_h263[2].id = V4L2_CID_CODEC_MFC5X_ENC_INTRA_REFRESH_MB;
+        ext_ctrl_h263[2].value = h263_arg->RandomIntraMBRefresh;
+
+        ext_ctrl_h263[3].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CTRL_ENABLE;
+        ext_ctrl_h263[3].value = h263_arg->PadControlOn;
+        ext_ctrl_h263[4].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_LUMA_VALUE;
+        ext_ctrl_h263[4].value = h263_arg->LumaPadVal;
+        ext_ctrl_h263[5].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CB_VALUE;
+        ext_ctrl_h263[5].value = h263_arg->CbPadVal;
+        ext_ctrl_h263[6].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CR_VALUE;
+        ext_ctrl_h263[6].value = h263_arg->CrPadVal;
+
+        ext_ctrl_h263[7].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FRAME_ENABLE;
+        ext_ctrl_h263[7].value = h263_arg->EnableFRMRateControl;
+
+        ext_ctrl_h263[8].id = V4L2_CID_CODEC_MFC5X_ENC_H263_RC_FRAME_RATE;
+        ext_ctrl_h263[8].value = h263_arg->FrameRate;
+
+        ext_ctrl_h263[9].id = V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE;
+        ext_ctrl_h263[9].value = h263_arg->Bitrate;
+
+        ext_ctrl_h263[10].id = V4L2_CID_CODEC_MFC5X_ENC_H263_RC_FRAME_QP;
+        ext_ctrl_h263[10].value = h263_arg->FrameQp;
+        ext_ctrl_h263[11].id =  V4L2_CID_CODEC_MFC5X_ENC_H263_RC_P_FRAME_QP;
+        ext_ctrl_h263[11].value = h263_arg->FrameQp_P;
+
+        ext_ctrl_h263[12].id =  V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MAX_QP;
+        ext_ctrl_h263[12].value = h263_arg->QSCodeMax;
+        ext_ctrl_h263[13].id = V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MIN_QP;
+        ext_ctrl_h263[13].value = h263_arg->QSCodeMin;
+        ext_ctrl_h263[14].id = V4L2_CID_CODEC_MFC5X_ENC_RC_REACTION_COEFF;
+        ext_ctrl_h263[14].value = h263_arg->CBRPeriodRf;
+
+        if (V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL == pCTX->enc_frameskip) {
+            ext_ctrl_h263[15].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_h263[15].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL;
+        } else if (V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE == pCTX->enc_frameskip) {
+            ext_ctrl_h263[15].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_h263[15].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE;
+        } else { /* ENC_FRAME_SKIP_MODE_DISABLE (default) */
+            ext_ctrl_h263[15].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl_h263[15].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_DISABLE;
+        }
+
+        ext_ctrl_h263[16].id = V4L2_CID_CODEC_MFC5X_ENC_VBV_BUF_SIZE;
+        ext_ctrl_h263[16].value = 0;
+
+        ext_ctrl_h263[17].id = V4L2_CID_CODEC_MFC5X_ENC_SEQ_HDR_MODE;
+        ext_ctrl_h263[17].value = 0;
+
+        ext_ctrl_h263[18].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT;
+        ext_ctrl_h263[18].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
+
+#if defined (MFC6x_VERSION)
+        ext_ctrl_h263[19].id = V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MB_ENABLE; /* MFC 6.x Only */
+        ext_ctrl_h263[19].value = h263_arg->EnableMBRateControl;
+#endif
+        break;
+
+    case H264_ENC:
+        ext_ctrl[0].id = V4L2_CID_CODEC_MFC5X_ENC_H264_PROFILE;
+        ext_ctrl[0].value = h264_arg->ProfileIDC;
+        ext_ctrl[1].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LEVEL;
+        ext_ctrl[1].value = h264_arg->LevelIDC;
+        ext_ctrl[2].id = V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE;
+        ext_ctrl[2].value = h264_arg->IDRPeriod;
+        ext_ctrl[3].id = V4L2_CID_CODEC_MFC5X_ENC_H264_MAX_REF_PIC;
+        ext_ctrl[3].value = h264_arg->NumberReferenceFrames;
+        ext_ctrl[4].id = V4L2_CID_CODEC_MFC5X_ENC_H264_NUM_REF_PIC_4P;
+        ext_ctrl[4].value = h264_arg->NumberRefForPframes;
+        ext_ctrl[5].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MODE;
+        ext_ctrl[5].value = h264_arg->SliceMode;  /* 0: one, 1: fixed #mb, 3: fixed #bytes */
+        if (h264_arg->SliceMode == 0) {
+            ext_ctrl[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl[6].value = 1;  /* default */
+#if defined (MFC5x_VERSION)
+            ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl[7].value = 1900; /* default */
+#elif defined (MFC6x_VERSION)
+            ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl[7].value = 2800; /* based on MFC6.x */
+#endif
+        } else if (h264_arg->SliceMode == 1) {
+            ext_ctrl[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl[6].value = h264_arg->SliceArgument;
+#if defined (MFC5x_VERSION)
+            ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl[7].value = 1900; /* default */
+#elif defined (MFC6x_VERSION)
+            ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl[7].value = 2800; /* based on MFC6.x */
+#endif
+        } else if (h264_arg->SliceMode == 3) {
+            ext_ctrl[6].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB;
+            ext_ctrl[6].value = 1; /* default */
+            ext_ctrl[7].id = V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT;
+            ext_ctrl[7].value = h264_arg->SliceArgument;
+        }
+        /*
+         * It should be set using h264_arg->NumberBFrames after being handled by appl.
+         */
+        ext_ctrl[8].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_B_FRAMES;
+        ext_ctrl[8].value = h264_arg->NumberBFrames;
+        ext_ctrl[9].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_MODE;
+        ext_ctrl[9].value = h264_arg->LoopFilterDisable;
+        ext_ctrl[10].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_ALPHA;
+        ext_ctrl[10].value = h264_arg->LoopFilterAlphaC0Offset;
+        ext_ctrl[11].id = V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_BETA;
+        ext_ctrl[11].value = h264_arg->LoopFilterBetaOffset;
+        ext_ctrl[12].id = V4L2_CID_CODEC_MFC5X_ENC_H264_ENTROPY_MODE;
+        ext_ctrl[12].value = h264_arg->SymbolMode;
+        ext_ctrl[13].id = V4L2_CID_CODEC_MFC5X_ENC_H264_INTERLACE;
+        ext_ctrl[13].value = h264_arg->PictureInterlace;
+        ext_ctrl[14].id = V4L2_CID_CODEC_MFC5X_ENC_H264_8X8_TRANSFORM;
+        ext_ctrl[14].value = h264_arg->Transform8x8Mode;
+        ext_ctrl[15].id = V4L2_CID_CODEC_MFC5X_ENC_INTRA_REFRESH_MB;
+        ext_ctrl[15].value = h264_arg->RandomIntraMBRefresh;
+        ext_ctrl[16].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CTRL_ENABLE;
+        ext_ctrl[16].value = h264_arg->PadControlOn;
+        ext_ctrl[17].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_LUMA_VALUE;
+        ext_ctrl[17].value = h264_arg->LumaPadVal;
+        ext_ctrl[18].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CB_VALUE;
+        ext_ctrl[18].value = h264_arg->CbPadVal;
+        ext_ctrl[19].id = V4L2_CID_CODEC_MFC5X_ENC_PAD_CR_VALUE;
+        ext_ctrl[19].value = h264_arg->CrPadVal;
+        ext_ctrl[20].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FRAME_ENABLE;
+        ext_ctrl[20].value = h264_arg->EnableFRMRateControl;
+        ext_ctrl[21].id = V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_ENABLE;
+        ext_ctrl[21].value = h264_arg->EnableMBRateControl;
+        ext_ctrl[22].id = V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_RATE;
+        ext_ctrl[22].value = h264_arg->FrameRate;
+        ext_ctrl[23].id = V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE;
+        /* FIXME temporary fix */
+        if (h264_arg->Bitrate)
+            ext_ctrl[23].value = h264_arg->Bitrate;
+        else
+            ext_ctrl[23].value = 1; /* just for testing Movi studio */
+        ext_ctrl[24].id = V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_QP;
+        ext_ctrl[24].value = h264_arg->FrameQp;
+        ext_ctrl[25].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_P_FRAME_QP;
+        ext_ctrl[25].value = h264_arg->FrameQp_P;
+        ext_ctrl[26].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_B_FRAME_QP;
+        ext_ctrl[26].value = h264_arg->FrameQp_B;
+        ext_ctrl[27].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MAX_QP;
+        ext_ctrl[27].value = h264_arg->QSCodeMax;
+        ext_ctrl[28].id = V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MIN_QP;
+        ext_ctrl[28].value = h264_arg->QSCodeMin;
+        ext_ctrl[29].id = V4L2_CID_CODEC_MFC5X_ENC_RC_REACTION_COEFF;
+        ext_ctrl[29].value = h264_arg->CBRPeriodRf;
+        ext_ctrl[30].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_DARK;
+        ext_ctrl[30].value = h264_arg->DarkDisable;
+        ext_ctrl[31].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_SMOOTH;
+        ext_ctrl[31].value = h264_arg->SmoothDisable;
+        ext_ctrl[32].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_STATIC;
+        ext_ctrl[32].value = h264_arg->StaticDisable;
+        ext_ctrl[33].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_ACTIVITY;
+        ext_ctrl[33].value = h264_arg->ActivityDisable;
+
+        /* doesn't have to be set */
+        ext_ctrl[34].id = V4L2_CID_CODEC_MFC5X_ENC_H264_OPEN_GOP;
+        ext_ctrl[34].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
+        ext_ctrl[35].id = V4L2_CID_CODEC_MFC5X_ENC_H264_I_PERIOD;
+        ext_ctrl[35].value = 10;
+
+        if (V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL == pCTX->enc_frameskip) {
+            ext_ctrl[36].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl[36].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL;
+        } else if (V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE == pCTX->enc_frameskip) {
+            ext_ctrl[36].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl[36].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE;
+        } else { /* ENC_FRAME_SKIP_MODE_DISABLE (default) */
+            ext_ctrl[36].id = V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE;
+            ext_ctrl[36].value = V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_DISABLE;
+        }
+
+        ext_ctrl[37].id = V4L2_CID_CODEC_MFC5X_ENC_VBV_BUF_SIZE;
+        ext_ctrl[37].value = 0;
+
+        ext_ctrl[38].id = V4L2_CID_CODEC_MFC5X_ENC_SEQ_HDR_MODE;
+        ext_ctrl[38].value = 0; /* 0: seperated header, 1: header + first frame */
+
+        ext_ctrl[39].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_ENABLE;
+        ext_ctrl[39].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
+        ext_ctrl[40].id = V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_IDC;
+        ext_ctrl[40].value = 0;
+        ext_ctrl[41].id = V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_WIDTH;
+        ext_ctrl[41].value = 0;
+        ext_ctrl[42].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_HEIGHT;
+        ext_ctrl[42].value = 0;
+
+        if (pCTX->hier_p_enable) {
+            ext_ctrl[43].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_HIER_P_ENABLE;
+            ext_ctrl[43].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
+            ext_ctrl[44].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER0_QP;
+            ext_ctrl[44].value = pCTX->hier_qp_value.t0_frame_qp;
+            ext_ctrl[45].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER1_QP;
+            ext_ctrl[45].value = pCTX->hier_qp_value.t2_frame_qp;
+            ext_ctrl[46].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER2_QP;
+            ext_ctrl[46].value = pCTX->hier_qp_value.t3_frame_qp;
+        } else {
+            ext_ctrl[43].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_HIER_P_ENABLE;
+            ext_ctrl[43].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
+            ext_ctrl[44].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER0_QP;
+            ext_ctrl[44].value = 0;
+            ext_ctrl[45].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER1_QP;
+            ext_ctrl[45].value = 0;
+            ext_ctrl[46].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER2_QP;
+            ext_ctrl[46].value = 0;
+            }
+#ifdef S3D_SUPPORT
+        if (pCTX->sei_info.sei_gen_enable) {
+            ext_ctrl[47].id =  V4L2_CID_CODEC_FRAME_PACK_FRM0_FLAG;
+            ext_ctrl[47].value = pCTX->sei_info.curr_frame_frm0_flag;
+            ext_ctrl[48].id =  V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_TYPE;
+            ext_ctrl[48].value = pCTX->sei_info.frame_pack_arrgment_type;
+        } else {
+            ext_ctrl[47].id =  V4L2_CID_CODEC_FRAME_PACK_FRM0_FLAG;
+            ext_ctrl[47].value = 0;
+            ext_ctrl[48].id =  V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_TYPE;
+            ext_ctrl[48].value = 3;
+        }
+#else
+        ext_ctrl[47].id =  V4L2_CID_CODEC_FRAME_PACK_FRM0_FLAG;
+        ext_ctrl[47].value = 0;
+        ext_ctrl[48].id =  V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_TYPE;
+        ext_ctrl[48].value = 3;
+#endif
+#if defined (MFC5x_VERSION)
+        ext_ctrl[49].id = V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT; /* MFC5.x Only */
+        ext_ctrl[49].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
+#elif defined (MFC6x_VERSION)
+        if (pCTX->fmo_enable) {
+            ext_ctrl[49].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_ENABLE;
+            ext_ctrl[49].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
+            ext_ctrl[50].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_MAP_TYPE;
+            ext_ctrl[50].value = pCTX->fmo_value.slice_map_type;
+            ext_ctrl[51].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SLICE_NUM;
+            ext_ctrl[51].value = pCTX->fmo_value.slice_num_grp;
+            if (pCTX->fmo_value.slice_map_type == 0) {
+                ext_ctrl[52].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN1;
+                ext_ctrl[53].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN2;
+                ext_ctrl[54].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN3;
+                ext_ctrl[55].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN4;
+            for (i = 0; i < pCTX->fmo_value.slice_num_grp; i++)
+                ext_ctrl[52+i].value = pCTX->fmo_value.run_length[i];
+            for (i = pCTX->fmo_value.slice_num_grp; i < 4; i++);
+                ext_ctrl[52+i].value = 1;
+            } else {
+                ext_ctrl[52].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN1;
+                ext_ctrl[52].value = 1;
+                ext_ctrl[53].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN2;
+                ext_ctrl[53].value = 1;
+                ext_ctrl[54].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN3;
+                ext_ctrl[54].value = 1;
+                ext_ctrl[55].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN4;
+                ext_ctrl[55].value = 1;
+            }
+            if (pCTX->fmo_value.slice_map_type == 4 || pCTX->fmo_value.slice_map_type == 5) {
+                ext_ctrl[56].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_DIR;
+                ext_ctrl[56].value = pCTX->fmo_value.sg_dir;
+                ext_ctrl[57].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_RATE;
+                ext_ctrl[57].value = pCTX->fmo_value.sg_rate;
+            } else {
+                ext_ctrl[56].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_DIR;
+                ext_ctrl[56].value = 0;
+                ext_ctrl[57].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_RATE;
+                ext_ctrl[57].value = 1;
+            }
+        } else {
+            ext_ctrl[49].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_ENABLE;
+            ext_ctrl[49].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
+            ext_ctrl[50].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_MAP_TYPE;
+            ext_ctrl[50].value = 0;
+            ext_ctrl[51].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SLICE_NUM;
+            ext_ctrl[51].value = 1;
+            ext_ctrl[52].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN1;
+            ext_ctrl[52].value = 1;
+            ext_ctrl[53].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN2;
+            ext_ctrl[53].value = 1;
+            ext_ctrl[54].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN3;
+            ext_ctrl[54].value = 1;
+            ext_ctrl[55].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN4;
+            ext_ctrl[55].value = 1;
+            ext_ctrl[56].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_DIR;
+            ext_ctrl[56].value = 0;
+            ext_ctrl[57].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_RATE;
+            ext_ctrl[57].value = 1;
+        }
+        if (pCTX->aso_enable) {
+            ext_ctrl[58].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_ENABLE;
+            ext_ctrl[58].value = V4L2_CODEC_MFC5X_ENC_SW_ENABLE;
+            ext_ctrl[59].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_0;
+            ext_ctrl[59].value = pCTX->aso_sl_order[0];
+            ext_ctrl[60].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_1;
+            ext_ctrl[60].value = pCTX->aso_sl_order[1];
+            ext_ctrl[61].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_2;
+            ext_ctrl[61].value = pCTX->aso_sl_order[2];
+            ext_ctrl[62].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_3;
+            ext_ctrl[62].value = pCTX->aso_sl_order[3];
+            ext_ctrl[63].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_4;
+            ext_ctrl[63].value = pCTX->aso_sl_order[4];
+            ext_ctrl[64].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_5;
+            ext_ctrl[64].value = pCTX->aso_sl_order[5];
+            ext_ctrl[65].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_6;
+            ext_ctrl[65].value = pCTX->aso_sl_order[6];
+            ext_ctrl[66].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_7;
+            ext_ctrl[66].value = pCTX->aso_sl_order[7];
+        } else {
+            ext_ctrl[58].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_ENABLE;
+            ext_ctrl[58].value = V4L2_CODEC_MFC5X_ENC_SW_DISABLE;
+            ext_ctrl[59].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_0;
+            ext_ctrl[59].value = 0;
+            ext_ctrl[60].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_1;
+            ext_ctrl[60].value = 0;
+            ext_ctrl[61].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_2;
+            ext_ctrl[61].value = 0;
+            ext_ctrl[62].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_3;
+            ext_ctrl[62].value = 0;
+            ext_ctrl[63].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_4;
+            ext_ctrl[63].value = 0;
+            ext_ctrl[64].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_5;
+            ext_ctrl[64].value = 0;
+            ext_ctrl[65].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_6;
+            ext_ctrl[65].value = 0;
+            ext_ctrl[66].id =  V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_7;
+            ext_ctrl[66].value = 0;
+        }
+#endif
+        break;
+
+    default:
+        LOGE("[%s] Undefined codec type",__func__);
+        ret = MFC_RET_INVALID_PARAM;
+        goto error_case1;
+    }
+
+    ext_ctrls.ctrl_class = V4L2_CTRL_CLASS_CODEC;
+    if (pCTX->codecType == MPEG4_ENC) {
+        ext_ctrls.count = MPEG4_CTRL_NUM;
+        ext_ctrls.controls = ext_ctrl_mpeg4;
+    } else if (pCTX->codecType == H264_ENC) {
+        ext_ctrls.count = H264_CTRL_NUM;
+        ext_ctrls.controls = ext_ctrl;
+    } else if (pCTX->codecType == H263_ENC) {
+        ext_ctrls.count = H263_CTRL_NUM;
+        ext_ctrls.controls = ext_ctrl_h263;
+    }
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_EXT_CTRLS, &ext_ctrls);
+    if (ret != 0) {
+        LOGE("[%s] Failed to set extended controls",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    memset(&fmt, 0, sizeof(fmt));
+    fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+
+    fmt.fmt.pix_mp.width = pCTX->width;
+    fmt.fmt.pix_mp.height = pCTX->height;
+    fmt.fmt.pix_mp.num_planes = 2;
+#if 0
+    fmt.fmt.pix_mp.plane_fmt[0].bytesperline = Align(fmt.fmt.pix_mp.width, 128);
+    fmt.fmt.pix_mp.plane_fmt[1].bytesperline = Align(fmt.fmt.pix_mp.width, 128);
+
+    if (NV12_TILE == pCTX->framemap) {
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT; /* 4:2:0, 2 Planes, 64x32 Tiles */
+        fmt.fmt.pix_mp.plane_fmt[0].sizeimage =
+            Align(Align(fmt.fmt.pix_mp.width, 128) * Align(fmt.fmt.pix_mp.height, 32), 8192); /* tiled mode */
+        fmt.fmt.pix_mp.plane_fmt[1].sizeimage =
+            Align(Align(fmt.fmt.pix_mp.width, 128) * Align(fmt.fmt.pix_mp.height >> 1, 32), 8192); /* tiled mode */
+    } else { /* NV12_LINEAR (default) */
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M; /* 4:2:0, 2 Planes, linear */
+        fmt.fmt.pix_mp.plane_fmt[0].sizeimage =
+            Align((fmt.fmt.pix_mp.width * fmt.fmt.pix_mp.height), 2048); /* linear mode, 2K align */
+        fmt.fmt.pix_mp.plane_fmt[1].sizeimage =
+            Align((fmt.fmt.pix_mp.width * (fmt.fmt.pix_mp.height >> 1)), 2048); /* linear mode, 2K align */
+    }
+#else   /* FIXME: */
+    if (NV12_TILE == pCTX->framemap) {
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT_16X16; /* 4:2:0, 2 Planes, 16x16 Tiles */
+    } else { /* NV12_LINEAR (default) */
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M; /* 4:2:0, 2 Planes, linear */
+    }
+#endif
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
+    if (ret != 0) {
+        LOGE("[%s] S_FMT failed on MFC output stream",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    /* capture (dst) */
+    memset(&fmt, 0, sizeof(fmt));
+
+    switch (pCTX->codecType) {
+    case H264_ENC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
+        break;
+    case MPEG4_ENC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_MPEG4;
+        break;
+    case H263_ENC:
+        fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H263;
+        break;
+    default:
+        LOGE("[%s] Codec has not been recognised",__func__);
+        return MFC_RET_ENC_INIT_FAIL;
+    }
+
+    fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    fmt.fmt.pix_mp.plane_fmt[0].sizeimage = MAX_STREAM_SIZE;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
+    if (ret != 0) {
+        LOGE("[%s] S_FMT failed on MFC output stream",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    /* cacheable buffer */
+    ctrl.id = V4L2_CID_CACHEABLE;
+    if (pCTX->cacheablebuffer == NO_CACHE)
+        ctrl.value = 0;
+    else
+        ctrl.value = 1;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+
+    /* Initialize streams for input */
+    memset(&reqbuf, 0, sizeof(reqbuf));
+    reqbuf.count  = MFC_ENC_NUM_SRC_BUFS;
+    reqbuf.type   = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    if (pCTX->v4l2_enc.bInputPhyVir)
+        reqbuf.memory = V4L2_MEMORY_USERPTR;
+    else
+        reqbuf.memory = V4L2_MEMORY_MMAP;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
+    if (ret != 0) {
+        LOGE("[%s] Reqbufs src ioctl failed",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case1;
+    }
+    pCTX->v4l2_enc.mfc_num_src_bufs  = reqbuf.count;
+
+    if (!pCTX->v4l2_enc.bInputPhyVir) {
+        /* Then the buffers have to be queried and mmaped */
+        for (i = 0;  i < pCTX->v4l2_enc.mfc_num_src_bufs; ++i) {
+            memset(&buf, 0, sizeof(buf));
+            buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+            buf.memory = V4L2_MEMORY_MMAP;
+            buf.index = i;
+            buf.m.planes = planes;
+            buf.length = 2;
+
+            ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
+            if (ret != 0) {
+                LOGE("[%s] Querybuf src ioctl failed",__func__);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case2;
+            }
+
+            pCTX->v4l2_enc.mfc_src_bufs_len[0] = buf.m.planes[0].length;
+            pCTX->v4l2_enc.mfc_src_bufs_len[1] = buf.m.planes[1].length;
+
+            pCTX->v4l2_enc.mfc_src_phys[i][0] = buf.m.planes[0].cookie;
+            pCTX->v4l2_enc.mfc_src_phys[i][1] = buf.m.planes[1].cookie;
+
+            pCTX->v4l2_enc.mfc_src_bufs[i][0] =
+                mmap(NULL, buf.m.planes[0].length, PROT_READ | PROT_WRITE,
+                MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
+            if (pCTX->v4l2_enc.mfc_src_bufs[i][0] == MAP_FAILED) {
+                LOGE("[%s] Mmap on src buffer (0) failed",__func__);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case2;
+            }
+
+            pCTX->v4l2_enc.mfc_src_bufs[i][1] =
+                mmap(NULL, buf.m.planes[1].length, PROT_READ | PROT_WRITE,
+                MAP_SHARED, pCTX->hMFC, buf.m.planes[1].m.mem_offset);
+            if (pCTX->v4l2_enc.mfc_src_bufs[i][1] == MAP_FAILED) {
+                munmap(pCTX->v4l2_enc.mfc_src_bufs[i][0], pCTX->v4l2_enc.mfc_src_bufs_len[0]);
+                LOGE("[%s] Mmap on src buffer (1) failed",__func__);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case2;
+            }
+        }
+    } else
+        LOGV("[%s] Camera Phys src buf %d",__func__,reqbuf.count);
+
+    for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++)
+        pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_DEQUEUED;
+
+    pCTX->v4l2_enc.beingUsedIndex = 0;
+
+    pCTX->sizeFrmBuf.luma = (unsigned int)(pCTX->width * pCTX->height);
+    pCTX->sizeFrmBuf.chroma = (unsigned int)((pCTX->width * pCTX->height) >> 1);
+    pCTX->inter_buff_status |= MFC_USE_YUV_BUFF;
+
+    /* Initialize stream for output */
+    memset(&reqbuf, 0, sizeof(reqbuf));
+    reqbuf.count  = MFC_ENC_MAX_DST_BUFS;
+    reqbuf.type   = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    reqbuf.memory = V4L2_MEMORY_MMAP;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
+    if (ret != 0) {
+        LOGE("[%s] Reqbufs dst ioctl failed",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case2;
+    }
+
+    pCTX->v4l2_enc.mfc_num_dst_bufs   = reqbuf.count;
+
+    for (i = 0; i < MFC_ENC_MAX_DST_BUFS; ++i) {
+        memset(&buf, 0, sizeof(buf));
+        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+        buf.memory = V4L2_MEMORY_MMAP;
+        buf.index = i;
+        buf.m.planes = planes;
+        buf.length = 1;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
+        if (ret != 0) {
+            LOGE("[%s] Querybuf dst ioctl failed",__func__);
+            ret = MFC_RET_ENC_INIT_FAIL;
+            goto error_case3;
+        }
+
+        pCTX->v4l2_enc.mfc_dst_bufs_len = buf.m.planes[0].length;
+        pCTX->v4l2_enc.mfc_dst_bufs[i] =
+                mmap(NULL, buf.m.planes[0].length, PROT_READ | PROT_WRITE,
+                MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
+        if (pCTX->v4l2_enc.mfc_dst_bufs[i] == MAP_FAILED) {
+            LOGE("[%s] Mmap on dst buffer failed",__func__);
+            ret = MFC_RET_ENC_INIT_FAIL;
+            goto error_case3;
+        }
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &buf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+            ret = MFC_RET_ENC_INIT_FAIL;
+            goto error_case3;
+        }
+    }
+
+    pCTX->sizeStrmBuf = MAX_ENCODER_OUTPUT_BUFFER_SIZE;
+    pCTX->inter_buff_status |= MFC_USE_STRM_BUFF;
+
+    type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
+    if (ret != 0) {
+        LOGE("[%s] V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, VIDIOC_STREAMON failed",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case3;
+    }
+
+    pCTX->inter_buff_status |= MFC_USE_DST_STREAMON;
+
+    memset(&buf, 0, sizeof(buf));
+    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    buf.memory = V4L2_MEMORY_MMAP;
+    buf.m.planes = planes;
+    buf.length = 1;
+
+    /* note: #define POLLOUT 0x0004 */
+    poll_events.fd = pCTX->hMFC;
+    poll_events.events = POLLIN | POLLERR;
+    poll_events.revents = 0;
+
+    /* wait for header encoding */
+    do {
+        poll_state = poll((struct pollfd*)&poll_events, 1, POLL_ENC_WAIT_TIMEOUT);
+        if (0 < poll_state) {
+            if (poll_events.revents & POLLIN) { /* POLLIN */
+                ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &buf);
+                if (ret == 0)
+                    break;
+            } else if (poll_events.revents & POLLERR) { /*POLLERR */
+                LOGE("[%s] POLLERR\n",__func__);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case3;
+            } else {
+                LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
+                ret = MFC_RET_ENC_INIT_FAIL;
+                goto error_case3;
+            }
+        } else if (0 > poll_state) {
+            ret = MFC_RET_ENC_INIT_FAIL;
+            goto error_case3;
+        }
+    } while (1 == poll_state);
+
+    pCTX->v4l2_enc.mfc_dst_bufs_bytes_used_len = buf.m.planes[0].bytesused;
+    pCTX->virStrmBuf = (unsigned int)pCTX->v4l2_enc.mfc_dst_bufs[buf.index];
+
+    /* stream dequeued index */
+    index = buf.index;
+    memset(&buf, 0, sizeof(buf));
+    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    buf.memory = V4L2_MEMORY_MMAP;
+    buf.index = index;
+    buf.m.planes = planes;
+    buf.length = 1;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &buf);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+        ret = MFC_RET_ENC_INIT_FAIL;
+        goto error_case3;
+    }
+    LOGV("[%s] Strm out idx %d",__func__,index);
+
+    return MFC_RET_OK;
+
+error_case3:
+    for (j = 0; j < i; j++)
+        munmap(pCTX->v4l2_enc.mfc_dst_bufs[j], pCTX->v4l2_enc.mfc_dst_bufs_len);
+
+    i = pCTX->v4l2_enc.mfc_num_src_bufs;
+error_case2:
+    if (!pCTX->v4l2_enc.bInputPhyVir) {
+        for (j = 0; j < i; j++) {
+            munmap(pCTX->v4l2_enc.mfc_src_bufs[j][0], pCTX->v4l2_enc.mfc_src_bufs_len[0]);
+            munmap(pCTX->v4l2_enc.mfc_src_bufs[j][1], pCTX->v4l2_enc.mfc_src_bufs_len[1]);
+        }
+    }
+error_case1:
+    return ret;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info)
+{
+    _MFCLIB *pCTX;
+    int i;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    /* FIXME check this if GetInBuf() is not called for UserPtr */
+    if (pCTX->v4l2_enc.bInputPhyVir) {
+        input_info->YPhyAddr = (void*)0;
+        input_info->CPhyAddr = (void*)0;
+        input_info->YVirAddr = (void*)0;
+        input_info->CVirAddr = (void*)0;
+
+        /* FIXME check whether Y & C sizes should be set or not*/
+        if (NV12_TILE == pCTX->framemap) {
+            /* 4:2:0, 2 Planes, 64x32 Tiles */
+            input_info->YSize = Align(Align(pCTX->width, 128) * Align(pCTX->height, 32), 8192); /* tiled mode */
+            input_info->CSize = Align(Align(pCTX->width, 128) * Align(pCTX->height >> 1, 32), 8192); /* tiled mode */
+        } else { /* NV12_LINEAR (default) */
+            /* 4:2:0, 2 Planes, linear */
+            input_info->YSize = Align(Align(pCTX->width, 16) * Align(pCTX->height, 16), 2048); /* width = 16B, height = 16B align */
+            input_info->CSize = Align(Align(pCTX->width, 16) * Align(pCTX->height >> 1, 8), 2048); /* width = 16B, height = 8B align */
+        }
+    } else {
+        for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++)
+            if (BUF_DEQUEUED == pCTX->v4l2_enc.mfc_src_buf_flags[i])
+                break;
+
+        if (i == pCTX->v4l2_enc.mfc_num_src_bufs) {
+            LOGV("[%s] No buffer is available.",__func__);
+            return MFC_RET_ENC_GET_INBUF_FAIL;
+        } else {
+            input_info->YPhyAddr = (void*)pCTX->v4l2_enc.mfc_src_phys[i][0];
+            input_info->CPhyAddr = (void*)pCTX->v4l2_enc.mfc_src_phys[i][1];
+            input_info->YVirAddr = (void*)pCTX->v4l2_enc.mfc_src_bufs[i][0];
+            input_info->CVirAddr = (void*)pCTX->v4l2_enc.mfc_src_bufs[i][1];
+            input_info->YSize = (int)pCTX->v4l2_enc.mfc_src_bufs_len[0];
+            input_info->CSize = (int)pCTX->v4l2_enc.mfc_src_bufs_len[1];
+
+            pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_ENQUEUED;
+        }
+    }
+    LOGV("[%s] Input Buffer idx %d",__func__,i);
+    return MFC_RET_OK;
+}
+
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info)
+{
+    _MFCLIB *pCTX;
+    struct v4l2_buffer qbuf;
+    struct v4l2_plane planes[MFC_ENC_NUM_PLANES];
+    int ret,i;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    memset(&qbuf, 0, sizeof(qbuf));
+    if (pCTX->v4l2_enc.bInputPhyVir) {
+        qbuf.memory = V4L2_MEMORY_USERPTR;
+        qbuf.index = pCTX->v4l2_enc.beingUsedIndex;
+        planes[0].m.userptr = (unsigned long)input_info->YPhyAddr;
+        planes[0].length = input_info->YSize;
+        planes[0].bytesused = input_info->YSize;
+        planes[1].m.userptr = (unsigned long)input_info->CPhyAddr;
+        planes[1].length = input_info->CSize;
+        planes[1].bytesused = input_info->CSize;
+
+        /* FIXME, this is only for case of not using B frame,
+        Camera side should know which buffer is queued() refering to index of
+        MFC dqbuf() */
+        pCTX->v4l2_enc.beingUsedIndex++;
+        pCTX->v4l2_enc.beingUsedIndex %= MFC_ENC_NUM_SRC_BUFS;
+        LOGV("[%s] Phy Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
+    } else {
+        for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++)
+            if (pCTX->v4l2_enc.mfc_src_bufs[i][0] == input_info->YVirAddr)
+                break;
+
+        if (i == pCTX->v4l2_enc.mfc_num_src_bufs) {
+            LOGE("[%s] Can not use the buffer",__func__);
+            return MFC_RET_INVALID_PARAM;
+        } else {
+            pCTX->v4l2_enc.beingUsedIndex = i;
+            //pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_ENQUEUED;
+        }
+        qbuf.memory = V4L2_MEMORY_MMAP;
+        qbuf.index = pCTX->v4l2_enc.beingUsedIndex;
+        planes[0].bytesused = pCTX->width * pCTX->height;
+        planes[1].bytesused = (pCTX->width * pCTX->height) >> 1;
+        LOGV("[%s] Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
+    }
+
+    qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    qbuf.m.planes = planes;
+    qbuf.length = 2;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+        return MFC_RET_ENC_SET_INBUF_FAIL;
+    }
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUTPUT_INFO *output_info)
+{
+    _MFCLIB *pCTX;
+    struct v4l2_control ctrl;
+    unsigned int encoded_y_addr, encoded_c_addr;
+    int ret;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    if (pCTX->v4l2_enc.bRunning == 0) {
+        pCTX->encodedHeaderSize = pCTX->v4l2_enc.mfc_dst_bufs_bytes_used_len;
+        output_info->dataSize = 0;
+    } else {
+        output_info->dataSize = pCTX->v4l2_enc.mfc_dst_bufs_bytes_used_len;
+    }
+
+    ctrl.id = V4L2_CID_CODEC_ENCODED_LUMA_ADDR;
+    ctrl.value = 0;
+    ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
+    if (ret != 0)
+        LOGE("[%s] Error to do g_ctrl",__func__);
+    encoded_y_addr = (unsigned int)ctrl.value;
+
+    ctrl.id = V4L2_CID_CODEC_ENCODED_CHROMA_ADDR;
+    ctrl.value = 0;
+    ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
+    if (ret != 0)
+        LOGE("[%s] Error to do g_ctrl",__func__);
+    encoded_c_addr = (unsigned int)ctrl.value;
+
+    output_info->headerSize = pCTX->encodedHeaderSize;
+    output_info->frameType = pCTX->encodedframeType;
+    output_info->StrmPhyAddr = (void *)0;
+    output_info->StrmVirAddr = (void *)pCTX->virStrmBuf;
+    output_info->encodedYPhyAddr = (void*)encoded_y_addr;
+    output_info->encodedCPhyAddr = (void*)encoded_c_addr;
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetOutBuf(void *openHandle, void *phyOutbuf, void *virOutbuf, int outputBufferSize)
+{
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    return MFC_RET_ENC_SET_OUTBUF_FAIL;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
+{
+    int ret;
+    int dequeued_index;
+    int loopcnt = 0;
+    _MFCLIB *pCTX;
+
+    struct v4l2_buffer qbuf;
+    struct v4l2_plane planes[MFC_ENC_NUM_PLANES];
+    enum v4l2_buf_type type;
+
+    struct v4l2_control ctrl;
+
+    struct pollfd poll_events;
+    int poll_state;
+
+    LOGV("[%s] Enter \n",__func__);
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    ctrl.id = V4L2_CID_CODEC_FRAME_TAG;
+    ctrl.value = pCTX->inframetag;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
+        return MFC_RET_ENC_EXE_ERR;
+    }
+
+    if (pCTX->v4l2_enc.bRunning == 0) {
+        type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_STREAMON failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_ENC_EXE_ERR;
+        }
+
+        pCTX->v4l2_enc.bRunning = 1;
+    }
+
+    pCTX->inter_buff_status |= MFC_USE_SRC_STREAMON;
+
+    memset(&qbuf, 0, sizeof(qbuf));
+    qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    qbuf.memory = V4L2_MEMORY_MMAP;
+    qbuf.m.planes = planes;
+    qbuf.length = 1;
+
+    /* note: #define POLLOUT 0x0004 */
+    poll_events.fd = pCTX->hMFC;
+    poll_events.events = POLLIN | POLLERR;
+    poll_events.revents = 0;
+
+    /* wait for encoding */
+    do {
+        poll_state = poll((struct pollfd*)&poll_events, 1, POLL_ENC_WAIT_TIMEOUT);
+        if (0 < poll_state) {
+            if (poll_events.revents & POLLIN) { /* POLLIN */
+                ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+                if (ret == 0)
+                    break;
+            } else if (poll_events.revents & POLLERR) { /* POLLERR */
+                LOGE("[%s] POLLERR\n",__func__);
+                return MFC_RET_ENC_EXE_ERR;
+            } else {
+                LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
+                return MFC_RET_ENC_EXE_ERR;
+            }
+        } else if (0 > poll_state) {
+            LOGE("[%s] poll() Encoder POLL Timeout 0x%x\n",__func__, poll_events.revents);
+            return MFC_RET_ENC_EXE_ERR;
+        } else { /* in the case of B frame encoding */
+            ctrl.id = V4L2_CID_CODEC_CHECK_STATE;
+            ctrl.value = 0;
+            ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
+            LOGV("[%s] ctx state = %d\n",__func__, ctrl.value);
+            if (ctrl.value == MFCSTATE_ENC_NO_OUTPUT)
+                return MFC_RET_OK;
+        }
+        loopcnt++;
+    } while ((0 == poll_state) && (loopcnt < 5));
+
+    if (pCTX->v4l2_enc.bRunning != 0) {
+        pCTX->encodedframeType = (qbuf.flags & 0x38) >> 3; /* encoded frame type */
+        LOGV("[%s] encoded frame type = %d\n", __func__, pCTX->encodedframeType);
+
+        switch (pCTX->encodedframeType) {
+        case 1:
+            pCTX->encodedframeType = MFC_FRAME_TYPE_I_FRAME;
+            break;
+        case 2:
+            pCTX->encodedframeType = MFC_FRAME_TYPE_P_FRAME;
+            break;
+        case 4:
+            pCTX->encodedframeType = MFC_FRAME_TYPE_B_FRAME;
+            break;
+        default:
+             LOGE("[%s] VIDIOC_DQBUF failed, encoded frame type is wrong",__func__);
+        }
+    }
+
+    dequeued_index = qbuf.index;
+
+    if (qbuf.m.planes[0].bytesused > 0) { /* FIXME later */
+        pCTX->v4l2_enc.mfc_dst_bufs_bytes_used_len = qbuf.m.planes[0].bytesused;
+    }
+
+    ctrl.id = V4L2_CID_CODEC_FRAME_TAG;
+    ctrl.value = 0;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
+        return MFC_RET_ENC_EXE_ERR;
+    }
+
+    pCTX->outframetagtop = ctrl.value;
+
+    memset(&qbuf, 0, sizeof(qbuf));
+    qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+    qbuf.memory = V4L2_MEMORY_MMAP;
+    qbuf.index = dequeued_index;
+    qbuf.m.planes = planes;
+    qbuf.length = 1;
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
+        return MFC_RET_ENC_EXE_ERR;
+    }
+
+    if (pCTX->v4l2_enc.bRunning != 0) {
+        memset(&qbuf, 0, sizeof(qbuf));
+        qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+
+        if (pCTX->v4l2_enc.bInputPhyVir)
+            qbuf.memory = V4L2_MEMORY_USERPTR;
+        else
+            qbuf.memory = V4L2_MEMORY_MMAP;
+
+        ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
+        if (ret != 0) {
+            LOGE("[%s] VIDIOC_DQBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
+            return MFC_RET_ENC_EXE_ERR;
+        }
+    }
+    pCTX->v4l2_enc.mfc_src_buf_flags[qbuf.index] = BUF_DEQUEUED;
+
+    /* Update context stream buffer address */
+    pCTX->virStrmBuf = (unsigned int)pCTX->v4l2_enc.mfc_dst_bufs[dequeued_index];
+    LOGV("[%s] Strm out idx %d",__func__,dequeued_index);
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value)
+{
+    _MFCLIB *pCTX;
+    struct v4l2_control ctrl;
+    struct mfc_enc_hier_p_qp hier_p_qp;
+#ifdef S3D_SUPPORT
+    SSBSIP_MFC_FRAME_PACKING *frame_packing;
+#endif
+    struct mfc_enc_fmo fmo_param;
+    int *aso_param;
+    int ret, i;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if (value == NULL) {
+        LOGE("[%s] value is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    pCTX  = (_MFCLIB *) openHandle;
+
+    switch (conf_type) {
+    case MFC_ENC_SETCONF_FRAME_TAG:
+        pCTX->inframetag = *((unsigned int *)value);
+        return MFC_RET_OK;
+
+    case MFC_ENC_SETCONF_FRAME_TYPE:
+        ctrl.id = V4L2_CID_CODEC_FRAME_INSERTION;
+        ctrl.value = *((unsigned int*)value);
+        break;
+
+    case MFC_ENC_SETCONF_I_PERIOD:
+        ctrl.id = V4L2_CID_CODEC_ENCODED_I_PERIOD_CH;
+        ctrl.value = *((unsigned int*)value);
+        break;
+
+    case MFC_ENC_SETCONF_CHANGE_FRAME_RATE:
+        ctrl.id = V4L2_CID_CODEC_ENCODED_FRAME_RATE_CH;
+        ctrl.value = *((unsigned int*)value);
+        break;
+
+    case MFC_ENC_SETCONF_CHANGE_BIT_RATE:
+        ctrl.id = V4L2_CID_CODEC_ENCODED_BIT_RATE_CH;
+        ctrl.value = *((unsigned int*)value);
+        break;
+#ifdef S3D_SUPPORT
+    case MFC_ENC_SETCONF_SEI_GEN:
+        ctrl.id = V4L2_CID_CODEC_FRAME_PACK_SEI_GEN;
+        ctrl.value = *((unsigned int*)value);
+        pCTX->sei_info.sei_gen_enable = 1;
+        break;
+#endif
+    case MFC_ENC_SETCONF_ALLOW_FRAME_SKIP:
+        pCTX->enc_frameskip = *((int *)value);
+        return MFC_RET_OK;
+#if 0
+    case MFC_ENC_SETCONF_VUI_INFO:
+        vui_info = *((struct mfc_enc_vui_info *) value);
+        EncArg.args.set_config.in_config_value[0]  = (int)(vui_info.aspect_ratio_idc);
+        EncArg.args.set_config.in_config_value[1]  = 0;
+        break;
+#endif
+    case MFC_ENC_SETCONF_HIER_P:
+        hier_p_qp = *((struct mfc_enc_hier_p_qp *) value);
+        pCTX->hier_p_enable = 1;
+        pCTX->hier_qp_value.t0_frame_qp = (int)(hier_p_qp.t0_frame_qp);
+        pCTX->hier_qp_value.t2_frame_qp  = (int)(hier_p_qp.t2_frame_qp);
+        pCTX->hier_qp_value.t3_frame_qp  = (int)(hier_p_qp.t3_frame_qp);
+        return MFC_RET_OK;
+#ifdef S3D_SUPPORT
+    case MFC_ENC_SETCONF_FRAME_PACKING:
+        frame_packing = (SSBSIP_MFC_FRAME_PACKING *)value;
+        pCTX->sei_info.curr_frame_frm0_flag = (int)(frame_packing->current_frame_is_frame0_flag);
+        pCTX->sei_info.frame_pack_arrgment_type  = (int)(frame_packing->arrangement_type);
+        return MFC_RET_OK;
+#endif
+    case MFC_ENC_SETCONF_FMO:
+        fmo_param = *((struct mfc_enc_fmo *) value);
+        pCTX->fmo_enable = 1;
+        pCTX->fmo_value.slice_map_type = (int)(fmo_param.slice_map_type);
+        pCTX->fmo_value.slice_num_grp  = (int)(fmo_param.slice_num_grp);
+        pCTX->fmo_value.run_length[0]  = (int)(fmo_param.run_length[0]);
+        pCTX->fmo_value.run_length[1]  = (int)(fmo_param.run_length[1]);
+        pCTX->fmo_value.run_length[2]  = (int)(fmo_param.run_length[2]);
+        pCTX->fmo_value.run_length[3]  = (int)(fmo_param.run_length[3]);
+        pCTX->fmo_value.sg_dir         = (int)(fmo_param.sg_dir);
+        pCTX->fmo_value.sg_rate        = (int)(fmo_param.sg_rate);
+        return MFC_RET_OK;
+
+    case MFC_ENC_SETCONF_ASO:
+        aso_param = (int *) value;
+        pCTX->aso_enable = 1;
+        for (i = 0; i < 8; i++)
+            pCTX->aso_sl_order[i] = (int)aso_param[i];
+        return MFC_RET_OK;
+
+    default:
+        LOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
+    if (ret != 0) {
+        LOGE("[%s] VIDIOC_S_CTRL failed (conf_type = %d)",__func__, conf_type);
+        return MFC_RET_ENC_SET_CONF_FAIL;
+    }
+
+    return MFC_RET_OK;
+}
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value)
+{
+    _MFCLIB *pCTX;
+
+    pCTX = (_MFCLIB *) openHandle;
+
+    if (openHandle == NULL) {
+        LOGE("[%s] openHandle is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    if (value == NULL) {
+        LOGE("[%s] value is NULL\n",__func__);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    switch (conf_type) {
+    case MFC_ENC_GETCONF_FRAME_TAG:
+        *((unsigned int *)value) = pCTX->outframetagtop;
+        break;
+
+    default:
+        LOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
+        return MFC_RET_INVALID_PARAM;
+    }
+
+    return MFC_RET_OK;
+}
+
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/include/SsbSipMfcApi.h b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/include/SsbSipMfcApi.h
new file mode 100644
index 0000000..b386c72
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/include/SsbSipMfcApi.h
@@ -0,0 +1,431 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * Global header for Samsung MFC (Multi Function Codec - FIMV) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _SSBSIP_MFC_API_H_
+#define _SSBSIP_MFC_API_H_
+
+/*--------------------------------------------------------------------------------*/
+/* Definition                                                                     */
+/*--------------------------------------------------------------------------------*/
+#define MAX_DECODER_INPUT_BUFFER_SIZE  (1024 * 3072)
+#define MAX_ENCODER_OUTPUT_BUFFER_SIZE (1024 * 3072)
+
+#define MFC6x_VERSION
+
+#define SUPPORT_1080P        1
+
+#if SUPPORT_1080P
+#define MMAP_BUFFER_SIZE_MMAP          (70*1024*1024) /* only C110 use this value. in C210, memory size is decided in menuconfig*/
+#else
+#define MMAP_BUFFER_SIZE_MMAP          (62*1024*1024)
+#endif
+
+#define SAMSUNG_MFC_DEV_NAME           "/dev/video"
+
+#define SSBSIP_MFC_OK                   (1)
+#define SSBSIP_MFC_FAIL                 (0)
+
+/*--------------------------------------------------------------------------------*/
+/* Structure and Type                                                             */
+/*--------------------------------------------------------------------------------*/
+typedef enum {
+    H264_DEC,
+    VC1_DEC,     /* VC1 advaced Profile decoding  */
+    MPEG4_DEC,
+    XVID_DEC,
+    MPEG1_DEC,
+    MPEG2_DEC,
+    H263_DEC,
+    VC1RCV_DEC,  /* VC1 simple/main profile decoding  */
+    FIMV1_DEC,
+    FIMV2_DEC,
+    FIMV3_DEC,
+    FIMV4_DEC,
+#if defined (MFC6x_VERSION)
+    VP8_DEC,
+#endif
+    H264_ENC,
+    MPEG4_ENC,
+    H263_ENC,
+    UNKNOWN_TYPE
+} SSBSIP_MFC_CODEC_TYPE;
+
+typedef enum {
+    DONT_CARE = 0,
+    I_FRAME = 1,
+    NOT_CODED = 2
+} SSBSIP_MFC_FORCE_SET_FRAME_TYPE;
+
+typedef enum {
+    NV12_LINEAR = 0,
+    NV12_TILE,
+    NV21_LINEAR
+} SSBSIP_MFC_INSTRM_MODE_TYPE;
+
+typedef enum {
+    FRAME = 0,
+    SLICE,
+} SSBSIP_MFC_OUTSTRM_MODE_TYPE;
+
+typedef enum {
+    NO_CACHE = 0,
+    CACHE = 1
+} SSBIP_MFC_BUFFER_TYPE;
+
+typedef enum {
+    MFC_DEC_SETCONF_POST_ENABLE = 1,
+    MFC_DEC_SETCONF_EXTRA_BUFFER_NUM,
+    MFC_DEC_SETCONF_DISPLAY_DELAY,
+    MFC_DEC_SETCONF_IS_LAST_FRAME,
+    MFC_DEC_SETCONF_SLICE_ENABLE,
+    MFC_DEC_SETCONF_CRC_ENABLE,
+    MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT,
+    MFC_DEC_SETCONF_FRAME_TAG,
+    MFC_DEC_GETCONF_CRC_DATA,
+    MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT,
+    MFC_DEC_GETCONF_CROP_INFO,
+    MFC_DEC_GETCONF_FRAME_TAG,
+
+    /* C210 specific feature */
+    MFC_DEC_SETCONF_IMMEDIATELY_DISPLAY,
+    MFC_DEC_SETCONF_DPB_FLUSH,
+    MFC_DEC_SETCONF_PIXEL_CACHE,
+    MFC_DEC_GETCONF_WIDTH_HEIGHT,
+#ifdef S3D_SUPPORT
+    /* S3D specific feature */
+    MFC_DEC_SETCONF_SEI_PARSE,
+    MFC_DEC_GETCONF_FRAME_PACKING
+#endif
+} SSBSIP_MFC_DEC_CONF;
+
+typedef enum {
+    MFC_ENC_SETCONF_FRAME_TYPE = 100,
+    MFC_ENC_SETCONF_CHANGE_FRAME_RATE,
+    MFC_ENC_SETCONF_CHANGE_BIT_RATE,
+    MFC_ENC_SETCONF_FRAME_TAG,
+    MFC_ENC_SETCONF_ALLOW_FRAME_SKIP,
+    MFC_ENC_GETCONF_FRAME_TAG,
+
+    /* C210 specific feature */
+    MFC_ENC_SETCONF_VUI_INFO,
+    MFC_ENC_SETCONF_I_PERIOD,
+    MFC_ENC_SETCONF_HIER_P,
+#ifdef S3D_SUPPORT
+    /* S3D Specific feature */
+    MFC_ENC_SETCONF_SEI_GEN,
+    MFC_ENC_SETCONF_FRAME_PACKING,
+#endif
+    MFC_ENC_SETCONF_FMO,
+    MFC_ENC_SETCONF_ASO,
+} SSBSIP_MFC_ENC_CONF;
+
+typedef enum {
+    MFC_GETOUTBUF_STATUS_NULL = 0,
+    MFC_GETOUTBUF_DECODING_ONLY = 1,
+    MFC_GETOUTBUF_DISPLAY_DECODING,
+    MFC_GETOUTBUF_DISPLAY_ONLY,
+    MFC_GETOUTBUF_DISPLAY_END,
+    MFC_GETOUTBUF_CHANGE_RESOL
+} SSBSIP_MFC_DEC_OUTBUF_STATUS;
+
+typedef enum {
+    MFC_FRAME_TYPE_NOT_CODED,
+    MFC_FRAME_TYPE_I_FRAME,
+    MFC_FRAME_TYPE_P_FRAME,
+    MFC_FRAME_TYPE_B_FRAME,
+    MFC_FRAME_TYPE_OTHERS
+} SSBSIP_MFC_FRAME_TYPE;
+
+typedef enum {
+    MFC_RET_OK                      = 1,
+    MFC_RET_FAIL                    = -1000,
+    MFC_RET_OPEN_FAIL               = -1001,
+    MFC_RET_CLOSE_FAIL              = -1002,
+
+    MFC_RET_DEC_INIT_FAIL           = -2000,
+    MFC_RET_DEC_EXE_TIME_OUT        = -2001,
+    MFC_RET_DEC_EXE_ERR             = -2002,
+    MFC_RET_DEC_GET_INBUF_FAIL      = -2003,
+    MFC_RET_DEC_SET_INBUF_FAIL      = -2004,
+    MFC_RET_DEC_GET_OUTBUF_FAIL     = -2005,
+    MFC_RET_DEC_GET_CONF_FAIL       = -2006,
+    MFC_RET_DEC_SET_CONF_FAIL       = -2007,
+
+    MFC_RET_ENC_INIT_FAIL           = -3000,
+    MFC_RET_ENC_EXE_TIME_OUT        = -3001,
+    MFC_RET_ENC_EXE_ERR             = -3002,
+    MFC_RET_ENC_GET_INBUF_FAIL      = -3003,
+    MFC_RET_ENC_SET_INBUF_FAIL      = -3004,
+    MFC_RET_ENC_GET_OUTBUF_FAIL     = -3005,
+    MFC_RET_ENC_SET_OUTBUF_FAIL     = -3006,
+    MFC_RET_ENC_GET_CONF_FAIL       = -3007,
+    MFC_RET_ENC_SET_CONF_FAIL       = -3008,
+
+    MFC_RET_INVALID_PARAM           = -4000
+} SSBSIP_MFC_ERROR_CODE;
+
+typedef struct {
+    void *YPhyAddr;                     /* [OUT] physical address of Y */
+    void *CPhyAddr;                     /* [OUT] physical address of CbCr */
+    void *YVirAddr;                     /* [OUT] virtual address of Y */
+    void *CVirAddr;                     /* [OUT] virtual address of CbCr */
+
+    int img_width;                      /* [OUT] width of real image */
+    int img_height;                     /* [OUT] height of real image */
+    int buf_width;                      /* [OUT] width aligned to 16 */
+    int buf_height;                     /* [OUT] height alighed to 16 */
+
+    int timestamp_top;                  /* [OUT] timestamp of top filed(This is used for interlaced stream) */
+    int timestamp_bottom;               /* [OUT] timestamp of bottom filed(This is used for interlaced stream) */
+    int consumedByte;                   /* [OUT] the number of byte consumed during decoding */
+    int res_change;                     /* [OUT] whether resolution is changed or not. 0: not change, 1: increased, 2: decreased */
+    int crop_top_offset;                /* [OUT] crop information, top_offset */
+    int crop_bottom_offset;             /* [OUT] crop information, bottom_offset */
+    int crop_left_offset;               /* [OUT] crop information, left_offset */
+    int crop_right_offset;              /* [OUT] crop information, right_offset */
+    int disp_pic_frame_type;            /* [OUT] display picture frame type information */
+
+    /* C210 UMP feature */
+    unsigned int y_cookie;              /* [OUT] cookie for Y address */
+    unsigned int c_cookie;              /* [OUT] cookie for CbCr address, If it is 0, Y and CbCr is in continous memory */
+} SSBSIP_MFC_DEC_OUTPUT_INFO;
+
+typedef struct {
+    void *YPhyAddr;                     /* [IN/OUT] physical address of Y */
+    void *CPhyAddr;                     /* [IN/OUT] physical address of CbCr */
+    void *YVirAddr;                     /* [IN/OUT] virtual address of Y */
+    void *CVirAddr;                     /* [IN/OUT] virtual address of CbCr */
+    int YSize;                          /* [IN/OUT] input size of Y data */
+    int CSize;                          /* [IN/OUT] input size of CbCr data */
+
+    /* C210 UMP feature */
+    unsigned int y_cookie;              /* [OUT] cookie for Y address */
+    unsigned int c_cookie;              /* [OUT] cookie for CbCr address, If it is 0, Y and CbCr is in continous memory */
+} SSBSIP_MFC_ENC_INPUT_INFO;
+
+typedef struct {
+    unsigned int dataSize;              /* [OUT] encoded data size(without header) */
+    unsigned int headerSize;            /* [OUT] encoded header size */
+    unsigned int frameType;             /* [OUT] frame type of encoded stream */
+    void *StrmPhyAddr;                  /* [OUT] physical address of Y */
+    void *StrmVirAddr;                  /* [OUT] virtual address of Y */
+    void *encodedYPhyAddr;              /* [OUT] physical address of Y which is flushed */
+    void *encodedCPhyAddr;              /* [OUT] physical address of C which is flushed */
+
+    /* C210 UMP feature */
+    unsigned int strm_cookie;           /* [OUT] cooke for stream buffer */
+    unsigned int y_encoded_cookie;      /* [OUT] cookie for Y address */
+    unsigned int c_encoded_cookie;      /* [OUT] cookie for CbCr address, If it is 0, Y and CbCr is in continous memory */
+} SSBSIP_MFC_ENC_OUTPUT_INFO;
+
+typedef struct {
+    /* common parameters */
+    SSBSIP_MFC_CODEC_TYPE codecType;            /* [IN] codec type */
+    int SourceWidth;                            /* [IN] width of video to be encoded */
+    int SourceHeight;                           /* [IN] height of video to be encoded */
+    int IDRPeriod;                              /* [IN] GOP number(interval of I-frame) */
+    int SliceMode;                              /* [IN] Multi slice mode */
+    int RandomIntraMBRefresh;                   /* [IN] cyclic intra refresh */
+    int EnableFRMRateControl;                   /* [IN] frame based rate control enable */
+    int Bitrate;                                /* [IN] rate control parameter(bit rate) */
+    int FrameQp;                                /* [IN] The quantization parameter of the frame */
+    int FrameQp_P;                              /* [IN] The quantization parameter of the P frame */
+    int QSCodeMax;                              /* [IN] Maximum Quantization value */
+    int QSCodeMin;                              /* [IN] Minimum Quantization value */
+    int CBRPeriodRf;                            /* [IN] Reaction coefficient parameter for rate control */
+    int PadControlOn;                           /* [IN] Enable padding control */
+    int LumaPadVal;                             /* [IN] Luma pel value used to fill padding area */
+    int CbPadVal;                               /* [IN] CB pel value used to fill padding area */
+    int CrPadVal;                               /* [IN] CR pel value used to fill padding area */
+    int FrameMap;                               /* [IN] Encoding input mode(tile mode or linear mode) */
+    SSBSIP_MFC_OUTSTRM_MODE_TYPE OutputMode;    /* [IN] Output mode: Frame/Slice */
+
+    /* H.264 specific parameters */
+    int ProfileIDC;                     /* [IN] profile */
+    int LevelIDC;                       /* [IN] level */
+    int FrameQp_B;                      /* [IN] The quantization parameter of the B frame */
+    int FrameRate;                      /* [IN] rate control parameter(frame rate) */
+    int SliceArgument;                  /* [IN] MB number or byte number */
+    int NumberBFrames;                  /* [IN] The number of consecutive B frame inserted */
+    int NumberReferenceFrames;          /* [IN] The number of reference pictures used */
+    int NumberRefForPframes;            /* [IN] The number of reference pictures used for encoding P pictures */
+    int LoopFilterDisable;              /* [IN] disable the loop filter */
+    int LoopFilterAlphaC0Offset;        /* [IN] Alpha & C0 offset for H.264 loop filter */
+    int LoopFilterBetaOffset;           /* [IN] Beta offset for H.264 loop filter */
+    int SymbolMode;                     /* [IN] The mode of entropy coding(CABAC, CAVLC) */
+    int PictureInterlace;               /* [IN] Enables the interlace mode */
+    int Transform8x8Mode;               /* [IN] Allow 8x8 transform(This is allowed only for high profile) */
+    int EnableMBRateControl;            /* [IN] Enable macroblock-level rate control */
+    int DarkDisable;                    /* [IN] Disable adaptive rate control on dark region */
+    int SmoothDisable;                  /* [IN] Disable adaptive rate control on smooth region */
+    int StaticDisable;                  /* [IN] Disable adaptive rate control on static region */
+    int ActivityDisable;                /* [IN] Disable adaptive rate control on high activity region */
+} SSBSIP_MFC_ENC_H264_PARAM;
+
+typedef struct {
+    /* common parameters */
+    SSBSIP_MFC_CODEC_TYPE codecType;            /* [IN] codec type */
+    int SourceWidth;                            /* [IN] width of video to be encoded */
+    int SourceHeight;                           /* [IN] height of video to be encoded */
+    int IDRPeriod;                              /* [IN] GOP number(interval of I-frame) */
+    int SliceMode;                              /* [IN] Multi slice mode */
+    int RandomIntraMBRefresh;                   /* [IN] cyclic intra refresh */
+    int EnableFRMRateControl;                   /* [IN] frame based rate control enable */
+    int Bitrate;                                /* [IN] rate control parameter(bit rate) */
+    int FrameQp;                                /* [IN] The quantization parameter of the frame */
+    int FrameQp_P;                              /* [IN] The quantization parameter of the P frame */
+    int QSCodeMax;                              /* [IN] Maximum Quantization value */
+    int QSCodeMin;                              /* [IN] Minimum Quantization value */
+    int CBRPeriodRf;                            /* [IN] Reaction coefficient parameter for rate control */
+    int PadControlOn;                           /* [IN] Enable padding control */
+    int LumaPadVal;                             /* [IN] Luma pel value used to fill padding area */
+    int CbPadVal;                               /* [IN] CB pel value used to fill padding area */
+    int CrPadVal;                               /* [IN] CR pel value used to fill padding area */
+    int FrameMap;                               /* [IN] Encoding input mode(tile mode or linear mode) */
+    SSBSIP_MFC_OUTSTRM_MODE_TYPE OutputMode;    /* [IN] Output mode: Frame/Slice */
+#if defined (MFC6x_VERSION)
+    int EnableMBRateControl;                    /* [IN] Enable macroblock-level rate control, MFC6.x Only */
+#endif
+
+    /* MPEG4 specific parameters */
+    int ProfileIDC;                     /* [IN] profile */
+    int LevelIDC;                       /* [IN] level */
+    int FrameQp_B;                      /* [IN] The quantization parameter of the B frame */
+    int TimeIncreamentRes;              /* [IN] frame rate */
+    int VopTimeIncreament;              /* [IN] frame rate */
+    int SliceArgument;                  /* [IN] MB number or byte number */
+    int NumberBFrames;                  /* [IN] The number of consecutive B frame inserted */
+    int DisableQpelME;                  /* [IN] disable quarter-pixel motion estimation */
+} SSBSIP_MFC_ENC_MPEG4_PARAM;
+
+typedef struct {
+    /* common parameters */
+    SSBSIP_MFC_CODEC_TYPE codecType;            /* [IN] codec type */
+    int SourceWidth;                            /* [IN] width of video to be encoded */
+    int SourceHeight;                           /* [IN] height of video to be encoded */
+    int IDRPeriod;                              /* [IN] GOP number(interval of I-frame) */
+    int SliceMode;                              /* [IN] Multi slice mode */
+    int RandomIntraMBRefresh;                   /* [IN] cyclic intra refresh */
+    int EnableFRMRateControl;                   /* [IN] frame based rate control enable */
+    int Bitrate;                                /* [IN] rate control parameter(bit rate) */
+    int FrameQp;                                /* [IN] The quantization parameter of the frame */
+    int FrameQp_P;                              /* [IN] The quantization parameter of the P frame */
+    int QSCodeMax;                              /* [IN] Maximum Quantization value */
+    int QSCodeMin;                              /* [IN] Minimum Quantization value */
+    int CBRPeriodRf;                            /* [IN] Reaction coefficient parameter for rate control */
+    int PadControlOn;                           /* [IN] Enable padding control */
+    int LumaPadVal;                             /* [IN] Luma pel value used to fill padding area */
+    int CbPadVal;                               /* [IN] CB pel value used to fill padding area */
+    int CrPadVal;                               /* [IN] CR pel value used to fill padding area */
+    int FrameMap;                               /* [IN] Encoding input mode(tile mode or linear mode) */
+#if defined (MFC6x_VERSION)
+    int EnableMBRateControl;                    /* [IN] Enable macroblock-level rate control, MFC6.x Only */
+#endif
+
+    /* H.263 specific parameters */
+    int FrameRate;                      /* [IN] rate control parameter(frame rate) */
+} SSBSIP_MFC_ENC_H263_PARAM;
+
+typedef struct {
+    int width;
+    int height;
+    int buf_width;
+    int buf_height;
+} SSBSIP_MFC_IMG_RESOLUTION;
+
+typedef struct {
+    int crop_top_offset;
+    int crop_bottom_offset;
+    int crop_left_offset;
+    int crop_right_offset;
+} SSBSIP_MFC_CROP_INFORMATION;
+
+#ifdef S3D_SUPPORT
+typedef struct {
+    int           available;
+    unsigned int  arrangement_id;
+    int           arrangement_cancel_flag;
+    unsigned char arrangement_type;
+    int           quincunx_sampling_flag;
+    unsigned char content_interpretation_type;
+    int           spatial_flipping_flag;
+    int           frame0_flipped_flag;
+    int           field_views_flag;
+    int           current_frame_is_frame0_flag;
+    unsigned char frame0_grid_pos_x;
+    unsigned char frame0_grid_pos_y;
+    unsigned char frame1_grid_pos_x;
+    unsigned char frame1_grid_pos_y;
+} SSBSIP_MFC_FRAME_PACKING;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*--------------------------------------------------------------------------------*/
+/* Decoding APIs                                                                  */
+/*--------------------------------------------------------------------------------*/
+void *SsbSipMfcDecOpen(void);
+void *SsbSipMfcDecOpenExt(void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE codec_type, int Frameleng);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill);
+//SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle);
+void  *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSize);
+//SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info);
+
+#if (defined(CONFIG_VIDEO_MFC_VCM_UMP) || defined(USE_UMP))
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, unsigned int secure_id, int size);
+#else
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, void *virInBuf, int size);
+#endif
+
+SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_DEC_OUTPUT_INFO *output_info);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CONF conf_type, void *value);
+
+/*--------------------------------------------------------------------------------*/
+/* Encoding APIs                                                                  */
+/*--------------------------------------------------------------------------------*/
+void *SsbSipMfcEncOpen(void);
+void *SsbSipMfcEncOpenExt(void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPUT_INFO *input_info);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUTPUT_INFO *output_info);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetOutBuf(void *openHandle, void *phyOutbuf, void *virOutbuf, int outputBufferSize);
+
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value);
+SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CONF conf_type, void *value);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SSBSIP_MFC_API_H_ */
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/include/mfc_errno.h b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/include/mfc_errno.h
new file mode 100644
index 0000000..b8e96ab
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/include/mfc_errno.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * Global header for Samsung MFC (Multi Function Codec - FIMV) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MFC_ERRNO_H
+#define __MFC_ERRNO_H __FILE__
+
+enum mfc_ret_code {
+    MFC_OK = 1,
+    MFC_FAIL = -1000,
+    MFC_OPEN_FAIL = -1001,
+    MFC_CLOSE_FAIL = -1002,
+
+    MFC_DEC_INIT_FAIL = -2000,
+    MFC_DEC_EXE_TIME_OUT = -2001,
+    MFC_DEC_EXE_ERR = -2002,
+    MFC_DEC_GET_INBUF_FAIL = 2003,
+    MFC_DEC_SET_INBUF_FAIL = 2004,
+    MFC_DEC_GET_OUTBUF_FAIL = -2005,
+    MFC_DEC_GET_CONF_FAIL = -2006,
+    MFC_DEC_SET_CONF_FAIL = -2007,
+
+    MFC_ENC_INIT_FAIL = -3000,
+    MFC_ENC_EXE_TIME_OUT = -3001,
+    MFC_ENC_EXE_ERR = -3002,
+    MFC_ENC_GET_INBUF_FAIL = -3003,
+    MFC_ENC_SET_INBUF_FAIL = -3004,
+    MFC_ENC_GET_OUTBUF_FAIL = -3005,
+    MFC_ENC_SET_OUTBUF_FAIL = -3006,
+    MFC_ENC_GET_CONF_FAIL = -3007,
+    MFC_ENC_SET_CONF_FAIL = -3008,
+
+    MFC_STATE_INVALID = -4000,
+    MFC_DEC_HEADER_FAIL = -4001,
+    MFC_DEC_INIT_BUF_FAIL = -4002,
+    MFC_ENC_HEADER_FAIL = -5000,
+    MFC_ENC_PARAM_FAIL = -5001,
+    MFC_FRM_BUF_SIZE_FAIL = -6000,
+    MFC_FW_LOAD_FAIL = -6001,
+    MFC_FW_INIT_FAIL = -6002,
+    MFC_INST_NUM_EXCEEDED_FAIL = -6003,
+    MFC_MEM_ALLOC_FAIL = -6004,
+    MFC_MEM_INVALID_ADDR_FAIL = -6005,
+    MFC_MEM_MAPPING_FAIL = -6006,
+    MFC_GET_CONF_FAIL = -6007,
+    MFC_SET_CONF_FAIL = -6008,
+    MFC_INVALID_PARAM_FAIL = -6009,
+    MFC_API_FAIL = -9000,
+
+    MFC_CMD_FAIL = -1003,
+    MFC_SLEEP_FAIL = -1010,
+    MFC_WAKEUP_FAIL = -1020,
+
+    MFC_CLK_ON_FAIL = -1030,
+    MFC_CLK_OFF_FAIL = -1030,
+    MFC_PWR_ON_FAIL = -1040,
+    MFC_PWR_OFF_FAIL = -1041,
+};
+
+#endif /* __MFC_ERRNO_H */
diff --git a/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/include/mfc_interface.h b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/include/mfc_interface.h
new file mode 100644
index 0000000..9bcee9d
--- /dev/null
+++ b/exynos4/multimedia/codecs/sec_codecs/video/exynos5/mfc_v4l2/include/mfc_interface.h
@@ -0,0 +1,588 @@
+/*
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *              http://www.samsung.com/
+ *
+ * Global header for Samsung MFC (Multi Function Codec - FIMV) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MFC_INTERFACE_H
+#define __MFC_INTERFACE_H
+
+#include "mfc_errno.h"
+#include "SsbSipMfcApi.h"
+
+#define IOCTL_MFC_DEC_INIT          (0x00800001)
+#define IOCTL_MFC_ENC_INIT          (0x00800002)
+#define IOCTL_MFC_DEC_EXE           (0x00800003)
+#define IOCTL_MFC_ENC_EXE           (0x00800004)
+
+#define IOCTL_MFC_GET_IN_BUF        (0x00800010)
+#define IOCTL_MFC_FREE_BUF          (0x00800011)
+#define IOCTL_MFC_GET_REAL_ADDR     (0x00800012)
+#define IOCTL_MFC_GET_MMAP_SIZE     (0x00800014)
+#define IOCTL_MFC_SET_IN_BUF        (0x00800018)
+
+#define IOCTL_MFC_SET_CONFIG        (0x00800101)
+#define IOCTL_MFC_GET_CONFIG        (0x00800102)
+
+#define IOCTL_MFC_SET_BUF_CACHE     (0x00800201)
+
+/* MFC H/W support maximum 32 extra DPB. */
+#define MFC_MAX_EXTRA_DPB                      5
+#define MFC_MAX_DISP_DELAY              0xF
+
+#define MFC_LIB_VER_MAJOR               1
+#define MFC_LIB_VER_MINOR               00
+
+#define BUF_L_UNIT          (1024)
+#define Align(x, alignbyte)     (((x)+(alignbyte)-1)/(alignbyte)*(alignbyte))
+
+#define MFC_ENC_NUM_SRC_BUFS    2 /* Number of source buffers to request */
+#define MFC_ENC_MAX_DST_BUFS    2 /* The maximum number of buffers */
+#define MFC_ENC_NUM_PLANES  2 /* Number of planes used by MFC Input */
+
+#define MFC_DEC_NUM_SRC_BUFS    2  /* Number of source buffers to request */
+#define MFC_DEC_MAX_DST_BUFS    32 /* The maximum number of buffers */
+#define MFC_DEC_NUM_PLANES  2  /* Number of planes used by MFC output */
+
+enum inst_type {
+    DECODER = 0x1,
+    ENCODER = 0x2,
+};
+
+enum mfc_check_state {
+    MFCSTATE_PROCESSING = 0,
+    MFCSTATE_DEC_RES_DETECT,
+    MFCSTATE_DEC_TERMINATING,
+    MFCSTATE_ENC_NO_OUTPUT,
+};
+
+typedef enum {
+    MFC_UNPACKED_PB = 0,
+    MFC_PACKED_PB = 1
+} mfc_packed_mode;
+
+typedef enum {
+    SSBSIP_MFC_LAST_FRAME_NOT_RECEIVED = 0,
+    SSBSIP_MFC_LAST_FRAME_RECEIVED = 1,
+    SSBSIP_MFC_LAST_FRAME_PROCESSED = 2
+} SSBSIP_MFC_LAST_FRAME_STATUS;
+
+typedef enum {
+    MFC_USE_NONE         =  0x0000,
+    MFC_USE_YUV_BUFF     =  0x0001,
+    MFC_USE_STRM_BUFF    =  0x0010,
+    MFC_USE_SRC_STREAMON =  0x0100,
+    MFC_USE_DST_STREAMON =  0x1000,
+} s3c_mfc_interbuff_status;
+
+typedef struct {
+    int luma0;  /* per frame (or top field) */
+    int chroma0;    /* per frame (or top field) */
+    int luma1;  /* per frame (or bottom field) */
+    int chroma1;    /* per frame (or bottom field) */
+} SSBSIP_MFC_CRC_DATA;
+
+#ifdef S3D_SUPPORT
+struct mfc_frame_pack_sei_info {
+    int sei_avail;
+    unsigned int arrgment_id;
+    int sei_info;
+    int grid_pos;
+};
+#endif
+
+struct mfc_strm_ref_buf_arg {
+    unsigned int strm_ref_y;
+    unsigned int mv_ref_yc;
+};
+
+struct mfc_frame_buf_arg {
+    unsigned int luma;
+    unsigned int chroma;
+};
+
+struct mfc_enc_init_common_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN] codec type */
+
+    int in_width;                        /* [IN] width of YUV420 frame to be encoded */
+    int in_height;                       /* [IN] height of YUV420 frame to be encoded */
+
+    int in_gop_num;                      /* [IN] GOP Number (interval of I-frame) */
+    int in_vop_quant;   /* [IN] VOP quant */
+    int in_vop_quant_p; /* [IN] VOP quant for P frame */
+
+    /* [IN] RC enable */
+    /* [IN] RC enable (0:disable, 1:frame level RC) */
+    int in_rc_fr_en;
+    int in_rc_bitrate;  /* [IN]  RC parameter (bitrate in kbps) */
+
+    int in_rc_qbound_min;   /* [IN]  RC parameter (Q bound Min) */
+    int in_rc_qbound_max;   /* [IN]  RC parameter (Q bound Max) */
+    int in_rc_rpara;    /* [IN]  RC parameter (Reaction Coefficient) */
+
+    /* [IN] Multi-slice mode (0:single, 1:multiple) */
+    int in_ms_mode;
+    /* [IN] Multi-slice size (in num. of mb or byte) */
+    int in_ms_arg;
+
+    int in_mb_refresh;                   /* [IN] Macroblock refresh */
+
+    /* [IN] Enable (1) / Disable (0) padding with the specified values */
+    int in_pad_ctrl_on;
+
+    /* [IN] pad value if pad_ctrl_on is Enable */
+    int in_y_pad_val;
+    int in_cb_pad_val;
+    int in_cr_pad_val;
+
+    /* linear or tiled */
+    int in_frame_map;
+
+    unsigned int in_pixelcache;
+
+    unsigned int in_mapped_addr;
+    struct mfc_strm_ref_buf_arg out_u_addr;
+    struct mfc_strm_ref_buf_arg out_p_addr;
+    struct mfc_strm_ref_buf_arg out_buf_size;
+    unsigned int out_header_size;
+};
+
+struct mfc_enc_init_h263_arg {
+    int in_rc_framerate;    /* [IN]  RC parameter (framerate) */
+};
+
+struct mfc_enc_init_mpeg4_arg {
+    int in_profile;     /* [IN] profile */
+    int in_level;       /* [IN] level */
+
+    int in_vop_quant_b; /* [IN] VOP quant for B frame */
+
+    /* [IN] B frame number */
+    int in_bframenum;
+
+    /* [IN] Quarter-pel MC enable (1:enabled, 0:disabled) */
+    int in_quart_pixel;
+
+    int in_TimeIncreamentRes;   /* [IN] VOP time resolution */
+    int in_VopTimeIncreament;   /* [IN] Frame delta */
+};
+
+struct mfc_enc_init_h264_arg {
+    int in_profile;     /* [IN] profile */
+    int in_level;       /* [IN] level */
+
+    int in_vop_quant_b; /* [IN] VOP quant for B frame */
+
+    /* [IN] B frame number */
+    int in_bframenum;
+
+    /* [IN] interlace mode(0:progressive, 1:interlace) */
+    int in_interlace_mode;
+
+    /* [IN]  reference number */
+    int in_reference_num;
+    /* [IN]  reference number of P frame */
+    int in_ref_num_p;
+
+    int in_rc_framerate;    /* [IN]  RC parameter (framerate) */
+    int in_rc_mb_en;    /* [IN] RC enable (0:disable, 1:MB level RC) */
+    /* [IN] MB level rate control dark region adaptive feature */
+    int in_rc_mb_dark_dis;  /* (0:enable, 1:disable) */
+    /* [IN] MB level rate control smooth region adaptive feature */
+    int in_rc_mb_smooth_dis;    /* (0:enable, 1:disable) */
+    /* [IN] MB level rate control static region adaptive feature */
+    int in_rc_mb_static_dis;    /* (0:enable, 1:disable) */
+    /* [IN] MB level rate control activity region adaptive feature */
+    int in_rc_mb_activity_dis;  /* (0:enable, 1:disable) */
+
+    /* [IN]  disable deblocking filter idc */
+    int in_deblock_dis; /* (0: enable,1: disable, 2:Disable at slice boundary) */
+    /* [IN]  slice alpha c0 offset of deblocking filter */
+    int in_deblock_alpha_c0;
+    /* [IN]  slice beta offset of deblocking filter */
+    int in_deblock_beta;
+
+    /* [IN]  ( 0 : CAVLC, 1 : CABAC ) */
+    int in_symbolmode;
+    /* [IN] (0: only 4x4 transform, 1: allow using 8x8 transform) */
+    int in_transform8x8_mode;
+
+    /* [IN] Inter weighted parameter for mode decision */
+    int in_md_interweight_pps;
+    /* [IN] Intra weighted parameter for mode decision */
+    int in_md_intraweight_pps;
+};
+
+struct mfc_enc_init_arg {
+    struct mfc_enc_init_common_arg cmn;
+    union {
+        struct mfc_enc_init_h264_arg h264;
+        struct mfc_enc_init_mpeg4_arg mpeg4;
+        struct mfc_enc_init_h263_arg h263;
+    } codec;
+};
+
+struct mfc_enc_exe_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN]  codec type */
+    unsigned int in_Y_addr;              /* [IN]  In-buffer addr of Y component */
+    unsigned int in_CbCr_addr;           /* [IN]  In-buffer addr of CbCr component */
+    unsigned int in_Y_addr_vir;          /* [IN]  In-buffer addr of Y component */
+    unsigned int in_CbCr_addr_vir;       /* [IN]  In-buffer addr of CbCr component */
+    unsigned int in_strm_st;             /* [IN]  Out-buffer start addr of encoded strm */
+    unsigned int in_strm_end;            /* [IN]  Out-buffer end addr of encoded strm */
+    unsigned int in_frametag;   /* [IN]  unique frame ID */
+
+    unsigned int out_frame_type;         /* [OUT] frame type */
+    int out_encoded_size;                /* [OUT] Length of Encoded video stream */
+    unsigned int out_Y_addr;    /*[OUT]Out-buffer addr of encoded Y component */
+    unsigned int out_CbCr_addr; /*[OUT]Out-buffer addr of encoded CbCr component */
+    unsigned int out_frametag_top;  /* [OUT] unique frame ID of an output frame or top field */
+    unsigned int out_frametag_bottom;/* [OUT] unique frame ID of bottom field */
+
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    unsigned int out_y_secure_id;
+    unsigned int out_c_secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int out_y_cookie;
+    unsigned int out_c_cookie;
+#endif
+};
+
+struct mfc_dec_init_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type;    /* [IN] codec type */
+    int in_strm_buf;        /* [IN] address of stream buffer */
+    int in_strm_size;       /* [IN] filled size in stream buffer */
+    int in_packed_PB;                    /* [IN]  Is packed PB frame or not, 1: packedPB  0: unpacked */
+
+    unsigned int in_crc;        /* [IN] */
+    unsigned int in_pixelcache; /* [IN] */
+    unsigned int in_slice;      /* [IN] */
+    unsigned int in_numextradpb;    /* [IN] */
+
+    unsigned int in_mapped_addr;
+
+    int out_frm_width;      /* [OUT] width  of YUV420 frame */
+    int out_frm_height;     /* [OUT] height of YUV420 frame */
+    int out_buf_width;  /* [OUT] width  of YUV420 frame */
+    int out_buf_height; /* [OUT] height of YUV420 frame */
+
+    int out_dpb_cnt;    /* [OUT] the number of buffers which is nessary during decoding. */
+
+    int out_crop_right_offset; /* [OUT] crop information for h264 */
+    int out_crop_left_offset;
+    int out_crop_bottom_offset;
+    int out_crop_top_offset;
+};
+
+struct mfc_dec_exe_arg {
+    SSBSIP_MFC_CODEC_TYPE in_codec_type; /* [IN]  codec type */
+    int in_strm_buf;  /* [IN]  the physical address of STRM_BUF */
+    /* [IN]  Size of video stream filled in STRM_BUF */
+    int in_strm_size;
+    /* [IN] the address of dpb FRAME_BUF */
+    struct mfc_frame_buf_arg in_frm_buf;
+    /* [IN] size of dpb FRAME_BUF */
+    struct mfc_frame_buf_arg in_frm_size;
+    /* [IN] Unique frame ID eg. application specific timestamp */
+    unsigned int in_frametag;
+    /* [IN] immdiate Display for seek,thumbnail and one frame */
+    int in_immediately_disp;
+    /* [OUT]  the physical address of display buf */
+    int out_display_Y_addr;
+    /* [OUT]  the physical address of display buf */
+    int out_display_C_addr;
+    int out_display_status;
+    /* [OUT] unique frame ID of an output frame or top field */
+    unsigned int out_frametag_top;
+     /* [OUT] unique frame ID of bottom field */
+    unsigned int out_frametag_bottom;
+    int out_pic_time_top;
+    int out_pic_time_bottom;
+    int out_consumed_byte;
+
+    int out_crop_right_offset;
+    int out_crop_left_offset;
+    int out_crop_bottom_offset;
+    int out_crop_top_offset;
+
+    /* in new driver, each buffer offset must be return to the user */
+    int out_y_offset;
+    int out_c_offset;
+
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    unsigned int out_y_secure_id;
+    unsigned int out_c_secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int out_y_cookie;
+    unsigned int out_c_cookie;
+#endif
+    int out_img_width;                   /* [OUT] width  of YUV420 frame */
+    int out_img_height;                  /* [OUT] height of YUV420 frame */
+    int out_buf_width;                   /* [OUT] width  of YUV420 frame */
+    int out_buf_height;                  /* [OUT] height of YUV420 frame */
+
+    int out_disp_pic_frame_type;        /* [OUT] display picture frame type information */
+};
+
+struct mfc_get_config_arg {
+    /* [IN] Configurable parameter type */
+    int in_config_param;
+
+    /* [IN] Values to get for the configurable parameter. */
+    /* Maximum four integer values can be obtained; */
+    int out_config_value[4];
+};
+
+struct mfc_set_config_arg {
+    /* [IN] Configurable parameter type */
+    int in_config_param;
+
+    /* [IN]  Values to be set for the configurable parameter. */
+    /* Maximum four integer values can be set. */
+    int in_config_value[4];
+};
+
+struct mfc_get_real_addr_arg {
+    unsigned int key;
+    unsigned int addr;
+};
+
+struct mfc_buf_alloc_arg {
+    enum inst_type type;
+    int size;
+    /*
+    unsigned int mapped;
+    */
+    unsigned int align;
+
+    unsigned int addr;
+    /*
+    unsigned int phys;
+    */
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    /* FIMXE: invalid secure id == -1 */
+    unsigned int secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int cookie;
+#else
+    unsigned int offset;
+#endif
+};
+
+struct mfc_buf_free_arg {
+    unsigned int addr;
+};
+
+/* RMVME */
+struct mfc_mem_alloc_arg {
+    enum inst_type type;
+    int buff_size;
+    SSBIP_MFC_BUFFER_TYPE buf_cache_type;
+    unsigned int mapped_addr;
+#if defined(CONFIG_VIDEO_MFC_VCM_UMP)
+    unsigned int secure_id;
+#elif defined(CONFIG_S5P_VMEM)
+    unsigned int cookie;
+#else
+    unsigned int offset;
+#endif
+};
+
+struct mfc_mem_free_arg {
+    unsigned int key;
+};
+/* RMVME */
+
+union mfc_args {
+    /*
+    struct mfc_enc_init_arg enc_init;
+
+    struct mfc_enc_init_mpeg4_arg enc_init_mpeg4;
+    struct mfc_enc_init_mpeg4_arg enc_init_h263;
+    struct mfc_enc_init_h264_arg enc_init_h264;
+    */
+    struct mfc_enc_init_arg enc_init;
+    struct mfc_enc_exe_arg enc_exe;
+
+    struct mfc_dec_init_arg dec_init;
+    struct mfc_dec_exe_arg dec_exe;
+
+    struct mfc_get_config_arg get_config;
+    struct mfc_set_config_arg set_config;
+
+    struct mfc_buf_alloc_arg buf_alloc;
+    struct mfc_buf_free_arg buf_free;
+    struct mfc_get_real_addr_arg real_addr;
+
+    /* RMVME */
+    struct mfc_mem_alloc_arg mem_alloc;
+    struct mfc_mem_free_arg mem_free;
+    /* RMVME */
+};
+
+struct mfc_common_args {
+    enum mfc_ret_code ret_code; /* [OUT] error code */
+    union mfc_args args;
+};
+
+struct mfc_enc_vui_info {
+    int aspect_ratio_idc;
+};
+
+struct mfc_dec_fimv1_info {
+    int width;
+    int height;
+};
+
+struct mfc_enc_hier_p_qp {
+    int t0_frame_qp;
+    int t2_frame_qp;
+    int t3_frame_qp;
+};
+
+#ifdef S3D_SUPPORT
+struct mfc_enc_sei_info {
+    int sei_gen_enable;
+    int curr_frame_frm0_flag;
+    int frame_pack_arrgment_type;
+};
+#endif
+
+struct mfc_enc_fmo {
+    unsigned int slice_map_type;
+    unsigned int slice_num_grp;
+    unsigned int run_length[4];
+    unsigned int sg_dir;
+    unsigned int sg_rate;
+};
+
+enum BUF_STATUS {
+    BUF_ENQUEUED,
+    BUF_DEQUEUED
+};
+
+struct mfc_dec_v4l2 {
+    char *mfc_src_bufs[MFC_DEC_NUM_SRC_BUFS];                   /* information of source buffers */
+    char *mfc_dst_bufs[MFC_DEC_MAX_DST_BUFS][MFC_DEC_NUM_PLANES];   /* information of destination buffers */
+    char *mfc_dst_phys[MFC_DEC_MAX_DST_BUFS][MFC_DEC_NUM_PLANES];   /* cma information of destination buffers */
+
+    unsigned int mfc_src_bufs_len;                      /* needed for munmap */
+    unsigned int mfc_dst_bufs_len[MFC_DEC_NUM_PLANES];  /* needed for munmap */
+
+    unsigned int mfc_num_src_bufs;  /* the number of source buffers */
+    unsigned int mfc_num_dst_bufs;  /* the number of destination buffers */
+
+    char mfc_src_buf_flags[MFC_DEC_NUM_SRC_BUFS];
+    int bBeingFinalized;
+    int allocIndex;
+    int beingUsedIndex;
+};
+
+struct mfc_enc_v4l2 {
+    char *mfc_src_bufs[MFC_ENC_NUM_SRC_BUFS][MFC_ENC_NUM_PLANES];
+    char *mfc_src_phys[MFC_ENC_NUM_SRC_BUFS][MFC_ENC_NUM_PLANES];
+    char *mfc_dst_bufs[MFC_ENC_MAX_DST_BUFS];
+
+    unsigned int mfc_src_bufs_len[MFC_ENC_NUM_PLANES];
+    unsigned int mfc_dst_bufs_len;
+
+    unsigned int mfc_num_src_bufs;
+    unsigned int mfc_num_dst_bufs;
+
+    unsigned int mfc_dst_bufs_bytes_used_len;
+    char mfc_src_buf_flags[MFC_ENC_NUM_SRC_BUFS];
+    int bRunning;
+    int bInputPhyVir;               /* Flag to use MFC src as physical or virtual 0: virtual  1: physical */
+    int beingUsedIndex;
+};
+
+typedef struct {
+    int magic;
+    int hMFC;
+    int hVMEM;
+    int width;
+    int height;
+    int sizeStrmBuf;
+    struct mfc_frame_buf_arg sizeFrmBuf;
+    int displayStatus;
+    int inter_buff_status;
+    unsigned int virFreeStrmAddr;
+    unsigned int phyStrmBuf;
+    unsigned int virStrmBuf;
+    unsigned int virMvRefYC;
+    struct mfc_frame_buf_arg phyFrmBuf;
+    struct mfc_frame_buf_arg virFrmBuf;
+    unsigned int mapped_addr;
+    unsigned int mapped_size;
+    struct mfc_common_args MfcArg;
+    SSBSIP_MFC_CODEC_TYPE codecType;
+    SSBSIP_MFC_DEC_OUTPUT_INFO decOutInfo;
+    unsigned int inframetag;
+    unsigned int outframetagtop;
+    unsigned int outframetagbottom;
+    unsigned int immediatelydisp;
+    unsigned int encodedHeaderSize;
+    int encodedDataSize;
+    unsigned int encodedframeType;
+    struct mfc_frame_buf_arg encodedphyFrmBuf;
+
+    unsigned int dec_crc;
+    unsigned int dec_pixelcache;
+    unsigned int dec_slice;
+    unsigned int dec_numextradpb;
+
+    int input_cookie;
+    int input_secure_id;
+    int input_size;
+
+    /* to support non-blocking mode */
+    unsigned int encode_cnt;
+
+    struct mfc_dec_v4l2 v4l2_dec;
+    struct mfc_enc_v4l2 v4l2_enc;
+
+    int enc_frameskip;
+    int cacheablebuffer;
+    struct mfc_dec_fimv1_info fimv1_res;
+    SSBSIP_MFC_LAST_FRAME_STATUS lastframe;
+    SSBSIP_MFC_INSTRM_MODE_TYPE framemap;
+
+    int hier_p_enable;
+    struct mfc_enc_hier_p_qp hier_qp_value;
+#ifdef S3D_SUPPORT
+    struct mfc_enc_sei_info sei_info;
+#endif
+    int fmo_enable;
+    struct mfc_enc_fmo fmo_value;
+    int aso_enable;
+    int aso_sl_order[8];
+
+
+    /*ION related*/
+    int ion_fd;
+    int dst_ion_fd[MFC_DEC_MAX_DST_BUFS][MFC_DEC_NUM_PLANES];
+} _MFCLIB;
+
+#define ENC_PROFILE_LEVEL(profile, level)      ((profile) | ((level) << 8))
+#define ENC_RC_QBOUND(min_qp, max_qp)          ((min_qp) | ((max_qp) << 8))
+
+#define SSBSIP_MFC_FAIL                  (0)
+
+#endif /* __MFC_INTERFACE_H */
diff --git a/exynos4/multimedia/libs/Android.mk b/exynos4/multimedia/libs/Android.mk
new file mode 100644
index 0000000..55ca333
--- /dev/null
+++ b/exynos4/multimedia/libs/Android.mk
@@ -0,0 +1 @@
+include $(all-subdir-makefiles)
\ No newline at end of file
diff --git a/exynos4/multimedia/libs/libcsc/Android.mk b/exynos4/multimedia/libs/libcsc/Android.mk
new file mode 100644
index 0000000..6f3f753
--- /dev/null
+++ b/exynos4/multimedia/libs/libcsc/Android.mk
@@ -0,0 +1,64 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_COPY_HEADERS_TO := libsecmm
+LOCAL_COPY_HEADERS := \
+	csc.h
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	csc.c
+
+ifeq ($(BOARD_USE_EXYNOS_OMX), true)
+OMX_NAME := exynos
+else
+OMX_NAME := sec
+endif
+
+LOCAL_C_INCLUDES := \
+	$(TOP)/$(BOARD_HMM_PATH)/openmax/$(OMX_NAME)_omx/include/khronos \
+	$(TOP)/$(BOARD_HMM_PATH)/openmax/$(OMX_NAME)_omx/include/$(OMX_NAME)
+
+LOCAL_CFLAGS :=
+
+LOCAL_MODULE := libcsc
+
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := libswconverter
+LOCAL_SHARED_LIBRARIES := liblog
+
+ifeq ($(BOARD_USE_SAMSUNG_COLORFORMAT), true)
+LOCAL_CFLAGS += -DUSE_SAMSUNG_COLORFORMAT
+endif
+
+ifeq ($(TARGET_BOARD_PLATFORM), exynos4)
+LOCAL_SRC_FILES += hwconverter_wrapper.cpp
+LOCAL_C_INCLUDES += $(TOP)/$(BOARD_HMM_PATH)/utils/csc/exynos4 \
+	$(TOP)/$(BOARD_HAL_PATH)/include \
+	$(TOP)/$(BOARD_HAL_PATH)/libhwconverter
+LOCAL_CFLAGS += -DUSE_FIMC
+LOCAL_SHARED_LIBRARIES += libfimc libhwconverter
+endif
+
+ifeq ($(TARGET_BOARD_PLATFORM), exynos5)
+LOCAL_C_INCLUDES += $(TOP)/$(BOARD_HMM_PATH)/utils/csc/exynos5 \
+	$(TOP)/device/samsung/exynos5/include
+LOCAL_CFLAGS += -DUSE_GSCALER
+LOCAL_SHARED_LIBRARIES += libexynosgscaler
+endif
+
+ifeq ($(BOARD_USE_V4L2_ION),true)
+LOCAL_CFLAGS += -DUSE_ION
+LOCAL_SHARED_LIBRARIES += libion
+endif
+
+ifeq ($(BOARD_USE_EXYNOS_OMX), true)
+LOCAL_CFLAGS += -DEXYNOS_OMX
+endif
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/libs/libcsc/csc.c b/exynos4/multimedia/libs/libcsc/csc.c
new file mode 100644
index 0000000..19bd203
--- /dev/null
+++ b/exynos4/multimedia/libs/libcsc/csc.c
@@ -0,0 +1,740 @@
+/*
+ *
+ * Copyright 2012 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        csc.c
+ *
+ * @brief       color space convertion abstract source
+ *
+ * @author      Pyoungjae Jung(pjet.jung@samsung.com)
+ *
+ * @version     1.0.0
+ *
+ * @history
+ *   2012.1.11 : Create
+ */
+#define LOG_TAG "libcsc"
+#include <cutils/log.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <utils/Log.h>
+
+#include "csc.h"
+#include "sec_format.h"
+#include "sec_utils_v4l2.h"
+#include "swconverter.h"
+
+#ifdef EXYNOS_OMX
+#include "Exynos_OMX_Def.h"
+#else
+#include "SEC_OMX_Def.h"
+#endif
+
+#ifdef USE_FIMC
+#include "hwconverter_wrapper.h"
+#endif
+
+#ifdef USE_GSCALER
+#include "exynos_gscaler.h"
+#endif
+
+#define GSCALER_IMG_ALIGN 16
+#define CSC_MAX_PLANES 3
+#define ALIGN(x, a)       (((x) + (a) - 1) & ~((a) - 1))
+
+typedef enum _CSC_PLANE {
+    CSC_Y_PLANE = 0,
+    CSC_RGB_PLANE = 0,
+    CSC_U_PLANE = 1,
+    CSC_UV_PLANE = 1,
+    CSC_V_PLANE = 2
+} CSC_PLANE;
+
+typedef enum _CSC_HW_TYPE {
+    CSC_HW_TYPE_FIMC = 0,
+    CSC_HW_TYPE_GSCALER
+} CSC_HW_TYPE;
+
+typedef struct _CSC_FORMAT {
+    unsigned int width;
+    unsigned int height;
+    unsigned int crop_left;
+    unsigned int crop_top;
+    unsigned int crop_width;
+    unsigned int crop_height;
+    unsigned int color_format;
+    unsigned int cacheable;
+} CSC_FORMAT;
+
+typedef struct _CSC_BUFFER {
+    unsigned char *planes[CSC_MAX_PLANES];
+    int ion_fd;
+} CSC_BUFFER;
+
+typedef struct _CSC_HANDLE {
+    CSC_FORMAT      dst_format;
+    CSC_FORMAT      src_format;
+    CSC_BUFFER      dst_buffer;
+    CSC_BUFFER      src_buffer;
+    CSC_METHOD      csc_method;
+    CSC_HW_TYPE     csc_hw_type;
+    void           *csc_hw_handle;
+} CSC_HANDLE;
+
+OMX_COLOR_FORMATTYPE hal_2_omx_pixel_format(
+    unsigned int hal_format)
+{
+    OMX_COLOR_FORMATTYPE omx_format;
+    switch (hal_format) {
+    case HAL_PIXEL_FORMAT_YCbCr_420_P:
+        omx_format = OMX_COLOR_FormatYUV420Planar;
+        break;
+    case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+        omx_format = OMX_COLOR_FormatYUV420SemiPlanar;
+        break;
+    case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
+        omx_format = OMX_SEC_COLOR_FormatNV12Tiled;
+        break;
+    case HAL_PIXEL_FORMAT_ARGB888:
+        omx_format = OMX_COLOR_Format32bitARGB8888;
+        break;
+    default:
+        omx_format = OMX_COLOR_FormatYUV420Planar;
+        break;
+    }
+    return omx_format;
+}
+
+unsigned int omx_2_hal_pixel_format(
+    OMX_COLOR_FORMATTYPE omx_format)
+{
+    unsigned int hal_format;
+    switch (omx_format) {
+    case OMX_COLOR_FormatYUV420Planar:
+        hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
+        break;
+    case OMX_COLOR_FormatYUV420SemiPlanar:
+        hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP;
+        break;
+    case OMX_SEC_COLOR_FormatNV12Tiled:
+        hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED;
+        break;
+    case OMX_COLOR_Format32bitARGB8888:
+        hal_format = HAL_PIXEL_FORMAT_ARGB888;
+        break;
+    default:
+        hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
+        break;
+    }
+    return hal_format;
+}
+
+/* source is RGB888 */
+static CSC_ERRORCODE conv_sw_src_argb888(
+    CSC_HANDLE *handle)
+{
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    switch (handle->dst_format.color_format) {
+    case HAL_PIXEL_FORMAT_YCbCr_420_P:
+        csc_ARGB8888_to_YUV420P(
+            (unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
+            (unsigned char *)handle->dst_buffer.planes[CSC_U_PLANE],
+            (unsigned char *)handle->dst_buffer.planes[CSC_V_PLANE],
+            (unsigned char *)handle->src_buffer.planes[CSC_RGB_PLANE],
+            handle->src_format.width,
+            handle->src_format.height);
+        ret = CSC_ErrorNone;
+        break;
+    case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+        csc_ARGB8888_to_YUV420SP(
+            (unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
+            (unsigned char *)handle->dst_buffer.planes[CSC_UV_PLANE],
+            (unsigned char *)handle->src_buffer.planes[CSC_RGB_PLANE],
+            handle->src_format.width,
+            handle->src_format.height);
+        ret = CSC_ErrorNone;
+        break;
+    default:
+        ret = CSC_ErrorUnsupportFormat;
+        break;
+    }
+
+    return ret;
+}
+
+/* source is NV12T */
+static CSC_ERRORCODE conv_sw_src_nv12t(
+    CSC_HANDLE *handle)
+{
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    switch (handle->dst_format.color_format) {
+    case HAL_PIXEL_FORMAT_YCbCr_420_P:
+        csc_tiled_to_linear_y_neon(
+            (unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
+            (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
+            handle->src_format.width,
+            handle->src_format.height);
+        csc_tiled_to_linear_uv_deinterleave_neon(
+            (unsigned char *)handle->dst_buffer.planes[CSC_U_PLANE],
+            (unsigned char *)handle->dst_buffer.planes[CSC_V_PLANE],
+            (unsigned char *)handle->src_buffer.planes[CSC_UV_PLANE],
+            handle->src_format.width,
+            handle->src_format.height / 2);
+        ret = CSC_ErrorNone;
+        break;
+    case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+        csc_tiled_to_linear_y_neon(
+            (unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
+            (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
+            handle->src_format.width,
+            handle->src_format.height);
+        csc_tiled_to_linear_uv_neon(
+            (unsigned char *)handle->dst_buffer.planes[CSC_UV_PLANE],
+            (unsigned char *)handle->src_buffer.planes[CSC_UV_PLANE],
+            handle->src_format.width,
+            handle->src_format.height / 2);
+        ret = CSC_ErrorNone;
+        break;
+    default:
+        ret = CSC_ErrorUnsupportFormat;
+        break;
+    }
+
+    return ret;
+}
+
+/* source is YUV420P */
+static CSC_ERRORCODE conv_sw_src_yuv420p(
+    CSC_HANDLE *handle)
+{
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    switch (handle->dst_format.color_format) {
+    case HAL_PIXEL_FORMAT_YCbCr_420_P:  /* bypass */
+        memcpy((unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
+               (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
+               handle->src_format.width * handle->src_format.height);
+        memcpy((unsigned char *)handle->dst_buffer.planes[CSC_U_PLANE],
+               (unsigned char *)handle->src_buffer.planes[CSC_U_PLANE],
+               (handle->src_format.width * handle->src_format.height) >> 2);
+        memcpy((unsigned char *)handle->dst_buffer.planes[CSC_V_PLANE],
+               (unsigned char *)handle->src_buffer.planes[CSC_V_PLANE],
+               (handle->src_format.width * handle->src_format.height) >> 2);
+        ret = CSC_ErrorNone;
+        break;
+    case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+        memcpy((unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
+               (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
+               handle->src_format.width * handle->src_format.height);
+        csc_interleave_memcpy_neon(
+            (unsigned char *)handle->dst_buffer.planes[CSC_UV_PLANE],
+            (unsigned char *)handle->src_buffer.planes[CSC_U_PLANE],
+            (unsigned char *)handle->src_buffer.planes[CSC_V_PLANE],
+            (handle->src_format.width * handle->src_format.height) >> 2);
+        ret = CSC_ErrorNone;
+        break;
+    default:
+        ret = CSC_ErrorUnsupportFormat;
+        break;
+    }
+
+    return ret;
+}
+
+/* source is YUV420SP */
+static CSC_ERRORCODE conv_sw_src_yuv420sp(
+    CSC_HANDLE *handle)
+{
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    switch (handle->dst_format.color_format) {
+    case HAL_PIXEL_FORMAT_YCbCr_420_P:
+        memcpy((unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
+               (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
+               handle->src_format.width * handle->src_format.height);
+        csc_deinterleave_memcpy(
+            (unsigned char *)handle->dst_buffer.planes[CSC_U_PLANE],
+            (unsigned char *)handle->dst_buffer.planes[CSC_V_PLANE],
+            (unsigned char *)handle->src_buffer.planes[CSC_UV_PLANE],
+            handle->src_format.width * handle->src_format.height >> 1);
+        ret = CSC_ErrorNone;
+        break;
+    case HAL_PIXEL_FORMAT_YCbCr_420_SP: /* bypass */
+        memcpy((unsigned char *)handle->dst_buffer.planes[CSC_Y_PLANE],
+               (unsigned char *)handle->src_buffer.planes[CSC_Y_PLANE],
+               handle->src_format.width * handle->src_format.height);
+        memcpy((unsigned char *)handle->dst_buffer.planes[CSC_UV_PLANE],
+               (unsigned char *)handle->src_buffer.planes[CSC_UV_PLANE],
+               handle->src_format.width * handle->src_format.height >> 1);
+        ret = CSC_ErrorNone;
+        break;
+    default:
+        ret = CSC_ErrorUnsupportFormat;
+        break;
+    }
+
+    return ret;
+}
+
+static CSC_ERRORCODE conv_sw(
+    CSC_HANDLE *handle)
+{
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    switch (handle->src_format.color_format) {
+    case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
+        ret = conv_sw_src_nv12t(handle);
+        break;
+    case HAL_PIXEL_FORMAT_YCbCr_420_P:
+        ret = conv_sw_src_yuv420p(handle);
+        break;
+    case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+        ret = conv_sw_src_yuv420sp(handle);
+        break;
+    case HAL_PIXEL_FORMAT_ARGB888:
+        ret = conv_sw_src_argb888(handle);
+        break;
+    default:
+        ret = CSC_ErrorUnsupportFormat;
+        break;
+    }
+
+    return ret;
+}
+
+static CSC_ERRORCODE conv_hw(
+    CSC_HANDLE *handle)
+{
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    switch (handle->csc_hw_type) {
+#ifdef USE_FIMC
+    case CSC_HW_TYPE_FIMC:
+    {
+        void *src_addr[3];
+        void *dst_addr[3];
+        OMX_COLOR_FORMATTYPE omx_format;
+        src_addr[0] = handle->src_buffer.planes[CSC_Y_PLANE];
+        src_addr[1] = handle->src_buffer.planes[CSC_UV_PLANE];
+        dst_addr[0] = handle->dst_buffer.planes[CSC_Y_PLANE];
+        dst_addr[1] = handle->dst_buffer.planes[CSC_U_PLANE];
+        dst_addr[2] = handle->dst_buffer.planes[CSC_V_PLANE];
+        omx_format = hal_2_omx_pixel_format(handle->dst_format.color_format);
+        csc_hwconverter_convert_nv12t(
+            handle->csc_hw_handle,
+            dst_addr,
+            src_addr,
+            handle->dst_format.width,
+            handle->dst_format.height,
+            omx_format);
+        break;
+    }
+#endif
+#ifdef USE_GSCALER
+    case CSC_HW_TYPE_GSCALER:
+        exynos_gsc_convert(handle->csc_hw_handle);
+        break;
+#endif
+    default:
+        LOGE("%s:: unsupported csc_hw_type", __func__);
+        break;
+    }
+
+    return CSC_ErrorNotImplemented;
+}
+
+void *csc_init(
+    CSC_METHOD *method)
+{
+    CSC_HANDLE *csc_handle;
+    csc_handle = (CSC_HANDLE *)malloc(sizeof(CSC_HANDLE));
+    if (csc_handle == NULL)
+        return NULL;
+
+    memset(csc_handle, 0, sizeof(CSC_HANDLE));
+
+    csc_handle->csc_method = *method;
+
+    if (csc_handle->csc_method == CSC_METHOD_HW ||
+        csc_handle->csc_method == CSC_METHOD_PREFER_HW) {
+#ifdef USE_FIMC
+        csc_handle->csc_hw_type = CSC_HW_TYPE_FIMC;
+#endif
+#ifdef USE_GSCALER
+        csc_handle->csc_hw_type = CSC_HW_TYPE_GSCALER;
+#endif
+        switch (csc_handle->csc_hw_type) {
+#ifdef USE_FIMC
+        case CSC_HW_TYPE_FIMC:
+            csc_handle->csc_hw_handle = csc_hwconverter_open();
+            LOGD("%s:: CSC_HW_TYPE_FIMC", __func__);
+            break;
+#endif
+#ifdef USE_GSCALER
+        case CSC_HW_TYPE_GSCALER:
+            csc_handle->csc_hw_handle = exynos_gsc_create();
+            LOGD("%s:: CSC_HW_TYPE_GSCALER", __func__);
+            break;
+#endif
+        default:
+            LOGE("%s:: unsupported csc_hw_type, csc use sw", __func__);
+            csc_handle->csc_hw_handle == NULL;
+            break;
+        }
+    }
+
+    if (csc_handle->csc_method == CSC_METHOD_PREFER_HW) {
+        if (csc_handle->csc_hw_handle == NULL) {
+            csc_handle->csc_method = CSC_METHOD_SW;
+            *method = CSC_METHOD_SW;
+        } else {
+            csc_handle->csc_method = CSC_METHOD_HW;
+            *method = CSC_METHOD_HW;
+        }
+    }
+
+    if (csc_handle->csc_method == CSC_METHOD_HW) {
+        if (csc_handle->csc_hw_handle == NULL) {
+            LOGE("%s:: CSC_METHOD_HW can't open HW", __func__);
+            free(csc_handle);
+            csc_handle = NULL;
+        }
+    }
+
+    LOGD("%s:: CSC_METHOD=%d", __func__, csc_handle->csc_method);
+
+    return (void *)csc_handle;
+}
+
+CSC_ERRORCODE csc_deinit(
+    void *handle)
+{
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+    CSC_HANDLE *csc_handle;
+
+    csc_handle = (CSC_HANDLE *)handle;
+    if (csc_handle->csc_method == CSC_METHOD_HW) {
+        switch (csc_handle->csc_hw_type) {
+#ifdef USE_FIMC
+        case CSC_HW_TYPE_FIMC:
+            csc_hwconverter_close(csc_handle->csc_hw_handle);
+            break;
+#endif
+#ifdef USE_GSCALER
+        case CSC_HW_TYPE_GSCALER:
+            exynos_gsc_destroy(csc_handle->csc_hw_handle);
+            break;
+#endif
+        default:
+            LOGE("%s:: unsupported csc_hw_type", __func__);
+            break;
+        }
+    }
+
+    if (csc_handle != NULL) {
+        free(csc_handle);
+        ret = CSC_ErrorNone;
+    }
+
+    return ret;
+}
+
+CSC_ERRORCODE csc_get_method(
+    void           *handle,
+    CSC_METHOD     *method)
+{
+    CSC_HANDLE *csc_handle;
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    if (handle == NULL)
+        return CSC_ErrorNotInit;
+
+    csc_handle = (CSC_HANDLE *)handle;
+    *method = csc_handle->csc_method;
+
+    return ret;
+}
+
+CSC_ERRORCODE csc_get_src_format(
+    void           *handle,
+    unsigned int   *width,
+    unsigned int   *height,
+    unsigned int   *crop_left,
+    unsigned int   *crop_top,
+    unsigned int   *crop_width,
+    unsigned int   *crop_height,
+    unsigned int   *color_format,
+    unsigned int   *cacheable)
+{
+    CSC_HANDLE *csc_handle;
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    if (handle == NULL)
+        return CSC_ErrorNotInit;
+
+    csc_handle = (CSC_HANDLE *)handle;
+    *width = csc_handle->src_format.width;
+    *height = csc_handle->src_format.height;
+    *crop_left = csc_handle->src_format.crop_left;
+    *crop_top = csc_handle->src_format.crop_top;
+    *crop_width = csc_handle->src_format.crop_width;
+    *crop_height = csc_handle->src_format.crop_height;
+    *color_format = csc_handle->src_format.color_format;
+    *cacheable = csc_handle->src_format.cacheable;
+
+    return ret;
+}
+
+CSC_ERRORCODE csc_set_src_format(
+    void           *handle,
+    unsigned int    width,
+    unsigned int    height,
+    unsigned int    crop_left,
+    unsigned int    crop_top,
+    unsigned int    crop_width,
+    unsigned int    crop_height,
+    unsigned int    color_format,
+    unsigned int    cacheable)
+{
+    CSC_HANDLE *csc_handle;
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    if (handle == NULL)
+        return CSC_ErrorNotInit;
+
+    csc_handle = (CSC_HANDLE *)handle;
+    csc_handle->src_format.width = width;
+    csc_handle->src_format.height = height;
+    csc_handle->src_format.crop_left = crop_left;
+    csc_handle->src_format.crop_top = crop_top;
+    csc_handle->src_format.crop_width = crop_width;
+    csc_handle->src_format.crop_height = crop_height;
+    csc_handle->src_format.color_format = color_format;
+    csc_handle->src_format.cacheable = cacheable;
+
+    if (csc_handle->csc_method == CSC_METHOD_HW) {
+        switch (csc_handle->csc_hw_type) {
+        case CSC_HW_TYPE_FIMC:
+            break;
+#ifdef USE_GSCALER
+        case CSC_HW_TYPE_GSCALER:
+            exynos_gsc_set_src_format(
+                csc_handle->csc_hw_handle,
+                ALIGN(csc_handle->src_format.width, GSCALER_IMG_ALIGN),
+                ALIGN(csc_handle->src_format.height, GSCALER_IMG_ALIGN),
+                csc_handle->src_format.crop_left,
+                csc_handle->src_format.crop_top,
+                ALIGN(csc_handle->src_format.crop_width, GSCALER_IMG_ALIGN),
+                ALIGN(csc_handle->src_format.crop_height, GSCALER_IMG_ALIGN),
+                HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->src_format.color_format),
+                csc_handle->src_format.cacheable);
+            break;
+#endif
+        default:
+            LOGE("%s:: unsupported csc_hw_type", __func__);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+CSC_ERRORCODE csc_get_dst_format(
+    void           *handle,
+    unsigned int   *width,
+    unsigned int   *height,
+    unsigned int   *crop_left,
+    unsigned int   *crop_top,
+    unsigned int   *crop_width,
+    unsigned int   *crop_height,
+    unsigned int   *color_format,
+    unsigned int   *cacheable)
+{
+    CSC_HANDLE *csc_handle;
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    if (handle == NULL)
+        return CSC_ErrorNotInit;
+
+    csc_handle = (CSC_HANDLE *)handle;
+    *width = csc_handle->dst_format.width;
+    *height = csc_handle->dst_format.height;
+    *crop_left = csc_handle->dst_format.crop_left;
+    *crop_top = csc_handle->dst_format.crop_top;
+    *crop_width = csc_handle->dst_format.crop_width;
+    *crop_height = csc_handle->dst_format.crop_height;
+    *color_format = csc_handle->dst_format.color_format;
+    *cacheable = csc_handle->dst_format.cacheable;
+
+    return ret;
+}
+
+CSC_ERRORCODE csc_set_dst_format(
+    void           *handle,
+    unsigned int    width,
+    unsigned int    height,
+    unsigned int    crop_left,
+    unsigned int    crop_top,
+    unsigned int    crop_width,
+    unsigned int    crop_height,
+    unsigned int    color_format,
+    unsigned int    cacheable)
+{
+    CSC_HANDLE *csc_handle;
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    if (handle == NULL)
+        return CSC_ErrorNotInit;
+
+    csc_handle = (CSC_HANDLE *)handle;
+    csc_handle->dst_format.width = width;
+    csc_handle->dst_format.height = height;
+    csc_handle->dst_format.crop_left = crop_left;
+    csc_handle->dst_format.crop_top = crop_top;
+    csc_handle->dst_format.crop_width = crop_width;
+    csc_handle->dst_format.crop_height = crop_height;
+    csc_handle->dst_format.color_format = color_format;
+    csc_handle->dst_format.cacheable = cacheable;
+
+    if (csc_handle->csc_method == CSC_METHOD_HW) {
+        switch (csc_handle->csc_hw_type) {
+        case CSC_HW_TYPE_FIMC:
+            break;
+#ifdef USE_GSCALER
+        case CSC_HW_TYPE_GSCALER:
+            exynos_gsc_set_dst_format(
+                csc_handle->csc_hw_handle,
+                ALIGN(csc_handle->dst_format.width, GSCALER_IMG_ALIGN),
+                ALIGN(csc_handle->dst_format.height, GSCALER_IMG_ALIGN),
+                csc_handle->dst_format.crop_left,
+                csc_handle->dst_format.crop_top,
+                ALIGN(csc_handle->dst_format.crop_width, GSCALER_IMG_ALIGN),
+                ALIGN(csc_handle->dst_format.crop_height, GSCALER_IMG_ALIGN),
+                HAL_PIXEL_FORMAT_2_V4L2_PIX(csc_handle->dst_format.color_format),
+                csc_handle->dst_format.cacheable);
+            break;
+#endif
+        default:
+            LOGE("%s:: unsupported csc_hw_type", __func__);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+CSC_ERRORCODE csc_set_src_buffer(
+    void           *handle,
+    unsigned char  *y,
+    unsigned char  *u,
+    unsigned char  *v,
+    int             ion_fd)
+{
+    CSC_HANDLE *csc_handle;
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+    void *addr[3] = {NULL, };
+
+    if (handle == NULL)
+        return CSC_ErrorNotInit;
+
+    csc_handle = (CSC_HANDLE *)handle;
+    csc_handle->src_buffer.planes[CSC_Y_PLANE] = y;
+    csc_handle->src_buffer.planes[CSC_U_PLANE] = u;
+    csc_handle->src_buffer.planes[CSC_V_PLANE] = v;
+
+    if (csc_handle->csc_method == CSC_METHOD_HW) {
+        addr[0] = csc_handle->src_buffer.planes[CSC_Y_PLANE];
+        addr[1] = csc_handle->src_buffer.planes[CSC_U_PLANE];
+        addr[2] = csc_handle->src_buffer.planes[CSC_V_PLANE];
+
+        switch (csc_handle->csc_hw_type) {
+        case CSC_HW_TYPE_FIMC:
+            break;
+#ifdef USE_GSCALER
+        case CSC_HW_TYPE_GSCALER:
+            exynos_gsc_set_src_addr(csc_handle->csc_hw_handle, addr);
+            break;
+#endif
+        default:
+            LOGE("%s:: unsupported csc_hw_type", __func__);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+CSC_ERRORCODE csc_set_dst_buffer(
+    void           *handle,
+    unsigned char  *y,
+    unsigned char  *u,
+    unsigned char  *v,
+    int             ion_fd)
+{
+    CSC_HANDLE *csc_handle;
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+    void *addr[3] = {NULL, };
+
+    if (handle == NULL)
+        return CSC_ErrorNotInit;
+
+    csc_handle = (CSC_HANDLE *)handle;
+    csc_handle->dst_buffer.planes[CSC_Y_PLANE] = y;
+    csc_handle->dst_buffer.planes[CSC_U_PLANE] = u;
+    csc_handle->dst_buffer.planes[CSC_V_PLANE] = v;
+
+    if (csc_handle->csc_method == CSC_METHOD_HW) {
+        addr[0] = csc_handle->dst_buffer.planes[CSC_Y_PLANE];
+        addr[1] = csc_handle->dst_buffer.planes[CSC_U_PLANE];
+        addr[2] = csc_handle->dst_buffer.planes[CSC_V_PLANE];
+
+        switch (csc_handle->csc_hw_type) {
+        case CSC_HW_TYPE_FIMC:
+            break;
+#ifdef USE_GSCALER
+        case CSC_HW_TYPE_GSCALER:
+            exynos_gsc_set_dst_addr(csc_handle->csc_hw_handle, addr);
+            break;
+#endif
+        default:
+            LOGE("%s:: unsupported csc_hw_type", __func__);
+            break;
+        }
+    }
+
+    return ret;
+}
+
+CSC_ERRORCODE csc_convert(
+    void *handle)
+{
+    CSC_HANDLE *csc_handle = (CSC_HANDLE *)handle;
+    CSC_ERRORCODE ret = CSC_ErrorNone;
+
+    if (csc_handle == NULL)
+        return CSC_ErrorNotInit;
+
+    if (csc_handle->csc_method == CSC_METHOD_HW)
+        ret = conv_hw(csc_handle);
+    else
+        ret = conv_sw(csc_handle);
+
+    return ret;
+}
diff --git a/exynos4/multimedia/libs/libcsc/csc.h b/exynos4/multimedia/libs/libcsc/csc.h
new file mode 100644
index 0000000..9069392
--- /dev/null
+++ b/exynos4/multimedia/libs/libcsc/csc.h
@@ -0,0 +1,355 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    csc.h
+ *
+ * @brief   color space convertion abstract header
+ *
+ * @author  Pyoungjae Jung (pjet.jung@samsung.com)
+ *
+ * @version 1.0
+ *
+ * @history
+ *   2011.12.27 : Create
+ */
+
+#ifndef CSC_H
+#define CSC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum _CSC_ERRORCODE {
+    CSC_ErrorNone = 0,
+    CSC_Error,
+    CSC_ErrorNotInit,
+    CSC_ErrorInvalidAddress,
+    CSC_ErrorUnsupportFormat,
+    CSC_ErrorNotImplemented
+} CSC_ERRORCODE;
+
+typedef enum _CSC_METHOD {
+    CSC_METHOD_SW = 0,
+    CSC_METHOD_HW,
+    CSC_METHOD_PREFER_HW
+} CSC_METHOD;
+
+/*
+ * change hal pixel format to omx pixel format
+ *
+ * @param hal_format
+ *   hal pixel format[in]
+ *
+ * @return
+ *   omx pixel format
+ */
+unsigned int hal_2_omx_pixel_format(
+    unsigned int hal_format);
+
+/*
+ * change omx pixel format to hal pixel format
+ *
+ * @param hal_format
+ *   omx pixel format[in]
+ *
+ * @return
+ *   hal pixel format
+ */
+unsigned int omx_2_hal_pixel_format(
+    unsigned int omx_format);
+
+/*
+ * Init CSC handle
+ *
+ * @return
+ *   csc handle
+ */
+void *csc_init(
+    CSC_METHOD *method);
+
+/*
+ * Deinit CSC handle
+ *
+ * @param handle
+ *   CSC handle[in]
+ *
+ * @return
+ *   error code
+ */
+CSC_ERRORCODE csc_deinit(
+    void *handle);
+
+/*
+ * get color space converter method
+ *
+ * @param handle
+ *   CSC handle[in]
+ *
+ * @param method
+ *   CSC method[out]
+ *
+ * @return
+ *   error code
+ */
+CSC_ERRORCODE csc_get_method(
+    void           *handle,
+    CSC_METHOD     *method);
+
+/*
+ * Get source format.
+ *
+ * @param handle
+ *   CSC handle[in]
+ *
+ * @param width
+ *   address of image width[out]
+ *
+ * @param height
+ *   address of image height[out]
+ *
+ * @param crop_left
+ *   address of image left crop size[out]
+ *
+ * @param crop_top
+ *   address of image top crop size[out]
+ *
+ * @param crop_width
+ *   address of cropped image width[out]
+ *
+ * @param crop_height
+ *   address of cropped image height[out]
+ *
+ * @param color_format
+ *   address of source color format(HAL format)[out]
+ *
+ * @return
+ *   error code
+ */
+CSC_ERRORCODE csc_get_src_format(
+    void           *handle,
+    unsigned int   *width,
+    unsigned int   *height,
+    unsigned int   *crop_left,
+    unsigned int   *crop_top,
+    unsigned int   *crop_width,
+    unsigned int   *crop_height,
+    unsigned int   *color_format,
+    unsigned int   *cacheable);
+
+/*
+ * Set source format.
+ * Don't call each converting time.
+ * Pls call this function as below.
+ *   1. first converting time
+ *   2. format is changed
+ *
+ * @param handle
+ *   CSC handle[in]
+ *
+ * @param width
+ *   image width[in]
+ *
+ * @param height
+ *   image height[in]
+ *
+ * @param crop_left
+ *   image left crop size[in]
+ *
+ * @param crop_top
+ *   image top crop size[in]
+ *
+ * @param crop_width
+ *   cropped image width[in]
+ *
+ * @param crop_height
+ *   cropped image height[in]
+ *
+ * @param color_format
+ *   source color format(HAL format)[in]
+ *
+ * @return
+ *   error code
+ */
+CSC_ERRORCODE csc_set_src_format(
+    void           *handle,
+    unsigned int    width,
+    unsigned int    height,
+    unsigned int    crop_left,
+    unsigned int    crop_top,
+    unsigned int    crop_width,
+    unsigned int    crop_height,
+    unsigned int    color_format,
+    unsigned int    cacheable);
+
+/*
+ * Get destination format.
+ *
+ * @param handle
+ *   CSC handle[in]
+ *
+ * @param width
+ *   address of image width[out]
+ *
+ * @param height
+ *   address of image height[out]
+ *
+ * @param crop_left
+ *   address of image left crop size[out]
+ *
+ * @param crop_top
+ *   address of image top crop size[out]
+ *
+ * @param crop_width
+ *   address of cropped image width[out]
+ *
+ * @param crop_height
+ *   address of cropped image height[out]
+ *
+ * @param color_format
+ *   address of color format(HAL format)[out]
+ *
+ * @return
+ *   error code
+ */
+CSC_ERRORCODE csc_get_dst_format(
+    void           *handle,
+    unsigned int   *width,
+    unsigned int   *height,
+    unsigned int   *crop_left,
+    unsigned int   *crop_top,
+    unsigned int   *crop_width,
+    unsigned int   *crop_height,
+    unsigned int   *color_format,
+    unsigned int   *cacheable);
+
+/*
+ * Set destination format
+ * Don't call each converting time.
+ * Pls call this function as below.
+ *   1. first converting time
+ *   2. format is changed
+ *
+ * @param handle
+ *   CSC handle[in]
+ *
+ * @param width
+ *   image width[in]
+ *
+ * @param height
+ *   image height[in]
+ *
+ * @param crop_left
+ *   image left crop size[in]
+ *
+ * @param crop_top
+ *   image top crop size[in]
+ *
+ * @param crop_width
+ *   cropped image width[in]
+ *
+ * @param crop_height
+ *   cropped image height[in]
+ *
+ * @param color_format
+ *   destination color format(HAL format)[in]
+ *
+ * @return
+ *   error code
+ */
+CSC_ERRORCODE csc_set_dst_format(
+    void           *handle,
+    unsigned int    width,
+    unsigned int    height,
+    unsigned int    crop_left,
+    unsigned int    crop_top,
+    unsigned int    crop_width,
+    unsigned int    crop_height,
+    unsigned int    color_format,
+    unsigned int    cacheable);
+
+/*
+ * Setup source buffer
+ * set_format func should be called before this this func.
+ *
+ * @param handle
+ *   CSC handle[in]
+ *
+ * @param src_buffer
+ *   source buffer pointer array[in]
+ *
+ * @param y
+ *   y or RGB destination pointer[in]
+ *
+ * @param u
+ *   u or uv destination pointer[in]
+ *
+ * @param v
+ *   v or none destination pointer[in]
+ *
+ * @return
+ *   error code
+ */
+CSC_ERRORCODE csc_set_src_buffer(
+    void           *handle,
+    unsigned char  *y,
+    unsigned char  *u,
+    unsigned char  *v,
+    int             ion_fd);
+
+/*
+ * Setup destination buffer
+ *
+ * @param handle
+ *   CSC handle[in]
+ *
+ * @param y
+ *   y or RGB destination pointer[in]
+ *
+ * @param u
+ *   u or uv destination pointer[in]
+ *
+ * @param v
+ *   v or none destination pointer[in]
+ *
+ * @return
+ *   error code
+ */
+CSC_ERRORCODE csc_set_dst_buffer(
+    void           *handle,
+    unsigned char  *y,
+    unsigned char  *u,
+    unsigned char  *v,
+    int             ion_fd);
+
+/*
+ * Convert color space with presetup color format
+ *
+ * @param handle
+ *   CSC handle[in]
+ *
+ * @return
+ *   error code
+ */
+CSC_ERRORCODE csc_convert(
+    void *handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/libs/libcsc/hwconverter_wrapper.cpp b/exynos4/multimedia/libs/libcsc/hwconverter_wrapper.cpp
new file mode 100644
index 0000000..9f6cd07
--- /dev/null
+++ b/exynos4/multimedia/libs/libcsc/hwconverter_wrapper.cpp
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    hwconverter_wrapper.cpp
+ *
+ * @brief   hwconverter_wrapper abstract libhwconverter and support c functions
+ *
+ * @author  ShinWon Lee (shinwon.lee@samsung.com)
+ *
+ * @version 1.0
+ *
+ * @history
+ *   2012.02.01 : Create
+ */
+
+#include <utils/Log.h>
+#include <dlfcn.h>
+
+#include "SEC_OMX_Def.h"
+#include "hwconverter_wrapper.h"
+#include "HardwareConverter.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * create hwconverter handle
+ *
+ * @return
+ *   fimc handle
+ */
+void *csc_hwconverter_open()
+{
+    HardwareConverter *hw_converter = NULL;
+
+    hw_converter = new HardwareConverter;
+    if (hw_converter->bHWconvert_flag == 0) {
+        delete hw_converter;
+        hw_converter = NULL;
+        LOGE("%s LINE = %d HardwareConverter failed", __func__, __LINE__);
+    }
+
+    return (void *)hw_converter;
+}
+
+/*
+ * destroy hwconverter handle
+ *
+ * @param handle
+ *   fimc handle[in]
+ *
+ * @return
+ *   pass or fail
+ */
+HWCONVERTER_ERROR_CODE csc_hwconverter_close(
+    void *handle)
+{
+    HardwareConverter *hw_converter = (HardwareConverter *)handle;
+
+    if (hw_converter != NULL)
+        delete hw_converter;
+
+    return HWCONVERTER_RET_OK;
+}
+
+/*
+ * convert color space nv12t to omxformat
+ *
+ * @param handle
+ *   hwconverter handle[in]
+ *
+ * @param dst_addr
+ *   y,u,v address of dst_addr[out]
+ *
+ * @param src_addr
+ *   y,uv address of src_addr.Format is nv12t[in]
+ *
+ * @param width
+ *   width of dst image[in]
+ *
+ * @param height
+ *   height of dst image[in]
+ *
+ * @param omxformat
+ *   omxformat of dst image[in]
+ *
+ * @return
+ *   pass or fail
+ */
+HWCONVERTER_ERROR_CODE csc_hwconverter_convert_nv12t(
+    void *handle,
+    void **dst_addr,
+    void **src_addr,
+    unsigned int width,
+    unsigned int height,
+    OMX_COLOR_FORMATTYPE omxformat)
+{
+    HWCONVERTER_ERROR_CODE ret = HWCONVERTER_RET_OK;
+    HardwareConverter *hw_converter = (HardwareConverter *)handle;
+
+    if (hw_converter == NULL) {
+        ret = HWCONVERTER_RET_FAIL;
+        goto EXIT;
+    }
+
+    hw_converter->convert(
+            (void *)src_addr, (void *)dst_addr,
+            (OMX_COLOR_FORMATTYPE)OMX_SEC_COLOR_FormatNV12TPhysicalAddress,
+            width, height, omxformat);
+
+    ret = HWCONVERTER_RET_OK;
+
+EXIT:
+
+    return ret;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/exynos4/multimedia/libs/libcsc/hwconverter_wrapper.h b/exynos4/multimedia/libs/libcsc/hwconverter_wrapper.h
new file mode 100644
index 0000000..292a680
--- /dev/null
+++ b/exynos4/multimedia/libs/libcsc/hwconverter_wrapper.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    hwconverter_wrapper.h
+ *
+ * @brief   hwconverter_wrapper abstract libhwconverter and support c functions
+ *
+ * @author  ShinWon Lee (shinwon.lee@samsung.com)
+ *
+ * @version 1.0
+ *
+ * @history
+ *   2012.02.01 : Create
+ */
+
+#ifndef HWCONVERTER_WRAPPER_H
+
+#define HWCONVERTER_WRAPPER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <OMX_Video.h>
+
+/*--------------------------------------------------------------------------------*/
+/* Structure and Type                                                             */
+/*--------------------------------------------------------------------------------*/
+typedef enum {
+    HWCONVERTER_RET_OK                 = 0,
+    HWCONVERTER_RET_FAIL               = -1
+} HWCONVERTER_ERROR_CODE;
+
+/*--------------------------------------------------------------------------------*/
+/* CSC FIMC APIs                                                                  */
+/*--------------------------------------------------------------------------------*/
+/*
+ * create hwconverter handle
+ *
+ * @return
+ *   hwconverter handle
+ */
+void *csc_fimc_open();
+
+/*
+ * destroy hwconverter handle
+ *
+ * @param handle
+ *   hwconverter handle[in]
+ *
+ * @return
+ *   error code
+ */
+HWCONVERTER_ERROR_CODE csc_fimc_close(
+    void *handle);
+
+/*
+ * convert color space nv12t to omxformat
+ *
+ * @param handle
+ *   hwconverter handle[in]
+ *
+ * @param dst_addr
+ *   y,u,v address of dst_addr[out]
+ *
+ * @param src_addr
+ *   y,uv address of src_addr.Format is nv12t[in]
+ *
+ * @param width
+ *   width of dst image[in]
+ *
+ * @param height
+ *   height of dst image[in]
+ *
+ * @param omxformat
+ *   omxformat of dst image[in]
+ *
+ * @return
+ *   error code
+ */
+HWCONVERTER_ERROR_CODE csc_fimc_convert_nv12t(
+    void *handle,
+    void **dst_addr,
+    void **src_addr,
+    unsigned int width,
+    unsigned int height,
+    OMX_COLOR_FORMATTYPE omxformat);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/libstagefrighthw/Android.mk b/exynos4/multimedia/libstagefrighthw/Android.mk
new file mode 100644
index 0000000..ce7a5e7
--- /dev/null
+++ b/exynos4/multimedia/libstagefrighthw/Android.mk
@@ -0,0 +1,23 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+    SEC_OMX_Plugin.cpp
+
+LOCAL_CFLAGS += $(PV_CFLAGS_MINUS_VISIBILITY)
+
+LOCAL_C_INCLUDES:= \
+      $(TOP)/frameworks/base/include/media/stagefright/openmax \
+
+LOCAL_SHARED_LIBRARIES :=    \
+        libbinder            \
+        libutils             \
+        libcutils            \
+        libui                \
+        libdl                \
+        libsurfaceflinger_client
+
+LOCAL_MODULE := libstagefrighthw
+
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/libstagefrighthw/SEC_OMX_Plugin.cpp b/exynos4/multimedia/libstagefrighthw/SEC_OMX_Plugin.cpp
new file mode 100644
index 0000000..efc8691
--- /dev/null
+++ b/exynos4/multimedia/libstagefrighthw/SEC_OMX_Plugin.cpp
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "SEC_OMX_Plugin.h"
+
+#include <dlfcn.h>
+
+#include <media/stagefright/HardwareAPI.h>
+#include <media/stagefright/MediaDebug.h>
+
+namespace android {
+
+OMXPluginBase *createOMXPlugin() {
+    return new SECOMXPlugin;
+}
+
+SECOMXPlugin::SECOMXPlugin()
+    : mLibHandle(dlopen("libSEC_OMX_Core.so", RTLD_NOW)),
+      mInit(NULL),
+      mDeinit(NULL),
+      mComponentNameEnum(NULL),
+      mGetHandle(NULL),
+      mFreeHandle(NULL),
+      mGetRolesOfComponentHandle(NULL) {
+    if (mLibHandle != NULL) {
+        mInit = (InitFunc)dlsym(mLibHandle, "SEC_OMX_Init");
+        mDeinit = (DeinitFunc)dlsym(mLibHandle, "SEC_OMX_Deinit");
+
+        mComponentNameEnum =
+            (ComponentNameEnumFunc)dlsym(mLibHandle, "SEC_OMX_ComponentNameEnum");
+
+        mGetHandle = (GetHandleFunc)dlsym(mLibHandle, "SEC_OMX_GetHandle");
+        mFreeHandle = (FreeHandleFunc)dlsym(mLibHandle, "SEC_OMX_FreeHandle");
+
+        mGetRolesOfComponentHandle =
+            (GetRolesOfComponentFunc)dlsym(
+                    mLibHandle, "SEC_OMX_GetRolesOfComponent");
+
+        (*mInit)();
+
+    }
+}
+
+SECOMXPlugin::~SECOMXPlugin() {
+    if (mLibHandle != NULL) {
+        (*mDeinit)();
+
+        dlclose(mLibHandle);
+        mLibHandle = NULL;
+    }
+}
+
+OMX_ERRORTYPE SECOMXPlugin::makeComponentInstance(
+        const char *name,
+        const OMX_CALLBACKTYPE *callbacks,
+        OMX_PTR appData,
+        OMX_COMPONENTTYPE **component) {
+    if (mLibHandle == NULL) {
+        return OMX_ErrorUndefined;
+    }
+
+    return (*mGetHandle)(
+            reinterpret_cast<OMX_HANDLETYPE *>(component),
+            const_cast<char *>(name),
+            appData, const_cast<OMX_CALLBACKTYPE *>(callbacks));
+}
+
+OMX_ERRORTYPE SECOMXPlugin::destroyComponentInstance(
+        OMX_COMPONENTTYPE *component) {
+    if (mLibHandle == NULL) {
+        return OMX_ErrorUndefined;
+    }
+
+    return (*mFreeHandle)(reinterpret_cast<OMX_HANDLETYPE *>(component));
+}
+
+OMX_ERRORTYPE SECOMXPlugin::enumerateComponents(
+        OMX_STRING name,
+        size_t size,
+        OMX_U32 index) {
+    if (mLibHandle == NULL) {
+        return OMX_ErrorUndefined;
+    }
+
+    return (*mComponentNameEnum)(name, size, index);
+}
+
+OMX_ERRORTYPE SECOMXPlugin::getRolesOfComponent(
+        const char *name,
+        Vector<String8> *roles) {
+    roles->clear();
+
+    if (mLibHandle == NULL) {
+        return OMX_ErrorUndefined;
+    }
+
+    OMX_U32 numRoles;
+    OMX_ERRORTYPE err = (*mGetRolesOfComponentHandle)(
+            const_cast<OMX_STRING>(name), &numRoles, NULL);
+
+    if (err != OMX_ErrorNone) {
+        return err;
+    }
+
+    if (numRoles > 0) {
+        OMX_U8 **array = new OMX_U8 *[numRoles];
+        for (OMX_U32 i = 0; i < numRoles; ++i) {
+            array[i] = new OMX_U8[OMX_MAX_STRINGNAME_SIZE];
+        }
+
+        OMX_U32 numRoles2;
+        err = (*mGetRolesOfComponentHandle)(
+                const_cast<OMX_STRING>(name), &numRoles2, array);
+
+        CHECK_EQ(err, OMX_ErrorNone);
+        CHECK_EQ(numRoles, numRoles2);
+
+        for (OMX_U32 i = 0; i < numRoles; ++i) {
+            String8 s((const char *)array[i]);
+            roles->push(s);
+
+            delete[] array[i];
+            array[i] = NULL;
+        }
+
+        delete[] array;
+        array = NULL;
+    }
+
+    return OMX_ErrorNone;
+}
+
+}  // namespace android
+
diff --git a/exynos4/multimedia/libstagefrighthw/SEC_OMX_Plugin.h b/exynos4/multimedia/libstagefrighthw/SEC_OMX_Plugin.h
new file mode 100644
index 0000000..6df2d31
--- /dev/null
+++ b/exynos4/multimedia/libstagefrighthw/SEC_OMX_Plugin.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SEC_OMX_PLUGIN
+
+#define SEC_OMX_PLUGIN
+
+#include <media/stagefright/OMXPluginBase.h>
+
+namespace android {
+
+struct SECOMXPlugin : public OMXPluginBase {
+    SECOMXPlugin();
+    virtual ~SECOMXPlugin();
+
+    virtual OMX_ERRORTYPE makeComponentInstance(
+            const char *name,
+            const OMX_CALLBACKTYPE *callbacks,
+            OMX_PTR appData,
+            OMX_COMPONENTTYPE **component);
+
+    virtual OMX_ERRORTYPE destroyComponentInstance(
+            OMX_COMPONENTTYPE *component);
+
+    virtual OMX_ERRORTYPE enumerateComponents(
+            OMX_STRING name,
+            size_t size,
+            OMX_U32 index);
+
+    virtual OMX_ERRORTYPE getRolesOfComponent(
+            const char *name,
+            Vector<String8> *roles);
+
+private:
+    void *mLibHandle;
+
+    typedef OMX_ERRORTYPE (*InitFunc)();
+    typedef OMX_ERRORTYPE (*DeinitFunc)();
+    typedef OMX_ERRORTYPE (*ComponentNameEnumFunc)(
+            OMX_STRING, OMX_U32, OMX_U32);
+
+    typedef OMX_ERRORTYPE (*GetHandleFunc)(
+            OMX_HANDLETYPE *, OMX_STRING, OMX_PTR, OMX_CALLBACKTYPE *);
+
+    typedef OMX_ERRORTYPE (*FreeHandleFunc)(OMX_HANDLETYPE *);
+
+    typedef OMX_ERRORTYPE (*GetRolesOfComponentFunc)(
+            OMX_STRING, OMX_U32 *, OMX_U8 **);
+
+    InitFunc mInit;
+    DeinitFunc mDeinit;
+    ComponentNameEnumFunc mComponentNameEnum;
+    GetHandleFunc mGetHandle;
+    FreeHandleFunc mFreeHandle;
+    GetRolesOfComponentFunc mGetRolesOfComponentHandle;
+
+    SECOMXPlugin(const SECOMXPlugin &);
+    SECOMXPlugin &operator=(const SECOMXPlugin &);
+};
+
+}  // namespace android
+
+#endif  // SEC_OMX_PLUGIN
diff --git a/exynos4/multimedia/openmax/Android.mk b/exynos4/multimedia/openmax/Android.mk
new file mode 100644
index 0000000..6571161
--- /dev/null
+++ b/exynos4/multimedia/openmax/Android.mk
@@ -0,0 +1 @@
+include $(all-subdir-makefiles)
diff --git a/exynos4/multimedia/openmax/sec_omx/Android.mk b/exynos4/multimedia/openmax/sec_omx/Android.mk
new file mode 100644
index 0000000..a15f70d
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/Android.mk
@@ -0,0 +1,32 @@
+LOCAL_PATH := $(call my-dir)
+BOARD_USE_ANB := true
+
+include $(CLEAR_VARS)
+
+SEC_OMX_TOP := $(LOCAL_PATH)
+
+SEC_COPY_HEADERS_TO := libsecmm
+
+SEC_OMX_INC := $(SEC_OMX_TOP)/include/
+SEC_OMX_COMPONENT := $(SEC_OMX_TOP)/component
+
+include $(SEC_OMX_TOP)/osal/Android.mk
+include $(SEC_OMX_TOP)/core/Android.mk
+
+include $(SEC_OMX_COMPONENT)/common/Android.mk
+include $(SEC_OMX_COMPONENT)/video/dec/Android.mk
+include $(SEC_OMX_COMPONENT)/video/dec/h264/Android.mk
+include $(SEC_OMX_COMPONENT)/video/dec/mpeg4/Android.mk
+include $(SEC_OMX_COMPONENT)/video/dec/vc1/Android.mk
+include $(SEC_OMX_COMPONENT)/video/enc/Android.mk
+include $(SEC_OMX_COMPONENT)/video/enc/h264/Android.mk
+include $(SEC_OMX_COMPONENT)/video/enc/mpeg4/Android.mk
+
+ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
+include $(SEC_OMX_COMPONENT)/video/dec/vp8/Android.mk
+endif
+
+ifeq ($(BOARD_USE_ALP_AUDIO), true)
+include $(SEC_OMX_COMPONENT)/audio/dec/Android.mk
+include $(SEC_OMX_COMPONENT)/audio/dec/mp3/Android.mk
+endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/audio/dec/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/Android.mk
new file mode 100644
index 0000000..303737b
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/Android.mk
@@ -0,0 +1,19 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Adec.c
+
+LOCAL_MODULE := libSEC_OMX_Adec
+LOCAL_ARM_MODE := arm
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/audio/dec \
+	$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO)
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/audio/dec/SEC_OMX_Adec.c b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/SEC_OMX_Adec.c
new file mode 100644
index 0000000..dab7247
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/SEC_OMX_Adec.c
@@ -0,0 +1,1376 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Adec.c
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ *
+ * @version     1.1.0
+ * @history
+ *   2011.10.18 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "SEC_OMX_Macros.h"
+#include "SEC_OSAL_Event.h"
+#include "SEC_OMX_Adec.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OSAL_Thread.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Mutex.h"
+#include "SEC_OSAL_ETC.h"
+#include "srp_api.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_AUDIO_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+OMX_ERRORTYPE SEC_OMX_UseBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes,
+    OMX_IN OMX_U8                   *pBuffer)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *temp_bufferHeader = NULL;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pSECPort = &pSECComponent->pSECPort[nPortIndex];
+    if (nPortIndex >= pSECComponent->portParam.nPorts) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+    if (pSECPort->portState != OMX_StateIdle) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
+    if (temp_bufferHeader == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE));
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (pSECPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+            pSECPort->bufferHeader[i] = temp_bufferHeader;
+            pSECPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED);
+            INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
+            temp_bufferHeader->pBuffer        = pBuffer;
+            temp_bufferHeader->nAllocLen      = nSizeBytes;
+            temp_bufferHeader->pAppPrivate    = pAppPrivate;
+            if (nPortIndex == INPUT_PORT_INDEX)
+                temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX;
+            else
+                temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX;
+
+            pSECPort->assignedBufferNum++;
+            if (pSECPort->assignedBufferNum == pSECPort->portDefinition.nBufferCountActual) {
+                pSECPort->portDefinition.bPopulated = OMX_TRUE;
+                /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+                SEC_OSAL_SemaphorePost(pSECPort->loadedResource);
+                /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            }
+            *ppBufferHdr = temp_bufferHeader;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+    }
+
+    SEC_OSAL_Free(temp_bufferHeader);
+    ret = OMX_ErrorInsufficientResources;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *temp_bufferHeader = NULL;
+    OMX_U8                *temp_buffer = NULL;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pSECPort = &pSECComponent->pSECPort[nPortIndex];
+    if (nPortIndex >= pSECComponent->portParam.nPorts) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+/*
+    if (pSECPort->portState != OMX_StateIdle ) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+*/
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    temp_buffer = SEC_OSAL_Malloc(sizeof(OMX_U8) * nSizeBytes);
+    if (temp_buffer == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+
+    temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
+    if (temp_bufferHeader == NULL) {
+        SEC_OSAL_Free(temp_buffer);
+        temp_buffer = NULL;
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE));
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (pSECPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+            pSECPort->bufferHeader[i] = temp_bufferHeader;
+            pSECPort->bufferStateAllocate[i] = (BUFFER_STATE_ALLOCATED | HEADER_STATE_ALLOCATED);
+            INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
+            temp_bufferHeader->pBuffer        = temp_buffer;
+            temp_bufferHeader->nAllocLen      = nSizeBytes;
+            temp_bufferHeader->pAppPrivate    = pAppPrivate;
+            if (nPortIndex == INPUT_PORT_INDEX)
+                temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX;
+            else
+                temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX;
+            pSECPort->assignedBufferNum++;
+            if (pSECPort->assignedBufferNum == pSECPort->portDefinition.nBufferCountActual) {
+                pSECPort->portDefinition.bPopulated = OMX_TRUE;
+                /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+                SEC_OSAL_SemaphorePost(pSECPort->loadedResource);
+                /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            }
+            *ppBuffer = temp_bufferHeader;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+    }
+
+    SEC_OSAL_Free(temp_bufferHeader);
+    SEC_OSAL_Free(temp_buffer);
+    ret = OMX_ErrorInsufficientResources;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_FreeBuffer(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_U32        nPortIndex,
+    OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *temp_bufferHeader = NULL;
+    OMX_U8                *temp_buffer = NULL;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECPort = &pSECComponent->pSECPort[nPortIndex];
+
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    if ((pSECPort->portState != OMX_StateLoaded) && (pSECPort->portState != OMX_StateInvalid)) {
+        (*(pSECComponent->pCallbacks->EventHandler)) (pOMXComponent,
+                        pSECComponent->callbackData,
+                        (OMX_U32)OMX_EventError,
+                        (OMX_U32)OMX_ErrorPortUnpopulated,
+                        nPortIndex, NULL);
+    }
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (((pSECPort->bufferStateAllocate[i] | BUFFER_STATE_FREE) != 0) && (pSECPort->bufferHeader[i] != NULL)) {
+            if (pSECPort->bufferHeader[i]->pBuffer == pBufferHdr->pBuffer) {
+                if (pSECPort->bufferStateAllocate[i] & BUFFER_STATE_ALLOCATED) {
+                    SEC_OSAL_Free(pSECPort->bufferHeader[i]->pBuffer);
+                    pSECPort->bufferHeader[i]->pBuffer = NULL;
+                    pBufferHdr->pBuffer = NULL;
+                } else if (pSECPort->bufferStateAllocate[i] & BUFFER_STATE_ASSIGNED) {
+                    ; /* None*/
+                }
+                pSECPort->assignedBufferNum--;
+                if (pSECPort->bufferStateAllocate[i] & HEADER_STATE_ALLOCATED) {
+                    SEC_OSAL_Free(pSECPort->bufferHeader[i]);
+                    pSECPort->bufferHeader[i] = NULL;
+                    pBufferHdr = NULL;
+                }
+                pSECPort->bufferStateAllocate[i] = BUFFER_STATE_FREE;
+                ret = OMX_ErrorNone;
+                goto EXIT;
+            }
+        }
+    }
+
+EXIT:
+    if (ret == OMX_ErrorNone) {
+        if (pSECPort->assignedBufferNum == 0) {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "pSECPort->unloadedResource signal set");
+            /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+            SEC_OSAL_SemaphorePost(pSECPort->unloadedResource);
+            /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            pSECPort->portDefinition.bPopulated = OMX_FALSE;
+        }
+    }
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AllocateTunnelBuffer(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex)
+{
+    OMX_ERRORTYPE                 ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT             *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE         *temp_bufferHeader = NULL;
+    OMX_U8                       *temp_buffer = NULL;
+    OMX_U32                       bufferSize = 0;
+    OMX_PARAM_PORTDEFINITIONTYPE  portDefinition;
+
+    ret = OMX_ErrorTunnelingUnsupported;
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_FreeTunnelBuffer(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT* pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE* temp_bufferHeader = NULL;
+    OMX_U8 *temp_buffer = NULL;
+    OMX_U32 bufferSize = 0;
+
+    ret = OMX_ErrorTunnelingUnsupported;
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentTunnelRequest(
+    OMX_IN OMX_HANDLETYPE hComp,
+    OMX_IN OMX_U32        nPort,
+    OMX_IN OMX_HANDLETYPE hTunneledComp,
+    OMX_IN OMX_U32        nTunneledPort,
+    OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    ret = OMX_ErrorTunnelingUnsupported;
+EXIT:
+    return ret;
+}
+
+OMX_BOOL SEC_Check_BufferProcess_State(SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    if ((pSECComponent->currentState == OMX_StateExecuting) &&
+        (pSECComponent->pSECPort[INPUT_PORT_INDEX].portState == OMX_StateIdle) &&
+        (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portState == OMX_StateIdle) &&
+        (pSECComponent->transientState != SEC_OMX_TransStateExecutingToIdle) &&
+        (pSECComponent->transientState != SEC_OMX_TransStateIdleToExecuting)) {
+        return OMX_TRUE;
+    } else {
+        return OMX_FALSE;
+    }
+}
+
+static OMX_ERRORTYPE SEC_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secOMXInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOMXOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+    OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader;
+
+    FunctionIn();
+
+    if (bufferHeader != NULL) {
+        if (secOMXInputPort->markType.hMarkTargetComponent != NULL ) {
+            bufferHeader->hMarkTargetComponent      = secOMXInputPort->markType.hMarkTargetComponent;
+            bufferHeader->pMarkData                 = secOMXInputPort->markType.pMarkData;
+            secOMXInputPort->markType.hMarkTargetComponent = NULL;
+            secOMXInputPort->markType.pMarkData = NULL;
+        }
+
+        if (bufferHeader->hMarkTargetComponent != NULL) {
+            if (bufferHeader->hMarkTargetComponent == pOMXComponent) {
+                pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                                pSECComponent->callbackData,
+                                OMX_EventMark,
+                                0, 0, bufferHeader->pMarkData);
+            } else {
+                pSECComponent->propagateMarkType.hMarkTargetComponent = bufferHeader->hMarkTargetComponent;
+                pSECComponent->propagateMarkType.pMarkData = bufferHeader->pMarkData;
+            }
+        }
+
+        if (CHECK_PORT_TUNNELED(secOMXInputPort)) {
+            OMX_FillThisBuffer(secOMXInputPort->tunneledComponent, bufferHeader);
+        } else {
+            bufferHeader->nFilledLen = 0;
+            pSECComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader);
+        }
+    }
+
+    if ((pSECComponent->currentState == OMX_StatePause) &&
+        ((!CHECK_PORT_BEING_FLUSHED(secOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(secOMXOutputPort)))) {
+        SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME);
+        SEC_OSAL_SignalReset(pSECComponent->pauseEvent);
+    }
+
+    dataBuffer->dataValid     = OMX_FALSE;
+    dataBuffer->dataLen       = 0;
+    dataBuffer->remainDataLen = 0;
+    dataBuffer->usedDataLen   = 0;
+    dataBuffer->bufferHeader  = NULL;
+    dataBuffer->nFlags        = 0;
+    dataBuffer->timeStamp     = 0;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    OMX_ERRORTYPE       ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT   *pSECPort = NULL;
+    SEC_OMX_DATABUFFER *dataBuffer = NULL;
+    SEC_OMX_MESSAGE*    message = NULL;
+    SEC_OMX_DATABUFFER *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+
+    FunctionIn();
+
+    pSECPort= &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    dataBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+
+    if (pSECComponent->currentState != OMX_StateExecuting) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    } else {
+        SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID);
+        SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
+        if (dataBuffer->dataValid != OMX_TRUE) {
+            message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+            if (message == NULL) {
+                ret = OMX_ErrorUndefined;
+                SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+                goto EXIT;
+            }
+
+            dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData);
+            dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen;
+            dataBuffer->dataLen = dataBuffer->bufferHeader->nFilledLen;
+            dataBuffer->remainDataLen = dataBuffer->dataLen;
+            dataBuffer->usedDataLen = 0;
+            dataBuffer->dataValid = OMX_TRUE;
+            dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags;
+            dataBuffer->timeStamp = dataBuffer->bufferHeader->nTimeStamp;
+
+            SEC_OSAL_Free(message);
+
+            if (dataBuffer->allocSize <= dataBuffer->dataLen)
+                SEC_OSAL_Log(SEC_LOG_WARNING, "Input Buffer Full, Check input buffer size! allocSize:%d, dataLen:%d", dataBuffer->allocSize, dataBuffer->dataLen);
+        }
+        SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+        ret = OMX_ErrorNone;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secOMXInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOMXOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+    OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader;
+
+    FunctionIn();
+
+    if (bufferHeader != NULL) {
+        bufferHeader->nFilledLen = dataBuffer->remainDataLen;
+        bufferHeader->nOffset    = 0;
+        bufferHeader->nFlags     = dataBuffer->nFlags;
+        bufferHeader->nTimeStamp = dataBuffer->timeStamp;
+
+        if (pSECComponent->propagateMarkType.hMarkTargetComponent != NULL) {
+            bufferHeader->hMarkTargetComponent = pSECComponent->propagateMarkType.hMarkTargetComponent;
+            bufferHeader->pMarkData = pSECComponent->propagateMarkType.pMarkData;
+            pSECComponent->propagateMarkType.hMarkTargetComponent = NULL;
+            pSECComponent->propagateMarkType.pMarkData = NULL;
+        }
+
+        if (bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) {
+            pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                            pSECComponent->callbackData,
+                            OMX_EventBufferFlag,
+                            OUTPUT_PORT_INDEX,
+                            bufferHeader->nFlags, NULL);
+        }
+
+        if (CHECK_PORT_TUNNELED(secOMXOutputPort)) {
+            OMX_EmptyThisBuffer(secOMXOutputPort->tunneledComponent, bufferHeader);
+        } else {
+            pSECComponent->pCallbacks->FillBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader);
+        }
+    }
+
+    if ((pSECComponent->currentState == OMX_StatePause) &&
+        ((!CHECK_PORT_BEING_FLUSHED(secOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(secOMXOutputPort)))) {
+        SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME);
+        SEC_OSAL_SignalReset(pSECComponent->pauseEvent);
+    }
+
+    /* reset dataBuffer */
+    dataBuffer->dataValid     = OMX_FALSE;
+    dataBuffer->dataLen       = 0;
+    dataBuffer->remainDataLen = 0;
+    dataBuffer->usedDataLen   = 0;
+    dataBuffer->bufferHeader  = NULL;
+    dataBuffer->nFlags        = 0;
+    dataBuffer->timeStamp     = 0;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    OMX_ERRORTYPE       ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT   *pSECPort = NULL;
+    SEC_OMX_DATABUFFER *dataBuffer = NULL;
+    SEC_OMX_MESSAGE    *message = NULL;
+    SEC_OMX_DATABUFFER *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+
+    FunctionIn();
+
+    pSECPort= &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    dataBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+
+    if (pSECComponent->currentState != OMX_StateExecuting) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    } else {
+        SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID);
+        SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+        if (dataBuffer->dataValid != OMX_TRUE) {
+            message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+            if (message == NULL) {
+                ret = OMX_ErrorUndefined;
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+                goto EXIT;
+            }
+
+            dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData);
+            dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen;
+            dataBuffer->dataLen = 0; //dataBuffer->bufferHeader->nFilledLen;
+            dataBuffer->remainDataLen = dataBuffer->dataLen;
+            dataBuffer->usedDataLen = 0; //dataBuffer->bufferHeader->nOffset;
+            dataBuffer->dataValid =OMX_TRUE;
+            /* dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags; */
+            /* dataBuffer->nTimeStamp = dataBuffer->bufferHeader->nTimeStamp; */
+            pSECComponent->processData[OUTPUT_PORT_INDEX].dataBuffer = dataBuffer->bufferHeader->pBuffer;
+            pSECComponent->processData[OUTPUT_PORT_INDEX].allocSize = dataBuffer->bufferHeader->nAllocLen;
+
+            SEC_OSAL_Free(message);
+        }
+        SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+        ret = OMX_ErrorNone;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+
+}
+
+static OMX_ERRORTYPE SEC_BufferReset(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 portIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    /* SEC_OMX_BASEPORT      *pSECPort = &pSECComponent->pSECPort[portIndex]; */
+    SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[portIndex];
+    /* OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader; */
+
+    dataBuffer->dataValid     = OMX_FALSE;
+    dataBuffer->dataLen       = 0;
+    dataBuffer->remainDataLen = 0;
+    dataBuffer->usedDataLen   = 0;
+    dataBuffer->bufferHeader  = NULL;
+    dataBuffer->nFlags        = 0;
+    dataBuffer->timeStamp     = 0;
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_DataReset(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 portIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    /* SEC_OMX_BASEPORT      *pSECPort = &pSECComponent->pSECPort[portIndex]; */
+    /* SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[portIndex]; */
+    /* OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader; */
+    SEC_OMX_DATA          *processData = &pSECComponent->processData[portIndex];
+
+    processData->dataLen       = 0;
+    processData->remainDataLen = 0;
+    processData->usedDataLen   = 0;
+    processData->nFlags        = 0;
+    processData->timeStamp     = 0;
+
+    return ret;
+}
+
+OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_BOOL               ret = OMX_FALSE;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+    SEC_OMX_DATA          *inputData = &pSECComponent->processData[INPUT_PORT_INDEX];
+    OMX_U32                copySize = 0;
+    OMX_BYTE               checkInputStream = NULL;
+    OMX_U32                checkInputStreamLen = 0;
+    OMX_U32                checkedSize = 0;
+    OMX_BOOL               flagEOF = OMX_FALSE;
+    OMX_BOOL               previousFrameEOF = OMX_FALSE;
+
+    FunctionIn();
+
+    if (inputUseBuffer->dataValid == OMX_TRUE) {
+        checkInputStream = inputUseBuffer->bufferHeader->pBuffer + inputUseBuffer->usedDataLen;
+        checkInputStreamLen = inputUseBuffer->remainDataLen;
+
+        if (inputData->dataLen == 0) {
+            previousFrameEOF = OMX_TRUE;
+        } else {
+            previousFrameEOF = OMX_FALSE;
+        }
+
+        /* Audio extractor should parse into frame units. */
+        flagEOF = OMX_TRUE;
+        checkedSize = checkInputStreamLen;
+        copySize = checkedSize;
+
+        if (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS)
+            pSECComponent->bSaveFlagEOS = OMX_TRUE;
+
+        if (((inputData->allocSize) - (inputData->dataLen)) >= copySize) {
+            if (copySize > 0)
+                SEC_OSAL_Memcpy(inputData->dataBuffer + inputData->dataLen, checkInputStream, copySize);
+
+            inputUseBuffer->dataLen -= copySize;
+            inputUseBuffer->remainDataLen -= copySize;
+            inputUseBuffer->usedDataLen += copySize;
+
+            inputData->dataLen += copySize;
+            inputData->remainDataLen += copySize;
+
+            if (previousFrameEOF == OMX_TRUE) {
+                inputData->timeStamp = inputUseBuffer->timeStamp;
+                inputData->nFlags = inputUseBuffer->nFlags;
+            }
+
+            if (pSECComponent->bUseFlagEOF == OMX_TRUE) {
+                if (pSECComponent->bSaveFlagEOS == OMX_TRUE) {
+                    inputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                    flagEOF = OMX_TRUE;
+                    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+                } else {
+                    inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+                }
+            } else {
+                if ((checkedSize == checkInputStreamLen) && (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+                    if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) &&
+                        ((inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) ||
+                        (inputData->dataLen == 0))) {
+                    inputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                    flagEOF = OMX_TRUE;
+                    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+                    } else if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) &&
+                               (!(inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) &&
+                               (inputData->dataLen != 0)) {
+                        inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+                        flagEOF = OMX_TRUE;
+                        pSECComponent->bSaveFlagEOS = OMX_TRUE;
+                    }
+                } else {
+                    inputData->nFlags = (inputUseBuffer->nFlags & (~OMX_BUFFERFLAG_EOS));
+                }
+            }
+        } else {
+            /*????????????????????????????????? Error ?????????????????????????????????*/
+            SEC_DataReset(pOMXComponent, INPUT_PORT_INDEX);
+            flagEOF = OMX_FALSE;
+        }
+
+        if ((inputUseBuffer->remainDataLen == 0) ||
+            (CHECK_PORT_BEING_FLUSHED(secInputPort)))
+            SEC_InputBufferReturn(pOMXComponent);
+        else
+            inputUseBuffer->dataValid = OMX_TRUE;
+    }
+
+    if (flagEOF == OMX_TRUE) {
+        if (pSECComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
+            /* Flush SRP buffers */
+            SRP_Flush();
+
+            pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_TRUE;
+            pSECComponent->checkTimeStamp.startTimeStamp = inputData->timeStamp;
+            pSECComponent->checkTimeStamp.nStartFlags = inputData->nFlags;
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "first frame timestamp after seeking %lld us (%.2f secs)",
+                inputData->timeStamp, inputData->timeStamp / 1E6);
+        }
+
+        ret = OMX_TRUE;
+    } else {
+        ret = OMX_FALSE;
+    }
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_BOOL               ret = OMX_FALSE;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATA          *outputData = &pSECComponent->processData[OUTPUT_PORT_INDEX];
+    OMX_U32                copySize = 0;
+
+    FunctionIn();
+
+    if (outputUseBuffer->dataValid == OMX_TRUE) {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE) {
+            if (pSECComponent->checkTimeStamp.startTimeStamp == outputData->timeStamp) {
+                pSECComponent->checkTimeStamp.startTimeStamp = -19761123;
+                pSECComponent->checkTimeStamp.nStartFlags = 0x0;
+                pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+                pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+            } else {
+                SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+                ret = OMX_TRUE;
+                goto EXIT;
+            }
+        } else if (pSECComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
+            SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+            ret = OMX_TRUE;
+            goto EXIT;
+        }
+
+        if (outputData->remainDataLen <= (outputUseBuffer->allocSize - outputUseBuffer->dataLen)) {
+            copySize = outputData->remainDataLen;
+
+            outputUseBuffer->dataLen += copySize;
+            outputUseBuffer->remainDataLen += copySize;
+            outputUseBuffer->nFlags = outputData->nFlags;
+            outputUseBuffer->timeStamp = outputData->timeStamp;
+
+            ret = OMX_TRUE;
+
+            /* reset outputData */
+            SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+
+            if ((outputUseBuffer->remainDataLen > 0) ||
+                (outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) ||
+                (CHECK_PORT_BEING_FLUSHED(secOutputPort)))
+                SEC_OutputBufferReturn(pOMXComponent);
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "output buffer is smaller than decoded data size Out Length");
+
+            ret = OMX_FALSE;
+
+            /* reset outputData */
+            SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+        }
+    } else {
+        ret = OMX_FALSE;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_AUDIODEC_COMPONENT *pVideoDec = (SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT      *secInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATA          *inputData = &pSECComponent->processData[INPUT_PORT_INDEX];
+    SEC_OMX_DATA          *outputData = &pSECComponent->processData[OUTPUT_PORT_INDEX];
+    OMX_U32                copySize = 0;
+
+    pSECComponent->remainOutputData = OMX_FALSE;
+    pSECComponent->reInputData = OMX_FALSE;
+
+    FunctionIn();
+
+    while (!pSECComponent->bExitBufferProcessThread) {
+        SEC_OSAL_SleepMillisec(0);
+
+        if (((pSECComponent->currentState == OMX_StatePause) ||
+            (pSECComponent->currentState == OMX_StateIdle) ||
+            (pSECComponent->transientState == SEC_OMX_TransStateLoadedToIdle) ||
+            (pSECComponent->transientState == SEC_OMX_TransStateExecutingToIdle)) &&
+            (pSECComponent->transientState != SEC_OMX_TransStateIdleToLoaded)&&
+            ((!CHECK_PORT_BEING_FLUSHED(secInputPort) && !CHECK_PORT_BEING_FLUSHED(secOutputPort)))) {
+            SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME);
+            SEC_OSAL_SignalReset(pSECComponent->pauseEvent);
+        }
+
+        while ((SEC_Check_BufferProcess_State(pSECComponent)) && (!pSECComponent->bExitBufferProcessThread)) {
+            SEC_OSAL_SleepMillisec(0);
+
+            SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+            if ((outputUseBuffer->dataValid != OMX_TRUE) &&
+                (!CHECK_PORT_BEING_FLUSHED(secOutputPort))) {
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+                ret = SEC_OutputBufferGetQueue(pSECComponent);
+                if ((ret == OMX_ErrorUndefined) ||
+                    (secInputPort->portState != OMX_StateIdle) ||
+                    (secOutputPort->portState != OMX_StateIdle)) {
+                    break;
+                }
+            } else {
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+            }
+
+            if (pSECComponent->remainOutputData == OMX_FALSE) {
+                if (pSECComponent->reInputData == OMX_FALSE) {
+                    SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
+                    if ((SEC_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) &&
+                        (!CHECK_PORT_BEING_FLUSHED(secInputPort))) {
+                            SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+                            ret = SEC_InputBufferGetQueue(pSECComponent);
+                            break;
+                    }
+
+                    SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+                }
+
+                SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
+                SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+                ret = pSECComponent->sec_mfc_bufferProcess(pOMXComponent, inputData, outputData);
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+                SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+
+                if (ret == OMX_ErrorInputDataDecodeYet)
+                    pSECComponent->reInputData = OMX_TRUE;
+                else
+                    pSECComponent->reInputData = OMX_FALSE;
+            }
+
+            SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+
+            if (SEC_Postprocess_OutputData(pOMXComponent) == OMX_FALSE)
+                pSECComponent->remainOutputData = OMX_TRUE;
+            else
+                pSECComponent->remainOutputData = OMX_FALSE;
+
+            SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+        }
+    }
+
+EXIT:
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AudioDecodeGetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamAudioInit:
+    {
+        OMX_PORT_PARAM_TYPE *portParam = (OMX_PORT_PARAM_TYPE *)ComponentParameterStructure;
+        ret = SEC_OMX_Check_SizeVersion(portParam, sizeof(OMX_PORT_PARAM_TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        portParam->nPorts           = pSECComponent->portParam.nPorts;
+        portParam->nStartPortNumber = pSECComponent->portParam.nStartPortNumber;
+        ret = OMX_ErrorNone;
+    }
+        break;
+    case OMX_IndexParamAudioPortFormat:
+    {
+        OMX_AUDIO_PARAM_PORTFORMATTYPE *portFormat = (OMX_AUDIO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure;
+        OMX_U32                         portIndex = portFormat->nPortIndex;
+        OMX_U32                         index    = portFormat->nIndex;
+        SEC_OMX_BASEPORT               *pSECPort = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE   *portDefinition = NULL;
+        OMX_U32                         supportFormatNum = 0; /* supportFormatNum = N-1 */
+
+        ret = SEC_OMX_Check_SizeVersion(portFormat, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((portIndex >= pSECComponent->portParam.nPorts)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            supportFormatNum = INPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1;
+            if (index > supportFormatNum) {
+                ret = OMX_ErrorNoMore;
+                goto EXIT;
+            }
+
+            pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+            portDefinition = &pSECPort->portDefinition;
+
+            portFormat->eEncoding = portDefinition->format.audio.eEncoding;
+        } else if (portIndex == OUTPUT_PORT_INDEX) {
+            supportFormatNum = OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1;
+            if (index > supportFormatNum) {
+                ret = OMX_ErrorNoMore;
+                goto EXIT;
+            }
+
+            pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+            portDefinition = &pSECPort->portDefinition;
+
+            portFormat->eEncoding = portDefinition->format.audio.eEncoding;
+        }
+        ret = OMX_ErrorNone;
+    }
+        break;
+    default:
+    {
+        ret = SEC_OMX_GetParameter(hComponent, nParamIndex, ComponentParameterStructure);
+    }
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+OMX_ERRORTYPE SEC_OMX_AudioDecodeSetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamAudioPortFormat:
+    {
+        OMX_AUDIO_PARAM_PORTFORMATTYPE *portFormat = (OMX_AUDIO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure;
+        OMX_U32                         portIndex = portFormat->nPortIndex;
+        OMX_U32                         index    = portFormat->nIndex;
+        SEC_OMX_BASEPORT               *pSECPort = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE   *portDefinition = NULL;
+        OMX_U32                         supportFormatNum = 0; /* supportFormatNum = N-1 */
+
+        ret = SEC_OMX_Check_SizeVersion(portFormat, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((portIndex >= pSECComponent->portParam.nPorts)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+        portDefinition = &pSECPort->portDefinition;
+
+        portDefinition->format.audio.eEncoding = portFormat->eEncoding;
+        ret = OMX_ErrorNone;
+    }
+        break;
+    default:
+    {
+        ret = SEC_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure);
+    }
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AudioDecodeGetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_GetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AudioDecodeSetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexConfigAudioMute:
+    {
+        SEC_OSAL_Log(SEC_LOG_TRACE, "OMX_IndexConfigAudioMute");
+        ret = OMX_ErrorUnsupportedIndex;
+    }
+        break;
+    case OMX_IndexConfigAudioVolume:
+    {
+        SEC_OSAL_Log(SEC_LOG_TRACE, "OMX_IndexConfigAudioVolume");
+        ret = OMX_ErrorUnsupportedIndex;
+    }
+        break;
+    default:
+        ret = SEC_OMX_SetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AudioDecodeGetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AudioDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE          *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = NULL;
+    SEC_OMX_BASEPORT           *pSECPort = NULL;
+    SEC_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_BaseComponent_Constructor(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_Port_Constructor(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OMX_BaseComponent_Destructor(pOMXComponent);
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pAudioDec = SEC_OSAL_Malloc(sizeof(SEC_OMX_AUDIODEC_COMPONENT));
+    if (pAudioDec == NULL) {
+        SEC_OMX_BaseComponent_Destructor(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    SEC_OSAL_Memset(pAudioDec, 0, sizeof(SEC_OMX_AUDIODEC_COMPONENT));
+    pSECComponent->hComponentHandle = (OMX_HANDLETYPE)pAudioDec;
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.nBufferCountActual = MAX_AUDIO_INPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferCountMin = MAX_AUDIO_INPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_AUDIO_INPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.eDomain = OMX_PortDomainAudio;
+
+    pSECPort->portDefinition.format.audio.cMIMEType = SEC_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.audio.cMIMEType, "audio/raw");
+    pSECPort->portDefinition.format.audio.pNativeRender = 0;
+    pSECPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingUnused;
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.nBufferCountActual = MAX_AUDIO_OUTPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferCountMin = MAX_AUDIO_OUTPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.eDomain = OMX_PortDomainAudio;
+
+    pSECPort->portDefinition.format.audio.cMIMEType = SEC_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.audio.cMIMEType, "audio/raw");
+    pSECPort->portDefinition.format.audio.pNativeRender = 0;
+    pSECPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingUnused;
+
+
+    pOMXComponent->UseBuffer              = &SEC_OMX_UseBuffer;
+    pOMXComponent->AllocateBuffer         = &SEC_OMX_AllocateBuffer;
+    pOMXComponent->FreeBuffer             = &SEC_OMX_FreeBuffer;
+    pOMXComponent->ComponentTunnelRequest = &SEC_OMX_ComponentTunnelRequest;
+
+    pSECComponent->sec_AllocateTunnelBuffer = &SEC_OMX_AllocateTunnelBuffer;
+    pSECComponent->sec_FreeTunnelBuffer     = &SEC_OMX_FreeTunnelBuffer;
+    pSECComponent->sec_BufferProcess        = &SEC_OMX_BufferProcess;
+    pSECComponent->sec_BufferReset          = &SEC_BufferReset;
+    pSECComponent->sec_InputBufferReturn    = &SEC_InputBufferReturn;
+    pSECComponent->sec_OutputBufferReturn   = &SEC_OutputBufferReturn;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AudioDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE          *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = NULL;
+    SEC_OMX_BASEPORT           *pSECPort = NULL;
+    SEC_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL;
+    int                         i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pAudioDec = (SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OSAL_Free(pAudioDec);
+    pSECComponent->hComponentHandle = pAudioDec = NULL;
+
+    for(i = 0; i < ALL_PORT_NUM; i++) {
+        pSECPort = &pSECComponent->pSECPort[i];
+        SEC_OSAL_Free(pSECPort->portDefinition.format.audio.cMIMEType);
+        pSECPort->portDefinition.format.audio.cMIMEType = NULL;
+    }
+
+    ret = SEC_OMX_Port_Destructor(pOMXComponent);
+
+    ret = SEC_OMX_BaseComponent_Destructor(hComponent);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/audio/dec/SEC_OMX_Adec.h b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/SEC_OMX_Adec.h
new file mode 100644
index 0000000..8ff20ab
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/SEC_OMX_Adec.h
@@ -0,0 +1,132 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Adec.h
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ *
+ * @version     1.1.0
+ * @history
+ *   2011.10.18 : Create
+ */
+
+#ifndef SEC_OMX_AUDIO_DECODE
+#define SEC_OMX_AUDIO_DECODE
+
+#include "OMX_Component.h"
+#include "SEC_OMX_Def.h"
+#include "SEC_OSAL_Queue.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Basecomponent.h"
+
+#define MAX_AUDIO_INPUTBUFFER_NUM    2
+#define MAX_AUDIO_OUTPUTBUFFER_NUM   2
+
+#define DEFAULT_AUDIO_INPUT_BUFFER_SIZE     (16 * 1024)
+#define DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE    (32 * 1024)
+
+#define DEFAULT_AUDIO_SAMPLING_FREQ  44100
+#define DEFAULT_AUDIO_CHANNELS_NUM   2
+#define DEFAULT_AUDIO_BIT_PER_SAMPLE 16
+
+#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX    1
+#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX   1
+
+typedef struct _SRP_DEC_INPUT_BUFFER
+{
+    void *PhyAddr;      // physical address
+    void *VirAddr;      // virtual address
+    int   bufferSize;   // input buffer alloc size
+    int   dataSize;     // Data length
+} SRP_DEC_INPUT_BUFFER;
+
+typedef struct _SEC_OMX_AUDIODEC_COMPONENT
+{
+    OMX_HANDLETYPE hCodecHandle;
+
+    OMX_BOOL bFirstFrame;
+    OMX_PTR pInputBuffer;
+    SRP_DEC_INPUT_BUFFER SRPDecInputBuffer[MAX_AUDIO_INPUTBUFFER_NUM];
+    OMX_U32  indexInputBuffer;
+} SEC_OMX_AUDIODEC_COMPONENT;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OMX_UseBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes,
+    OMX_IN OMX_U8                   *pBuffer);
+OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes);
+OMX_ERRORTYPE SEC_OMX_FreeBuffer(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_U32        nPortIndex,
+    OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr);
+OMX_ERRORTYPE SEC_OMX_AllocateTunnelBuffer(
+    SEC_OMX_BASEPORT *pOMXBasePort,
+    OMX_U32           nPortIndex);
+OMX_ERRORTYPE SEC_OMX_FreeTunnelBuffer(
+    SEC_OMX_BASEPORT *pOMXBasePort,
+    OMX_U32           nPortIndex);
+OMX_ERRORTYPE SEC_OMX_ComponentTunnelRequest(
+    OMX_IN  OMX_HANDLETYPE hComp,
+    OMX_IN OMX_U32         nPort,
+    OMX_IN OMX_HANDLETYPE  hTunneledComp,
+    OMX_IN OMX_U32         nTunneledPort,
+    OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup);
+OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent);
+OMX_ERRORTYPE SEC_OMX_AudioDecodeGetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     ComponentParameterStructure);
+OMX_ERRORTYPE SEC_OMX_AudioDecodeSetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        ComponentParameterStructure);
+OMX_ERRORTYPE SEC_OMX_AudioDecodeGetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure);
+OMX_ERRORTYPE SEC_OMX_AudioDecodeSetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure);
+OMX_ERRORTYPE SEC_OMX_AudioDecodeGetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType);
+OMX_ERRORTYPE SEC_OMX_AudioDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent);
+OMX_ERRORTYPE SEC_OMX_AudioDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent);
+OMX_BOOL SEC_Check_BufferProcess_State(SEC_OMX_BASECOMPONENT *pSECComponent);
+inline void SEC_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SEC_OMX_AUDIO_DECODE */
diff --git a/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/Android.mk
new file mode 100644
index 0000000..43af655
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/Android.mk
@@ -0,0 +1,31 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Mp3dec.c \
+	library_register.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libOMX.SEC.MP3.Decoder
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx
+
+LOCAL_CFLAGS :=
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Adec libsecosal libsecbasecomponent \
+	libsrpapi
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
+	libSEC_OMX_Resourcemanager
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/audio/dec \
+	$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO)
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/SEC_OMX_Mp3dec.c b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/SEC_OMX_Mp3dec.c
new file mode 100644
index 0000000..a8c77f6
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/SEC_OMX_Mp3dec.c
@@ -0,0 +1,918 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file      SEC_OMX_Mp3dec.c
+ * @brief
+ * @author    Yunji Kim (yunji.kim@samsung.com)
+ * @version   1.1.0
+ * @history
+ *   2011.10.18 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Macros.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Adec.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Thread.h"
+#include "library_register.h"
+#include "SEC_OMX_Mp3dec.h"
+#include "srp_api.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_MP3_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+//#define SRP_DUMP_TO_FILE
+#ifdef SRP_DUMP_TO_FILE
+#include "stdio.h"
+
+FILE *inFile;
+FILE *outFile;
+#endif
+
+OMX_ERRORTYPE SEC_SRP_Mp3Dec_GetParameter(
+    OMX_IN    OMX_HANDLETYPE hComponent,
+    OMX_IN    OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamAudioMp3:
+    {
+        OMX_AUDIO_PARAM_MP3TYPE *pDstMp3Param = (OMX_AUDIO_PARAM_MP3TYPE *)pComponentParameterStructure;
+        OMX_AUDIO_PARAM_MP3TYPE *pSrcMp3Param = NULL;
+        SEC_MP3_HANDLE          *pMp3Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstMp3Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMp3Dec = (SEC_MP3_HANDLE *)((SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcMp3Param = &pMp3Dec->mp3Param;
+
+        SEC_OSAL_Memcpy(pDstMp3Param, pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE));
+    }
+        break;
+    case OMX_IndexParamAudioPcm:
+    {
+        OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure;
+        OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = NULL;
+        SEC_MP3_HANDLE              *pMp3Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstPcmParam->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMp3Dec = (SEC_MP3_HANDLE *)((SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcPcmParam = &pMp3Dec->pcmParam;
+
+        SEC_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_S32 codecType;
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_MP3_DEC_ROLE);
+    }
+        break;
+    default:
+        ret = SEC_OMX_AudioDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_SRP_Mp3Dec_SetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamAudioMp3:
+    {
+        OMX_AUDIO_PARAM_MP3TYPE *pDstMp3Param = NULL;
+        OMX_AUDIO_PARAM_MP3TYPE *pSrcMp3Param = (OMX_AUDIO_PARAM_MP3TYPE *)pComponentParameterStructure;
+        SEC_MP3_HANDLE          *pMp3Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcMp3Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMp3Dec = (SEC_MP3_HANDLE *)((SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstMp3Param = &pMp3Dec->mp3Param;
+
+        SEC_OSAL_Memcpy(pDstMp3Param, pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE));
+    }
+        break;
+    case OMX_IndexParamAudioPcm:
+    {
+        OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = NULL;
+        OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure;
+        SEC_MP3_HANDLE              *pMp3Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcPcmParam->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMp3Dec = (SEC_MP3_HANDLE *)((SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstPcmParam = &pMp3Dec->pcmParam;
+
+        SEC_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+
+        if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_MP3_DEC_ROLE)) {
+            pSECComponent->pSECPort[INPUT_PORT_INDEX].portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingMP3;
+        } else {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+    }
+        break;
+    default:
+        ret = SEC_OMX_AudioDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_SRP_Mp3Dec_GetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_AudioDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_SRP_Mp3Dec_SetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_AudioDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_SRP_Mp3Dec_GetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_AudioDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_SRP_Mp3Dec_ComponentRoleEnum(
+    OMX_IN  OMX_HANDLETYPE hComponent,
+    OMX_OUT OMX_U8        *cRole,
+    OMX_IN  OMX_U32        nIndex)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    OMX_S32                  codecType;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (cRole == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) {
+        ret = OMX_ErrorNoMore;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_MP3_DEC_ROLE);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_SRP_Mp3Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_AUDIODEC_COMPONENT *pAudioDec = (SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_MP3_HANDLE             *pMp3Dec = (SEC_MP3_HANDLE *)pAudioDec->hCodecHandle;
+
+    FunctionIn();
+
+    SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+    SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+    pSECComponent->bUseFlagEOF = OMX_TRUE; /* Mp3 extractor should parse into frame unit. */
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+    pMp3Dec->hSRPMp3Handle.bConfiguredSRP = OMX_FALSE;
+    pMp3Dec->hSRPMp3Handle.bSRPSendEOS = OMX_FALSE;
+    pSECComponent->getAllDelayBuffer = OMX_FALSE;
+
+#ifdef SRP_DUMP_TO_FILE
+    inFile = fopen("/data/InFile.mp3", "w+");
+    outFile = fopen("/data/OutFile.pcm", "w+");
+#endif
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_SRP_Mp3Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    FunctionIn();
+
+#ifdef SRP_DUMP_TO_FILE
+    fclose(inFile);
+    fclose(outFile);
+#endif
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_SRP_Mp3_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_AUDIODEC_COMPONENT *pAudioDec = (SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_MP3_HANDLE             *pMp3Dec = (SEC_MP3_HANDLE *)pAudioDec->hCodecHandle;
+    struct srp_dec_info         codecDecInfo;
+    OMX_S32                     returnCodec = 0;
+    unsigned long               isSRPStopped = 0;
+    OMX_PTR                     dataBuffer = NULL;
+    unsigned int                dataLen = 0;
+    OMX_BOOL                    isSRPIbufOverflow = OMX_FALSE;
+
+    FunctionIn();
+
+#ifdef SRP_DUMP_TO_FILE
+    if (pSECComponent->reInputData == OMX_FALSE) {
+        fwrite(pInputData->dataBuffer, pInputData->dataLen, 1, inFile);
+    }
+#endif
+
+    /* Save timestamp and flags of input data */
+    pOutputData->timeStamp = pInputData->timeStamp;
+    pOutputData->nFlags = pInputData->nFlags & (~OMX_BUFFERFLAG_EOS);
+
+    /* Decoding mp3 frames by SRP */
+    if (pSECComponent->getAllDelayBuffer == OMX_FALSE) {
+        returnCodec = SRP_Decode(pInputData->dataBuffer, pInputData->dataLen);
+
+        if (returnCodec >= 0) {
+            if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
+                SRP_Send_EOS();
+                pMp3Dec->hSRPMp3Handle.bSRPSendEOS = OMX_TRUE;
+            }
+        } else if (returnCodec == SRP_ERROR_IBUF_OVERFLOW) {
+            isSRPIbufOverflow = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        }
+    }
+
+    if (pMp3Dec->hSRPMp3Handle.bConfiguredSRP == OMX_FALSE) {
+        returnCodec = SRP_Get_Dec_Info(&codecDecInfo);
+        if (returnCodec < 0) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "SRP_Get_Dec_Info failed: %d", returnCodec);
+            ret = OMX_ErrorHardware;
+            goto EXIT;
+        }
+
+        if (!codecDecInfo.sample_rate || !codecDecInfo.channels) {
+            if (pMp3Dec->hSRPMp3Handle.bSRPSendEOS == OMX_TRUE) {
+                pOutputData->dataLen = 0;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else {
+                pSECComponent->getAllDelayBuffer = OMX_FALSE;
+                if (isSRPIbufOverflow)
+                    ret = OMX_ErrorInputDataDecodeYet;
+                else
+                    ret = OMX_ErrorNone;
+            }
+            goto EXIT;
+        }
+
+        SEC_OSAL_Log(SEC_LOG_TRACE, "numChannels(%d), samplingRate(%d)",
+            codecDecInfo.channels, codecDecInfo.sample_rate);
+
+        if (pMp3Dec->pcmParam.nChannels != codecDecInfo.channels ||
+            pMp3Dec->pcmParam.nSamplingRate != codecDecInfo.sample_rate) {
+            /* Change channel count and sampling rate information */
+            pMp3Dec->pcmParam.nChannels = codecDecInfo.channels;
+            pMp3Dec->pcmParam.nSamplingRate = codecDecInfo.sample_rate;
+
+            /* Send Port Settings changed call back */
+            (*(pSECComponent->pCallbacks->EventHandler))
+                  (pOMXComponent,
+                   pSECComponent->callbackData,
+                   OMX_EventPortSettingsChanged, /* The command was completed */
+                   OMX_DirOutput, /* This is the port index */
+                   0,
+                   NULL);
+        }
+
+        pMp3Dec->hSRPMp3Handle.bConfiguredSRP = OMX_TRUE;
+
+        if (pMp3Dec->hSRPMp3Handle.bSRPSendEOS == OMX_TRUE) {
+            pOutputData->dataLen = 0;
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            if (isSRPIbufOverflow)
+                ret = OMX_ErrorInputDataDecodeYet;
+            else
+                ret = OMX_ErrorNone;
+        }
+        goto EXIT;
+    }
+
+    /* Get decoded data from SRP */
+    returnCodec = SRP_Get_PCM(&dataBuffer, &dataLen);
+    if (dataLen > 0) {
+        pOutputData->dataLen = dataLen;
+        SEC_OSAL_Memcpy(pOutputData->dataBuffer, dataBuffer, dataLen);
+    } else {
+        pOutputData->dataLen = 0;
+    }
+
+#ifdef SRP_DUMP_TO_FILE
+    if (pOutputData->dataLen > 0)
+        fwrite(pOutputData->dataBuffer, pOutputData->dataLen, 1, outFile);
+#endif
+
+    /* Delay EOS signal until all the PCM is returned from the SRP driver. */
+    if (pMp3Dec->hSRPMp3Handle.bSRPSendEOS == OMX_TRUE) {
+        if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
+            returnCodec = SRP_GetParams(SRP_STOP_EOS_STATE, &isSRPStopped);
+            if (returnCodec != 0)
+                SEC_OSAL_Log(SEC_LOG_ERROR, "Fail SRP_STOP_EOS_STATE");
+            if (isSRPStopped == 1) {
+                pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_FALSE;
+                pMp3Dec->hSRPMp3Handle.bSRPSendEOS = OMX_FALSE; /* for repeating one song */
+                ret = OMX_ErrorNone;
+            } else {
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            }
+        } else { /* Flush after EOS */
+            pMp3Dec->hSRPMp3Handle.bSRPSendEOS = OMX_FALSE;
+        }
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_SRP_Mp3Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *pInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *pOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    FunctionIn();
+
+    if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) ||
+            (!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) {
+        if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
+            ret = OMX_ErrorInputDataDecodeYet;
+        else
+            ret = OMX_ErrorNone;
+
+        goto EXIT;
+    }
+    if (OMX_FALSE == SEC_Check_BufferProcess_State(pSECComponent)) {
+        if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
+            ret = OMX_ErrorInputDataDecodeYet;
+        else
+            ret = OMX_ErrorNone;
+
+        goto EXIT;
+    }
+
+    ret = SEC_SRP_Mp3_Decode_Block(pOMXComponent, pInputData, pOutputData);
+
+    if (ret != OMX_ErrorNone) {
+        if (ret == OMX_ErrorInputDataDecodeYet) {
+            pOutputData->usedDataLen = 0;
+            pOutputData->remainDataLen = pOutputData->dataLen;
+        } else {
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+                                                    pSECComponent->callbackData,
+                                                    OMX_EventError, ret, 0, NULL);
+        }
+    } else {
+        pInputData->previousDataLen = pInputData->dataLen;
+        pInputData->usedDataLen += pInputData->dataLen;
+        pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
+        pInputData->dataLen -= pInputData->usedDataLen;
+        pInputData->usedDataLen = 0;
+
+        pOutputData->usedDataLen = 0;
+        pOutputData->remainDataLen = pOutputData->dataLen;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE          *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = NULL;
+    SEC_OMX_BASEPORT           *pSECPort = NULL;
+    SEC_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL;
+    SEC_MP3_HANDLE             *pMp3Dec = NULL;
+    OMX_PTR                     pInputBuffer = NULL;
+    OMX_PTR                     pOutputBuffer = NULL;
+    unsigned int                inputBufferSize = 0;
+    unsigned int                inputBufferNum = 0;
+    unsigned int                outputBufferSize = 0;
+    unsigned int                outputBufferNum = 0;
+    OMX_S32                     returnCodec;
+    int i = 0;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (componentName == NULL)) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret);
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_MP3_DEC, componentName) != 0) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret);
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_AudioDecodeComponentInit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_OMX_AudioDecodeComponentInit error, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECComponent->codecType = HW_AUDIO_DEC_CODEC;
+
+    pSECComponent->componentName = (OMX_STRING)SEC_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
+    if (pSECComponent->componentName == NULL) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret);
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT_ERROR_1;
+    }
+    SEC_OSAL_Memset(pSECComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
+    SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_MP3_DEC);
+
+    pMp3Dec = SEC_OSAL_Malloc(sizeof(SEC_MP3_HANDLE));
+    if (pMp3Dec == NULL) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_MP3_HANDLE alloc error, ret: %X", __FUNCTION__, ret);
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT_ERROR_2;
+    }
+    SEC_OSAL_Memset(pMp3Dec, 0, sizeof(SEC_MP3_HANDLE));
+    pAudioDec = (SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    pAudioDec->hCodecHandle = (OMX_HANDLETYPE)pMp3Dec;
+
+    /* Create and Init SRP */
+    pMp3Dec->hSRPMp3Handle.bSRPLoaded = OMX_FALSE;
+    returnCodec = SRP_Create(SRP_INIT_BLOCK_MODE);
+    if (returnCodec < 0) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "SRP_Create failed: %d", returnCodec);
+        ret = OMX_ErrorHardware;
+        goto EXIT_ERROR_3;
+    }
+    pMp3Dec->hSRPMp3Handle.hSRPHandle = (OMX_HANDLETYPE)returnCodec; /* SRP's fd */
+    returnCodec = SRP_Init();
+    if (returnCodec < 0) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "SRP_Init failed: %d", returnCodec);
+        ret = OMX_ErrorHardware;
+        goto EXIT_ERROR_4;
+    }
+    pMp3Dec->hSRPMp3Handle.bSRPLoaded = OMX_TRUE;
+
+    /* Get input buffer info from SRP */
+    returnCodec = SRP_Get_Ibuf_Info(&pInputBuffer, &inputBufferSize, &inputBufferNum);
+    if (returnCodec < 0) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "SRP_Get_Ibuf_Info failed: %d", returnCodec);
+        ret = OMX_ErrorHardware;
+        goto EXIT_ERROR_5;
+    }
+
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = inputBufferSize;
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = SEC_OSAL_Malloc(inputBufferSize);
+    if (pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer == NULL) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "Input data buffer alloc failed");
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT_ERROR_5;
+    }
+
+    /* Get output buffer info from SRP */
+    returnCodec = SRP_Get_Obuf_Info(&pOutputBuffer, &outputBufferSize, &outputBufferNum);
+    if (returnCodec < 0) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "SRP_Get_Obuf_Info failed: %d", returnCodec);
+        ret = OMX_ErrorHardware;
+        goto EXIT_ERROR_6;
+    }
+
+    /* Set componentVersion */
+    pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->componentVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->componentVersion.s.nStep         = STEP_NUMBER;
+
+    /* Set specVersion */
+    pSECComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->specVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->specVersion.s.nStep         = STEP_NUMBER;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.nBufferCountActual = inputBufferNum;
+    pSECPort->portDefinition.nBufferCountMin = inputBufferNum;
+    pSECPort->portDefinition.nBufferSize = inputBufferSize;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.audio.cMIMEType, "audio/mpeg");
+    pSECPort->portDefinition.format.audio.pNativeRender = 0;
+    pSECPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingMP3;
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.nBufferCountActual = outputBufferNum;
+    pSECPort->portDefinition.nBufferCountMin = outputBufferNum;
+    pSECPort->portDefinition.nBufferSize = outputBufferSize;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.audio.cMIMEType, "audio/raw");
+    pSECPort->portDefinition.format.audio.pNativeRender = 0;
+    pSECPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
+
+    /* Default values for Mp3 audio param */
+    INIT_SET_SIZE_VERSION(&pMp3Dec->mp3Param, OMX_AUDIO_PARAM_MP3TYPE);
+    pMp3Dec->mp3Param.nPortIndex      = INPUT_PORT_INDEX;
+    pMp3Dec->mp3Param.nChannels       = DEFAULT_AUDIO_CHANNELS_NUM;
+    pMp3Dec->mp3Param.nBitRate        = 0;
+    pMp3Dec->mp3Param.nSampleRate     = DEFAULT_AUDIO_SAMPLING_FREQ;
+    pMp3Dec->mp3Param.nAudioBandWidth = 0;
+    pMp3Dec->mp3Param.eChannelMode    = OMX_AUDIO_ChannelModeStereo;
+    pMp3Dec->mp3Param.eFormat         = OMX_AUDIO_MP3StreamFormatMP1Layer3;
+
+    /* Default values for PCM audio param */
+    INIT_SET_SIZE_VERSION(&pMp3Dec->pcmParam, OMX_AUDIO_PARAM_PCMMODETYPE);
+    pMp3Dec->pcmParam.nPortIndex         = OUTPUT_PORT_INDEX;
+    pMp3Dec->pcmParam.nChannels          = DEFAULT_AUDIO_CHANNELS_NUM;
+    pMp3Dec->pcmParam.eNumData           = OMX_NumericalDataSigned;
+    pMp3Dec->pcmParam.eEndian            = OMX_EndianLittle;
+    pMp3Dec->pcmParam.bInterleaved       = OMX_TRUE;
+    pMp3Dec->pcmParam.nBitPerSample      = DEFAULT_AUDIO_BIT_PER_SAMPLE;
+    pMp3Dec->pcmParam.nSamplingRate      = DEFAULT_AUDIO_SAMPLING_FREQ;
+    pMp3Dec->pcmParam.ePCMMode           = OMX_AUDIO_PCMModeLinear;
+    pMp3Dec->pcmParam.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
+    pMp3Dec->pcmParam.eChannelMapping[1] = OMX_AUDIO_ChannelRF;
+
+    pOMXComponent->GetParameter      = &SEC_SRP_Mp3Dec_GetParameter;
+    pOMXComponent->SetParameter      = &SEC_SRP_Mp3Dec_SetParameter;
+    pOMXComponent->GetConfig         = &SEC_SRP_Mp3Dec_GetConfig;
+    pOMXComponent->SetConfig         = &SEC_SRP_Mp3Dec_SetConfig;
+    pOMXComponent->GetExtensionIndex = &SEC_SRP_Mp3Dec_GetExtensionIndex;
+    pOMXComponent->ComponentRoleEnum = &SEC_SRP_Mp3Dec_ComponentRoleEnum;
+    pOMXComponent->ComponentDeInit   = &SEC_OMX_ComponentDeinit;
+
+    /* ToDo: Change the function name associated with a specific codec */
+    pSECComponent->sec_mfc_componentInit      = &SEC_SRP_Mp3Dec_Init;
+    pSECComponent->sec_mfc_componentTerminate = &SEC_SRP_Mp3Dec_Terminate;
+    pSECComponent->sec_mfc_bufferProcess      = &SEC_SRP_Mp3Dec_bufferProcess;
+    pSECComponent->sec_checkInputFrame = NULL;
+
+    pSECComponent->currentState = OMX_StateLoaded;
+
+    ret = OMX_ErrorNone;
+    goto EXIT; /* This function is performed successfully. */
+
+EXIT_ERROR_6:
+    SEC_OSAL_Free(pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer);
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = NULL;
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = 0;
+EXIT_ERROR_5:
+    SRP_Deinit();
+EXIT_ERROR_4:
+    SRP_Terminate();
+EXIT_ERROR_3:
+    SEC_OSAL_Free(pMp3Dec);
+    pAudioDec->hCodecHandle = NULL;
+EXIT_ERROR_2:
+    SEC_OSAL_Free(pSECComponent->componentName);
+    pSECComponent->componentName = NULL;
+EXIT_ERROR_1:
+    SEC_OMX_AudioDecodeComponentDeinit(pOMXComponent);
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_MP3_HANDLE        *pMp3Dec = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    SEC_OSAL_Free(pSECComponent->componentName);
+    pSECComponent->componentName = NULL;
+    if (pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer) {
+        SEC_OSAL_Free(pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer);
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = NULL;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = 0;
+    }
+
+    pMp3Dec = (SEC_MP3_HANDLE *)((SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    if (pMp3Dec != NULL) {
+        if (pMp3Dec->hSRPMp3Handle.bSRPLoaded == OMX_TRUE) {
+            SRP_Deinit();
+            SRP_Terminate();
+        }
+        SEC_OSAL_Free(pMp3Dec);
+        ((SEC_OMX_AUDIODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle = NULL;
+    }
+
+    ret = SEC_OMX_AudioDecodeComponentDeinit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/SEC_OMX_Mp3dec.h b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/SEC_OMX_Mp3dec.h
new file mode 100644
index 0000000..a8b80f5
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/SEC_OMX_Mp3dec.h
@@ -0,0 +1,63 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Mp3dec.h
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2011.10.18 : Create
+ */
+
+#ifndef SEC_OMX_MP3_DEC_COMPONENT
+#define SEC_OMX_MP3_DEC_COMPONENT
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+
+typedef struct _SEC_SRP_MP3_HANDLE
+{
+    OMX_HANDLETYPE hSRPHandle;
+    OMX_BOOL       bConfiguredSRP;
+    OMX_BOOL       bSRPLoaded;
+    OMX_BOOL       bSRPSendEOS;
+    OMX_S32        returnCodec;
+} SEC_SRP_MP3_HANDLE;
+
+typedef struct _SEC_MP3_HANDLE
+{
+    /* OMX Codec specific */
+    OMX_AUDIO_PARAM_MP3TYPE     mp3Param;
+    OMX_AUDIO_PARAM_PCMMODETYPE pcmParam;
+
+    /* SEC SRP Codec specific */
+    SEC_SRP_MP3_HANDLE      hSRPMp3Handle;
+} SEC_MP3_HANDLE;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
+                OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* SEC_OMX_MP3_DEC_COMPONENT */
diff --git a/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/library_register.c b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/library_register.c
new file mode 100644
index 0000000..c94377a
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/library_register.c
@@ -0,0 +1,58 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.c
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2011.10.18 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+#include "library_register.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_MP3_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent)
+{
+    FunctionIn();
+
+    if (ppSECComponent == NULL)
+        goto EXIT;
+
+    /* component 1 - audio decoder MP3 */
+    SEC_OSAL_Strcpy(ppSECComponent[0]->componentName, SEC_OMX_COMPONENT_MP3_DEC);
+    SEC_OSAL_Strcpy(ppSECComponent[0]->roles[0], SEC_OMX_COMPONENT_MP3_DEC_ROLE);
+    ppSECComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+EXIT:
+    FunctionOut();
+    return MAX_COMPONENT_NUM;
+}
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/library_register.h b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/library_register.h
new file mode 100644
index 0000000..90ae8c2
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/audio/dec/mp3/library_register.h
@@ -0,0 +1,54 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.h
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2011.10.18 : Create
+ */
+
+#ifndef SEC_OMX_MP3_DEC_REG
+#define SEC_OMX_MP3_DEC_REG
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "SEC_OMX_Component_Register.h"
+
+
+#define OSCL_EXPORT_REF __attribute__((visibility("default")))
+#define MAX_COMPONENT_NUM         1
+#define MAX_COMPONENT_ROLE_NUM    1
+
+/* MP3 */
+#define SEC_OMX_COMPONENT_MP3_DEC         "OMX.SEC.MP3.Decoder"
+#define SEC_OMX_COMPONENT_MP3_DEC_ROLE    "audio_decoder.mp3"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* SEC_OMX_MP3_DEC_REG */
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/common/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/common/Android.mk
new file mode 100644
index 0000000..a6f84bf
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/common/Android.mk
@@ -0,0 +1,43 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Basecomponent.c \
+	SEC_OMX_Baseport.c
+
+LOCAL_MODULE := libsecbasecomponent
+
+LOCAL_CFLAGS :=
+
+LOCAL_STATIC_LIBRARIES := libsecosal
+LOCAL_SHARED_LIBRARIES := libcutils libutils
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal
+
+include $(BUILD_STATIC_LIBRARY)
+
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Resourcemanager.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libSEC_OMX_Resourcemanager
+
+LOCAL_CFLAGS :=
+
+LOCAL_STATIC_LIBRARIES := libsecosal
+LOCAL_SHARED_LIBRARIES := libcutils libutils
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Basecomponent.c b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Basecomponent.c
new file mode 100644
index 0000000..e615d18
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Basecomponent.c
@@ -0,0 +1,1535 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Basecomponent.c
+ * @brief
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ *             Yunji Kim (yunji.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "SEC_OSAL_Event.h"
+#include "SEC_OSAL_Thread.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Mutex.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OMX_Resourcemanager.h"
+#include "SEC_OMX_Macros.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_BASE_COMP"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+/* Change CHECK_SIZE_VERSION Macro */
+OMX_ERRORTYPE SEC_OMX_Check_SizeVersion(OMX_PTR header, OMX_U32 size)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    OMX_VERSIONTYPE* version = NULL;
+    if (header == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    version = (OMX_VERSIONTYPE*)((char*)header + sizeof(OMX_U32));
+    if (*((OMX_U32*)header) != size) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (version->s.nVersionMajor != VERSIONMAJOR_NUMBER ||
+        version->s.nVersionMinor != VERSIONMINOR_NUMBER) {
+        ret = OMX_ErrorVersionMismatch;
+        goto EXIT;
+    }
+    ret = OMX_ErrorNone;
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_GetComponentVersion(
+    OMX_IN  OMX_HANDLETYPE   hComponent,
+    OMX_OUT OMX_STRING       pComponentName,
+    OMX_OUT OMX_VERSIONTYPE *pComponentVersion,
+    OMX_OUT OMX_VERSIONTYPE *pSpecVersion,
+    OMX_OUT OMX_UUIDTYPE    *pComponentUUID)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    OMX_U32                compUUID[3];
+
+    FunctionIn();
+
+    /* check parameters */
+    if (hComponent     == NULL ||
+        pComponentName == NULL || pComponentVersion == NULL ||
+        pSpecVersion   == NULL || pComponentUUID    == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    SEC_OSAL_Strcpy(pComponentName, pSECComponent->componentName);
+    SEC_OSAL_Memcpy(pComponentVersion, &(pSECComponent->componentVersion), sizeof(OMX_VERSIONTYPE));
+    SEC_OSAL_Memcpy(pSpecVersion, &(pSECComponent->specVersion), sizeof(OMX_VERSIONTYPE));
+
+    /* Fill UUID with handle address, PID and UID.
+     * This should guarantee uiniqness */
+    compUUID[0] = (OMX_U32)pOMXComponent;
+    compUUID[1] = getpid();
+    compUUID[2] = getuid();
+    SEC_OSAL_Memcpy(*pComponentUUID, compUUID, 3 * sizeof(*compUUID));
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_GetState (
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_OUT OMX_STATETYPE *pState)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pState == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    *pState = pSECComponent->currentState;
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_OMX_BufferProcessThread(OMX_PTR threadData)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_MESSAGE       *message = NULL;
+
+    FunctionIn();
+
+    if (threadData == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)threadData;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECComponent->sec_BufferProcess(pOMXComponent);
+
+    SEC_OSAL_ThreadExit(NULL);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentStateSet(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 messageParam)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_MESSAGE       *message;
+    OMX_STATETYPE          destState = messageParam;
+    OMX_STATETYPE          currentState = pSECComponent->currentState;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_S32                countValue = 0;
+    unsigned int           i = 0, j = 0;
+    int                    k = 0;
+
+    FunctionIn();
+
+    /* check parameters */
+    if (currentState == destState) {
+         ret = OMX_ErrorSameState;
+            goto EXIT;
+    }
+    if (currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if ((currentState == OMX_StateLoaded) && (destState == OMX_StateIdle)) {
+        ret = SEC_OMX_Get_Resource(pOMXComponent);
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+    }
+    if (((currentState == OMX_StateIdle) && (destState == OMX_StateLoaded))       ||
+        ((currentState == OMX_StateIdle) && (destState == OMX_StateInvalid))      ||
+        ((currentState == OMX_StateExecuting) && (destState == OMX_StateInvalid)) ||
+        ((currentState == OMX_StatePause) && (destState == OMX_StateInvalid))) {
+        SEC_OMX_Release_Resource(pOMXComponent);
+    }
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "destState: %d", destState);
+
+    switch (destState) {
+    case OMX_StateInvalid:
+        switch (currentState) {
+        case OMX_StateWaitForResources:
+            SEC_OMX_Out_WaitForResource(pOMXComponent);
+        case OMX_StateIdle:
+        case OMX_StateExecuting:
+        case OMX_StatePause:
+        case OMX_StateLoaded:
+            pSECComponent->currentState = OMX_StateInvalid;
+            if (pSECComponent->hBufferProcess) {
+                pSECComponent->bExitBufferProcessThread = OMX_TRUE;
+
+                for (i = 0; i < ALL_PORT_NUM; i++) {
+                    SEC_OSAL_Get_SemaphoreCount(pSECComponent->pSECPort[i].bufferSemID, &countValue);
+                    if (countValue == 0)
+                        SEC_OSAL_SemaphorePost(pSECComponent->pSECPort[i].bufferSemID);
+                }
+
+                SEC_OSAL_SignalSet(pSECComponent->pauseEvent);
+                SEC_OSAL_ThreadTerminate(pSECComponent->hBufferProcess);
+                pSECComponent->hBufferProcess = NULL;
+
+                for (i = 0; i < ALL_PORT_NUM; i++) {
+                    SEC_OSAL_MutexTerminate(pSECComponent->secDataBuffer[i].bufferMutex);
+                    pSECComponent->secDataBuffer[i].bufferMutex = NULL;
+                }
+
+                SEC_OSAL_SignalTerminate(pSECComponent->pauseEvent);
+                for (i = 0; i < ALL_PORT_NUM; i++) {
+                    SEC_OSAL_SemaphoreTerminate(pSECComponent->pSECPort[i].bufferSemID);
+                    pSECComponent->pSECPort[i].bufferSemID = NULL;
+                }
+            }
+            if (pSECComponent->sec_mfc_componentTerminate != NULL)
+                pSECComponent->sec_mfc_componentTerminate(pOMXComponent);
+
+            ret = OMX_ErrorInvalidState;
+            break;
+        default:
+            ret = OMX_ErrorInvalidState;
+            break;
+        }
+        break;
+    case OMX_StateLoaded:
+        switch (currentState) {
+        case OMX_StateIdle:
+            pSECComponent->bExitBufferProcessThread = OMX_TRUE;
+
+            for (i = 0; i < ALL_PORT_NUM; i++) {
+                SEC_OSAL_Get_SemaphoreCount(pSECComponent->pSECPort[i].bufferSemID, &countValue);
+                if (countValue == 0)
+                    SEC_OSAL_SemaphorePost(pSECComponent->pSECPort[i].bufferSemID);
+            }
+
+            SEC_OSAL_SignalSet(pSECComponent->pauseEvent);
+            SEC_OSAL_ThreadTerminate(pSECComponent->hBufferProcess);
+            pSECComponent->hBufferProcess = NULL;
+
+            for (i = 0; i < ALL_PORT_NUM; i++) {
+                SEC_OSAL_MutexTerminate(pSECComponent->secDataBuffer[i].bufferMutex);
+                pSECComponent->secDataBuffer[i].bufferMutex = NULL;
+            }
+
+            SEC_OSAL_SignalTerminate(pSECComponent->pauseEvent);
+            for (i = 0; i < ALL_PORT_NUM; i++) {
+                SEC_OSAL_SemaphoreTerminate(pSECComponent->pSECPort[i].bufferSemID);
+                pSECComponent->pSECPort[i].bufferSemID = NULL;
+            }
+
+            pSECComponent->sec_mfc_componentTerminate(pOMXComponent);
+
+            for (i = 0; i < (pSECComponent->portParam.nPorts); i++) {
+                pSECPort = (pSECComponent->pSECPort + i);
+                if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                    while (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) > 0) {
+                        message = (SEC_OMX_MESSAGE*)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+                        if (message != NULL)
+                            SEC_OSAL_Free(message);
+                    }
+                    ret = pSECComponent->sec_FreeTunnelBuffer(pSECPort, i);
+                    if (OMX_ErrorNone != ret) {
+                        goto EXIT;
+                    }
+                } else {
+                    if (CHECK_PORT_ENABLED(pSECPort)) {
+                        SEC_OSAL_SemaphoreWait(pSECPort->unloadedResource);
+                        pSECPort->portDefinition.bPopulated = OMX_FALSE;
+                    }
+                }
+            }
+            pSECComponent->currentState = OMX_StateLoaded;
+            break;
+        case OMX_StateWaitForResources:
+            ret = SEC_OMX_Out_WaitForResource(pOMXComponent);
+            pSECComponent->currentState = OMX_StateLoaded;
+            break;
+        case OMX_StateExecuting:
+        case OMX_StatePause:
+        default:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        }
+        break;
+    case OMX_StateIdle:
+        switch (currentState) {
+        case OMX_StateLoaded:
+            for (i = 0; i < pSECComponent->portParam.nPorts; i++) {
+                pSECPort = (pSECComponent->pSECPort + i);
+                if (pSECPort == NULL) {
+                    ret = OMX_ErrorBadParameter;
+                    goto EXIT;
+                }
+                if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                    if (CHECK_PORT_ENABLED(pSECPort)) {
+                        ret = pSECComponent->sec_AllocateTunnelBuffer(pSECPort, i);
+                        if (ret!=OMX_ErrorNone)
+                            goto EXIT;
+                    }
+                } else {
+                    if (CHECK_PORT_ENABLED(pSECPort)) {
+                        SEC_OSAL_SemaphoreWait(pSECComponent->pSECPort[i].loadedResource);
+                        pSECPort->portDefinition.bPopulated = OMX_TRUE;
+                    }
+                }
+            }
+            ret = pSECComponent->sec_mfc_componentInit(pOMXComponent);
+            if (ret != OMX_ErrorNone) {
+                /*
+                 * if (CHECK_PORT_TUNNELED == OMX_TRUE) thenTunnel Buffer Free
+                 */
+                goto EXIT;
+            }
+            pSECComponent->bExitBufferProcessThread = OMX_FALSE;
+            SEC_OSAL_SignalCreate(&pSECComponent->pauseEvent);
+            for (i = 0; i < ALL_PORT_NUM; i++) {
+                ret = SEC_OSAL_SemaphoreCreate(&pSECComponent->pSECPort[i].bufferSemID);
+                if (ret != OMX_ErrorNone) {
+                    ret = OMX_ErrorInsufficientResources;
+                    SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+                    goto EXIT;
+                }
+            }
+            for (i = 0; i < ALL_PORT_NUM; i++) {
+                ret = SEC_OSAL_MutexCreate(&pSECComponent->secDataBuffer[i].bufferMutex);
+                if (ret != OMX_ErrorNone) {
+                    ret = OMX_ErrorInsufficientResources;
+                    SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+                    goto EXIT;
+                }
+            }
+            ret = SEC_OSAL_ThreadCreate(&pSECComponent->hBufferProcess,
+                             SEC_OMX_BufferProcessThread,
+                             pOMXComponent);
+            if (ret != OMX_ErrorNone) {
+                /*
+                 * if (CHECK_PORT_TUNNELED == OMX_TRUE) thenTunnel Buffer Free
+                 */
+
+                SEC_OSAL_SignalTerminate(pSECComponent->pauseEvent);
+                for (i = 0; i < ALL_PORT_NUM; i++) {
+                    SEC_OSAL_MutexTerminate(pSECComponent->secDataBuffer[i].bufferMutex);
+                    pSECComponent->secDataBuffer[i].bufferMutex = NULL;
+                }
+                for (i = 0; i < ALL_PORT_NUM; i++) {
+                    SEC_OSAL_SemaphoreTerminate(pSECComponent->pSECPort[i].bufferSemID);
+                    pSECComponent->pSECPort[i].bufferSemID = NULL;
+                }
+
+                ret = OMX_ErrorInsufficientResources;
+                goto EXIT;
+            }
+            pSECComponent->currentState = OMX_StateIdle;
+            break;
+        case OMX_StateExecuting:
+        case OMX_StatePause:
+            SEC_OMX_BufferFlushProcessNoEvent(pOMXComponent, ALL_PORT_INDEX);
+            pSECComponent->currentState = OMX_StateIdle;
+            break;
+        case OMX_StateWaitForResources:
+            pSECComponent->currentState = OMX_StateIdle;
+            break;
+        default:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        }
+        break;
+    case OMX_StateExecuting:
+        switch (currentState) {
+        case OMX_StateLoaded:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        case OMX_StateIdle:
+            for (i = 0; i < pSECComponent->portParam.nPorts; i++) {
+                pSECPort = &pSECComponent->pSECPort[i];
+                if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort) && CHECK_PORT_ENABLED(pSECPort)) {
+                    for (j = 0; j < pSECPort->tunnelBufferNum; j++) {
+                        SEC_OSAL_SemaphorePost(pSECComponent->pSECPort[i].bufferSemID);
+                    }
+                }
+            }
+
+            pSECComponent->transientState = SEC_OMX_TransStateMax;
+            pSECComponent->currentState = OMX_StateExecuting;
+            SEC_OSAL_SignalSet(pSECComponent->pauseEvent);
+            break;
+        case OMX_StatePause:
+            for (i = 0; i < pSECComponent->portParam.nPorts; i++) {
+                pSECPort = &pSECComponent->pSECPort[i];
+                if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort) && CHECK_PORT_ENABLED(pSECPort)) {
+                    OMX_S32 semaValue = 0, cnt = 0;
+                    SEC_OSAL_Get_SemaphoreCount(pSECComponent->pSECPort[i].bufferSemID, &semaValue);
+                    if (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) > semaValue) {
+                        cnt = SEC_OSAL_GetElemNum(&pSECPort->bufferQ) - semaValue;
+                        for (k = 0; k < cnt; k++) {
+                            SEC_OSAL_SemaphorePost(pSECComponent->pSECPort[i].bufferSemID);
+                        }
+                    }
+                }
+            }
+
+            pSECComponent->currentState = OMX_StateExecuting;
+            SEC_OSAL_SignalSet(pSECComponent->pauseEvent);
+            break;
+        case OMX_StateWaitForResources:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        default:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        }
+        break;
+    case OMX_StatePause:
+        switch (currentState) {
+        case OMX_StateLoaded:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        case OMX_StateIdle:
+            pSECComponent->currentState = OMX_StatePause;
+            break;
+        case OMX_StateExecuting:
+            pSECComponent->currentState = OMX_StatePause;
+            break;
+        case OMX_StateWaitForResources:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        default:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        }
+        break;
+    case OMX_StateWaitForResources:
+        switch (currentState) {
+        case OMX_StateLoaded:
+            ret = SEC_OMX_In_WaitForResource(pOMXComponent);
+            pSECComponent->currentState = OMX_StateWaitForResources;
+            break;
+        case OMX_StateIdle:
+        case OMX_StateExecuting:
+        case OMX_StatePause:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        default:
+            ret = OMX_ErrorIncorrectStateTransition;
+            break;
+        }
+        break;
+    default:
+        ret = OMX_ErrorIncorrectStateTransition;
+        break;
+    }
+
+EXIT:
+    if (ret == OMX_ErrorNone) {
+        if (pSECComponent->pCallbacks != NULL) {
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+            pSECComponent->callbackData,
+            OMX_EventCmdComplete, OMX_CommandStateSet,
+            destState, NULL);
+        }
+    } else {
+        if (pSECComponent->pCallbacks != NULL) {
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+            pSECComponent->callbackData,
+            OMX_EventError, ret, 0, NULL);
+        }
+    }
+    FunctionOut();
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_OMX_MessageHandlerThread(OMX_PTR threadData)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_MESSAGE       *message = NULL;
+    OMX_U32                messageType = 0, portIndex = 0;
+
+    FunctionIn();
+
+    if (threadData == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)threadData;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    while (pSECComponent->bExitMessageHandlerThread == OMX_FALSE) {
+        SEC_OSAL_SemaphoreWait(pSECComponent->msgSemaphoreHandle);
+        message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECComponent->messageQ);
+        if (message != NULL) {
+            messageType = message->messageType;
+            switch (messageType) {
+            case OMX_CommandStateSet:
+                ret = SEC_OMX_ComponentStateSet(pOMXComponent, message->messageParam);
+                break;
+            case OMX_CommandFlush:
+                ret = SEC_OMX_BufferFlushProcess(pOMXComponent, message->messageParam);
+                break;
+            case OMX_CommandPortDisable:
+                ret = SEC_OMX_PortDisableProcess(pOMXComponent, message->messageParam);
+                break;
+            case OMX_CommandPortEnable:
+                ret = SEC_OMX_PortEnableProcess(pOMXComponent, message->messageParam);
+                break;
+            case OMX_CommandMarkBuffer:
+                portIndex = message->messageParam;
+                pSECComponent->pSECPort[portIndex].markType.hMarkTargetComponent = ((OMX_MARKTYPE *)message->pCmdData)->hMarkTargetComponent;
+                pSECComponent->pSECPort[portIndex].markType.pMarkData            = ((OMX_MARKTYPE *)message->pCmdData)->pMarkData;
+                break;
+            case (OMX_COMMANDTYPE)SEC_OMX_CommandComponentDeInit:
+                pSECComponent->bExitMessageHandlerThread = OMX_TRUE;
+                break;
+            default:
+                break;
+            }
+            SEC_OSAL_Free(message);
+            message = NULL;
+        }
+    }
+
+    SEC_OSAL_ThreadExit(NULL);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_StateSet(SEC_OMX_BASECOMPONENT *pSECComponent, OMX_U32 nParam)
+{
+    OMX_U32 destState = nParam;
+    OMX_U32 i = 0;
+
+    if ((destState == OMX_StateIdle) && (pSECComponent->currentState == OMX_StateLoaded)) {
+        pSECComponent->transientState = SEC_OMX_TransStateLoadedToIdle;
+        for(i = 0; i < pSECComponent->portParam.nPorts; i++) {
+            pSECComponent->pSECPort[i].portState = OMX_StateIdle;
+        }
+        SEC_OSAL_Log(SEC_LOG_TRACE, "to OMX_StateIdle");
+    } else if ((destState == OMX_StateLoaded) && (pSECComponent->currentState == OMX_StateIdle)) {
+        pSECComponent->transientState = SEC_OMX_TransStateIdleToLoaded;
+        for (i = 0; i < pSECComponent->portParam.nPorts; i++) {
+            pSECComponent->pSECPort[i].portState = OMX_StateLoaded;
+        }
+        SEC_OSAL_Log(SEC_LOG_TRACE, "to OMX_StateLoaded");
+    } else if ((destState == OMX_StateIdle) && (pSECComponent->currentState == OMX_StateExecuting)) {
+        pSECComponent->transientState = SEC_OMX_TransStateExecutingToIdle;
+        SEC_OSAL_Log(SEC_LOG_TRACE, "to OMX_StateIdle");
+    } else if ((destState == OMX_StateExecuting) && (pSECComponent->currentState == OMX_StateIdle)) {
+        pSECComponent->transientState = SEC_OMX_TransStateIdleToExecuting;
+        SEC_OSAL_Log(SEC_LOG_TRACE, "to OMX_StateExecuting");
+    } else if (destState == OMX_StateInvalid) {
+        for (i = 0; i < pSECComponent->portParam.nPorts; i++) {
+            pSECComponent->pSECPort[i].portState = OMX_StateInvalid;
+        }
+    }
+
+    return OMX_ErrorNone;
+}
+
+static OMX_ERRORTYPE SEC_SetPortFlush(SEC_OMX_BASECOMPONENT *pSECComponent, OMX_U32 nParam)
+{
+    OMX_ERRORTYPE     ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT *pSECPort = NULL;
+    OMX_S32           portIndex = nParam;
+    OMX_U16           i = 0, cnt = 0, index = 0;
+
+
+    if ((pSECComponent->currentState == OMX_StateExecuting) ||
+        (pSECComponent->currentState == OMX_StatePause)) {
+        if ((portIndex != ALL_PORT_INDEX) &&
+           ((OMX_S32)portIndex >= (OMX_S32)pSECComponent->portParam.nPorts)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        /*********************
+        *    need flush event set ?????
+        **********************/
+        cnt = (portIndex == ALL_PORT_INDEX ) ? ALL_PORT_NUM : 1;
+        for (i = 0; i < cnt; i++) {
+            if (portIndex == ALL_PORT_INDEX)
+                index = i;
+            else
+                index = portIndex;
+            pSECComponent->pSECPort[index].bIsPortFlushed = OMX_TRUE;
+        }
+    } else {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+    ret = OMX_ErrorNone;
+
+EXIT:
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_SetPortEnable(SEC_OMX_BASECOMPONENT *pSECComponent, OMX_U32 nParam)
+{
+    OMX_ERRORTYPE     ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT *pSECPort = NULL;
+    OMX_S32           portIndex = nParam;
+    OMX_U16           i = 0, cnt = 0;
+
+    FunctionIn();
+
+    if ((portIndex != ALL_PORT_INDEX) &&
+        ((OMX_S32)portIndex >= (OMX_S32)pSECComponent->portParam.nPorts)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    if (portIndex == ALL_PORT_INDEX) {
+        for (i = 0; i < pSECComponent->portParam.nPorts; i++) {
+            pSECPort = &pSECComponent->pSECPort[i];
+            if (CHECK_PORT_ENABLED(pSECPort)) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            } else {
+                pSECPort->portState = OMX_StateIdle;
+            }
+        }
+    } else {
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+        if (CHECK_PORT_ENABLED(pSECPort)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        } else {
+            pSECPort->portState = OMX_StateIdle;
+        }
+    }
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+
+}
+
+static OMX_ERRORTYPE SEC_SetPortDisable(SEC_OMX_BASECOMPONENT *pSECComponent, OMX_U32 nParam)
+{
+    OMX_ERRORTYPE     ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT *pSECPort = NULL;
+    OMX_S32           portIndex = nParam;
+    OMX_U16           i = 0, cnt = 0;
+
+    FunctionIn();
+
+    if ((portIndex != ALL_PORT_INDEX) &&
+        ((OMX_S32)portIndex >= (OMX_S32)pSECComponent->portParam.nPorts)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    if (portIndex == ALL_PORT_INDEX) {
+        for (i = 0; i < pSECComponent->portParam.nPorts; i++) {
+            pSECPort = &pSECComponent->pSECPort[i];
+            if (!CHECK_PORT_ENABLED(pSECPort)) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+            pSECPort->portState = OMX_StateLoaded;
+            pSECPort->bIsPortDisabled = OMX_TRUE;
+        }
+    } else {
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+        pSECPort->portState = OMX_StateLoaded;
+        pSECPort->bIsPortDisabled = OMX_TRUE;
+    }
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_SetMarkBuffer(SEC_OMX_BASECOMPONENT *pSECComponent, OMX_U32 nParam)
+{
+    OMX_ERRORTYPE     ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT *pSECPort = NULL;
+    OMX_U32           portIndex = nParam;
+    OMX_U16           i = 0, cnt = 0;
+
+
+    if (nParam >= pSECComponent->portParam.nPorts) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    if ((pSECComponent->currentState == OMX_StateExecuting) ||
+        (pSECComponent->currentState == OMX_StatePause)) {
+        ret = OMX_ErrorNone;
+    } else {
+        ret = OMX_ErrorIncorrectStateOperation;
+    }
+
+EXIT:
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_OMX_CommandQueue(
+    SEC_OMX_BASECOMPONENT *pSECComponent,
+    OMX_COMMANDTYPE        Cmd,
+    OMX_U32                nParam,
+    OMX_PTR                pCmdData)
+{
+    OMX_ERRORTYPE    ret = OMX_ErrorNone;
+    SEC_OMX_MESSAGE *command = (SEC_OMX_MESSAGE *)SEC_OSAL_Malloc(sizeof(SEC_OMX_MESSAGE));
+
+    if (command == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    command->messageType  = (OMX_U32)Cmd;
+    command->messageParam = nParam;
+    command->pCmdData     = pCmdData;
+
+    ret = SEC_OSAL_Queue(&pSECComponent->messageQ, (void *)command);
+    if (ret != 0) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+    ret = SEC_OSAL_SemaphorePost(pSECComponent->msgSemaphoreHandle);
+
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_SendCommand(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_COMMANDTYPE Cmd,
+    OMX_IN OMX_U32         nParam,
+    OMX_IN OMX_PTR         pCmdData)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_MESSAGE       *message = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (Cmd) {
+    case OMX_CommandStateSet :
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Command: OMX_CommandStateSet");
+        SEC_StateSet(pSECComponent, nParam);
+        break;
+    case OMX_CommandFlush :
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Command: OMX_CommandFlush");
+        ret = SEC_SetPortFlush(pSECComponent, nParam);
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+        break;
+    case OMX_CommandPortDisable :
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Command: OMX_CommandPortDisable");
+        ret = SEC_SetPortDisable(pSECComponent, nParam);
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+        break;
+    case OMX_CommandPortEnable :
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Command: OMX_CommandPortEnable");
+        ret = SEC_SetPortEnable(pSECComponent, nParam);
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+        break;
+    case OMX_CommandMarkBuffer :
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Command: OMX_CommandMarkBuffer");
+        ret = SEC_SetMarkBuffer(pSECComponent, nParam);
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+        break;
+/*
+    case SEC_CommandFillBuffer :
+    case SEC_CommandEmptyBuffer :
+    case SEC_CommandDeInit :
+*/
+    default:
+        break;
+    }
+
+    ret = SEC_OMX_CommandQueue(pSECComponent, Cmd, nParam, pCmdData);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_GetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case (OMX_INDEXTYPE)OMX_COMPONENT_CAPABILITY_TYPE_INDEX:
+    {
+        /* For Android PV OpenCORE */
+        OMXComponentCapabilityFlagsType *capabilityFlags = (OMXComponentCapabilityFlagsType *)ComponentParameterStructure;
+        SEC_OSAL_Memcpy(capabilityFlags, &pSECComponent->capabilityFlags, sizeof(OMXComponentCapabilityFlagsType));
+    }
+        break;
+    case OMX_IndexParamAudioInit:
+    case OMX_IndexParamVideoInit:
+    case OMX_IndexParamImageInit:
+    case OMX_IndexParamOtherInit:
+    {
+        OMX_PORT_PARAM_TYPE *portParam = (OMX_PORT_PARAM_TYPE *)ComponentParameterStructure;
+        ret = SEC_OMX_Check_SizeVersion(portParam, sizeof(OMX_PORT_PARAM_TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+        portParam->nPorts         = 0;
+        portParam->nStartPortNumber     = 0;
+    }
+        break;
+    case OMX_IndexParamPortDefinition:
+    {
+        OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure;
+        OMX_U32                       portIndex = portDefinition->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort;
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+        ret = SEC_OMX_Check_SizeVersion(portDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+        SEC_OSAL_Memcpy(portDefinition, &pSECPort->portDefinition, portDefinition->nSize);
+    }
+        break;
+    case OMX_IndexParamPriorityMgmt:
+    {
+        OMX_PRIORITYMGMTTYPE *compPriority = (OMX_PRIORITYMGMTTYPE *)ComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(compPriority, sizeof(OMX_PRIORITYMGMTTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        compPriority->nGroupID       = pSECComponent->compPriority.nGroupID;
+        compPriority->nGroupPriority = pSECComponent->compPriority.nGroupPriority;
+    }
+        break;
+
+    case OMX_IndexParamCompBufferSupplier:
+    {
+        OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE *)ComponentParameterStructure;
+        OMX_U32                       portIndex = bufferSupplier->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort;
+
+        if ((pSECComponent->currentState == OMX_StateLoaded) ||
+            (pSECComponent->currentState == OMX_StateWaitForResources)) {
+            if (portIndex >= pSECComponent->portParam.nPorts) {
+                ret = OMX_ErrorBadPortIndex;
+                goto EXIT;
+            }
+            ret = SEC_OMX_Check_SizeVersion(bufferSupplier, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE));
+            if (ret != OMX_ErrorNone) {
+                goto EXIT;
+            }
+
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+
+
+            if (pSECPort->portDefinition.eDir == OMX_DirInput) {
+                if (CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                    bufferSupplier->eBufferSupplier = OMX_BufferSupplyInput;
+                } else if (CHECK_PORT_TUNNELED(pSECPort)) {
+                    bufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput;
+                } else {
+                    bufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified;
+                }
+            } else {
+                if (CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                    bufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput;
+                } else if (CHECK_PORT_TUNNELED(pSECPort)) {
+                    bufferSupplier->eBufferSupplier = OMX_BufferSupplyInput;
+                } else {
+                    bufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified;
+                }
+            }
+        }
+        else
+        {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+    }
+        break;
+    default:
+    {
+        ret = OMX_ErrorUnsupportedIndex;
+        goto EXIT;
+    }
+        break;
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_SetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamAudioInit:
+    case OMX_IndexParamVideoInit:
+    case OMX_IndexParamImageInit:
+    case OMX_IndexParamOtherInit:
+    {
+        OMX_PORT_PARAM_TYPE *portParam = (OMX_PORT_PARAM_TYPE *)ComponentParameterStructure;
+        ret = SEC_OMX_Check_SizeVersion(portParam, sizeof(OMX_PORT_PARAM_TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) &&
+            (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+        ret = OMX_ErrorUndefined;
+        /* SEC_OSAL_Memcpy(&pSECComponent->portParam, portParam, sizeof(OMX_PORT_PARAM_TYPE)); */
+    }
+        break;
+    case OMX_IndexParamPortDefinition:
+    {
+        OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure;
+        OMX_U32               portIndex = portDefinition->nPortIndex;
+        SEC_OMX_BASEPORT         *pSECPort;
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+        ret = SEC_OMX_Check_SizeVersion(portDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            if (pSECPort->portDefinition.bEnabled == OMX_TRUE) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+        }
+        if (portDefinition->nBufferCountActual < pSECPort->portDefinition.nBufferCountMin) {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+
+        SEC_OSAL_Memcpy(&pSECPort->portDefinition, portDefinition, portDefinition->nSize);
+    }
+        break;
+    case OMX_IndexParamPriorityMgmt:
+    {
+        OMX_PRIORITYMGMTTYPE *compPriority = (OMX_PRIORITYMGMTTYPE *)ComponentParameterStructure;
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) &&
+            (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+
+        ret = SEC_OMX_Check_SizeVersion(compPriority, sizeof(OMX_PRIORITYMGMTTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECComponent->compPriority.nGroupID = compPriority->nGroupID;
+        pSECComponent->compPriority.nGroupPriority = compPriority->nGroupPriority;
+    }
+        break;
+    case OMX_IndexParamCompBufferSupplier:
+    {
+        OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE *)ComponentParameterStructure;
+        OMX_U32           portIndex = bufferSupplier->nPortIndex;
+        SEC_OMX_BASEPORT *pSECPort = NULL;
+
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+        ret = SEC_OMX_Check_SizeVersion(bufferSupplier, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            if (pSECPort->portDefinition.bEnabled == OMX_TRUE) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+        }
+
+        if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyUnspecified) {
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+        if (CHECK_PORT_TUNNELED(pSECPort) == 0) {
+            ret = OMX_ErrorNone; /*OMX_ErrorNone ?????*/
+            goto EXIT;
+        }
+
+        if (pSECPort->portDefinition.eDir == OMX_DirInput) {
+            if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyInput) {
+                /*
+                if (CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                    ret = OMX_ErrorNone;
+                }
+                */
+                pSECPort->tunnelFlags |= SEC_TUNNEL_IS_SUPPLIER;
+                bufferSupplier->nPortIndex = pSECPort->tunneledPort;
+                ret = OMX_SetParameter(pSECPort->tunneledComponent, OMX_IndexParamCompBufferSupplier, bufferSupplier);
+                goto EXIT;
+            } else if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) {
+                ret = OMX_ErrorNone;
+                if (CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                    pSECPort->tunnelFlags &= ~SEC_TUNNEL_IS_SUPPLIER;
+                    bufferSupplier->nPortIndex = pSECPort->tunneledPort;
+                    ret = OMX_SetParameter(pSECPort->tunneledComponent, OMX_IndexParamCompBufferSupplier, bufferSupplier);
+                }
+                goto EXIT;
+            }
+        } else if (pSECPort->portDefinition.eDir == OMX_DirOutput) {
+            if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyInput) {
+                ret = OMX_ErrorNone;
+                if (CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                    pSECPort->tunnelFlags &= ~SEC_TUNNEL_IS_SUPPLIER;
+                    ret = OMX_ErrorNone;
+                }
+                goto EXIT;
+            } else if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) {
+                /*
+                if (CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                    ret = OMX_ErrorNone;
+                }
+                */
+                pSECPort->tunnelFlags |= SEC_TUNNEL_IS_SUPPLIER;
+                ret = OMX_ErrorNone;
+                goto EXIT;
+            }
+        }
+    }
+        break;
+    default:
+    {
+        ret = OMX_ErrorUnsupportedIndex;
+        goto EXIT;
+    }
+        break;
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_GetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_INOUT OMX_PTR     pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = OMX_ErrorUnsupportedIndex;
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_SetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = OMX_ErrorUnsupportedIndex;
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_GetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    ret = OMX_ErrorBadParameter;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_SetCallbacks (
+    OMX_IN OMX_HANDLETYPE    hComponent,
+    OMX_IN OMX_CALLBACKTYPE* pCallbacks,
+    OMX_IN OMX_PTR           pAppData)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pCallbacks == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState != OMX_StateLoaded) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+
+    pSECComponent->pCallbacks = pCallbacks;
+    pSECComponent->callbackData = pAppData;
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_UseEGLImage(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN void                     *eglImage)
+{
+    return OMX_ErrorNotImplemented;
+}
+
+OMX_ERRORTYPE SEC_OMX_BaseComponent_Constructor(
+    OMX_IN OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    pSECComponent = SEC_OSAL_Malloc(sizeof(SEC_OMX_BASECOMPONENT));
+    if (pSECComponent == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECComponent, 0, sizeof(SEC_OMX_BASECOMPONENT));
+    pOMXComponent->pComponentPrivate = (OMX_PTR)pSECComponent;
+
+    ret = SEC_OSAL_SemaphoreCreate(&pSECComponent->msgSemaphoreHandle);
+    if (ret != OMX_ErrorNone) {
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    ret = SEC_OSAL_MutexCreate(&pSECComponent->compMutex);
+    if (ret != OMX_ErrorNone) {
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    pSECComponent->bExitMessageHandlerThread = OMX_FALSE;
+    SEC_OSAL_QueueCreate(&pSECComponent->messageQ);
+    ret = SEC_OSAL_ThreadCreate(&pSECComponent->hMessageHandler, SEC_OMX_MessageHandlerThread, pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    pOMXComponent->GetComponentVersion = &SEC_OMX_GetComponentVersion;
+    pOMXComponent->SendCommand         = &SEC_OMX_SendCommand;
+    pOMXComponent->GetState            = &SEC_OMX_GetState;
+    pOMXComponent->SetCallbacks        = &SEC_OMX_SetCallbacks;
+    pOMXComponent->UseEGLImage         = &SEC_OMX_UseEGLImage;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_BaseComponent_Destructor(
+    OMX_IN OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    OMX_S32                semaValue = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    SEC_OMX_CommandQueue(pSECComponent, SEC_OMX_CommandComponentDeInit, 0, NULL);
+    SEC_OSAL_SleepMillisec(0);
+    SEC_OSAL_Get_SemaphoreCount(pSECComponent->msgSemaphoreHandle, &semaValue);
+    if (semaValue == 0)
+        SEC_OSAL_SemaphorePost(pSECComponent->msgSemaphoreHandle);
+    SEC_OSAL_SemaphorePost(pSECComponent->msgSemaphoreHandle);
+
+    SEC_OSAL_ThreadTerminate(pSECComponent->hMessageHandler);
+    pSECComponent->hMessageHandler = NULL;
+
+    SEC_OSAL_MutexTerminate(pSECComponent->compMutex);
+    pSECComponent->compMutex = NULL;
+    SEC_OSAL_SemaphoreTerminate(pSECComponent->msgSemaphoreHandle);
+    pSECComponent->msgSemaphoreHandle = NULL;
+    SEC_OSAL_QueueTerminate(&pSECComponent->messageQ);
+
+    SEC_OSAL_Free(pSECComponent);
+    pSECComponent = NULL;
+
+    ret = OMX_ErrorNone;
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Basecomponent.h b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Basecomponent.h
new file mode 100644
index 0000000..47c6771
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Basecomponent.h
@@ -0,0 +1,196 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Basecomponent.h
+ * @brief
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ *             Yunji Kim (yunji.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_BASECOMP
+#define SEC_OMX_BASECOMP
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "SEC_OSAL_Queue.h"
+#include "SEC_OMX_Baseport.h"
+
+
+typedef struct _SEC_OMX_MESSAGE
+{
+    OMX_U32 messageType;
+    OMX_U32 messageParam;
+    OMX_PTR pCmdData;
+} SEC_OMX_MESSAGE;
+
+typedef struct _SEC_OMX_DATABUFFER
+{
+    OMX_HANDLETYPE        bufferMutex;
+    OMX_BUFFERHEADERTYPE* bufferHeader;
+    OMX_BOOL              dataValid;
+    OMX_U32               allocSize;
+    OMX_U32               dataLen;
+    OMX_U32               usedDataLen;
+    OMX_U32               remainDataLen;
+    OMX_U32               nFlags;
+    OMX_TICKS             timeStamp;
+} SEC_OMX_DATABUFFER;
+
+typedef struct _SEC_OMX_DATA
+{
+    OMX_BYTE  dataBuffer;
+    OMX_U32   allocSize;
+    OMX_U32   dataLen;
+    OMX_U32   usedDataLen;
+    OMX_U32   remainDataLen;
+    OMX_U32   previousDataLen;
+    OMX_U32   nFlags;
+    OMX_TICKS timeStamp;
+} SEC_OMX_DATA;
+
+/* for Check TimeStamp after Seek */
+typedef struct _SEC_OMX_TIMESTAPM
+{
+    OMX_BOOL  needSetStartTimeStamp;
+    OMX_BOOL  needCheckStartTimeStamp;
+    OMX_TICKS startTimeStamp;
+    OMX_U32   nStartFlags;
+} SEC_OMX_TIMESTAMP;
+
+typedef struct _SEC_OMX_BASECOMPONENT
+{
+    OMX_STRING               componentName;
+    OMX_VERSIONTYPE          componentVersion;
+    OMX_VERSIONTYPE          specVersion;
+
+    OMX_STATETYPE            currentState;
+    SEC_OMX_TRANS_STATETYPE  transientState;
+
+    SEC_CODEC_TYPE           codecType;
+    SEC_OMX_PRIORITYMGMTTYPE compPriority;
+    OMX_MARKTYPE             propagateMarkType;
+    OMX_HANDLETYPE           compMutex;
+
+    OMX_HANDLETYPE           hComponentHandle;
+
+    /* Message Handler */
+    OMX_BOOL                 bExitMessageHandlerThread;
+    OMX_HANDLETYPE           hMessageHandler;
+    OMX_HANDLETYPE           msgSemaphoreHandle;
+    SEC_QUEUE                messageQ;
+
+    /* Buffer Process */
+    OMX_BOOL                 bExitBufferProcessThread;
+    OMX_HANDLETYPE           hBufferProcess;
+
+    /* Buffer */
+    SEC_OMX_DATABUFFER       secDataBuffer[2];
+
+    /* Data */
+    SEC_OMX_DATA             processData[2];
+
+    /* Port */
+    OMX_PORT_PARAM_TYPE      portParam;
+    SEC_OMX_BASEPORT        *pSECPort;
+
+    OMX_HANDLETYPE           pauseEvent;
+
+    /* Callback function */
+    OMX_CALLBACKTYPE        *pCallbacks;
+    OMX_PTR                  callbackData;
+
+    /* Save Timestamp */
+    OMX_TICKS                timeStamp[MAX_TIMESTAMP];
+    SEC_OMX_TIMESTAMP        checkTimeStamp;
+
+    /* Save Flags */
+    OMX_U32                  nFlags[MAX_FLAGS];
+
+    OMX_BOOL                 getAllDelayBuffer;
+    OMX_BOOL                 remainOutputData;
+    OMX_BOOL                 reInputData;
+
+    /* Android CapabilityFlags */
+    OMXComponentCapabilityFlagsType capabilityFlags;
+
+    OMX_BOOL bUseFlagEOF;
+    OMX_BOOL bSaveFlagEOS;
+
+    OMX_ERRORTYPE (*sec_mfc_componentInit)(OMX_COMPONENTTYPE *pOMXComponent);
+    OMX_ERRORTYPE (*sec_mfc_componentTerminate)(OMX_COMPONENTTYPE *pOMXComponent);
+    OMX_ERRORTYPE (*sec_mfc_bufferProcess) (OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData);
+
+    OMX_ERRORTYPE (*sec_AllocateTunnelBuffer)(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
+    OMX_ERRORTYPE (*sec_FreeTunnelBuffer)(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
+    OMX_ERRORTYPE (*sec_BufferProcess)(OMX_HANDLETYPE hComponent);
+    OMX_ERRORTYPE (*sec_BufferReset)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex);
+    OMX_ERRORTYPE (*sec_InputBufferReturn)(OMX_COMPONENTTYPE *pOMXComponent);
+    OMX_ERRORTYPE (*sec_OutputBufferReturn)(OMX_COMPONENTTYPE *pOMXComponent);
+
+    OMX_ERRORTYPE (*sec_allocSecureInputBuffer)(OMX_IN OMX_HANDLETYPE hComponent,
+                                                OMX_IN OMX_U32 nBufferSize,
+                                                OMX_INOUT OMX_PTR *pInputBuffer_physicalAddress);
+    OMX_ERRORTYPE (*sec_freeSecureInputBuffer)(OMX_IN OMX_HANDLETYPE hComponent,
+                                               OMX_INOUT OMX_PTR pInputBuffer_physicalAddress);
+
+    int (*sec_checkInputFrame)(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame);
+} SEC_OMX_BASECOMPONENT;
+
+OMX_ERRORTYPE SEC_OMX_GetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     ComponentParameterStructure);
+
+OMX_ERRORTYPE SEC_OMX_SetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        ComponentParameterStructure);
+
+OMX_ERRORTYPE SEC_OMX_GetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_INOUT OMX_PTR     pComponentConfigStructure);
+
+OMX_ERRORTYPE SEC_OMX_SetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentConfigStructure);
+
+OMX_ERRORTYPE SEC_OMX_GetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType);
+
+OMX_ERRORTYPE SEC_OMX_BaseComponent_Constructor(OMX_IN OMX_HANDLETYPE hComponent);
+OMX_ERRORTYPE SEC_OMX_BaseComponent_Destructor(OMX_IN OMX_HANDLETYPE hComponent);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    OMX_ERRORTYPE SEC_OMX_Check_SizeVersion(OMX_PTR header, OMX_U32 size);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Baseport.c b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Baseport.c
new file mode 100644
index 0000000..3bd37f5
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Baseport.c
@@ -0,0 +1,1014 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Baseport.c
+ * @brief
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ *             HyeYeon Chung (hyeon.chung@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Macros.h"
+#include "SEC_OSAL_Event.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Mutex.h"
+
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Basecomponent.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_BASE_PORT"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+OMX_ERRORTYPE SEC_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *bufferHeader = NULL;
+    SEC_OMX_MESSAGE       *message = NULL;
+    OMX_U32                flushNum = 0;
+    OMX_S32                semValue = 0;
+
+    FunctionIn();
+
+    pSECPort = &pSECComponent->pSECPort[portIndex];
+    while (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) > 0) {
+        SEC_OSAL_Get_SemaphoreCount(pSECComponent->pSECPort[portIndex].bufferSemID, &semValue);
+        if (semValue == 0)
+            SEC_OSAL_SemaphorePost(pSECComponent->pSECPort[portIndex].bufferSemID);
+        SEC_OSAL_SemaphoreWait(pSECComponent->pSECPort[portIndex].bufferSemID);
+
+        message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+        if (message != NULL) {
+            bufferHeader = (OMX_BUFFERHEADERTYPE *)message->pCmdData;
+            bufferHeader->nFilledLen = 0;
+
+            if (CHECK_PORT_TUNNELED(pSECPort) && !CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                if (portIndex) {
+                    OMX_EmptyThisBuffer(pSECPort->tunneledComponent, bufferHeader);
+                } else {
+                    OMX_FillThisBuffer(pSECPort->tunneledComponent, bufferHeader);
+                }
+                SEC_OSAL_Free(message);
+                message = NULL;
+            } else if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                SEC_OSAL_Log(SEC_LOG_ERROR, "Tunneled mode is not working, Line:%d", __LINE__);
+                ret = OMX_ErrorNotImplemented;
+                SEC_OSAL_Queue(&pSECPort->bufferQ, pSECPort);
+                goto EXIT;
+            } else {
+                if (portIndex == OUTPUT_PORT_INDEX) {
+                    pSECComponent->pCallbacks->FillBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader);
+                } else {
+                    pSECComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader);
+                }
+
+                SEC_OSAL_Free(message);
+                message = NULL;
+            }
+        }
+    }
+
+    if (pSECComponent->secDataBuffer[portIndex].dataValid == OMX_TRUE) {
+        if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+            message = SEC_OSAL_Malloc(sizeof(SEC_OMX_MESSAGE));
+            message->pCmdData = pSECComponent->secDataBuffer[portIndex].bufferHeader;
+            message->messageType = 0;
+            message->messageParam = -1;
+            SEC_OSAL_Queue(&pSECPort->bufferQ, message);
+            pSECComponent->sec_BufferReset(pOMXComponent, portIndex);
+        } else {
+            if (portIndex == INPUT_PORT_INDEX)
+                pSECComponent->sec_InputBufferReturn(pOMXComponent);
+            else if (portIndex == OUTPUT_PORT_INDEX)
+                pSECComponent->sec_OutputBufferReturn(pOMXComponent);
+        }
+    }
+
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        while (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) < (int)pSECPort->assignedBufferNum) {
+            SEC_OSAL_SemaphoreWait(pSECComponent->pSECPort[portIndex].bufferSemID);
+        }
+        if (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) != (int)pSECPort->assignedBufferNum)
+            SEC_OSAL_SetElemNum(&pSECPort->bufferQ, pSECPort->assignedBufferNum);
+    } else {
+        while(1) {
+            OMX_S32 cnt = 0;
+            SEC_OSAL_Get_SemaphoreCount(pSECComponent->pSECPort[portIndex].bufferSemID, &cnt);
+            if (cnt <= 0)
+                break;
+            SEC_OSAL_SemaphoreWait(pSECComponent->pSECPort[portIndex].bufferSemID);
+        }
+        SEC_OSAL_SetElemNum(&pSECPort->bufferQ, 0);
+    }
+
+    pSECComponent->processData[portIndex].dataLen       = 0;
+    pSECComponent->processData[portIndex].nFlags        = 0;
+    pSECComponent->processData[portIndex].remainDataLen = 0;
+    pSECComponent->processData[portIndex].timeStamp     = 0;
+    pSECComponent->processData[portIndex].usedDataLen   = 0;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_S32                portIndex = 0;
+    OMX_U32                i = 0, cnt = 0;
+    SEC_OMX_DATABUFFER    *flushBuffer = NULL;
+
+    FunctionIn();
+
+    if (pOMXComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    cnt = (nPortIndex == ALL_PORT_INDEX ) ? ALL_PORT_NUM : 1;
+
+    for (i = 0; i < cnt; i++) {
+        if (nPortIndex == ALL_PORT_INDEX)
+            portIndex = i;
+        else
+            portIndex = nPortIndex;
+
+        SEC_OSAL_SignalSet(pSECComponent->pauseEvent);
+
+        flushBuffer = &pSECComponent->secDataBuffer[portIndex];
+
+        SEC_OSAL_MutexLock(flushBuffer->bufferMutex);
+        ret = SEC_OMX_FlushPort(pOMXComponent, portIndex);
+        SEC_OSAL_MutexUnlock(flushBuffer->bufferMutex);
+
+        pSECComponent->pSECPort[portIndex].bIsPortFlushed = OMX_FALSE;
+
+        if (ret == OMX_ErrorNone) {
+            SEC_OSAL_Log(SEC_LOG_TRACE,"OMX_CommandFlush EventCmdComplete");
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+                            pSECComponent->callbackData,
+                            OMX_EventCmdComplete,
+                            OMX_CommandFlush, portIndex, NULL);
+        }
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+            pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+            SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+            SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            pSECComponent->bSaveFlagEOS = OMX_FALSE;
+            pSECComponent->reInputData = OMX_FALSE;
+        } else if (portIndex == OUTPUT_PORT_INDEX) {
+            pSECComponent->remainOutputData = OMX_FALSE;
+        }
+    }
+
+EXIT:
+    if ((ret != OMX_ErrorNone) && (pOMXComponent != NULL) && (pSECComponent != NULL)) {
+            pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                            pSECComponent->callbackData,
+                            OMX_EventError,
+                            ret, 0, NULL);
+    }
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_BufferFlushProcessNoEvent(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_S32                portIndex = 0;
+    OMX_U32                i = 0, cnt = 0;
+    SEC_OMX_DATABUFFER    *flushBuffer = NULL;
+
+    FunctionIn();
+
+    if (pOMXComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    cnt = (nPortIndex == ALL_PORT_INDEX ) ? ALL_PORT_NUM : 1;
+
+    for (i = 0; i < cnt; i++) {
+        if (nPortIndex == ALL_PORT_INDEX)
+            portIndex = i;
+        else
+            portIndex = nPortIndex;
+
+        pSECComponent->pSECPort[portIndex].bIsPortFlushed = OMX_TRUE;
+
+        SEC_OSAL_SignalSet(pSECComponent->pauseEvent);
+
+        flushBuffer = &pSECComponent->secDataBuffer[portIndex];
+
+        SEC_OSAL_MutexLock(flushBuffer->bufferMutex);
+        ret = SEC_OMX_FlushPort(pOMXComponent, portIndex);
+        SEC_OSAL_MutexUnlock(flushBuffer->bufferMutex);
+
+        pSECComponent->pSECPort[portIndex].bIsPortFlushed = OMX_FALSE;
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+            pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+            SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+            SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            pSECComponent->bSaveFlagEOS = OMX_FALSE;
+            pSECComponent->remainOutputData = OMX_FALSE;
+            pSECComponent->reInputData = OMX_FALSE;
+        } else if (portIndex == OUTPUT_PORT_INDEX) {
+            pSECComponent->remainOutputData = OMX_FALSE;
+        }
+    }
+
+EXIT:
+    if ((ret != OMX_ErrorNone) && (pOMXComponent != NULL) && (pSECComponent != NULL)) {
+        pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                            pSECComponent->callbackData,
+                            OMX_EventError,
+                            ret, 0, NULL);
+    }
+
+    FunctionOut();
+
+    return ret;
+}
+
+
+OMX_ERRORTYPE SEC_OMX_EnablePort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_U32                i = 0, cnt = 0;
+
+    FunctionIn();
+
+    pSECPort = &pSECComponent->pSECPort[portIndex];
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = pSECComponent->sec_AllocateTunnelBuffer(pSECPort, portIndex);
+        if (OMX_ErrorNone != ret) {
+            goto EXIT;
+        }
+        pSECPort->portDefinition.bPopulated = OMX_TRUE;
+        if (pSECComponent->currentState == OMX_StateExecuting) {
+            for (i=0; i<pSECPort->tunnelBufferNum; i++) {
+                SEC_OSAL_SemaphorePost(pSECComponent->pSECPort[portIndex].bufferSemID);
+            }
+        }
+    } else if (CHECK_PORT_TUNNELED(pSECPort) && !CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            SEC_OSAL_SemaphoreWait(pSECPort->loadedResource);
+            pSECPort->portDefinition.bPopulated = OMX_TRUE;
+        }
+    } else {
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            SEC_OSAL_SemaphoreWait(pSECPort->loadedResource);
+            pSECPort->portDefinition.bPopulated = OMX_TRUE;
+        }
+    }
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_PortEnableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    OMX_S32                portIndex = 0;
+    OMX_U32                i = 0, cnt = 0;
+
+    FunctionIn();
+
+    if (pOMXComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    cnt = (nPortIndex == ALL_PORT_INDEX) ? ALL_PORT_NUM : 1;
+
+    for (i = 0; i < cnt; i++) {
+        if (nPortIndex == ALL_PORT_INDEX)
+            portIndex = i;
+        else
+            portIndex = nPortIndex;
+
+        ret = SEC_OMX_EnablePort(pOMXComponent, portIndex);
+        if (ret == OMX_ErrorNone) {
+            pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                            pSECComponent->callbackData,
+                            OMX_EventCmdComplete,
+                            OMX_CommandPortEnable, portIndex, NULL);
+        }
+    }
+
+EXIT:
+    if ((ret != OMX_ErrorNone) && (pOMXComponent != NULL) && (pSECComponent != NULL)) {
+            pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                            pSECComponent->callbackData,
+                            OMX_EventError,
+                            ret, 0, NULL);
+        }
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_DisablePort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_U32                i = 0, elemNum = 0;
+    SEC_OMX_MESSAGE       *message;
+
+    FunctionIn();
+
+    pSECPort = &pSECComponent->pSECPort[portIndex];
+
+    if (!CHECK_PORT_ENABLED(pSECPort)) {
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+    if (pSECComponent->currentState!=OMX_StateLoaded) {
+        if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+            while (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) >0 ) {
+                message = (SEC_OMX_MESSAGE*)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+                SEC_OSAL_Free(message);
+            }
+            ret = pSECComponent->sec_FreeTunnelBuffer(pSECPort, portIndex);
+            if (OMX_ErrorNone != ret) {
+                goto EXIT;
+            }
+            pSECPort->portDefinition.bPopulated = OMX_FALSE;
+        } else if (CHECK_PORT_TUNNELED(pSECPort) && !CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+            pSECPort->portDefinition.bPopulated = OMX_FALSE;
+            SEC_OSAL_SemaphoreWait(pSECPort->unloadedResource);
+        } else {
+            if (CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+                while (SEC_OSAL_GetElemNum(&pSECPort->bufferQ) >0 ) {
+                    message = (SEC_OMX_MESSAGE*)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+                    SEC_OSAL_Free(message);
+                }
+            }
+            pSECPort->portDefinition.bPopulated = OMX_FALSE;
+            SEC_OSAL_SemaphoreWait(pSECPort->unloadedResource);
+        }
+    }
+    pSECPort->portDefinition.bEnabled = OMX_FALSE;
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_PortDisableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    OMX_S32                portIndex = 0;
+    OMX_U32                i = 0, cnt = 0;
+    SEC_OMX_DATABUFFER      *flushBuffer = NULL;
+
+    FunctionIn();
+
+    if (pOMXComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    cnt = (nPortIndex == ALL_PORT_INDEX ) ? ALL_PORT_NUM : 1;
+
+    /* port flush*/
+    for(i = 0; i < cnt; i++) {
+        if (nPortIndex == ALL_PORT_INDEX)
+            portIndex = i;
+        else
+            portIndex = nPortIndex;
+
+        pSECComponent->pSECPort[portIndex].bIsPortFlushed = OMX_TRUE;
+
+        flushBuffer = &pSECComponent->secDataBuffer[portIndex];
+
+        SEC_OSAL_MutexLock(flushBuffer->bufferMutex);
+        ret = SEC_OMX_FlushPort(pOMXComponent, portIndex);
+        SEC_OSAL_MutexUnlock(flushBuffer->bufferMutex);
+
+        pSECComponent->pSECPort[portIndex].bIsPortFlushed = OMX_FALSE;
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+            pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+            SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+            SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            pSECComponent->bSaveFlagEOS = OMX_FALSE;
+            pSECComponent->reInputData = OMX_FALSE;
+        } else if (portIndex == OUTPUT_PORT_INDEX) {
+            pSECComponent->remainOutputData = OMX_FALSE;
+        }
+    }
+
+    for(i = 0; i < cnt; i++) {
+        if (nPortIndex == ALL_PORT_INDEX)
+            portIndex = i;
+        else
+            portIndex = nPortIndex;
+
+        ret = SEC_OMX_DisablePort(pOMXComponent, portIndex);
+        pSECComponent->pSECPort[portIndex].bIsPortDisabled = OMX_FALSE;
+        if (ret == OMX_ErrorNone) {
+            pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                            pSECComponent->callbackData,
+                            OMX_EventCmdComplete,
+                            OMX_CommandPortDisable, portIndex, NULL);
+        }
+    }
+
+EXIT:
+    if ((ret != OMX_ErrorNone) && (pOMXComponent != NULL) && (pSECComponent != NULL)) {
+        pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                        pSECComponent->callbackData,
+                        OMX_EventError,
+                        ret, 0, NULL);
+    }
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_EmptyThisBuffer(
+    OMX_IN OMX_HANDLETYPE        hComponent,
+    OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BOOL               findBuffer = OMX_FALSE;
+    SEC_OMX_MESSAGE       *message;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (pBuffer == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pBuffer->nInputPortIndex != INPUT_PORT_INDEX) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_Check_SizeVersion(pBuffer, sizeof(OMX_BUFFERHEADERTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if ((pSECComponent->currentState != OMX_StateIdle) &&
+        (pSECComponent->currentState != OMX_StateExecuting) &&
+        (pSECComponent->currentState != OMX_StatePause)) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    if ((!CHECK_PORT_ENABLED(pSECPort)) ||
+        ((CHECK_PORT_BEING_FLUSHED(pSECPort) || CHECK_PORT_BEING_DISABLED(pSECPort)) &&
+        (!CHECK_PORT_TUNNELED(pSECPort) || !CHECK_PORT_BUFFER_SUPPLIER(pSECPort))) ||
+        ((pSECComponent->transientState == SEC_OMX_TransStateExecutingToIdle) &&
+        (CHECK_PORT_TUNNELED(pSECPort) && !CHECK_PORT_BUFFER_SUPPLIER(pSECPort)))) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (pBuffer == pSECPort->bufferHeader[i]) {
+            findBuffer = OMX_TRUE;
+            break;
+        }
+    }
+
+    if (findBuffer == OMX_FALSE) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    } else {
+        ret = OMX_ErrorNone;
+    }
+
+    message = SEC_OSAL_Malloc(sizeof(SEC_OMX_MESSAGE));
+    if (message == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    message->messageType = SEC_OMX_CommandEmptyBuffer;
+    message->messageParam = (OMX_U32) i;
+    message->pCmdData = (OMX_PTR)pBuffer;
+
+    ret = SEC_OSAL_Queue(&pSECPort->bufferQ, (void *)message);
+    if (ret != 0) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+    ret = SEC_OSAL_SemaphorePost(pSECPort->bufferSemID);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_FillThisBuffer(
+    OMX_IN OMX_HANDLETYPE        hComponent,
+    OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BOOL               findBuffer = OMX_FALSE;
+    SEC_OMX_MESSAGE       *message;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (pBuffer == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pBuffer->nOutputPortIndex != OUTPUT_PORT_INDEX) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_Check_SizeVersion(pBuffer, sizeof(OMX_BUFFERHEADERTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if ((pSECComponent->currentState != OMX_StateIdle) &&
+        (pSECComponent->currentState != OMX_StateExecuting) &&
+        (pSECComponent->currentState != OMX_StatePause)) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    if ((!CHECK_PORT_ENABLED(pSECPort)) ||
+        ((CHECK_PORT_BEING_FLUSHED(pSECPort) || CHECK_PORT_BEING_DISABLED(pSECPort)) &&
+        (!CHECK_PORT_TUNNELED(pSECPort) || !CHECK_PORT_BUFFER_SUPPLIER(pSECPort))) ||
+        ((pSECComponent->transientState == SEC_OMX_TransStateExecutingToIdle) &&
+        (CHECK_PORT_TUNNELED(pSECPort) && !CHECK_PORT_BUFFER_SUPPLIER(pSECPort)))) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (pBuffer == pSECPort->bufferHeader[i]) {
+            findBuffer = OMX_TRUE;
+            break;
+        }
+    }
+
+    if (findBuffer == OMX_FALSE) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    } else {
+        ret = OMX_ErrorNone;
+    }
+
+    message = SEC_OSAL_Malloc(sizeof(SEC_OMX_MESSAGE));
+    if (message == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    message->messageType = SEC_OMX_CommandFillBuffer;
+    message->messageParam = (OMX_U32) i;
+    message->pCmdData = (OMX_PTR)pBuffer;
+
+    ret = SEC_OSAL_Queue(&pSECPort->bufferQ, (void *)message);
+    if (ret != 0) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    ret = SEC_OSAL_SemaphorePost(pSECPort->bufferSemID);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_Port_Constructor(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    SEC_OMX_BASEPORT      *pSECInputPort = NULL;
+    SEC_OMX_BASEPORT      *pSECOutputPort = NULL;
+    int i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    INIT_SET_SIZE_VERSION(&pSECComponent->portParam, OMX_PORT_PARAM_TYPE);
+    pSECComponent->portParam.nPorts = ALL_PORT_NUM;
+    pSECComponent->portParam.nStartPortNumber = INPUT_PORT_INDEX;
+
+    pSECPort = SEC_OSAL_Malloc(sizeof(SEC_OMX_BASEPORT) * ALL_PORT_NUM);
+    if (pSECPort == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECPort, 0, sizeof(SEC_OMX_BASEPORT) * ALL_PORT_NUM);
+    pSECComponent->pSECPort = pSECPort;
+
+    /* Input Port */
+    pSECInputPort = &pSECPort[INPUT_PORT_INDEX];
+
+    SEC_OSAL_QueueCreate(&pSECInputPort->bufferQ);
+
+    pSECInputPort->bufferHeader = SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE*) * MAX_BUFFER_NUM);
+    if (pSECInputPort->bufferHeader == NULL) {
+        SEC_OSAL_Free(pSECPort);
+        pSECPort = NULL;
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECInputPort->bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE*) * MAX_BUFFER_NUM);
+
+    pSECInputPort->bufferStateAllocate = SEC_OSAL_Malloc(sizeof(OMX_U32) * MAX_BUFFER_NUM);
+    if (pSECInputPort->bufferStateAllocate == NULL) {
+        SEC_OSAL_Free(pSECInputPort->bufferHeader);
+        pSECInputPort->bufferHeader = NULL;
+        SEC_OSAL_Free(pSECPort);
+        pSECPort = NULL;
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECInputPort->bufferStateAllocate, 0, sizeof(OMX_U32) * MAX_BUFFER_NUM);
+
+    pSECInputPort->bufferSemID = NULL;
+    pSECInputPort->assignedBufferNum = 0;
+    pSECInputPort->portState = OMX_StateMax;
+    pSECInputPort->bIsPortFlushed = OMX_FALSE;
+    pSECInputPort->bIsPortDisabled = OMX_FALSE;
+    pSECInputPort->tunneledComponent = NULL;
+    pSECInputPort->tunneledPort = 0;
+    pSECInputPort->tunnelBufferNum = 0;
+    pSECInputPort->bufferSupplier = OMX_BufferSupplyUnspecified;
+    pSECInputPort->tunnelFlags = 0;
+    ret = SEC_OSAL_SemaphoreCreate(&pSECInputPort->loadedResource);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Free(pSECInputPort->bufferStateAllocate);
+        pSECInputPort->bufferStateAllocate = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferHeader);
+        pSECInputPort->bufferHeader = NULL;
+        SEC_OSAL_Free(pSECPort);
+        pSECPort = NULL;
+        goto EXIT;
+    }
+    ret = SEC_OSAL_SemaphoreCreate(&pSECInputPort->unloadedResource);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_SemaphoreTerminate(pSECInputPort->loadedResource);
+        pSECInputPort->loadedResource = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferStateAllocate);
+        pSECInputPort->bufferStateAllocate = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferHeader);
+        pSECInputPort->bufferHeader = NULL;
+        SEC_OSAL_Free(pSECPort);
+        pSECPort = NULL;
+        goto EXIT;
+    }
+
+    INIT_SET_SIZE_VERSION(&pSECInputPort->portDefinition, OMX_PARAM_PORTDEFINITIONTYPE);
+    pSECInputPort->portDefinition.nPortIndex = INPUT_PORT_INDEX;
+    pSECInputPort->portDefinition.eDir = OMX_DirInput;
+    pSECInputPort->portDefinition.nBufferCountActual = 0;
+    pSECInputPort->portDefinition.nBufferCountMin = 0;
+    pSECInputPort->portDefinition.nBufferSize = 0;
+    pSECInputPort->portDefinition.bEnabled = OMX_FALSE;
+    pSECInputPort->portDefinition.bPopulated = OMX_FALSE;
+    pSECInputPort->portDefinition.eDomain = OMX_PortDomainMax;
+    pSECInputPort->portDefinition.bBuffersContiguous = OMX_FALSE;
+    pSECInputPort->portDefinition.nBufferAlignment = 0;
+    pSECInputPort->markType.hMarkTargetComponent = NULL;
+    pSECInputPort->markType.pMarkData = NULL;
+
+    /* Output Port */
+    pSECOutputPort = &pSECPort[OUTPUT_PORT_INDEX];
+
+    SEC_OSAL_QueueCreate(&pSECOutputPort->bufferQ);
+
+    pSECOutputPort->bufferHeader = SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE*) * MAX_BUFFER_NUM);
+    if (pSECOutputPort->bufferHeader == NULL) {
+        SEC_OSAL_SemaphoreTerminate(pSECInputPort->unloadedResource);
+        pSECInputPort->unloadedResource = NULL;
+        SEC_OSAL_SemaphoreTerminate(pSECInputPort->loadedResource);
+        pSECInputPort->loadedResource = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferStateAllocate);
+        pSECInputPort->bufferStateAllocate = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferHeader);
+        pSECInputPort->bufferHeader = NULL;
+        SEC_OSAL_Free(pSECPort);
+        pSECPort = NULL;
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECOutputPort->bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE*) * MAX_BUFFER_NUM);
+
+    pSECOutputPort->bufferStateAllocate = SEC_OSAL_Malloc(sizeof(OMX_U32) * MAX_BUFFER_NUM);
+    if (pSECOutputPort->bufferStateAllocate == NULL) {
+        SEC_OSAL_Free(pSECOutputPort->bufferHeader);
+        pSECOutputPort->bufferHeader = NULL;
+
+        SEC_OSAL_SemaphoreTerminate(pSECInputPort->unloadedResource);
+        pSECInputPort->unloadedResource = NULL;
+        SEC_OSAL_SemaphoreTerminate(pSECInputPort->loadedResource);
+        pSECInputPort->loadedResource = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferStateAllocate);
+        pSECInputPort->bufferStateAllocate = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferHeader);
+        pSECInputPort->bufferHeader = NULL;
+        SEC_OSAL_Free(pSECPort);
+        pSECPort = NULL;
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECOutputPort->bufferStateAllocate, 0, sizeof(OMX_U32) * MAX_BUFFER_NUM);
+
+    pSECOutputPort->bufferSemID = NULL;
+    pSECOutputPort->assignedBufferNum = 0;
+    pSECOutputPort->portState = OMX_StateMax;
+    pSECOutputPort->bIsPortFlushed = OMX_FALSE;
+    pSECOutputPort->bIsPortDisabled = OMX_FALSE;
+    pSECOutputPort->tunneledComponent = NULL;
+    pSECOutputPort->tunneledPort = 0;
+    pSECOutputPort->tunnelBufferNum = 0;
+    pSECOutputPort->bufferSupplier = OMX_BufferSupplyUnspecified;
+    pSECOutputPort->tunnelFlags = 0;
+    ret = SEC_OSAL_SemaphoreCreate(&pSECOutputPort->loadedResource);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Free(pSECOutputPort->bufferStateAllocate);
+        pSECOutputPort->bufferStateAllocate = NULL;
+        SEC_OSAL_Free(pSECOutputPort->bufferHeader);
+        pSECOutputPort->bufferHeader = NULL;
+
+        SEC_OSAL_SemaphoreTerminate(pSECInputPort->unloadedResource);
+        pSECInputPort->unloadedResource = NULL;
+        SEC_OSAL_SemaphoreTerminate(pSECInputPort->loadedResource);
+        pSECInputPort->loadedResource = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferStateAllocate);
+        pSECInputPort->bufferStateAllocate = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferHeader);
+        pSECInputPort->bufferHeader = NULL;
+        SEC_OSAL_Free(pSECPort);
+        pSECPort = NULL;
+        goto EXIT;
+    }
+    ret = SEC_OSAL_SemaphoreCreate(&pSECOutputPort->unloadedResource);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_SemaphoreTerminate(pSECOutputPort->loadedResource);
+        pSECOutputPort->loadedResource = NULL;
+        SEC_OSAL_Free(pSECOutputPort->bufferStateAllocate);
+        pSECOutputPort->bufferStateAllocate = NULL;
+        SEC_OSAL_Free(pSECOutputPort->bufferHeader);
+        pSECOutputPort->bufferHeader = NULL;
+
+        SEC_OSAL_SemaphoreTerminate(pSECInputPort->unloadedResource);
+        pSECInputPort->unloadedResource = NULL;
+        SEC_OSAL_SemaphoreTerminate(pSECInputPort->loadedResource);
+        pSECInputPort->loadedResource = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferStateAllocate);
+        pSECInputPort->bufferStateAllocate = NULL;
+        SEC_OSAL_Free(pSECInputPort->bufferHeader);
+        pSECInputPort->bufferHeader = NULL;
+        SEC_OSAL_Free(pSECPort);
+        pSECPort = NULL;
+        goto EXIT;
+    }
+
+    INIT_SET_SIZE_VERSION(&pSECOutputPort->portDefinition, OMX_PARAM_PORTDEFINITIONTYPE);
+    pSECOutputPort->portDefinition.nPortIndex = OUTPUT_PORT_INDEX;
+    pSECOutputPort->portDefinition.eDir = OMX_DirOutput;
+    pSECOutputPort->portDefinition.nBufferCountActual = 0;
+    pSECOutputPort->portDefinition.nBufferCountMin = 0;
+    pSECOutputPort->portDefinition.nBufferSize = 0;
+    pSECOutputPort->portDefinition.bEnabled = OMX_FALSE;
+    pSECOutputPort->portDefinition.bPopulated = OMX_FALSE;
+    pSECOutputPort->portDefinition.eDomain = OMX_PortDomainMax;
+    pSECOutputPort->portDefinition.bBuffersContiguous = OMX_FALSE;
+    pSECOutputPort->portDefinition.nBufferAlignment = 0;
+    pSECOutputPort->markType.hMarkTargetComponent = NULL;
+    pSECOutputPort->markType.pMarkData = NULL;
+
+    pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+    pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+    pSECComponent->checkTimeStamp.startTimeStamp = 0;
+    pSECComponent->checkTimeStamp.nStartFlags = 0x0;
+
+    pOMXComponent->EmptyThisBuffer = &SEC_OMX_EmptyThisBuffer;
+    pOMXComponent->FillThisBuffer  = &SEC_OMX_FillThisBuffer;
+
+    ret = OMX_ErrorNone;
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_Port_Destructor(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+
+    FunctionIn();
+
+    int i = 0;
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    for (i = 0; i < ALL_PORT_NUM; i++) {
+        pSECPort = &pSECComponent->pSECPort[i];
+
+        SEC_OSAL_SemaphoreTerminate(pSECPort->loadedResource);
+        pSECPort->loadedResource = NULL;
+        SEC_OSAL_SemaphoreTerminate(pSECPort->unloadedResource);
+        pSECPort->unloadedResource = NULL;
+        SEC_OSAL_Free(pSECPort->bufferStateAllocate);
+        pSECPort->bufferStateAllocate = NULL;
+        SEC_OSAL_Free(pSECPort->bufferHeader);
+        pSECPort->bufferHeader = NULL;
+
+        SEC_OSAL_QueueTerminate(&pSECPort->bufferQ);
+    }
+    SEC_OSAL_Free(pSECComponent->pSECPort);
+    pSECComponent->pSECPort = NULL;
+    ret = OMX_ErrorNone;
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Baseport.h b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Baseport.h
new file mode 100644
index 0000000..a69a443
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Baseport.h
@@ -0,0 +1,95 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Baseport.h
+ * @brief
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ *             HyeYeon Chung (hyeon.chung@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_BASE_PORT
+#define SEC_OMX_BASE_PORT
+
+
+#include "OMX_Component.h"
+#include "SEC_OMX_Def.h"
+#include "SEC_OSAL_Queue.h"
+
+
+#define BUFFER_STATE_ALLOCATED  (1 << 0)
+#define BUFFER_STATE_ASSIGNED   (1 << 1)
+#define HEADER_STATE_ALLOCATED  (1 << 2)
+#define BUFFER_STATE_FREE        0
+
+#define MAX_BUFFER_NUM          20
+
+#define INPUT_PORT_INDEX    0
+#define OUTPUT_PORT_INDEX   1
+#define ALL_PORT_INDEX     -1
+#define ALL_PORT_NUM        2
+
+typedef struct _SEC_OMX_BASEPORT
+{
+    OMX_BUFFERHEADERTYPE         **bufferHeader;
+    OMX_U32                       *bufferStateAllocate;
+    OMX_PARAM_PORTDEFINITIONTYPE   portDefinition;
+    OMX_HANDLETYPE                 bufferSemID;
+    SEC_QUEUE                      bufferQ;
+    OMX_U32                        assignedBufferNum;
+    OMX_STATETYPE                  portState;
+    OMX_HANDLETYPE                 loadedResource;
+    OMX_HANDLETYPE                 unloadedResource;
+
+    OMX_BOOL                       bIsPortFlushed;
+    OMX_BOOL                       bIsPortDisabled;
+    OMX_MARKTYPE                   markType;
+
+    OMX_CONFIG_RECTTYPE            cropRectangle;
+
+    /* Tunnel Info */
+    OMX_HANDLETYPE                 tunneledComponent;
+    OMX_U32                        tunneledPort;
+    OMX_U32                        tunnelBufferNum;
+    OMX_BUFFERSUPPLIERTYPE         bufferSupplier;
+    OMX_U32                        tunnelFlags;
+
+    OMX_BOOL                       bIsANBEnabled;
+    OMX_BOOL                       bStoreMetaData;
+} SEC_OMX_BASEPORT;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OMX_PortEnableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
+OMX_ERRORTYPE SEC_OMX_PortDisableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
+OMX_ERRORTYPE SEC_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
+OMX_ERRORTYPE SEC_OMX_BufferFlushProcessNoEvent(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
+OMX_ERRORTYPE SEC_OMX_Port_Constructor(OMX_HANDLETYPE hComponent);
+OMX_ERRORTYPE SEC_OMX_Port_Destructor(OMX_HANDLETYPE hComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Resourcemanager.c b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Resourcemanager.c
new file mode 100644
index 0000000..6a2c979
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Resourcemanager.c
@@ -0,0 +1,478 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Resourcemanager.c
+ * @brief
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Resourcemanager.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Mutex.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_RM"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+#define MAX_RESOURCE_VIDEO_DEC 3 /* for Android */
+#define MAX_RESOURCE_VIDEO_ENC 1 /* for Android */
+
+/* Max allowable video scheduler component instance */
+static SEC_OMX_RM_COMPONENT_LIST *gpVideoDecRMComponentList = NULL;
+static SEC_OMX_RM_COMPONENT_LIST *gpVideoDecRMWaitingList = NULL;
+static SEC_OMX_RM_COMPONENT_LIST *gpVideoEncRMComponentList = NULL;
+static SEC_OMX_RM_COMPONENT_LIST *gpVideoEncRMWaitingList = NULL;
+static OMX_HANDLETYPE ghVideoRMComponentListMutex = NULL;
+
+
+OMX_ERRORTYPE addElementList(SEC_OMX_RM_COMPONENT_LIST **ppList, OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_RM_COMPONENT_LIST *pTempComp = NULL;
+    SEC_OMX_BASECOMPONENT     *pSECComponent = NULL;
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (*ppList != NULL) {
+        pTempComp = *ppList;
+        while (pTempComp->pNext != NULL) {
+            pTempComp = pTempComp->pNext;
+        }
+        pTempComp->pNext = (SEC_OMX_RM_COMPONENT_LIST *)SEC_OSAL_Malloc(sizeof(SEC_OMX_RM_COMPONENT_LIST));
+        if (pTempComp->pNext == NULL) {
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+        ((SEC_OMX_RM_COMPONENT_LIST *)(pTempComp->pNext))->pNext = NULL;
+        ((SEC_OMX_RM_COMPONENT_LIST *)(pTempComp->pNext))->pOMXStandComp = pOMXComponent;
+        ((SEC_OMX_RM_COMPONENT_LIST *)(pTempComp->pNext))->groupPriority = pSECComponent->compPriority.nGroupPriority;
+        goto EXIT;
+    } else {
+        *ppList = (SEC_OMX_RM_COMPONENT_LIST *)SEC_OSAL_Malloc(sizeof(SEC_OMX_RM_COMPONENT_LIST));
+        if (*ppList == NULL) {
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+        pTempComp = *ppList;
+        pTempComp->pNext = NULL;
+        pTempComp->pOMXStandComp = pOMXComponent;
+        pTempComp->groupPriority = pSECComponent->compPriority.nGroupPriority;
+    }
+
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE removeElementList(SEC_OMX_RM_COMPONENT_LIST **ppList, OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_RM_COMPONENT_LIST *pCurrComp = NULL;
+    SEC_OMX_RM_COMPONENT_LIST *pPrevComp = NULL;
+    OMX_BOOL                   bDetectComp = OMX_FALSE;
+
+    if (*ppList == NULL) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    pCurrComp = *ppList;
+    while (pCurrComp != NULL) {
+        if (pCurrComp->pOMXStandComp == pOMXComponent) {
+            if (*ppList == pCurrComp) {
+                *ppList = pCurrComp->pNext;
+                SEC_OSAL_Free(pCurrComp);
+            } else {
+                if (pPrevComp != NULL)
+                    pPrevComp->pNext = pCurrComp->pNext;
+
+                SEC_OSAL_Free(pCurrComp);
+            }
+            bDetectComp = OMX_TRUE;
+            break;
+        } else {
+            pPrevComp = pCurrComp;
+            pCurrComp = pCurrComp->pNext;
+        }
+    }
+
+    if (bDetectComp == OMX_FALSE)
+        ret = OMX_ErrorComponentNotFound;
+    else
+        ret = OMX_ErrorNone;
+
+EXIT:
+    return ret;
+}
+
+int searchLowPriority(SEC_OMX_RM_COMPONENT_LIST *RMComp_list, OMX_U32 inComp_priority, SEC_OMX_RM_COMPONENT_LIST **outLowComp)
+{
+    int ret = 0;
+    SEC_OMX_RM_COMPONENT_LIST *pTempComp = NULL;
+    SEC_OMX_RM_COMPONENT_LIST *pCandidateComp = NULL;
+
+    if (RMComp_list == NULL)
+        ret = -1;
+
+    pTempComp = RMComp_list;
+    *outLowComp = 0;
+
+    while (pTempComp != NULL) {
+        if (pTempComp->groupPriority > inComp_priority) {
+            if (pCandidateComp != NULL) {
+                if (pCandidateComp->groupPriority < pTempComp->groupPriority)
+                    pCandidateComp = pTempComp;
+            } else {
+                pCandidateComp = pTempComp;
+            }
+        }
+
+        pTempComp = pTempComp->pNext;
+    }
+
+    *outLowComp = pCandidateComp;
+    if (pCandidateComp == NULL)
+        ret = 0;
+    else
+        ret = 1;
+
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE removeComponent(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateIdle) {
+        (*(pSECComponent->pCallbacks->EventHandler))
+            (pOMXComponent, pSECComponent->callbackData,
+            OMX_EventError, OMX_ErrorResourcesLost, 0, NULL);
+        ret = OMX_SendCommand(pOMXComponent, OMX_CommandStateSet, OMX_StateLoaded, NULL);
+        if (ret != OMX_ErrorNone) {
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+    } else if ((pSECComponent->currentState == OMX_StateExecuting) || (pSECComponent->currentState == OMX_StatePause)) {
+        /* Todo */
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    return ret;
+}
+
+
+OMX_ERRORTYPE SEC_OMX_ResourceManager_Init()
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    FunctionIn();
+    ret = SEC_OSAL_MutexCreate(&ghVideoRMComponentListMutex);
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ResourceManager_Deinit()
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    SEC_OMX_RM_COMPONENT_LIST *pCurrComponent;
+    SEC_OMX_RM_COMPONENT_LIST *pNextComponent;
+
+    FunctionIn();
+
+    SEC_OSAL_MutexLock(ghVideoRMComponentListMutex);
+
+    if (gpVideoDecRMComponentList) {
+        pCurrComponent = gpVideoDecRMComponentList;
+        while (pCurrComponent != NULL) {
+            pNextComponent = pCurrComponent->pNext;
+            SEC_OSAL_Free(pCurrComponent);
+            pCurrComponent = pNextComponent;
+        }
+        gpVideoDecRMComponentList = NULL;
+    }
+    if (gpVideoDecRMWaitingList) {
+        pCurrComponent = gpVideoDecRMWaitingList;
+        while (pCurrComponent != NULL) {
+            pNextComponent = pCurrComponent->pNext;
+            SEC_OSAL_Free(pCurrComponent);
+            pCurrComponent = pNextComponent;
+        }
+        gpVideoDecRMWaitingList = NULL;
+    }
+
+    if (gpVideoEncRMComponentList) {
+        pCurrComponent = gpVideoEncRMComponentList;
+        while (pCurrComponent != NULL) {
+            pNextComponent = pCurrComponent->pNext;
+            SEC_OSAL_Free(pCurrComponent);
+            pCurrComponent = pNextComponent;
+        }
+        gpVideoEncRMComponentList = NULL;
+    }
+    if (gpVideoEncRMWaitingList) {
+        pCurrComponent = gpVideoEncRMWaitingList;
+        while (pCurrComponent != NULL) {
+            pNextComponent = pCurrComponent->pNext;
+            SEC_OSAL_Free(pCurrComponent);
+            pCurrComponent = pNextComponent;
+        }
+        gpVideoEncRMWaitingList = NULL;
+    }
+
+    SEC_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
+
+    SEC_OSAL_MutexTerminate(ghVideoRMComponentListMutex);
+    ghVideoRMComponentListMutex = NULL;
+
+    ret = OMX_ErrorNone;
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_Get_Resource(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT     *pSECComponent = NULL;
+    SEC_OMX_RM_COMPONENT_LIST *pComponentTemp = NULL;
+    SEC_OMX_RM_COMPONENT_LIST *pComponentCandidate = NULL;
+    int numElem = 0;
+    int lowCompDetect = 0;
+
+    FunctionIn();
+
+    SEC_OSAL_MutexLock(ghVideoRMComponentListMutex);
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pSECComponent->codecType == HW_VIDEO_DEC_CODEC) {
+        pComponentTemp = gpVideoDecRMComponentList;
+        if (pComponentTemp != NULL) {
+            while (pComponentTemp) {
+                numElem++;
+                pComponentTemp = pComponentTemp->pNext;
+            }
+        } else {
+            numElem = 0;
+        }
+        if (numElem >= MAX_RESOURCE_VIDEO_DEC) {
+            lowCompDetect = searchLowPriority(gpVideoDecRMComponentList, pSECComponent->compPriority.nGroupPriority, &pComponentCandidate);
+            if (lowCompDetect <= 0) {
+                ret = OMX_ErrorInsufficientResources;
+                goto EXIT;
+            } else {
+                ret = removeComponent(pComponentCandidate->pOMXStandComp);
+                if (ret != OMX_ErrorNone) {
+                    ret = OMX_ErrorInsufficientResources;
+                    goto EXIT;
+                } else {
+                    ret = removeElementList(&gpVideoDecRMComponentList, pComponentCandidate->pOMXStandComp);
+                    ret = addElementList(&gpVideoDecRMComponentList, pOMXComponent);
+                    if (ret != OMX_ErrorNone) {
+                        ret = OMX_ErrorInsufficientResources;
+                        goto EXIT;
+                    }
+                }
+            }
+        } else {
+            ret = addElementList(&gpVideoDecRMComponentList, pOMXComponent);
+            if (ret != OMX_ErrorNone) {
+                ret = OMX_ErrorInsufficientResources;
+                goto EXIT;
+            }
+        }
+    } else if (pSECComponent->codecType == HW_VIDEO_ENC_CODEC) {
+        pComponentTemp = gpVideoEncRMComponentList;
+        if (pComponentTemp != NULL) {
+            while (pComponentTemp) {
+                numElem++;
+                pComponentTemp = pComponentTemp->pNext;
+            }
+        } else {
+            numElem = 0;
+        }
+        if (numElem >= MAX_RESOURCE_VIDEO_ENC) {
+            lowCompDetect = searchLowPriority(gpVideoEncRMComponentList, pSECComponent->compPriority.nGroupPriority, &pComponentCandidate);
+            if (lowCompDetect <= 0) {
+                ret = OMX_ErrorInsufficientResources;
+                goto EXIT;
+            } else {
+                ret = removeComponent(pComponentCandidate->pOMXStandComp);
+                if (ret != OMX_ErrorNone) {
+                    ret = OMX_ErrorInsufficientResources;
+                    goto EXIT;
+                } else {
+                    ret = removeElementList(&gpVideoEncRMComponentList, pComponentCandidate->pOMXStandComp);
+                    ret = addElementList(&gpVideoEncRMComponentList, pOMXComponent);
+                    if (ret != OMX_ErrorNone) {
+                        ret = OMX_ErrorInsufficientResources;
+                        goto EXIT;
+                    }
+                }
+            }
+        } else {
+            ret = addElementList(&gpVideoEncRMComponentList, pOMXComponent);
+            if (ret != OMX_ErrorNone) {
+                ret = OMX_ErrorInsufficientResources;
+                goto EXIT;
+            }
+        }
+    }
+    ret = OMX_ErrorNone;
+
+EXIT:
+
+    SEC_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_Release_Resource(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT     *pSECComponent = NULL;
+    SEC_OMX_RM_COMPONENT_LIST *pComponentTemp = NULL;
+    OMX_COMPONENTTYPE         *pOMXWaitComponent = NULL;
+    int numElem = 0;
+
+    FunctionIn();
+
+    SEC_OSAL_MutexLock(ghVideoRMComponentListMutex);
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    
+    if (pSECComponent->codecType == HW_VIDEO_DEC_CODEC) {
+        pComponentTemp = gpVideoDecRMWaitingList;
+        if (gpVideoDecRMComponentList == NULL) {
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+
+        ret = removeElementList(&gpVideoDecRMComponentList, pOMXComponent);
+        if (ret != OMX_ErrorNone) {
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+        while (pComponentTemp) {
+            numElem++;
+            pComponentTemp = pComponentTemp->pNext;
+        }
+        if (numElem > 0) {
+            pOMXWaitComponent = gpVideoDecRMWaitingList->pOMXStandComp;
+            removeElementList(&gpVideoDecRMWaitingList, pOMXWaitComponent);
+            ret = OMX_SendCommand(pOMXWaitComponent, OMX_CommandStateSet, OMX_StateIdle, NULL);
+            if (ret != OMX_ErrorNone) {
+                goto EXIT;
+            }
+        }
+    } else if (pSECComponent->codecType == HW_VIDEO_ENC_CODEC) {
+        pComponentTemp = gpVideoEncRMWaitingList;
+        if (gpVideoEncRMComponentList == NULL) {
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+
+        ret = removeElementList(&gpVideoEncRMComponentList, pOMXComponent);
+        if (ret != OMX_ErrorNone) {
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+        while (pComponentTemp) {
+            numElem++;
+            pComponentTemp = pComponentTemp->pNext;
+        }
+        if (numElem > 0) {
+            pOMXWaitComponent = gpVideoEncRMWaitingList->pOMXStandComp;
+            removeElementList(&gpVideoEncRMWaitingList, pOMXWaitComponent);
+            ret = OMX_SendCommand(pOMXWaitComponent, OMX_CommandStateSet, OMX_StateIdle, NULL);
+            if (ret != OMX_ErrorNone) {
+                goto EXIT;
+            }
+        }
+    }
+
+EXIT:
+
+    SEC_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_In_WaitForResource(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    SEC_OSAL_MutexLock(ghVideoRMComponentListMutex);
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->codecType == HW_VIDEO_DEC_CODEC)
+        ret = addElementList(&gpVideoDecRMWaitingList, pOMXComponent);
+    else if (pSECComponent->codecType == HW_VIDEO_ENC_CODEC)
+        ret = addElementList(&gpVideoEncRMWaitingList, pOMXComponent);
+
+    SEC_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_Out_WaitForResource(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    SEC_OSAL_MutexLock(ghVideoRMComponentListMutex);
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->codecType == HW_VIDEO_DEC_CODEC)
+        ret = removeElementList(&gpVideoDecRMWaitingList, pOMXComponent);
+    else if (pSECComponent->codecType == HW_VIDEO_ENC_CODEC)
+        ret = removeElementList(&gpVideoEncRMWaitingList, pOMXComponent);
+
+    SEC_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
+
+    FunctionOut();
+
+    return ret;
+}
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Resourcemanager.h b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Resourcemanager.h
new file mode 100644
index 0000000..e78b378
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/common/SEC_OMX_Resourcemanager.h
@@ -0,0 +1,59 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Resourcemanager.h
+ * @brief
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_RESOURCEMANAGER
+#define SEC_OMX_RESOURCEMANAGER
+
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+
+
+struct SEC_OMX_RM_COMPONENT_LIST;
+typedef struct _SEC_OMX_RM_COMPONENT_LIST
+{
+    OMX_COMPONENTTYPE         *pOMXStandComp;
+    OMX_U32                    groupPriority;
+    struct _SEC_OMX_RM_COMPONENT_LIST *pNext;
+} SEC_OMX_RM_COMPONENT_LIST;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OMX_ResourceManager_Init();
+OMX_ERRORTYPE SEC_OMX_ResourceManager_Deinit();
+OMX_ERRORTYPE SEC_OMX_Get_Resource(OMX_COMPONENTTYPE *pOMXComponent);
+OMX_ERRORTYPE SEC_OMX_Release_Resource(OMX_COMPONENTTYPE *pOMXComponent);
+OMX_ERRORTYPE SEC_OMX_In_WaitForResource(OMX_COMPONENTTYPE *pOMXComponent);
+OMX_ERRORTYPE SEC_OMX_Out_WaitForResource(OMX_COMPONENTTYPE *pOMXComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/video/dec/Android.mk
new file mode 100644
index 0000000..349be6f
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/Android.mk
@@ -0,0 +1,23 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Vdec.c
+
+LOCAL_MODULE := libSEC_OMX_Vdec
+LOCAL_ARM_MODE := arm
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/video/dec
+
+ifeq ($(BOARD_USE_ANB), true)
+LOCAL_STATIC_LIBRARIES := libsecosal
+LOCAL_CFLAGS += -DUSE_ANB
+endif
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/SEC_OMX_Vdec.c b/exynos4/multimedia/openmax/sec_omx/component/video/dec/SEC_OMX_Vdec.c
new file mode 100644
index 0000000..042dd25
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/SEC_OMX_Vdec.c
@@ -0,0 +1,1544 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Vdec.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ *              HyeYeon Chung (hyeon.chung@samsung.com)
+ *              Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "SEC_OMX_Macros.h"
+#include "SEC_OSAL_Event.h"
+#include "SEC_OMX_Vdec.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OSAL_Thread.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Mutex.h"
+#include "SEC_OSAL_ETC.h"
+
+#ifdef USE_ANB
+#include "SEC_OSAL_Android.h"
+#endif
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_VIDEO_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+inline void SEC_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    if ((secOutputPort->portDefinition.format.video.nFrameWidth !=
+            secInputPort->portDefinition.format.video.nFrameWidth) ||
+        (secOutputPort->portDefinition.format.video.nFrameHeight !=
+            secInputPort->portDefinition.format.video.nFrameHeight)) {
+        OMX_U32 width = 0, height = 0;
+
+        secOutputPort->portDefinition.format.video.nFrameWidth =
+            secInputPort->portDefinition.format.video.nFrameWidth;
+        secOutputPort->portDefinition.format.video.nFrameHeight =
+            secInputPort->portDefinition.format.video.nFrameHeight;
+        width = secOutputPort->portDefinition.format.video.nStride =
+            secInputPort->portDefinition.format.video.nStride;
+        height = secOutputPort->portDefinition.format.video.nSliceHeight =
+            secInputPort->portDefinition.format.video.nSliceHeight;
+
+        switch(secOutputPort->portDefinition.format.video.eColorFormat) {
+        case OMX_COLOR_FormatYUV420Planar:
+        case OMX_COLOR_FormatYUV420SemiPlanar:
+        case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+        case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+            if (width && height)
+                secOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
+            break;
+        case OMX_SEC_COLOR_FormatNV12Tiled:
+            width = secOutputPort->portDefinition.format.video.nFrameWidth;
+            height = secOutputPort->portDefinition.format.video.nFrameHeight;
+            if (width && height) {
+                secOutputPort->portDefinition.nBufferSize =
+                    ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)) \
+                    + ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height/2));
+            }
+            break;
+        default:
+            if (width && height)
+                secOutputPort->portDefinition.nBufferSize = width * height * 2;
+            break;
+        }
+    }
+
+  return ;
+}
+
+OMX_ERRORTYPE SEC_OMX_UseBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes,
+    OMX_IN OMX_U8                   *pBuffer)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *temp_bufferHeader = NULL;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pSECPort = &pSECComponent->pSECPort[nPortIndex];
+    if (nPortIndex >= pSECComponent->portParam.nPorts) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+    if (pSECPort->portState != OMX_StateIdle) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
+    if (temp_bufferHeader == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE));
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (pSECPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+            pSECPort->bufferHeader[i] = temp_bufferHeader;
+            pSECPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED);
+            INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
+            temp_bufferHeader->pBuffer        = pBuffer;
+            temp_bufferHeader->nAllocLen      = nSizeBytes;
+            temp_bufferHeader->pAppPrivate    = pAppPrivate;
+            if (nPortIndex == INPUT_PORT_INDEX)
+                temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX;
+            else
+                temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX;
+
+            pSECPort->assignedBufferNum++;
+            if (pSECPort->assignedBufferNum == pSECPort->portDefinition.nBufferCountActual) {
+                pSECPort->portDefinition.bPopulated = OMX_TRUE;
+                /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+                SEC_OSAL_SemaphorePost(pSECPort->loadedResource);
+                /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            }
+            *ppBufferHdr = temp_bufferHeader;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+    }
+
+    SEC_OSAL_Free(temp_bufferHeader);
+    ret = OMX_ErrorInsufficientResources;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *temp_bufferHeader = NULL;
+    OMX_U8                *temp_buffer = NULL;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+
+    pSECPort = &pSECComponent->pSECPort[nPortIndex];
+    if (nPortIndex >= pSECComponent->portParam.nPorts) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+/*
+    if (pSECPort->portState != OMX_StateIdle ) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+*/
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    if ((pVideoDec->bDRMPlayerMode == OMX_TRUE) && (nPortIndex == INPUT_PORT_INDEX)) {
+        ret = pSECComponent->sec_allocSecureInputBuffer(hComponent, sizeof(OMX_U8) * nSizeBytes, &temp_buffer);
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+    } else {
+        temp_buffer = SEC_OSAL_Malloc(sizeof(OMX_U8) * nSizeBytes);
+        if (temp_buffer == NULL) {
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+    }
+
+    temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
+    if (temp_bufferHeader == NULL) {
+        if ((pVideoDec->bDRMPlayerMode == OMX_TRUE) && (nPortIndex == INPUT_PORT_INDEX))
+            pSECComponent->sec_freeSecureInputBuffer(hComponent, temp_buffer);
+        else
+            SEC_OSAL_Free(temp_buffer);
+
+        temp_buffer = NULL;
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE));
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (pSECPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+            pSECPort->bufferHeader[i] = temp_bufferHeader;
+            pSECPort->bufferStateAllocate[i] = (BUFFER_STATE_ALLOCATED | HEADER_STATE_ALLOCATED);
+            INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
+            temp_bufferHeader->pBuffer        = temp_buffer;
+            temp_bufferHeader->nAllocLen      = nSizeBytes;
+            temp_bufferHeader->pAppPrivate    = pAppPrivate;
+            if (nPortIndex == INPUT_PORT_INDEX)
+                temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX;
+            else
+                temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX;
+            pSECPort->assignedBufferNum++;
+            if (pSECPort->assignedBufferNum == pSECPort->portDefinition.nBufferCountActual) {
+                pSECPort->portDefinition.bPopulated = OMX_TRUE;
+                /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+                SEC_OSAL_SemaphorePost(pSECPort->loadedResource);
+                /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            }
+            *ppBuffer = temp_bufferHeader;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+    }
+
+    SEC_OSAL_Free(temp_bufferHeader);
+    if ((pVideoDec->bDRMPlayerMode == OMX_TRUE) && (nPortIndex == INPUT_PORT_INDEX))
+        pSECComponent->sec_freeSecureInputBuffer(hComponent, temp_buffer);
+    else
+        SEC_OSAL_Free(temp_buffer);
+
+    ret = OMX_ErrorInsufficientResources;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_FreeBuffer(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_U32        nPortIndex,
+    OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *temp_bufferHeader = NULL;
+    OMX_U8                *temp_buffer = NULL;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    pSECPort = &pSECComponent->pSECPort[nPortIndex];
+
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    if ((pSECPort->portState != OMX_StateLoaded) && (pSECPort->portState != OMX_StateInvalid)) {
+        (*(pSECComponent->pCallbacks->EventHandler)) (pOMXComponent,
+                        pSECComponent->callbackData,
+                        (OMX_U32)OMX_EventError,
+                        (OMX_U32)OMX_ErrorPortUnpopulated,
+                        nPortIndex, NULL);
+    }
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (((pSECPort->bufferStateAllocate[i] | BUFFER_STATE_FREE) != 0) && (pSECPort->bufferHeader[i] != NULL)) {
+            if (pSECPort->bufferHeader[i]->pBuffer == pBufferHdr->pBuffer) {
+                if (pSECPort->bufferStateAllocate[i] & BUFFER_STATE_ALLOCATED) {
+                    if ((pVideoDec->bDRMPlayerMode == OMX_TRUE) && (nPortIndex == INPUT_PORT_INDEX))
+                        pSECComponent->sec_freeSecureInputBuffer(hComponent, pSECPort->bufferHeader[i]->pBuffer);
+                    else
+                        SEC_OSAL_Free(pSECPort->bufferHeader[i]->pBuffer);
+                    pSECPort->bufferHeader[i]->pBuffer = NULL;
+                    pBufferHdr->pBuffer = NULL;
+                } else if (pSECPort->bufferStateAllocate[i] & BUFFER_STATE_ASSIGNED) {
+                    ; /* None*/
+                }
+                pSECPort->assignedBufferNum--;
+                if (pSECPort->bufferStateAllocate[i] & HEADER_STATE_ALLOCATED) {
+                    SEC_OSAL_Free(pSECPort->bufferHeader[i]);
+                    pSECPort->bufferHeader[i] = NULL;
+                    pBufferHdr = NULL;
+                }
+                pSECPort->bufferStateAllocate[i] = BUFFER_STATE_FREE;
+                ret = OMX_ErrorNone;
+                goto EXIT;
+            }
+        }
+    }
+
+EXIT:
+    if (ret == OMX_ErrorNone) {
+        if (pSECPort->assignedBufferNum == 0) {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "pSECPort->unloadedResource signal set");
+            /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+            SEC_OSAL_SemaphorePost(pSECPort->unloadedResource);
+            /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            pSECPort->portDefinition.bPopulated = OMX_FALSE;
+        }
+    }
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AllocateTunnelBuffer(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex)
+{
+    OMX_ERRORTYPE                 ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT             *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE         *temp_bufferHeader = NULL;
+    OMX_U8                       *temp_buffer = NULL;
+    OMX_U32                       bufferSize = 0;
+    OMX_PARAM_PORTDEFINITIONTYPE  portDefinition;
+
+    ret = OMX_ErrorTunnelingUnsupported;
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_FreeTunnelBuffer(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT* pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE* temp_bufferHeader = NULL;
+    OMX_U8 *temp_buffer = NULL;
+    OMX_U32 bufferSize = 0;
+
+    ret = OMX_ErrorTunnelingUnsupported;
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentTunnelRequest(
+    OMX_IN OMX_HANDLETYPE hComp,
+    OMX_IN OMX_U32        nPort,
+    OMX_IN OMX_HANDLETYPE hTunneledComp,
+    OMX_IN OMX_U32        nTunneledPort,
+    OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    ret = OMX_ErrorTunnelingUnsupported;
+EXIT:
+    return ret;
+}
+
+OMX_BOOL SEC_Check_BufferProcess_State(SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    if ((pSECComponent->currentState == OMX_StateExecuting) &&
+        (pSECComponent->pSECPort[INPUT_PORT_INDEX].portState == OMX_StateIdle) &&
+        (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portState == OMX_StateIdle) &&
+        (pSECComponent->transientState != SEC_OMX_TransStateExecutingToIdle) &&
+        (pSECComponent->transientState != SEC_OMX_TransStateIdleToExecuting)) {
+        return OMX_TRUE;
+    } else {
+        return OMX_FALSE;
+    }
+}
+
+static OMX_ERRORTYPE SEC_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secOMXInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOMXOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+    OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader;
+
+    FunctionIn();
+
+    if (bufferHeader != NULL) {
+        if (secOMXInputPort->markType.hMarkTargetComponent != NULL ) {
+            bufferHeader->hMarkTargetComponent      = secOMXInputPort->markType.hMarkTargetComponent;
+            bufferHeader->pMarkData                 = secOMXInputPort->markType.pMarkData;
+            secOMXInputPort->markType.hMarkTargetComponent = NULL;
+            secOMXInputPort->markType.pMarkData = NULL;
+        }
+
+        if (bufferHeader->hMarkTargetComponent != NULL) {
+            if (bufferHeader->hMarkTargetComponent == pOMXComponent) {
+                pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                                pSECComponent->callbackData,
+                                OMX_EventMark,
+                                0, 0, bufferHeader->pMarkData);
+            } else {
+                pSECComponent->propagateMarkType.hMarkTargetComponent = bufferHeader->hMarkTargetComponent;
+                pSECComponent->propagateMarkType.pMarkData = bufferHeader->pMarkData;
+            }
+        }
+
+        if (CHECK_PORT_TUNNELED(secOMXInputPort)) {
+            OMX_FillThisBuffer(secOMXInputPort->tunneledComponent, bufferHeader);
+        } else {
+            bufferHeader->nFilledLen = 0;
+            pSECComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader);
+        }
+    }
+
+    if ((pSECComponent->currentState == OMX_StatePause) &&
+        ((!CHECK_PORT_BEING_FLUSHED(secOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(secOMXOutputPort)))) {
+        SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME);
+        SEC_OSAL_SignalReset(pSECComponent->pauseEvent);
+    }
+
+    dataBuffer->dataValid     = OMX_FALSE;
+    dataBuffer->dataLen       = 0;
+    dataBuffer->remainDataLen = 0;
+    dataBuffer->usedDataLen   = 0;
+    dataBuffer->bufferHeader  = NULL;
+    dataBuffer->nFlags        = 0;
+    dataBuffer->timeStamp     = 0;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    OMX_ERRORTYPE       ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT   *pSECPort = NULL;
+    SEC_OMX_DATABUFFER *dataBuffer = NULL;
+    SEC_OMX_MESSAGE*    message = NULL;
+    SEC_OMX_DATABUFFER *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+
+    FunctionIn();
+
+    pSECPort= &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    dataBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+
+    if (pSECComponent->currentState != OMX_StateExecuting) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    } else {
+        SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID);
+        SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
+        if (dataBuffer->dataValid != OMX_TRUE) {
+            message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+            if (message == NULL) {
+                ret = OMX_ErrorUndefined;
+                SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+                goto EXIT;
+            }
+
+            dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData);
+            dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen;
+            dataBuffer->dataLen = dataBuffer->bufferHeader->nFilledLen;
+            dataBuffer->remainDataLen = dataBuffer->dataLen;
+            dataBuffer->usedDataLen = 0;
+            dataBuffer->dataValid = OMX_TRUE;
+            dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags;
+            dataBuffer->timeStamp = dataBuffer->bufferHeader->nTimeStamp;
+
+            SEC_OSAL_Free(message);
+
+            if (dataBuffer->allocSize <= dataBuffer->dataLen)
+                SEC_OSAL_Log(SEC_LOG_WARNING, "Input Buffer Full, Check input buffer size! allocSize:%d, dataLen:%d", dataBuffer->allocSize, dataBuffer->dataLen);
+        }
+        SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+        ret = OMX_ErrorNone;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secOMXInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOMXOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+    OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader;
+
+    FunctionIn();
+
+    if (bufferHeader != NULL) {
+        bufferHeader->nFilledLen = dataBuffer->remainDataLen;
+        bufferHeader->nOffset    = 0;
+        bufferHeader->nFlags     = dataBuffer->nFlags;
+        bufferHeader->nTimeStamp = dataBuffer->timeStamp;
+
+        if (pSECComponent->propagateMarkType.hMarkTargetComponent != NULL) {
+            bufferHeader->hMarkTargetComponent = pSECComponent->propagateMarkType.hMarkTargetComponent;
+            bufferHeader->pMarkData = pSECComponent->propagateMarkType.pMarkData;
+            pSECComponent->propagateMarkType.hMarkTargetComponent = NULL;
+            pSECComponent->propagateMarkType.pMarkData = NULL;
+        }
+
+        if (bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) {
+            pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                            pSECComponent->callbackData,
+                            OMX_EventBufferFlag,
+                            OUTPUT_PORT_INDEX,
+                            bufferHeader->nFlags, NULL);
+        }
+
+        if (CHECK_PORT_TUNNELED(secOMXOutputPort)) {
+            OMX_EmptyThisBuffer(secOMXOutputPort->tunneledComponent, bufferHeader);
+        } else {
+            pSECComponent->pCallbacks->FillBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader);
+        }
+    }
+
+    if ((pSECComponent->currentState == OMX_StatePause) &&
+        ((!CHECK_PORT_BEING_FLUSHED(secOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(secOMXOutputPort)))) {
+        SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME);
+        SEC_OSAL_SignalReset(pSECComponent->pauseEvent);
+    }
+
+    /* reset dataBuffer */
+    dataBuffer->dataValid     = OMX_FALSE;
+    dataBuffer->dataLen       = 0;
+    dataBuffer->remainDataLen = 0;
+    dataBuffer->usedDataLen   = 0;
+    dataBuffer->bufferHeader  = NULL;
+    dataBuffer->nFlags        = 0;
+    dataBuffer->timeStamp     = 0;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    OMX_ERRORTYPE       ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT   *pSECPort = NULL;
+    SEC_OMX_DATABUFFER *dataBuffer = NULL;
+    SEC_OMX_MESSAGE    *message = NULL;
+    SEC_OMX_DATABUFFER *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+
+    FunctionIn();
+
+    pSECPort= &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    dataBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+
+    if (pSECComponent->currentState != OMX_StateExecuting) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    } else {
+        SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID);
+        SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+        if (dataBuffer->dataValid != OMX_TRUE) {
+            message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+            if (message == NULL) {
+                ret = OMX_ErrorUndefined;
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+                goto EXIT;
+            }
+
+            dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData);
+            dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen;
+            dataBuffer->dataLen = 0; //dataBuffer->bufferHeader->nFilledLen;
+            dataBuffer->remainDataLen = dataBuffer->dataLen;
+            dataBuffer->usedDataLen = 0; //dataBuffer->bufferHeader->nOffset;
+            dataBuffer->dataValid =OMX_TRUE;
+            /* dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags; */
+            /* dataBuffer->nTimeStamp = dataBuffer->bufferHeader->nTimeStamp; */
+            pSECComponent->processData[OUTPUT_PORT_INDEX].dataBuffer = dataBuffer->bufferHeader->pBuffer;
+            pSECComponent->processData[OUTPUT_PORT_INDEX].allocSize = dataBuffer->bufferHeader->nAllocLen;
+
+            SEC_OSAL_Free(message);
+        }
+        SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+        ret = OMX_ErrorNone;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+
+}
+
+static OMX_ERRORTYPE SEC_BufferReset(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 portIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    /* SEC_OMX_BASEPORT      *pSECPort = &pSECComponent->pSECPort[portIndex]; */
+    SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[portIndex];
+    /* OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader; */
+
+    dataBuffer->dataValid     = OMX_FALSE;
+    dataBuffer->dataLen       = 0;
+    dataBuffer->remainDataLen = 0;
+    dataBuffer->usedDataLen   = 0;
+    dataBuffer->bufferHeader  = NULL;
+    dataBuffer->nFlags        = 0;
+    dataBuffer->timeStamp     = 0;
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_DataReset(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 portIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    /* SEC_OMX_BASEPORT      *pSECPort = &pSECComponent->pSECPort[portIndex]; */
+    /* SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[portIndex]; */
+    /* OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader; */
+    SEC_OMX_DATA          *processData = &pSECComponent->processData[portIndex];
+
+    processData->dataLen       = 0;
+    processData->remainDataLen = 0;
+    processData->usedDataLen   = 0;
+    processData->nFlags        = 0;
+    processData->timeStamp     = 0;
+
+    return ret;
+}
+
+OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_BOOL               ret = OMX_FALSE;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_DATABUFFER    *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+    SEC_OMX_DATA          *inputData = &pSECComponent->processData[INPUT_PORT_INDEX];
+    OMX_U32                copySize = 0;
+    OMX_BYTE               checkInputStream = NULL;
+    OMX_U32                checkInputStreamLen = 0;
+    OMX_U32                checkedSize = 0;
+    OMX_BOOL               flagEOF = OMX_FALSE;
+    OMX_BOOL               previousFrameEOF = OMX_FALSE;
+
+    FunctionIn();
+
+    if (inputUseBuffer->dataValid == OMX_TRUE) {
+        checkInputStream = inputUseBuffer->bufferHeader->pBuffer + inputUseBuffer->usedDataLen;
+        checkInputStreamLen = inputUseBuffer->remainDataLen;
+
+        if (inputData->dataLen == 0) {
+            previousFrameEOF = OMX_TRUE;
+        } else {
+            previousFrameEOF = OMX_FALSE;
+        }
+        if (pVideoDec->bDRMPlayerMode == OMX_TRUE) {
+            flagEOF = OMX_TRUE;
+            checkedSize = checkInputStreamLen;
+        } else if ((pSECComponent->bUseFlagEOF == OMX_TRUE) &&
+           !(inputUseBuffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) {
+            flagEOF = OMX_TRUE;
+            checkedSize = checkInputStreamLen;
+        } else {
+            pSECComponent->bUseFlagEOF = OMX_FALSE;
+            checkedSize = pSECComponent->sec_checkInputFrame(checkInputStream, checkInputStreamLen, inputUseBuffer->nFlags, previousFrameEOF, &flagEOF);
+        }
+
+        if (flagEOF == OMX_TRUE) {
+            copySize = checkedSize;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "sec_checkInputFrame : OMX_TRUE");
+        } else {
+            copySize = checkInputStreamLen;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "sec_checkInputFrame : OMX_FALSE");
+        }
+
+        if (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS)
+            pSECComponent->bSaveFlagEOS = OMX_TRUE;
+
+        if ((((inputData->allocSize) - (inputData->dataLen)) >= copySize) || (pVideoDec->bDRMPlayerMode == OMX_TRUE)) {
+            if (pVideoDec->bDRMPlayerMode == OMX_TRUE) {
+                inputData->dataBuffer = checkInputStream;
+            } else {
+                if (copySize > 0)
+                    SEC_OSAL_Memcpy(inputData->dataBuffer + inputData->dataLen, checkInputStream, copySize);
+            }
+
+            inputUseBuffer->dataLen -= copySize;
+            inputUseBuffer->remainDataLen -= copySize;
+            inputUseBuffer->usedDataLen += copySize;
+
+            inputData->dataLen += copySize;
+            inputData->remainDataLen += copySize;
+
+            if (previousFrameEOF == OMX_TRUE) {
+                inputData->timeStamp = inputUseBuffer->timeStamp;
+                inputData->nFlags = inputUseBuffer->nFlags;
+            }
+
+            if (pSECComponent->bUseFlagEOF == OMX_TRUE) {
+                if (pSECComponent->bSaveFlagEOS == OMX_TRUE) {
+                    inputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                    flagEOF = OMX_TRUE;
+                    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+                } else {
+                    inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+                }
+            } else {
+                if ((checkedSize == checkInputStreamLen) && (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+                    if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) &&
+                        ((inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) ||
+                        (inputData->dataLen == 0))) {
+                    inputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                    flagEOF = OMX_TRUE;
+                    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+                    } else if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) &&
+                               (!(inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) &&
+                               (inputData->dataLen != 0)) {
+                        inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+                        flagEOF = OMX_TRUE;
+                        pSECComponent->bSaveFlagEOS = OMX_TRUE;
+                    }
+                } else {
+                    inputData->nFlags = (inputUseBuffer->nFlags & (~OMX_BUFFERFLAG_EOS));
+                }
+            }
+
+            if(((inputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+               (inputData->dataLen <= 0) && (flagEOF == OMX_TRUE)) {
+                inputData->dataLen = inputData->previousDataLen;
+                inputData->remainDataLen = inputData->previousDataLen;
+            }
+        } else {
+            /*????????????????????????????????? Error ?????????????????????????????????*/
+            SEC_DataReset(pOMXComponent, INPUT_PORT_INDEX);
+            flagEOF = OMX_FALSE;
+        }
+
+        if (inputUseBuffer->remainDataLen == 0) {
+            if (pVideoDec->bDRMPlayerMode != OMX_TRUE)
+                SEC_InputBufferReturn(pOMXComponent);
+        } else {
+            inputUseBuffer->dataValid = OMX_TRUE;
+        }
+    }
+
+    if (flagEOF == OMX_TRUE) {
+        if (pSECComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
+            pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_TRUE;
+            pSECComponent->checkTimeStamp.startTimeStamp = inputData->timeStamp;
+            pSECComponent->checkTimeStamp.nStartFlags = inputData->nFlags;
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "first frame timestamp after seeking %lld us (%.2f secs)",
+                inputData->timeStamp, inputData->timeStamp / 1E6);
+        }
+
+        ret = OMX_TRUE;
+    } else {
+        ret = OMX_FALSE;
+    }
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_BOOL               ret = OMX_FALSE;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATA          *outputData = &pSECComponent->processData[OUTPUT_PORT_INDEX];
+    OMX_U32                copySize = 0;
+
+    FunctionIn();
+
+    if (outputUseBuffer->dataValid == OMX_TRUE) {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE) {
+            if ((pSECComponent->checkTimeStamp.startTimeStamp == outputData->timeStamp) &&
+                (pSECComponent->checkTimeStamp.nStartFlags == outputData->nFlags)){
+                pSECComponent->checkTimeStamp.startTimeStamp = -19761123;
+                pSECComponent->checkTimeStamp.nStartFlags = 0x0;
+                pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+                pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+            } else {
+                SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+                ret = OMX_TRUE;
+                goto EXIT;
+            }
+        } else if (pSECComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
+            SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+            ret = OMX_TRUE;
+            goto EXIT;
+        }
+
+        if (outputData->remainDataLen <= (outputUseBuffer->allocSize - outputUseBuffer->dataLen)) {
+            copySize = outputData->remainDataLen;
+
+            outputUseBuffer->dataLen += copySize;
+            outputUseBuffer->remainDataLen += copySize;
+            outputUseBuffer->nFlags = outputData->nFlags;
+            outputUseBuffer->timeStamp = outputData->timeStamp;
+
+            ret = OMX_TRUE;
+
+            /* reset outputData */
+            SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+
+            if ((outputUseBuffer->remainDataLen > 0) ||
+                (outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS))
+                SEC_OutputBufferReturn(pOMXComponent);
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "output buffer is smaller than decoded data size Out Length");
+
+            ret = OMX_FALSE;
+
+            /* reset outputData */
+            SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+        }
+    } else {
+        ret = OMX_FALSE;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT      *secInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATA          *inputData = &pSECComponent->processData[INPUT_PORT_INDEX];
+    SEC_OMX_DATA          *outputData = &pSECComponent->processData[OUTPUT_PORT_INDEX];
+    OMX_U32                copySize = 0;
+
+    pSECComponent->remainOutputData = OMX_FALSE;
+    pSECComponent->reInputData = OMX_FALSE;
+
+    FunctionIn();
+
+    while (!pSECComponent->bExitBufferProcessThread) {
+        SEC_OSAL_SleepMillisec(0);
+
+        if (((pSECComponent->currentState == OMX_StatePause) ||
+            (pSECComponent->currentState == OMX_StateIdle) ||
+            (pSECComponent->transientState == SEC_OMX_TransStateLoadedToIdle) ||
+            (pSECComponent->transientState == SEC_OMX_TransStateExecutingToIdle)) &&
+            (pSECComponent->transientState != SEC_OMX_TransStateIdleToLoaded)&&
+            ((!CHECK_PORT_BEING_FLUSHED(secInputPort) && !CHECK_PORT_BEING_FLUSHED(secOutputPort)))) {
+            SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME);
+            SEC_OSAL_SignalReset(pSECComponent->pauseEvent);
+        }
+
+        while ((SEC_Check_BufferProcess_State(pSECComponent)) && (!pSECComponent->bExitBufferProcessThread)) {
+            SEC_OSAL_SleepMillisec(0);
+
+            SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+            if ((outputUseBuffer->dataValid != OMX_TRUE) &&
+                (!CHECK_PORT_BEING_FLUSHED(secOutputPort))) {
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+                ret = SEC_OutputBufferGetQueue(pSECComponent);
+                if ((ret == OMX_ErrorUndefined) ||
+                    (secInputPort->portState != OMX_StateIdle) ||
+                    (secOutputPort->portState != OMX_StateIdle)) {
+                    break;
+                }
+            } else {
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+            }
+
+            if (pSECComponent->remainOutputData == OMX_FALSE) {
+                if (pSECComponent->reInputData == OMX_FALSE) {
+                    SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
+                    if ((SEC_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) &&
+                        (!CHECK_PORT_BEING_FLUSHED(secInputPort))) {
+                            SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+                            ret = SEC_InputBufferGetQueue(pSECComponent);
+                            break;
+                    }
+
+                    SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+                }
+
+                SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
+                SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+                ret = pSECComponent->sec_mfc_bufferProcess(pOMXComponent, inputData, outputData);
+
+                if (pVideoDec->bDRMPlayerMode == OMX_TRUE) {
+                    if ((inputUseBuffer->remainDataLen == 0) &&
+                        (ret != OMX_ErrorInputDataDecodeYet))
+                        SEC_InputBufferReturn(pOMXComponent);
+                    else
+                        inputUseBuffer->dataValid = OMX_TRUE;
+                }
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+                SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+
+                if (ret == OMX_ErrorInputDataDecodeYet)
+                    pSECComponent->reInputData = OMX_TRUE;
+                else
+                    pSECComponent->reInputData = OMX_FALSE;
+            }
+
+            SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+
+            if (SEC_Postprocess_OutputData(pOMXComponent) == OMX_FALSE)
+                pSECComponent->remainOutputData = OMX_TRUE;
+            else
+                pSECComponent->remainOutputData = OMX_FALSE;
+
+            SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+        }
+    }
+
+EXIT:
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoDecodeGetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamVideoInit:
+    {
+        OMX_PORT_PARAM_TYPE *portParam = (OMX_PORT_PARAM_TYPE *)ComponentParameterStructure;
+        ret = SEC_OMX_Check_SizeVersion(portParam, sizeof(OMX_PORT_PARAM_TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        portParam->nPorts           = pSECComponent->portParam.nPorts;
+        portParam->nStartPortNumber = pSECComponent->portParam.nStartPortNumber;
+        ret = OMX_ErrorNone;
+    }
+        break;
+    case OMX_IndexParamVideoPortFormat:
+    {
+        OMX_VIDEO_PARAM_PORTFORMATTYPE *portFormat = (OMX_VIDEO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure;
+        OMX_U32                         portIndex = portFormat->nPortIndex;
+        OMX_U32                         index    = portFormat->nIndex;
+        SEC_OMX_BASEPORT               *pSECPort = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE   *portDefinition = NULL;
+        OMX_U32                         supportFormatNum = 0; /* supportFormatNum = N-1 */
+
+        ret = SEC_OMX_Check_SizeVersion(portFormat, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((portIndex >= pSECComponent->portParam.nPorts)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            supportFormatNum = INPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1;
+            if (index > supportFormatNum) {
+                ret = OMX_ErrorNoMore;
+                goto EXIT;
+            }
+
+            pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+            portDefinition = &pSECPort->portDefinition;
+
+            portFormat->eCompressionFormat = portDefinition->format.video.eCompressionFormat;
+            portFormat->eColorFormat       = portDefinition->format.video.eColorFormat;
+            portFormat->xFramerate           = portDefinition->format.video.xFramerate;
+        } else if (portIndex == OUTPUT_PORT_INDEX) {
+            supportFormatNum = OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1;
+            if (index > supportFormatNum) {
+                ret = OMX_ErrorNoMore;
+                goto EXIT;
+            }
+
+            pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+            portDefinition = &pSECPort->portDefinition;
+
+            switch (index) {
+            case supportFormat_0:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_COLOR_FormatYUV420Planar;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_1:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_COLOR_FormatYUV420SemiPlanar;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_2:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+           case supportFormat_3:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12Tiled;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            }
+        }
+        ret = OMX_ErrorNone;
+    }
+        break;
+#ifdef USE_ANB
+    case OMX_IndexParamGetAndroidNativeBuffer:
+    {
+        ret = SEC_OSAL_GetANBParameter(hComponent, nParamIndex, ComponentParameterStructure);
+    }
+        break;
+#endif
+    default:
+    {
+        ret = SEC_OMX_GetParameter(hComponent, nParamIndex, ComponentParameterStructure);
+    }
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+OMX_ERRORTYPE SEC_OMX_VideoDecodeSetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamVideoPortFormat:
+    {
+        OMX_VIDEO_PARAM_PORTFORMATTYPE *portFormat = (OMX_VIDEO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure;
+        OMX_U32                         portIndex = portFormat->nPortIndex;
+        OMX_U32                         index    = portFormat->nIndex;
+        SEC_OMX_BASEPORT               *pSECPort = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE   *portDefinition = NULL;
+        OMX_U32                         supportFormatNum = 0;
+
+        ret = SEC_OMX_Check_SizeVersion(portFormat, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((portIndex >= pSECComponent->portParam.nPorts)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            portDefinition = &pSECPort->portDefinition;
+
+            portDefinition->format.video.eColorFormat       = portFormat->eColorFormat;
+            portDefinition->format.video.eCompressionFormat = portFormat->eCompressionFormat;
+            portDefinition->format.video.xFramerate         = portFormat->xFramerate;
+        }
+    }
+        break;
+#ifdef USE_ANB
+    case OMX_IndexParamEnableAndroidBuffers:
+    case OMX_IndexParamUseAndroidNativeBuffer:
+    {
+        ret = SEC_OSAL_SetANBParameter(hComponent, nIndex, ComponentParameterStructure);
+    }
+        break;
+#endif
+    default:
+    {
+        ret = SEC_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure);
+    }
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoDecodeGetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_GetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoDecodeSetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexVendorThumbnailMode:
+    {
+        SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+        pVideoDec->bThumbnailMode = *((OMX_BOOL *)pComponentConfigStructure);
+
+        ret = OMX_ErrorNone;
+    }
+        break;
+    default:
+        ret = SEC_OMX_SetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoDecodeGetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+#ifdef USE_ANB
+    if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_ENABLE_ANB) == 0)
+        *pIndexType = (OMX_INDEXTYPE) OMX_IndexParamEnableAndroidBuffers;
+    else if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_GET_ANB) == 0)
+        *pIndexType = (OMX_INDEXTYPE) OMX_IndexParamGetAndroidNativeBuffer;
+    else if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_USE_ANB) == 0)
+        *pIndexType = (OMX_INDEXTYPE) OMX_IndexParamUseAndroidNativeBuffer;
+    else
+        ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
+#else
+    ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
+#endif
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_BaseComponent_Constructor(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_Port_Constructor(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OMX_BaseComponent_Destructor(pOMXComponent);
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pVideoDec = SEC_OSAL_Malloc(sizeof(SEC_OMX_VIDEODEC_COMPONENT));
+    if (pVideoDec == NULL) {
+        SEC_OMX_BaseComponent_Destructor(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    SEC_OSAL_Memset(pVideoDec, 0, sizeof(SEC_OMX_VIDEODEC_COMPONENT));
+    pSECComponent->hComponentHandle = (OMX_HANDLETYPE)pVideoDec;
+
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.nBufferCountActual = MAX_VIDEO_INPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferCountMin = MAX_VIDEO_INPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferSize = 0;
+    pSECPort->portDefinition.eDomain = OMX_PortDomainVideo;
+
+    pSECPort->portDefinition.format.video.cMIMEType = SEC_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+
+    pSECPort->portDefinition.format.video.nFrameWidth = 0;
+    pSECPort->portDefinition.format.video.nFrameHeight= 0;
+    pSECPort->portDefinition.format.video.nStride = 0;
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.format.video.nBitrate = 64000;
+    pSECPort->portDefinition.format.video.xFramerate = (15 << 16);
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.format.video.pNativeWindow = NULL;
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.nBufferCountActual = MAX_VIDEO_OUTPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferCountMin = MAX_VIDEO_OUTPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.eDomain = OMX_PortDomainVideo;
+
+    pSECPort->portDefinition.format.video.cMIMEType = SEC_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+
+    pSECPort->portDefinition.format.video.nFrameWidth = 0;
+    pSECPort->portDefinition.format.video.nFrameHeight= 0;
+    pSECPort->portDefinition.format.video.nStride = 0;
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.format.video.nBitrate = 64000;
+    pSECPort->portDefinition.format.video.xFramerate = (15 << 16);
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.format.video.pNativeWindow = NULL;
+
+    pOMXComponent->UseBuffer              = &SEC_OMX_UseBuffer;
+    pOMXComponent->AllocateBuffer         = &SEC_OMX_AllocateBuffer;
+    pOMXComponent->FreeBuffer             = &SEC_OMX_FreeBuffer;
+    pOMXComponent->ComponentTunnelRequest = &SEC_OMX_ComponentTunnelRequest;
+
+    pSECComponent->sec_AllocateTunnelBuffer = &SEC_OMX_AllocateTunnelBuffer;
+    pSECComponent->sec_FreeTunnelBuffer     = &SEC_OMX_FreeTunnelBuffer;
+    pSECComponent->sec_BufferProcess        = &SEC_OMX_BufferProcess;
+    pSECComponent->sec_BufferReset          = &SEC_BufferReset;
+    pSECComponent->sec_InputBufferReturn    = &SEC_InputBufferReturn;
+    pSECComponent->sec_OutputBufferReturn   = &SEC_OutputBufferReturn;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+    int                    i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OSAL_Free(pVideoDec);
+    pSECComponent->hComponentHandle = pVideoDec = NULL;
+
+    for(i = 0; i < ALL_PORT_NUM; i++) {
+        pSECPort = &pSECComponent->pSECPort[i];
+        SEC_OSAL_Free(pSECPort->portDefinition.format.video.cMIMEType);
+        pSECPort->portDefinition.format.video.cMIMEType = NULL;
+    }
+
+    ret = SEC_OMX_Port_Destructor(pOMXComponent);
+
+    ret = SEC_OMX_BaseComponent_Destructor(hComponent);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/SEC_OMX_Vdec.h b/exynos4/multimedia/openmax/sec_omx/component/video/dec/SEC_OMX_Vdec.h
new file mode 100644
index 0000000..d3bbdf4
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/SEC_OMX_Vdec.h
@@ -0,0 +1,160 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Vdec.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ *              HyeYeon Chung (hyeon.chung@samsung.com)
+ *              Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_VIDEO_DECODE
+#define SEC_OMX_VIDEO_DECODE
+
+#include "OMX_Component.h"
+#include "SEC_OMX_Def.h"
+#include "SEC_OSAL_Queue.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Basecomponent.h"
+
+#define MAX_VIDEO_INPUTBUFFER_NUM    5
+#define MAX_VIDEO_OUTPUTBUFFER_NUM   2
+
+#define DEFAULT_FRAME_WIDTH          176
+#define DEFAULT_FRAME_HEIGHT         144
+
+#define DEFAULT_VIDEO_INPUT_BUFFER_SIZE    (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT) * 2
+#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE   (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2
+
+#define MFC_INPUT_BUFFER_NUM_MAX            2
+#define DEFAULT_MFC_INPUT_BUFFER_SIZE    1024 * 1024 * MFC_INPUT_BUFFER_NUM_MAX    /*DEFAULT_VIDEO_INPUT_BUFFER_SIZE*/
+
+#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX    1
+#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX   4
+
+typedef struct
+{
+    void *pAddrY;
+    void *pAddrC;
+} MFC_DEC_ADDR_INFO;
+
+typedef struct _SEC_MFC_NBDEC_THREAD
+{
+    OMX_HANDLETYPE  hNBDecodeThread;
+    OMX_HANDLETYPE  hDecFrameStart;
+    OMX_HANDLETYPE  hDecFrameEnd;
+    OMX_BOOL        bExitDecodeThread;
+    OMX_BOOL        bDecoderRun;
+
+    OMX_U32         oneFrameSize;
+} SEC_MFC_NBDEC_THREAD;
+
+typedef struct _MFC_DEC_INPUT_BUFFER
+{
+    void *PhyAddr;      // physical address
+    void *VirAddr;      // virtual address
+    int   bufferSize;   // input buffer alloc size
+    int   dataSize;     // Data length
+} MFC_DEC_INPUT_BUFFER;
+
+typedef struct _SEC_OMX_VIDEODEC_COMPONENT
+{
+    OMX_HANDLETYPE hCodecHandle;
+    SEC_MFC_NBDEC_THREAD NBDecThread;
+
+    OMX_BOOL bThumbnailMode;
+    OMX_BOOL bFirstFrame;
+    MFC_DEC_INPUT_BUFFER MFCDecInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
+    OMX_U32  indexInputBuffer;
+
+    /* CSC handle */
+    OMX_PTR csc_handle;
+    OMX_U32 csc_set_format;
+
+    /* For DRM Play */
+    OMX_BOOL bDRMPlayerMode;
+} SEC_OMX_VIDEODEC_COMPONENT;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OMX_UseBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes,
+    OMX_IN OMX_U8                   *pBuffer);
+OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes);
+OMX_ERRORTYPE SEC_OMX_FreeBuffer(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_U32        nPortIndex,
+    OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr);
+OMX_ERRORTYPE SEC_OMX_AllocateTunnelBuffer(
+    SEC_OMX_BASEPORT *pOMXBasePort,
+    OMX_U32           nPortIndex);
+OMX_ERRORTYPE SEC_OMX_FreeTunnelBuffer(
+    SEC_OMX_BASEPORT *pOMXBasePort,
+    OMX_U32           nPortIndex);
+OMX_ERRORTYPE SEC_OMX_ComponentTunnelRequest(
+    OMX_IN  OMX_HANDLETYPE hComp,
+    OMX_IN OMX_U32         nPort,
+    OMX_IN OMX_HANDLETYPE  hTunneledComp,
+    OMX_IN OMX_U32         nTunneledPort,
+    OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup);
+OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent);
+OMX_ERRORTYPE SEC_OMX_VideoDecodeGetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     ComponentParameterStructure);
+OMX_ERRORTYPE SEC_OMX_VideoDecodeSetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        ComponentParameterStructure);
+OMX_ERRORTYPE SEC_OMX_VideoDecodeGetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure);
+OMX_ERRORTYPE SEC_OMX_VideoDecodeSetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure);
+OMX_ERRORTYPE SEC_OMX_VideoDecodeGetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType);
+OMX_ERRORTYPE SEC_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent);
+OMX_ERRORTYPE SEC_OMX_VideoDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent);
+OMX_BOOL SEC_Check_BufferProcess_State(SEC_OMX_BASECOMPONENT *pSECComponent);
+inline void SEC_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/Android.mk
new file mode 100644
index 0000000..da5880e
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/Android.mk
@@ -0,0 +1,84 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_H264dec.c \
+	library_register.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libOMX.SEC.AVC.Decoder
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx
+
+LOCAL_CFLAGS :=
+
+ifeq ($(BOARD_NONBLOCK_MODE_PROCESS), true)
+LOCAL_CFLAGS += -DNONBLOCK_MODE_PROCESS
+endif
+
+ifeq ($(BOARD_USE_DRM), true)
+LOCAL_CFLAGS += -DUSE_DRM
+endif
+
+ifeq ($(BOARD_USE_ANB), true)
+LOCAL_CFLAGS += -DUSE_ANB
+ifeq ($(BOARD_USE_CSC_FIMC), true)
+ifeq ($(BOARD_USE_V4L2_ION), false)
+LOCAL_CFLAGS += -DUSE_CSC_FIMC
+endif
+endif
+
+ifeq ($(BOARD_USE_CSC_GSCALER), true)
+LOCAL_CFLAGS += -DUSE_CSC_GSCALER
+endif
+endif
+
+
+ifeq ($(TARGET_BOARD_PLATFORM), exynos4)
+ifeq ($(BOARD_USE_V4L2_ION),false)
+ifeq ($(BOARD_USE_S3D_SUPPORT), true)
+LOCAL_CFLAGS += -DS3D_SUPPORT
+endif
+endif
+endif
+
+ifeq ($(TARGET_BOARD_PLATFORM), exynos5)
+ifeq ($(BOARD_USE_S3D_SUPPORT), true)
+LOCAL_CFLAGS += -DS3D_SUPPORT
+endif
+endif
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \
+	libswconverter libsecmfcapi
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
+	libSEC_OMX_Resourcemanager libcsc
+
+ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
+LOCAL_SHARED_LIBRARIES += libfimc libhwconverter
+endif
+
+ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
+LOCAL_SHARED_LIBRARIES += libexynosgscaler
+endif
+
+#ifeq ($(BOARD_USE_V4L2_ION),true)
+#LOCAL_SHARED_LIBRARIES += libion
+#endif
+
+ifeq ($(BOARD_USES_MFC_FPS),true)
+LOCAL_CFLAGS += -DCONFIG_MFC_FPS
+endif
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/video/dec \
+	$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO) \
+	$(BOARD_HAL_PATH)/include
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/SEC_OMX_H264dec.c b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/SEC_OMX_H264dec.c
new file mode 100644
index 0000000..2ad34d8
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/SEC_OMX_H264dec.c
@@ -0,0 +1,2611 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_H264dec.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Macros.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Vdec.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Thread.h"
+#include "library_register.h"
+#include "SEC_OMX_H264dec.h"
+#include "SsbSipMfcApi.h"
+
+#ifdef USE_ANB
+#include "SEC_OSAL_Android.h"
+#endif
+
+/* To use CSC_METHOD_PREFER_HW or CSC_METHOD_HW in SEC OMX, gralloc should allocate physical memory using FIMC */
+/* It means GRALLOC_USAGE_HW_FIMC1 should be set on Native Window usage */
+#include "csc.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_H264_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+#define H264_DEC_NUM_OF_EXTRA_BUFFERS 7
+
+#ifdef S3D_SUPPORT
+#define ADD_SPS_PPS_I_FRAME
+#else
+//#define ADD_SPS_PPS_I_FRAME
+#endif
+//#define FULL_FRAME_SEARCH
+
+/* H.264 Decoder Supported Levels & profiles */
+SEC_OMX_VIDEO_PROFILELEVEL supportedAVCProfileLevels[] ={
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1b},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel11},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel12},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel13},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel2},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel21},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel22},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel3},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel31},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel32},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel4},
+
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1b},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel11},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel12},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel13},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel2},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel21},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel22},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel3},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel31},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel32},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel4},
+
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel1},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel1b},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel11},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel12},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel13},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel2},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel21},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel22},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel3},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel31},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel32},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel4}};
+
+
+static int Check_H264_Frame(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame)
+{
+    OMX_U32  preFourByte       = (OMX_U32)-1;
+    int      accessUnitSize    = 0;
+    int      frameTypeBoundary = 0;
+    int      nextNaluSize      = 0;
+    int      naluStart         = 0;
+
+    if (bPreviousFrameEOF == OMX_TRUE)
+        naluStart = 0;
+    else
+        naluStart = 1;
+
+    while (1) {
+        int inputOneByte = 0;
+
+        if (accessUnitSize == (int)buffSize)
+            goto EXIT;
+
+        inputOneByte = *(pInputStream++);
+        accessUnitSize += 1;
+
+        if (preFourByte == 0x00000001 || (preFourByte << 8) == 0x00000100) {
+            int naluType = inputOneByte & 0x1F;
+
+            SEC_OSAL_Log(SEC_LOG_TRACE, "NaluType : %d", naluType);
+            if (naluStart == 0) {
+#ifdef ADD_SPS_PPS_I_FRAME
+                if (naluType == 1 || naluType == 5)
+#else
+                if (naluType == 1 || naluType == 5 || naluType == 7 || naluType == 8)
+#endif
+                    naluStart = 1;
+            } else {
+#ifdef OLD_DETECT
+                frameTypeBoundary = (8 - naluType) & (naluType - 10); //AUD(9)
+#else
+                if (naluType == 9)
+                    frameTypeBoundary = -2;
+#endif
+                if (naluType == 1 || naluType == 5) {
+                    if (accessUnitSize == (int)buffSize) {
+                        accessUnitSize--;
+                        goto EXIT;
+                    }
+                    inputOneByte = *pInputStream++;
+                    accessUnitSize += 1;
+
+                    if (inputOneByte >= 0x80)
+                        frameTypeBoundary = -1;
+                }
+                if (frameTypeBoundary < 0) {
+                    break;
+                }
+            }
+
+        }
+        preFourByte = (preFourByte << 8) + inputOneByte;
+    }
+
+    *pbEndOfFrame = OMX_TRUE;
+    nextNaluSize = -5;
+    if (frameTypeBoundary == -1)
+        nextNaluSize = -6;
+    if (preFourByte != 0x00000001)
+        nextNaluSize++;
+    return (accessUnitSize + nextNaluSize);
+
+EXIT:
+    *pbEndOfFrame = OMX_FALSE;
+
+    return accessUnitSize;
+}
+
+OMX_BOOL Check_H264_StartCode(OMX_U8 *pInputStream, OMX_U32 streamSize)
+{
+    if (streamSize < 4) {
+        return OMX_FALSE;
+    } else if ((pInputStream[0] == 0x00) &&
+              (pInputStream[1] == 0x00) &&
+              (pInputStream[2] == 0x00) &&
+              (pInputStream[3] != 0x00) &&
+              ((pInputStream[3] >> 3) == 0x00)) {
+        return OMX_TRUE;
+    } else if ((pInputStream[0] == 0x00) &&
+              (pInputStream[1] == 0x00) &&
+              (pInputStream[2] != 0x00) &&
+              ((pInputStream[2] >> 3) == 0x00)) {
+        return OMX_TRUE;
+    } else {
+        return OMX_FALSE;
+    }
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Dec_Alloc_SecureInputBuffer(OMX_IN OMX_HANDLETYPE hComponent,
+                                                      OMX_IN OMX_U32 nBufferSize,
+                                                      OMX_INOUT OMX_PTR *pInputBuffer_physicalAddress)
+{
+    FunctionIn();
+
+    OMX_ERRORTYPE      ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_H264DEC_HANDLE    *pH264Dec = NULL;
+    OMX_PTR pStreamBuffer    = NULL;
+    OMX_PTR pStreamPhyBuffer = NULL;
+
+#ifdef USE_DRM
+    pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    if (pH264Dec == NULL) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    pStreamBuffer = SsbSipMfcDecAllocInputBuffer(pH264Dec->hMFCH264Handle.hMFCHandle, &pStreamPhyBuffer, nBufferSize);
+    if (pStreamBuffer == NULL) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pStreamPhyBuffer;
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = nBufferSize;
+
+    *pInputBuffer_physicalAddress = pStreamPhyBuffer;
+#endif
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Dec_Free_SecureInputBuffer(OMX_IN OMX_HANDLETYPE hComponent,
+                                                     OMX_INOUT OMX_PTR pInputBuffer_physicalAddress)
+{
+    FunctionIn();
+
+    OMX_ERRORTYPE      ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_H264DEC_HANDLE    *pH264Dec = NULL;
+    OMX_PTR pStreamPhyBuffer = NULL;
+
+#ifdef USE_DRM
+    pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    if (pH264Dec == NULL) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    pStreamPhyBuffer = pInputBuffer_physicalAddress;
+    SsbSipMfcDecFreeInputBuffer(pH264Dec->hMFCH264Handle.hMFCHandle, pStreamPhyBuffer);
+#endif
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Dec_GetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     pComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamVideoAvc:
+    {
+        OMX_VIDEO_PARAM_AVCTYPE *pDstAVCComponent = (OMX_VIDEO_PARAM_AVCTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_AVCTYPE *pSrcAVCComponent = NULL;
+        SEC_H264DEC_HANDLE      *pH264Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstAVCComponent->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcAVCComponent = &pH264Dec->AVCComponent[pDstAVCComponent->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstAVCComponent, pSrcAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_H264_DEC_ROLE);
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelQuerySupported:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pDstProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE*)pComponentParameterStructure;
+        SEC_OMX_VIDEO_PROFILELEVEL *pProfileLevel = NULL;
+        OMX_U32 maxProfileLevelNum = 0;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pProfileLevel = supportedAVCProfileLevels;
+        maxProfileLevelNum = sizeof(supportedAVCProfileLevels) / sizeof(SEC_OMX_VIDEO_PROFILELEVEL);
+
+        if (pDstProfileLevel->nProfileIndex >= maxProfileLevelNum) {
+            ret = OMX_ErrorNoMore;
+            goto EXIT;
+        }
+
+        pProfileLevel += pDstProfileLevel->nProfileIndex;
+        pDstProfileLevel->eProfile = pProfileLevel->profile;
+        pDstProfileLevel->eLevel = pProfileLevel->level;
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelCurrent:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pDstProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE*)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_AVCTYPE *pSrcAVCComponent = NULL;
+        SEC_H264DEC_HANDLE      *pH264Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcAVCComponent = &pH264Dec->AVCComponent[pDstProfileLevel->nPortIndex];
+
+        pDstProfileLevel->eProfile = pSrcAVCComponent->eProfile;
+        pDstProfileLevel->eLevel = pSrcAVCComponent->eLevel;
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = NULL;
+        SEC_H264DEC_HANDLE      *pH264Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstErrorCorrectionType->nPortIndex != INPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcErrorCorrectionType = &pH264Dec->errorCorrectionType[INPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Dec_SetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamVideoAvc:
+    {
+        OMX_VIDEO_PARAM_AVCTYPE *pDstAVCComponent = NULL;
+        OMX_VIDEO_PARAM_AVCTYPE *pSrcAVCComponent = (OMX_VIDEO_PARAM_AVCTYPE *)pComponentParameterStructure;
+        SEC_H264DEC_HANDLE      *pH264Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcAVCComponent->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstAVCComponent = &pH264Dec->AVCComponent[pSrcAVCComponent->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstAVCComponent, pSrcAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+
+        if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_H264_DEC_ROLE)) {
+            pSECComponent->pSECPort[INPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
+        } else {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+    }
+        break;
+    case OMX_IndexParamPortDefinition:
+    {
+        OMX_PARAM_PORTDEFINITIONTYPE *pPortDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)pComponentParameterStructure;
+        OMX_U32                       portIndex = pPortDefinition->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort;
+        OMX_U32 width, height, size;
+        OMX_U32 realWidth, realHeight;
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+        ret = SEC_OMX_Check_SizeVersion(pPortDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            if (pSECPort->portDefinition.bEnabled == OMX_TRUE) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+        }
+        if (pPortDefinition->nBufferCountActual < pSECPort->portDefinition.nBufferCountMin) {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+
+        SEC_OSAL_Memcpy(&pSECPort->portDefinition, pPortDefinition, pPortDefinition->nSize);
+
+        realWidth = pSECPort->portDefinition.format.video.nFrameWidth;
+        realHeight = pSECPort->portDefinition.format.video.nFrameHeight;
+        width = ((realWidth + 15) & (~15));
+        height = ((realHeight + 15) & (~15));
+        size = (width * height * 3) / 2;
+        pSECPort->portDefinition.format.video.nStride = width;
+        pSECPort->portDefinition.format.video.nSliceHeight = height;
+        pSECPort->portDefinition.nBufferSize = (size > pSECPort->portDefinition.nBufferSize) ? size : pSECPort->portDefinition.nBufferSize;
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+            pSECOutputPort->portDefinition.format.video.nFrameWidth = pSECPort->portDefinition.format.video.nFrameWidth;
+            pSECOutputPort->portDefinition.format.video.nFrameHeight = pSECPort->portDefinition.format.video.nFrameHeight;
+            pSECOutputPort->portDefinition.format.video.nStride = width;
+            pSECOutputPort->portDefinition.format.video.nSliceHeight = height;
+
+            switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+            case OMX_COLOR_FormatYUV420Planar:
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+            case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+            case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                pSECOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
+                break;
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                pSECOutputPort->portDefinition.nBufferSize =
+                    ALIGN_TO_8KB(ALIGN_TO_128B(realWidth) * ALIGN_TO_32B(realHeight)) \
+                  + ALIGN_TO_8KB(ALIGN_TO_128B(realWidth) * ALIGN_TO_32B(realHeight/2));
+                break;
+            default:
+                SEC_OSAL_Log(SEC_LOG_ERROR, "Color format is not support!! use default YUV size!!");
+                ret = OMX_ErrorUnsupportedSetting;
+                break;
+            }
+        }
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelCurrent:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pSrcProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_AVCTYPE *pDstAVCComponent = NULL;
+        SEC_H264DEC_HANDLE      *pH264Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone)
+            goto EXIT;
+
+        if (pSrcProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+        pDstAVCComponent = &pH264Dec->AVCComponent[pSrcProfileLevel->nPortIndex];
+        pDstAVCComponent->eProfile = pSrcProfileLevel->eProfile;
+        pDstAVCComponent->eLevel = pSrcProfileLevel->eLevel;
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = NULL;
+        SEC_H264DEC_HANDLE      *pH264Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcErrorCorrectionType->nPortIndex != INPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstErrorCorrectionType = &pH264Dec->errorCorrectionType[INPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Dec_GetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexConfigCommonOutputCrop:
+    {
+        SEC_H264DEC_HANDLE  *pH264Dec = NULL;
+        OMX_CONFIG_RECTTYPE *pSrcRectType = NULL;
+        OMX_CONFIG_RECTTYPE *pDstRectType = NULL;
+        pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+        if (pH264Dec->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) {
+            ret = OMX_ErrorNotReady;
+            break;
+        }
+
+        pDstRectType = (OMX_CONFIG_RECTTYPE *)pComponentConfigStructure;
+
+        if ((pDstRectType->nPortIndex != INPUT_PORT_INDEX) &&
+            (pDstRectType->nPortIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[pDstRectType->nPortIndex];
+
+        pSrcRectType = &(pSECPort->cropRectangle);
+
+        pDstRectType->nTop = pSrcRectType->nTop;
+        pDstRectType->nLeft = pSrcRectType->nLeft;
+        pDstRectType->nHeight = pSrcRectType->nHeight;
+        pDstRectType->nWidth = pSrcRectType->nWidth;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Dec_SetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_VideoDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Dec_GetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_ENABLE_THUMBNAIL) == 0) {
+        SEC_H264DEC_HANDLE *pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+        *pIndexType = OMX_IndexVendorThumbnailMode;
+
+        ret = OMX_ErrorNone;
+    } else {
+        ret = SEC_OMX_VideoDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Dec_ComponentRoleEnum(OMX_HANDLETYPE hComponent, OMX_U8 *cRole, OMX_U32 nIndex)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (cRole == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (nIndex == (MAX_COMPONENT_ROLE_NUM-1)) {
+        SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_H264_DEC_ROLE);
+        ret = OMX_ErrorNone;
+    } else {
+        ret = OMX_ErrorNoMore;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_DecodeThread(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_H264DEC_HANDLE    *pH264Dec = (SEC_H264DEC_HANDLE *)pVideoDec->hCodecHandle;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    while (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+        SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameStart);
+
+        if (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStart(PERF_ID_DEC);
+#endif
+            pH264Dec->hMFCH264Handle.returnCodec = SsbSipMfcDecExe(pH264Dec->hMFCH264Handle.hMFCHandle, pVideoDec->NBDecThread.oneFrameSize);
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStop(PERF_ID_DEC);
+#endif
+            SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameEnd);
+        }
+    }
+
+EXIT:
+    SEC_OSAL_ThreadExit(NULL);
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Init */
+OMX_ERRORTYPE SEC_MFC_H264Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT      *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_H264DEC_HANDLE    *pH264Dec = NULL;
+    OMX_PTR pStreamBuffer    = NULL;
+    OMX_PTR pStreamPhyBuffer = NULL;
+    OMX_PTR hMFCHandle;
+
+#ifdef S3D_SUPPORT
+    OMX_S32 setConfVal       = 0;
+#endif
+    CSC_METHOD csc_method = CSC_METHOD_SW;
+
+#ifdef CONFIG_MFC_FPS
+    SEC_OSAL_PerfInit(PERF_ID_DEC);
+    SEC_OSAL_PerfInit(PERF_ID_CSC);
+#endif
+
+    pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pH264Dec->hMFCH264Handle.bConfiguredMFC = OMX_FALSE;
+    pSECComponent->bUseFlagEOF = OMX_FALSE;
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+
+    /* MFC(Multi Function Codec) decoder and CMM(Codec Memory Management) driver open */
+    if (pVideoDec->bDRMPlayerMode == OMX_FALSE) {
+        hMFCHandle = NULL;
+
+        if (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) {
+            hMFCHandle = (OMX_PTR)SsbSipMfcDecOpen();
+        } else {
+            SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+            hMFCHandle = (OMX_PTR)SsbSipMfcDecOpenExt(&buf_type);
+        }
+
+        if (hMFCHandle == NULL) {
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+        pH264Dec->hMFCH264Handle.hMFCHandle = hMFCHandle;
+    } else {
+        hMFCHandle = pH264Dec->hMFCH264Handle.hMFCHandle;
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+    }
+
+#ifdef S3D_SUPPORT
+    /*Enable SEI parsing for checking frame_packing S3D*/
+    setConfVal = 1;
+    SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_SEI_PARSE, &setConfVal);
+#endif
+
+    /* Allocate decoder's input buffer */
+    /* Get first input buffer */
+    if (pVideoDec->bDRMPlayerMode == OMX_FALSE) {
+        pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE / 2);
+        if (pStreamBuffer == NULL) {
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+        pVideoDec->MFCDecInputBuffer[0].VirAddr = pStreamBuffer;
+        pVideoDec->MFCDecInputBuffer[0].PhyAddr = pStreamPhyBuffer;
+        pVideoDec->MFCDecInputBuffer[0].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE / 2;
+        pVideoDec->MFCDecInputBuffer[0].dataSize = 0;
+
+#ifdef NONBLOCK_MODE_PROCESS
+        /* Get second input buffer */
+        pStreamBuffer = NULL;
+        pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE / 2);
+        if (pStreamBuffer == NULL) {
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+        pVideoDec->MFCDecInputBuffer[1].VirAddr = pStreamBuffer;
+        pVideoDec->MFCDecInputBuffer[1].PhyAddr = pStreamPhyBuffer;
+        pVideoDec->MFCDecInputBuffer[1].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE / 2;
+        pVideoDec->MFCDecInputBuffer[1].dataSize = 0;
+        pVideoDec->indexInputBuffer = 0;
+
+        pVideoDec->bFirstFrame = OMX_TRUE;
+
+        pVideoDec->NBDecThread.bExitDecodeThread = OMX_FALSE;
+        pVideoDec->NBDecThread.bDecoderRun = OMX_FALSE;
+        pVideoDec->NBDecThread.oneFrameSize = 0;
+        SEC_OSAL_SemaphoreCreate(&(pVideoDec->NBDecThread.hDecFrameStart));
+        SEC_OSAL_SemaphoreCreate(&(pVideoDec->NBDecThread.hDecFrameEnd));
+        if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pVideoDec->NBDecThread.hNBDecodeThread,
+                                                    SEC_MFC_DecodeThread,
+                                                    pOMXComponent)) {
+            pH264Dec->hMFCH264Handle.returnCodec = MFC_RET_OK;
+        }
+#endif
+
+        pH264Dec->hMFCH264Handle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[0].VirAddr;
+        pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[0].PhyAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[0].VirAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[0].bufferSize;
+    }
+
+    SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+    SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+    pH264Dec->hMFCH264Handle.indexTimestamp = 0;
+    pH264Dec->hMFCH264Handle.outputIndexTimestamp = 0;
+
+    pSECComponent->getAllDelayBuffer = OMX_FALSE;
+
+#ifdef USE_ANB
+#if defined(USE_CSC_FIMC) || defined(USE_CSC_GSCALER)
+    if (pSECOutputPort->bIsANBEnabled == OMX_TRUE)
+        csc_method = CSC_METHOD_PREFER_HW;
+#endif
+    if (pVideoDec->bDRMPlayerMode == OMX_TRUE) {
+        csc_method = CSC_METHOD_HW;
+    }
+#endif
+    pVideoDec->csc_handle = csc_init(&csc_method);
+    pVideoDec->csc_set_format = OMX_FALSE;
+
+    SEC_OSAL_Log(SEC_LOG_ERROR, "%s::csc_method=%d", __func__, csc_method);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Terminate */
+OMX_ERRORTYPE SEC_MFC_H264Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_H264DEC_HANDLE    *pH264Dec = NULL;
+    OMX_PTR                hMFCHandle = NULL;
+
+    FunctionIn();
+
+#ifdef CONFIG_MFC_FPS
+    SEC_OSAL_PerfPrint("[DEC]",  PERF_ID_DEC);
+    SEC_OSAL_PerfPrint("[CSC]",  PERF_ID_CSC);
+#endif
+
+    pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    hMFCHandle = pH264Dec->hMFCH264Handle.hMFCHandle;
+
+    pH264Dec->hMFCH264Handle.pMFCStreamBuffer    = NULL;
+    pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer = NULL;
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = NULL;
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = 0;
+
+    if (pVideoDec->bDRMPlayerMode == OMX_FALSE) {
+#ifdef NONBLOCK_MODE_PROCESS
+        if (pVideoDec->NBDecThread.hNBDecodeThread != NULL) {
+            pVideoDec->NBDecThread.bExitDecodeThread = OMX_TRUE;
+            SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameStart);
+            SEC_OSAL_ThreadTerminate(pVideoDec->NBDecThread.hNBDecodeThread);
+            pVideoDec->NBDecThread.hNBDecodeThread = NULL;
+        }
+
+        if(pVideoDec->NBDecThread.hDecFrameEnd != NULL) {
+            SEC_OSAL_SemaphoreTerminate(pVideoDec->NBDecThread.hDecFrameEnd);
+            pVideoDec->NBDecThread.hDecFrameEnd = NULL;
+        }
+
+        if(pVideoDec->NBDecThread.hDecFrameStart != NULL) {
+            SEC_OSAL_SemaphoreTerminate(pVideoDec->NBDecThread.hDecFrameStart);
+           pVideoDec->NBDecThread.hDecFrameStart = NULL;
+        }
+#endif
+    }
+
+    if (pVideoDec->bDRMPlayerMode == OMX_FALSE) {
+        if (hMFCHandle != NULL) {
+            SsbSipMfcDecClose(hMFCHandle);
+            hMFCHandle = pH264Dec->hMFCH264Handle.hMFCHandle = NULL;
+        }
+    }
+
+    if (pVideoDec->csc_handle != NULL) {
+        csc_deinit(pVideoDec->csc_handle);
+        pVideoDec->csc_handle = NULL;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_H264DEC_HANDLE         *pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    SEC_OMX_BASEPORT           *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT           *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    OMX_U32                     oneFrameSize = pInputData->dataLen;
+    SSBSIP_MFC_DEC_OUTPUT_INFO  outputInfo;
+    OMX_S32                     setConfVal = 0;
+    int                         bufWidth = 0;
+    int                         bufHeight = 0;
+    OMX_U32                     FrameBufferYSize = 0;
+    OMX_U32                     FrameBufferUVSize = 0;
+    OMX_BOOL                    outputDataValid = OMX_FALSE;
+#ifdef S3D_SUPPORT
+    SSBSIP_MFC_FRAME_PACKING    frame_packing;
+#endif
+
+    FunctionIn();
+
+    if (pH264Dec->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) {
+        SSBSIP_MFC_CODEC_TYPE eCodecType = H264_DEC;
+
+        if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+
+        /* Default number in the driver is optimized */
+        if (pVideoDec->bThumbnailMode == OMX_TRUE) {
+            setConfVal = 0;
+            SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
+        } else {
+            setConfVal = H264_DEC_NUM_OF_EXTRA_BUFFERS;
+            SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &setConfVal);
+
+            setConfVal = 8;
+            SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
+        }
+
+        SsbSipMfcDecSetInBuf(pH264Dec->hMFCH264Handle.hMFCHandle,
+                             pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer,
+                             pH264Dec->hMFCH264Handle.pMFCStreamBuffer,
+                             pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        pH264Dec->hMFCH264Handle.returnCodec = SsbSipMfcDecInit(pH264Dec->hMFCH264Handle.hMFCHandle, eCodecType, oneFrameSize);
+        if (pH264Dec->hMFCH264Handle.returnCodec == MFC_RET_OK) {
+            SSBSIP_MFC_IMG_RESOLUTION imgResol;
+            SSBSIP_MFC_CROP_INFORMATION cropInfo;
+
+            SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "set width height information : %d, %d",
+                            pSECInputPort->portDefinition.format.video.nFrameWidth,
+                            pSECInputPort->portDefinition.format.video.nFrameHeight);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "mfc width height information : %d, %d",
+                            imgResol.width, imgResol.height);
+
+            SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_CROP_INFO, &cropInfo);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "mfc crop_top crop_bottom crop_left crop_right :  %d, %d, %d, %d",
+                            cropInfo.crop_top_offset , cropInfo.crop_bottom_offset ,
+                            cropInfo.crop_left_offset , cropInfo.crop_right_offset);
+
+            pSECOutputPort->cropRectangle.nTop    = cropInfo.crop_top_offset;
+            pSECOutputPort->cropRectangle.nLeft   = cropInfo.crop_left_offset;
+            pSECOutputPort->cropRectangle.nWidth  = imgResol.width - cropInfo.crop_left_offset - cropInfo.crop_right_offset;
+            pSECOutputPort->cropRectangle.nHeight = imgResol.height - cropInfo.crop_top_offset - cropInfo.crop_bottom_offset;
+
+            pH264Dec->hMFCH264Handle.bConfiguredMFC = OMX_TRUE;
+
+            /** Update Frame Size **/
+            if ((cropInfo.crop_left_offset != 0) || (cropInfo.crop_right_offset != 0) ||
+                (cropInfo.crop_top_offset != 0) || (cropInfo.crop_bottom_offset != 0)) {
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /** Send crop info call back **/
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, /* The command was completed */
+                       OMX_DirOutput, /* This is the port index */
+                       OMX_IndexConfigCommonOutputCrop,
+                       NULL);
+            }
+            if ((pSECInputPort->portDefinition.format.video.nFrameWidth != (unsigned int)imgResol.width) ||
+                (pSECInputPort->portDefinition.format.video.nFrameHeight != (unsigned int)imgResol.height)) {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "change width height information : OMX_EventPortSettingsChanged");
+
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /** Send Port Settings changed call back **/
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, /* The command was completed */
+                       OMX_DirOutput, /* This is the port index */
+                       0,
+                       NULL);
+            }
+
+#ifdef ADD_SPS_PPS_I_FRAME
+            ret = OMX_ErrorInputDataDecodeYet;
+#else
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+
+            ret = OMX_ErrorNone;
+#endif
+            goto EXIT;
+        } else {
+            ret = OMX_ErrorMFCInit;
+            goto EXIT;
+        }
+    }
+
+#ifndef FULL_FRAME_SEARCH
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+#endif
+
+    pSECComponent->timeStamp[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+    pSECComponent->nFlags[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
+
+    if ((pH264Dec->hMFCH264Handle.returnCodec == MFC_RET_OK) &&
+        (pVideoDec->bFirstFrame == OMX_FALSE)) {
+        SSBSIP_MFC_DEC_OUTBUF_STATUS status;
+        OMX_S32 indexTimestamp = 0;
+
+        /* wait for mfc decode done */
+        if (pVideoDec->NBDecThread.bDecoderRun == OMX_TRUE) {
+            SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameEnd);
+            pVideoDec->NBDecThread.bDecoderRun = OMX_FALSE;
+        }
+
+        SEC_OSAL_SleepMillisec(0);
+        status = SsbSipMfcDecGetOutBuf(pH264Dec->hMFCH264Handle.hMFCHandle, &outputInfo);
+        bufWidth = (outputInfo.img_width + 15) & (~15);
+        bufHeight = (outputInfo.img_height + 15) & (~15);
+        FrameBufferYSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height));
+        FrameBufferUVSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height/2));
+
+#ifdef S3D_SUPPORT
+        /* Check Whether frame packing information is available */
+        SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_FRAME_PACKING, &frame_packing);
+
+        if (pVideoDec->bThumbnailMode == OMX_FALSE &&
+            frame_packing.available &&
+            pH264Dec->hMFCH264Handle.bS3DMode == OMX_FALSE) {
+
+            SEC_OSAL_Log(SEC_LOG_TRACE, "arrangement ID: 0x%08x", frame_packing.arrangement_id);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "arrangement_type: %d", frame_packing.arrangement_type);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "content_interpretation_type: %d", frame_packing.content_interpretation_type);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "current_frame_is_frame0_flag: %d", frame_packing.current_frame_is_frame0_flag);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "spatial_flipping_flag: %d", frame_packing.spatial_flipping_flag);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "fr0X:%d fr0Y:%d fr0X:%d fr0Y:%d", frame_packing.frame0_grid_pos_x,
+                frame_packing.frame0_grid_pos_y, frame_packing.frame1_grid_pos_x, frame_packing.frame1_grid_pos_y);
+
+            /* Change Outport eColorFormat based on Framepacking information*/
+            if (frame_packing.arrangement_type == 3) {
+                if (frame_packing.content_interpretation_type == 1) {
+                    switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+                    case OMX_SEC_COLOR_FormatNV12Tiled:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatNV12Tiled_SBS_LR;
+                        break;
+                    case OMX_COLOR_FormatYUV420SemiPlanar:
+                    case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatYUV420SemiPlanar_SBS_LR;
+                        break;
+                    case OMX_COLOR_FormatYUV420Planar:
+                    default:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatYUV420Planar_SBS_LR;
+                        break;
+                    }
+                } else if (frame_packing.content_interpretation_type == 2) {
+                    switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+                    case OMX_SEC_COLOR_FormatNV12Tiled:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatNV12Tiled_SBS_RL;
+                        break;
+                    case OMX_COLOR_FormatYUV420SemiPlanar:
+                    case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatYUV420SemiPlanar_SBS_RL;
+                        break;
+                    case OMX_COLOR_FormatYUV420Planar:
+                    default:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatYUV420Planar_SBS_RL;
+                        break;
+                    }
+                }
+            } else if (frame_packing.arrangement_type == 4) {
+                if (frame_packing.content_interpretation_type == 1) {
+                    switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+                    case OMX_SEC_COLOR_FormatNV12Tiled:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatNV12Tiled_TB_LR;
+                        break;
+                    case OMX_COLOR_FormatYUV420SemiPlanar:
+                    case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatYUV420SemiPlanar_TB_LR;
+                        break;
+                    case OMX_COLOR_FormatYUV420Planar:
+                    default:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatYUV420Planar_TB_LR;
+                        break;
+                    }
+                } else if (frame_packing.content_interpretation_type == 2) {
+                    switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+                    case OMX_SEC_COLOR_FormatNV12Tiled:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatNV12Tiled_TB_RL;
+                        break;
+                    case OMX_COLOR_FormatYUV420SemiPlanar:
+                    case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatYUV420SemiPlanar_TB_RL;
+                        break;
+                    case OMX_COLOR_FormatYUV420Planar:
+                    default:
+                        pSECOutputPort->portDefinition.format.video.eColorFormat = OMX_SEC_COLOR_FormatYUV420Planar_TB_RL;
+                        break;
+                    }
+                }
+            }
+
+            /** Send Port Settings changed call back - output color format change */
+           (*(pSECComponent->pCallbacks->EventHandler))
+                  (pOMXComponent,
+                   pSECComponent->callbackData,
+                   OMX_EventPortSettingsChanged, /* The command was completed */
+                   OMX_DirOutput, /* This is the port index */
+                   0,
+                   NULL);
+
+            if ((pSECOutputPort->cropRectangle.nTop != 0) || (pSECOutputPort->cropRectangle.nLeft != 0)) {
+                /** Send crop info call back **/
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, /* The command was completed */
+                       OMX_DirOutput, /* This is the port index */
+                       OMX_IndexConfigCommonOutputCrop,
+                       NULL);
+            }
+            pH264Dec->hMFCH264Handle.bS3DMode = OMX_TRUE;
+            SEC_OSAL_SleepMillisec(0);
+            ret = OMX_ErrorInputDataDecodeYet;
+            goto EXIT;
+        }
+#endif
+
+        if ((SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            /* For timestamp correction. if mfc support frametype detect */
+            SEC_OSAL_Log(SEC_LOG_TRACE, "disp_pic_frame_type: %d", outputInfo.disp_pic_frame_type);
+#ifdef NEED_TIMESTAMP_REORDER
+            if ((outputInfo.disp_pic_frame_type == MFC_FRAME_TYPE_I_FRAME) ||
+                (pH264Dec->hMFCH264Handle.bFlashPlayerMode == OMX_TRUE)) {
+                pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+                pH264Dec->hMFCH264Handle.outputIndexTimestamp = indexTimestamp;
+            } else {
+                pOutputData->timeStamp = pSECComponent->timeStamp[pH264Dec->hMFCH264Handle.outputIndexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[pH264Dec->hMFCH264Handle.outputIndexTimestamp];
+            }
+#else
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+#endif
+            SEC_OSAL_Log(SEC_LOG_TRACE, "timestamp %lld us (%.2f secs)", pOutputData->timeStamp, pOutputData->timeStamp / 1E6);
+        }
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
+            (status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
+            outputDataValid = OMX_TRUE;
+            pH264Dec->hMFCH264Handle.outputIndexTimestamp++;
+            pH264Dec->hMFCH264Handle.outputIndexTimestamp %= MAX_TIMESTAMP;
+        }
+        if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+            outputDataValid = OMX_FALSE;
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE))
+            ret = OMX_ErrorInputDataDecodeYet;
+
+        if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+            if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE))) {
+                pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else {
+                ret = OMX_ErrorNone;
+            }
+            outputDataValid = OMX_FALSE;
+        }
+
+#ifdef FULL_FRAME_SEARCH
+        if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+            pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else
+#endif
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            ret = OMX_ErrorNone;
+        }
+    } else {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
+            (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+        }
+
+        if ((pVideoDec->bFirstFrame == OMX_TRUE) &&
+            ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+            ((pInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) != OMX_BUFFERFLAG_CODECCONFIG)) {
+            pOutputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+        }
+
+        outputDataValid = OMX_FALSE;
+
+        /* ret = OMX_ErrorUndefined; */
+        ret = OMX_ErrorNone;
+    }
+
+    if (ret == OMX_ErrorInputDataDecodeYet) {
+        pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize = oneFrameSize;
+        pVideoDec->indexInputBuffer++;
+        pVideoDec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+        pH264Dec->hMFCH264Handle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].PhyAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].bufferSize;
+        oneFrameSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize;
+        //pInputData->dataLen = oneFrameSize;
+        //pInputData->remainDataLen = oneFrameSize;
+    }
+
+    if ((Check_H264_StartCode(pInputData->dataBuffer, oneFrameSize) == OMX_TRUE) &&
+        ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS)) {
+        if ((ret != OMX_ErrorInputDataDecodeYet) || (pSECComponent->getAllDelayBuffer == OMX_TRUE)) {
+            SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pH264Dec->hMFCH264Handle.indexTimestamp));
+            pH264Dec->hMFCH264Handle.indexTimestamp++;
+            pH264Dec->hMFCH264Handle.indexTimestamp %= MAX_TIMESTAMP;
+        }
+
+        SsbSipMfcDecSetInBuf(pH264Dec->hMFCH264Handle.hMFCHandle,
+                             pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer,
+                             pH264Dec->hMFCH264Handle.pMFCStreamBuffer,
+                             pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize = oneFrameSize;
+        pVideoDec->NBDecThread.oneFrameSize = oneFrameSize;
+
+        /* mfc decode start */
+        SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameStart);
+        pVideoDec->NBDecThread.bDecoderRun = OMX_TRUE;
+        pH264Dec->hMFCH264Handle.returnCodec = MFC_RET_OK;
+
+        SEC_OSAL_SleepMillisec(0);
+
+        pVideoDec->indexInputBuffer++;
+        pVideoDec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+        pH264Dec->hMFCH264Handle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pH264Dec->hMFCH264Handle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].PhyAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].bufferSize;
+
+        if ((pVideoDec->bFirstFrame == OMX_TRUE) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE) &&
+            (outputDataValid == OMX_FALSE)) {
+            ret = OMX_ErrorInputDataDecodeYet;
+        }
+
+        pVideoDec->bFirstFrame = OMX_FALSE;
+    } else {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE)
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+    }
+
+    /** Fill Output Buffer **/
+    if (outputDataValid == OMX_TRUE) {
+        void *pOutputBuf = (void *)pOutputData->dataBuffer;
+        void *pSrcBuf[3] = {NULL, };
+        void *pYUVBuf[3] = {NULL, };
+        unsigned int csc_src_color_format, csc_dst_color_format;
+        CSC_METHOD csc_method = CSC_METHOD_SW;
+        unsigned int cacheable = 1;
+
+        int frameSize = bufWidth * bufHeight;
+        int actualWidth = outputInfo.img_width;
+        int actualHeight = outputInfo.img_height;
+        int actualImageSize = actualWidth * actualHeight;
+
+        pSrcBuf[0] = outputInfo.YVirAddr;
+        pSrcBuf[1] = outputInfo.CVirAddr;
+
+        pYUVBuf[0]  = (unsigned char *)pOutputBuf;
+        pYUVBuf[1]  = (unsigned char *)pOutputBuf + actualImageSize;
+        pYUVBuf[2]  = (unsigned char *)pOutputBuf + actualImageSize + actualImageSize / 4;
+        pOutputData->dataLen = (actualImageSize * 3) / 2;
+
+#ifdef USE_ANB
+        if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+            OMX_U32 stride;
+            SEC_OSAL_LockANB(pOutputData->dataBuffer, actualWidth, actualHeight, pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat, &stride, pYUVBuf);
+            actualWidth = stride;
+            pOutputData->dataLen = sizeof(void *);
+        }
+#endif
+
+        if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
+            (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
+            /* if use Post copy address structure */
+            SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+            pOutputData->dataLen = (actualWidth * actualHeight * 3) / 2;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420p out for ThumbnailMode/Flash player mode");
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStart(PERF_ID_CSC);
+#endif
+            switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+#ifdef S3D_SUPPORT
+            case OMX_SEC_COLOR_FormatNV12Tiled_SBS_LR:
+            case OMX_SEC_COLOR_FormatNV12Tiled_SBS_RL:
+            case OMX_SEC_COLOR_FormatNV12Tiled_TB_LR:
+            case OMX_SEC_COLOR_FormatNV12Tiled_TB_RL:
+#endif
+                SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
+                SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + FrameBufferYSize, outputInfo.CVirAddr, FrameBufferUVSize);
+                pOutputData->dataLen = FrameBufferYSize + FrameBufferUVSize;
+                break;
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+#ifdef S3D_SUPPORT
+            case OMX_SEC_COLOR_FormatYUV420SemiPlanar_SBS_LR:
+            case OMX_SEC_COLOR_FormatYUV420SemiPlanar_SBS_RL:
+            case OMX_SEC_COLOR_FormatYUV420SemiPlanar_TB_LR:
+            case OMX_SEC_COLOR_FormatYUV420SemiPlanar_TB_RL:
+#endif
+            case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                break;
+            case OMX_COLOR_FormatYUV420Planar:
+#ifdef S3D_SUPPORT
+            case OMX_SEC_COLOR_FormatYUV420Planar_SBS_LR:
+            case OMX_SEC_COLOR_FormatYUV420Planar_SBS_RL:
+            case OMX_SEC_COLOR_FormatYUV420Planar_TB_LR:
+            case OMX_SEC_COLOR_FormatYUV420Planar_TB_RL:
+#endif
+            default:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                break;
+            }
+
+            csc_get_method(pVideoDec->csc_handle, &csc_method);
+#ifdef USE_CSC_FIMC
+            if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
+                SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
+                pSrcBuf[0] = outputInfo.YPhyAddr;
+                pSrcBuf[1] = outputInfo.CPhyAddr;
+            }
+#endif
+            if (pVideoDec->csc_set_format == OMX_FALSE) {
+                csc_set_src_format(
+                    pVideoDec->csc_handle,  /* handle */
+                    actualWidth,            /* width */
+                    actualHeight,           /* height */
+                    0,                      /* crop_left */
+                    0,                      /* crop_right */
+                    actualWidth,            /* crop_width */
+                    actualHeight,           /* crop_height */
+                    csc_src_color_format,   /* color_format */
+                    cacheable);             /* cacheable */
+                csc_set_dst_format(
+                    pVideoDec->csc_handle,  /* handle */
+                    actualWidth,            /* width */
+                    actualHeight,           /* height */
+                    0,                      /* crop_left */
+                    0,                      /* crop_right */
+                    actualWidth,            /* crop_width */
+                    actualHeight,           /* crop_height */
+                    csc_dst_color_format,   /* color_format */
+                    cacheable);             /* cacheable */
+                pVideoDec->csc_set_format = OMX_TRUE;
+            }
+            csc_set_src_buffer(
+                pVideoDec->csc_handle,  /* handle */
+                pSrcBuf[0],             /* y addr */
+                pSrcBuf[1],             /* u addr or uv addr */
+                pSrcBuf[2],             /* v addr or none */
+                0);                     /* ion fd */
+            csc_set_dst_buffer(
+                pVideoDec->csc_handle,  /* handle */
+                pYUVBuf[0],             /* y addr */
+                pYUVBuf[1],             /* u addr or uv addr */
+                pYUVBuf[2],             /* v addr or none */
+                0);                     /* ion fd */
+            csc_convert(pVideoDec->csc_handle);
+
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStop(PERF_ID_CSC);
+#endif
+        }
+#ifdef USE_ANB
+        if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+            SEC_OSAL_UnlockANB(pOutputData->dataBuffer);
+        }
+#endif
+    } else {
+        pOutputData->dataLen = 0;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT           *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT           *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_H264DEC_HANDLE         *pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    OMX_U32                     oneFrameSize = pInputData->dataLen;
+    SSBSIP_MFC_DEC_OUTPUT_INFO  outputInfo;
+    OMX_S32                     setConfVal = 0;
+    OMX_S32                     returnCodec = 0;
+    int                         bufWidth = 0;
+    int                         bufHeight = 0;
+    OMX_U32                     FrameBufferYSize;
+    OMX_U32                     FrameBufferUVSize;
+
+    FunctionIn();
+
+    if (pH264Dec->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) {
+        SSBSIP_MFC_CODEC_TYPE eCodecType = H264_DEC;
+
+        if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+
+        /* Default number in the driver is optimized */
+        if (pVideoDec->bThumbnailMode == OMX_TRUE) {
+            setConfVal = 0;
+            SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
+        } else {
+            setConfVal = H264_DEC_NUM_OF_EXTRA_BUFFERS;
+            SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &setConfVal);
+
+            setConfVal = 8;
+            SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
+        }
+
+        returnCodec = SsbSipMfcDecInit(pH264Dec->hMFCH264Handle.hMFCHandle, eCodecType, oneFrameSize);
+        if (returnCodec == MFC_RET_OK) {
+            SSBSIP_MFC_IMG_RESOLUTION imgResol;
+            SSBSIP_MFC_CROP_INFORMATION cropInfo;
+
+            SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "set width height information : %d, %d",
+                            pSECInputPort->portDefinition.format.video.nFrameWidth,
+                            pSECInputPort->portDefinition.format.video.nFrameHeight);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "mfc width height information : %d, %d",
+                            imgResol.width, imgResol.height);
+
+            SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_CROP_INFO, &cropInfo);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "mfc crop_top crop_bottom crop_left crop_right :  %d, %d, %d, %d",
+                            cropInfo.crop_top_offset , cropInfo.crop_bottom_offset ,
+                            cropInfo.crop_left_offset , cropInfo.crop_right_offset);
+
+            pSECOutputPort->cropRectangle.nTop    = cropInfo.crop_top_offset;
+            pSECOutputPort->cropRectangle.nLeft   = cropInfo.crop_left_offset;
+            pSECOutputPort->cropRectangle.nWidth  = imgResol.width - cropInfo.crop_left_offset - cropInfo.crop_right_offset;
+            pSECOutputPort->cropRectangle.nHeight = imgResol.height - cropInfo.crop_top_offset - cropInfo.crop_bottom_offset;
+
+            pH264Dec->hMFCH264Handle.bConfiguredMFC = OMX_TRUE;
+
+            /** Update Frame Size **/
+            if ((cropInfo.crop_left_offset != 0) || (cropInfo.crop_right_offset != 0) ||
+                (cropInfo.crop_top_offset != 0) || (cropInfo.crop_bottom_offset != 0)) {
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /** Send crop info call back **/
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, /* The command was completed */
+                       OMX_DirOutput, /* This is the port index */
+                       OMX_IndexConfigCommonOutputCrop,
+                       NULL);
+            }
+            if ((pSECInputPort->portDefinition.format.video.nFrameWidth != (unsigned int)imgResol.width) ||
+                (pSECInputPort->portDefinition.format.video.nFrameHeight != (unsigned int)imgResol.height)) {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "change width height information : OMX_EventPortSettingsChanged");
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /** Send Port Settings changed call back **/
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, /* The command was completed */
+                       OMX_DirOutput, /* This is the port index */
+                       0,
+                       NULL);
+            }
+
+#ifdef ADD_SPS_PPS_I_FRAME
+            ret = OMX_ErrorInputDataDecodeYet;
+#else
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+
+            ret = OMX_ErrorNone;
+#endif
+            goto EXIT;
+        } else {
+            ret = OMX_ErrorMFCInit;
+            goto EXIT;
+        }
+    }
+
+#ifndef FULL_FRAME_SEARCH
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+#endif
+
+    if (Check_H264_StartCode(pInputData->dataBuffer, pInputData->dataLen) == OMX_TRUE) {
+        pSECComponent->timeStamp[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+        pSECComponent->nFlags[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
+        SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pH264Dec->hMFCH264Handle.indexTimestamp));
+
+        returnCodec = SsbSipMfcDecExe(pH264Dec->hMFCH264Handle.hMFCHandle, oneFrameSize);
+    } else {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE)
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+        returnCodec = MFC_RET_OK;
+        goto EXIT;
+    }
+
+    if (returnCodec == MFC_RET_OK) {
+        SSBSIP_MFC_DEC_OUTBUF_STATUS status;
+        OMX_S32 indexTimestamp = 0;
+
+        status = SsbSipMfcDecGetOutBuf(pH264Dec->hMFCH264Handle.hMFCHandle, &outputInfo);
+        bufWidth =    (outputInfo.img_width + 15) & (~15);
+        bufHeight =  (outputInfo.img_height + 15) & (~15);
+        FrameBufferYSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height));
+        FrameBufferUVSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height/2));
+
+        if (status != MFC_GETOUTBUF_DISPLAY_ONLY) {
+            pH264Dec->hMFCH264Handle.indexTimestamp++;
+            pH264Dec->hMFCH264Handle.indexTimestamp %= MAX_TIMESTAMP;
+        }
+
+        if ((SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            /* For timestamp correction. if mfc support frametype detect */
+            SEC_OSAL_Log(SEC_LOG_TRACE, "disp_pic_frame_type: %d", outputInfo.disp_pic_frame_type);
+#ifdef NEED_TIMESTAMP_REORDER
+            if ((outputInfo.disp_pic_frame_type == MFC_FRAME_TYPE_I_FRAME) ||
+                (pH264Dec->hMFCH264Handle.bFlashPlayerMode != OMX_FALSE)) {
+                pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+                pH264Dec->hMFCH264Handle.outputIndexTimestamp = indexTimestamp;
+            } else {
+                pOutputData->timeStamp = pSECComponent->timeStamp[pH264Dec->hMFCH264Handle.outputIndexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[pH264Dec->hMFCH264Handle.outputIndexTimestamp];
+            }
+#else
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+#endif
+            SEC_OSAL_Log(SEC_LOG_TRACE, "timestamp %lld us (%.2f secs)", pOutputData->timeStamp, pOutputData->timeStamp / 1E6);
+        }
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
+            (status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
+            /** Fill Output Buffer **/
+            void *pOutputBuf = (void *)pOutputData->dataBuffer;
+            void *pSrcBuf[3] = {NULL, };
+            void *pYUVBuf[3] = {NULL, };
+            unsigned int csc_src_color_format, csc_dst_color_format;
+            CSC_METHOD csc_method = CSC_METHOD_SW;
+            unsigned int cacheable = 1;
+
+            int frameSize = bufWidth * bufHeight;
+            int actualWidth = outputInfo.img_width;
+            int actualHeight = outputInfo.img_height;
+            int actualImageSize = actualWidth * actualHeight;
+
+            pSrcBuf[0] = outputInfo.YVirAddr;
+            pSrcBuf[1] = outputInfo.CVirAddr;
+
+            pYUVBuf[0]  = (unsigned char *)pOutputBuf;
+            pYUVBuf[1]  = (unsigned char *)pOutputBuf + actualImageSize;
+            pYUVBuf[2]  = (unsigned char *)pOutputBuf + actualImageSize + actualImageSize / 4;
+            pOutputData->dataLen = (actualImageSize * 3) / 2;
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+                OMX_U32 stride;
+                SEC_OSAL_LockANB(pOutputData->dataBuffer, actualWidth, actualHeight, pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat, &stride, pYUVBuf);
+                actualWidth = stride;
+                pOutputData->dataLen = sizeof(void *);
+            }
+#endif
+            if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
+                (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
+                /* if use Post copy address structure */
+                SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+                pOutputData->dataLen = (actualWidth * actualHeight * 3) / 2;
+            } else {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420p out for ThumbnailMode/Flash player mode");
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStart(PERF_ID_CSC);
+#endif
+                switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+                case OMX_SEC_COLOR_FormatNV12Tiled:
+                    SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
+                    SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + FrameBufferYSize, outputInfo.CVirAddr, FrameBufferUVSize);
+                    pOutputData->dataLen = FrameBufferYSize + FrameBufferUVSize;
+                    break;
+                case OMX_COLOR_FormatYUV420SemiPlanar:
+                case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                    csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                    csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                    break;
+                case OMX_COLOR_FormatYUV420Planar:
+                default:
+                    csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                    csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                    break;
+                }
+
+                csc_get_method(pVideoDec->csc_handle, &csc_method);
+#ifdef USE_CSC_FIMC
+                if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
+                    SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
+                    pSrcBuf[0] = outputInfo.YPhyAddr;
+                    pSrcBuf[1] = outputInfo.CPhyAddr;
+                }
+#endif
+                if (pVideoDec->csc_set_format == OMX_FALSE) {
+                    csc_set_src_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        actualWidth,            /* width */
+                        actualHeight,           /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        actualWidth,            /* crop_width */
+                        actualHeight,           /* crop_height */
+                        csc_src_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    csc_set_dst_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        actualWidth,            /* width */
+                        actualHeight,           /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        actualWidth,            /* crop_width */
+                        actualHeight,           /* crop_height */
+                        csc_dst_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    pVideoDec->csc_set_format = OMX_TRUE;
+                }
+                csc_set_src_buffer(
+                    pVideoDec->csc_handle,  /* handle */
+                    pSrcBuf[0],             /* y addr */
+                    pSrcBuf[1],             /* u addr or uv addr */
+                    pSrcBuf[2],             /* v addr or none */
+                    0);                     /* ion fd */
+                csc_set_dst_buffer(
+                    pVideoDec->csc_handle,  /* handle */
+                    pYUVBuf[0],             /* y addr */
+                    pYUVBuf[1],             /* u addr or uv addr */
+                    pYUVBuf[2],             /* v addr or none */
+                    0);                     /* ion fd */
+                csc_convert(pVideoDec->csc_handle);
+
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStop(PERF_ID_CSC);
+#endif
+            }
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+                SEC_OSAL_UnlockANB(pOutputData->dataBuffer);
+            }
+#endif
+            pH264Dec->hMFCH264Handle.outputIndexTimestamp++;
+            pH264Dec->hMFCH264Handle.outputIndexTimestamp %= MAX_TIMESTAMP;
+        }
+        if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+            pOutputData->dataLen = 0;
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE))
+            ret = OMX_ErrorInputDataDecodeYet;
+
+        if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+            if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE))) {
+                pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else {
+                ret = OMX_ErrorNone;
+            }
+            goto EXIT;
+        }
+
+#ifdef FULL_FRAME_SEARCH
+        if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+            pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else
+#endif
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            ret = OMX_ErrorNone;
+        }
+    } else {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
+            (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+        }
+        pOutputData->dataLen = 0;
+
+        /* ret = OMX_ErrorUndefined; */
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264_Decode_DRM(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT           *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT           *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_H264DEC_HANDLE         *pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    OMX_U32                     oneFrameSize = pInputData->dataLen;
+    SSBSIP_MFC_DEC_OUTPUT_INFO  outputInfo;
+    OMX_S32                     setConfVal = 0;
+    OMX_S32                     returnCodec = 0;
+    int                         bufWidth = 0;
+    int                         bufHeight = 0;
+    OMX_U32                     FrameBufferYSize;
+    OMX_U32                     FrameBufferUVSize;
+    // DRM
+    OMX_PTR                     pInputPhysBuffer;
+    OMX_PTR                     pInputVirtBuffer;
+
+    FunctionIn();
+
+    if (pH264Dec->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) {
+        SSBSIP_MFC_CODEC_TYPE eCodecType = H264_DEC;
+
+        if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+
+        /* Set the number of extra buffer to prevent tearing */
+        /* DRM Play mode is returned only PhysicalAddress */
+        setConfVal = H264_DEC_NUM_OF_EXTRA_BUFFERS;
+        SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &setConfVal);
+
+        /* Default number in the driver is optimized */
+        if (pVideoDec->bThumbnailMode == OMX_TRUE) {
+            setConfVal = 0;
+            SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
+        } else {
+            setConfVal = 8;
+            SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
+        }
+
+        pInputPhysBuffer = pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer;
+        pInputVirtBuffer = NULL; /* ??????????? */
+
+        SEC_OSAL_Log(SEC_LOG_ERROR, "pInputPhysBuffer = 0x%x, allocSize = 0x%0x", pInputPhysBuffer, pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        SsbSipMfcDecSetInBuf(pH264Dec->hMFCH264Handle.hMFCHandle,
+                             pInputPhysBuffer, pInputVirtBuffer,
+                             pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        returnCodec = SsbSipMfcDecInit(pH264Dec->hMFCH264Handle.hMFCHandle, eCodecType, oneFrameSize);
+        if (returnCodec == MFC_RET_OK) {
+            SSBSIP_MFC_IMG_RESOLUTION imgResol;
+            SSBSIP_MFC_CROP_INFORMATION cropInfo;
+
+            SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "set width height information : %d, %d",
+                            pSECInputPort->portDefinition.format.video.nFrameWidth,
+                            pSECInputPort->portDefinition.format.video.nFrameHeight);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "mfc width height information : %d, %d",
+                            imgResol.width, imgResol.height);
+
+            SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_CROP_INFO, &cropInfo);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "mfc crop_top crop_bottom crop_left crop_right :  %d, %d, %d, %d",
+                            cropInfo.crop_top_offset , cropInfo.crop_bottom_offset ,
+                            cropInfo.crop_left_offset , cropInfo.crop_right_offset);
+
+            pSECOutputPort->cropRectangle.nTop    = cropInfo.crop_top_offset;
+            pSECOutputPort->cropRectangle.nLeft   = cropInfo.crop_left_offset;
+            pSECOutputPort->cropRectangle.nWidth  = imgResol.width - cropInfo.crop_left_offset - cropInfo.crop_right_offset;
+            pSECOutputPort->cropRectangle.nHeight = imgResol.height - cropInfo.crop_top_offset - cropInfo.crop_bottom_offset;
+
+            pH264Dec->hMFCH264Handle.bConfiguredMFC = OMX_TRUE;
+
+            /** Update Frame Size **/
+            if ((cropInfo.crop_left_offset != 0) || (cropInfo.crop_right_offset != 0) ||
+                (cropInfo.crop_top_offset != 0) || (cropInfo.crop_bottom_offset != 0)) {
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /** Send crop info call back **/
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, /* The command was completed */
+                       OMX_DirOutput, /* This is the port index */
+                       OMX_IndexConfigCommonOutputCrop,
+                       NULL);
+            }
+            if ((pSECInputPort->portDefinition.format.video.nFrameWidth != (unsigned int)imgResol.width) ||
+                (pSECInputPort->portDefinition.format.video.nFrameHeight != (unsigned int)imgResol.height)) {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "change width height information : OMX_EventPortSettingsChanged");
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /** Send Port Settings changed call back **/
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, /* The command was completed */
+                       OMX_DirOutput, /* This is the port index */
+                       0,
+                       NULL);
+            }
+
+#ifdef ADD_SPS_PPS_I_FRAME
+            ret = OMX_ErrorInputDataDecodeYet;
+#else
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+
+            ret = OMX_ErrorNone;
+#endif
+            goto EXIT;
+        } else {
+            ret = OMX_ErrorMFCInit;
+            goto EXIT;
+        }
+    }
+
+    if ((pInputData->dataBuffer != NULL) && (pInputData->dataLen != 0)) {
+        pSECComponent->timeStamp[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+        pSECComponent->nFlags[pH264Dec->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
+        SsbSipMfcDecSetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pH264Dec->hMFCH264Handle.indexTimestamp));
+        if (pVideoDec->bDRMPlayerMode == OMX_TRUE) {
+            pInputPhysBuffer = pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer;
+            pInputVirtBuffer = NULL; /* ??????????? */
+
+            SsbSipMfcDecSetInBuf(pH264Dec->hMFCH264Handle.hMFCHandle,
+                                 pInputPhysBuffer, pInputVirtBuffer,
+                                 pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+        }
+        returnCodec = SsbSipMfcDecExe(pH264Dec->hMFCH264Handle.hMFCHandle, oneFrameSize);
+    } else {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE)
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+        returnCodec = MFC_RET_OK;
+        goto EXIT;
+    }
+
+    if (returnCodec == MFC_RET_OK) {
+        SSBSIP_MFC_DEC_OUTBUF_STATUS status;
+        OMX_S32 indexTimestamp = 0;
+
+        status = SsbSipMfcDecGetOutBuf(pH264Dec->hMFCH264Handle.hMFCHandle, &outputInfo);
+        bufWidth =    (outputInfo.img_width + 15) & (~15);
+        bufHeight =  (outputInfo.img_height + 15) & (~15);
+        FrameBufferYSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height));
+        FrameBufferUVSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height/2));
+
+        if (status != MFC_GETOUTBUF_DISPLAY_ONLY) {
+            pH264Dec->hMFCH264Handle.indexTimestamp++;
+            pH264Dec->hMFCH264Handle.indexTimestamp %= MAX_TIMESTAMP;
+        }
+
+        if ((SsbSipMfcDecGetConfig(pH264Dec->hMFCH264Handle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            /* For timestamp correction. if mfc support frametype detect */
+            SEC_OSAL_Log(SEC_LOG_TRACE, "disp_pic_frame_type: %d", outputInfo.disp_pic_frame_type);
+#ifdef NEED_TIMESTAMP_REORDER
+            if ((outputInfo.disp_pic_frame_type == MFC_FRAME_TYPE_I_FRAME) ||
+                (pH264Dec->hMFCH264Handle.bFlashPlayerMode != OMX_FALSE)) {
+                pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+                pH264Dec->hMFCH264Handle.outputIndexTimestamp = indexTimestamp;
+            } else {
+                pOutputData->timeStamp = pSECComponent->timeStamp[pH264Dec->hMFCH264Handle.outputIndexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[pH264Dec->hMFCH264Handle.outputIndexTimestamp];
+            }
+#else
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+#endif
+            SEC_OSAL_Log(SEC_LOG_TRACE, "timestamp %lld us (%.2f secs)", pOutputData->timeStamp, pOutputData->timeStamp / 1E6);
+        }
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
+            (status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
+            /** Fill Output Buffer **/
+            void *pOutputBuf = (void *)pOutputData->dataBuffer;
+            void *pSrcBuf[3] = {NULL, };
+            void *pYUVBuf[3] = {NULL, };
+            unsigned int csc_src_color_format, csc_dst_color_format;
+            CSC_METHOD csc_method = CSC_METHOD_SW;
+            unsigned int cacheable = 1;
+
+            int frameSize = bufWidth * bufHeight;
+            int actualWidth = outputInfo.img_width;
+            int actualHeight = outputInfo.img_height;
+            int actualImageSize = actualWidth * actualHeight;
+
+            pSrcBuf[0] = outputInfo.YVirAddr;
+            pSrcBuf[1] = outputInfo.CVirAddr;
+
+            pYUVBuf[0]  = (unsigned char *)pOutputBuf;
+            pYUVBuf[1]  = (unsigned char *)pOutputBuf + actualImageSize;
+            pYUVBuf[2]  = (unsigned char *)pOutputBuf + actualImageSize + actualImageSize / 4;
+            pOutputData->dataLen = (actualImageSize * 3) / 2;
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+                OMX_U32 stride;
+                SEC_OSAL_LockANB(pOutputData->dataBuffer, actualWidth, actualHeight, pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat, &stride, pYUVBuf);
+                actualWidth = stride;
+                pOutputData->dataLen = sizeof(void *);
+            }
+#endif
+            if (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) {
+                /* if use Post copy address structure */
+                SEC_OSAL_Log(SEC_LOG_TRACE, "DRM] physical address data mode");
+                SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+                pOutputData->dataLen = (actualWidth * actualHeight * 3) / 2;
+            } else {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "DRM] Real data method");
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStart(PERF_ID_CSC);
+#endif
+                switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+                case OMX_SEC_COLOR_FormatNV12Tiled:
+                    SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
+                    SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + FrameBufferYSize, outputInfo.CVirAddr, FrameBufferUVSize);
+                    pOutputData->dataLen = FrameBufferYSize + FrameBufferUVSize;
+                    break;
+                case OMX_COLOR_FormatYUV420SemiPlanar:
+                case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                    csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                    csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                    break;
+                case OMX_COLOR_FormatYUV420Planar:
+                default:
+                    csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                    csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                    break;
+                }
+
+                csc_get_method(pVideoDec->csc_handle, &csc_method);
+#ifdef USE_CSC_FIMC
+                if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
+                    SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
+                    pSrcBuf[0] = outputInfo.YPhyAddr;
+                    pSrcBuf[1] = outputInfo.CPhyAddr;
+                }
+#endif
+                if (pVideoDec->csc_set_format == OMX_FALSE) {
+                    csc_set_src_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        actualWidth,            /* width */
+                        actualHeight,           /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        actualWidth,            /* crop_width */
+                        actualHeight,           /* crop_height */
+                        csc_src_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    csc_set_dst_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        actualWidth,            /* width */
+                        actualHeight,           /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        actualWidth,            /* crop_width */
+                        actualHeight,           /* crop_height */
+                        csc_dst_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    pVideoDec->csc_set_format = OMX_TRUE;
+                }
+                csc_set_src_buffer(
+                    pVideoDec->csc_handle,  /* handle */
+                    pSrcBuf[0],             /* y addr */
+                    pSrcBuf[1],             /* u addr or uv addr */
+                    pSrcBuf[2],             /* v addr or none */
+                    0);                     /* ion fd */
+                csc_set_dst_buffer(
+                    pVideoDec->csc_handle,  /* handle */
+                    pYUVBuf[0],             /* y addr */
+                    pYUVBuf[1],             /* u addr or uv addr */
+                    pYUVBuf[2],             /* v addr or none */
+                    0);                     /* ion fd */
+               csc_convert(pVideoDec->csc_handle);
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStop(PERF_ID_CSC);
+#endif
+            }
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE)
+                SEC_OSAL_UnlockANB(pOutputData->dataBuffer);
+#endif
+            pH264Dec->hMFCH264Handle.outputIndexTimestamp++;
+            pH264Dec->hMFCH264Handle.outputIndexTimestamp %= MAX_TIMESTAMP;
+        }
+        if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+            pOutputData->dataLen = 0;
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE))
+            ret = OMX_ErrorInputDataDecodeYet;
+
+        if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+            if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE))) {
+                pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else {
+                ret = OMX_ErrorNone;
+            }
+            goto EXIT;
+        }
+
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            ret = OMX_ErrorNone;
+        }
+    } else {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
+            (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+        }
+        pOutputData->dataLen = 0;
+
+        /* ret = OMX_ErrorUndefined; */
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Decode */
+OMX_ERRORTYPE SEC_MFC_H264Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_H264DEC_HANDLE      *pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    SEC_OMX_BASEPORT        *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT        *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    OMX_BOOL                 endOfFrame = OMX_FALSE;
+
+    FunctionIn();
+
+    if ((!CHECK_PORT_ENABLED(pSECInputPort)) || (!CHECK_PORT_ENABLED(pSECOutputPort)) ||
+        (!CHECK_PORT_POPULATED(pSECInputPort)) || (!CHECK_PORT_POPULATED(pSECOutputPort))) {
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+    if (OMX_FALSE == SEC_Check_BufferProcess_State(pSECComponent)) {
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+    if (pVideoDec->bDRMPlayerMode == OMX_FALSE) {
+#ifdef NONBLOCK_MODE_PROCESS
+        ret = SEC_MFC_H264_Decode_Nonblock(pOMXComponent, pInputData, pOutputData);
+#else
+        ret = SEC_MFC_H264_Decode_Block(pOMXComponent, pInputData, pOutputData);
+#endif
+    } else {
+        ret = SEC_MFC_H264_Decode_DRM(pOMXComponent, pInputData, pOutputData);
+    }
+
+    if (ret != OMX_ErrorNone) {
+        if (ret == OMX_ErrorInputDataDecodeYet) {
+            pOutputData->usedDataLen = 0;
+            pOutputData->remainDataLen = pOutputData->dataLen;
+        } else {
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+                                                    pSECComponent->callbackData,
+                                                    OMX_EventError, ret, 0, NULL);
+        }
+    } else {
+        pInputData->previousDataLen = pInputData->dataLen;
+        pInputData->usedDataLen += pInputData->dataLen;
+        pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
+        pInputData->dataLen -= pInputData->usedDataLen;
+        pInputData->usedDataLen = 0;
+
+        pOutputData->usedDataLen = 0;
+        pOutputData->remainDataLen = pOutputData->dataLen;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_OMX_BASEPORT        *pSECPort = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+    SEC_H264DEC_HANDLE      *pH264Dec = NULL;
+    OMX_BOOL                 bDRMPlayerMode = OMX_FALSE;
+    OMX_BOOL                 bFlashPlayerMode = OMX_FALSE;
+    int i = 0;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (componentName == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H264_DEC, componentName) == 0) {
+        bDRMPlayerMode = OMX_FALSE;
+        bFlashPlayerMode = OMX_FALSE;
+    } else if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H264_DRM_DEC, componentName) == 0) {
+        bDRMPlayerMode = OMX_TRUE;
+        bFlashPlayerMode = OMX_FALSE;
+    } else if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H264_FP_DEC, componentName) == 0) {
+        bDRMPlayerMode = OMX_FALSE;
+        bFlashPlayerMode = OMX_TRUE;
+    } else {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, componentName:%s, Line:%d", componentName, __LINE__);
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_VideoDecodeComponentInit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECComponent->codecType = HW_VIDEO_DEC_CODEC;
+
+    pSECComponent->componentName = (OMX_STRING)SEC_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
+    if (pSECComponent->componentName == NULL) {
+        SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
+
+    pH264Dec = SEC_OSAL_Malloc(sizeof(SEC_H264DEC_HANDLE));
+    if (pH264Dec == NULL) {
+        SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pH264Dec, 0, sizeof(SEC_H264DEC_HANDLE));
+    pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    pVideoDec->hCodecHandle = (OMX_HANDLETYPE)pH264Dec;
+
+    if (bDRMPlayerMode == OMX_TRUE)
+        SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H264_DRM_DEC);
+    else if (bFlashPlayerMode == OMX_TRUE)
+        SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H264_FP_DEC);
+    else
+        SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H264_DEC);
+
+    pVideoDec->bDRMPlayerMode = bDRMPlayerMode;
+    pH264Dec->hMFCH264Handle.bFlashPlayerMode = bFlashPlayerMode;
+#ifdef S3D_SUPPORT
+    pH264Dec->hMFCH264Handle.bS3DMode = OMX_FALSE;
+#endif
+
+    /* Set componentVersion */
+    pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->componentVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->componentVersion.s.nStep         = STEP_NUMBER;
+    /* Set specVersion */
+    pSECComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->specVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->specVersion.s.nStep         = STEP_NUMBER;
+
+    /* Android CapabilityFlags */
+    pSECComponent->capabilityFlags.iIsOMXComponentMultiThreaded                   = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalInputBufferAlloc  = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalOutputBufferAlloc = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsMovableInputBuffers       = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsPartialFrames             = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesNALStartCodes                 = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentCanHandleIncompleteFrames         = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesFullAVCFrames                 = OMX_TRUE;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_INPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "video/avc");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+    if (bFlashPlayerMode != OMX_FALSE) {
+        pSECPort->portDefinition.nBufferCountActual = MAX_H264_FP_VIDEO_INPUTBUFFER_NUM;
+        pSECPort->portDefinition.nBufferCountMin = MAX_H264_FP_VIDEO_INPUTBUFFER_NUM;
+    }
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+    if (bFlashPlayerMode != OMX_FALSE) {
+        pSECPort->portDefinition.nBufferCountActual = MAX_H264_FP_VIDEO_OUTPUTBUFFER_NUM;
+        pSECPort->portDefinition.nBufferCountMin = MAX_H264_FP_VIDEO_OUTPUTBUFFER_NUM;
+    }
+
+    for(i = 0; i < ALL_PORT_NUM; i++) {
+        INIT_SET_SIZE_VERSION(&pH264Dec->AVCComponent[i], OMX_VIDEO_PARAM_AVCTYPE);
+        pH264Dec->AVCComponent[i].nPortIndex = i;
+        pH264Dec->AVCComponent[i].eProfile   = OMX_VIDEO_AVCProfileBaseline;
+        pH264Dec->AVCComponent[i].eLevel     = OMX_VIDEO_AVCLevel4;
+    }
+
+    pOMXComponent->GetParameter      = &SEC_MFC_H264Dec_GetParameter;
+    pOMXComponent->SetParameter      = &SEC_MFC_H264Dec_SetParameter;
+    pOMXComponent->GetConfig         = &SEC_MFC_H264Dec_GetConfig;
+    pOMXComponent->SetConfig         = &SEC_MFC_H264Dec_SetConfig;
+    pOMXComponent->GetExtensionIndex = &SEC_MFC_H264Dec_GetExtensionIndex;
+    pOMXComponent->ComponentRoleEnum = &SEC_MFC_H264Dec_ComponentRoleEnum;
+    pOMXComponent->ComponentDeInit   = &SEC_OMX_ComponentDeinit;
+
+    pSECComponent->sec_mfc_componentInit      = &SEC_MFC_H264Dec_Init;
+    pSECComponent->sec_mfc_componentTerminate = &SEC_MFC_H264Dec_Terminate;
+    pSECComponent->sec_mfc_bufferProcess      = &SEC_MFC_H264Dec_bufferProcess;
+    pSECComponent->sec_checkInputFrame        = &Check_H264_Frame;
+
+    pSECComponent->sec_allocSecureInputBuffer = &SEC_MFC_H264Dec_Alloc_SecureInputBuffer;
+    pSECComponent->sec_freeSecureInputBuffer  = &SEC_MFC_H264Dec_Free_SecureInputBuffer;
+
+    if (bDRMPlayerMode == OMX_TRUE) {
+        OMX_PTR hMFCHandle = NULL;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "DRM--SsbSipMfcDecOpen, Line:%d", __LINE__);
+        hMFCHandle = (OMX_PTR)SsbSipMfcDecOpen();
+        if (hMFCHandle == NULL) {
+            ret = OMX_ErrorInsufficientResources;
+            goto EXIT;
+        }
+        pH264Dec->hMFCH264Handle.hMFCHandle = hMFCHandle;
+    }
+
+    pSECComponent->currentState = OMX_StateLoaded;
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+    SEC_H264DEC_HANDLE      *pH264Dec = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+
+    SEC_OSAL_Free(pSECComponent->componentName);
+    pSECComponent->componentName = NULL;
+
+    pH264Dec = (SEC_H264DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    if (pH264Dec != NULL) {
+        OMX_PTR hMFCHandle = NULL;
+        hMFCHandle = pH264Dec->hMFCH264Handle.hMFCHandle;
+        if ((hMFCHandle != NULL) && (pVideoDec->bDRMPlayerMode == OMX_TRUE)) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "DRM--SsbSipMfcDecClose, Line:%d", __LINE__);
+            SsbSipMfcDecClose(hMFCHandle);
+            hMFCHandle = pH264Dec->hMFCH264Handle.hMFCHandle = NULL;
+        }
+        SEC_OSAL_Free(pH264Dec);
+        pH264Dec = ((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle = NULL;
+    }
+
+    ret = SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/SEC_OMX_H264dec.h b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/SEC_OMX_H264dec.h
new file mode 100644
index 0000000..370a15f
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/SEC_OMX_H264dec.h
@@ -0,0 +1,74 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    SEC_OMX_H264dec.h
+ * @brief
+ * @author    SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_H264_DEC_COMPONENT
+#define SEC_OMX_H264_DEC_COMPONENT
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "OMX_Video.h"
+
+
+#define MAX_H264_FP_VIDEO_INPUTBUFFER_NUM  4
+#define MAX_H264_FP_VIDEO_OUTPUTBUFFER_NUM 4
+
+typedef struct _SEC_MFC_H264DEC_HANDLE
+{
+    OMX_HANDLETYPE hMFCHandle;
+    OMX_PTR  pMFCStreamBuffer;
+    OMX_PTR  pMFCStreamPhyBuffer;
+    OMX_U32  indexTimestamp;
+    OMX_U32  outputIndexTimestamp;
+    OMX_BOOL bConfiguredMFC;
+    OMX_BOOL bFlashPlayerMode;
+#ifdef S3D_SUPPORT
+    OMX_BOOL bS3DMode;
+#endif
+    OMX_S32  returnCodec;
+} SEC_MFC_H264DEC_HANDLE;
+
+typedef struct _SEC_H264DEC_HANDLE
+{
+    /* OMX Codec specific */
+    OMX_VIDEO_PARAM_AVCTYPE AVCComponent[ALL_PORT_NUM];
+    OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
+
+    /* SEC MFC Codec specific */
+    SEC_MFC_H264DEC_HANDLE hMFCH264Handle;
+} SEC_H264DEC_HANDLE;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/library_register.c b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/library_register.c
new file mode 100644
index 0000000..aa63c6c
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/library_register.c
@@ -0,0 +1,65 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    library_register.c
+ * @brief
+ * @author    SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+#include "library_register.h"
+#include "SEC_OSAL_Log.h"
+
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **secComponents)
+{
+    FunctionIn();
+
+    if (secComponents == NULL)
+        goto EXIT;
+
+    /* component 1 - video decoder H.264 */
+    SEC_OSAL_Strcpy(secComponents[0]->componentName, SEC_OMX_COMPONENT_H264_DEC);
+    SEC_OSAL_Strcpy(secComponents[0]->roles[0], SEC_OMX_COMPONENT_H264_DEC_ROLE);
+    secComponents[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+    /* component 2 - video decoder H.264 for flash player */
+    SEC_OSAL_Strcpy(secComponents[1]->componentName, SEC_OMX_COMPONENT_H264_FP_DEC);
+    SEC_OSAL_Strcpy(secComponents[1]->roles[0], SEC_OMX_COMPONENT_H264_DEC_ROLE);
+    secComponents[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+    /* component 3 - video decoder H.264 for DRM */
+    SEC_OSAL_Strcpy(secComponents[2]->componentName, SEC_OMX_COMPONENT_H264_DRM_DEC);
+    SEC_OSAL_Strcpy(secComponents[2]->roles[0], SEC_OMX_COMPONENT_H264_DEC_ROLE);
+    secComponents[2]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+EXIT:
+    FunctionOut();
+
+    return MAX_COMPONENT_NUM;
+}
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/library_register.h b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/library_register.h
new file mode 100644
index 0000000..8c03cbe
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/h264/library_register.h
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_H264_REG
+#define SEC_OMX_H264_REG
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "SEC_OMX_Component_Register.h"
+
+
+#define OSCL_EXPORT_REF __attribute__((visibility("default")))
+#define MAX_COMPONENT_NUM       3
+#define MAX_COMPONENT_ROLE_NUM  1
+
+/* H.264 */
+#define SEC_OMX_COMPONENT_H264_DEC "OMX.SEC.AVC.Decoder"
+#define SEC_OMX_COMPONENT_H264_FP_DEC "OMX.SEC.FP.AVC.Decoder"
+#define SEC_OMX_COMPONENT_H264_DRM_DEC "OMX.SEC.AVC.Decoder.secure"
+#define SEC_OMX_COMPONENT_H264_DEC_ROLE "video_decoder.avc"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **secComponents);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/Android.mk
new file mode 100644
index 0000000..d353180
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/Android.mk
@@ -0,0 +1,65 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Mpeg4dec.c \
+	library_register.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libOMX.SEC.M4V.Decoder
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx
+
+LOCAL_CFLAGS :=
+
+ifeq ($(BOARD_NONBLOCK_MODE_PROCESS), true)
+LOCAL_CFLAGS += -DNONBLOCK_MODE_PROCESS
+endif
+
+ifeq ($(BOARD_USE_ANB), true)
+LOCAL_CFLAGS += -DUSE_ANB
+ifeq ($(BOARD_USE_CSC_FIMC), true)
+ifeq ($(BOARD_USE_V4L2_ION), false)
+LOCAL_CFLAGS += -DUSE_CSC_FIMC
+endif
+endif
+
+ifeq ($(BOARD_USE_CSC_GSCALER), true)
+LOCAL_CFLAGS += -DUSE_CSC_GSCALER
+endif
+endif
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \
+	libswconverter libsecmfcapi
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
+	libSEC_OMX_Resourcemanager libcsc
+
+ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
+LOCAL_SHARED_LIBRARIES += libfimc libhwconverter
+endif
+
+ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
+LOCAL_SHARED_LIBRARIES += libexynosgscaler
+endif
+
+#ifeq ($(BOARD_USE_V4L2_ION),true)
+#LOCAL_SHARED_LIBRARIES += libion
+#endif
+
+ifeq ($(BOARD_USES_MFC_FPS),true)
+LOCAL_CFLAGS += -DCONFIG_MFC_FPS
+endif
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/video/dec \
+	$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO) \
+	$(BOARD_HAL_PATH)/include
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/SEC_OMX_Mpeg4dec.c b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/SEC_OMX_Mpeg4dec.c
new file mode 100644
index 0000000..e820503
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/SEC_OMX_Mpeg4dec.c
@@ -0,0 +1,2103 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file      SEC_OMX_Mpeg4dec.c
+ * @brief
+ * @author    Yunji Kim (yunji.kim@samsung.com)
+ * @version   1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Macros.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Vdec.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Thread.h"
+#include "library_register.h"
+#include "SEC_OMX_Mpeg4dec.h"
+#include "SsbSipMfcApi.h"
+
+#ifdef USE_ANB
+#include "SEC_OSAL_Android.h"
+#endif
+
+/* To use CSC_METHOD_PREFER_HW or CSC_METHOD_HW in SEC OMX, gralloc should allocate physical memory using FIMC */
+/* It means GRALLOC_USAGE_HW_FIMC1 should be set on Native Window usage */
+#include "csc.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_MPEG4_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+#define MPEG4_DEC_NUM_OF_EXTRA_BUFFERS 7
+
+//#define FULL_FRAME_SEARCH
+
+/* MPEG4 Decoder Supported Levels & profiles */
+SEC_OMX_VIDEO_PROFILELEVEL supportedMPEG4ProfileLevels[] ={
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level0},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level0b},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level1},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level2},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level3},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level4},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level4a},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level5},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level0},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level0b},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level1},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level2},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level3},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level4},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level4a},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level5}};
+
+/* H.263 Decoder Supported Levels & profiles */
+SEC_OMX_VIDEO_PROFILELEVEL supportedH263ProfileLevels[] = {
+    /* Baseline (Profile 0) */
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level10},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level20},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level30},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level40},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level45},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level50},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level60},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level70},
+    /* Profile 1 */
+    {OMX_VIDEO_H263ProfileH320Coding, OMX_VIDEO_H263Level10},
+    {OMX_VIDEO_H263ProfileH320Coding, OMX_VIDEO_H263Level20},
+    {OMX_VIDEO_H263ProfileH320Coding, OMX_VIDEO_H263Level30},
+    {OMX_VIDEO_H263ProfileH320Coding, OMX_VIDEO_H263Level40},
+    {OMX_VIDEO_H263ProfileH320Coding, OMX_VIDEO_H263Level45},
+    {OMX_VIDEO_H263ProfileH320Coding, OMX_VIDEO_H263Level50},
+    {OMX_VIDEO_H263ProfileH320Coding, OMX_VIDEO_H263Level60},
+    {OMX_VIDEO_H263ProfileH320Coding, OMX_VIDEO_H263Level70},
+    /* Profile 2 */
+    {OMX_VIDEO_H263ProfileBackwardCompatible, OMX_VIDEO_H263Level10},
+    {OMX_VIDEO_H263ProfileBackwardCompatible, OMX_VIDEO_H263Level20},
+    {OMX_VIDEO_H263ProfileBackwardCompatible, OMX_VIDEO_H263Level30},
+    {OMX_VIDEO_H263ProfileBackwardCompatible, OMX_VIDEO_H263Level40},
+    {OMX_VIDEO_H263ProfileBackwardCompatible, OMX_VIDEO_H263Level45},
+    {OMX_VIDEO_H263ProfileBackwardCompatible, OMX_VIDEO_H263Level50},
+    {OMX_VIDEO_H263ProfileBackwardCompatible, OMX_VIDEO_H263Level60},
+    {OMX_VIDEO_H263ProfileBackwardCompatible, OMX_VIDEO_H263Level70},
+    /* Profile 3, restricted up to SD resolution */
+    {OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level10},
+    {OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level20},
+    {OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level30},
+    {OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level40},
+    {OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level45},
+    {OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level50},
+    {OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level60},
+    {OMX_VIDEO_H263ProfileISWV2, OMX_VIDEO_H263Level70}};
+
+static OMX_HANDLETYPE ghMFCHandle = NULL;
+static OMX_BOOL gbFIMV1 = OMX_FALSE;
+
+static int Check_Mpeg4_Frame(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame)
+{
+    OMX_U32 len;
+    int readStream;
+    unsigned startCode;
+    OMX_BOOL bFrameStart;
+
+    len = 0;
+    bFrameStart = OMX_FALSE;
+
+    if (flag & OMX_BUFFERFLAG_CODECCONFIG) {
+        if (*pInputStream == 0x03) { /* FIMV1 */
+            if (ghMFCHandle != NULL) {
+                BitmapInfoHhr *pInfoHeader;
+                SSBSIP_MFC_IMG_RESOLUTION imgResolution;
+
+                pInfoHeader = (BitmapInfoHhr *)(pInputStream + 1);
+                imgResolution.width = pInfoHeader->BiWidth;
+                imgResolution.height = pInfoHeader->BiHeight;
+                SsbSipMfcDecSetConfig(ghMFCHandle, MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT, &imgResolution);
+
+                SEC_OSAL_Log(SEC_LOG_TRACE, "width(%d), height(%d)", imgResolution.width, imgResolution.height);
+                gbFIMV1 = OMX_TRUE;
+                *pbEndOfFrame = OMX_TRUE;
+                return buffSize;
+            }
+        }
+    }
+
+    if (gbFIMV1) {
+        *pbEndOfFrame = OMX_TRUE;
+        return buffSize;
+    }
+
+    if (bPreviousFrameEOF == OMX_FALSE)
+        bFrameStart = OMX_TRUE;
+
+    startCode = 0xFFFFFFFF;
+    if (bFrameStart == OMX_FALSE) {
+        /* find VOP start code */
+        while(startCode != 0x1B6) {
+            readStream = *(pInputStream + len);
+            startCode = (startCode << 8) | readStream;
+            len++;
+            if (len > buffSize)
+                goto EXIT;
+        }
+    }
+
+    /* find next VOP start code */
+    startCode = 0xFFFFFFFF;
+    while ((startCode != 0x1B6)) {
+        readStream = *(pInputStream + len);
+        startCode = (startCode << 8) | readStream;
+        len++;
+        if (len > buffSize)
+            goto EXIT;
+    }
+
+    *pbEndOfFrame = OMX_TRUE;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "1. Check_Mpeg4_Frame returned EOF = %d, len = %d, buffSize = %d", *pbEndOfFrame, len - 4, buffSize);
+
+    return len - 4;
+
+EXIT :
+    *pbEndOfFrame = OMX_FALSE;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "2. Check_Mpeg4_Frame returned EOF = %d, len = %d, buffSize = %d", *pbEndOfFrame, len - 1, buffSize);
+
+    return --len;
+}
+
+static int Check_H263_Frame(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame)
+{
+    OMX_U32 len;
+    int readStream;
+    unsigned startCode;
+    OMX_BOOL bFrameStart = 0;
+    unsigned pTypeMask = 0x03;
+    unsigned pType = 0;
+
+    len = 0;
+    bFrameStart = OMX_FALSE;
+
+    if (bPreviousFrameEOF == OMX_FALSE)
+        bFrameStart = OMX_TRUE;
+
+    startCode = 0xFFFFFFFF;
+    if (bFrameStart == OMX_FALSE) {
+        /* find PSC(Picture Start Code) : 0000 0000 0000 0000 1000 00 */
+        while (((startCode << 8 >> 10) != 0x20) || (pType != 0x02)) {
+            readStream = *(pInputStream + len);
+            startCode = (startCode << 8) | readStream;
+
+            readStream = *(pInputStream + len + 1);
+            pType = readStream & pTypeMask;
+
+            len++;
+            if (len > buffSize)
+                goto EXIT;
+        }
+    }
+
+    /* find next PSC */
+    startCode = 0xFFFFFFFF;
+    pType = 0;
+    while (((startCode << 8 >> 10) != 0x20) || (pType != 0x02)) {
+        readStream = *(pInputStream + len);
+        startCode = (startCode << 8) | readStream;
+
+        readStream = *(pInputStream + len + 1);
+        pType = readStream & pTypeMask;
+
+        len++;
+        if (len > buffSize)
+            goto EXIT;
+    }
+
+    *pbEndOfFrame = OMX_TRUE;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "1. Check_H263_Frame returned EOF = %d, len = %d, iBuffSize = %d", *pbEndOfFrame, len - 3, buffSize);
+
+    return len - 3;
+
+EXIT :
+
+    *pbEndOfFrame = OMX_FALSE;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "2. Check_H263_Frame returned EOF = %d, len = %d, iBuffSize = %d", *pbEndOfFrame, len - 1, buffSize);
+
+    return --len;
+}
+
+OMX_BOOL Check_Stream_PrefixCode(OMX_U8 *pInputStream, OMX_U32 streamSize, CODEC_TYPE codecType)
+{
+    switch (codecType) {
+    case CODEC_TYPE_MPEG4:
+        if (gbFIMV1) {
+            return OMX_TRUE;
+        } else {
+            if (streamSize < 3) {
+                return OMX_FALSE;
+            } else if ((pInputStream[0] == 0x00) &&
+                       (pInputStream[1] == 0x00) &&
+                       (pInputStream[2] == 0x01)) {
+                return OMX_TRUE;
+            } else {
+                return OMX_FALSE;
+            }
+        }
+        break;
+    case CODEC_TYPE_H263:
+        if (streamSize > 0)
+            return OMX_TRUE;
+        else
+            return OMX_FALSE;
+    default:
+        SEC_OSAL_Log(SEC_LOG_WARNING, "%s: undefined codec type (%d)", __FUNCTION__, codecType);
+        return OMX_FALSE;
+    }
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_GetParameter(
+    OMX_IN    OMX_HANDLETYPE hComponent,
+    OMX_IN    OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamVideoMpeg4:
+    {
+        OMX_VIDEO_PARAM_MPEG4TYPE *pDstMpeg4Param = (OMX_VIDEO_PARAM_MPEG4TYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_MPEG4TYPE *pSrcMpeg4Param = NULL;
+        SEC_MPEG4_HANDLE          *pMpeg4Dec = NULL;
+        ret = SEC_OMX_Check_SizeVersion(pDstMpeg4Param, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstMpeg4Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcMpeg4Param = &pMpeg4Dec->mpeg4Component[pDstMpeg4Param->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstMpeg4Param, pSrcMpeg4Param, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE));
+    }
+        break;
+    case OMX_IndexParamVideoH263:
+    {
+        OMX_VIDEO_PARAM_H263TYPE  *pDstH263Param = (OMX_VIDEO_PARAM_H263TYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_H263TYPE  *pSrcH263Param = NULL;
+        SEC_MPEG4_HANDLE          *pMpeg4Dec = NULL;
+        ret = SEC_OMX_Check_SizeVersion(pDstH263Param, sizeof(OMX_VIDEO_PARAM_H263TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstH263Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcH263Param = &pMpeg4Dec->h263Component[pDstH263Param->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstH263Param, pSrcH263Param, sizeof(OMX_VIDEO_PARAM_H263TYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_S32 codecType;
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        codecType = ((SEC_MPEG4_HANDLE *)(((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType;
+        if (codecType == CODEC_TYPE_MPEG4)
+            SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_MPEG4_DEC_ROLE);
+        else
+            SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_H263_DEC_ROLE);
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelQuerySupported:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pDstProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pComponentParameterStructure;
+        SEC_OMX_VIDEO_PROFILELEVEL       *pProfileLevel = NULL;
+        OMX_U32                           maxProfileLevelNum = 0;
+        OMX_S32                           codecType;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        codecType = ((SEC_MPEG4_HANDLE *)(((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType;
+        if (codecType == CODEC_TYPE_MPEG4) {
+            pProfileLevel = supportedMPEG4ProfileLevels;
+            maxProfileLevelNum = sizeof(supportedMPEG4ProfileLevels) / sizeof(SEC_OMX_VIDEO_PROFILELEVEL);
+        } else {
+            pProfileLevel = supportedH263ProfileLevels;
+            maxProfileLevelNum = sizeof(supportedH263ProfileLevels) / sizeof(SEC_OMX_VIDEO_PROFILELEVEL);
+        }
+
+        if (pDstProfileLevel->nProfileIndex >= maxProfileLevelNum) {
+            ret = OMX_ErrorNoMore;
+            goto EXIT;
+        }
+
+        pProfileLevel += pDstProfileLevel->nProfileIndex;
+        pDstProfileLevel->eProfile = pProfileLevel->profile;
+        pDstProfileLevel->eLevel = pProfileLevel->level;
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelCurrent:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pDstProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_MPEG4TYPE        *pSrcMpeg4Param = NULL;
+        OMX_VIDEO_PARAM_H263TYPE         *pSrcH263Param = NULL;
+        SEC_MPEG4_HANDLE                 *pMpeg4Dec = NULL;
+        OMX_S32                           codecType;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        codecType = pMpeg4Dec->hMFCMpeg4Handle.codecType;
+        if (codecType == CODEC_TYPE_MPEG4) {
+            pSrcMpeg4Param = &pMpeg4Dec->mpeg4Component[pDstProfileLevel->nPortIndex];
+            pDstProfileLevel->eProfile = pSrcMpeg4Param->eProfile;
+            pDstProfileLevel->eLevel = pSrcMpeg4Param->eLevel;
+        } else {
+            pSrcH263Param = &pMpeg4Dec->h263Component[pDstProfileLevel->nPortIndex];
+            pDstProfileLevel->eProfile = pSrcH263Param->eProfile;
+            pDstProfileLevel->eLevel = pSrcH263Param->eLevel;
+        }
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = NULL;
+        SEC_MPEG4_HANDLE                    *pMpeg4Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstErrorCorrectionType->nPortIndex != INPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcErrorCorrectionType = &pMpeg4Dec->errorCorrectionType[INPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_SetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamVideoMpeg4:
+    {
+        OMX_VIDEO_PARAM_MPEG4TYPE *pDstMpeg4Param = NULL;
+        OMX_VIDEO_PARAM_MPEG4TYPE *pSrcMpeg4Param = (OMX_VIDEO_PARAM_MPEG4TYPE *)pComponentParameterStructure;
+        SEC_MPEG4_HANDLE          *pMpeg4Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcMpeg4Param, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcMpeg4Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstMpeg4Param = &pMpeg4Dec->mpeg4Component[pSrcMpeg4Param->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstMpeg4Param, pSrcMpeg4Param, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE));
+    }
+        break;
+    case OMX_IndexParamVideoH263:
+    {
+        OMX_VIDEO_PARAM_H263TYPE *pDstH263Param = NULL;
+        OMX_VIDEO_PARAM_H263TYPE *pSrcH263Param = (OMX_VIDEO_PARAM_H263TYPE *)pComponentParameterStructure;
+        SEC_MPEG4_HANDLE         *pMpeg4Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcH263Param, sizeof(OMX_VIDEO_PARAM_H263TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcH263Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstH263Param = &pMpeg4Dec->h263Component[pSrcH263Param->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstH263Param, pSrcH263Param, sizeof(OMX_VIDEO_PARAM_H263TYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+
+        if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_MPEG4_DEC_ROLE)) {
+            pSECComponent->pSECPort[INPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
+            //((SEC_MPEG4_HANDLE *)(((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType = CODEC_TYPE_MPEG4;
+        } else if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_H263_DEC_ROLE)) {
+            pSECComponent->pSECPort[INPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingH263;
+            //((SEC_MPEG4_HANDLE *)(((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType = CODEC_TYPE_H263;
+        } else {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+    }
+        break;
+    case OMX_IndexParamPortDefinition:
+    {
+        OMX_PARAM_PORTDEFINITIONTYPE *pPortDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)pComponentParameterStructure;
+        OMX_U32                       portIndex = pPortDefinition->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort;
+        OMX_U32 width, height, size;
+        OMX_U32 realWidth, realHeight;
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+        ret = SEC_OMX_Check_SizeVersion(pPortDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            if (pSECPort->portDefinition.bEnabled == OMX_TRUE) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+        }
+        if (pPortDefinition->nBufferCountActual < pSECPort->portDefinition.nBufferCountMin) {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+
+        SEC_OSAL_Memcpy(&pSECPort->portDefinition, pPortDefinition, pPortDefinition->nSize);
+
+        realWidth = pSECPort->portDefinition.format.video.nFrameWidth;
+        realHeight = pSECPort->portDefinition.format.video.nFrameHeight;
+        width = ((realWidth + 15) & (~15));
+        height = ((realHeight + 15) & (~15));
+        size = (width * height * 3) / 2;
+        pSECPort->portDefinition.format.video.nStride = width;
+        pSECPort->portDefinition.format.video.nSliceHeight = height;
+        pSECPort->portDefinition.nBufferSize = (size > pSECPort->portDefinition.nBufferSize) ? size : pSECPort->portDefinition.nBufferSize;
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+            pSECOutputPort->portDefinition.format.video.nFrameWidth = pSECPort->portDefinition.format.video.nFrameWidth;
+            pSECOutputPort->portDefinition.format.video.nFrameHeight = pSECPort->portDefinition.format.video.nFrameHeight;
+            pSECOutputPort->portDefinition.format.video.nStride = width;
+            pSECOutputPort->portDefinition.format.video.nSliceHeight = height;
+
+            switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+            case OMX_COLOR_FormatYUV420Planar:
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+            case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+            case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                pSECOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
+                break;
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                pSECOutputPort->portDefinition.nBufferSize =
+                    ALIGN_TO_8KB(ALIGN_TO_128B(realWidth) * ALIGN_TO_32B(realHeight)) \
+                  + ALIGN_TO_8KB(ALIGN_TO_128B(realWidth) * ALIGN_TO_32B(realHeight/2));
+                break;
+            default:
+                SEC_OSAL_Log(SEC_LOG_ERROR, "Color format is not support!! use default YUV size!!");
+                ret = OMX_ErrorUnsupportedSetting;
+                break;
+            }
+        }
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelCurrent:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pSrcProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_MPEG4TYPE        *pDstMpeg4Param = NULL;
+        OMX_VIDEO_PARAM_H263TYPE         *pDstH263Param = NULL;
+        SEC_MPEG4_HANDLE                 *pMpeg4Dec = NULL;
+        OMX_S32                           codecType;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        codecType = pMpeg4Dec->hMFCMpeg4Handle.codecType;
+        if (codecType == CODEC_TYPE_MPEG4) {
+            /*
+             * To do: Check validity of profile & level parameters
+             */
+
+            pDstMpeg4Param = &pMpeg4Dec->mpeg4Component[pSrcProfileLevel->nPortIndex];
+            pDstMpeg4Param->eProfile = pSrcProfileLevel->eProfile;
+            pDstMpeg4Param->eLevel = pSrcProfileLevel->eLevel;
+        } else {
+            /*
+             * To do: Check validity of profile & level parameters
+             */
+
+            pDstH263Param = &pMpeg4Dec->h263Component[pSrcProfileLevel->nPortIndex];
+            pDstH263Param->eProfile = pSrcProfileLevel->eProfile;
+            pDstH263Param->eLevel = pSrcProfileLevel->eLevel;
+        }
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = NULL;
+        SEC_MPEG4_HANDLE                    *pMpeg4Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcErrorCorrectionType->nPortIndex != INPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstErrorCorrectionType = &pMpeg4Dec->errorCorrectionType[INPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_GetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentConfigStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_VideoDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_SetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentConfigStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_VideoDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_GetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_ENABLE_THUMBNAIL) == 0) {
+        SEC_MPEG4_HANDLE *pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+        *pIndexType = OMX_IndexVendorThumbnailMode;
+
+        ret = OMX_ErrorNone;
+    } else {
+        ret = SEC_OMX_VideoDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_ComponentRoleEnum(
+    OMX_IN  OMX_HANDLETYPE hComponent,
+    OMX_OUT OMX_U8        *cRole,
+    OMX_IN  OMX_U32        nIndex)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    OMX_S32                  codecType;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (cRole == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) {
+        ret = OMX_ErrorNoMore;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    codecType = ((SEC_MPEG4_HANDLE *)(((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType;
+    if (codecType == CODEC_TYPE_MPEG4)
+        SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_MPEG4_DEC_ROLE);
+    else
+        SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_H263_DEC_ROLE);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_DecodeThread(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_MPEG4_HANDLE      *pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    while (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+        SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameStart);
+
+        if (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStart(PERF_ID_DEC);
+#endif
+            pMpeg4Dec->hMFCMpeg4Handle.returnCodec = SsbSipMfcDecExe(pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle, pVideoDec->NBDecThread.oneFrameSize);
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStop(PERF_ID_DEC);
+#endif
+            SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameEnd);
+        }
+    }
+
+EXIT:
+    SEC_OSAL_ThreadExit(NULL);
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Init */
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT      *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_MPEG4_HANDLE      *pMpeg4Dec = NULL;
+    OMX_HANDLETYPE         hMFCHandle = NULL;
+    OMX_PTR                pStreamBuffer = NULL;
+    OMX_PTR                pStreamPhyBuffer = NULL;
+#ifdef CONFIG_MFC_FPS
+    SEC_OSAL_PerfInit(PERF_ID_DEC);
+    SEC_OSAL_PerfInit(PERF_ID_CSC);
+#endif
+    CSC_METHOD csc_method = CSC_METHOD_SW;
+
+    FunctionIn();
+
+    pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pMpeg4Dec->hMFCMpeg4Handle.bConfiguredMFC = OMX_FALSE;
+    pSECComponent->bUseFlagEOF = OMX_FALSE;
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+
+    /* MFC(Multi Format Codec) decoder and CMM(Codec Memory Management) driver open */
+    if (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) {
+        hMFCHandle = (OMX_PTR)SsbSipMfcDecOpen();
+    } else {
+        SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+        hMFCHandle = (OMX_PTR)SsbSipMfcDecOpenExt(&buf_type);
+    }
+
+    if (hMFCHandle == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    ghMFCHandle = pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle = hMFCHandle;
+
+    /* Allocate decoder's input buffer */
+    /* Get first input buffer */
+    pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE / 2);
+    if (pStreamBuffer == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoDec->MFCDecInputBuffer[0].VirAddr = pStreamBuffer;
+    pVideoDec->MFCDecInputBuffer[0].PhyAddr = pStreamPhyBuffer;
+    pVideoDec->MFCDecInputBuffer[0].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE / 2;
+    pVideoDec->MFCDecInputBuffer[0].dataSize = 0;
+
+#ifdef NONBLOCK_MODE_PROCESS
+    /* Get second input buffer */
+    pStreamBuffer = NULL;
+    pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE / 2);
+    if (pStreamBuffer == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoDec->MFCDecInputBuffer[1].VirAddr = pStreamBuffer;
+    pVideoDec->MFCDecInputBuffer[1].PhyAddr = pStreamPhyBuffer;
+    pVideoDec->MFCDecInputBuffer[1].bufferSize    = DEFAULT_MFC_INPUT_BUFFER_SIZE / 2;
+    pVideoDec->MFCDecInputBuffer[1].dataSize = 0;
+    pVideoDec->indexInputBuffer = 0;
+
+    pVideoDec->bFirstFrame = OMX_TRUE;
+
+    pVideoDec->NBDecThread.bExitDecodeThread = OMX_FALSE;
+    pVideoDec->NBDecThread.bDecoderRun = OMX_FALSE;
+    pVideoDec->NBDecThread.oneFrameSize = 0;
+    SEC_OSAL_SemaphoreCreate(&(pVideoDec->NBDecThread.hDecFrameStart));
+    SEC_OSAL_SemaphoreCreate(&(pVideoDec->NBDecThread.hDecFrameEnd));
+    if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pVideoDec->NBDecThread.hNBDecodeThread,
+                                                SEC_MFC_DecodeThread,
+                                                pOMXComponent)) {
+        pMpeg4Dec->hMFCMpeg4Handle.returnCodec = MFC_RET_OK;
+    }
+#endif
+
+    pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[0].VirAddr;
+    pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[0].PhyAddr;
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[0].VirAddr;
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[0].bufferSize;
+
+    SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+    SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+    pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp = 0;
+    pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp = 0;
+
+    pSECComponent->getAllDelayBuffer = OMX_FALSE;
+
+#ifdef USE_ANB
+#if defined(USE_CSC_FIMC) || defined(USE_CSC_GSCALER)
+    if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+        csc_method = CSC_METHOD_PREFER_HW;
+    }
+#endif
+#endif
+    pVideoDec->csc_handle = csc_init(&csc_method);
+    pVideoDec->csc_set_format = OMX_FALSE;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Terminate */
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_MPEG4_HANDLE      *pMpeg4Dec = NULL;
+    OMX_HANDLETYPE         hMFCHandle = NULL;
+
+    FunctionIn();
+
+#ifdef CONFIG_MFC_FPS
+    SEC_OSAL_PerfPrint("[DEC]",  PERF_ID_DEC);
+    SEC_OSAL_PerfPrint("[CSC]",  PERF_ID_CSC);
+#endif
+
+    pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    hMFCHandle = pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle;
+
+    pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer    = NULL;
+    pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer = NULL;
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = NULL;
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = 0;
+
+#ifdef NONBLOCK_MODE_PROCESS
+    if (pVideoDec->NBDecThread.hNBDecodeThread != NULL) {
+        pVideoDec->NBDecThread.bExitDecodeThread = OMX_TRUE;
+        SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameStart);
+        SEC_OSAL_ThreadTerminate(pVideoDec->NBDecThread.hNBDecodeThread);
+        pVideoDec->NBDecThread.hNBDecodeThread = NULL;
+    }
+
+    if(pVideoDec->NBDecThread.hDecFrameEnd != NULL) {
+        SEC_OSAL_SemaphoreTerminate(pVideoDec->NBDecThread.hDecFrameEnd);
+        pVideoDec->NBDecThread.hDecFrameEnd = NULL;
+    }
+
+    if(pVideoDec->NBDecThread.hDecFrameStart != NULL) {
+        SEC_OSAL_SemaphoreTerminate(pVideoDec->NBDecThread.hDecFrameStart);
+        pVideoDec->NBDecThread.hDecFrameStart = NULL;
+    }
+#endif
+
+    if (hMFCHandle != NULL) {
+        SsbSipMfcDecClose(hMFCHandle);
+        ghMFCHandle = hMFCHandle = NULL;
+        pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle = NULL;
+    }
+
+    if (pVideoDec->csc_handle != NULL) {
+        csc_deinit(pVideoDec->csc_handle);
+        pVideoDec->csc_handle = NULL;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT           *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT           *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_MPEG4_HANDLE           *pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    OMX_HANDLETYPE              hMFCHandle = pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle;
+    OMX_U32                     oneFrameSize = pInputData->dataLen;
+    SSBSIP_MFC_DEC_OUTPUT_INFO  outputInfo;
+    OMX_S32                     configValue;
+    int                         bufWidth;
+    int                         bufHeight;
+    OMX_U32                     FrameBufferYSize = 0;
+    OMX_U32                     FrameBufferUVSize = 0;
+    OMX_BOOL                    outputDataValid = OMX_FALSE;
+
+    FunctionIn();
+
+    if (pMpeg4Dec->hMFCMpeg4Handle.bConfiguredMFC == OMX_FALSE) {
+        SSBSIP_MFC_CODEC_TYPE MFCCodecType;
+        if (pMpeg4Dec->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) {
+            if (gbFIMV1)
+                MFCCodecType = FIMV1_DEC;
+            else
+                MFCCodecType = MPEG4_DEC;
+        } else {
+            MFCCodecType = H263_DEC;
+        }
+
+        if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+
+        /* Set mpeg4 deblocking filter enable */
+        configValue = 1;
+        SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_POST_ENABLE, &configValue);
+
+        if (pVideoDec->bThumbnailMode == OMX_TRUE) {
+            configValue = 0;    // the number that you want to delay
+            SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &configValue);
+        } else {
+            configValue = MPEG4_DEC_NUM_OF_EXTRA_BUFFERS;
+            SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &configValue);
+        }
+
+        SsbSipMfcDecSetInBuf(pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle,
+                             pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer,
+                             pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer,
+                             pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        pMpeg4Dec->hMFCMpeg4Handle.returnCodec = SsbSipMfcDecInit(hMFCHandle, MFCCodecType, oneFrameSize);
+        if (pMpeg4Dec->hMFCMpeg4Handle.returnCodec == MFC_RET_OK) {
+            SSBSIP_MFC_IMG_RESOLUTION imgResol;
+
+            if (SsbSipMfcDecGetConfig(hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol) != MFC_RET_OK) {
+                ret = OMX_ErrorMFCInit;
+                SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcDecGetConfig failed", __FUNCTION__);
+                goto EXIT;
+            }
+
+            /** Update Frame Size **/
+            if ((pSECInputPort->portDefinition.format.video.nFrameWidth != (unsigned int)imgResol.width) ||
+                (pSECInputPort->portDefinition.format.video.nFrameHeight != (unsigned int)imgResol.height)) {
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /* Send Port Settings changed call back */
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, // The command was completed
+                       OMX_DirOutput, // This is the port index
+                       0,
+                       NULL);
+            }
+
+            SEC_OSAL_Log(SEC_LOG_TRACE, "nFrameWidth(%d) nFrameHeight(%d), nStride(%d), nSliceHeight(%d)",
+                    pSECInputPort->portDefinition.format.video.nFrameWidth, pSECInputPort->portDefinition.format.video.nFrameHeight,
+                    pSECInputPort->portDefinition.format.video.nStride, pSECInputPort->portDefinition.format.video.nSliceHeight);
+
+            pMpeg4Dec->hMFCMpeg4Handle.bConfiguredMFC = OMX_TRUE;
+            if (pMpeg4Dec->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) {
+                pOutputData->timeStamp = pInputData->timeStamp;
+                pOutputData->nFlags = pInputData->nFlags;
+                ret = OMX_ErrorNone;
+            } else {
+                pOutputData->dataLen = 0;
+                ret = OMX_ErrorInputDataDecodeYet;
+            }
+            goto EXIT;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcDecInit failed", __FUNCTION__);
+            ret = OMX_ErrorMFCInit;    /* OMX_ErrorUndefined */
+            goto EXIT;
+        }
+    }
+
+#ifndef FULL_FRAME_SEARCH
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+#endif
+
+    pSECComponent->timeStamp[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
+    pSECComponent->nFlags[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags;
+
+    if ((pMpeg4Dec->hMFCMpeg4Handle.returnCodec == MFC_RET_OK) &&
+        (pVideoDec->bFirstFrame == OMX_FALSE)) {
+        SSBSIP_MFC_DEC_OUTBUF_STATUS status;
+        OMX_S32 indexTimestamp = 0;
+
+        /* wait for mfc decode done */
+        if (pVideoDec->NBDecThread.bDecoderRun == OMX_TRUE) {
+            SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameEnd);
+            pVideoDec->NBDecThread.bDecoderRun = OMX_FALSE;
+        }
+
+        SEC_OSAL_SleepMillisec(0);
+        status = SsbSipMfcDecGetOutBuf(hMFCHandle, &outputInfo);
+        bufWidth = (outputInfo.img_width + 15) & (~15);
+        bufHeight = (outputInfo.img_height + 15) & (~15);
+        FrameBufferYSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height));
+        FrameBufferUVSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height/2));
+
+        if ((SsbSipMfcDecGetConfig(hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            /* For timestamp correction. if mfc support frametype detect */
+            SEC_OSAL_Log(SEC_LOG_TRACE, "disp_pic_frame_type: %d", outputInfo.disp_pic_frame_type);
+#ifdef NEED_TIMESTAMP_REORDER
+            if (outputInfo.disp_pic_frame_type == MFC_FRAME_TYPE_I_FRAME) {
+                pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+                pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp = indexTimestamp;
+            } else {
+                pOutputData->timeStamp = pSECComponent->timeStamp[pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp];
+            }
+#else
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+#endif
+        }
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
+            (status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
+            outputDataValid = OMX_TRUE;
+            pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp++;
+            pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp %= MAX_TIMESTAMP;
+        }
+        if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+            outputDataValid = OMX_FALSE;
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE))
+            ret = OMX_ErrorInputDataDecodeYet;
+
+        if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+            if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE))) {
+                pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else {
+                ret = OMX_ErrorNone;
+            }
+            outputDataValid = OMX_FALSE;
+        }
+
+#ifdef FULL_FRAME_SEARCH
+        if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+            pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else
+#endif
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            ret = OMX_ErrorNone;
+        }
+    } else {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
+            (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+        }
+
+        if ((pVideoDec->bFirstFrame == OMX_TRUE) &&
+            ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+            ((pInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) != OMX_BUFFERFLAG_CODECCONFIG)) {
+            pOutputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+        }
+
+        outputDataValid = OMX_FALSE;
+
+        /* ret = OMX_ErrorUndefined; */
+        ret = OMX_ErrorNone;
+    }
+
+    if (ret == OMX_ErrorInputDataDecodeYet) {
+        pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize = oneFrameSize;
+        pVideoDec->indexInputBuffer++;
+        pVideoDec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+        pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].PhyAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].bufferSize;
+        oneFrameSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize;
+        //pInputData->dataLen = oneFrameSize;
+        //pInputData->remainDataLen = oneFrameSize;
+    }
+
+    if ((Check_Stream_PrefixCode(pInputData->dataBuffer, oneFrameSize, pMpeg4Dec->hMFCMpeg4Handle.codecType) == OMX_TRUE) &&
+        ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS)) {
+        if ((ret != OMX_ErrorInputDataDecodeYet) || (pSECComponent->getAllDelayBuffer == OMX_TRUE)) {
+            SsbSipMfcDecSetConfig(pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp));
+            pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp++;
+            pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp %= MAX_TIMESTAMP;
+        }
+
+        SsbSipMfcDecSetInBuf(pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle,
+                             pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer,
+                             pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer,
+                             pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize = oneFrameSize;
+        pVideoDec->NBDecThread.oneFrameSize = oneFrameSize;
+
+        /* mfc decode start */
+        SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameStart);
+        pVideoDec->NBDecThread.bDecoderRun = OMX_TRUE;
+        pMpeg4Dec->hMFCMpeg4Handle.returnCodec = MFC_RET_OK;
+
+        SEC_OSAL_SleepMillisec(0);
+
+        pVideoDec->indexInputBuffer++;
+        pVideoDec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+        pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pMpeg4Dec->hMFCMpeg4Handle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].PhyAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].bufferSize;
+
+        if ((pVideoDec->bFirstFrame == OMX_TRUE) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE) &&
+            (outputDataValid == OMX_FALSE)) {
+            ret = OMX_ErrorInputDataDecodeYet;
+        }
+
+        pVideoDec->bFirstFrame = OMX_FALSE;
+    } else {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE)
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+    }
+
+    /** Fill Output Buffer **/
+    if (outputDataValid == OMX_TRUE) {
+        void *pOutputBuf = (void *)pOutputData->dataBuffer;
+        void *pSrcBuf[3] = {NULL, };
+        void *pYUVBuf[3] = {NULL, };
+        unsigned int csc_src_color_format, csc_dst_color_format;
+        CSC_METHOD csc_method = CSC_METHOD_SW;
+        unsigned int cacheable = 1;
+
+        int frameSize = bufWidth * bufHeight;
+        int width = outputInfo.img_width;
+        int height = outputInfo.img_height;
+        int imageSize = outputInfo.img_width * outputInfo.img_height;
+
+        pSrcBuf[0] = outputInfo.YVirAddr;
+        pSrcBuf[1] = outputInfo.CVirAddr;
+
+        pYUVBuf[0]  = (unsigned char *)pOutputBuf;
+        pYUVBuf[1]  = (unsigned char *)pOutputBuf + imageSize;
+        pYUVBuf[2]  = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
+        pOutputData->dataLen = (imageSize * 3) / 2;
+
+#ifdef USE_ANB
+        if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+            OMX_U32 stride;
+            SEC_OSAL_LockANB(pOutputData->dataBuffer, width, height, pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat, &stride, pYUVBuf);
+            width = stride;
+            pOutputData->dataLen = sizeof(void *);
+        }
+#endif
+        if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
+            (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
+            /* if use Post copy address structure */
+            SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+            pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height * 3) / 2;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStart(PERF_ID_CSC);
+#endif
+            switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
+                SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + FrameBufferYSize, outputInfo.CVirAddr, FrameBufferUVSize);
+                pOutputData->dataLen = FrameBufferYSize + FrameBufferUVSize;
+                break;
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+            case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                break;
+            case OMX_COLOR_FormatYUV420Planar:
+            default:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                break;
+            }
+
+            csc_get_method(pVideoDec->csc_handle, &csc_method);
+#ifdef USE_CSC_FIMC
+            if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
+                SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
+                pSrcBuf[0] = outputInfo.YPhyAddr;
+                pSrcBuf[1] = outputInfo.CPhyAddr;
+            }
+#endif
+            if (pVideoDec->csc_set_format == OMX_FALSE) {
+                csc_set_src_format(
+                    pVideoDec->csc_handle,  /* handle */
+                    width,                  /* width */
+                    height,                 /* height */
+                    0,                      /* crop_left */
+                    0,                      /* crop_right */
+                    width,                  /* crop_width */
+                    height,                 /* crop_height */
+                    csc_src_color_format,   /* color_format */
+                    cacheable);             /* cacheable */
+                csc_set_dst_format(
+                    pVideoDec->csc_handle,  /* handle */
+                    width,                  /* width */
+                    height,                 /* height */
+                    0,                      /* crop_left */
+                    0,                      /* crop_right */
+                    width,                  /* crop_width */
+                    height,                 /* crop_height */
+                    csc_dst_color_format,   /* color_format */
+                    cacheable);             /* cacheable */
+                pVideoDec->csc_set_format = OMX_TRUE;
+            }
+
+            csc_set_src_buffer(
+                pVideoDec->csc_handle,  /* handle */
+                pSrcBuf[0],             /* y addr */
+                pSrcBuf[1],             /* u addr or uv addr */
+                pSrcBuf[2],             /* v addr or none */
+                0);                     /* ion fd */
+            csc_set_dst_buffer(
+                pVideoDec->csc_handle,  /* handle */
+                pYUVBuf[0],             /* y addr */
+                pYUVBuf[1],             /* u addr or uv addr */
+                pYUVBuf[2],             /* v addr or none */
+                0);                     /* ion fd */
+            csc_convert(pVideoDec->csc_handle);
+
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStop(PERF_ID_CSC);
+#endif
+        }
+#ifdef USE_ANB
+        if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+            SEC_OSAL_UnlockANB(pOutputData->dataBuffer);
+        }
+#endif
+    } else {
+        pOutputData->dataLen = 0;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT           *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT           *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_MPEG4_HANDLE           *pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    OMX_HANDLETYPE              hMFCHandle = pMpeg4Dec->hMFCMpeg4Handle.hMFCHandle;
+    OMX_U32                     oneFrameSize = pInputData->dataLen;
+    SSBSIP_MFC_DEC_OUTPUT_INFO  outputInfo;
+    OMX_S32                     configValue;
+    OMX_S32                     returnCodec;
+    int                         bufWidth;
+    int                         bufHeight;
+    OMX_U32                     FrameBufferYSize;
+    OMX_U32                     FrameBufferUVSize;
+
+    FunctionIn();
+
+    if (pMpeg4Dec->hMFCMpeg4Handle.bConfiguredMFC == OMX_FALSE) {
+        SSBSIP_MFC_CODEC_TYPE MFCCodecType;
+        if (pMpeg4Dec->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) {
+            if (gbFIMV1)
+                MFCCodecType = FIMV1_DEC;
+            else
+                MFCCodecType = MPEG4_DEC;
+        } else {
+            MFCCodecType = H263_DEC;
+        }
+
+        if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+
+        /* Set mpeg4 deblocking filter enable */
+        configValue = 1;
+        SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_POST_ENABLE, &configValue);
+
+        if (pVideoDec->bThumbnailMode == OMX_TRUE) {
+            configValue = 0;    // the number that you want to delay
+            SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &configValue);
+        } else {
+            configValue = MPEG4_DEC_NUM_OF_EXTRA_BUFFERS;
+            SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &configValue);
+        }
+
+        returnCodec = SsbSipMfcDecInit(hMFCHandle, MFCCodecType, oneFrameSize);
+        if (returnCodec == MFC_RET_OK) {
+            SSBSIP_MFC_IMG_RESOLUTION imgResol;
+
+            if (SsbSipMfcDecGetConfig(hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol) != MFC_RET_OK) {
+                ret = OMX_ErrorMFCInit;
+                SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcDecGetConfig failed", __FUNCTION__);
+                goto EXIT;
+            }
+
+            /** Update Frame Size **/
+            if ((pSECInputPort->portDefinition.format.video.nFrameWidth != (unsigned int)imgResol.width) ||
+               (pSECInputPort->portDefinition.format.video.nFrameHeight != (unsigned int)imgResol.height)) {
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /* Send Port Settings changed call back */
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, // The command was completed
+                       OMX_DirOutput, // This is the port index
+                       0,
+                       NULL);
+            }
+
+            SEC_OSAL_Log(SEC_LOG_TRACE, "nFrameWidth(%d) nFrameHeight(%d), nStride(%d), nSliceHeight(%d)",
+                    pSECInputPort->portDefinition.format.video.nFrameWidth,  pSECInputPort->portDefinition.format.video.nFrameHeight,
+                    pSECInputPort->portDefinition.format.video.nStride, pSECInputPort->portDefinition.format.video.nSliceHeight);
+
+            pMpeg4Dec->hMFCMpeg4Handle.bConfiguredMFC = OMX_TRUE;
+            if (pMpeg4Dec->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) {
+                pOutputData->timeStamp = pInputData->timeStamp;
+                pOutputData->nFlags = pInputData->nFlags;
+                ret = OMX_ErrorNone;
+            } else {
+                pOutputData->dataLen = 0;
+                ret = OMX_ErrorInputDataDecodeYet;
+            }
+            goto EXIT;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcDecInit failed", __FUNCTION__);
+            ret = OMX_ErrorMFCInit;    /* OMX_ErrorUndefined */
+            goto EXIT;
+        }
+    }
+
+#ifndef FULL_FRAME_SEARCH
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+#endif
+
+    if (Check_Stream_PrefixCode(pInputData->dataBuffer, pInputData->dataLen, pMpeg4Dec->hMFCMpeg4Handle.codecType) == OMX_TRUE) {
+        pSECComponent->timeStamp[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
+        pSECComponent->nFlags[pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags;
+        SsbSipMfcDecSetConfig(hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp));
+
+        returnCodec = SsbSipMfcDecExe(hMFCHandle, oneFrameSize);
+    } else {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE)
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+        returnCodec = MFC_RET_OK;
+        goto EXIT;
+    }
+
+    if (returnCodec == MFC_RET_OK) {
+        SSBSIP_MFC_DEC_OUTBUF_STATUS status;
+        OMX_S32 indexTimestamp = 0;
+
+        status = SsbSipMfcDecGetOutBuf(hMFCHandle, &outputInfo);
+        bufWidth =  (outputInfo.img_width + 15) & (~15);
+        bufHeight =  (outputInfo.img_height + 15) & (~15);
+        FrameBufferYSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height));
+        FrameBufferUVSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height/2));
+
+        if (status != MFC_GETOUTBUF_DISPLAY_ONLY) {
+            pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp++;
+            pMpeg4Dec->hMFCMpeg4Handle.indexTimestamp %= MAX_TIMESTAMP;
+        }
+
+        if ((SsbSipMfcDecGetConfig(hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            /* For timestamp correction. if mfc support frametype detect */
+            SEC_OSAL_Log(SEC_LOG_TRACE, "disp_pic_frame_type: %d", outputInfo.disp_pic_frame_type);
+#ifdef NEED_TIMESTAMP_REORDER
+            if (outputInfo.disp_pic_frame_type == MFC_FRAME_TYPE_I_FRAME) {
+                pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+                pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp = indexTimestamp;
+            } else {
+                pOutputData->timeStamp = pSECComponent->timeStamp[pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp];
+            }
+#else
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+#endif
+        }
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
+            (status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
+            /** Fill Output Buffer **/
+            void *pOutputBuf = (void *)pOutputData->dataBuffer;
+            void *pSrcBuf[3] = {NULL, };
+            void *pYUVBuf[3] = {NULL, };
+            unsigned int csc_src_color_format, csc_dst_color_format;
+            CSC_METHOD csc_method = CSC_METHOD_SW;
+            unsigned int cacheable = 1;
+
+            int frameSize = bufWidth * bufHeight;
+            int width = outputInfo.img_width;
+            int height = outputInfo.img_height;
+            int imageSize = outputInfo.img_width * outputInfo.img_height;
+
+            pSrcBuf[0] = outputInfo.YVirAddr;
+            pSrcBuf[1] = outputInfo.CVirAddr;
+
+            pYUVBuf[0]  = (unsigned char *)pOutputBuf;
+            pYUVBuf[1]  = (unsigned char *)pOutputBuf + imageSize;
+            pYUVBuf[2]  = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
+            pOutputData->dataLen = (imageSize * 3) / 2;
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+                OMX_U32 stride;
+                SEC_OSAL_LockANB(pOutputData->dataBuffer, width, height, pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat, &stride, pYUVBuf);
+                width = stride;
+                pOutputData->dataLen = sizeof(void *);
+            }
+#endif
+            if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
+                (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
+                /* if use Post copy address structure */
+                SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+                pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height * 3) / 2;
+            } else {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStart(PERF_ID_CSC);
+#endif
+                switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+                case OMX_SEC_COLOR_FormatNV12Tiled:
+                    SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
+                    SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + FrameBufferYSize, outputInfo.CVirAddr, FrameBufferUVSize);
+                    pOutputData->dataLen = FrameBufferYSize + FrameBufferUVSize;
+                    break;
+                case OMX_COLOR_FormatYUV420SemiPlanar:
+                case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                    csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                    csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                    break;
+                case OMX_COLOR_FormatYUV420Planar:
+                default:
+                    csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                    csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                    break;
+                }
+
+                csc_get_method(pVideoDec->csc_handle, &csc_method);
+#ifdef USE_CSC_FIMC
+                if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
+                    SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
+                    pSrcBuf[0] = outputInfo.YPhyAddr;
+                    pSrcBuf[1] = outputInfo.CPhyAddr;
+                }
+#endif
+                if (pVideoDec->csc_set_format == OMX_FALSE) {
+                    csc_set_src_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        width,                  /* width */
+                        height,                 /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        width,                  /* crop_width */
+                        height,                 /* crop_height */
+                        csc_src_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    csc_set_dst_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        width,                  /* width */
+                        height,                 /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        width,                  /* crop_width */
+                        height,                 /* crop_height */
+                        csc_dst_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    pVideoDec->csc_set_format = OMX_TRUE;
+                }
+
+                csc_set_src_buffer(
+                    pVideoDec->csc_handle,  /* handle */
+                    pSrcBuf[0],             /* y addr */
+                    pSrcBuf[1],             /* u addr or uv addr */
+                    pSrcBuf[2],             /* v addr or none */
+                    0);                     /* ion fd */
+                csc_set_dst_buffer(
+                    pVideoDec->csc_handle,  /* handle */
+                    pYUVBuf[0],             /* y addr */
+                    pYUVBuf[1],             /* u addr or uv addr */
+                    pYUVBuf[2],             /* v addr or none */
+                    0);                     /* ion fd */
+                csc_convert(pVideoDec->csc_handle);
+
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStop(PERF_ID_CSC);
+#endif
+            }
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+                SEC_OSAL_UnlockANB(pOutputData->dataBuffer);
+            }
+#endif
+            pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp++;
+            pMpeg4Dec->hMFCMpeg4Handle.outputIndexTimestamp %= MAX_TIMESTAMP;
+        }
+        if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+            pOutputData->dataLen = 0;
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE)) {
+            ret = OMX_ErrorInputDataDecodeYet;
+        }
+
+        if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+            if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE))) {
+                pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else {
+                ret = OMX_ErrorNone;
+            }
+            goto EXIT;
+        }
+
+#ifdef FULL_FRAME_SEARCH
+        if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+            pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else
+#endif
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            ret = OMX_ErrorNone;
+        }
+    } else {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
+            (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+        }
+        pOutputData->dataLen = 0;
+
+        /* ret = OMX_ErrorUndefined; */
+            ret = OMX_ErrorNone;
+            goto EXIT;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Decode */
+OMX_ERRORTYPE SEC_MFC_Mpeg4Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_MPEG4_HANDLE        *pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    SEC_OMX_BASEPORT        *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT        *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    OMX_BOOL                 bCheckPrefix = OMX_FALSE;
+
+    FunctionIn();
+
+    if ((!CHECK_PORT_ENABLED(pSECInputPort)) || (!CHECK_PORT_ENABLED(pSECOutputPort)) ||
+        (!CHECK_PORT_POPULATED(pSECInputPort)) || (!CHECK_PORT_POPULATED(pSECOutputPort))) {
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+    if (OMX_FALSE == SEC_Check_BufferProcess_State(pSECComponent)) {
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+#ifdef NONBLOCK_MODE_PROCESS
+    ret = SEC_MFC_Mpeg4_Decode_Nonblock(pOMXComponent, pInputData, pOutputData);
+#else
+    ret = SEC_MFC_Mpeg4_Decode_Block(pOMXComponent, pInputData, pOutputData);
+#endif
+    if (ret != OMX_ErrorNone) {
+        if (ret == OMX_ErrorInputDataDecodeYet) {
+            pOutputData->usedDataLen = 0;
+            pOutputData->remainDataLen = pOutputData->dataLen;
+        } else {
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+                                                    pSECComponent->callbackData,
+                                                    OMX_EventError, ret, 0, NULL);
+        }
+    } else {
+        pInputData->previousDataLen = pInputData->dataLen;
+        pInputData->usedDataLen += pInputData->dataLen;
+        pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
+        pInputData->dataLen -= pInputData->usedDataLen;
+        pInputData->usedDataLen = 0;
+
+        pOutputData->usedDataLen = 0;
+        pOutputData->remainDataLen = pOutputData->dataLen;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_OMX_BASEPORT        *pSECPort = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+    SEC_MPEG4_HANDLE        *pMpeg4Dec = NULL;
+    OMX_S32                  codecType = -1;
+    int i = 0;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (componentName == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+    if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_MPEG4_DEC, componentName) == 0) {
+        codecType = CODEC_TYPE_MPEG4;
+    } else if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H263_DEC, componentName) == 0) {
+        codecType = CODEC_TYPE_H263;
+    } else {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_VideoDecodeComponentInit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_OMX_VideoDecodeComponentInit error, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECComponent->codecType = HW_VIDEO_DEC_CODEC;
+
+    pSECComponent->componentName = (OMX_STRING)SEC_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
+    if (pSECComponent->componentName == NULL) {
+        SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
+
+    pMpeg4Dec = SEC_OSAL_Malloc(sizeof(SEC_MPEG4_HANDLE));
+    if (pMpeg4Dec == NULL) {
+        SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_MPEG4_HANDLE alloc error, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pMpeg4Dec, 0, sizeof(SEC_MPEG4_HANDLE));
+    pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    pVideoDec->hCodecHandle = (OMX_HANDLETYPE)pMpeg4Dec;
+    pMpeg4Dec->hMFCMpeg4Handle.codecType = codecType;
+
+    if (codecType == CODEC_TYPE_MPEG4)
+        SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_MPEG4_DEC);
+    else
+        SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H263_DEC);
+
+    /* Set componentVersion */
+    pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->componentVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->componentVersion.s.nStep         = STEP_NUMBER;
+    /* Set specVersion */
+    pSECComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->specVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->specVersion.s.nStep         = STEP_NUMBER;
+
+    /* Android CapabilityFlags */
+    pSECComponent->capabilityFlags.iIsOMXComponentMultiThreaded                   = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalInputBufferAlloc  = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalOutputBufferAlloc = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsMovableInputBuffers       = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsPartialFrames             = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesNALStartCodes                 = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentCanHandleIncompleteFrames         = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesFullAVCFrames                 = OMX_TRUE;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0;
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_INPUT_BUFFER_SIZE;
+    if (codecType == CODEC_TYPE_MPEG4) {
+        pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
+        SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+        SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "video/mpeg4");
+    } else {
+        pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingH263;
+        SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+        SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "video/h263");
+    }
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0;
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    if (codecType == CODEC_TYPE_MPEG4) {
+        for(i = 0; i < ALL_PORT_NUM; i++) {
+            INIT_SET_SIZE_VERSION(&pMpeg4Dec->mpeg4Component[i], OMX_VIDEO_PARAM_MPEG4TYPE);
+            pMpeg4Dec->mpeg4Component[i].nPortIndex = i;
+            pMpeg4Dec->mpeg4Component[i].eProfile   = OMX_VIDEO_MPEG4ProfileSimple;
+            pMpeg4Dec->mpeg4Component[i].eLevel     = OMX_VIDEO_MPEG4Level3;
+        }
+    } else {
+        for(i = 0; i < ALL_PORT_NUM; i++) {
+            INIT_SET_SIZE_VERSION(&pMpeg4Dec->h263Component[i], OMX_VIDEO_PARAM_H263TYPE);
+            pMpeg4Dec->h263Component[i].nPortIndex = i;
+            pMpeg4Dec->h263Component[i].eProfile   = OMX_VIDEO_H263ProfileBaseline | OMX_VIDEO_H263ProfileISWV2;
+            pMpeg4Dec->h263Component[i].eLevel     = OMX_VIDEO_H263Level45;
+        }
+    }
+
+    pOMXComponent->GetParameter      = &SEC_MFC_Mpeg4Dec_GetParameter;
+    pOMXComponent->SetParameter      = &SEC_MFC_Mpeg4Dec_SetParameter;
+    pOMXComponent->GetConfig         = &SEC_MFC_Mpeg4Dec_GetConfig;
+    pOMXComponent->SetConfig         = &SEC_MFC_Mpeg4Dec_SetConfig;
+    pOMXComponent->GetExtensionIndex = &SEC_MFC_Mpeg4Dec_GetExtensionIndex;
+    pOMXComponent->ComponentRoleEnum = &SEC_MFC_Mpeg4Dec_ComponentRoleEnum;
+    pOMXComponent->ComponentDeInit   = &SEC_OMX_ComponentDeinit;
+
+    pSECComponent->sec_mfc_componentInit      = &SEC_MFC_Mpeg4Dec_Init;
+    pSECComponent->sec_mfc_componentTerminate = &SEC_MFC_Mpeg4Dec_Terminate;
+    pSECComponent->sec_mfc_bufferProcess      = &SEC_MFC_Mpeg4Dec_bufferProcess;
+    if (codecType == CODEC_TYPE_MPEG4)
+        pSECComponent->sec_checkInputFrame = &Check_Mpeg4_Frame;
+    else
+        pSECComponent->sec_checkInputFrame = &Check_H263_Frame;
+
+    pSECComponent->currentState = OMX_StateLoaded;
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_MPEG4_HANDLE        *pMpeg4Dec = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    SEC_OSAL_Free(pSECComponent->componentName);
+    pSECComponent->componentName = NULL;
+
+    pMpeg4Dec = (SEC_MPEG4_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    if (pMpeg4Dec != NULL) {
+        SEC_OSAL_Free(pMpeg4Dec);
+        ((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle = NULL;
+    }
+
+    ret = SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/SEC_OMX_Mpeg4dec.h b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/SEC_OMX_Mpeg4dec.h
new file mode 100644
index 0000000..256cb66
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/SEC_OMX_Mpeg4dec.h
@@ -0,0 +1,92 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Mpeg4dec.h
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_MPEG4_DEC_COMPONENT
+#define SEC_OMX_MPEG4_DEC_COMPONENT
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+
+
+typedef enum _CODEC_TYPE
+{
+    CODEC_TYPE_H263,
+    CODEC_TYPE_MPEG4
+} CODEC_TYPE;
+
+/*
+ * This structure is the same as BitmapInfoHhr struct in pv_avifile_typedefs.h file
+ */
+typedef struct _BitmapInfoHhr
+{
+    OMX_U32    BiSize;
+    OMX_U32    BiWidth;
+    OMX_U32    BiHeight;
+    OMX_U16    BiPlanes;
+    OMX_U16    BiBitCount;
+    OMX_U32    BiCompression;
+    OMX_U32    BiSizeImage;
+    OMX_U32    BiXPelsPerMeter;
+    OMX_U32    BiYPelsPerMeter;
+    OMX_U32    BiClrUsed;
+    OMX_U32    BiClrImportant;
+} BitmapInfoHhr;
+
+typedef struct _SEC_MFC_MPEG4_HANDLE
+{
+    OMX_HANDLETYPE hMFCHandle;
+    OMX_PTR        pMFCStreamBuffer;
+    OMX_PTR        pMFCStreamPhyBuffer;
+    OMX_U32        indexTimestamp;
+    OMX_U32        outputIndexTimestamp;
+    OMX_BOOL       bConfiguredMFC;
+    CODEC_TYPE     codecType;
+    OMX_S32        returnCodec;
+} SEC_MFC_MPEG4_HANDLE;
+
+typedef struct _SEC_MPEG4_HANDLE
+{
+    /* OMX Codec specific */
+    OMX_VIDEO_PARAM_H263TYPE  h263Component[ALL_PORT_NUM];
+    OMX_VIDEO_PARAM_MPEG4TYPE mpeg4Component[ALL_PORT_NUM];
+    OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
+
+    /* SEC MFC Codec specific */
+    SEC_MFC_MPEG4_HANDLE      hMFCMpeg4Handle;
+} SEC_MPEG4_HANDLE;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
+                OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/library_register.c b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/library_register.c
new file mode 100644
index 0000000..2ae1b0d
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/library_register.c
@@ -0,0 +1,63 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.c
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+#include "library_register.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_MPEG4_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent)
+{
+    FunctionIn();
+
+    if (ppSECComponent == NULL)
+        goto EXIT;
+
+    /* component 1 - video decoder MPEG4 */
+    SEC_OSAL_Strcpy(ppSECComponent[0]->componentName, SEC_OMX_COMPONENT_MPEG4_DEC);
+    SEC_OSAL_Strcpy(ppSECComponent[0]->roles[0], SEC_OMX_COMPONENT_MPEG4_DEC_ROLE);
+    ppSECComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+    /* component 2 - video decoder H.263 */
+    SEC_OSAL_Strcpy(ppSECComponent[1]->componentName, SEC_OMX_COMPONENT_H263_DEC);
+    SEC_OSAL_Strcpy(ppSECComponent[1]->roles[0], SEC_OMX_COMPONENT_H263_DEC_ROLE);
+    ppSECComponent[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+EXIT:
+    FunctionOut();
+    return MAX_COMPONENT_NUM;
+}
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/library_register.h b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/library_register.h
new file mode 100644
index 0000000..40aec73
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/mpeg4/library_register.h
@@ -0,0 +1,59 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.h
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_MPEG4_DEC_REG
+#define SEC_OMX_MPEG4_DEC_REG
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "SEC_OMX_Component_Register.h"
+
+
+#define OSCL_EXPORT_REF __attribute__((visibility("default")))
+#define MAX_COMPONENT_NUM              2
+#define MAX_COMPONENT_ROLE_NUM    1
+
+/* MPEG4 */
+#define SEC_OMX_COMPONENT_MPEG4_DEC         "OMX.SEC.MPEG4.Decoder"
+#define SEC_OMX_COMPONENT_MPEG4_DEC_ROLE    "video_decoder.mpeg4"
+
+/* H.263 */
+#define SEC_OMX_COMPONENT_H263_DEC          "OMX.SEC.H263.Decoder"
+#define SEC_OMX_COMPONENT_H263_DEC_ROLE     "video_decoder.h263"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/Android.mk
new file mode 100644
index 0000000..8be63e1
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/Android.mk
@@ -0,0 +1,65 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Wmvdec.c \
+	library_register.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libOMX.SEC.WMV.Decoder
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx
+
+LOCAL_CFLAGS :=
+
+ifeq ($(BOARD_NONBLOCK_MODE_PROCESS), true)
+LOCAL_CFLAGS += -DNONBLOCK_MODE_PROCESS
+endif
+
+ifeq ($(BOARD_USE_ANB), true)
+LOCAL_CFLAGS += -DUSE_ANB
+ifeq ($(BOARD_USE_CSC_FIMC), true)
+ifeq ($(BOARD_USE_V4L2_ION), false)
+LOCAL_CFLAGS += -DUSE_CSC_FIMC
+endif
+endif
+
+ifeq ($(BOARD_USE_CSC_GSCALER), true)
+LOCAL_CFLAGS += -DUSE_CSC_GSCALER
+endif
+endif
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \
+	libswconverter libsecmfcapi
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
+	libSEC_OMX_Resourcemanager libcsc
+
+ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
+LOCAL_SHARED_LIBRARIES += libfimc libhwconverter
+endif
+
+ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
+LOCAL_SHARED_LIBRARIES += libexynosgscaler
+endif
+
+#ifeq ($(BOARD_USE_V4L2_ION),true)
+#LOCAL_SHARED_LIBRARIES += libion
+#endif
+
+ifeq ($(BOARD_USES_MFC_FPS),true)
+LOCAL_CFLAGS += -DCONFIG_MFC_FPS
+endif
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/video/dec \
+	$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO) \
+	$(BOARD_HAL_PATH)/include
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/SEC_OMX_Wmvdec.c b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/SEC_OMX_Wmvdec.c
new file mode 100644
index 0000000..7e9194b
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/SEC_OMX_Wmvdec.c
@@ -0,0 +1,2014 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    SEC_OMX_Wmvdec.c
+ * @brief
+ * @author    HyeYeon Chung (hyeon.chung@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2010.8.16 : Create
+ *   2010.8.20 : Support WMV3 (Vc-1 Simple/Main Profile)
+ *   2010.8.21 : Support WMvC1 (Vc-1 Advanced Profile)
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Macros.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Vdec.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Thread.h"
+#include "SEC_OSAL_Memory.h"
+#include "library_register.h"
+#include "SEC_OMX_Wmvdec.h"
+#include "SsbSipMfcApi.h"
+#include "SEC_OSAL_Event.h"
+
+#ifdef USE_ANB
+#include "SEC_OSAL_Android.h"
+#endif
+
+/* To use CSC_METHOD_PREFER_HW or CSC_METHOD_HW in SEC OMX, gralloc should allocate physical memory using FIMC */
+/* It means GRALLOC_USAGE_HW_FIMC1 should be set on Native Window usage */
+#include "csc.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_WMV_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+#define WMV_DEC_NUM_OF_EXTRA_BUFFERS 7
+
+//#define FULL_FRAME_SEARCH
+
+/* ASF parser does not send start code on OpenCORE */
+#define WO_START_CODE
+
+static OMX_HANDLETYPE ghMFCHandle = NULL;
+static WMV_FORMAT gWvmFormat = WMV_FORMAT_UNKNOWN;
+
+const OMX_U32 wmv3 = 0x33564d57;
+const OMX_U32 wvc1 = 0x31435657;
+const OMX_U32 wmva = 0x41564d57;
+
+static int Check_Wmv_Frame(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame)
+{
+    OMX_U32  compressionID;
+    OMX_BOOL bFrameStart;
+    OMX_U32  len, readStream;
+    OMX_U32  startCode;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "buffSize = %d", buffSize);
+
+    len = 0;
+    bFrameStart = OMX_FALSE;
+
+    if (flag & OMX_BUFFERFLAG_CODECCONFIG) {
+        BitmapInfoHhr *pBitmapInfoHeader;
+        pBitmapInfoHeader = (BitmapInfoHhr *)pInputStream;
+
+        compressionID = pBitmapInfoHeader->BiCompression;
+        if (compressionID == wmv3) {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "WMV_FORMAT_WMV3");
+            gWvmFormat  = WMV_FORMAT_WMV3;
+
+            *pbEndOfFrame = OMX_TRUE;
+            return buffSize;
+        }
+        else if ((compressionID == wvc1) || (compressionID == wmva)) {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "WMV_FORMAT_VC1");
+            gWvmFormat  = WMV_FORMAT_VC1;
+
+#ifdef WO_START_CODE
+/* ASF parser does not send start code on OpenCORE */
+            *pbEndOfFrame = OMX_TRUE;
+            return buffSize;
+#endif
+        }
+    }
+
+    if (gWvmFormat == WMV_FORMAT_WMV3) {
+        *pbEndOfFrame = OMX_TRUE;
+        return buffSize;
+    }
+
+#ifdef WO_START_CODE
+/* ASF parser does not send start code on OpenCORE */
+    if (gWvmFormat == WMV_FORMAT_VC1) {
+        *pbEndOfFrame = OMX_TRUE;
+        return buffSize;
+    }
+#else
+ /* TODO : for comformanc test based on common buffer scheme w/o parser */
+
+    if (bPreviousFrameEOF == OMX_FALSE)
+        bFrameStart = OMX_TRUE;
+
+    startCode = 0xFFFFFFFF;
+    if (bFrameStart == OMX_FALSE) {
+        /* find Frame start code */
+        while(startCode != 0x10D) {
+            readStream = *(pInputStream + len);
+            startCode = (startCode << 8) | readStream;
+            len++;
+            if (len > buffSize)
+                goto EXIT;
+        }
+    }
+
+    /* find next Frame start code */
+    startCode = 0xFFFFFFFF;
+    while ((startCode != 0x10D)) {
+        readStream = *(pInputStream + len);
+        startCode = (startCode << 8) | readStream;
+        len++;
+        if (len > buffSize)
+            goto EXIT;
+    }
+
+    *pbEndOfFrame = OMX_TRUE;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "1. Check_Wmv_Frame returned EOF = %d, len = %d, buffSize = %d", *pbEndOfFrame, len - 4, buffSize);
+
+    return len - 4;
+#endif
+
+EXIT :
+    *pbEndOfFrame = OMX_FALSE;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "2. Check_Wmv_Frame returned EOF = %d, len = %d, buffSize = %d", *pbEndOfFrame, len - 1, buffSize);
+
+    return --len;
+}
+
+OMX_BOOL Check_Stream_PrefixCode(OMX_U8 *pInputStream, OMX_U32 streamSize, WMV_FORMAT wmvFormat)
+{
+    switch (wmvFormat) {
+    case WMV_FORMAT_WMV3:
+        if (streamSize > 0)
+            return OMX_TRUE;
+        else
+            return OMX_FALSE;
+        break;
+    case WMV_FORMAT_VC1:
+
+#ifdef WO_START_CODE
+        /* ASF parser does not send start code on OpenCORE */
+        if (streamSize > 3)
+            return OMX_TRUE;
+        else
+            return OMX_FALSE;
+        break;
+#else
+        /* TODO : for comformanc test based on common buffer scheme w/o parser */
+        if (streamSize < 3) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: streamSize is too small (%d)", __FUNCTION__, streamSize);
+            return OMX_FALSE;
+        } else if ((pInputStream[0] == 0x00) &&
+                   (pInputStream[1] == 0x00) &&
+                   (pInputStream[2] == 0x01)) {
+            return OMX_TRUE;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: Cannot find prefix", __FUNCTION__);
+            return OMX_FALSE;
+        }
+#endif
+        break;
+
+    default:
+        SEC_OSAL_Log(SEC_LOG_WARNING, "%s: undefined wmvFormat (%d)", __FUNCTION__, wmvFormat);
+        return OMX_FALSE;
+        break;
+    }
+}
+
+OMX_BOOL Make_Stream_MetaData(OMX_U8 *pInputStream, OMX_U32 *pStreamSize, WMV_FORMAT wmvFormat)
+{
+    OMX_U32 width, height;
+    OMX_U8  *pCurrBuf = pInputStream;
+    OMX_U32 currPos = 0;
+
+    FunctionIn();
+
+    /* Sequence Layer Data Structure */
+    OMX_U8 const_C5[4] = {0x00, 0x00, 0x00, 0xc5};
+    OMX_U8 const_04[4] = {0x04, 0x00, 0x00, 0x00};
+    OMX_U8 const_0C[4] = {0x0C, 0x00, 0x00, 0x00};
+    OMX_U8 struct_B_1[4] = {0xB3, 0x19, 0x00, 0x00};
+    OMX_U8 struct_B_2[4] = {0x44, 0x62, 0x05, 0x00};
+    OMX_U8 struct_B_3[4] = {0x0F, 0x00, 0x00, 0x00};
+    OMX_U8 struct_C[4] = {0x30, 0x00, 0x00, 0x00};
+
+    switch (wmvFormat) {
+    case WMV_FORMAT_WMV3:
+        if (*pStreamSize >= BITMAPINFOHEADER_SIZE) {
+            BitmapInfoHhr *pBitmapInfoHeader;
+            pBitmapInfoHeader = (BitmapInfoHhr *)pInputStream;
+
+            width = pBitmapInfoHeader->BiWidth;
+            height = pBitmapInfoHeader->BiHeight;
+            if (*pStreamSize > BITMAPINFOHEADER_SIZE)
+                SEC_OSAL_Memcpy(struct_C, pInputStream+BITMAPINFOHEADER_SIZE, 4);
+
+            SEC_OSAL_Memcpy(pCurrBuf + currPos, const_C5, 4);
+            currPos +=4;
+
+            SEC_OSAL_Memcpy(pCurrBuf + currPos, const_04, 4);
+            currPos +=4;
+
+            SEC_OSAL_Memcpy(pCurrBuf + currPos, struct_C, 4);
+            currPos +=4;
+
+            /* struct_A : VERT_SIZE */
+            pCurrBuf[currPos] =  height & 0xFF;
+            pCurrBuf[currPos+1] = (height>>8) & 0xFF;
+            pCurrBuf[currPos+2] = (height>>16) & 0xFF;
+            pCurrBuf[currPos+3] = (height>>24) & 0xFF;
+            currPos +=4;
+
+            /* struct_A : HORIZ_SIZE */
+            pCurrBuf[currPos] =  width & 0xFF;
+            pCurrBuf[currPos+1] = (width>>8) & 0xFF;
+            pCurrBuf[currPos+2] = (width>>16) & 0xFF;
+            pCurrBuf[currPos+3] = (width>>24) & 0xFF;
+            currPos +=4;
+
+            SEC_OSAL_Memcpy(pCurrBuf + currPos,const_0C, 4);
+            currPos +=4;
+
+            SEC_OSAL_Memcpy(pCurrBuf + currPos, struct_B_1, 4);
+            currPos +=4;
+
+            SEC_OSAL_Memcpy(pCurrBuf + currPos, struct_B_2, 4);
+            currPos +=4;
+
+            SEC_OSAL_Memcpy(pCurrBuf + currPos, struct_B_3, 4);
+            currPos +=4;
+
+            *pStreamSize = currPos;
+            return OMX_TRUE;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: *pStreamSize is too small to contain metadata(%d)", __FUNCTION__, *pStreamSize);
+            return OMX_FALSE;
+        }
+        break;
+    case WMV_FORMAT_VC1:
+        if (*pStreamSize >= BITMAPINFOHEADER_ASFBINDING_SIZE) {
+            SEC_OSAL_Memcpy(pCurrBuf, pInputStream + BITMAPINFOHEADER_ASFBINDING_SIZE, *pStreamSize - BITMAPINFOHEADER_ASFBINDING_SIZE);
+            *pStreamSize -= BITMAPINFOHEADER_ASFBINDING_SIZE;
+            return OMX_TRUE;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: *pStreamSize is too small to contain metadata(%d)", __FUNCTION__, *pStreamSize);
+            return OMX_FALSE;
+        }
+        break;
+    default:
+        SEC_OSAL_Log(SEC_LOG_WARNING, "%s: It is not necessary to make bitstream metadata for wmvFormat (%d)", __FUNCTION__, wmvFormat);
+        return OMX_FALSE;
+        break;
+    }
+}
+
+#ifdef WO_START_CODE
+OMX_BOOL Make_Stream_StartCode(OMX_U8 *pInputStream, OMX_U32 streamSize, WMV_FORMAT wmvFormat)
+{
+    OMX_U8  frameStartCode[4] = {0x00, 0x00, 0x01, 0x0d};
+    OMX_U32 i;
+
+    switch (wmvFormat) {
+    case WMV_FORMAT_WMV3:
+        return OMX_TRUE;
+        break;
+
+    case WMV_FORMAT_VC1:
+        /* Should find better way to shift data */
+        SEC_OSAL_Memmove(pInputStream+4, pInputStream, streamSize);
+        SEC_OSAL_Memcpy(pInputStream, frameStartCode, 4);
+
+        return OMX_TRUE;
+        break;
+
+    default:
+        SEC_OSAL_Log(SEC_LOG_WARNING, "%s: undefined wmvFormat (%d)", __FUNCTION__, wmvFormat);
+        return OMX_FALSE;
+        break;
+    }
+}
+#endif
+
+OMX_ERRORTYPE SEC_MFC_WmvDec_GetParameter(
+    OMX_IN    OMX_HANDLETYPE hComponent,
+    OMX_IN    OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE         ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamVideoWmv:
+    {
+        OMX_VIDEO_PARAM_WMVTYPE *pDstWmvParam = (OMX_VIDEO_PARAM_WMVTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_WMVTYPE *pSrcWmvParam = NULL;
+        SEC_WMV_HANDLE          *pWmvDec = NULL;
+        ret = SEC_OMX_Check_SizeVersion(pDstWmvParam, sizeof(OMX_VIDEO_PARAM_WMVTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstWmvParam->nPortIndex > OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+        }
+
+        pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcWmvParam = &pWmvDec->WmvComponent[pDstWmvParam->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstWmvParam, pSrcWmvParam, sizeof(OMX_VIDEO_PARAM_WMVTYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+            if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_WMV_DEC_ROLE);
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = NULL;
+        SEC_WMV_HANDLE                      *pWmvDec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstErrorCorrectionType->nPortIndex != INPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcErrorCorrectionType = &pWmvDec->errorCorrectionType[INPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_WmvDec_SetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamVideoWmv:
+    {
+        OMX_VIDEO_PARAM_WMVTYPE *pDstWmvParam = NULL;
+        OMX_VIDEO_PARAM_WMVTYPE *pSrcWmvParam = (OMX_VIDEO_PARAM_WMVTYPE *)pComponentParameterStructure;
+        SEC_WMV_HANDLE          *pWmvDec = NULL;
+        ret = SEC_OMX_Check_SizeVersion(pSrcWmvParam, sizeof(OMX_VIDEO_PARAM_WMVTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcWmvParam->nPortIndex > OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstWmvParam = &pWmvDec->WmvComponent[pSrcWmvParam->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstWmvParam, pSrcWmvParam, sizeof(OMX_VIDEO_PARAM_WMVTYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+
+        if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_WMV_DEC_ROLE)) {
+            pSECComponent->pSECPort[INPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingWMV;
+        } else {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+    }
+        break;
+    case OMX_IndexParamPortDefinition:
+    {
+        OMX_PARAM_PORTDEFINITIONTYPE *pPortDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)pComponentParameterStructure;
+        OMX_U32                       portIndex = pPortDefinition->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort;
+        OMX_U32 width, height, size;
+        OMX_U32 realWidth, realHeight;
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+        ret = SEC_OMX_Check_SizeVersion(pPortDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            if (pSECPort->portDefinition.bEnabled == OMX_TRUE) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+        }
+        if (pPortDefinition->nBufferCountActual < pSECPort->portDefinition.nBufferCountMin) {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+
+        SEC_OSAL_Memcpy(&pSECPort->portDefinition, pPortDefinition, pPortDefinition->nSize);
+
+        realWidth = pSECPort->portDefinition.format.video.nFrameWidth;
+        realHeight = pSECPort->portDefinition.format.video.nFrameHeight;
+        width = ((realWidth + 15) & (~15));
+        height = ((realHeight + 15) & (~15));
+        size = (width * height * 3) / 2;
+        pSECPort->portDefinition.format.video.nStride = width;
+        pSECPort->portDefinition.format.video.nSliceHeight = height;
+        pSECPort->portDefinition.nBufferSize = (size > pSECPort->portDefinition.nBufferSize) ? size : pSECPort->portDefinition.nBufferSize;
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+            pSECOutputPort->portDefinition.format.video.nFrameWidth = pSECPort->portDefinition.format.video.nFrameWidth;
+            pSECOutputPort->portDefinition.format.video.nFrameHeight = pSECPort->portDefinition.format.video.nFrameHeight;
+            pSECOutputPort->portDefinition.format.video.nStride = width;
+            pSECOutputPort->portDefinition.format.video.nSliceHeight = height;
+
+            switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+            case OMX_COLOR_FormatYUV420Planar:
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+            case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+            case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                pSECOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
+                break;
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                pSECOutputPort->portDefinition.nBufferSize =
+                    ALIGN_TO_8KB(ALIGN_TO_128B(realWidth) * ALIGN_TO_32B(realHeight)) \
+                  + ALIGN_TO_8KB(ALIGN_TO_128B(realWidth) * ALIGN_TO_32B(realHeight/2));
+                break;
+            default:
+                SEC_OSAL_Log(SEC_LOG_ERROR, "Color format is not support!! use default YUV size!!");
+                ret = OMX_ErrorUnsupportedSetting;
+                break;
+            }
+        }
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = NULL;
+        SEC_WMV_HANDLE                      *pWmvDec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcErrorCorrectionType->nPortIndex != INPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstErrorCorrectionType = &pWmvDec->errorCorrectionType[INPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_WmvDec_GetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_VideoDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_WmvDec_SetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_VideoDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_WmvDec_GetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_ENABLE_THUMBNAIL) == 0) {
+        SEC_WMV_HANDLE *pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+        *pIndexType = OMX_IndexVendorThumbnailMode;
+
+        ret = OMX_ErrorNone;
+    } else {
+        ret = SEC_OMX_VideoDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_WmvDec_ComponentRoleEnum(
+    OMX_IN  OMX_HANDLETYPE hComponent,
+    OMX_OUT OMX_U8        *cRole,
+    OMX_IN  OMX_U32        nIndex)
+{
+    OMX_ERRORTYPE         ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (cRole == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (nIndex == (MAX_COMPONENT_ROLE_NUM-1)) {
+        SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_WMV_DEC_ROLE);
+        ret = OMX_ErrorNone;
+    } else {
+        ret = OMX_ErrorUnsupportedIndex;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_DecodeThread(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_WMV_HANDLE        *pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    while (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+        SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameStart);
+
+        if (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStart(PERF_ID_DEC);
+#endif
+            pWmvDec->hMFCWmvHandle.returnCodec = SsbSipMfcDecExe(pWmvDec->hMFCWmvHandle.hMFCHandle, pVideoDec->NBDecThread.oneFrameSize);
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStop(PERF_ID_DEC);
+#endif
+            SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameEnd);
+        }
+    }
+
+EXIT:
+    SEC_OSAL_ThreadExit(NULL);
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Init */
+OMX_ERRORTYPE SEC_MFC_WmvDec_Init(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT      *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_WMV_HANDLE        *pWmvDec = NULL;
+    OMX_HANDLETYPE         hMFCHandle = NULL;
+    OMX_PTR                pStreamBuffer = NULL;
+    OMX_PTR                pStreamPhyBuffer = NULL;
+    CSC_METHOD csc_method = CSC_METHOD_SW;
+
+    FunctionIn();
+
+#ifdef CONFIG_MFC_FPS
+    SEC_OSAL_PerfInit(PERF_ID_DEC);
+    SEC_OSAL_PerfInit(PERF_ID_CSC);
+#endif
+
+    pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pWmvDec->hMFCWmvHandle.bConfiguredMFC = OMX_FALSE;
+    pSECComponent->bUseFlagEOF = OMX_FALSE;
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+
+    /* MFC(Multi Format Codec) decoder and CMM(Codec Memory Management) driver open */
+    if (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) {
+        hMFCHandle = (OMX_PTR)SsbSipMfcDecOpen();
+    } else {
+        SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+        hMFCHandle = (OMX_PTR)SsbSipMfcDecOpenExt(&buf_type);
+    }
+
+    if (hMFCHandle == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    ghMFCHandle = pWmvDec->hMFCWmvHandle.hMFCHandle = hMFCHandle;
+
+    /* Allocate decoder's input buffer */
+    /* Get first input buffer */
+    pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE / 2);
+    if (pStreamBuffer == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoDec->MFCDecInputBuffer[0].VirAddr = pStreamBuffer;
+    pVideoDec->MFCDecInputBuffer[0].PhyAddr = pStreamPhyBuffer;
+    pVideoDec->MFCDecInputBuffer[0].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE / 2;
+    pVideoDec->MFCDecInputBuffer[0].dataSize = 0;
+
+#ifdef NONBLOCK_MODE_PROCESS
+    /* Get second input buffer */
+    pStreamBuffer = NULL;
+    pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE / 2);
+    if (pStreamBuffer == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoDec->MFCDecInputBuffer[1].VirAddr = pStreamBuffer;
+    pVideoDec->MFCDecInputBuffer[1].PhyAddr = pStreamPhyBuffer;
+    pVideoDec->MFCDecInputBuffer[1].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE / 2;
+    pVideoDec->MFCDecInputBuffer[1].dataSize = 0;
+    pVideoDec->indexInputBuffer = 0;
+
+    pVideoDec->bFirstFrame = OMX_TRUE;
+
+    pVideoDec->NBDecThread.bExitDecodeThread = OMX_FALSE;
+    pVideoDec->NBDecThread.bDecoderRun = OMX_FALSE;
+    pVideoDec->NBDecThread.oneFrameSize = 0;
+    SEC_OSAL_SemaphoreCreate(&(pVideoDec->NBDecThread.hDecFrameStart));
+    SEC_OSAL_SemaphoreCreate(&(pVideoDec->NBDecThread.hDecFrameEnd));
+    if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pVideoDec->NBDecThread.hNBDecodeThread,
+                                                SEC_MFC_DecodeThread,
+                                                pOMXComponent)) {
+        pWmvDec->hMFCWmvHandle.returnCodec = MFC_RET_OK;
+    }
+#endif
+
+    pWmvDec->hMFCWmvHandle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[0].VirAddr;
+    pWmvDec->hMFCWmvHandle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[0].PhyAddr;
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[0].VirAddr;
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[0].bufferSize;
+
+    SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+    SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+    pWmvDec->hMFCWmvHandle.indexTimestamp = 0;
+    pWmvDec->hMFCWmvHandle.outputIndexTimestamp = 0;
+    pSECComponent->getAllDelayBuffer = OMX_FALSE;
+
+#ifdef USE_ANB
+#if defined(USE_CSC_FIMC) || defined(USE_CSC_GSCALER)
+    if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+        csc_method = CSC_METHOD_PREFER_HW;
+    }
+#endif
+#endif
+    pVideoDec->csc_handle = csc_init(&csc_method);
+    pVideoDec->csc_set_format = OMX_FALSE;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Terminate */
+OMX_ERRORTYPE SEC_MFC_WmvDec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_WMV_HANDLE        *pWmvDec = NULL;
+    OMX_HANDLETYPE         hMFCHandle = NULL;
+
+    FunctionIn();
+
+#ifdef CONFIG_MFC_FPS
+    SEC_OSAL_PerfPrint("[DEC]",  PERF_ID_DEC);
+    SEC_OSAL_PerfPrint("[CSC]",  PERF_ID_CSC);
+#endif
+
+    pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    hMFCHandle = pWmvDec->hMFCWmvHandle.hMFCHandle;
+
+    pWmvDec->hMFCWmvHandle.pMFCStreamBuffer    = NULL;
+    pWmvDec->hMFCWmvHandle.pMFCStreamPhyBuffer = NULL;
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = NULL;
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = 0;
+
+#ifdef NONBLOCK_MODE_PROCESS
+        if (pVideoDec->NBDecThread.hNBDecodeThread != NULL) {
+            pVideoDec->NBDecThread.bExitDecodeThread = OMX_TRUE;
+            SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameStart);
+            SEC_OSAL_ThreadTerminate(pVideoDec->NBDecThread.hNBDecodeThread);
+            pVideoDec->NBDecThread.hNBDecodeThread = NULL;
+        }
+
+        if(pVideoDec->NBDecThread.hDecFrameEnd != NULL) {
+            SEC_OSAL_SemaphoreTerminate(pVideoDec->NBDecThread.hDecFrameEnd);
+            pVideoDec->NBDecThread.hDecFrameEnd = NULL;
+        }
+
+        if(pVideoDec->NBDecThread.hDecFrameStart != NULL) {
+            SEC_OSAL_SemaphoreTerminate(pVideoDec->NBDecThread.hDecFrameStart);
+            pVideoDec->NBDecThread.hDecFrameStart = NULL;
+        }
+#endif
+
+    if (hMFCHandle != NULL) {
+        SsbSipMfcDecClose(hMFCHandle);
+        pWmvDec->hMFCWmvHandle.hMFCHandle = NULL;
+    }
+
+    if (pVideoDec->csc_handle != NULL) {
+        csc_deinit(pVideoDec->csc_handle);
+        pVideoDec->csc_handle = NULL;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Wmv_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT           *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT           *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_WMV_HANDLE             *pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    OMX_U32                     oneFrameSize = pInputData->dataLen;
+    SSBSIP_MFC_DEC_OUTPUT_INFO  outputInfo;
+    OMX_S32                     configValue = 0;
+    OMX_BOOL                    bMetaData = OMX_FALSE;
+    OMX_BOOL                    bStartCode = OMX_FALSE;
+    int                         bufWidth = 0;
+    int                         bufHeight = 0;
+    OMX_U32                     FrameBufferYSize = 0;
+    OMX_U32                     FrameBufferUVSize = 0;
+    OMX_BOOL                    outputDataValid = OMX_FALSE;
+
+    FunctionIn();
+
+    if (pWmvDec->hMFCWmvHandle.bConfiguredMFC == OMX_FALSE) {
+        SSBSIP_MFC_CODEC_TYPE MFCCodecType;
+
+        if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+
+        if (pWmvDec->hMFCWmvHandle.wmvFormat == WMV_FORMAT_WMV3)
+            MFCCodecType = VC1RCV_DEC;
+        else if (pWmvDec->hMFCWmvHandle.wmvFormat == WMV_FORMAT_VC1)
+            MFCCodecType = VC1_DEC;
+        else
+            MFCCodecType = UNKNOWN_TYPE;
+
+        SEC_OSAL_Log(SEC_LOG_TRACE, "codec type = %d", MFCCodecType);
+
+        if (pVideoDec->bThumbnailMode == OMX_TRUE) {
+            configValue = 0;    // the number that you want to delay
+            SsbSipMfcDecSetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &configValue);
+        } else {
+            configValue = WMV_DEC_NUM_OF_EXTRA_BUFFERS;
+            SsbSipMfcDecSetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &configValue);
+        }
+
+        bMetaData = Make_Stream_MetaData(pInputData->dataBuffer, &oneFrameSize, pWmvDec->hMFCWmvHandle.wmvFormat);
+        if (bMetaData == OMX_FALSE) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "Fail to Make Stream MetaData");
+            ret = OMX_ErrorMFCInit;
+            goto EXIT;
+        }
+
+        SsbSipMfcDecSetInBuf(pWmvDec->hMFCWmvHandle.hMFCHandle,
+                             pWmvDec->hMFCWmvHandle.pMFCStreamPhyBuffer,
+                             pWmvDec->hMFCWmvHandle.pMFCStreamBuffer,
+                             pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        pWmvDec->hMFCWmvHandle.returnCodec = SsbSipMfcDecInit(pWmvDec->hMFCWmvHandle.hMFCHandle, MFCCodecType, oneFrameSize);
+        if (pWmvDec->hMFCWmvHandle.returnCodec == MFC_RET_OK) {
+            SSBSIP_MFC_IMG_RESOLUTION imgResol;
+
+            if (SsbSipMfcDecGetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol) != MFC_RET_OK) {
+                ret = OMX_ErrorMFCInit;
+                SEC_OSAL_Log(SEC_LOG_ERROR, "SsbSipMfcDecGetConfig failed");
+                goto EXIT;
+            }
+
+            SEC_OSAL_Log(SEC_LOG_TRACE, "## nFrameWidth(%d) nFrameHeight(%d), nStride(%d), nSliceHeight(%d)",
+                pSECInputPort->portDefinition.format.video.nFrameWidth, pSECInputPort->portDefinition.format.video.nFrameHeight,
+                pSECInputPort->portDefinition.format.video.nStride, pSECInputPort->portDefinition.format.video.nSliceHeight);
+
+            /** Update Frame Size **/
+            if ((pSECInputPort->portDefinition.format.video.nFrameWidth != (unsigned int)imgResol.width) ||
+               (pSECInputPort->portDefinition.format.video.nFrameHeight != (unsigned int)imgResol.height)) {
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_OSAL_Log(SEC_LOG_TRACE, "nFrameWidth(%d) nFrameHeight(%d), nStride(%d), nSliceHeight(%d)",
+                    pSECInputPort->portDefinition.format.video.nFrameWidth, pSECInputPort->portDefinition.format.video.nFrameHeight,
+                    pSECInputPort->portDefinition.format.video.nStride, pSECInputPort->portDefinition.format.video.nSliceHeight);
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /* Send Port Settings changed call back */
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, // The command was completed
+                       OMX_DirOutput, // This is the port index
+                       0,
+                       NULL);
+            }
+
+            pWmvDec->hMFCWmvHandle.bConfiguredMFC = OMX_TRUE;
+
+            if (pWmvDec->hMFCWmvHandle.wmvFormat == WMV_FORMAT_WMV3) {
+                pOutputData->timeStamp = pInputData->timeStamp;
+                pOutputData->nFlags = pInputData->nFlags;
+                ret = OMX_ErrorNone;
+            } else {
+
+#ifdef WO_START_CODE
+/* ASF parser does not send start code on OpenCORE */
+                pOutputData->timeStamp = pInputData->timeStamp;
+                pOutputData->nFlags = pInputData->nFlags;
+                ret = OMX_ErrorNone;
+#else
+/* TODO : for comformanc test based on common buffer scheme w/o parser */
+                pOutputData->dataLen = 0;
+                ret = OMX_ErrorInputDataDecodeYet;
+#endif
+            }
+            goto EXIT;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "SsbSipMfcDecInit failed");
+            ret = OMX_ErrorMFCInit;    /* OMX_ErrorUndefined */
+            goto EXIT;
+        }
+    }
+
+#ifndef FULL_FRAME_SEARCH
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+#endif
+
+    pSECComponent->timeStamp[pWmvDec->hMFCWmvHandle.indexTimestamp] = pInputData->timeStamp;
+    pSECComponent->nFlags[pWmvDec->hMFCWmvHandle.indexTimestamp] = pInputData->nFlags;
+
+    if ((pWmvDec->hMFCWmvHandle.returnCodec == MFC_RET_OK) && (pVideoDec->bFirstFrame == OMX_FALSE)) {
+        SSBSIP_MFC_DEC_OUTBUF_STATUS status;
+        OMX_S32 indexTimestamp = 0;
+
+        /* wait for mfc decode done */
+        if (pVideoDec->NBDecThread.bDecoderRun == OMX_TRUE) {
+            SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameEnd);
+            pVideoDec->NBDecThread.bDecoderRun = OMX_FALSE;
+        }
+
+        SEC_OSAL_SleepMillisec(0);
+        status = SsbSipMfcDecGetOutBuf(pWmvDec->hMFCWmvHandle.hMFCHandle, &outputInfo);
+            bufWidth = (outputInfo.img_width + 15) & (~15);
+            bufHeight = (outputInfo.img_height + 15) & (~15);
+            FrameBufferYSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height));
+            FrameBufferUVSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height/2));
+
+            if ((SsbSipMfcDecGetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+                (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+                pOutputData->timeStamp = pInputData->timeStamp;
+                pOutputData->nFlags = pInputData->nFlags;
+            } else {
+                /* For timestamp correction. if mfc support frametype detect */
+                SEC_OSAL_Log(SEC_LOG_TRACE, "disp_pic_frame_type: %d", outputInfo.disp_pic_frame_type);
+#ifdef NEED_TIMESTAMP_REORDER
+                if (outputInfo.disp_pic_frame_type == MFC_FRAME_TYPE_I_FRAME) {
+                    pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                    pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+                    pWmvDec->hMFCWmvHandle.outputIndexTimestamp = indexTimestamp;
+                } else {
+                    pOutputData->timeStamp = pSECComponent->timeStamp[pWmvDec->hMFCWmvHandle.outputIndexTimestamp];
+                    pOutputData->nFlags = pSECComponent->nFlags[pWmvDec->hMFCWmvHandle.outputIndexTimestamp];
+                }
+#else
+                pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+#endif
+            }
+
+            if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
+                (status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
+                outputDataValid = OMX_TRUE;
+                pWmvDec->hMFCWmvHandle.outputIndexTimestamp++;
+                pWmvDec->hMFCWmvHandle.outputIndexTimestamp %= MAX_TIMESTAMP;
+            }
+            if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+                outputDataValid = OMX_FALSE;
+
+            if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+                (pSECComponent->getAllDelayBuffer == OMX_TRUE))
+                ret = OMX_ErrorInputDataDecodeYet;
+
+            if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+                if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                    ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE))) {
+                    pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                    pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                    ret = OMX_ErrorInputDataDecodeYet;
+                } else {
+                    ret = OMX_ErrorNone;
+                }
+                outputDataValid = OMX_FALSE;
+            }
+
+#ifdef FULL_FRAME_SEARCH
+            if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+                pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else
+#endif
+            if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+                pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+                pSECComponent->getAllDelayBuffer = OMX_FALSE;
+                ret = OMX_ErrorNone;
+            }
+    } else {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
+            (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+        }
+
+        if ((pVideoDec->bFirstFrame == OMX_TRUE) &&
+            ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+            ((pInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) != OMX_BUFFERFLAG_CODECCONFIG)) {
+            pOutputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+        }
+
+        outputDataValid = OMX_FALSE;
+
+        /* ret = OMX_ErrorUndefined; */
+        ret = OMX_ErrorNone;
+    }
+
+#ifdef WO_START_CODE
+    if (pInputData->allocSize < oneFrameSize+4) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "Can't attach startcode due to lack of buffer space");
+        ret = OMX_ErrorMFCInit;
+        goto EXIT;
+    }
+
+    bStartCode = Make_Stream_StartCode(pInputData->dataBuffer, oneFrameSize, pWmvDec->hMFCWmvHandle.wmvFormat);
+    if (bStartCode == OMX_FALSE) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "Fail to Make Stream Start Code");
+        ret = OMX_ErrorMFCInit;
+        goto EXIT;
+    }
+#endif
+
+    if (ret == OMX_ErrorInputDataDecodeYet) {
+        pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize = oneFrameSize;
+        pVideoDec->indexInputBuffer++;
+        pVideoDec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+        pWmvDec->hMFCWmvHandle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pWmvDec->hMFCWmvHandle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].PhyAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].bufferSize;
+        oneFrameSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize;
+        //pInputData->dataLen = oneFrameSize;
+        //pInputData->remainDataLen = oneFrameSize;
+    }
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SsbSipMfcDecExe oneFrameSize = %d", oneFrameSize);
+
+    if ((Check_Stream_PrefixCode(pInputData->dataBuffer, oneFrameSize, pWmvDec->hMFCWmvHandle.wmvFormat) == OMX_TRUE) &&
+        ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS)) {
+        if ((ret != OMX_ErrorInputDataDecodeYet) || (pSECComponent->getAllDelayBuffer == OMX_TRUE)) {
+            SsbSipMfcDecSetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pWmvDec->hMFCWmvHandle.indexTimestamp));
+            pWmvDec->hMFCWmvHandle.indexTimestamp++;
+            pWmvDec->hMFCWmvHandle.indexTimestamp %= MAX_TIMESTAMP;
+        }
+
+        SsbSipMfcDecSetInBuf(pWmvDec->hMFCWmvHandle.hMFCHandle,
+                             pWmvDec->hMFCWmvHandle.pMFCStreamPhyBuffer,
+                             pWmvDec->hMFCWmvHandle.pMFCStreamBuffer,
+                             pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize = oneFrameSize;
+#ifdef WO_START_CODE
+        pVideoDec->NBDecThread.oneFrameSize = oneFrameSize + 4; /* Frame Start Code */
+#else
+        pVideoDec->NBDecThread.oneFrameSize = oneFrameSize;
+#endif
+        /* mfc decode start */
+        SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameStart);
+        pVideoDec->NBDecThread.bDecoderRun = OMX_TRUE;
+        pWmvDec->hMFCWmvHandle.returnCodec = MFC_RET_OK;
+
+        SEC_OSAL_SleepMillisec(0);
+
+        pVideoDec->indexInputBuffer++;
+        pVideoDec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+        pWmvDec->hMFCWmvHandle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pWmvDec->hMFCWmvHandle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].PhyAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].bufferSize;
+
+        if ((pVideoDec->bFirstFrame == OMX_TRUE) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE) &&
+            (outputDataValid == OMX_FALSE)) {
+            ret = OMX_ErrorInputDataDecodeYet;
+        }
+
+        pVideoDec->bFirstFrame = OMX_FALSE;
+    } else {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE)
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+    }
+
+    /** Fill Output Buffer **/
+    if (outputDataValid == OMX_TRUE) {
+        SEC_OMX_BASEPORT *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+        SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+        void *pOutputBuf = (void *)pOutputData->dataBuffer;
+        void *pSrcBuf[3] = {NULL, };
+        void *pYUVBuf[3] = {NULL, };
+        unsigned int csc_src_color_format, csc_dst_color_format;
+        CSC_METHOD csc_method = CSC_METHOD_SW;
+        unsigned int cacheable = 1;
+
+        int frameSize = bufWidth * bufHeight;
+        int width = outputInfo.img_width;
+        int height = outputInfo.img_height;
+        int imageSize = outputInfo.img_width * outputInfo.img_height;
+
+        pSrcBuf[0] = outputInfo.YVirAddr;
+        pSrcBuf[1] = outputInfo.CVirAddr;
+
+        pYUVBuf[0]  = (unsigned char *)pOutputBuf;
+        pYUVBuf[1]  = (unsigned char *)pOutputBuf + imageSize;
+        pYUVBuf[2]  = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
+        pOutputData->dataLen = (imageSize * 3) / 2;
+
+#ifdef USE_ANB
+        if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+            OMX_U32 stride;
+            SEC_OSAL_LockANB(pOutputData->dataBuffer, width, height, pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat, &stride, pYUVBuf);
+            width = stride;
+            pOutputData->dataLen = sizeof(void *);
+        }
+#endif
+        if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
+            (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
+            /* if use Post copy address structure */
+            SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+            pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height * 3) / 2;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStart(PERF_ID_CSC);
+#endif
+            switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
+                SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + FrameBufferYSize, outputInfo.CVirAddr, FrameBufferUVSize);
+                pOutputData->dataLen = FrameBufferYSize + FrameBufferUVSize;
+                break;
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+            case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                break;
+            case OMX_COLOR_FormatYUV420Planar:
+            default:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                break;
+            }
+
+            csc_get_method(pVideoDec->csc_handle, &csc_method);
+#ifdef USE_CSC_FIMC
+            if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
+                SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
+                pSrcBuf[0] = outputInfo.YPhyAddr;
+                pSrcBuf[1] = outputInfo.CPhyAddr;
+            }
+#endif
+            if (pVideoDec->csc_set_format == OMX_FALSE) {
+                csc_set_src_format(
+                    pVideoDec->csc_handle,  /* handle */
+                    width,                  /* width */
+                    height,                 /* height */
+                    0,                      /* crop_left */
+                    0,                      /* crop_right */
+                    width,                  /* crop_width */
+                    height,                 /* crop_height */
+                    csc_src_color_format,   /* color_format */
+                    cacheable);             /* cacheable */
+                csc_set_dst_format(
+                    pVideoDec->csc_handle,  /* handle */
+                    width,                  /* width */
+                    height,                 /* height */
+                    0,                      /* crop_left */
+                    0,                      /* crop_right */
+                    width,                  /* crop_width */
+                    height,                 /* crop_height */
+                    csc_dst_color_format,   /* color_format */
+                    cacheable);             /* cacheable */
+                pVideoDec->csc_set_format = OMX_TRUE;
+            }
+            csc_set_src_buffer(
+                pVideoDec->csc_handle,  /* handle */
+                pSrcBuf[0],             /* y addr */
+                pSrcBuf[1],             /* u addr or uv addr */
+                pSrcBuf[2],             /* v addr or none */
+                0);                     /* ion fd */
+            csc_set_dst_buffer(
+                pVideoDec->csc_handle,
+                pYUVBuf[0],             /* y addr */
+                pYUVBuf[1],             /* u addr or uv addr */
+                pYUVBuf[2],             /* v addr or none */
+                0);                     /* ion fd */
+            csc_convert(pVideoDec->csc_handle);
+
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStop(PERF_ID_CSC);
+#endif
+        }
+#ifdef USE_ANB
+        if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+            SEC_OSAL_UnlockANB(pOutputData->dataBuffer);
+        }
+#endif
+    } else {
+        pOutputData->dataLen = 0;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Wmv_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT           *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT           *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_WMV_HANDLE             *pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    OMX_U32                     oneFrameSize = pInputData->dataLen;
+    SSBSIP_MFC_DEC_OUTPUT_INFO  outputInfo;
+    OMX_S32                     configValue = 0;
+    OMX_S32                     returnCodec = 0;
+    OMX_BOOL                    bMetaData = OMX_FALSE;
+    OMX_BOOL                    bStartCode = OMX_FALSE;
+    int                         bufWidth = 0;
+    int                         bufHeight = 0;
+    OMX_U32                     FrameBufferYSize;
+    OMX_U32                     FrameBufferUVSize;
+
+    FunctionIn();
+
+    if (pWmvDec->hMFCWmvHandle.bConfiguredMFC == OMX_FALSE) {
+        SSBSIP_MFC_CODEC_TYPE MFCCodecType;
+
+        if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+
+        if (pWmvDec->hMFCWmvHandle.wmvFormat == WMV_FORMAT_WMV3)
+            MFCCodecType = VC1RCV_DEC;
+        else if (pWmvDec->hMFCWmvHandle.wmvFormat == WMV_FORMAT_VC1)
+            MFCCodecType = VC1_DEC;
+        else
+            MFCCodecType = UNKNOWN_TYPE;
+
+        SEC_OSAL_Log(SEC_LOG_TRACE, "codec type = %d", MFCCodecType);
+
+        if (pVideoDec->bThumbnailMode == OMX_TRUE) {
+            configValue = 0;    // the number that you want to delay
+            SsbSipMfcDecSetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &configValue);
+        } else {
+            configValue = WMV_DEC_NUM_OF_EXTRA_BUFFERS;
+            SsbSipMfcDecSetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &configValue);
+        }
+
+        bMetaData = Make_Stream_MetaData(pInputData->dataBuffer, &oneFrameSize, pWmvDec->hMFCWmvHandle.wmvFormat);
+        if (bMetaData == OMX_FALSE) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "Fail to Make Stream MetaData");
+            ret = OMX_ErrorMFCInit;
+            goto EXIT;
+        }
+
+        returnCodec = SsbSipMfcDecInit(pWmvDec->hMFCWmvHandle.hMFCHandle, MFCCodecType, oneFrameSize);
+        if (returnCodec == MFC_RET_OK) {
+            SSBSIP_MFC_IMG_RESOLUTION imgResol;
+
+            if (SsbSipMfcDecGetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol) != MFC_RET_OK) {
+                ret = OMX_ErrorMFCInit;
+                SEC_OSAL_Log(SEC_LOG_ERROR, "SsbSipMfcDecGetConfig failed");
+                goto EXIT;
+            }
+
+            SEC_OSAL_Log(SEC_LOG_TRACE, "## nFrameWidth(%d) nFrameHeight(%d), nStride(%d), nSliceHeight(%d)",
+                pSECInputPort->portDefinition.format.video.nFrameWidth, pSECInputPort->portDefinition.format.video.nFrameHeight,
+                pSECInputPort->portDefinition.format.video.nStride, pSECInputPort->portDefinition.format.video.nSliceHeight);
+
+            /** Update Frame Size **/
+            if ((pSECInputPort->portDefinition.format.video.nFrameWidth != (unsigned int)imgResol.width) ||
+               (pSECInputPort->portDefinition.format.video.nFrameHeight != (unsigned int)imgResol.height)) {
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_OSAL_Log(SEC_LOG_TRACE, "nFrameWidth(%d) nFrameHeight(%d), nStride(%d), nSliceHeight(%d)",
+                    pSECInputPort->portDefinition.format.video.nFrameWidth, pSECInputPort->portDefinition.format.video.nFrameHeight,
+                    pSECInputPort->portDefinition.format.video.nStride, pSECInputPort->portDefinition.format.video.nSliceHeight);
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /* Send Port Settings changed call back */
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, // The command was completed
+                       OMX_DirOutput, // This is the port index
+                       0,
+                       NULL);
+            }
+
+            pWmvDec->hMFCWmvHandle.bConfiguredMFC = OMX_TRUE;
+
+            if (pWmvDec->hMFCWmvHandle.wmvFormat == WMV_FORMAT_WMV3) {
+                pOutputData->timeStamp = pInputData->timeStamp;
+                pOutputData->nFlags = pInputData->nFlags;
+                ret = OMX_ErrorNone;
+            } else {
+
+#ifdef WO_START_CODE
+/* ASF parser does not send start code on OpenCORE */
+                pOutputData->timeStamp = pInputData->timeStamp;
+                pOutputData->nFlags = pInputData->nFlags;
+                ret = OMX_ErrorNone;
+#else
+/* TODO : for comformanc test based on common buffer scheme w/o parser */
+                pOutputData->dataLen = 0;
+                ret = OMX_ErrorInputDataDecodeYet;
+#endif
+            }
+            goto EXIT;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "SsbSipMfcDecInit failed");
+            ret = OMX_ErrorMFCInit;    /* OMX_ErrorUndefined */
+            goto EXIT;
+        }
+    }
+
+#ifndef FULL_FRAME_SEARCH
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+#endif
+
+#ifdef WO_START_CODE
+    if (pInputData->allocSize < oneFrameSize+4) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "Can't attach startcode due to lack of buffer space");
+        ret = OMX_ErrorMFCInit;
+        goto EXIT;
+    }
+
+    bStartCode = Make_Stream_StartCode(pInputData->dataBuffer, oneFrameSize, pWmvDec->hMFCWmvHandle.wmvFormat);
+    if (bStartCode == OMX_FALSE) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "Fail to Make Stream Start Code");
+        ret = OMX_ErrorMFCInit;
+        goto EXIT;
+    }
+#endif
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SsbSipMfcDecExe oneFrameSize = %d", oneFrameSize);
+
+    if (Check_Stream_PrefixCode(pInputData->dataBuffer, pInputData->dataLen, pWmvDec->hMFCWmvHandle.wmvFormat) == OMX_TRUE) {
+        pSECComponent->timeStamp[pWmvDec->hMFCWmvHandle.indexTimestamp] = pInputData->timeStamp;
+        pSECComponent->nFlags[pWmvDec->hMFCWmvHandle.indexTimestamp] = pInputData->nFlags;
+        SsbSipMfcDecSetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pWmvDec->hMFCWmvHandle.indexTimestamp));
+
+#ifdef WO_START_CODE
+        returnCodec = SsbSipMfcDecExe(pWmvDec->hMFCWmvHandle.hMFCHandle, oneFrameSize+4); /* Frame Start Code */
+#else
+        returnCodec = SsbSipMfcDecExe(pWmvDec->hMFCWmvHandle.hMFCHandle, oneFrameSize);
+#endif
+    } else {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE)
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+        returnCodec = MFC_RET_OK;
+        goto EXIT;
+    }
+
+    if (returnCodec == MFC_RET_OK) {
+        SSBSIP_MFC_DEC_OUTBUF_STATUS status;
+        OMX_S32 indexTimestamp = 0;
+
+        status = SsbSipMfcDecGetOutBuf(pWmvDec->hMFCWmvHandle.hMFCHandle, &outputInfo);
+        bufWidth = (outputInfo.img_width + 15) & (~15);
+        bufHeight = (outputInfo.img_height + 15) & (~15);
+        FrameBufferYSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height));
+        FrameBufferUVSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height/2));
+
+        if (status != MFC_GETOUTBUF_DISPLAY_ONLY) {
+            pWmvDec->hMFCWmvHandle.indexTimestamp++;
+            pWmvDec->hMFCWmvHandle.indexTimestamp %= MAX_TIMESTAMP;
+        }
+
+        if (SsbSipMfcDecGetConfig(pWmvDec->hMFCWmvHandle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            /* For timestamp correction. if mfc support frametype detect */
+            SEC_OSAL_Log(SEC_LOG_TRACE, "disp_pic_frame_type: %d", outputInfo.disp_pic_frame_type);
+#ifdef NEED_TIMESTAMP_REORDER
+            if (outputInfo.disp_pic_frame_type == MFC_FRAME_TYPE_I_FRAME) {
+                pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+                pWmvDec->hMFCWmvHandle.outputIndexTimestamp = indexTimestamp;
+            } else {
+                pOutputData->timeStamp = pSECComponent->timeStamp[pWmvDec->hMFCWmvHandle.outputIndexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[pWmvDec->hMFCWmvHandle.outputIndexTimestamp];
+            }
+#else
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+#endif
+        }
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
+            (status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
+            /** Fill Output Buffer **/
+            void *pOutputBuf = (void *)pOutputData->dataBuffer;
+            void *pSrcBuf[3] = {NULL, };
+            void *pYUVBuf[3] = {NULL, };
+            unsigned int csc_src_color_format, csc_dst_color_format;
+            CSC_METHOD csc_method = CSC_METHOD_SW;
+            unsigned int cacheable = 1;
+
+            int frameSize = bufWidth * bufHeight;
+            int width = outputInfo.img_width;
+            int height = outputInfo.img_height;
+            int imageSize = outputInfo.img_width * outputInfo.img_height;
+
+            pSrcBuf[0] = outputInfo.YVirAddr;
+            pSrcBuf[1] = outputInfo.CVirAddr;
+
+            pYUVBuf[0]  = (unsigned char *)pOutputBuf;
+            pYUVBuf[1]  = (unsigned char *)pOutputBuf + imageSize;
+            pYUVBuf[2]  = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
+            pOutputData->dataLen = (imageSize * 3) / 2;
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+                OMX_U32 stride;
+                SEC_OSAL_LockANB(pOutputData->dataBuffer, width, height, pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat, &stride, pYUVBuf);
+                width = stride;
+                pOutputData->dataLen = sizeof(void *);
+            }
+#endif
+            if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
+                (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
+                SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+                pOutputData->dataLen = (outputInfo.img_width * outputInfo.img_height * 3) / 2;
+            } else {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 out for ThumbnailMode");
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStart(PERF_ID_CSC);
+#endif
+                switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+                case OMX_SEC_COLOR_FormatNV12Tiled:
+                    SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
+                    SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + FrameBufferYSize, outputInfo.CVirAddr, FrameBufferUVSize);
+                    pOutputData->dataLen = FrameBufferYSize + FrameBufferUVSize;
+                    break;
+                case OMX_COLOR_FormatYUV420SemiPlanar:
+                case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                    csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                    csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                    break;
+                case OMX_COLOR_FormatYUV420Planar:
+                default:
+                    csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                    csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                    break;
+                }
+
+                csc_get_method(pVideoDec->csc_handle, &csc_method);
+#ifdef USE_CSC_FIMC
+                if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
+                    SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
+                    pSrcBuf[0] = outputInfo.YPhyAddr;
+                    pSrcBuf[1] = outputInfo.CPhyAddr;
+                }
+#endif
+                if (pVideoDec->csc_set_format == OMX_FALSE) {
+                    csc_set_src_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        width,                  /* width */
+                        height,                 /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        width,                  /* crop_width */
+                        height,                 /* crop_height */
+                        csc_src_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    csc_set_dst_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        width,                  /* width */
+                        height,                 /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        width,                  /* crop_width */
+                        height,                 /* crop_height */
+                        csc_dst_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    pVideoDec->csc_set_format = OMX_TRUE;
+                }
+                csc_set_src_buffer(
+                    pVideoDec->csc_handle,  /* handle */
+                    pSrcBuf[0],             /* y addr */
+                    pSrcBuf[1],             /* u addr or uv addr */
+                    pSrcBuf[2],             /* v addr or none */
+                    0);                     /* ion fd */
+                csc_set_dst_buffer(
+                    pVideoDec->csc_handle,
+                    pYUVBuf[0],             /* y addr */
+                    pYUVBuf[1],             /* u addr or uv addr */
+                    pYUVBuf[2],             /* v addr or none */
+                    0);                     /* ion fd */
+                csc_convert(pVideoDec->csc_handle);
+
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStop(PERF_ID_CSC);
+#endif
+            }
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+                SEC_OSAL_UnlockANB(pOutputData->dataBuffer);
+            }
+#endif
+            pWmvDec->hMFCWmvHandle.outputIndexTimestamp++;
+            pWmvDec->hMFCWmvHandle.outputIndexTimestamp %= MAX_TIMESTAMP;
+        }
+        if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+            pOutputData->dataLen = 0;
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE))
+            ret = OMX_ErrorInputDataDecodeYet;
+
+        if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+            if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE))) {
+                pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else {
+                ret = OMX_ErrorNone;
+            }
+            goto EXIT;
+        }
+
+#ifdef FULL_FRAME_SEARCH
+        if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+            pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else
+#endif
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            ret = OMX_ErrorNone;
+        }
+    } else {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
+            (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+        }
+        pOutputData->dataLen = 0;
+
+        /* ret = OMX_ErrorUndefined; */
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Decode */
+OMX_ERRORTYPE SEC_MFC_WmvDec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE         ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_WMV_HANDLE        *pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    SEC_OMX_BASEPORT      *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    OMX_BOOL              bCheckPrefix = OMX_FALSE;
+
+    FunctionIn();
+
+    if ((!CHECK_PORT_ENABLED(pSECInputPort)) || (!CHECK_PORT_ENABLED(pSECOutputPort)) ||
+        (!CHECK_PORT_POPULATED(pSECInputPort)) || (!CHECK_PORT_POPULATED(pSECOutputPort))) {
+        goto EXIT;
+    }
+    if (OMX_FALSE == SEC_Check_BufferProcess_State(pSECComponent)) {
+        goto EXIT;
+    }
+
+    pWmvDec->hMFCWmvHandle.wmvFormat = gWvmFormat;
+
+#ifdef NONBLOCK_MODE_PROCESS
+    ret = SEC_MFC_Wmv_Decode_Nonblock(pOMXComponent, pInputData, pOutputData);
+#else
+    ret = SEC_MFC_Wmv_Decode_Block(pOMXComponent, pInputData, pOutputData);
+#endif
+    if (ret != OMX_ErrorNone) {
+        if (ret == OMX_ErrorInputDataDecodeYet) {
+            pOutputData->usedDataLen = 0;
+            pOutputData->remainDataLen = pOutputData->dataLen;
+        } else {
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+                                                    pSECComponent->callbackData,
+                                                    OMX_EventError, ret, 0, NULL);
+        }
+    } else {
+        pInputData->previousDataLen = pInputData->dataLen;
+        pInputData->usedDataLen += pInputData->dataLen;
+        pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
+        pInputData->dataLen -= pInputData->usedDataLen;
+        pInputData->usedDataLen = 0;
+
+        pOutputData->usedDataLen = 0;
+        pOutputData->remainDataLen = pOutputData->dataLen;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
+{
+    OMX_ERRORTYPE         ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+    SEC_WMV_HANDLE        *pWmvDec = NULL;
+    OMX_S32               wmvFormat = WMV_FORMAT_UNKNOWN;
+    int i = 0;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (componentName == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "SEC_OMX_ComponentInit: parameters are null, ret:%X", ret);
+        goto EXIT;
+    }
+    if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_WMV_DEC, componentName) != 0) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, componentName:%s, Line:%d", componentName, __LINE__);
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_VideoDecodeComponentInit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "SEC_OMX_ComponentInit: SEC_OMX_VideoDecodeComponentInit error, ret: %X", ret);
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECComponent->codecType = HW_VIDEO_DEC_CODEC;
+
+    pSECComponent->componentName = (OMX_STRING)SEC_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
+    if (pSECComponent->componentName == NULL) {
+        SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "SEC_OMX_ComponentInit: componentName alloc error, ret: %X", ret);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
+
+    pWmvDec = SEC_OSAL_Malloc(sizeof(SEC_WMV_HANDLE));
+    if (pWmvDec == NULL) {
+        SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "SEC_OMX_ComponentInit: SEC_WMV_HANDLE alloc error, ret: %X", ret);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pWmvDec, 0, sizeof(SEC_WMV_HANDLE));
+    pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    pVideoDec->hCodecHandle = (OMX_HANDLETYPE)pWmvDec;
+    pWmvDec->hMFCWmvHandle.wmvFormat = wmvFormat;
+
+    SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_WMV_DEC);
+
+    /* Set componentVersion */
+    pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->componentVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->componentVersion.s.nStep         = STEP_NUMBER;
+    /* Set specVersion */
+    pSECComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->specVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->specVersion.s.nStep         = STEP_NUMBER;
+
+    /* Android CapabilityFlags */
+    pSECComponent->capabilityFlags.iIsOMXComponentMultiThreaded                   = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalInputBufferAlloc  = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalOutputBufferAlloc = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsMovableInputBuffers       = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsPartialFrames             = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesNALStartCodes                 = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentCanHandleIncompleteFrames         = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesFullAVCFrames                 = OMX_TRUE;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0;
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_INPUT_BUFFER_SIZE;
+
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingWMV;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "video/wmv");
+
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0;
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    for(i = 0; i < ALL_PORT_NUM; i++) {
+        INIT_SET_SIZE_VERSION(&pWmvDec->WmvComponent[i], OMX_VIDEO_PARAM_WMVTYPE);
+        pWmvDec->WmvComponent[i].nPortIndex = i;
+        pWmvDec->WmvComponent[i].eFormat    = OMX_VIDEO_WMVFormat9;
+    }
+
+    pOMXComponent->GetParameter      = &SEC_MFC_WmvDec_GetParameter;
+    pOMXComponent->SetParameter      = &SEC_MFC_WmvDec_SetParameter;
+    pOMXComponent->GetConfig         = &SEC_MFC_WmvDec_GetConfig;
+    pOMXComponent->SetConfig         = &SEC_MFC_WmvDec_SetConfig;
+    pOMXComponent->GetExtensionIndex = &SEC_MFC_WmvDec_GetExtensionIndex;
+    pOMXComponent->ComponentRoleEnum = &SEC_MFC_WmvDec_ComponentRoleEnum;
+    pOMXComponent->ComponentDeInit   = &SEC_OMX_ComponentDeinit;
+
+    pSECComponent->sec_mfc_componentInit      = &SEC_MFC_WmvDec_Init;
+    pSECComponent->sec_mfc_componentTerminate = &SEC_MFC_WmvDec_Terminate;
+    pSECComponent->sec_mfc_bufferProcess      = &SEC_MFC_WmvDec_bufferProcess;
+    pSECComponent->sec_checkInputFrame = &Check_Wmv_Frame;
+
+    pSECComponent->currentState = OMX_StateLoaded;
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE         ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_WMV_HANDLE        *pWmvDec = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    SEC_OSAL_Free(pSECComponent->componentName);
+    pSECComponent->componentName = NULL;
+
+    pWmvDec = (SEC_WMV_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    if (pWmvDec != NULL) {
+        SEC_OSAL_Free(pWmvDec);
+        pWmvDec = ((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle = NULL;
+    }
+
+    ret = SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/SEC_OMX_Wmvdec.h b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/SEC_OMX_Wmvdec.h
new file mode 100644
index 0000000..0634465
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/SEC_OMX_Wmvdec.h
@@ -0,0 +1,94 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    SEC_OMX_Wmvdec.h
+ * @brief
+ * @author    HyeYeon Chung (hyeon.chung@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2010.8.20 : Create
+ */
+
+#ifndef SEC_OMX_WMV_DEC_COMPONENT
+#define SEC_OMX_WMV_DEC_COMPONENT
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+
+#define BITMAPINFOHEADER_SIZE               40
+#define BITMAPINFOHEADER_ASFBINDING_SIZE    41
+#define COMPRESSION_POS                     16
+
+typedef enum WMV_FORMAT {
+    WMV_FORMAT_VC1,
+    WMV_FORMAT_WMV3,
+    WMV_FORMAT_UNKNOWN
+} WMV_FORMAT;
+
+/*
+ * This structure is the same as BitmapInfoHhr struct in pv_avifile_typedefs.h file
+ */
+typedef struct _BitmapInfoHhr
+{
+    OMX_U32    BiSize;
+    OMX_U32    BiWidth;
+    OMX_U32    BiHeight;
+    OMX_U16    BiPlanes;
+    OMX_U16    BiBitCount;
+    OMX_U32    BiCompression;
+    OMX_U32    BiSizeImage;
+    OMX_U32    BiXPelsPerMeter;
+    OMX_U32    BiYPelsPerMeter;
+    OMX_U32    BiClrUsed;
+    OMX_U32    BiClrImportant;
+} BitmapInfoHhr;
+
+typedef struct _SEC_MFC_WMV_HANDLE
+{
+    OMX_HANDLETYPE hMFCHandle;
+    OMX_PTR        pMFCStreamBuffer;
+    OMX_PTR        pMFCStreamPhyBuffer;
+    OMX_U32        indexTimestamp;
+    OMX_U32        outputIndexTimestamp;
+    OMX_BOOL       bConfiguredMFC;
+    WMV_FORMAT     wmvFormat;
+    OMX_S32        returnCodec;
+} SEC_MFC_WMV_HANDLE;
+
+typedef struct _SEC_WMV_HANDLE
+{
+    /* OMX Codec specific */
+    OMX_VIDEO_PARAM_WMVTYPE WmvComponent[ALL_PORT_NUM];
+    OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
+
+    /* SEC MFC Codec specific */
+    SEC_MFC_WMV_HANDLE      hMFCWmvHandle;
+} SEC_WMV_HANDLE;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
+                OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/library_register.c b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/library_register.c
new file mode 100644
index 0000000..ce04f18
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/library_register.c
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    library_register.c
+ * @brief
+ * @author    HyeYeon Chung (hyeon.chung@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2010.8.20 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+#include "library_register.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_WMV_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent)
+{
+    FunctionIn();
+
+    if (ppSECComponent == NULL) {
+        goto EXIT;
+    }
+
+    /* component 1 - video decoder WMV */
+    SEC_OSAL_Strcpy(ppSECComponent[0]->componentName, SEC_OMX_COMPONENT_WMV_DEC);
+    SEC_OSAL_Strcpy(ppSECComponent[0]->roles[0], SEC_OMX_COMPONENT_WMV_DEC_ROLE);
+    ppSECComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+EXIT:
+    FunctionOut();
+    return MAX_COMPONENT_NUM;
+}
\ No newline at end of file
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/library_register.h b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/library_register.h
new file mode 100644
index 0000000..adac586
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vc1/library_register.h
@@ -0,0 +1,52 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    library_register.h
+ * @brief
+ * @author    HyeYeon Chung (hyeon.chung.chung@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_WMV_DEC_REG
+#define SEC_OMX_WMV_DEC_REG
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "SEC_OMX_Component_Register.h"
+
+#define OSCL_EXPORT_REF __attribute__((visibility("default")))
+#define MAX_COMPONENT_NUM              1
+#define MAX_COMPONENT_ROLE_NUM    1
+
+/* WMV */
+#define SEC_OMX_COMPONENT_WMV_DEC         "OMX.SEC.WMV.Decoder"
+#define SEC_OMX_COMPONENT_WMV_DEC_ROLE    "video_decoder.wmv"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
\ No newline at end of file
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/Android.mk
new file mode 100644
index 0000000..1ced382
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/Android.mk
@@ -0,0 +1,65 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Vp8dec.c \
+	library_register.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libOMX.SEC.VP8.Decoder
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx
+
+LOCAL_CFLAGS :=
+
+ifeq ($(BOARD_NONBLOCK_MODE_PROCESS), true)
+LOCAL_CFLAGS += -DNONBLOCK_MODE_PROCESS
+endif
+
+ifeq ($(BOARD_USE_ANB), true)
+LOCAL_CFLAGS += -DUSE_ANB
+ifeq ($(BOARD_USE_CSC_FIMC), true)
+ifeq ($(BOARD_USE_V4L2_ION), false)
+LOCAL_CFLAGS += -DUSE_CSC_FIMC
+endif
+endif
+
+ifeq ($(BOARD_USE_CSC_GSCALER), true)
+LOCAL_CFLAGS += -DUSE_CSC_GSCALER
+endif
+endif
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Vdec libsecosal libsecbasecomponent \
+	libswconverter libsecmfcapi
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
+	libSEC_OMX_Resourcemanager libcsc
+
+ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),)
+LOCAL_SHARED_LIBRARIES += libfimc libhwconverter
+endif
+
+ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
+LOCAL_SHARED_LIBRARIES += libexynosgscaler
+endif
+
+#ifeq ($(BOARD_USE_V4L2_ION),true)
+#LOCAL_SHARED_LIBRARIES += libion
+#endif
+
+ifeq ($(BOARD_USES_MFC_FPS),true)
+LOCAL_CFLAGS += -DCONFIG_MFC_FPS
+endif
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/video/dec \
+	$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO) \
+	$(BOARD_HAL_PATH)/include
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/SEC_OMX_Vp8dec.c b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/SEC_OMX_Vp8dec.c
new file mode 100644
index 0000000..5ac91d5
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/SEC_OMX_Vp8dec.c
@@ -0,0 +1,1665 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Vp8dec.c
+ * @brief
+ * @author      Satish Kumar Reddy (palli.satish@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2011.11.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Macros.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Vdec.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Thread.h"
+#include "library_register.h"
+#include "SEC_OMX_Vp8dec.h"
+#include "SsbSipMfcApi.h"
+
+#ifdef USE_ANB
+#include "SEC_OSAL_Android.h"
+#endif
+
+/* To use CSC_METHOD_PREFER_HW or CSC_METHOD_HW in SEC OMX, gralloc should allocate physical memory using FIMC */
+/* It means GRALLOC_USAGE_HW_FIMC1 should be set on Native Window usage */
+#include "csc.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_VP8_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+#define VP8_DEC_NUM_OF_EXTRA_BUFFERS 7
+
+//#define FULL_FRAME_SEARCH /* Full frame search not support*/
+
+static int Check_VP8_Frame(OMX_U8 *pInputStream, int buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame)
+{
+    /* Uncompressed data Chunk comprises a common
+    (for key frames and interframes) 3-byte frame tag that
+    contains four fields
+    - 1-bit frame type (0 - key frame, 1 - inter frame)
+    - 3-bit version number (0 - 3 are defined as four different
+                                      profiles with different decoding complexity)
+    - 1-bit show_frame flag ( 0 - current frame not for display,
+                                          1 - current frame is for dispaly)
+    - 19-bit field - size of the first data partition in bytes
+
+    Key Frames : frame tag followed by 7 bytes of uncompressed
+    data
+    3-bytes : Start code (byte 0: 0x9d,byte 1: 0x01,byte 2: 0x2a)
+    Next 4-bytes: Width & height, Horizontal and vertical scale information
+    16 bits      :     (2 bits Horizontal Scale << 14) | Width (14 bits)
+    16 bits      :     (2 bits Vertical Scale << 14) | Height (14 bits)
+    */
+    int width, height;
+    int horizSscale, vertScale;
+
+    FunctionIn();
+
+    *pbEndOfFrame = OMX_TRUE;
+
+    /*Check for Key frame*/
+    if (!(pInputStream[0] & 0x01)){
+        /* Key Frame  Start code*/
+        if (pInputStream[3] != 0x9d || pInputStream[4] != 0x01 || pInputStream[5]!=0x2a) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, " VP8 Key Frame Start Code not Found");
+            *pbEndOfFrame = OMX_FALSE;
+        }
+        SEC_OSAL_Log(SEC_LOG_TRACE, " VP8 Found Key Frame Start Code");
+        width = (pInputStream[6] | (pInputStream[7] << 8)) & 0x3fff;
+        horizSscale = pInputStream[7] >> 6;
+        height = (pInputStream[8] | (pInputStream[9] << 8)) & 0x3fff;
+        vertScale = pInputStream[9] >> 6;
+        SEC_OSAL_Log(SEC_LOG_TRACE, "width = %d, height = %d, horizSscale = %d, vertScale = %d", width, height, horizSscale, vertScale);
+    }
+
+    FunctionOut();
+    return buffSize;
+}
+
+OMX_BOOL Check_VP8_StartCode(OMX_U8 *pInputStream, OMX_U32 streamSize)
+{
+    SEC_OSAL_Log(SEC_LOG_TRACE, "streamSize: %d",streamSize);
+    if (streamSize < 3) {
+        return OMX_FALSE;
+    }
+
+    if (!(pInputStream[0] & 0x01)){
+        /* Key Frame  Start code*/
+        if (pInputStream[3] != 0x9d || pInputStream[4] != 0x01 || pInputStream[5]!=0x2a) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, " VP8 Key Frame Start Code not Found");
+            return OMX_FALSE;
+        }
+        SEC_OSAL_Log(SEC_LOG_TRACE, " VP8 Found Key Frame Start Code");
+    }
+
+    return OMX_TRUE;
+}
+
+OMX_ERRORTYPE SEC_MFC_VP8Dec_GetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     pComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_VP8_DEC_ROLE);
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = NULL;
+        SEC_VP8DEC_HANDLE      *pVp8Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstErrorCorrectionType->nPortIndex != INPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcErrorCorrectionType = &pVp8Dec->errorCorrectionType[INPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_VP8Dec_SetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+
+        if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_VP8_DEC_ROLE)) {
+            pSECComponent->pSECPort[INPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingVPX;
+        } else {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+    }
+        break;
+    case OMX_IndexParamPortDefinition:
+    {
+        OMX_PARAM_PORTDEFINITIONTYPE *pPortDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)pComponentParameterStructure;
+        OMX_U32                       portIndex = pPortDefinition->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort;
+        OMX_U32 width, height, size;
+        OMX_U32 realWidth, realHeight;
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+        ret = SEC_OMX_Check_SizeVersion(pPortDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            if (pSECPort->portDefinition.bEnabled == OMX_TRUE) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+        }
+        if (pPortDefinition->nBufferCountActual < pSECPort->portDefinition.nBufferCountMin) {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+
+        SEC_OSAL_Memcpy(&pSECPort->portDefinition, pPortDefinition, pPortDefinition->nSize);
+
+        realWidth = pSECPort->portDefinition.format.video.nFrameWidth;
+        realHeight = pSECPort->portDefinition.format.video.nFrameHeight;
+        width = ((realWidth + 15) & (~15));
+        height = ((realHeight + 15) & (~15));
+        size = (width * height * 3) / 2;
+        pSECPort->portDefinition.format.video.nStride = width;
+        pSECPort->portDefinition.format.video.nSliceHeight = height;
+        pSECPort->portDefinition.nBufferSize = (size > pSECPort->portDefinition.nBufferSize) ? size : pSECPort->portDefinition.nBufferSize;
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+            pSECOutputPort->portDefinition.format.video.nFrameWidth = pSECPort->portDefinition.format.video.nFrameWidth;
+            pSECOutputPort->portDefinition.format.video.nFrameHeight = pSECPort->portDefinition.format.video.nFrameHeight;
+            pSECOutputPort->portDefinition.format.video.nStride = width;
+            pSECOutputPort->portDefinition.format.video.nSliceHeight = height;
+
+            switch (pSECOutputPort->portDefinition.format.video.eColorFormat) {
+            case OMX_COLOR_FormatYUV420Planar:
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+            case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+            case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                pSECOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
+                break;
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                pSECOutputPort->portDefinition.nBufferSize =
+                    ALIGN_TO_8KB(ALIGN_TO_128B(realWidth) * ALIGN_TO_32B(realHeight)) \
+                  + ALIGN_TO_8KB(ALIGN_TO_128B(realWidth) * ALIGN_TO_32B(realHeight/2));
+                break;
+            default:
+                SEC_OSAL_Log(SEC_LOG_ERROR, "Color format is not support!! use default YUV size!!");
+                ret = OMX_ErrorUnsupportedSetting;
+                break;
+            }
+        }
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = NULL;
+        SEC_VP8DEC_HANDLE      *pVp8Dec = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcErrorCorrectionType->nPortIndex != INPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstErrorCorrectionType = &pVp8Dec->errorCorrectionType[INPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_VP8Dec_GetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_VideoDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_VP8Dec_SetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_VideoDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_VP8Dec_GetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_ENABLE_THUMBNAIL) == 0) {
+        SEC_VP8DEC_HANDLE *pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+        *pIndexType = OMX_IndexVendorThumbnailMode;
+
+        ret = OMX_ErrorNone;
+    } else {
+        ret = SEC_OMX_VideoDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_VP8Dec_ComponentRoleEnum(OMX_HANDLETYPE hComponent, OMX_U8 *cRole, OMX_U32 nIndex)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (cRole == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (nIndex == (MAX_COMPONENT_ROLE_NUM-1)) {
+        SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_VP8_DEC_ROLE);
+        ret = OMX_ErrorNone;
+    } else {
+        ret = OMX_ErrorNoMore;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_DecodeThread(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_VP8DEC_HANDLE    *pVp8Dec = (SEC_VP8DEC_HANDLE *)pVideoDec->hCodecHandle;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    while (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+        SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameStart);
+
+        if (pVideoDec->NBDecThread.bExitDecodeThread == OMX_FALSE) {
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStart(PERF_ID_DEC);
+#endif
+            pVp8Dec->hMFCVp8Handle.returnCodec = SsbSipMfcDecExe(pVp8Dec->hMFCVp8Handle.hMFCHandle, pVideoDec->NBDecThread.oneFrameSize);
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStop(PERF_ID_DEC);
+#endif
+            SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameEnd);
+        }
+    }
+
+EXIT:
+    SEC_OSAL_ThreadExit(NULL);
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Init */
+OMX_ERRORTYPE SEC_MFC_VP8Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT      *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_VP8DEC_HANDLE    *pVp8Dec = NULL;
+    OMX_PTR hMFCHandle       = NULL;
+    OMX_PTR pStreamBuffer    = NULL;
+    OMX_PTR pStreamPhyBuffer = NULL;
+    CSC_METHOD csc_method = CSC_METHOD_SW;
+
+#ifdef CONFIG_MFC_FPS
+    SEC_OSAL_PerfInit(PERF_ID_DEC);
+    SEC_OSAL_PerfInit(PERF_ID_CSC);
+#endif
+
+    pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pVp8Dec->hMFCVp8Handle.bConfiguredMFC = OMX_FALSE;
+    pSECComponent->bUseFlagEOF = OMX_FALSE;
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+
+    /* MFC(Multi Function Codec) decoder and CMM(Codec Memory Management) driver open */
+    if (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress) {
+        hMFCHandle = (OMX_PTR)SsbSipMfcDecOpen();
+    } else {
+        SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+        hMFCHandle = (OMX_PTR)SsbSipMfcDecOpenExt(&buf_type);
+    }
+
+    if (hMFCHandle == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVp8Dec->hMFCVp8Handle.hMFCHandle = hMFCHandle;
+
+    /* Allocate decoder's input buffer */
+    /* Get first input buffer */
+    pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE / 2);
+    if (pStreamBuffer == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoDec->MFCDecInputBuffer[0].VirAddr = pStreamBuffer;
+    pVideoDec->MFCDecInputBuffer[0].PhyAddr = pStreamPhyBuffer;
+    pVideoDec->MFCDecInputBuffer[0].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE / 2;
+    pVideoDec->MFCDecInputBuffer[0].dataSize = 0;
+
+#ifdef NONBLOCK_MODE_PROCESS
+    /* Get second input buffer */
+    pStreamBuffer = NULL;
+    pStreamBuffer = SsbSipMfcDecGetInBuf(hMFCHandle, &pStreamPhyBuffer, DEFAULT_MFC_INPUT_BUFFER_SIZE / 2);
+    if (pStreamBuffer == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoDec->MFCDecInputBuffer[1].VirAddr = pStreamBuffer;
+    pVideoDec->MFCDecInputBuffer[1].PhyAddr = pStreamPhyBuffer;
+    pVideoDec->MFCDecInputBuffer[1].bufferSize = DEFAULT_MFC_INPUT_BUFFER_SIZE / 2;
+    pVideoDec->MFCDecInputBuffer[1].dataSize = 0;
+    pVideoDec->indexInputBuffer = 0;
+
+    pVideoDec->bFirstFrame = OMX_TRUE;
+
+    pVideoDec->NBDecThread.bExitDecodeThread = OMX_FALSE;
+    pVideoDec->NBDecThread.bDecoderRun = OMX_FALSE;
+    pVideoDec->NBDecThread.oneFrameSize = 0;
+    SEC_OSAL_SemaphoreCreate(&(pVideoDec->NBDecThread.hDecFrameStart));
+    SEC_OSAL_SemaphoreCreate(&(pVideoDec->NBDecThread.hDecFrameEnd));
+    if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pVideoDec->NBDecThread.hNBDecodeThread,
+                                                SEC_MFC_DecodeThread,
+                                                pOMXComponent)) {
+        pVp8Dec->hMFCVp8Handle.returnCodec = MFC_RET_OK;
+    }
+#endif
+
+    pVp8Dec->hMFCVp8Handle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[0].VirAddr;
+    pVp8Dec->hMFCVp8Handle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[0].PhyAddr;
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[0].VirAddr;
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[0].bufferSize;
+
+    SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+    SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+    pVp8Dec->hMFCVp8Handle.indexTimestamp = 0;
+    pVp8Dec->hMFCVp8Handle.outputIndexTimestamp = 0;
+
+    pSECComponent->getAllDelayBuffer = OMX_FALSE;
+
+#ifdef USE_ANB
+#if defined(USE_CSC_FIMC) || defined(USE_CSC_GSCALER)
+    if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+        csc_method = CSC_METHOD_PREFER_HW;
+    }
+#endif
+#endif
+    pVideoDec->csc_handle = csc_init(&csc_method);
+    pVideoDec->csc_set_format = OMX_FALSE;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Terminate */
+OMX_ERRORTYPE SEC_MFC_VP8Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_VP8DEC_HANDLE    *pVp8Dec = NULL;
+    OMX_PTR                hMFCHandle = NULL;
+
+    FunctionIn();
+
+#ifdef CONFIG_MFC_FPS
+    SEC_OSAL_PerfPrint("[DEC]",  PERF_ID_DEC);
+    SEC_OSAL_PerfPrint("[CSC]",  PERF_ID_CSC);
+#endif
+
+    pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    hMFCHandle = pVp8Dec->hMFCVp8Handle.hMFCHandle;
+
+    pVp8Dec->hMFCVp8Handle.pMFCStreamBuffer    = NULL;
+    pVp8Dec->hMFCVp8Handle.pMFCStreamPhyBuffer = NULL;
+    pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = NULL;
+    pSECComponent->processData[INPUT_PORT_INDEX].allocSize = 0;
+
+#ifdef NONBLOCK_MODE_PROCESS
+    if (pVideoDec->NBDecThread.hNBDecodeThread != NULL) {
+        pVideoDec->NBDecThread.bExitDecodeThread = OMX_TRUE;
+        SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameStart);
+        SEC_OSAL_ThreadTerminate(pVideoDec->NBDecThread.hNBDecodeThread);
+        pVideoDec->NBDecThread.hNBDecodeThread = NULL;
+    }
+
+    if(pVideoDec->NBDecThread.hDecFrameEnd != NULL) {
+        SEC_OSAL_SemaphoreTerminate(pVideoDec->NBDecThread.hDecFrameEnd);
+        pVideoDec->NBDecThread.hDecFrameEnd = NULL;
+    }
+
+    if(pVideoDec->NBDecThread.hDecFrameStart != NULL) {
+        SEC_OSAL_SemaphoreTerminate(pVideoDec->NBDecThread.hDecFrameStart);
+        pVideoDec->NBDecThread.hDecFrameStart = NULL;
+    }
+#endif
+
+    if (hMFCHandle != NULL) {
+        SsbSipMfcDecClose(hMFCHandle);
+        hMFCHandle = pVp8Dec->hMFCVp8Handle.hMFCHandle = NULL;
+    }
+
+    if (pVideoDec->csc_handle != NULL) {
+        csc_deinit(pVideoDec->csc_handle);
+        pVideoDec->csc_handle = NULL;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_VP8_Decode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_VP8DEC_HANDLE         *pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    SEC_OMX_BASEPORT           *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT           *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    OMX_U32                     oneFrameSize = pInputData->dataLen;
+    SSBSIP_MFC_DEC_OUTPUT_INFO  outputInfo;
+    OMX_S32                     setConfVal = 0;
+    int                         bufWidth = 0;
+    int                         bufHeight = 0;
+    OMX_U32                     FrameBufferYSize = 0;
+    OMX_U32                     FrameBufferUVSize = 0;
+    OMX_BOOL                    outputDataValid = OMX_FALSE;
+
+    FunctionIn();
+
+    if (pVp8Dec->hMFCVp8Handle.bConfiguredMFC == OMX_FALSE) {
+        SSBSIP_MFC_CODEC_TYPE eCodecType = VP8_DEC;
+
+        if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+
+        /* Default number in the driver is optimized */
+        if (pVideoDec->bThumbnailMode == OMX_TRUE) {
+            setConfVal = 0;
+            SsbSipMfcDecSetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
+        } else {
+            setConfVal = VP8_DEC_NUM_OF_EXTRA_BUFFERS;
+            SsbSipMfcDecSetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &setConfVal);
+
+            setConfVal = 8;
+            SsbSipMfcDecSetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
+        }
+
+        SsbSipMfcDecSetInBuf(pVp8Dec->hMFCVp8Handle.hMFCHandle,
+                             pVp8Dec->hMFCVp8Handle.pMFCStreamPhyBuffer,
+                             pVp8Dec->hMFCVp8Handle.pMFCStreamBuffer,
+                             pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        pVp8Dec->hMFCVp8Handle.returnCodec = SsbSipMfcDecInit(pVp8Dec->hMFCVp8Handle.hMFCHandle, eCodecType, oneFrameSize);
+        if (pVp8Dec->hMFCVp8Handle.returnCodec == MFC_RET_OK) {
+            SSBSIP_MFC_IMG_RESOLUTION imgResol;
+
+            SsbSipMfcDecGetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol);
+            SEC_OSAL_Log(SEC_LOG_ERROR, "set width height information : %d, %d",
+                            pSECInputPort->portDefinition.format.video.nFrameWidth,
+                            pSECInputPort->portDefinition.format.video.nFrameHeight);
+            SEC_OSAL_Log(SEC_LOG_ERROR, "mfc width height information : %d, %d",
+                            imgResol.width, imgResol.height);
+
+            if ((pSECInputPort->portDefinition.format.video.nFrameWidth != imgResol.width) ||
+                (pSECInputPort->portDefinition.format.video.nFrameHeight != imgResol.height)) {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "change width height information : OMX_EventPortSettingsChanged");
+
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /** Send Port Settings changed call back **/
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, /* The command was completed */
+                       OMX_DirOutput, /* This is the port index */
+                       0,
+                       NULL);
+            }
+
+            pVp8Dec->hMFCVp8Handle.bConfiguredMFC = OMX_TRUE;
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+
+            ret = OMX_ErrorInputDataDecodeYet;
+            goto EXIT;
+        } else {
+            ret = OMX_ErrorMFCInit;
+            goto EXIT;
+        }
+    }
+
+#ifndef FULL_FRAME_SEARCH
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+#endif
+
+    pSECComponent->timeStamp[pVp8Dec->hMFCVp8Handle.indexTimestamp] = pInputData->timeStamp;
+    pSECComponent->nFlags[pVp8Dec->hMFCVp8Handle.indexTimestamp] = pInputData->nFlags;
+
+    if ((pVp8Dec->hMFCVp8Handle.returnCodec == MFC_RET_OK) &&
+        (pVideoDec->bFirstFrame == OMX_FALSE)) {
+        SSBSIP_MFC_DEC_OUTBUF_STATUS status;
+        OMX_S32 indexTimestamp = 0;
+
+        /* wait for mfc decode done */
+        if (pVideoDec->NBDecThread.bDecoderRun == OMX_TRUE) {
+            SEC_OSAL_SemaphoreWait(pVideoDec->NBDecThread.hDecFrameEnd);
+            pVideoDec->NBDecThread.bDecoderRun = OMX_FALSE;
+        }
+
+        SEC_OSAL_SleepMillisec(0);
+        status = SsbSipMfcDecGetOutBuf(pVp8Dec->hMFCVp8Handle.hMFCHandle, &outputInfo);
+        bufWidth = (outputInfo.img_width + 15) & (~15);
+        bufHeight = (outputInfo.img_height + 15) & (~15);
+        FrameBufferYSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height));
+        FrameBufferUVSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height/2));
+
+        if ((SsbSipMfcDecGetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            /* For timestamp correction. if mfc support frametype detect */
+            SEC_OSAL_Log(SEC_LOG_TRACE, "disp_pic_frame_type: %d", outputInfo.disp_pic_frame_type);
+#ifdef NEED_TIMESTAMP_REORDER
+            if (outputInfo.disp_pic_frame_type == MFC_FRAME_TYPE_I_FRAME) {
+                pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+                pVp8Dec->hMFCVp8Handle.outputIndexTimestamp = indexTimestamp;
+            } else {
+                pOutputData->timeStamp = pSECComponent->timeStamp[pVp8Dec->hMFCVp8Handle.outputIndexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[pVp8Dec->hMFCVp8Handle.outputIndexTimestamp];
+            }
+#else
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+#endif
+            SEC_OSAL_Log(SEC_LOG_TRACE, "timestamp %lld us (%.2f secs)", pOutputData->timeStamp, pOutputData->timeStamp / 1E6);
+        }
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
+            (status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
+            outputDataValid = OMX_TRUE;
+            pVp8Dec->hMFCVp8Handle.outputIndexTimestamp++;
+            pVp8Dec->hMFCVp8Handle.outputIndexTimestamp %= MAX_TIMESTAMP;
+        }
+        if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+            outputDataValid = OMX_FALSE;
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE))
+            ret = OMX_ErrorInputDataDecodeYet;
+
+        if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+            if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE))) {
+                pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else {
+                ret = OMX_ErrorNone;
+            }
+            outputDataValid = OMX_FALSE;
+        }
+
+#ifdef FULL_FRAME_SEARCH
+        if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+            pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else
+#endif
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            ret = OMX_ErrorNone;
+        }
+    } else {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
+            (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+        }
+
+        if ((pVideoDec->bFirstFrame == OMX_TRUE) &&
+            ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) &&
+            ((pInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) != OMX_BUFFERFLAG_CODECCONFIG)) {
+            pOutputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+        }
+
+        outputDataValid = OMX_FALSE;
+
+        /* ret = OMX_ErrorUndefined; */
+        ret = OMX_ErrorNone;
+    }
+
+    if (ret == OMX_ErrorInputDataDecodeYet) {
+        pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize = oneFrameSize;
+        pVideoDec->indexInputBuffer++;
+        pVideoDec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+        pVp8Dec->hMFCVp8Handle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pVp8Dec->hMFCVp8Handle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].PhyAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].bufferSize;
+        oneFrameSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize;
+        //pInputData->dataLen = oneFrameSize;
+        //pInputData->remainDataLen = oneFrameSize;
+    }
+
+    if ((Check_VP8_StartCode(pInputData->dataBuffer, oneFrameSize) == OMX_TRUE) &&
+        ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS)) {
+        if ((ret != OMX_ErrorInputDataDecodeYet) || (pSECComponent->getAllDelayBuffer == OMX_TRUE)) {
+            SsbSipMfcDecSetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pVp8Dec->hMFCVp8Handle.indexTimestamp));
+            pVp8Dec->hMFCVp8Handle.indexTimestamp++;
+            pVp8Dec->hMFCVp8Handle.indexTimestamp %= MAX_TIMESTAMP;
+        }
+
+        SsbSipMfcDecSetInBuf(pVp8Dec->hMFCVp8Handle.hMFCHandle,
+                             pVp8Dec->hMFCVp8Handle.pMFCStreamPhyBuffer,
+                             pVp8Dec->hMFCVp8Handle.pMFCStreamBuffer,
+                             pSECComponent->processData[INPUT_PORT_INDEX].allocSize);
+
+        pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].dataSize = oneFrameSize;
+        pVideoDec->NBDecThread.oneFrameSize = oneFrameSize;
+
+        /* mfc decode start */
+        SEC_OSAL_SemaphorePost(pVideoDec->NBDecThread.hDecFrameStart);
+        pVideoDec->NBDecThread.bDecoderRun = OMX_TRUE;
+        pVp8Dec->hMFCVp8Handle.returnCodec = MFC_RET_OK;
+
+        SEC_OSAL_SleepMillisec(0);
+
+        pVideoDec->indexInputBuffer++;
+        pVideoDec->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+        pVp8Dec->hMFCVp8Handle.pMFCStreamBuffer    = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pVp8Dec->hMFCVp8Handle.pMFCStreamPhyBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].PhyAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].VirAddr;
+        pSECComponent->processData[INPUT_PORT_INDEX].allocSize = pVideoDec->MFCDecInputBuffer[pVideoDec->indexInputBuffer].bufferSize;
+
+        if ((pVideoDec->bFirstFrame == OMX_TRUE) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE) &&
+            (outputDataValid == OMX_FALSE)) {
+            ret = OMX_ErrorInputDataDecodeYet;
+        }
+
+        pVideoDec->bFirstFrame = OMX_FALSE;
+    } else {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE)
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+    }
+
+    /** Fill Output Buffer **/
+    if (outputDataValid == OMX_TRUE) {
+        void *pOutputBuf = (void *)pOutputData->dataBuffer;
+        void *pSrcBuf[3] = {NULL, };
+        void *pYUVBuf[3] = {NULL, };
+        unsigned int csc_src_color_format, csc_dst_color_format;
+        CSC_METHOD csc_method = CSC_METHOD_SW;
+        unsigned int cacheable = 1;
+
+        int frameSize = bufWidth * bufHeight;
+        int width = outputInfo.img_width;
+        int height = outputInfo.img_height;
+        int imageSize = outputInfo.img_width * outputInfo.img_height;
+
+        pSrcBuf[0] = outputInfo.YVirAddr;
+        pSrcBuf[1] = outputInfo.CVirAddr;
+
+        pYUVBuf[0]  = (unsigned char *)pOutputBuf;
+        pYUVBuf[1]  = (unsigned char *)pOutputBuf + imageSize;
+        pYUVBuf[2]  = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
+        pOutputData->dataLen = (imageSize * 3) / 2;
+
+#ifdef USE_ANB
+        if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+            unsigned int stride;
+            SEC_OSAL_LockANB(pOutputData->dataBuffer, width, height, pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat, &stride, pYUVBuf);
+            width = stride;
+            pOutputData->dataLen = sizeof(void *);
+         }
+#endif
+        if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
+            (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
+            /* if use Post copy address structure */
+            SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+            SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+            pOutputData->dataLen = (width * height * 3) / 2;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 SP/P Output mode");
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStart(PERF_ID_CSC);
+#endif
+            switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+                SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
+                SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + FrameBufferYSize, outputInfo.CVirAddr, FrameBufferUVSize);
+                pOutputData->dataLen = FrameBufferYSize + FrameBufferUVSize;
+                break;
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+            case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                break;
+            case OMX_COLOR_FormatYUV420Planar:
+            default:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                break;
+            }
+
+            csc_get_method(pVideoDec->csc_handle, &csc_method);
+#ifdef USE_CSC_FIMC
+            if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
+                SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
+                pSrcBuf[0] = outputInfo.YPhyAddr;
+                pSrcBuf[1] = outputInfo.CPhyAddr;
+            }
+#endif
+            if (pVideoDec->csc_set_format == OMX_FALSE) {
+                csc_set_src_format(
+                    pVideoDec->csc_handle,  /* handle */
+                    width,                  /* width */
+                    height,                 /* height */
+                    0,                      /* crop_left */
+                    0,                      /* crop_right */
+                    width,                  /* crop_width */
+                    height,                 /* crop_height */
+                    csc_src_color_format,   /* color_format */
+                    cacheable);             /* cacheable */
+                csc_set_dst_format(
+                    pVideoDec->csc_handle,  /* handle */
+                    width,                  /* width */
+                    height,                 /* height */
+                    0,                      /* crop_left */
+                    0,                      /* crop_right */
+                    width,                  /* crop_width */
+                    height,                 /* crop_height */
+                    csc_dst_color_format,   /* color_format */
+                    cacheable);             /* cacheable */
+                pVideoDec->csc_set_format = OMX_TRUE;
+            }
+            csc_set_src_buffer(
+                pVideoDec->csc_handle,  /* handle */
+                pSrcBuf[0],             /* y addr */
+                pSrcBuf[1],             /* u addr or uv addr */
+                pSrcBuf[2],             /* v addr or none */
+                0);                     /* ion fd */
+            csc_set_dst_buffer(
+                pVideoDec->csc_handle,
+                pYUVBuf[0],             /* y addr */
+                pYUVBuf[1],             /* u addr or uv addr */
+                pYUVBuf[2],             /* v addr or none */
+                0);                     /* ion fd */
+            csc_convert(pVideoDec->csc_handle);
+
+#ifdef CONFIG_MFC_FPS
+            SEC_OSAL_PerfStop(PERF_ID_CSC);
+#endif
+        }
+#ifdef USE_ANB
+        if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+            SEC_OSAL_UnlockANB(pOutputData->dataBuffer);
+        }
+#endif
+    } else {
+        pOutputData->dataLen = 0;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_VP8_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE               ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT      *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT           *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT           *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_VP8DEC_HANDLE         *pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    OMX_U32                     oneFrameSize = pInputData->dataLen;
+    SSBSIP_MFC_DEC_OUTPUT_INFO  outputInfo;
+    OMX_S32                     setConfVal = 0;
+    OMX_S32                     returnCodec = 0;
+    int                         bufWidth = 0;
+    int                         bufHeight = 0;
+    OMX_U32                     FrameBufferYSize;
+    OMX_U32                     FrameBufferUVSize;
+
+    FunctionIn();
+
+    if (pVp8Dec->hMFCVp8Handle.bConfiguredMFC == OMX_FALSE) {
+        SSBSIP_MFC_CODEC_TYPE eCodecType = VP8_DEC;
+
+        if ((oneFrameSize <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+
+        /* Default number in the driver is optimized */
+        if (pVideoDec->bThumbnailMode == OMX_TRUE) {
+            setConfVal = 0;
+            SsbSipMfcDecSetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_SETCONF_DISPLAY_DELAY, &setConfVal);
+        } else {
+            setConfVal = VP8_DEC_NUM_OF_EXTRA_BUFFERS;
+            SsbSipMfcDecSetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_SETCONF_EXTRA_BUFFER_NUM, &setConfVal);
+        }
+
+        returnCodec = SsbSipMfcDecInit(pVp8Dec->hMFCVp8Handle.hMFCHandle, eCodecType, oneFrameSize);
+        if (returnCodec == MFC_RET_OK) {
+            SSBSIP_MFC_IMG_RESOLUTION imgResol;
+
+            SsbSipMfcDecGetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_GETCONF_BUF_WIDTH_HEIGHT, &imgResol);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "set width height information : %d, %d",
+                            pSECInputPort->portDefinition.format.video.nFrameWidth,
+                            pSECInputPort->portDefinition.format.video.nFrameHeight);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "mfc width height information : %d, %d",
+                            imgResol.width, imgResol.height);
+
+            /** Update Frame Size **/
+            if ((pSECInputPort->portDefinition.format.video.nFrameWidth != imgResol.width) ||
+                (pSECInputPort->portDefinition.format.video.nFrameHeight != imgResol.height)) {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "change width height information : OMX_EventPortSettingsChanged");
+                /* change width and height information */
+                pSECInputPort->portDefinition.format.video.nFrameWidth = imgResol.width;
+                pSECInputPort->portDefinition.format.video.nFrameHeight = imgResol.height;
+                pSECInputPort->portDefinition.format.video.nStride      = ((imgResol.width + 15) & (~15));
+                pSECInputPort->portDefinition.format.video.nSliceHeight = ((imgResol.height + 15) & (~15));
+
+                SEC_UpdateFrameSize(pOMXComponent);
+
+                /** Send Port Settings changed call back **/
+                (*(pSECComponent->pCallbacks->EventHandler))
+                      (pOMXComponent,
+                       pSECComponent->callbackData,
+                       OMX_EventPortSettingsChanged, /* The command was completed */
+                       OMX_DirOutput, /* This is the port index */
+                       0,
+                       NULL);
+            }
+
+            pVp8Dec->hMFCVp8Handle.bConfiguredMFC = OMX_TRUE;
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+
+            ret = OMX_ErrorInputDataDecodeYet;
+            goto EXIT;
+        } else {
+            ret = OMX_ErrorMFCInit;
+            goto EXIT;
+        }
+    }
+
+#ifndef FULL_FRAME_SEARCH
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+#endif
+
+    if (Check_VP8_StartCode(pInputData->dataBuffer, pInputData->dataLen) == OMX_TRUE) {
+        pSECComponent->timeStamp[pVp8Dec->hMFCVp8Handle.indexTimestamp] = pInputData->timeStamp;
+        pSECComponent->nFlags[pVp8Dec->hMFCVp8Handle.indexTimestamp] = pInputData->nFlags;
+        SsbSipMfcDecSetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_SETCONF_FRAME_TAG, &(pVp8Dec->hMFCVp8Handle.indexTimestamp));
+
+        returnCodec = SsbSipMfcDecExe(pVp8Dec->hMFCVp8Handle.hMFCHandle, oneFrameSize);
+    } else {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE)
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE;
+
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+        returnCodec = MFC_RET_OK;
+        goto EXIT;
+    }
+
+    if (returnCodec == MFC_RET_OK) {
+        SSBSIP_MFC_DEC_OUTBUF_STATUS status;
+        OMX_S32 indexTimestamp = 0;
+
+        status = SsbSipMfcDecGetOutBuf(pVp8Dec->hMFCVp8Handle.hMFCHandle, &outputInfo);
+        bufWidth =    (outputInfo.img_width + 15) & (~15);
+        bufHeight =  (outputInfo.img_height + 15) & (~15);
+        FrameBufferYSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height));
+        FrameBufferUVSize = ALIGN_TO_8KB(ALIGN_TO_128B(outputInfo.img_width) * ALIGN_TO_32B(outputInfo.img_height/2));
+
+        if (status != MFC_GETOUTBUF_DISPLAY_ONLY) {
+            pVp8Dec->hMFCVp8Handle.indexTimestamp++;
+            pVp8Dec->hMFCVp8Handle.indexTimestamp %= MAX_TIMESTAMP;
+        }
+
+        if ((SsbSipMfcDecGetConfig(pVp8Dec->hMFCVp8Handle.hMFCHandle, MFC_DEC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            /* For timestamp correction. if mfc support frametype detect */
+            SEC_OSAL_Log(SEC_LOG_TRACE, "disp_pic_frame_type: %d", outputInfo.disp_pic_frame_type);
+#ifdef NEED_TIMESTAMP_REORDER
+            if (outputInfo.disp_pic_frame_type == MFC_FRAME_TYPE_I_FRAME) {
+                pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+                pVp8Dec->hMFCVp8Handle.outputIndexTimestamp = indexTimestamp;
+            } else {
+                pOutputData->timeStamp = pSECComponent->timeStamp[pVp8Dec->hMFCVp8Handle.outputIndexTimestamp];
+                pOutputData->nFlags = pSECComponent->nFlags[pVp8Dec->hMFCVp8Handle.outputIndexTimestamp];
+            }
+#else
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+#endif
+            SEC_OSAL_Log(SEC_LOG_TRACE, "timestamp %lld us (%.2f secs)", pOutputData->timeStamp, pOutputData->timeStamp / 1E6);
+        }
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_DECODING) ||
+            (status == MFC_GETOUTBUF_DISPLAY_ONLY)) {
+            /** Fill Output Buffer **/
+            void *pOutputBuf = (void *)pOutputData->dataBuffer;
+            void *pSrcBuf[3] = {NULL, };
+            void *pYUVBuf[3] = {NULL, };
+            unsigned int csc_src_color_format, csc_dst_color_format;
+            CSC_METHOD csc_method = CSC_METHOD_SW;
+            unsigned int cacheable = 1;
+
+            int frameSize = bufWidth * bufHeight;
+            int width = outputInfo.img_width;
+            int height = outputInfo.img_height;
+            int imageSize = outputInfo.img_width * outputInfo.img_height;
+
+            pSrcBuf[0] = outputInfo.YVirAddr;
+            pSrcBuf[1] = outputInfo.CVirAddr;
+
+            pYUVBuf[0]  = (unsigned char *)pOutputBuf;
+            pYUVBuf[1]  = (unsigned char *)pOutputBuf + imageSize;
+            pYUVBuf[2]  = (unsigned char *)pOutputBuf + imageSize + imageSize / 4;
+            pOutputData->dataLen = (imageSize * 3) / 2;
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+                unsigned int stride;
+                SEC_OSAL_LockANB(pOutputData->dataBuffer, width, height, pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat, &stride, pYUVBuf);
+                width = stride;
+                pOutputData->dataLen = sizeof(void *);
+            }
+#endif
+            if ((pVideoDec->bThumbnailMode == OMX_FALSE) &&
+                (pSECOutputPort->portDefinition.format.video.eColorFormat == OMX_SEC_COLOR_FormatNV12TPhysicalAddress)) {
+                /* if use Post copy address structure */
+                SEC_OSAL_Memcpy(pYUVBuf[0], &(outputInfo.YPhyAddr), sizeof(outputInfo.YPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 1), &(outputInfo.CPhyAddr), sizeof(outputInfo.CPhyAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 2), &(outputInfo.YVirAddr), sizeof(outputInfo.YVirAddr));
+                SEC_OSAL_Memcpy((unsigned char *)pYUVBuf[0] + (sizeof(void *) * 3), &(outputInfo.CVirAddr), sizeof(outputInfo.CVirAddr));
+                pOutputData->dataLen = (width * height * 3) / 2;
+            } else {
+                SEC_OSAL_Log(SEC_LOG_TRACE, "YUV420 SP/P Output mode");
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStart(PERF_ID_CSC);
+#endif
+                switch (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eColorFormat) {
+                case OMX_SEC_COLOR_FormatNV12Tiled:
+                    SEC_OSAL_Memcpy(pOutputBuf, outputInfo.YVirAddr, FrameBufferYSize);
+                    SEC_OSAL_Memcpy((unsigned char *)pOutputBuf + FrameBufferYSize, outputInfo.CVirAddr, FrameBufferUVSize);
+                    pOutputData->dataLen = FrameBufferYSize + FrameBufferUVSize;
+                    break;
+                case OMX_COLOR_FormatYUV420SemiPlanar:
+                case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                    break;
+                case OMX_COLOR_FormatYUV420Planar:
+                default:
+                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_SEC_COLOR_FormatNV12Tiled);
+                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                    break;
+                }
+
+                csc_get_method(pVideoDec->csc_handle, &csc_method);
+#ifdef USE_CSC_FIMC
+                if ((pSECOutputPort->bIsANBEnabled == OMX_TRUE) && (csc_method == CSC_METHOD_HW)) {
+                    SEC_OSAL_GetPhysANB(pOutputData->dataBuffer, pYUVBuf);
+                    pSrcBuf[0] = outputInfo.YPhyAddr;
+                    pSrcBuf[1] = outputInfo.CPhyAddr;
+                }
+#endif
+                if (pVideoDec->csc_set_format == OMX_FALSE) {
+                    csc_set_src_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        width,                  /* width */
+                        height,                 /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        width,                  /* crop_width */
+                        height,                 /* crop_height */
+                        csc_src_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    csc_set_dst_format(
+                        pVideoDec->csc_handle,  /* handle */
+                        width,                  /* width */
+                        height,                 /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        width,                  /* crop_width */
+                        height,                 /* crop_height */
+                        csc_dst_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    pVideoDec->csc_set_format = OMX_TRUE;
+                }
+                csc_set_src_buffer(
+                    pVideoDec->csc_handle,    /* handle */
+                    pSrcBuf[0],               /* y addr */
+                    pSrcBuf[1],               /* u addr or uv addr */
+                    pSrcBuf[2],               /* v addr or none */
+                    0);                       /* ion fd */
+                csc_set_dst_buffer(
+                    pVideoDec->csc_handle,
+                    pYUVBuf[0],             /* y addr */
+                    pYUVBuf[1],             /* u addr or uv addr */
+                    pYUVBuf[2],             /* v addr or none */
+                    0);                     /* ion fd */
+                csc_convert(pVideoDec->csc_handle);
+
+#ifdef CONFIG_MFC_FPS
+                SEC_OSAL_PerfStop(PERF_ID_CSC);
+#endif
+            }
+
+#ifdef USE_ANB
+            if (pSECOutputPort->bIsANBEnabled == OMX_TRUE) {
+                SEC_OSAL_UnlockANB(pOutputData->dataBuffer);
+            }
+#endif
+            pVp8Dec->hMFCVp8Handle.outputIndexTimestamp++;
+            pVp8Dec->hMFCVp8Handle.outputIndexTimestamp %= MAX_TIMESTAMP;
+        }
+        if (pOutputData->nFlags & OMX_BUFFERFLAG_EOS)
+            pOutputData->dataLen = 0;
+
+        if ((status == MFC_GETOUTBUF_DISPLAY_ONLY) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE))
+            ret = OMX_ErrorInputDataDecodeYet;
+
+        if (status == MFC_GETOUTBUF_DECODING_ONLY) {
+            if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+                ((pSECComponent->bSaveFlagEOS == OMX_TRUE) || (pSECComponent->getAllDelayBuffer == OMX_TRUE))) {
+                pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                pSECComponent->getAllDelayBuffer = OMX_TRUE;
+                ret = OMX_ErrorInputDataDecodeYet;
+            } else {
+                ret = OMX_ErrorNone;
+            }
+            goto EXIT;
+        }
+
+#ifdef FULL_FRAME_SEARCH
+        if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) != OMX_BUFFERFLAG_EOS) &&
+            (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+            pInputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else
+#endif
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataDecodeYet;
+        } else if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            ret = OMX_ErrorNone;
+        }
+    } else {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        if ((pSECComponent->bSaveFlagEOS == OMX_TRUE) ||
+            (pSECComponent->getAllDelayBuffer == OMX_TRUE) ||
+            (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
+            pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+        }
+        pOutputData->dataLen = 0;
+
+        /* ret = OMX_ErrorUndefined; */
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Decode */
+OMX_ERRORTYPE SEC_MFC_VP8Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_VP8DEC_HANDLE      *pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    SEC_OMX_BASEPORT        *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT        *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    OMX_BOOL                 endOfFrame = OMX_FALSE;
+
+    FunctionIn();
+
+    if ((!CHECK_PORT_ENABLED(pSECInputPort)) || (!CHECK_PORT_ENABLED(pSECOutputPort)) ||
+        (!CHECK_PORT_POPULATED(pSECInputPort)) || (!CHECK_PORT_POPULATED(pSECOutputPort))) {
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+    if (OMX_FALSE == SEC_Check_BufferProcess_State(pSECComponent)) {
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+#ifdef NONBLOCK_MODE_PROCESS
+    ret = SEC_MFC_VP8_Decode_Nonblock(pOMXComponent, pInputData, pOutputData);
+#else
+    ret = SEC_MFC_VP8_Decode_Block(pOMXComponent, pInputData, pOutputData);
+#endif
+    if (ret != OMX_ErrorNone) {
+        if (ret == OMX_ErrorInputDataDecodeYet) {
+            pOutputData->usedDataLen = 0;
+            pOutputData->remainDataLen = pOutputData->dataLen;
+        } else {
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+                                                    pSECComponent->callbackData,
+                                                    OMX_EventError, ret, 0, NULL);
+        }
+    } else {
+        pInputData->previousDataLen = pInputData->dataLen;
+        pInputData->usedDataLen += pInputData->dataLen;
+        pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
+        pInputData->dataLen -= pInputData->usedDataLen;
+        pInputData->usedDataLen = 0;
+
+        pOutputData->usedDataLen = 0;
+        pOutputData->remainDataLen = pOutputData->dataLen;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_OMX_BASEPORT        *pSECPort = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+    SEC_VP8DEC_HANDLE      *pVp8Dec = NULL;
+    //OMX_BOOL                 bFlashPlayerMode = OMX_FALSE;
+    int i = 0;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (componentName == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_VP8_DEC, componentName) != 0) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, componentName:%s, Line:%d", componentName, __LINE__);
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_VideoDecodeComponentInit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECComponent->codecType = HW_VIDEO_DEC_CODEC;
+
+    pSECComponent->componentName = (OMX_STRING)SEC_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
+    if (pSECComponent->componentName == NULL) {
+        SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
+
+    pVp8Dec = SEC_OSAL_Malloc(sizeof(SEC_VP8DEC_HANDLE));
+    if (pVp8Dec == NULL) {
+        SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pVp8Dec, 0, sizeof(SEC_VP8DEC_HANDLE));
+    pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+    pVideoDec->hCodecHandle = (OMX_HANDLETYPE)pVp8Dec;
+
+    SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_VP8_DEC);
+
+    /* Set componentVersion */
+    pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->componentVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->componentVersion.s.nStep         = STEP_NUMBER;
+    /* Set specVersion */
+    pSECComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->specVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->specVersion.s.nStep         = STEP_NUMBER;
+
+    /* Android CapabilityFlags */
+    pSECComponent->capabilityFlags.iIsOMXComponentMultiThreaded                   = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalInputBufferAlloc  = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalOutputBufferAlloc = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsMovableInputBuffers       = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsPartialFrames             = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesNALStartCodes                 = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentCanHandleIncompleteFrames         = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesFullAVCFrames                 = OMX_TRUE;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_INPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingVPX;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "video/x-vnd.on2.vp8");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    /*for(i = 0; i < ALL_PORT_NUM; i++) {
+        INIT_SET_SIZE_VERSION(&pH264Dec->AVCComponent[i], OMX_VIDEO_PARAM_AVCTYPE);
+        pH264Dec->AVCComponent[i].nPortIndex = i;
+        pH264Dec->AVCComponent[i].eProfile   = OMX_VIDEO_AVCProfileBaseline;
+        pH264Dec->AVCComponent[i].eLevel     = OMX_VIDEO_AVCLevel4;
+    }*/
+
+    pOMXComponent->GetParameter      = &SEC_MFC_VP8Dec_GetParameter;
+    pOMXComponent->SetParameter      = &SEC_MFC_VP8Dec_SetParameter;
+    pOMXComponent->GetConfig         = &SEC_MFC_VP8Dec_GetConfig;
+    pOMXComponent->SetConfig         = &SEC_MFC_VP8Dec_SetConfig;
+    pOMXComponent->GetExtensionIndex = &SEC_MFC_VP8Dec_GetExtensionIndex;
+    pOMXComponent->ComponentRoleEnum = &SEC_MFC_VP8Dec_ComponentRoleEnum;
+    pOMXComponent->ComponentDeInit   = &SEC_OMX_ComponentDeinit;
+
+    pSECComponent->sec_mfc_componentInit      = &SEC_MFC_VP8Dec_Init;
+    pSECComponent->sec_mfc_componentTerminate = &SEC_MFC_VP8Dec_Terminate;
+    pSECComponent->sec_mfc_bufferProcess      = &SEC_MFC_VP8Dec_bufferProcess;
+    pSECComponent->sec_checkInputFrame        = &Check_VP8_Frame;
+
+    pSECComponent->currentState = OMX_StateLoaded;
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_VP8DEC_HANDLE      *pVp8Dec = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    SEC_OSAL_Free(pSECComponent->componentName);
+    pSECComponent->componentName = NULL;
+
+    pVp8Dec = (SEC_VP8DEC_HANDLE *)((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    if (pVp8Dec != NULL) {
+        SEC_OSAL_Free(pVp8Dec);
+        pVp8Dec = ((SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle = NULL;
+    }
+
+    ret = SEC_OMX_VideoDecodeComponentDeinit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/SEC_OMX_Vp8dec.h b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/SEC_OMX_Vp8dec.h
new file mode 100644
index 0000000..40ce20c
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/SEC_OMX_Vp8dec.h
@@ -0,0 +1,66 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Vp8dec.h
+ * @brief
+ * @author     Satish Kumar Reddy (palli.satish@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2011.10.10 : Create
+ */
+
+#ifndef SEC_OMX_VP8_DEC_COMPONENT
+#define SEC_OMX_VP8_DEC_COMPONENT
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "OMX_Video.h"
+
+
+typedef struct _SEC_MFC_VP8DEC_HANDLE
+{
+    OMX_HANDLETYPE hMFCHandle;
+    OMX_PTR  pMFCStreamBuffer;
+    OMX_PTR  pMFCStreamPhyBuffer;
+    OMX_U32  indexTimestamp;
+    OMX_U32  outputIndexTimestamp;
+    OMX_BOOL bConfiguredMFC;
+    OMX_S32  returnCodec;
+} SEC_MFC_VP8DEC_HANDLE;
+
+typedef struct _SEC_VP8DEC_HANDLE
+{
+    /* OMX Codec specific */
+    OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
+
+    /* SEC MFC Codec specific */
+    SEC_MFC_VP8DEC_HANDLE hMFCVp8Handle;
+} SEC_VP8DEC_HANDLE;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/library_register.c b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/library_register.c
new file mode 100644
index 0000000..13f7f4a
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/library_register.c
@@ -0,0 +1,58 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    library_register.c
+ * @brief
+ * @author     Satish Kumar Reddy (palli.satish@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2011.11.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+#include "library_register.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_VP8_DEC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent)
+{
+    FunctionIn();
+
+    if (ppSECComponent == NULL)
+        goto EXIT;
+
+    /* component 1 - video decoder VP8 */
+    SEC_OSAL_Strcpy(ppSECComponent[0]->componentName, SEC_OMX_COMPONENT_VP8_DEC);
+    SEC_OSAL_Strcpy(ppSECComponent[0]->roles[0], SEC_OMX_COMPONENT_VP8_DEC_ROLE);
+    ppSECComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+EXIT:
+    FunctionOut();
+    return MAX_COMPONENT_NUM;
+}
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/library_register.h b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/library_register.h
new file mode 100644
index 0000000..5e17150
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/dec/vp8/library_register.h
@@ -0,0 +1,54 @@
+/*
+ *
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.h
+ * @brief
+ * @author      Satish Kumar Reddy (palli.satish@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2011.11.15 : Create
+ */
+
+#ifndef SEC_OMX_VP8_DEC_REG
+#define SEC_OMX_VP8_DEC_REG
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "SEC_OMX_Component_Register.h"
+
+
+#define OSCL_EXPORT_REF __attribute__((visibility("default")))
+#define MAX_COMPONENT_NUM       1
+#define MAX_COMPONENT_ROLE_NUM  1
+
+/* VP8 */
+#define SEC_OMX_COMPONENT_VP8_DEC "OMX.SEC.VP8.Decoder"
+#define SEC_OMX_COMPONENT_VP8_DEC_ROLE "video_decoder.vpx"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/video/enc/Android.mk
new file mode 100644
index 0000000..1c842f2
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/Android.mk
@@ -0,0 +1,37 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Venc.c
+
+LOCAL_MODULE := libSEC_OMX_Venc
+LOCAL_ARM_MODE := arm
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/video/dec \
+	$(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO)
+
+ifeq ($(BOARD_USE_METADATABUFFERTYPE), true)
+LOCAL_CFLAGS += -DUSE_METADATABUFFERTYPE
+endif
+
+ifeq ($(BOARD_USE_STOREMETADATA), true)
+LOCAL_CFLAGS += -DUSE_STOREMETADATA
+endif
+
+ifeq ($(BOARD_USE_V4L2), true)
+ifeq ($(TARGET_SOC), exynos5250)
+LOCAL_CFLAGS += -DUSE_SLICE_OUTPUT_MODE
+endif
+else
+LOCAL_CFLAGS += -DUSE_SLICE_OUTPUT_MODE
+endif
+
+LOCAL_SHARED_LIBRARIES := libcsc
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/SEC_OMX_Venc.c b/exynos4/multimedia/openmax/sec_omx/component/video/enc/SEC_OMX_Venc.c
new file mode 100644
index 0000000..e4b6cc2
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/SEC_OMX_Venc.c
@@ -0,0 +1,1856 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Venc.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ *              Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "SEC_OMX_Macros.h"
+#include "SEC_OSAL_Event.h"
+#include "SEC_OMX_Venc.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OSAL_Thread.h"
+#include "SEC_OSAL_Mutex.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_ETC.h"
+#include "csc.h"
+
+#ifdef USE_STOREMETADATA
+#include "SEC_OSAL_Android.h"
+#endif
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_VIDEO_ENC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+inline void SEC_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    if ((secOutputPort->portDefinition.format.video.nFrameWidth !=
+            secInputPort->portDefinition.format.video.nFrameWidth) ||
+        (secOutputPort->portDefinition.format.video.nFrameHeight !=
+            secInputPort->portDefinition.format.video.nFrameHeight)) {
+        OMX_U32 width = 0, height = 0;
+
+        secOutputPort->portDefinition.format.video.nFrameWidth =
+            secInputPort->portDefinition.format.video.nFrameWidth;
+        secOutputPort->portDefinition.format.video.nFrameHeight =
+            secInputPort->portDefinition.format.video.nFrameHeight;
+        width = secOutputPort->portDefinition.format.video.nStride =
+            secInputPort->portDefinition.format.video.nStride;
+        height = secOutputPort->portDefinition.format.video.nSliceHeight =
+            secInputPort->portDefinition.format.video.nSliceHeight;
+
+        if (width && height)
+            secOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
+    }
+
+  return ;
+}
+
+OMX_ERRORTYPE SEC_OMX_UseBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes,
+    OMX_IN OMX_U8                   *pBuffer)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *temp_bufferHeader = NULL;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pSECPort = &pSECComponent->pSECPort[nPortIndex];
+    if (nPortIndex >= pSECComponent->portParam.nPorts) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+    if (pSECPort->portState != OMX_StateIdle) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
+    if (temp_bufferHeader == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE));
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (pSECPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+            pSECPort->bufferHeader[i] = temp_bufferHeader;
+            pSECPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED);
+            INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
+            temp_bufferHeader->pBuffer        = pBuffer;
+            temp_bufferHeader->nAllocLen      = nSizeBytes;
+            temp_bufferHeader->pAppPrivate    = pAppPrivate;
+            if (nPortIndex == INPUT_PORT_INDEX)
+                temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX;
+            else
+                temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX;
+
+            pSECPort->assignedBufferNum++;
+            if (pSECPort->assignedBufferNum == pSECPort->portDefinition.nBufferCountActual) {
+                pSECPort->portDefinition.bPopulated = OMX_TRUE;
+                /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+                SEC_OSAL_SemaphorePost(pSECPort->loadedResource);
+                /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            }
+            *ppBufferHdr = temp_bufferHeader;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+    }
+
+    SEC_OSAL_Free(temp_bufferHeader);
+    ret = OMX_ErrorInsufficientResources;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *temp_bufferHeader = NULL;
+    OMX_U8                *temp_buffer = NULL;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pSECPort = &pSECComponent->pSECPort[nPortIndex];
+    if (nPortIndex >= pSECComponent->portParam.nPorts) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+/*
+    if (pSECPort->portState != OMX_StateIdle ) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+*/
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    temp_buffer = SEC_OSAL_Malloc(sizeof(OMX_U8) * nSizeBytes);
+    if (temp_buffer == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+
+    temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
+    if (temp_bufferHeader == NULL) {
+        SEC_OSAL_Free(temp_buffer);
+        temp_buffer = NULL;
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE));
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (pSECPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+            pSECPort->bufferHeader[i] = temp_bufferHeader;
+            pSECPort->bufferStateAllocate[i] = (BUFFER_STATE_ALLOCATED | HEADER_STATE_ALLOCATED);
+            INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
+            temp_bufferHeader->pBuffer        = temp_buffer;
+            temp_bufferHeader->nAllocLen      = nSizeBytes;
+            temp_bufferHeader->pAppPrivate    = pAppPrivate;
+            if (nPortIndex == INPUT_PORT_INDEX)
+                temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX;
+            else
+                temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX;
+            pSECPort->assignedBufferNum++;
+            if (pSECPort->assignedBufferNum == pSECPort->portDefinition.nBufferCountActual) {
+                pSECPort->portDefinition.bPopulated = OMX_TRUE;
+                /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+                SEC_OSAL_SemaphorePost(pSECPort->loadedResource);
+                /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            }
+            *ppBuffer = temp_bufferHeader;
+            ret = OMX_ErrorNone;
+            goto EXIT;
+        }
+    }
+
+    SEC_OSAL_Free(temp_bufferHeader);
+    SEC_OSAL_Free(temp_buffer);
+    ret = OMX_ErrorInsufficientResources;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_FreeBuffer(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_U32        nPortIndex,
+    OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE  *temp_bufferHeader = NULL;
+    OMX_U8                *temp_buffer = NULL;
+    OMX_U32                i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECPort = &pSECComponent->pSECPort[nPortIndex];
+
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    if ((pSECPort->portState != OMX_StateLoaded) && (pSECPort->portState != OMX_StateInvalid)) {
+        (*(pSECComponent->pCallbacks->EventHandler)) (pOMXComponent,
+                        pSECComponent->callbackData,
+                        (OMX_U32)OMX_EventError,
+                        (OMX_U32)OMX_ErrorPortUnpopulated,
+                        nPortIndex, NULL);
+    }
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (((pSECPort->bufferStateAllocate[i] | BUFFER_STATE_FREE) != 0) && (pSECPort->bufferHeader[i] != NULL)) {
+            if (pSECPort->bufferHeader[i]->pBuffer == pBufferHdr->pBuffer) {
+                if (pSECPort->bufferStateAllocate[i] & BUFFER_STATE_ALLOCATED) {
+                    SEC_OSAL_Free(pSECPort->bufferHeader[i]->pBuffer);
+                    pSECPort->bufferHeader[i]->pBuffer = NULL;
+                    pBufferHdr->pBuffer = NULL;
+                } else if (pSECPort->bufferStateAllocate[i] & BUFFER_STATE_ASSIGNED) {
+                    ; /* None*/
+                }
+                pSECPort->assignedBufferNum--;
+                if (pSECPort->bufferStateAllocate[i] & HEADER_STATE_ALLOCATED) {
+                    SEC_OSAL_Free(pSECPort->bufferHeader[i]);
+                    pSECPort->bufferHeader[i] = NULL;
+                    pBufferHdr = NULL;
+                }
+                pSECPort->bufferStateAllocate[i] = BUFFER_STATE_FREE;
+                ret = OMX_ErrorNone;
+                goto EXIT;
+            }
+        }
+    }
+
+EXIT:
+    if (ret == OMX_ErrorNone) {
+        if (pSECPort->assignedBufferNum == 0) {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "pSECPort->unloadedResource signal set");
+            /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+            SEC_OSAL_SemaphorePost(pSECPort->unloadedResource);
+            /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            pSECPort->portDefinition.bPopulated = OMX_FALSE;
+        }
+    }
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_AllocateTunnelBuffer(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex)
+{
+    OMX_ERRORTYPE                 ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT             *pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE         *temp_bufferHeader = NULL;
+    OMX_U8                       *temp_buffer = NULL;
+    OMX_U32                       bufferSize = 0;
+    OMX_PARAM_PORTDEFINITIONTYPE  portDefinition;
+
+    ret = OMX_ErrorTunnelingUnsupported;
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_FreeTunnelBuffer(SEC_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT* pSECPort = NULL;
+    OMX_BUFFERHEADERTYPE* temp_bufferHeader = NULL;
+    OMX_U8 *temp_buffer = NULL;
+    OMX_U32 bufferSize = 0;
+    OMX_PARAM_PORTDEFINITIONTYPE portDefinition;
+
+    ret = OMX_ErrorTunnelingUnsupported;
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentTunnelRequest(
+    OMX_IN OMX_HANDLETYPE hComp,
+    OMX_IN OMX_U32        nPort,
+    OMX_IN OMX_HANDLETYPE hTunneledComp,
+    OMX_IN OMX_U32        nTunneledPort,
+    OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    ret = OMX_ErrorTunnelingUnsupported;
+EXIT:
+    return ret;
+}
+
+OMX_BOOL SEC_Check_BufferProcess_State(SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    if ((pSECComponent->currentState == OMX_StateExecuting) &&
+        (pSECComponent->pSECPort[INPUT_PORT_INDEX].portState == OMX_StateIdle) &&
+        (pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portState == OMX_StateIdle) &&
+        (pSECComponent->transientState != SEC_OMX_TransStateExecutingToIdle) &&
+        (pSECComponent->transientState != SEC_OMX_TransStateIdleToExecuting))
+        return OMX_TRUE;
+    else
+        return OMX_FALSE;
+}
+
+static OMX_ERRORTYPE SEC_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secOMXInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOMXOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+    OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader;
+
+    FunctionIn();
+
+    if (bufferHeader != NULL) {
+        if (secOMXInputPort->markType.hMarkTargetComponent != NULL ) {
+            bufferHeader->hMarkTargetComponent      = secOMXInputPort->markType.hMarkTargetComponent;
+            bufferHeader->pMarkData                 = secOMXInputPort->markType.pMarkData;
+            secOMXInputPort->markType.hMarkTargetComponent = NULL;
+            secOMXInputPort->markType.pMarkData = NULL;
+        }
+
+        if (bufferHeader->hMarkTargetComponent != NULL) {
+            if (bufferHeader->hMarkTargetComponent == pOMXComponent) {
+                pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                                pSECComponent->callbackData,
+                                OMX_EventMark,
+                                0, 0, bufferHeader->pMarkData);
+            } else {
+                pSECComponent->propagateMarkType.hMarkTargetComponent = bufferHeader->hMarkTargetComponent;
+                pSECComponent->propagateMarkType.pMarkData = bufferHeader->pMarkData;
+            }
+        }
+
+        if (CHECK_PORT_TUNNELED(secOMXInputPort)) {
+            OMX_FillThisBuffer(secOMXInputPort->tunneledComponent, bufferHeader);
+        } else {
+            bufferHeader->nFilledLen = 0;
+            pSECComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader);
+        }
+    }
+
+    if ((pSECComponent->currentState == OMX_StatePause) &&
+        ((!CHECK_PORT_BEING_FLUSHED(secOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(secOMXOutputPort)))) {
+        SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME);
+        SEC_OSAL_SignalReset(pSECComponent->pauseEvent);
+    }
+
+    dataBuffer->dataValid     = OMX_FALSE;
+    dataBuffer->dataLen       = 0;
+    dataBuffer->remainDataLen = 0;
+    dataBuffer->usedDataLen   = 0;
+    dataBuffer->bufferHeader  = NULL;
+    dataBuffer->nFlags        = 0;
+    dataBuffer->timeStamp     = 0;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_InputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    OMX_ERRORTYPE       ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT   *pSECPort = NULL;
+    SEC_OMX_DATABUFFER *dataBuffer = NULL;
+    SEC_OMX_MESSAGE*    message = NULL;
+    SEC_OMX_DATABUFFER *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+
+    FunctionIn();
+
+    pSECPort= &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    dataBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+
+    if (pSECComponent->currentState != OMX_StateExecuting) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    } else {
+        SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID);
+        SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
+        if (dataBuffer->dataValid != OMX_TRUE) {
+            message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+            if (message == NULL) {
+                ret = OMX_ErrorUndefined;
+                SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+                goto EXIT;
+            }
+
+            dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData);
+            dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen;
+            dataBuffer->dataLen = dataBuffer->bufferHeader->nFilledLen;
+            dataBuffer->remainDataLen = dataBuffer->dataLen;
+            dataBuffer->usedDataLen = 0; //dataBuffer->bufferHeader->nOffset;
+            dataBuffer->dataValid = OMX_TRUE;
+            dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags;
+            dataBuffer->timeStamp = dataBuffer->bufferHeader->nTimeStamp;
+            pSECComponent->processData[INPUT_PORT_INDEX].dataBuffer = dataBuffer->bufferHeader->pBuffer;
+            pSECComponent->processData[INPUT_PORT_INDEX].allocSize = dataBuffer->bufferHeader->nAllocLen;
+            SEC_OSAL_Free(message);
+        }
+        SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+        ret = OMX_ErrorNone;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT      *secOMXInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOMXOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+    OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader;
+
+    FunctionIn();
+
+    if (bufferHeader != NULL) {
+        bufferHeader->nFilledLen = dataBuffer->remainDataLen;
+        bufferHeader->nOffset    = 0;
+        bufferHeader->nFlags     = dataBuffer->nFlags;
+        bufferHeader->nTimeStamp = dataBuffer->timeStamp;
+
+        if (pSECComponent->propagateMarkType.hMarkTargetComponent != NULL) {
+            bufferHeader->hMarkTargetComponent = pSECComponent->propagateMarkType.hMarkTargetComponent;
+            bufferHeader->pMarkData = pSECComponent->propagateMarkType.pMarkData;
+            pSECComponent->propagateMarkType.hMarkTargetComponent = NULL;
+            pSECComponent->propagateMarkType.pMarkData = NULL;
+        }
+
+        if (bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) {
+            pSECComponent->pCallbacks->EventHandler(pOMXComponent,
+                            pSECComponent->callbackData,
+                            OMX_EventBufferFlag,
+                            OUTPUT_PORT_INDEX,
+                            bufferHeader->nFlags, NULL);
+        }
+
+        if (CHECK_PORT_TUNNELED(secOMXOutputPort)) {
+            OMX_EmptyThisBuffer(secOMXOutputPort->tunneledComponent, bufferHeader);
+        } else {
+            pSECComponent->pCallbacks->FillBufferDone(pOMXComponent, pSECComponent->callbackData, bufferHeader);
+        }
+    }
+
+    if ((pSECComponent->currentState == OMX_StatePause) &&
+        ((!CHECK_PORT_BEING_FLUSHED(secOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(secOMXOutputPort)))) {
+        SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME);
+        SEC_OSAL_SignalReset(pSECComponent->pauseEvent);
+    }
+
+    /* reset dataBuffer */
+    dataBuffer->dataValid     = OMX_FALSE;
+    dataBuffer->dataLen       = 0;
+    dataBuffer->remainDataLen = 0;
+    dataBuffer->usedDataLen   = 0;
+    dataBuffer->bufferHeader  = NULL;
+    dataBuffer->nFlags        = 0;
+    dataBuffer->timeStamp     = 0;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OutputBufferGetQueue(SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    OMX_ERRORTYPE       ret = OMX_ErrorNone;
+    SEC_OMX_BASEPORT   *pSECPort = NULL;
+    SEC_OMX_DATABUFFER *dataBuffer = NULL;
+    SEC_OMX_MESSAGE    *message = NULL;
+    SEC_OMX_DATABUFFER *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+
+    FunctionIn();
+
+    pSECPort= &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    dataBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+
+    if (pSECComponent->currentState != OMX_StateExecuting) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    } else {
+        SEC_OSAL_SemaphoreWait(pSECPort->bufferSemID);
+        SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+        if (dataBuffer->dataValid != OMX_TRUE) {
+            message = (SEC_OMX_MESSAGE *)SEC_OSAL_Dequeue(&pSECPort->bufferQ);
+            if (message == NULL) {
+                ret = OMX_ErrorUndefined;
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+                goto EXIT;
+            }
+
+            dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData);
+            dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen;
+            dataBuffer->dataLen = 0; //dataBuffer->bufferHeader->nFilledLen;
+            dataBuffer->remainDataLen = dataBuffer->dataLen;
+            dataBuffer->usedDataLen = 0; //dataBuffer->bufferHeader->nOffset;
+            dataBuffer->dataValid =OMX_TRUE;
+            /* dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags; */
+            /* dataBuffer->nTimeStamp = dataBuffer->bufferHeader->nTimeStamp; */
+            SEC_OSAL_Free(message);
+        }
+        SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+        ret = OMX_ErrorNone;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+
+}
+
+static OMX_ERRORTYPE SEC_BufferReset(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 portIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    /* SEC_OMX_BASEPORT      *pSECPort = &pSECComponent->pSECPort[portIndex]; */
+    SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[portIndex];
+    /* OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader; */
+
+    dataBuffer->dataValid     = OMX_FALSE;
+    dataBuffer->dataLen       = 0;
+    dataBuffer->remainDataLen = 0;
+    dataBuffer->usedDataLen   = 0;
+    dataBuffer->bufferHeader  = NULL;
+    dataBuffer->nFlags        = 0;
+    dataBuffer->timeStamp     = 0;
+
+    return ret;
+}
+
+static OMX_ERRORTYPE SEC_DataReset(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 portIndex)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    /* SEC_OMX_BASEPORT      *pSECPort = &pSECComponent->pSECPort[portIndex]; */
+    /* SEC_OMX_DATABUFFER    *dataBuffer = &pSECComponent->secDataBuffer[portIndex]; */
+    /* OMX_BUFFERHEADERTYPE  *bufferHeader = dataBuffer->bufferHeader; */
+    SEC_OMX_DATA          *processData = &pSECComponent->processData[portIndex];
+
+    processData->dataLen       = 0;
+    processData->remainDataLen = 0;
+    processData->usedDataLen   = 0;
+    processData->nFlags        = 0;
+    processData->timeStamp     = 0;
+
+    return ret;
+}
+
+OMX_BOOL SEC_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_BOOL               ret = OMX_FALSE;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_DATABUFFER    *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+    SEC_OMX_DATA          *inputData = &pSECComponent->processData[INPUT_PORT_INDEX];
+    OMX_U32                copySize = 0;
+    OMX_BYTE               checkInputStream = NULL;
+    OMX_U32                checkInputStreamLen = 0;
+    OMX_U32                checkedSize = 0;
+    OMX_BOOL               flagEOS = OMX_FALSE;
+    OMX_BOOL               flagEOF = OMX_FALSE;
+    OMX_BOOL               previousFrameEOF = OMX_FALSE;
+
+    if (inputUseBuffer->dataValid == OMX_TRUE) {
+        checkInputStream = inputUseBuffer->bufferHeader->pBuffer + inputUseBuffer->usedDataLen;
+        checkInputStreamLen = inputUseBuffer->remainDataLen;
+
+        if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+            (pSECComponent->bUseFlagEOF == OMX_FALSE)) {
+            pSECComponent->bUseFlagEOF = OMX_TRUE;
+        }
+
+        if (inputData->dataLen == 0) {
+            previousFrameEOF = OMX_TRUE;
+        } else {
+            previousFrameEOF = OMX_FALSE;
+        }
+        if (pSECComponent->bUseFlagEOF == OMX_TRUE) {
+            flagEOF = OMX_TRUE;
+            checkedSize = checkInputStreamLen;
+            if (checkedSize == 0) {
+                SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+                int width = pSECPort->portDefinition.format.video.nFrameWidth;
+                int height = pSECPort->portDefinition.format.video.nFrameHeight;
+                inputUseBuffer->remainDataLen = inputUseBuffer->dataLen = (width * height * 3) / 2;
+                checkedSize = checkInputStreamLen = inputUseBuffer->remainDataLen;
+                inputUseBuffer->nFlags |= OMX_BUFFERFLAG_EOS;
+            }
+            if (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) {
+                flagEOS = OMX_TRUE;
+            }
+        } else {
+            SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+            int width = pSECPort->portDefinition.format.video.nFrameWidth;
+            int height = pSECPort->portDefinition.format.video.nFrameHeight;
+            unsigned int oneFrameSize = 0;
+
+            switch (pSECPort->portDefinition.format.video.eColorFormat) {
+            case OMX_COLOR_FormatYUV420SemiPlanar:
+            case OMX_COLOR_FormatYUV420Planar:
+            case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+            case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+            case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
+            case OMX_SEC_COLOR_FormatNV12Tiled:
+            case OMX_SEC_COLOR_FormatNV21Linear:
+                oneFrameSize = (width * height * 3) / 2;
+                break;
+            case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+                oneFrameSize = ALIGN((ALIGN(width, 16) * ALIGN(height, 16)), 2048) + ALIGN((ALIGN(width, 16) * ALIGN(height >> 1, 8)), 2048);
+                break;
+            default:
+                SEC_OSAL_Log(SEC_LOG_ERROR, "SEC_Preprocessor_InputData: eColorFormat is wrong");
+                break;
+            }
+
+            if (previousFrameEOF == OMX_TRUE) {
+                if (checkInputStreamLen >= oneFrameSize) {
+                    checkedSize = oneFrameSize;
+                    flagEOF = OMX_TRUE;
+                } else {
+                    flagEOF = OMX_FALSE;
+                }
+            } else {
+                if (checkInputStreamLen >= (oneFrameSize - inputData->dataLen)) {
+                    checkedSize = oneFrameSize - inputData->dataLen;
+                    flagEOF = OMX_TRUE;
+                } else {
+                    flagEOF = OMX_FALSE;
+                }
+            }
+
+            if ((flagEOF == OMX_FALSE) && (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS)) {
+                flagEOF = OMX_TRUE;
+                flagEOS = OMX_TRUE;
+            }
+        }
+
+        if (flagEOF == OMX_TRUE) {
+            copySize = checkedSize;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "sec_checkInputFrame : OMX_TRUE");
+        } else {
+            copySize = checkInputStreamLen;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "sec_checkInputFrame : OMX_FALSE");
+        }
+
+        if (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS)
+            pSECComponent->bSaveFlagEOS = OMX_TRUE;
+
+        if (((inputData->allocSize) - (inputData->dataLen)) >= copySize) {
+            SEC_OMX_BASEPORT *pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+            if ((pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV12TPhysicalAddress) &&
+                (pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV12LPhysicalAddress) &&
+                (pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV12LVirtualAddress) &&
+                (pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV21LPhysicalAddress)) {
+                if (flagEOF == OMX_TRUE) {
+                    OMX_U32 width, height;
+                    unsigned int csc_src_color_format, csc_dst_color_format;
+                    unsigned int cacheable = 1;
+                    unsigned char *pSrcBuf[3] = {NULL, };
+                    unsigned char *pDstBuf[3] = {NULL, };
+                    OMX_PTR ppBuf[3];
+
+                    width = pSECPort->portDefinition.format.video.nFrameWidth;
+                    height = pSECPort->portDefinition.format.video.nFrameHeight;
+
+                    pDstBuf[0] = (unsigned char *)pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr;
+                    pDstBuf[1] = (unsigned char *)pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr;
+
+                    SEC_OSAL_Log(SEC_LOG_TRACE, "pVideoEnc->MFCEncInputBuffer[%d].YVirAddr : 0x%x", pVideoEnc->indexInputBuffer, pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr);
+                    SEC_OSAL_Log(SEC_LOG_TRACE, "pVideoEnc->MFCEncInputBuffer[%d].CVirAddr : 0x%x", pVideoEnc->indexInputBuffer, pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr);
+
+                    SEC_OSAL_Log(SEC_LOG_TRACE, "width:%d, height:%d, Ysize:%d", width, height, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height)));
+                    SEC_OSAL_Log(SEC_LOG_TRACE, "width:%d, height:%d, Csize:%d", width, height, ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height / 2)));
+
+                    if (pSECPort->bStoreMetaData == OMX_FALSE) {
+                        pSrcBuf[0]  = checkInputStream;
+                        pSrcBuf[1]  = checkInputStream + (width * height);
+                        pSrcBuf[2]  = checkInputStream + (((width * height) * 5) / 4);
+
+                        switch (pSECPort->portDefinition.format.video.eColorFormat) {
+                        case OMX_COLOR_FormatYUV420Planar:
+                            /* YUV420Planar case it needed changed interleave UV plane (MFC spec.)*/
+                            csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420Planar);
+                            csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                            break;
+                        case OMX_COLOR_FormatYUV420SemiPlanar:
+                        case OMX_SEC_COLOR_FormatNV12Tiled:
+                        case OMX_SEC_COLOR_FormatNV21Linear:
+                            csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                            csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+                            break;
+                        default:
+                            break;
+                        }
+                    }
+#ifdef USE_METADATABUFFERTYPE
+                    else {
+                        if (pSECPort->portDefinition.format.video.eColorFormat == OMX_COLOR_FormatAndroidOpaque) {
+                                OMX_PTR pOutBuffer;
+                                csc_src_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_Format32bitARGB8888);
+                                csc_dst_color_format = omx_2_hal_pixel_format((unsigned int)OMX_COLOR_FormatYUV420SemiPlanar);
+
+                                SEC_OSAL_GetInfoFromMetaData(inputData, ppBuf);
+                                SEC_OSAL_LockANBHandle((OMX_U32)ppBuf[0], width, height, OMX_COLOR_FormatAndroidOpaque, &pOutBuffer);
+                                pSrcBuf[0]  = (unsigned char *)pOutBuffer;
+                                pSrcBuf[1]  = NULL;
+                                pSrcBuf[2]  = NULL;
+                        }
+                    }
+#endif
+
+                    csc_set_src_format(
+                        pVideoEnc->csc_handle,  /* handle */
+                        width,                  /* width */
+                        height,                 /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        width,                  /* crop_width */
+                        height,                 /* crop_height */
+                        csc_src_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    csc_set_dst_format(
+                        pVideoEnc->csc_handle,  /* handle */
+                        width,                  /* width */
+                        height,                 /* height */
+                        0,                      /* crop_left */
+                        0,                      /* crop_right */
+                        width,                  /* crop_width */
+                        height,                 /* crop_height */
+                        csc_dst_color_format,   /* color_format */
+                        cacheable);             /* cacheable */
+                    csc_set_src_buffer(
+                        pVideoEnc->csc_handle,  /* handle */
+                        pSrcBuf[0],             /* y addr */
+                        pSrcBuf[1],             /* u addr or uv addr */
+                        pSrcBuf[2],             /* v addr or none */
+                        0);                     /* ion fd */
+                    csc_set_dst_buffer(
+                        pVideoEnc->csc_handle,  /* handle */
+                        pDstBuf[0],             /* y addr */
+                        pDstBuf[1],             /* u addr or uv addr */
+                        pDstBuf[2],             /* v addr or none */
+                        0);                     /* ion fd */
+                    csc_convert(pVideoEnc->csc_handle);
+
+#ifdef USE_METADATABUFFERTYPE
+                    if (pSECPort->bStoreMetaData == OMX_TRUE) {
+                        SEC_OSAL_UnlockANBHandle((OMX_U32)ppBuf[0]);
+                    }
+#endif
+                }
+            }
+
+            inputUseBuffer->dataLen -= copySize; /* ???????????? do not need ?????????????? */
+            inputUseBuffer->remainDataLen -= copySize;
+            inputUseBuffer->usedDataLen += copySize;
+
+            inputData->dataLen += copySize;
+            inputData->remainDataLen += copySize;
+
+            if (previousFrameEOF == OMX_TRUE) {
+                inputData->timeStamp = inputUseBuffer->timeStamp;
+                inputData->nFlags = inputUseBuffer->nFlags;
+            }
+
+            if (pSECComponent->bUseFlagEOF == OMX_TRUE) {
+                if (pSECComponent->bSaveFlagEOS == OMX_TRUE) {
+                    inputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                    flagEOF = OMX_TRUE;
+                    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+                }
+            } else {
+                if ((checkedSize == checkInputStreamLen) && (pSECComponent->bSaveFlagEOS == OMX_TRUE)) {
+                    inputData->nFlags |= OMX_BUFFERFLAG_EOS;
+                    flagEOF = OMX_TRUE;
+                    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+                } else {
+                    inputData->nFlags = (inputUseBuffer->nFlags & (~OMX_BUFFERFLAG_EOS));
+                }
+            }
+        } else {
+            /*????????????????????????????????? Error ?????????????????????????????????*/
+            SEC_DataReset(pOMXComponent, INPUT_PORT_INDEX);
+            flagEOF = OMX_FALSE;
+        }
+
+        if (inputUseBuffer->remainDataLen == 0) {
+            if(flagEOF == OMX_FALSE)
+                SEC_InputBufferReturn(pOMXComponent);
+        } else {
+            inputUseBuffer->dataValid = OMX_TRUE;
+        }
+    }
+
+    if (flagEOF == OMX_TRUE) {
+        if (pSECComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
+            pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_TRUE;
+            pSECComponent->checkTimeStamp.startTimeStamp = inputData->timeStamp;
+            pSECComponent->checkTimeStamp.nStartFlags = inputData->nFlags;
+            pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+        }
+
+        ret = OMX_TRUE;
+    } else {
+        ret = OMX_FALSE;
+    }
+    return ret;
+}
+
+OMX_BOOL SEC_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_BOOL               ret = OMX_FALSE;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_DATABUFFER    *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATA          *outputData = &pSECComponent->processData[OUTPUT_PORT_INDEX];
+    OMX_U32                copySize = 0;
+
+    if (outputUseBuffer->dataValid == OMX_TRUE) {
+        if (pSECComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE) {
+            if (pSECComponent->checkTimeStamp.startTimeStamp == outputData->timeStamp){
+                pSECComponent->checkTimeStamp.startTimeStamp = -19761123;
+                pSECComponent->checkTimeStamp.nStartFlags = 0x0;
+                pSECComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
+                pSECComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
+            } else {
+                SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+
+                ret = OMX_TRUE;
+                goto EXIT;
+            }
+        } else if (pSECComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) {
+            SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+
+            ret = OMX_TRUE;
+            goto EXIT;
+        }
+
+        if (outputData->remainDataLen <= (outputUseBuffer->allocSize - outputUseBuffer->dataLen)) {
+            copySize = outputData->remainDataLen;
+            if (copySize > 0)
+                SEC_OSAL_Memcpy((outputUseBuffer->bufferHeader->pBuffer + outputUseBuffer->dataLen),
+                        (outputData->dataBuffer + outputData->usedDataLen),
+                         copySize);
+
+            outputUseBuffer->dataLen += copySize;
+            outputUseBuffer->remainDataLen += copySize;
+            outputUseBuffer->nFlags = outputData->nFlags;
+            outputUseBuffer->timeStamp = outputData->timeStamp;
+
+            ret = OMX_TRUE;
+
+            /* reset outputData */
+            SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+
+            if ((outputUseBuffer->remainDataLen > 0) ||
+                (outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS))
+                SEC_OutputBufferReturn(pOMXComponent);
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "output buffer is smaller than encoded data size Out Length");
+
+            ret = OMX_FALSE;
+
+            /* reset outputData */
+            SEC_DataReset(pOMXComponent, OUTPUT_PORT_INDEX);
+        }
+    } else {
+        ret = OMX_FALSE;
+    }
+
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT      *secInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT      *secOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *inputUseBuffer = &pSECComponent->secDataBuffer[INPUT_PORT_INDEX];
+    SEC_OMX_DATABUFFER    *outputUseBuffer = &pSECComponent->secDataBuffer[OUTPUT_PORT_INDEX];
+    SEC_OMX_DATA          *inputData = &pSECComponent->processData[INPUT_PORT_INDEX];
+    SEC_OMX_DATA          *outputData = &pSECComponent->processData[OUTPUT_PORT_INDEX];
+    OMX_U32                copySize = 0;
+
+    pSECComponent->remainOutputData = OMX_FALSE;
+    pSECComponent->reInputData = OMX_FALSE;
+
+    FunctionIn();
+
+    while (!pSECComponent->bExitBufferProcessThread) {
+        SEC_OSAL_SleepMillisec(0);
+
+        if (((pSECComponent->currentState == OMX_StatePause) ||
+            (pSECComponent->currentState == OMX_StateIdle) ||
+            (pSECComponent->transientState == SEC_OMX_TransStateLoadedToIdle) ||
+            (pSECComponent->transientState == SEC_OMX_TransStateExecutingToIdle)) &&
+            (pSECComponent->transientState != SEC_OMX_TransStateIdleToLoaded)&&
+            ((!CHECK_PORT_BEING_FLUSHED(secInputPort) && !CHECK_PORT_BEING_FLUSHED(secOutputPort)))) {
+            SEC_OSAL_SignalWait(pSECComponent->pauseEvent, DEF_MAX_WAIT_TIME);
+            SEC_OSAL_SignalReset(pSECComponent->pauseEvent);
+        }
+
+        while (SEC_Check_BufferProcess_State(pSECComponent) && !pSECComponent->bExitBufferProcessThread) {
+            SEC_OSAL_SleepMillisec(0);
+
+            SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+            if ((outputUseBuffer->dataValid != OMX_TRUE) &&
+                (!CHECK_PORT_BEING_FLUSHED(secOutputPort))) {
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+                ret = SEC_OutputBufferGetQueue(pSECComponent);
+                if ((ret == OMX_ErrorUndefined) ||
+                    (secInputPort->portState != OMX_StateIdle) ||
+                    (secOutputPort->portState != OMX_StateIdle)) {
+                    break;
+                }
+            } else {
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+            }
+
+            if (pSECComponent->remainOutputData == OMX_FALSE) {
+                if (pSECComponent->reInputData == OMX_FALSE) {
+                    SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
+                    if ((SEC_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) &&
+                        (!CHECK_PORT_BEING_FLUSHED(secInputPort))) {
+                            SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+                            ret = SEC_InputBufferGetQueue(pSECComponent);
+                            break;
+                    }
+                    SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+                }
+
+                SEC_OSAL_MutexLock(inputUseBuffer->bufferMutex);
+                SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+                ret = pSECComponent->sec_mfc_bufferProcess(pOMXComponent, inputData, outputData);
+
+                if (inputUseBuffer->remainDataLen == 0)
+                    SEC_InputBufferReturn(pOMXComponent);
+                else
+                    inputUseBuffer->dataValid = OMX_TRUE;
+
+                SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+                SEC_OSAL_MutexUnlock(inputUseBuffer->bufferMutex);
+
+                if (ret == OMX_ErrorInputDataEncodeYet)
+                    pSECComponent->reInputData = OMX_TRUE;
+                else
+                    pSECComponent->reInputData = OMX_FALSE;
+            }
+
+            SEC_OSAL_MutexLock(outputUseBuffer->bufferMutex);
+
+            if (SEC_Postprocess_OutputData(pOMXComponent) == OMX_FALSE)
+                pSECComponent->remainOutputData = OMX_TRUE;
+            else
+                pSECComponent->remainOutputData = OMX_FALSE;
+
+            SEC_OSAL_MutexUnlock(outputUseBuffer->bufferMutex);
+        }
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoEncodeGetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamVideoInit:
+    {
+        OMX_PORT_PARAM_TYPE *portParam = (OMX_PORT_PARAM_TYPE *)ComponentParameterStructure;
+        ret = SEC_OMX_Check_SizeVersion(portParam, sizeof(OMX_PORT_PARAM_TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        portParam->nPorts           = pSECComponent->portParam.nPorts;
+        portParam->nStartPortNumber = pSECComponent->portParam.nStartPortNumber;
+        ret = OMX_ErrorNone;
+    }
+        break;
+    case OMX_IndexParamVideoPortFormat:
+    {
+        OMX_VIDEO_PARAM_PORTFORMATTYPE *portFormat = (OMX_VIDEO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure;
+        OMX_U32                         portIndex = portFormat->nPortIndex;
+        OMX_U32                         index    = portFormat->nIndex;
+        SEC_OMX_BASEPORT               *pSECPort = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE   *portDefinition = NULL;
+        OMX_U32                         supportFormatNum = 0;
+
+        ret = SEC_OMX_Check_SizeVersion(portFormat, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((portIndex >= pSECComponent->portParam.nPorts)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+
+        if (portIndex == INPUT_PORT_INDEX) {
+            supportFormatNum = INPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1;
+            if (index > supportFormatNum) {
+                ret = OMX_ErrorNoMore;
+                goto EXIT;
+            }
+
+            pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+            portDefinition = &pSECPort->portDefinition;
+
+            switch (index) {
+            case supportFormat_0:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_COLOR_FormatYUV420Planar;
+                portFormat->xFramerate           = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_1:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12TPhysicalAddress;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_2:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12LPhysicalAddress;
+                portFormat->xFramerate           = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_3:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_COLOR_FormatYUV420SemiPlanar;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_4:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12Tiled;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_5:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV12LVirtualAddress;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_6:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV21LPhysicalAddress;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_7:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_SEC_COLOR_FormatNV21Linear;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            case supportFormat_8:
+                portFormat->eCompressionFormat = OMX_VIDEO_CodingUnused;
+                portFormat->eColorFormat       = OMX_COLOR_FormatAndroidOpaque;
+                portFormat->xFramerate         = portDefinition->format.video.xFramerate;
+                break;
+            }
+        } else if (portIndex == OUTPUT_PORT_INDEX) {
+            supportFormatNum = OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1;
+            if (index > supportFormatNum) {
+                ret = OMX_ErrorNoMore;
+                goto EXIT;
+            }
+
+            pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+            portDefinition = &pSECPort->portDefinition;
+
+            portFormat->eCompressionFormat = portDefinition->format.video.eCompressionFormat;
+            portFormat->eColorFormat       = portDefinition->format.video.eColorFormat;
+            portFormat->xFramerate           = portDefinition->format.video.xFramerate;
+        }
+        ret = OMX_ErrorNone;
+    }
+        break;
+    case OMX_IndexParamVideoBitrate:
+    {
+        OMX_VIDEO_PARAM_BITRATETYPE  *videoRateControl = (OMX_VIDEO_PARAM_BITRATETYPE *)ComponentParameterStructure;
+        OMX_U32                       portIndex = videoRateControl->nPortIndex;
+        SEC_OMX_BASEPORT         *pSECPort = NULL;
+        SEC_OMX_VIDEOENC_COMPONENT   *pVideoEnc = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = NULL;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            portDefinition = &pSECPort->portDefinition;
+
+            videoRateControl->eControlRate = pVideoEnc->eControlRate[portIndex];
+            videoRateControl->nTargetBitrate = portDefinition->format.video.nBitrate;
+        }
+        ret = OMX_ErrorNone;
+    }
+        break;
+    case OMX_IndexParamVideoQuantization:
+    {
+        OMX_VIDEO_PARAM_QUANTIZATIONTYPE  *videoQuantizationControl = (OMX_VIDEO_PARAM_QUANTIZATIONTYPE *)ComponentParameterStructure;
+        OMX_U32                       portIndex = videoQuantizationControl->nPortIndex;
+        SEC_OMX_BASEPORT         *pSECPort = NULL;
+        SEC_OMX_VIDEOENC_COMPONENT   *pVideoEnc = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = NULL;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            portDefinition = &pSECPort->portDefinition;
+
+            videoQuantizationControl->nQpI = pVideoEnc->quantization.nQpI;
+            videoQuantizationControl->nQpP = pVideoEnc->quantization.nQpP;
+            videoQuantizationControl->nQpB = pVideoEnc->quantization.nQpB;
+        }
+        ret = OMX_ErrorNone;
+
+    }
+        break;
+    case OMX_IndexParamPortDefinition:
+    {
+        OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure;
+        OMX_U32                       portIndex = portDefinition->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort;
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+        ret = SEC_OMX_Check_SizeVersion(portDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+        SEC_OSAL_Memcpy(portDefinition, &pSECPort->portDefinition, portDefinition->nSize);
+
+#ifdef USE_STOREMETADATA
+        if ((portIndex == 0) &&
+            (pSECPort->bStoreMetaData == OMX_TRUE) &&
+            (pSECPort->portDefinition.format.video.eColorFormat != OMX_SEC_COLOR_FormatNV12LVirtualAddress)) {
+            portDefinition->nBufferSize = MAX_INPUT_METADATA_BUFFER_SIZE;
+        }
+#endif
+    }
+        break;
+    default:
+    {
+        ret = SEC_OMX_GetParameter(hComponent, nParamIndex, ComponentParameterStructure);
+    }
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+OMX_ERRORTYPE SEC_OMX_VideoEncodeSetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamVideoPortFormat:
+    {
+        OMX_VIDEO_PARAM_PORTFORMATTYPE *portFormat = (OMX_VIDEO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure;
+        OMX_U32                         portIndex = portFormat->nPortIndex;
+        OMX_U32                         index    = portFormat->nIndex;
+        SEC_OMX_BASEPORT               *pSECPort = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE   *portDefinition = NULL;
+        OMX_U32                         supportFormatNum = 0;
+
+        ret = SEC_OMX_Check_SizeVersion(portFormat, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((portIndex >= pSECComponent->portParam.nPorts)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            portDefinition = &pSECPort->portDefinition;
+
+            portDefinition->format.video.eColorFormat       = portFormat->eColorFormat;
+            portDefinition->format.video.eCompressionFormat = portFormat->eCompressionFormat;
+            portDefinition->format.video.xFramerate         = portFormat->xFramerate;
+        }
+    }
+        break;
+    case OMX_IndexParamVideoBitrate:
+    {
+        OMX_VIDEO_PARAM_BITRATETYPE  *videoRateControl = (OMX_VIDEO_PARAM_BITRATETYPE *)ComponentParameterStructure;
+        OMX_U32                       portIndex = videoRateControl->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort = NULL;
+        SEC_OMX_VIDEOENC_COMPONENT   *pVideoEnc = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = NULL;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            portDefinition = &pSECPort->portDefinition;
+
+            pVideoEnc->eControlRate[portIndex] = videoRateControl->eControlRate;
+            portDefinition->format.video.nBitrate = videoRateControl->nTargetBitrate;
+        }
+        ret = OMX_ErrorNone;
+    }
+        break;
+    case OMX_IndexParamVideoQuantization:
+    {
+        OMX_VIDEO_PARAM_QUANTIZATIONTYPE  *videoQuantizationControl = (OMX_VIDEO_PARAM_QUANTIZATIONTYPE *)ComponentParameterStructure;
+        OMX_U32                       portIndex = videoQuantizationControl->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort = NULL;
+        SEC_OMX_VIDEOENC_COMPONENT   *pVideoEnc = NULL;
+        OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = NULL;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            portDefinition = &pSECPort->portDefinition;
+
+            pVideoEnc->quantization.nQpI = videoQuantizationControl->nQpI;
+            pVideoEnc->quantization.nQpP = videoQuantizationControl->nQpP;
+            pVideoEnc->quantization.nQpB = videoQuantizationControl->nQpB;
+        }
+        ret = OMX_ErrorNone;
+    }
+        break;
+    case OMX_IndexParamPortDefinition:
+    {
+        OMX_PARAM_PORTDEFINITIONTYPE *pPortDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure;
+        OMX_U32                       portIndex = pPortDefinition->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort;
+        OMX_U32 width, height, size;
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+        ret = SEC_OMX_Check_SizeVersion(pPortDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            if (pSECPort->portDefinition.bEnabled == OMX_TRUE) {
+                ret = OMX_ErrorIncorrectStateOperation;
+                goto EXIT;
+            }
+        }
+        if(pPortDefinition->nBufferCountActual < pSECPort->portDefinition.nBufferCountMin) {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+
+        SEC_OSAL_Memcpy(&pSECPort->portDefinition, pPortDefinition, pPortDefinition->nSize);
+        if (portIndex == INPUT_PORT_INDEX) {
+            SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+            SEC_UpdateFrameSize(pOMXComponent);
+            SEC_OSAL_Log(SEC_LOG_TRACE, "pSECOutputPort->portDefinition.nBufferSize: %d",
+                            pSECOutputPort->portDefinition.nBufferSize);
+        }
+        ret = OMX_ErrorNone;
+    }
+        break;
+#ifdef USE_STOREMETADATA
+    case OMX_IndexParamStoreMetaDataBuffer:
+    {
+        ret = SEC_OSAL_SetANBParameter(hComponent, nIndex, ComponentParameterStructure);
+    }
+        break;
+#endif
+    default:
+    {
+        ret = SEC_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure);
+    }
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoEncodeGetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexConfigVideoBitrate:
+    {
+        OMX_VIDEO_CONFIG_BITRATETYPE *pEncodeBitrate = (OMX_VIDEO_CONFIG_BITRATETYPE *)pComponentConfigStructure;
+        OMX_U32                       portIndex = pEncodeBitrate->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort = NULL;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            pEncodeBitrate->nEncodeBitrate = pSECPort->portDefinition.format.video.nBitrate;
+        }
+    }
+        break;
+    case OMX_IndexConfigVideoFramerate:
+    {
+        OMX_CONFIG_FRAMERATETYPE *pFramerate = (OMX_CONFIG_FRAMERATETYPE *)pComponentConfigStructure;
+        OMX_U32                   portIndex = pFramerate->nPortIndex;
+        SEC_OMX_BASEPORT         *pSECPort = NULL;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            pFramerate->xEncodeFramerate = pSECPort->portDefinition.format.video.xFramerate;
+        }
+    }
+        break;
+    default:
+        ret = SEC_OMX_SetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoEncodeSetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+    {
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexConfigVideoBitrate:
+    {
+        OMX_VIDEO_CONFIG_BITRATETYPE *pEncodeBitrate = (OMX_VIDEO_CONFIG_BITRATETYPE *)pComponentConfigStructure;
+        OMX_U32                       portIndex = pEncodeBitrate->nPortIndex;
+        SEC_OMX_BASEPORT             *pSECPort = NULL;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            pSECPort->portDefinition.format.video.nBitrate = pEncodeBitrate->nEncodeBitrate;
+        }
+    }
+        break;
+    case OMX_IndexConfigVideoFramerate:
+    {
+        OMX_CONFIG_FRAMERATETYPE *pFramerate = (OMX_CONFIG_FRAMERATETYPE *)pComponentConfigStructure;
+        OMX_U32                   portIndex = pFramerate->nPortIndex;
+        SEC_OMX_BASEPORT         *pSECPort = NULL;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pSECPort = &pSECComponent->pSECPort[portIndex];
+            pSECPort->portDefinition.format.video.xFramerate = pFramerate->xEncodeFramerate;
+        }
+    }
+        break;
+    case OMX_IndexConfigVideoIntraVOPRefresh:
+    {
+        OMX_CONFIG_INTRAREFRESHVOPTYPE *pIntraRefreshVOP = (OMX_CONFIG_INTRAREFRESHVOPTYPE *)pComponentConfigStructure;
+        SEC_OMX_VIDEOENC_COMPONENT *pVEncBase = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+        OMX_U32 portIndex = pIntraRefreshVOP->nPortIndex;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pVEncBase->IntraRefreshVOP = pIntraRefreshVOP->IntraRefreshVOP;
+        }
+    }
+        break;
+    default:
+        ret = SEC_OMX_SetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoEncodeGetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+#ifdef USE_STOREMETADATA
+    if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_PARAM_STORE_METADATA_BUFFER) == 0) {
+        *pIndexType = (OMX_INDEXTYPE) OMX_IndexParamStoreMetaDataBuffer;
+    } else {
+        ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
+    }
+#else
+    ret = SEC_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType);
+#endif
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoEncodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_BaseComponent_Constructor(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    ret = SEC_OMX_Port_Constructor(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OMX_BaseComponent_Destructor(pOMXComponent);
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pVideoEnc = SEC_OSAL_Malloc(sizeof(SEC_OMX_VIDEOENC_COMPONENT));
+    if (pVideoEnc == NULL) {
+        SEC_OMX_BaseComponent_Destructor(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    SEC_OSAL_Memset(pVideoEnc, 0, sizeof(SEC_OMX_VIDEOENC_COMPONENT));
+    pSECComponent->hComponentHandle = (OMX_HANDLETYPE)pVideoEnc;
+
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+
+    pVideoEnc->configChange = OMX_FALSE;
+    pVideoEnc->quantization.nQpI = 20;
+    pVideoEnc->quantization.nQpP = 20;
+    pVideoEnc->quantization.nQpB = 20;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.nBufferCountActual = MAX_VIDEO_INPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferCountMin = MAX_VIDEO_INPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferSize = 0;
+    pSECPort->portDefinition.eDomain = OMX_PortDomainVideo;
+
+    pSECPort->portDefinition.format.video.cMIMEType = SEC_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+
+    pSECPort->portDefinition.format.video.nFrameWidth = 0;
+    pSECPort->portDefinition.format.video.nFrameHeight= 0;
+    pSECPort->portDefinition.format.video.nStride = 0;
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.format.video.nBitrate = 64000;
+    pSECPort->portDefinition.format.video.xFramerate = (15 << 16);
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.format.video.pNativeWindow = NULL;
+    pVideoEnc->eControlRate[INPUT_PORT_INDEX] = OMX_Video_ControlRateDisable;
+
+    pSECPort->bStoreMetaData = OMX_FALSE;
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.nBufferCountActual = MAX_VIDEO_OUTPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferCountMin = MAX_VIDEO_OUTPUTBUFFER_NUM;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.eDomain = OMX_PortDomainVideo;
+
+    pSECPort->portDefinition.format.video.cMIMEType = SEC_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+
+    pSECPort->portDefinition.format.video.nFrameWidth = 0;
+    pSECPort->portDefinition.format.video.nFrameHeight= 0;
+    pSECPort->portDefinition.format.video.nStride = 0;
+    pSECPort->portDefinition.format.video.nSliceHeight = 0;
+    pSECPort->portDefinition.format.video.nBitrate = 64000;
+    pSECPort->portDefinition.format.video.xFramerate = (15 << 16);
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.format.video.pNativeWindow = NULL;
+    pVideoEnc->eControlRate[OUTPUT_PORT_INDEX] = OMX_Video_ControlRateDisable;
+
+    pOMXComponent->UseBuffer              = &SEC_OMX_UseBuffer;
+    pOMXComponent->AllocateBuffer         = &SEC_OMX_AllocateBuffer;
+    pOMXComponent->FreeBuffer             = &SEC_OMX_FreeBuffer;
+    pOMXComponent->ComponentTunnelRequest = &SEC_OMX_ComponentTunnelRequest;
+
+    pSECComponent->sec_AllocateTunnelBuffer = &SEC_OMX_AllocateTunnelBuffer;
+    pSECComponent->sec_FreeTunnelBuffer     = &SEC_OMX_FreeTunnelBuffer;
+    pSECComponent->sec_BufferProcess        = &SEC_OMX_BufferProcess;
+    pSECComponent->sec_BufferReset          = &SEC_BufferReset;
+    pSECComponent->sec_InputBufferReturn    = &SEC_InputBufferReturn;
+    pSECComponent->sec_OutputBufferReturn   = &SEC_OutputBufferReturn;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_VideoEncodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_BASEPORT      *pSECPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    int                    i = 0;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OSAL_Free(pVideoEnc);
+    pSECComponent->hComponentHandle = pVideoEnc = NULL;
+
+    for(i = 0; i < ALL_PORT_NUM; i++) {
+        pSECPort = &pSECComponent->pSECPort[i];
+        SEC_OSAL_Free(pSECPort->portDefinition.format.video.cMIMEType);
+        pSECPort->portDefinition.format.video.cMIMEType = NULL;
+    }
+
+    ret = SEC_OMX_Port_Destructor(pOMXComponent);
+
+    ret = SEC_OMX_BaseComponent_Destructor(hComponent);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/SEC_OMX_Venc.h b/exynos4/multimedia/openmax/sec_omx/component/video/enc/SEC_OMX_Venc.h
new file mode 100644
index 0000000..6225fd3
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/SEC_OMX_Venc.h
@@ -0,0 +1,166 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Venc.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ *              Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_VIDEO_ENCODE
+#define SEC_OMX_VIDEO_ENCODE
+
+#include "OMX_Component.h"
+#include "SEC_OMX_Def.h"
+#include "SEC_OSAL_Queue.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Basecomponent.h"
+
+#define MAX_VIDEO_INPUTBUFFER_NUM    5
+#define MAX_VIDEO_OUTPUTBUFFER_NUM   4
+
+#define DEFAULT_FRAME_WIDTH          176
+#define DEFAULT_FRAME_HEIGHT         144
+
+#define DEFAULT_VIDEO_INPUT_BUFFER_SIZE    ALIGN_TO_8KB(ALIGN_TO_128B(DEFAULT_FRAME_WIDTH) * ALIGN_TO_32B(DEFAULT_FRAME_HEIGHT)) \
+                                           + ALIGN_TO_8KB(ALIGN_TO_128B(DEFAULT_FRAME_WIDTH) * ALIGN_TO_32B(DEFAULT_FRAME_HEIGHT / 2))
+                                           /* (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2 */
+#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE   DEFAULT_VIDEO_INPUT_BUFFER_SIZE
+
+#define MFC_INPUT_BUFFER_NUM_MAX            2
+
+#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX    9
+#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX   1
+
+#ifdef USE_STOREMETADATA
+// The largest metadata buffer size advertised
+// when metadata buffer mode is used for video encoding
+#define  MAX_INPUT_METADATA_BUFFER_SIZE (64)
+#endif
+
+typedef struct
+{
+    void *pAddrY;
+    void *pAddrC;
+} MFC_ENC_ADDR_INFO;
+
+typedef struct _SEC_MFC_NBENC_THREAD
+{
+    OMX_HANDLETYPE  hNBEncodeThread;
+    OMX_HANDLETYPE  hEncFrameStart;
+    OMX_HANDLETYPE  hEncFrameEnd;
+    OMX_BOOL        bExitEncodeThread;
+    OMX_BOOL        bEncoderRun;
+} SEC_MFC_NBENC_THREAD;
+
+typedef struct _MFC_ENC_INPUT_BUFFER
+{
+    void *YPhyAddr; // physical address of Y
+    void *CPhyAddr; // physical address of CbCr
+    void *YVirAddr; // virtual address of Y
+    void *CVirAddr; // virtual address of CbCr
+    int YBufferSize; // input buffer alloc size of Y
+    int CBufferSize; // input buffer alloc size of CbCr
+    int YDataSize;  // input size of Y data
+    int CDataSize;  // input size of CbCr data
+} MFC_ENC_INPUT_BUFFER;
+
+typedef struct _SEC_OMX_VIDEOENC_COMPONENT
+{
+    OMX_HANDLETYPE hCodecHandle;
+    SEC_MFC_NBENC_THREAD NBEncThread;
+
+    OMX_BOOL configChange;
+    OMX_BOOL IntraRefreshVOP;
+    OMX_VIDEO_CONTROLRATETYPE eControlRate[ALL_PORT_NUM];
+    OMX_VIDEO_PARAM_QUANTIZATIONTYPE quantization;
+    OMX_BOOL bFirstFrame;
+    MFC_ENC_INPUT_BUFFER MFCEncInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
+    OMX_U32  indexInputBuffer;
+
+    /* CSC handle */
+    OMX_PTR csc_handle;
+} SEC_OMX_VIDEOENC_COMPONENT;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OMX_UseBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes,
+    OMX_IN OMX_U8                   *pBuffer);
+OMX_ERRORTYPE SEC_OMX_AllocateBuffer(
+    OMX_IN OMX_HANDLETYPE            hComponent,
+    OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer,
+    OMX_IN OMX_U32                   nPortIndex,
+    OMX_IN OMX_PTR                   pAppPrivate,
+    OMX_IN OMX_U32                   nSizeBytes);
+OMX_ERRORTYPE SEC_OMX_FreeBuffer(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_U32        nPortIndex,
+    OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr);
+OMX_ERRORTYPE SEC_OMX_AllocateTunnelBuffer(
+    SEC_OMX_BASEPORT *pOMXBasePort,
+    OMX_U32           nPortIndex);
+OMX_ERRORTYPE SEC_OMX_FreeTunnelBuffer(
+    SEC_OMX_BASEPORT *pOMXBasePort,
+    OMX_U32           nPortIndex);
+OMX_ERRORTYPE SEC_OMX_ComponentTunnelRequest(
+    OMX_IN OMX_HANDLETYPE  hComp,
+    OMX_IN OMX_U32         nPort,
+    OMX_IN OMX_HANDLETYPE  hTunneledComp,
+    OMX_IN OMX_U32         nTunneledPort,
+    OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup);
+OMX_ERRORTYPE SEC_OMX_BufferProcess(OMX_HANDLETYPE hComponent);
+OMX_ERRORTYPE SEC_OMX_VideoEncodeGetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     ComponentParameterStructure);
+OMX_ERRORTYPE SEC_OMX_VideoEncodeSetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        ComponentParameterStructure);
+OMX_ERRORTYPE SEC_OMX_VideoEncodeGetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure);
+OMX_ERRORTYPE SEC_OMX_VideoEncodeSetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure);
+OMX_ERRORTYPE SEC_OMX_VideoEncodeGetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType);
+OMX_ERRORTYPE SEC_OMX_VideoEncodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent);
+OMX_ERRORTYPE SEC_OMX_VideoEncodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent);
+OMX_BOOL SEC_Check_BufferProcess_State(SEC_OMX_BASECOMPONENT *pSECComponent);
+inline void SEC_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/Android.mk
new file mode 100644
index 0000000..d8c7b06
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/Android.mk
@@ -0,0 +1,39 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_H264enc.c \
+	library_register.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libOMX.SEC.AVC.Encoder
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx
+
+LOCAL_CFLAGS :=
+
+ifeq ($(BOARD_NONBLOCK_MODE_PROCESS), true)
+LOCAL_CFLAGS += -DNONBLOCK_MODE_PROCESS
+endif
+
+ifeq ($(BOARD_USE_METADATABUFFERTYPE), true)
+LOCAL_CFLAGS += -DUSE_METADATABUFFERTYPE
+endif
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc libsecosal libsecbasecomponent \
+	libswconverter libsecmfcapi
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
+	libSEC_OMX_Resourcemanager libcsc
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/video/enc \
+    $(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO)
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/SEC_OMX_H264enc.c b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/SEC_OMX_H264enc.c
new file mode 100644
index 0000000..24123d7
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/SEC_OMX_H264enc.c
@@ -0,0 +1,1605 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_H264enc.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Macros.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Venc.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Thread.h"
+#include "SEC_OSAL_Android.h"
+#include "library_register.h"
+#include "SEC_OMX_H264enc.h"
+#include "SsbSipMfcApi.h"
+#include "csc.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_H264_ENC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+/* H.264 Encoder Supported Levels & profiles */
+SEC_OMX_VIDEO_PROFILELEVEL supportedAVCProfileLevels[] ={
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel1b},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel11},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel12},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel13},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel2},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel21},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel22},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel3},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel31},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel32},
+    {OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel4},
+
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel1b},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel11},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel12},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel13},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel2},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel21},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel22},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel3},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel31},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel32},
+    {OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel4},
+
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel1},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel1b},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel11},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel12},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel13},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel2},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel21},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel22},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel3},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel31},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel32},
+    {OMX_VIDEO_AVCProfileHigh, OMX_VIDEO_AVCLevel4}};
+
+
+OMX_U32 OMXAVCProfileToProfileIDC(OMX_VIDEO_AVCPROFILETYPE profile)
+{
+    OMX_U32 ret = 0; //default OMX_VIDEO_AVCProfileMain
+
+    if (profile == OMX_VIDEO_AVCProfileMain)
+        ret = 0;
+    else if (profile == OMX_VIDEO_AVCProfileHigh)
+        ret = 1;
+    else if (profile == OMX_VIDEO_AVCProfileBaseline)
+        ret = 2;
+
+    return ret;
+}
+
+OMX_U32 OMXAVCLevelToLevelIDC(OMX_VIDEO_AVCLEVELTYPE level)
+{
+    OMX_U32 ret = 40; //default OMX_VIDEO_AVCLevel4
+
+    if (level == OMX_VIDEO_AVCLevel1)
+        ret = 10;
+    else if (level == OMX_VIDEO_AVCLevel1b)
+        ret = 9;
+    else if (level == OMX_VIDEO_AVCLevel11)
+        ret = 11;
+    else if (level == OMX_VIDEO_AVCLevel12)
+        ret = 12;
+    else if (level == OMX_VIDEO_AVCLevel13)
+        ret = 13;
+    else if (level == OMX_VIDEO_AVCLevel2)
+        ret = 20;
+    else if (level == OMX_VIDEO_AVCLevel21)
+        ret = 21;
+    else if (level == OMX_VIDEO_AVCLevel22)
+        ret = 22;
+    else if (level == OMX_VIDEO_AVCLevel3)
+        ret = 30;
+    else if (level == OMX_VIDEO_AVCLevel31)
+        ret = 31;
+    else if (level == OMX_VIDEO_AVCLevel32)
+        ret = 32;
+    else if (level == OMX_VIDEO_AVCLevel4)
+        ret = 40;
+
+    return ret;
+}
+
+OMX_U8 *FindDelimiter(OMX_U8 *pBuffer, OMX_U32 size)
+{
+    OMX_U32 i;
+
+    for (i = 0; i < size - 3; i++) {
+        if ((pBuffer[i] == 0x00)   &&
+            (pBuffer[i + 1] == 0x00) &&
+            (pBuffer[i + 2] == 0x00) &&
+            (pBuffer[i + 3] == 0x01))
+            return (pBuffer + i);
+    }
+
+    return NULL;
+}
+
+void H264PrintParams(SSBSIP_MFC_ENC_H264_PARAM *h264Arg)
+{
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SourceWidth             : %d\n", h264Arg->SourceWidth);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SourceHeight            : %d\n", h264Arg->SourceHeight);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "ProfileIDC              : %d\n", h264Arg->ProfileIDC);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "LevelIDC                : %d\n", h264Arg->LevelIDC);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "IDRPeriod               : %d\n", h264Arg->IDRPeriod);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "NumberReferenceFrames   : %d\n", h264Arg->NumberReferenceFrames);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "NumberRefForPframes     : %d\n", h264Arg->NumberRefForPframes);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SliceMode               : %d\n", h264Arg->SliceMode);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SliceArgument           : %d\n", h264Arg->SliceArgument);
+#ifdef USE_SLICE_OUTPUT_MODE
+    SEC_OSAL_Log(SEC_LOG_TRACE, "OutputMode              : %d\n", h264Arg->OutputMode);
+#endif
+    SEC_OSAL_Log(SEC_LOG_TRACE, "NumberBFrames           : %d\n", h264Arg->NumberBFrames);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "LoopFilterDisable       : %d\n", h264Arg->LoopFilterDisable);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "LoopFilterAlphaC0Offset : %d\n", h264Arg->LoopFilterAlphaC0Offset);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "LoopFilterBetaOffset    : %d\n", h264Arg->LoopFilterBetaOffset);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SymbolMode              : %d\n", h264Arg->SymbolMode);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "PictureInterlace        : %d\n", h264Arg->PictureInterlace);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "Transform8x8Mode        : %d\n", h264Arg->Transform8x8Mode);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "RandomIntraMBRefresh    : %d\n", h264Arg->RandomIntraMBRefresh);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "PadControlOn            : %d\n", h264Arg->PadControlOn);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "LumaPadVal              : %d\n", h264Arg->LumaPadVal);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "CbPadVal                : %d\n", h264Arg->CbPadVal);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "CrPadVal                : %d\n", h264Arg->CrPadVal);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "EnableFRMRateControl    : %d\n", h264Arg->EnableFRMRateControl);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "EnableMBRateControl     : %d\n", h264Arg->EnableMBRateControl);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameRate               : %d\n", h264Arg->FrameRate);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "Bitrate                 : %d\n", h264Arg->Bitrate);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameQp                 : %d\n", h264Arg->FrameQp);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "QSCodeMax               : %d\n", h264Arg->QSCodeMax);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "QSCodeMin               : %d\n", h264Arg->QSCodeMin);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "CBRPeriodRf             : %d\n", h264Arg->CBRPeriodRf);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "DarkDisable             : %d\n", h264Arg->DarkDisable);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SmoothDisable           : %d\n", h264Arg->SmoothDisable);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "StaticDisable           : %d\n", h264Arg->StaticDisable);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "ActivityDisable         : %d\n", h264Arg->ActivityDisable);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameMap                : %d\n", h264Arg->FrameMap);
+}
+
+void Set_H264Enc_Param(SSBSIP_MFC_ENC_H264_PARAM *pH264Arg, SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    SEC_OMX_BASEPORT          *pSECInputPort = NULL;
+    SEC_OMX_BASEPORT          *pSECOutputPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_H264ENC_HANDLE        *pH264Enc = NULL;
+
+    pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    pH264Arg->codecType    = H264_ENC;
+    pH264Arg->SourceWidth  = pSECOutputPort->portDefinition.format.video.nFrameWidth;
+    pH264Arg->SourceHeight = pSECOutputPort->portDefinition.format.video.nFrameHeight;
+    pH264Arg->IDRPeriod    = pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames + 1;
+    pH264Arg->SliceMode    = 0;
+#ifdef USE_SLICE_OUTPUT_MODE
+    pH264Arg->OutputMode   = FRAME;
+#endif
+    pH264Arg->RandomIntraMBRefresh = 0;
+    pH264Arg->Bitrate      = pSECOutputPort->portDefinition.format.video.nBitrate;
+    pH264Arg->QSCodeMax    = 51;
+    pH264Arg->QSCodeMin    = 10;
+    pH264Arg->PadControlOn = 0;             // 0: disable, 1: enable
+    pH264Arg->LumaPadVal   = 0;
+    pH264Arg->CbPadVal     = 0;
+    pH264Arg->CrPadVal     = 0;
+
+    pH264Arg->ProfileIDC   = OMXAVCProfileToProfileIDC(pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].eProfile); //0;  //(OMX_VIDEO_AVCProfileMain)
+    pH264Arg->LevelIDC     = OMXAVCLevelToLevelIDC(pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].eLevel);       //40; //(OMX_VIDEO_AVCLevel4)
+    pH264Arg->FrameRate    = (pSECInputPort->portDefinition.format.video.xFramerate) >> 16;
+    pH264Arg->SliceArgument = 0;          // Slice mb/byte size number
+    pH264Arg->NumberBFrames = 0;            // 0 ~ 2
+    pH264Arg->NumberReferenceFrames = 1;
+    pH264Arg->NumberRefForPframes   = 1;
+    pH264Arg->LoopFilterDisable     = 1;    // 1: Loop Filter Disable, 0: Filter Enable
+    pH264Arg->LoopFilterAlphaC0Offset = 0;
+    pH264Arg->LoopFilterBetaOffset    = 0;
+    pH264Arg->SymbolMode       = 0;         // 0: CAVLC, 1: CABAC
+    pH264Arg->PictureInterlace = 0;
+    pH264Arg->Transform8x8Mode = 0;         // 0: 4x4, 1: allow 8x8
+    pH264Arg->DarkDisable     = 1;
+    pH264Arg->SmoothDisable   = 1;
+    pH264Arg->StaticDisable   = 1;
+    pH264Arg->ActivityDisable = 1;
+
+    pH264Arg->FrameQp      = pVideoEnc->quantization.nQpI;
+    pH264Arg->FrameQp_P    = pVideoEnc->quantization.nQpP;
+    pH264Arg->FrameQp_B    = pVideoEnc->quantization.nQpB;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pVideoEnc->eControlRate[OUTPUT_PORT_INDEX]: 0x%x", pVideoEnc->eControlRate[OUTPUT_PORT_INDEX]);
+    switch (pVideoEnc->eControlRate[OUTPUT_PORT_INDEX]) {
+    case OMX_Video_ControlRateVariable:
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+        pH264Arg->EnableFRMRateControl = 0;        // 0: Disable, 1: Frame level RC
+        pH264Arg->EnableMBRateControl  = 0;        // 0: Disable, 1:MB level RC
+        pH264Arg->CBRPeriodRf  = 100;
+        break;
+    case OMX_Video_ControlRateConstant:
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode CBR");
+        pH264Arg->EnableFRMRateControl = 1;        // 0: Disable, 1: Frame level RC
+        pH264Arg->EnableMBRateControl  = 1;         // 0: Disable, 1:MB level RC
+        pH264Arg->CBRPeriodRf  = 10;
+        break;
+    case OMX_Video_ControlRateDisable:
+    default: //Android default
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+        pH264Arg->EnableFRMRateControl = 0;
+        pH264Arg->EnableMBRateControl  = 0;
+        pH264Arg->CBRPeriodRf  = 100;
+        break;
+    }
+
+    switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) {
+    case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+    case OMX_COLOR_FormatYUV420SemiPlanar:
+    case OMX_COLOR_FormatYUV420Planar:
+#ifdef USE_METADATABUFFERTYPE
+    case OMX_COLOR_FormatAndroidOpaque:
+#endif
+        pH264Arg->FrameMap = NV12_LINEAR;
+        break;
+    case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12Tiled:
+        pH264Arg->FrameMap = NV12_TILE;
+        break;
+    case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV21Linear:
+        pH264Arg->FrameMap = NV21_LINEAR;
+        break;
+    default:
+        pH264Arg->FrameMap = NV12_TILE;
+        break;
+    }
+
+    H264PrintParams(pH264Arg);
+}
+
+void Change_H264Enc_Param(SSBSIP_MFC_ENC_H264_PARAM *pH264Arg, SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    SEC_OMX_BASEPORT          *pSECInputPort = NULL;
+    SEC_OMX_BASEPORT          *pSECOutputPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_H264ENC_HANDLE        *pH264Enc = NULL;
+
+    pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    if (pVideoEnc->IntraRefreshVOP == OMX_TRUE) {
+        int set_conf_IntraRefreshVOP = 1;
+        SsbSipMfcEncSetConfig(pH264Enc->hMFCH264Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_FRAME_TYPE,
+                                &set_conf_IntraRefreshVOP);
+        pVideoEnc->IntraRefreshVOP = OMX_FALSE;
+    }
+    if (pH264Arg->IDRPeriod != (int)pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames + 1) {
+        int set_conf_IDRPeriod = pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames + 1;
+        SsbSipMfcEncSetConfig(pH264Enc->hMFCH264Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_I_PERIOD,
+                                &set_conf_IDRPeriod);
+    }
+    if (pH264Arg->Bitrate != (int)pSECOutputPort->portDefinition.format.video.nBitrate) {
+        int set_conf_bitrate = pSECOutputPort->portDefinition.format.video.nBitrate;
+        SsbSipMfcEncSetConfig(pH264Enc->hMFCH264Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_CHANGE_BIT_RATE,
+                                &set_conf_bitrate);
+    }
+    if (pH264Arg->FrameRate != (int)((pSECOutputPort->portDefinition.format.video.xFramerate) >> 16)) {
+        int set_conf_framerate = (pSECInputPort->portDefinition.format.video.xFramerate) >> 16;
+        SsbSipMfcEncSetConfig(pH264Enc->hMFCH264Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_CHANGE_FRAME_RATE,
+                                &set_conf_framerate);
+    }
+
+    Set_H264Enc_Param(pH264Arg, pSECComponent);
+    H264PrintParams(pH264Arg);
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Enc_GetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR     pComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamVideoAvc:
+    {
+        OMX_VIDEO_PARAM_AVCTYPE *pDstAVCComponent = (OMX_VIDEO_PARAM_AVCTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_AVCTYPE *pSrcAVCComponent = NULL;
+        SEC_H264ENC_HANDLE      *pH264Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstAVCComponent->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcAVCComponent = &pH264Enc->AVCComponent[pDstAVCComponent->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstAVCComponent, pSrcAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_H264_ENC_ROLE);
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelQuerySupported:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pDstProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE*)pComponentParameterStructure;
+        SEC_OMX_VIDEO_PROFILELEVEL *pProfileLevel = NULL;
+        OMX_U32 maxProfileLevelNum = 0;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pProfileLevel = supportedAVCProfileLevels;
+        maxProfileLevelNum = sizeof(supportedAVCProfileLevels) / sizeof(SEC_OMX_VIDEO_PROFILELEVEL);
+
+        if (pDstProfileLevel->nProfileIndex >= maxProfileLevelNum) {
+            ret = OMX_ErrorNoMore;
+            goto EXIT;
+        }
+
+        pProfileLevel += pDstProfileLevel->nProfileIndex;
+        pDstProfileLevel->eProfile = pProfileLevel->profile;
+        pDstProfileLevel->eLevel = pProfileLevel->level;
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelCurrent:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pDstProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE*)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_AVCTYPE *pSrcAVCComponent = NULL;
+        SEC_H264ENC_HANDLE        *pH264Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcAVCComponent = &pH264Enc->AVCComponent[pDstProfileLevel->nPortIndex];
+
+        pDstProfileLevel->eProfile = pSrcAVCComponent->eProfile;
+        pDstProfileLevel->eLevel = pSrcAVCComponent->eLevel;
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = NULL;
+        SEC_H264ENC_HANDLE        *pH264Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstErrorCorrectionType->nPortIndex != OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcErrorCorrectionType = &pH264Enc->errorCorrectionType[OUTPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoEncodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Enc_SetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamVideoAvc:
+    {
+        OMX_VIDEO_PARAM_AVCTYPE *pDstAVCComponent = NULL;
+        OMX_VIDEO_PARAM_AVCTYPE *pSrcAVCComponent = (OMX_VIDEO_PARAM_AVCTYPE *)pComponentParameterStructure;
+        SEC_H264ENC_HANDLE      *pH264Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcAVCComponent->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstAVCComponent = &pH264Enc->AVCComponent[pSrcAVCComponent->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstAVCComponent, pSrcAVCComponent, sizeof(OMX_VIDEO_PARAM_AVCTYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+
+        if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_H264_ENC_ROLE)) {
+            pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
+        } else {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelCurrent:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pSrcProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_AVCTYPE *pDstAVCComponent = NULL;
+        SEC_H264ENC_HANDLE        *pH264Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+        pDstAVCComponent = &pH264Enc->AVCComponent[pSrcProfileLevel->nPortIndex];
+        pDstAVCComponent->eProfile = pSrcProfileLevel->eProfile;
+        pDstAVCComponent->eLevel = pSrcProfileLevel->eLevel;
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = NULL;
+        SEC_H264ENC_HANDLE        *pH264Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcErrorCorrectionType->nPortIndex != OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstErrorCorrectionType = &pH264Enc->errorCorrectionType[OUTPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoEncodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Enc_GetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_H264ENC_HANDLE    *pH264Enc = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+    pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+    switch (nIndex) {
+    case OMX_IndexConfigVideoAVCIntraPeriod:
+    {
+        OMX_VIDEO_CONFIG_AVCINTRAPERIOD *pAVCIntraPeriod = (OMX_VIDEO_CONFIG_AVCINTRAPERIOD *)pComponentConfigStructure;
+        OMX_U32           portIndex = pAVCIntraPeriod->nPortIndex;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            pAVCIntraPeriod->nIDRPeriod = pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames + 1;
+            pAVCIntraPeriod->nPFrames = pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames;
+        }
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoEncodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Enc_SetConfig(
+    OMX_HANDLETYPE hComponent,
+    OMX_INDEXTYPE nIndex,
+    OMX_PTR pComponentConfigStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_H264ENC_HANDLE         *pH264Enc = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    pVideoEnc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+    pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+    switch (nIndex) {
+    case OMX_IndexConfigVideoIntraPeriod:
+    {
+        SEC_OMX_VIDEOENC_COMPONENT *pVEncBase = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+        OMX_U32 nPFrames = (*((OMX_U32 *)pComponentConfigStructure)) - 1;
+
+        pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames = nPFrames;
+
+        ret = OMX_ErrorNone;
+    }
+        break;
+    case OMX_IndexConfigVideoAVCIntraPeriod:
+    {
+        OMX_VIDEO_CONFIG_AVCINTRAPERIOD *pAVCIntraPeriod = (OMX_VIDEO_CONFIG_AVCINTRAPERIOD *)pComponentConfigStructure;
+        OMX_U32           portIndex = pAVCIntraPeriod->nPortIndex;
+
+        if ((portIndex != OUTPUT_PORT_INDEX)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        } else {
+            if (pAVCIntraPeriod->nIDRPeriod == (pAVCIntraPeriod->nPFrames + 1))
+                pH264Enc->AVCComponent[OUTPUT_PORT_INDEX].nPFrames = pAVCIntraPeriod->nPFrames;
+            else {
+                ret = OMX_ErrorBadParameter;
+                goto EXIT;
+            }
+        }
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoEncodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    if (ret == OMX_ErrorNone)
+        pVideoEnc->configChange = OMX_TRUE;
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Enc_GetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+    if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_CONFIG_VIDEO_INTRAPERIOD) == 0) {
+        *pIndexType = OMX_IndexConfigVideoIntraPeriod;
+        ret = OMX_ErrorNone;
+    } else {
+        ret = SEC_OMX_VideoEncodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264Enc_ComponentRoleEnum(OMX_HANDLETYPE hComponent, OMX_U8 *cRole, OMX_U32 nIndex)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (cRole == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (nIndex == (MAX_COMPONENT_ROLE_NUM-1)) {
+        SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_H264_ENC_ROLE);
+        ret = OMX_ErrorNone;
+    } else {
+        ret = OMX_ErrorNoMore;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_EncodeThread(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_H264ENC_HANDLE    *pH264Enc = (SEC_H264ENC_HANDLE *)pVideoEnc->hCodecHandle;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    while (pVideoEnc->NBEncThread.bExitEncodeThread == OMX_FALSE) {
+        SEC_OSAL_SemaphoreWait(pVideoEnc->NBEncThread.hEncFrameStart);
+
+        if (pVideoEnc->NBEncThread.bExitEncodeThread == OMX_FALSE) {
+            pH264Enc->hMFCH264Handle.returnCodec = SsbSipMfcEncExe(pH264Enc->hMFCH264Handle.hMFCHandle);
+            SEC_OSAL_SemaphorePost(pVideoEnc->NBEncThread.hEncFrameEnd);
+        }
+    }
+
+EXIT:
+    FunctionOut();
+    SEC_OSAL_ThreadExit(NULL);
+
+    return ret;
+}
+
+/* MFC Init */
+OMX_ERRORTYPE SEC_MFC_H264Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT     *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_OMX_BASEPORT          *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_H264ENC_HANDLE        *pH264Enc = NULL;
+    OMX_PTR                    hMFCHandle = NULL;
+    OMX_S32                    returnCodec = 0;
+    CSC_METHOD csc_method = CSC_METHOD_SW;
+
+    FunctionIn();
+
+    pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pH264Enc->hMFCH264Handle.bConfiguredMFC = OMX_FALSE;
+    pSECComponent->bUseFlagEOF = OMX_FALSE;
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+
+    /* MFC(Multi Function Codec) encoder and CMM(Codec Memory Management) driver open */
+    switch (pSECInputPort->portDefinition.format.video.eColorFormat) {
+    case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+    case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
+        hMFCHandle = (OMX_PTR)SsbSipMfcEncOpen();
+        break;
+    default: {
+        SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+        hMFCHandle = (OMX_PTR)SsbSipMfcEncOpenExt(&buf_type);
+        break;
+    }
+    }
+
+    if (hMFCHandle == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pH264Enc->hMFCH264Handle.hMFCHandle = hMFCHandle;
+
+    Set_H264Enc_Param(&(pH264Enc->hMFCH264Handle.mfcVideoAvc), pSECComponent);
+
+    returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pH264Enc->hMFCH264Handle.mfcVideoAvc));
+    if (returnCodec != MFC_RET_OK) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+
+    /* Allocate encoder's input buffer */
+    returnCodec = SsbSipMfcEncGetInBuf(hMFCHandle, &(pH264Enc->hMFCH264Handle.inputInfo));
+    if (returnCodec != MFC_RET_OK) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoEnc->MFCEncInputBuffer[0].YPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.YPhyAddr;
+    pVideoEnc->MFCEncInputBuffer[0].CPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.CPhyAddr;
+    pVideoEnc->MFCEncInputBuffer[0].YVirAddr = pH264Enc->hMFCH264Handle.inputInfo.YVirAddr;
+    pVideoEnc->MFCEncInputBuffer[0].CVirAddr = pH264Enc->hMFCH264Handle.inputInfo.CVirAddr;
+    pVideoEnc->MFCEncInputBuffer[0].YBufferSize = pH264Enc->hMFCH264Handle.inputInfo.YSize;
+    pVideoEnc->MFCEncInputBuffer[0].CBufferSize = pH264Enc->hMFCH264Handle.inputInfo.CSize;
+    pVideoEnc->MFCEncInputBuffer[0].YDataSize = 0;
+    pVideoEnc->MFCEncInputBuffer[0].CDataSize = 0;
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pH264Enc->hMFCH264Handle.inputInfo.YVirAddr : 0x%x", pH264Enc->hMFCH264Handle.inputInfo.YVirAddr);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pH264Enc->hMFCH264Handle.inputInfo.CVirAddr : 0x%x", pH264Enc->hMFCH264Handle.inputInfo.CVirAddr);
+
+    returnCodec = SsbSipMfcEncGetInBuf(hMFCHandle, &(pH264Enc->hMFCH264Handle.inputInfo));
+    if (returnCodec != MFC_RET_OK) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoEnc->MFCEncInputBuffer[1].YPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.YPhyAddr;
+    pVideoEnc->MFCEncInputBuffer[1].CPhyAddr = pH264Enc->hMFCH264Handle.inputInfo.CPhyAddr;
+    pVideoEnc->MFCEncInputBuffer[1].YVirAddr = pH264Enc->hMFCH264Handle.inputInfo.YVirAddr;
+    pVideoEnc->MFCEncInputBuffer[1].CVirAddr = pH264Enc->hMFCH264Handle.inputInfo.CVirAddr;
+    pVideoEnc->MFCEncInputBuffer[1].YBufferSize = pH264Enc->hMFCH264Handle.inputInfo.YSize;
+    pVideoEnc->MFCEncInputBuffer[1].CBufferSize = pH264Enc->hMFCH264Handle.inputInfo.CSize;
+    pVideoEnc->MFCEncInputBuffer[1].YDataSize = 0;
+    pVideoEnc->MFCEncInputBuffer[1].CDataSize = 0;
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pH264Enc->hMFCH264Handle.inputInfo.YVirAddr : 0x%x", pH264Enc->hMFCH264Handle.inputInfo.YVirAddr);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pH264Enc->hMFCH264Handle.inputInfo.CVirAddr : 0x%x", pH264Enc->hMFCH264Handle.inputInfo.CVirAddr);
+
+    pVideoEnc->indexInputBuffer = 0;
+
+    pVideoEnc->bFirstFrame = OMX_TRUE;
+
+#ifdef NONBLOCK_MODE_PROCESS
+    pVideoEnc->NBEncThread.bExitEncodeThread = OMX_FALSE;
+    pVideoEnc->NBEncThread.bEncoderRun = OMX_FALSE;
+    SEC_OSAL_SemaphoreCreate(&(pVideoEnc->NBEncThread.hEncFrameStart));
+    SEC_OSAL_SemaphoreCreate(&(pVideoEnc->NBEncThread.hEncFrameEnd));
+    if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pVideoEnc->NBEncThread.hNBEncodeThread,
+                                                SEC_MFC_EncodeThread,
+                                                pOMXComponent)) {
+        pH264Enc->hMFCH264Handle.returnCodec = MFC_RET_OK;
+    }
+#endif
+    SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+    SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+    pH264Enc->hMFCH264Handle.indexTimestamp = 0;
+
+    pVideoEnc->csc_handle = csc_init(&csc_method);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Terminate */
+OMX_ERRORTYPE SEC_MFC_H264Enc_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+    SEC_H264ENC_HANDLE    *pH264Enc = NULL;
+    OMX_PTR                hMFCHandle = NULL;
+
+    FunctionIn();
+
+    pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+#ifdef NONBLOCK_MODE_PROCESS
+    if (pVideoEnc->NBEncThread.hNBEncodeThread != NULL) {
+        pVideoEnc->NBEncThread.bExitEncodeThread = OMX_TRUE;
+        SEC_OSAL_SemaphorePost(pVideoEnc->NBEncThread.hEncFrameStart);
+        SEC_OSAL_ThreadTerminate(pVideoEnc->NBEncThread.hNBEncodeThread);
+        pVideoEnc->NBEncThread.hNBEncodeThread = NULL;
+    }
+
+    if(pVideoEnc->NBEncThread.hEncFrameEnd != NULL) {
+        SEC_OSAL_SemaphoreTerminate(pVideoEnc->NBEncThread.hEncFrameEnd);
+        pVideoEnc->NBEncThread.hEncFrameEnd = NULL;
+    }
+
+    if(pVideoEnc->NBEncThread.hEncFrameStart != NULL) {
+        SEC_OSAL_SemaphoreTerminate(pVideoEnc->NBEncThread.hEncFrameStart);
+        pVideoEnc->NBEncThread.hEncFrameStart = NULL;
+    }
+#endif
+
+    hMFCHandle = pH264Enc->hMFCH264Handle.hMFCHandle;
+    if (hMFCHandle != NULL) {
+        SsbSipMfcEncClose(hMFCHandle);
+        hMFCHandle = pH264Enc->hMFCH264Handle.hMFCHandle = NULL;
+    }
+
+    if (pVideoEnc->csc_handle != NULL) {
+        csc_deinit(pVideoEnc->csc_handle);
+        pVideoEnc->csc_handle = NULL;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264_Encode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT     *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+    SEC_H264ENC_HANDLE        *pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    SSBSIP_MFC_ENC_INPUT_INFO *pInputInfo = &pH264Enc->hMFCH264Handle.inputInfo;
+    SSBSIP_MFC_ENC_OUTPUT_INFO outputInfo;
+    SEC_OMX_BASEPORT          *pSECPort = NULL;
+    MFC_ENC_ADDR_INFO          addrInfo;
+    OMX_U32                    oneFrameSize = pInputData->dataLen;
+
+    FunctionIn();
+
+    if (pH264Enc->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) {
+        pH264Enc->hMFCH264Handle.returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo);
+        if (pH264Enc->hMFCH264Handle.returnCodec != MFC_RET_OK) {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "%s - SsbSipMfcEncGetOutBuf Failed\n", __func__);
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        } else {
+            OMX_U8 *p = NULL;
+            int iSpsSize = 0;
+            int iPpsSize = 0;
+
+            p = FindDelimiter((OMX_U8 *)outputInfo.StrmVirAddr + 4, outputInfo.headerSize - 4);
+
+            iSpsSize = (unsigned int)p - (unsigned int)outputInfo.StrmVirAddr;
+            pH264Enc->hMFCH264Handle.headerData.pHeaderSPS = (OMX_PTR)outputInfo.StrmVirAddr;
+            pH264Enc->hMFCH264Handle.headerData.SPSLen = iSpsSize;
+
+            iPpsSize = outputInfo.headerSize - iSpsSize;
+            pH264Enc->hMFCH264Handle.headerData.pHeaderPPS = (OMX_U8 *)outputInfo.StrmVirAddr + iSpsSize;
+            pH264Enc->hMFCH264Handle.headerData.PPSLen = iPpsSize;
+        }
+
+        pOutputData->dataBuffer = outputInfo.StrmVirAddr;
+        pOutputData->allocSize = outputInfo.headerSize;
+        pOutputData->dataLen = outputInfo.headerSize;
+        pOutputData->timeStamp = 0;
+        pOutputData->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
+        pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
+
+        pH264Enc->hMFCH264Handle.bConfiguredMFC = OMX_TRUE;
+
+        ret = OMX_ErrorInputDataEncodeYet;
+        goto EXIT;
+    }
+
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+
+    if (oneFrameSize <= 0) {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) ||
+        (pSECComponent->getAllDelayBuffer == OMX_TRUE)){
+        /* Dummy input data for get out encoded last frame */
+        pInputInfo->YPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YPhyAddr;
+        pInputInfo->CPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CPhyAddr;
+        pInputInfo->YVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr;
+        pInputInfo->CVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr;
+    } else {
+        switch (pSECPort->portDefinition.format.video.eColorFormat) {
+        case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+        case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+        case OMX_SEC_COLOR_FormatNV21LPhysicalAddress: {
+#ifndef USE_METADATABUFFERTYPE
+            /* USE_FIMC_FRAME_BUFFER */
+            SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));
+            SEC_OSAL_Memcpy(&addrInfo.pAddrC, pInputData->dataBuffer + sizeof(addrInfo.pAddrY), sizeof(addrInfo.pAddrC));
+#else
+            OMX_PTR ppBuf[3];
+            SEC_OSAL_GetInfoFromMetaData(pInputData, ppBuf);
+
+            SEC_OSAL_Memcpy(&addrInfo.pAddrY, ppBuf[0], sizeof(addrInfo.pAddrY));
+            SEC_OSAL_Memcpy(&addrInfo.pAddrC, ppBuf[1], sizeof(addrInfo.pAddrC));
+#endif
+            pInputInfo->YPhyAddr = addrInfo.pAddrY;
+            pInputInfo->CPhyAddr = addrInfo.pAddrC;
+            break;
+        }
+        case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+            addrInfo.pAddrY = *((void **)pInputData->dataBuffer);
+            addrInfo.pAddrC = (void *)((char *)addrInfo.pAddrY + pInputInfo->YSize);
+
+            pInputInfo->YPhyAddr = addrInfo.pAddrY;
+            pInputInfo->CPhyAddr = addrInfo.pAddrC;
+            break;
+        default:
+            pInputInfo->YPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YPhyAddr;
+            pInputInfo->CPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CPhyAddr;
+            pInputInfo->YVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr;
+            pInputInfo->CVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr;
+            break;
+        }
+    }
+
+    pSECComponent->timeStamp[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+    pSECComponent->nFlags[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
+
+    if ((pH264Enc->hMFCH264Handle.returnCodec == MFC_RET_OK) &&
+        (pVideoEnc->bFirstFrame == OMX_FALSE)) {
+        OMX_S32 indexTimestamp = 0;
+
+        /* wait for mfc encode done */
+        if (pVideoEnc->NBEncThread.bEncoderRun != OMX_FALSE) {
+            SEC_OSAL_SemaphoreWait(pVideoEnc->NBEncThread.hEncFrameEnd);
+            pVideoEnc->NBEncThread.bEncoderRun = OMX_FALSE;
+        }
+
+        SEC_OSAL_SleepMillisec(0);
+        pH264Enc->hMFCH264Handle.returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo);
+        if ((SsbSipMfcEncGetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))){
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+        }
+
+        if (pH264Enc->hMFCH264Handle.returnCodec == MFC_RET_OK) {
+            /** Fill Output Buffer **/
+            pOutputData->dataBuffer = outputInfo.StrmVirAddr;
+            pOutputData->allocSize = outputInfo.dataSize;
+            pOutputData->dataLen = outputInfo.dataSize;
+            pOutputData->usedDataLen = 0;
+
+            pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
+            if (outputInfo.frameType == MFC_FRAME_TYPE_I_FRAME)
+                pOutputData->nFlags |= OMX_BUFFERFLAG_SYNCFRAME;
+
+            SEC_OSAL_Log(SEC_LOG_TRACE, "MFC Encode OK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+
+            ret = OMX_ErrorNone;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, pH264Enc->hMFCH264Handle.returnCodec);
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+
+        if (pSECComponent->getAllDelayBuffer == OMX_TRUE) {
+            ret = OMX_ErrorInputDataEncodeYet;
+        }
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataEncodeYet;
+        }
+        if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            pOutputData->dataLen = 0;
+            pOutputData->usedDataLen = 0;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "OMX_BUFFERFLAG_EOS!!!");
+            ret = OMX_ErrorNone;
+        }
+    }
+    if (pH264Enc->hMFCH264Handle.returnCodec != MFC_RET_OK) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "In %s : SsbSipMfcEncExe Failed!!!\n", __func__);
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    pH264Enc->hMFCH264Handle.returnCodec = SsbSipMfcEncSetInBuf(pH264Enc->hMFCH264Handle.hMFCHandle, pInputInfo);
+    if (pH264Enc->hMFCH264Handle.returnCodec != MFC_RET_OK) {
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Error : SsbSipMfcEncSetInBuf() \n");
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    } else {
+        pVideoEnc->indexInputBuffer++;
+        pVideoEnc->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+    }
+
+    if (pVideoEnc->configChange == OMX_TRUE) {
+        Change_H264Enc_Param(&(pH264Enc->hMFCH264Handle.mfcVideoAvc), pSECComponent);
+        pVideoEnc->configChange = OMX_FALSE;
+    }
+
+    SsbSipMfcEncSetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pH264Enc->hMFCH264Handle.indexTimestamp));
+
+    /* mfc encode start */
+    SEC_OSAL_SemaphorePost(pVideoEnc->NBEncThread.hEncFrameStart);
+    pVideoEnc->NBEncThread.bEncoderRun = OMX_TRUE;
+    pH264Enc->hMFCH264Handle.indexTimestamp++;
+    pH264Enc->hMFCH264Handle.indexTimestamp %= MAX_TIMESTAMP;
+    pVideoEnc->bFirstFrame = OMX_FALSE;
+    SEC_OSAL_SleepMillisec(0);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_H264_Encode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT     *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+    SEC_H264ENC_HANDLE        *pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    SSBSIP_MFC_ENC_INPUT_INFO *pInputInfo = &pH264Enc->hMFCH264Handle.inputInfo;
+    SSBSIP_MFC_ENC_OUTPUT_INFO outputInfo;
+    SEC_OMX_BASEPORT          *pSECPort = NULL;
+    MFC_ENC_ADDR_INFO          addrInfo;
+    OMX_U32                    oneFrameSize = pInputData->dataLen;
+    OMX_S32                    returnCodec = 0;
+
+    FunctionIn();
+
+    if (pH264Enc->hMFCH264Handle.bConfiguredMFC == OMX_FALSE) {
+        returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo);
+        if (returnCodec != MFC_RET_OK)
+        {
+            SEC_OSAL_Log(SEC_LOG_TRACE, "%s - SsbSipMfcEncGetOutBuf Failed\n", __func__);
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        } else {
+            OMX_U8 *p = NULL;
+            int iSpsSize = 0;
+            int iPpsSize = 0;
+
+            p = FindDelimiter((OMX_U8 *)outputInfo.StrmVirAddr + 4, outputInfo.headerSize - 4);
+
+            iSpsSize = (unsigned int)p - (unsigned int)outputInfo.StrmVirAddr;
+            pH264Enc->hMFCH264Handle.headerData.pHeaderSPS = (OMX_PTR)outputInfo.StrmVirAddr;
+            pH264Enc->hMFCH264Handle.headerData.SPSLen = iSpsSize;
+
+            iPpsSize = outputInfo.headerSize - iSpsSize;
+            pH264Enc->hMFCH264Handle.headerData.pHeaderPPS = (OMX_U8 *)outputInfo.StrmVirAddr + iSpsSize;
+            pH264Enc->hMFCH264Handle.headerData.PPSLen = iPpsSize;
+        }
+
+        pOutputData->dataBuffer = outputInfo.StrmVirAddr;
+        pOutputData->allocSize = outputInfo.headerSize;
+        pOutputData->dataLen = outputInfo.headerSize;
+        pOutputData->timeStamp = 0;
+        pOutputData->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
+        pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
+
+        pH264Enc->hMFCH264Handle.bConfiguredMFC = OMX_TRUE;
+
+        ret = OMX_ErrorInputDataEncodeYet;
+        goto EXIT;
+    }
+
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+
+    if (oneFrameSize <= 0) {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    switch (pSECPort->portDefinition.format.video.eColorFormat) {
+    case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV21LPhysicalAddress: {
+#ifndef USE_METADATABUFFERTYPE
+        /* USE_FIMC_FRAME_BUFFER */
+        SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));
+        SEC_OSAL_Memcpy(&addrInfo.pAddrC, pInputData->dataBuffer + sizeof(addrInfo.pAddrY), sizeof(addrInfo.pAddrC));
+#else
+        OMX_PTR ppBuf[3];
+        SEC_OSAL_GetInfoFromMetaData(pInputData, ppBuf);
+
+        SEC_OSAL_Memcpy(&addrInfo.pAddrY, ppBuf[0], sizeof(addrInfo.pAddrY));
+        SEC_OSAL_Memcpy(&addrInfo.pAddrC, ppBuf[1], sizeof(addrInfo.pAddrC));
+#endif
+        pInputInfo->YPhyAddr = addrInfo.pAddrY;
+        pInputInfo->CPhyAddr = addrInfo.pAddrC;
+        break;
+    }
+    case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+        addrInfo.pAddrY = *((void **)pInputData->dataBuffer);
+        addrInfo.pAddrC = (void *)((char *)addrInfo.pAddrY + pInputInfo->YSize);
+
+        pInputInfo->YPhyAddr = addrInfo.pAddrY;
+        pInputInfo->CPhyAddr = addrInfo.pAddrC;
+        break;
+    default:
+        pInputInfo->YPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YPhyAddr;
+        pInputInfo->CPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CPhyAddr;
+        pInputInfo->YVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr;
+        pInputInfo->CVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr;
+        break;
+    }
+
+    returnCodec = SsbSipMfcEncSetInBuf(pH264Enc->hMFCH264Handle.hMFCHandle, pInputInfo);
+    if (returnCodec != MFC_RET_OK) {
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Error : SsbSipMfcEncSetInBuf() \n");
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    } else {
+        pVideoEnc->indexInputBuffer++;
+        pVideoEnc->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+    }
+
+    if (pVideoEnc->configChange == OMX_TRUE) {
+        Change_H264Enc_Param(&(pH264Enc->hMFCH264Handle.mfcVideoAvc), pSECComponent);
+        pVideoEnc->configChange = OMX_FALSE;
+    }
+
+    pSECComponent->timeStamp[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->timeStamp;
+    pSECComponent->nFlags[pH264Enc->hMFCH264Handle.indexTimestamp] = pInputData->nFlags;
+    SsbSipMfcEncSetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pH264Enc->hMFCH264Handle.indexTimestamp));
+
+    returnCodec = SsbSipMfcEncExe(pH264Enc->hMFCH264Handle.hMFCHandle);
+    if (returnCodec == MFC_RET_OK) {
+        OMX_S32 indexTimestamp = 0;
+
+        pH264Enc->hMFCH264Handle.indexTimestamp++;
+        pH264Enc->hMFCH264Handle.indexTimestamp %= MAX_TIMESTAMP;
+
+        returnCodec = SsbSipMfcEncGetOutBuf(pH264Enc->hMFCH264Handle.hMFCHandle, &outputInfo);
+        if ((SsbSipMfcEncGetConfig(pH264Enc->hMFCH264Handle.hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))){
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+        }
+
+        if (returnCodec == MFC_RET_OK) {
+            /** Fill Output Buffer **/
+            pOutputData->dataBuffer = outputInfo.StrmVirAddr;
+            pOutputData->allocSize = outputInfo.dataSize;
+            pOutputData->dataLen = outputInfo.dataSize;
+            pOutputData->usedDataLen = 0;
+
+            pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
+            if (outputInfo.frameType == MFC_FRAME_TYPE_I_FRAME)
+                pOutputData->nFlags |= OMX_BUFFERFLAG_SYNCFRAME;
+
+            SEC_OSAL_Log(SEC_LOG_TRACE, "MFC Encode OK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+
+            ret = OMX_ErrorNone;
+        }
+    }
+
+    if (returnCodec != MFC_RET_OK) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "In %s : SsbSipMfcEncExe OR SsbSipMfcEncGetOutBuf Failed!!!\n", __func__);
+        ret = OMX_ErrorUndefined;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Encode */
+OMX_ERRORTYPE SEC_MFC_H264Enc_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_H264ENC_HANDLE      *pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    SEC_OMX_BASEPORT        *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT        *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    OMX_BOOL                 endOfFrame = OMX_FALSE;
+    OMX_BOOL                 flagEOS = OMX_FALSE;
+
+    FunctionIn();
+
+    if ((!CHECK_PORT_ENABLED(pSECInputPort)) || (!CHECK_PORT_ENABLED(pSECOutputPort)) ||
+            (!CHECK_PORT_POPULATED(pSECInputPort)) || (!CHECK_PORT_POPULATED(pSECOutputPort))) {
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+    if (OMX_FALSE == SEC_Check_BufferProcess_State(pSECComponent)) {
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+#ifdef NONBLOCK_MODE_PROCESS
+    ret = SEC_MFC_H264_Encode_Nonblock(pOMXComponent, pInputData, pOutputData);
+#else
+    ret = SEC_MFC_H264_Encode_Block(pOMXComponent, pInputData, pOutputData);
+#endif
+    if (ret != OMX_ErrorNone) {
+        if (ret == OMX_ErrorInputDataEncodeYet) {
+            pOutputData->usedDataLen = 0;
+            pOutputData->remainDataLen = pOutputData->dataLen;
+        } else {
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+                                            pSECComponent->callbackData,
+                                            OMX_EventError, ret, 0, NULL);
+        }
+    } else {
+        pInputData->usedDataLen += pInputData->dataLen;
+        pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
+        pInputData->dataLen -= pInputData->usedDataLen;
+        pInputData->usedDataLen = 0;
+
+        /* pOutputData->usedDataLen = 0; */
+        pOutputData->remainDataLen = pOutputData->dataLen - pOutputData->usedDataLen;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_OMX_BASEPORT        *pSECPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_H264ENC_HANDLE      *pH264Enc = NULL;
+    int i = 0;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (componentName == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H264_ENC, componentName) != 0) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorBadParameter, componentName:%s, Line:%d", componentName, __LINE__);
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_VideoEncodeComponentInit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECComponent->codecType = HW_VIDEO_ENC_CODEC;
+
+    pSECComponent->componentName = (OMX_STRING)SEC_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
+    if (pSECComponent->componentName == NULL) {
+        SEC_OMX_VideoEncodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
+
+    pH264Enc = SEC_OSAL_Malloc(sizeof(SEC_H264ENC_HANDLE));
+    if (pH264Enc == NULL) {
+        SEC_OMX_VideoEncodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pH264Enc, 0, sizeof(SEC_H264ENC_HANDLE));
+    pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    pVideoEnc->hCodecHandle = (OMX_HANDLETYPE)pH264Enc;
+
+    SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H264_ENC);
+    /* Set componentVersion */
+    pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->componentVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->componentVersion.s.nStep         = STEP_NUMBER;
+    /* Set specVersion */
+    pSECComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->specVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->specVersion.s.nStep         = STEP_NUMBER;
+
+    /* Android CapabilityFlags */
+    pSECComponent->capabilityFlags.iIsOMXComponentMultiThreaded                   = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalInputBufferAlloc  = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalOutputBufferAlloc = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsMovableInputBuffers       = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsPartialFrames             = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesNALStartCodes                 = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentCanHandleIncompleteFrames         = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesFullAVCFrames                 = OMX_TRUE;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_INPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nStride = 0; /*DEFAULT_FRAME_WIDTH;*/
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "video/avc");
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    for(i = 0; i < ALL_PORT_NUM; i++) {
+        INIT_SET_SIZE_VERSION(&pH264Enc->AVCComponent[i], OMX_VIDEO_PARAM_AVCTYPE);
+        pH264Enc->AVCComponent[i].nPortIndex = i;
+        pH264Enc->AVCComponent[i].eProfile   = OMX_VIDEO_AVCProfileBaseline;
+        pH264Enc->AVCComponent[i].eLevel     = OMX_VIDEO_AVCLevel31;
+
+        pH264Enc->AVCComponent[i].nPFrames = 20;
+    }
+
+    pOMXComponent->GetParameter      = &SEC_MFC_H264Enc_GetParameter;
+    pOMXComponent->SetParameter      = &SEC_MFC_H264Enc_SetParameter;
+    pOMXComponent->GetConfig         = &SEC_MFC_H264Enc_GetConfig;
+    pOMXComponent->SetConfig         = &SEC_MFC_H264Enc_SetConfig;
+    pOMXComponent->GetExtensionIndex = &SEC_MFC_H264Enc_GetExtensionIndex;
+    pOMXComponent->ComponentRoleEnum = &SEC_MFC_H264Enc_ComponentRoleEnum;
+    pOMXComponent->ComponentDeInit   = &SEC_OMX_ComponentDeinit;
+
+    pSECComponent->sec_mfc_componentInit      = &SEC_MFC_H264Enc_Init;
+    pSECComponent->sec_mfc_componentTerminate = &SEC_MFC_H264Enc_Terminate;
+    pSECComponent->sec_mfc_bufferProcess      = &SEC_MFC_H264Enc_bufferProcess;
+    pSECComponent->sec_checkInputFrame        = NULL;
+
+    pSECComponent->currentState = OMX_StateLoaded;
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_H264ENC_HANDLE      *pH264Enc = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    SEC_OSAL_Free(pSECComponent->componentName);
+    pSECComponent->componentName = NULL;
+
+    pH264Enc = (SEC_H264ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    if (pH264Enc != NULL) {
+        SEC_OSAL_Free(pH264Enc);
+        pH264Enc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle = NULL;
+    }
+
+    ret = SEC_OMX_VideoEncodeComponentDeinit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/SEC_OMX_H264enc.h b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/SEC_OMX_H264enc.h
new file mode 100644
index 0000000..cc0a94f
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/SEC_OMX_H264enc.h
@@ -0,0 +1,77 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_H264enc.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_H264_ENC_COMPONENT
+#define SEC_OMX_H264_ENC_COMPONENT
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "OMX_Video.h"
+#include "SsbSipMfcApi.h"
+
+
+typedef struct _EXTRA_DATA
+{
+    OMX_PTR pHeaderSPS;
+    OMX_U32 SPSLen;
+    OMX_PTR pHeaderPPS;
+    OMX_U32 PPSLen;
+} EXTRA_DATA;
+
+typedef struct _SEC_MFC_H264ENC_HANDLE
+{
+    OMX_HANDLETYPE hMFCHandle;
+    SSBSIP_MFC_ENC_H264_PARAM mfcVideoAvc;
+    SSBSIP_MFC_ENC_INPUT_INFO inputInfo;
+/*    SSBSIP_MFC_ENC_OUTPUT_INFO outputInfo; */
+    OMX_U32 indexTimestamp;
+    OMX_BOOL bConfiguredMFC;
+    EXTRA_DATA headerData;
+    OMX_S32 returnCodec;
+} SEC_MFC_H264ENC_HANDLE;
+
+typedef struct _SEC_H264ENC_HANDLE
+{
+    /* OMX Codec specific */
+    OMX_VIDEO_PARAM_AVCTYPE AVCComponent[ALL_PORT_NUM];
+    OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
+
+    /* SEC MFC Codec specific */
+    SEC_MFC_H264ENC_HANDLE hMFCH264Handle;
+} SEC_H264ENC_HANDLE;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/library_register.c b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/library_register.c
new file mode 100644
index 0000000..e24e126
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/library_register.c
@@ -0,0 +1,55 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+#include "library_register.h"
+#include "SEC_OSAL_Log.h"
+
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **secComponents)
+{
+	FunctionIn();
+
+	if (secComponents == NULL)
+		goto EXIT;
+
+	/* component 1 - video decoder H.264 */
+	SEC_OSAL_Strcpy(secComponents[0]->componentName, SEC_OMX_COMPONENT_H264_ENC);
+	SEC_OSAL_Strcpy(secComponents[0]->roles[0], SEC_OMX_COMPONENT_H264_ENC_ROLE);
+	secComponents[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+EXIT:
+	FunctionOut();
+
+	return MAX_COMPONENT_NUM;
+}
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/library_register.h b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/library_register.h
new file mode 100644
index 0000000..9511e3c
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/h264/library_register.h
@@ -0,0 +1,55 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_H264_REG
+#define SEC_OMX_H264_REG
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "SEC_OMX_Component_Register.h"
+
+
+#define OSCL_EXPORT_REF __attribute__((visibility("default")))
+#define MAX_COMPONENT_NUM       1
+#define MAX_COMPONENT_ROLE_NUM  1
+
+/* H.264 */
+#define SEC_OMX_COMPONENT_H264_ENC "OMX.SEC.AVC.Encoder"
+#define SEC_OMX_COMPONENT_H264_ENC_ROLE "video_encoder.avc"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **secComponents);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/Android.mk b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/Android.mk
new file mode 100644
index 0000000..441f5fb
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/Android.mk
@@ -0,0 +1,39 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OMX_Mpeg4enc.c \
+	library_register.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libOMX.SEC.M4V.Encoder
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx
+
+LOCAL_CFLAGS :=
+
+ifeq ($(BOARD_NONBLOCK_MODE_PROCESS), true)
+LOCAL_CFLAGS += -DNONBLOCK_MODE_PROCESS
+endif
+
+ifeq ($(BOARD_USE_METADATABUFFERTYPE), true)
+LOCAL_CFLAGS += -DUSE_METADATABUFFERTYPE
+endif
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := libSEC_OMX_Venc libsecosal libsecbasecomponent \
+	libswconverter libsecmfcapi
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
+	libSEC_OMX_Resourcemanager libcsc
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/core \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/video/enc \
+    $(TARGET_OUT_HEADERS)/$(SEC_COPY_HEADERS_TO)
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.c b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.c
new file mode 100644
index 0000000..1fcc90e
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.c
@@ -0,0 +1,1803 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Mpeg4enc.c
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Macros.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Venc.h"
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OSAL_Thread.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Android.h"
+#include "library_register.h"
+#include "SEC_OMX_Mpeg4enc.h"
+#include "SsbSipMfcApi.h"
+#include "csc.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_MPEG4_ENC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+/* MPEG4 Encoder Supported Levels & profiles */
+SEC_OMX_VIDEO_PROFILELEVEL supportedMPEG4ProfileLevels[] ={
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level0},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level0b},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level1},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level2},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level3},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level4},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level4a},
+    {OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level5},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level0},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level0b},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level1},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level2},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level3},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level4},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level4a},
+    {OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level5}};
+
+/* H.263 Encoder Supported Levels & profiles */
+SEC_OMX_VIDEO_PROFILELEVEL supportedH263ProfileLevels[] = {
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level10},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level20},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level30},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level40},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level45},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level50},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level60},
+    {OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level70}};
+
+OMX_U32 OMXMpeg4ProfileToMFCProfile(OMX_VIDEO_MPEG4PROFILETYPE profile)
+{
+    OMX_U32 ret;
+
+    switch (profile) {
+    case OMX_VIDEO_MPEG4ProfileSimple:
+        ret = 0;
+        break;
+    case OMX_VIDEO_MPEG4ProfileAdvancedSimple:
+        ret = 1;
+        break;
+    default:
+        ret = 0;
+    };
+
+    return ret;
+}
+OMX_U32 OMXMpeg4LevelToMFCLevel(OMX_VIDEO_MPEG4LEVELTYPE level)
+{
+    OMX_U32 ret;
+
+    switch (level) {
+    case OMX_VIDEO_MPEG4Level0:
+        ret = 0;
+        break;
+    case OMX_VIDEO_MPEG4Level0b:
+        ret = 9;
+        break;
+    case OMX_VIDEO_MPEG4Level1:
+        ret = 1;
+        break;
+    case OMX_VIDEO_MPEG4Level2:
+        ret = 2;
+        break;
+    case OMX_VIDEO_MPEG4Level3:
+        ret = 3;
+        break;
+    case OMX_VIDEO_MPEG4Level4:
+    case OMX_VIDEO_MPEG4Level4a:
+        ret = 4;
+        break;
+    case OMX_VIDEO_MPEG4Level5:
+        ret = 5;
+        break;
+    default:
+        ret = 0;
+    };
+
+    return ret;
+}
+
+void Mpeg4PrintParams(SSBSIP_MFC_ENC_MPEG4_PARAM *pMpeg4Param)
+{
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SourceWidth             : %d\n", pMpeg4Param->SourceWidth);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SourceHeight            : %d\n", pMpeg4Param->SourceHeight);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "IDRPeriod               : %d\n", pMpeg4Param->IDRPeriod);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SliceMode               : %d\n", pMpeg4Param->SliceMode);
+#ifdef USE_SLICE_OUTPUT_MODE
+    SEC_OSAL_Log(SEC_LOG_TRACE, "OutputMode              : %d\n", pMpeg4Param->OutputMode);
+#endif
+    SEC_OSAL_Log(SEC_LOG_TRACE, "RandomIntraMBRefresh    : %d\n", pMpeg4Param->RandomIntraMBRefresh);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "EnableFRMRateControl    : %d\n", pMpeg4Param->EnableFRMRateControl);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "Bitrate                 : %d\n", pMpeg4Param->Bitrate);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameQp                 : %d\n", pMpeg4Param->FrameQp);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameQp_P               : %d\n", pMpeg4Param->FrameQp_P);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "QSCodeMax               : %d\n", pMpeg4Param->QSCodeMax);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "QSCodeMin               : %d\n", pMpeg4Param->QSCodeMin);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "CBRPeriodRf             : %d\n", pMpeg4Param->CBRPeriodRf);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "PadControlOn            : %d\n", pMpeg4Param->PadControlOn);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "LumaPadVal              : %d\n", pMpeg4Param->LumaPadVal);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "CbPadVal                : %d\n", pMpeg4Param->CbPadVal);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "CrPadVal                : %d\n", pMpeg4Param->CrPadVal);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameMap                : %d\n", pMpeg4Param->FrameMap);
+
+    /* MPEG4 specific parameters */
+    SEC_OSAL_Log(SEC_LOG_TRACE, "ProfileIDC              : %d\n", pMpeg4Param->ProfileIDC);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "LevelIDC                : %d\n", pMpeg4Param->LevelIDC);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameQp_B               : %d\n", pMpeg4Param->FrameQp_B);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "TimeIncreamentRes       : %d\n", pMpeg4Param->TimeIncreamentRes);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "VopTimeIncreament       : %d\n", pMpeg4Param->VopTimeIncreament);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SliceArgument           : %d\n", pMpeg4Param->SliceArgument);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "NumberBFrames           : %d\n", pMpeg4Param->NumberBFrames);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "DisableQpelME           : %d\n", pMpeg4Param->DisableQpelME);
+}
+
+void H263PrintParams(SSBSIP_MFC_ENC_H263_PARAM *pH263Param)
+{
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SourceWidth             : %d\n", pH263Param->SourceWidth);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SourceHeight            : %d\n", pH263Param->SourceHeight);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "IDRPeriod               : %d\n", pH263Param->IDRPeriod);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "SliceMode               : %d\n", pH263Param->SliceMode);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "RandomIntraMBRefresh    : %d\n", pH263Param->RandomIntraMBRefresh);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "EnableFRMRateControl    : %d\n", pH263Param->EnableFRMRateControl);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "Bitrate                 : %d\n", pH263Param->Bitrate);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameQp                 : %d\n", pH263Param->FrameQp);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameQp_P               : %d\n", pH263Param->FrameQp_P);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "QSCodeMax               : %d\n", pH263Param->QSCodeMax);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "QSCodeMin               : %d\n", pH263Param->QSCodeMin);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "CBRPeriodRf             : %d\n", pH263Param->CBRPeriodRf);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "PadControlOn            : %d\n", pH263Param->PadControlOn);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "LumaPadVal              : %d\n", pH263Param->LumaPadVal);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "CbPadVal                : %d\n", pH263Param->CbPadVal);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "CrPadVal                : %d\n", pH263Param->CrPadVal);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameMap                : %d\n", pH263Param->FrameMap);
+
+    /* H.263 specific parameters */
+    SEC_OSAL_Log(SEC_LOG_TRACE, "FrameRate               : %d\n", pH263Param->FrameRate);
+}
+
+void Set_Mpeg4Enc_Param(SSBSIP_MFC_ENC_MPEG4_PARAM *pMpeg4Param, SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    SEC_OMX_BASEPORT    *pSECInputPort = NULL;
+    SEC_OMX_BASEPORT    *pSECOutputPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_MPEG4ENC_HANDLE *pMpeg4Enc = NULL;
+
+    pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    pMpeg4Param->codecType            = MPEG4_ENC;
+    pMpeg4Param->SourceWidth          = pSECOutputPort->portDefinition.format.video.nFrameWidth;
+    pMpeg4Param->SourceHeight         = pSECOutputPort->portDefinition.format.video.nFrameHeight;
+    pMpeg4Param->IDRPeriod            = pMpeg4Enc->mpeg4Component[OUTPUT_PORT_INDEX].nPFrames + 1;
+    pMpeg4Param->SliceMode            = 0;
+#ifdef USE_SLICE_OUTPUT_MODE
+    pMpeg4Param->OutputMode           = FRAME;
+#endif
+    pMpeg4Param->RandomIntraMBRefresh = 0;
+    pMpeg4Param->Bitrate              = pSECOutputPort->portDefinition.format.video.nBitrate;
+    pMpeg4Param->QSCodeMax            = 30;
+    pMpeg4Param->QSCodeMin            = 10;
+    pMpeg4Param->PadControlOn         = 0;    /* 0: Use boundary pixel, 1: Use the below setting value */
+    pMpeg4Param->LumaPadVal           = 0;
+    pMpeg4Param->CbPadVal             = 0;
+    pMpeg4Param->CrPadVal             = 0;
+
+    pMpeg4Param->ProfileIDC           = OMXMpeg4ProfileToMFCProfile(pMpeg4Enc->mpeg4Component[OUTPUT_PORT_INDEX].eProfile);
+    pMpeg4Param->LevelIDC             = OMXMpeg4LevelToMFCLevel(pMpeg4Enc->mpeg4Component[OUTPUT_PORT_INDEX].eLevel);
+    pMpeg4Param->TimeIncreamentRes    = (pSECInputPort->portDefinition.format.video.xFramerate) >> 16;
+    pMpeg4Param->VopTimeIncreament    = 1;
+    pMpeg4Param->SliceArgument        = 0;    /* MB number or byte number */
+    pMpeg4Param->NumberBFrames        = 0;    /* 0(not used) ~ 2 */
+    pMpeg4Param->DisableQpelME        = 1;
+
+    pMpeg4Param->FrameQp              = pVideoEnc->quantization.nQpI;
+    pMpeg4Param->FrameQp_P            = pVideoEnc->quantization.nQpP;
+    pMpeg4Param->FrameQp_B            = pVideoEnc->quantization.nQpB;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pVideoEnc->eControlRate[OUTPUT_PORT_INDEX]: 0x%x", pVideoEnc->eControlRate[OUTPUT_PORT_INDEX]);
+    switch (pVideoEnc->eControlRate[OUTPUT_PORT_INDEX]) {
+    case OMX_Video_ControlRateVariable:
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+        pMpeg4Param->EnableFRMRateControl = 0;        // 0: Disable, 1: Frame level RC
+        pMpeg4Param->CBRPeriodRf          = 100;
+        break;
+    case OMX_Video_ControlRateConstant:
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode CBR");
+        pMpeg4Param->EnableFRMRateControl = 1;        // 0: Disable, 1: Frame level RC
+        pMpeg4Param->CBRPeriodRf          = 10;
+        break;
+    case OMX_Video_ControlRateDisable:
+    default: //Android default
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+        pMpeg4Param->EnableFRMRateControl = 0;
+        pMpeg4Param->CBRPeriodRf          = 100;
+        break;
+    }
+
+    switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) {
+    case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+    case OMX_COLOR_FormatYUV420SemiPlanar:
+    case OMX_COLOR_FormatYUV420Planar:
+#ifdef METADATABUFFERTYPE
+    case OMX_COLOR_FormatAndroidOpaque:
+#endif
+        pMpeg4Param->FrameMap = NV12_LINEAR;
+        break;
+    case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12Tiled:
+        pMpeg4Param->FrameMap = NV12_TILE;
+        break;
+    case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV21Linear:
+        pMpeg4Param->FrameMap = NV21_LINEAR;
+        break;
+    default:
+        pMpeg4Param->FrameMap = NV12_TILE;
+        break;
+    }
+
+    Mpeg4PrintParams(pMpeg4Param);
+}
+
+void Change_Mpeg4Enc_Param(SSBSIP_MFC_ENC_MPEG4_PARAM *pMpeg4Param, SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    SEC_OMX_BASEPORT          *pSECInputPort = NULL;
+    SEC_OMX_BASEPORT          *pSECOutputPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_MPEG4ENC_HANDLE       *pMpeg4Enc = NULL;
+
+    pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    if (pVideoEnc->IntraRefreshVOP == OMX_TRUE) {
+        int set_conf_IntraRefreshVOP = 1;
+        SsbSipMfcEncSetConfig(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_FRAME_TYPE,
+                                &set_conf_IntraRefreshVOP);
+        pVideoEnc->IntraRefreshVOP = OMX_FALSE;
+    }
+
+    if (pMpeg4Param->IDRPeriod != (int)pMpeg4Enc->mpeg4Component[OUTPUT_PORT_INDEX].nPFrames + 1) {
+        int set_conf_IDRPeriod = pMpeg4Enc->mpeg4Component[OUTPUT_PORT_INDEX].nPFrames + 1;
+        SsbSipMfcEncSetConfig(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_I_PERIOD,
+                                &set_conf_IDRPeriod);
+    }
+    if (pMpeg4Param->Bitrate != (int)pSECOutputPort->portDefinition.format.video.nBitrate) {
+        int set_conf_bitrate = pSECOutputPort->portDefinition.format.video.nBitrate;
+        SsbSipMfcEncSetConfig(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_CHANGE_BIT_RATE,
+                                &set_conf_bitrate);
+    }
+    if (pMpeg4Param->TimeIncreamentRes != (int)((pSECOutputPort->portDefinition.format.video.xFramerate) >> 16)) {
+        int set_conf_framerate = (pSECInputPort->portDefinition.format.video.xFramerate) >> 16;
+        SsbSipMfcEncSetConfig(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_CHANGE_FRAME_RATE,
+                                &set_conf_framerate);
+    }
+
+    Set_Mpeg4Enc_Param(pMpeg4Param, pSECComponent);
+    Mpeg4PrintParams(pMpeg4Param);
+}
+
+void Set_H263Enc_Param(SSBSIP_MFC_ENC_H263_PARAM *pH263Param, SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    SEC_OMX_BASEPORT    *pSECInputPort = NULL;
+    SEC_OMX_BASEPORT    *pSECOutputPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_MPEG4ENC_HANDLE *pMpeg4Enc = NULL;
+
+    pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    pH263Param->codecType            = H263_ENC;
+    pH263Param->SourceWidth          = pSECOutputPort->portDefinition.format.video.nFrameWidth;
+    pH263Param->SourceHeight         = pSECOutputPort->portDefinition.format.video.nFrameHeight;
+    pH263Param->IDRPeriod            = pMpeg4Enc->h263Component[OUTPUT_PORT_INDEX].nPFrames + 1;
+    pH263Param->SliceMode            = 0;
+    pH263Param->RandomIntraMBRefresh = 0;
+    pH263Param->Bitrate              = pSECOutputPort->portDefinition.format.video.nBitrate;
+    pH263Param->QSCodeMax            = 30;
+    pH263Param->QSCodeMin            = 10;
+    pH263Param->PadControlOn         = 0;    /* 0: Use boundary pixel, 1: Use the below setting value */
+    pH263Param->LumaPadVal           = 0;
+    pH263Param->CbPadVal             = 0;
+    pH263Param->CrPadVal             = 0;
+
+    pH263Param->FrameRate            = (pSECInputPort->portDefinition.format.video.xFramerate) >> 16;
+
+    pH263Param->FrameQp              = pVideoEnc->quantization.nQpI;
+    pH263Param->FrameQp_P            = pVideoEnc->quantization.nQpP;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pVideoEnc->eControlRate[OUTPUT_PORT_INDEX]: 0x%x", pVideoEnc->eControlRate[OUTPUT_PORT_INDEX]);
+    switch (pVideoEnc->eControlRate[OUTPUT_PORT_INDEX]) {
+    case OMX_Video_ControlRateVariable:
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+        pH263Param->EnableFRMRateControl = 0;        // 0: Disable, 1: Frame level RC
+        pH263Param->CBRPeriodRf          = 100;
+        break;
+    case OMX_Video_ControlRateConstant:
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode CBR");
+        pH263Param->EnableFRMRateControl = 1;        // 0: Disable, 1: Frame level RC
+        pH263Param->CBRPeriodRf          = 10;
+        break;
+    case OMX_Video_ControlRateDisable:
+    default: //Android default
+        SEC_OSAL_Log(SEC_LOG_TRACE, "Video Encode VBR");
+        pH263Param->EnableFRMRateControl = 0;
+        pH263Param->CBRPeriodRf          = 100;
+        break;
+    }
+
+    switch ((SEC_OMX_COLOR_FORMATTYPE)pSECInputPort->portDefinition.format.video.eColorFormat) {
+    case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+    case OMX_COLOR_FormatYUV420SemiPlanar:
+        pH263Param->FrameMap = NV12_LINEAR;
+        break;
+    case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12Tiled:
+        pH263Param->FrameMap = NV12_TILE;
+        break;
+    case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV21Linear:
+        pH263Param->FrameMap = NV21_LINEAR;
+        break;
+    default:
+        pH263Param->FrameMap = NV12_TILE;
+        break;
+    }
+
+    H263PrintParams(pH263Param);
+}
+
+void Change_H263Enc_Param(SSBSIP_MFC_ENC_H263_PARAM *pH263Param, SEC_OMX_BASECOMPONENT *pSECComponent)
+{
+    SEC_OMX_BASEPORT          *pSECInputPort = NULL;
+    SEC_OMX_BASEPORT          *pSECOutputPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_MPEG4ENC_HANDLE       *pMpeg4Enc = NULL;
+
+    pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    if (pVideoEnc->IntraRefreshVOP == OMX_TRUE) {
+        int set_conf_IntraRefreshVOP = 1;
+        SsbSipMfcEncSetConfig(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_FRAME_TYPE,
+                                &set_conf_IntraRefreshVOP);
+        pVideoEnc->IntraRefreshVOP = OMX_FALSE;
+    }
+    if (pH263Param->IDRPeriod != (int)pMpeg4Enc->h263Component[OUTPUT_PORT_INDEX].nPFrames + 1) {
+        int set_conf_IDRPeriod = pMpeg4Enc->h263Component[OUTPUT_PORT_INDEX].nPFrames + 1;
+        SsbSipMfcEncSetConfig(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_I_PERIOD,
+                                &set_conf_IDRPeriod);
+    }
+    if (pH263Param->Bitrate != (int)pSECOutputPort->portDefinition.format.video.nBitrate) {
+        int set_conf_bitrate = pSECOutputPort->portDefinition.format.video.nBitrate;
+        SsbSipMfcEncSetConfig(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_CHANGE_BIT_RATE,
+                                &set_conf_bitrate);
+    }
+    if (pH263Param->FrameRate != (int)((pSECOutputPort->portDefinition.format.video.xFramerate) >> 16)) {
+        int set_conf_framerate = (pSECInputPort->portDefinition.format.video.xFramerate) >> 16;
+        SsbSipMfcEncSetConfig(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle,
+                                MFC_ENC_SETCONF_CHANGE_FRAME_RATE,
+                                &set_conf_framerate);
+    }
+
+    Set_H263Enc_Param(pH263Param, pSECComponent);
+    H263PrintParams(pH263Param);
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_GetParameter(
+    OMX_IN    OMX_HANDLETYPE hComponent,
+    OMX_IN    OMX_INDEXTYPE  nParamIndex,
+    OMX_INOUT OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nParamIndex) {
+    case OMX_IndexParamVideoMpeg4:
+    {
+        OMX_VIDEO_PARAM_MPEG4TYPE *pDstMpeg4Param = (OMX_VIDEO_PARAM_MPEG4TYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_MPEG4TYPE *pSrcMpeg4Param = NULL;
+        SEC_MPEG4ENC_HANDLE       *pMpeg4Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstMpeg4Param, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstMpeg4Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcMpeg4Param = &pMpeg4Enc->mpeg4Component[pDstMpeg4Param->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstMpeg4Param, pSrcMpeg4Param, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE));
+    }
+        break;
+    case OMX_IndexParamVideoH263:
+    {
+        OMX_VIDEO_PARAM_H263TYPE  *pDstH263Param = (OMX_VIDEO_PARAM_H263TYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_H263TYPE  *pSrcH263Param = NULL;
+        SEC_MPEG4ENC_HANDLE       *pMpeg4Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstH263Param, sizeof(OMX_VIDEO_PARAM_H263TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstH263Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcH263Param = &pMpeg4Enc->h263Component[pDstH263Param->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstH263Param, pSrcH263Param, sizeof(OMX_VIDEO_PARAM_H263TYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_S32 codecType;
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        codecType = ((SEC_MPEG4ENC_HANDLE *)(((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType;
+        if (codecType == CODEC_TYPE_MPEG4)
+            SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_MPEG4_ENC_ROLE);
+        else
+            SEC_OSAL_Strcpy((char *)pComponentRole->cRole, SEC_OMX_COMPONENT_H263_ENC_ROLE);
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelQuerySupported:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pDstProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pComponentParameterStructure;
+        SEC_OMX_VIDEO_PROFILELEVEL       *pProfileLevel = NULL;
+        OMX_U32                           maxProfileLevelNum = 0;
+        OMX_S32                           codecType;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        codecType = ((SEC_MPEG4ENC_HANDLE *)(((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType;
+        if (codecType == CODEC_TYPE_MPEG4) {
+            pProfileLevel = supportedMPEG4ProfileLevels;
+            maxProfileLevelNum = sizeof(supportedMPEG4ProfileLevels) / sizeof(SEC_OMX_VIDEO_PROFILELEVEL);
+        } else {
+            pProfileLevel = supportedH263ProfileLevels;
+            maxProfileLevelNum = sizeof(supportedH263ProfileLevels) / sizeof(SEC_OMX_VIDEO_PROFILELEVEL);
+        }
+
+        if (pDstProfileLevel->nProfileIndex >= maxProfileLevelNum) {
+            ret = OMX_ErrorNoMore;
+            goto EXIT;
+        }
+
+        pProfileLevel += pDstProfileLevel->nProfileIndex;
+        pDstProfileLevel->eProfile = pProfileLevel->profile;
+        pDstProfileLevel->eLevel = pProfileLevel->level;
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelCurrent:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pDstProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_MPEG4TYPE        *pSrcMpeg4Param = NULL;
+        OMX_VIDEO_PARAM_H263TYPE         *pSrcH263Param = NULL;
+        SEC_MPEG4ENC_HANDLE              *pMpeg4Enc = NULL;
+        OMX_S32                           codecType;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        codecType = pMpeg4Enc->hMFCMpeg4Handle.codecType;
+        if (codecType == CODEC_TYPE_MPEG4) {
+            pSrcMpeg4Param = &pMpeg4Enc->mpeg4Component[pDstProfileLevel->nPortIndex];
+            pDstProfileLevel->eProfile = pSrcMpeg4Param->eProfile;
+            pDstProfileLevel->eLevel = pSrcMpeg4Param->eLevel;
+        } else {
+            pSrcH263Param = &pMpeg4Enc->h263Component[pDstProfileLevel->nPortIndex];
+            pDstProfileLevel->eProfile = pSrcH263Param->eProfile;
+            pDstProfileLevel->eLevel = pSrcH263Param->eLevel;
+        }
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = NULL;
+        SEC_MPEG4ENC_HANDLE                 *pMpeg4Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pDstErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pDstErrorCorrectionType->nPortIndex != OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pSrcErrorCorrectionType = &pMpeg4Enc->errorCorrectionType[OUTPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoEncodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_SetParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentParameterStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamVideoMpeg4:
+    {
+        OMX_VIDEO_PARAM_MPEG4TYPE *pDstMpeg4Param = NULL;
+        OMX_VIDEO_PARAM_MPEG4TYPE *pSrcMpeg4Param = (OMX_VIDEO_PARAM_MPEG4TYPE *)pComponentParameterStructure;
+        SEC_MPEG4ENC_HANDLE       *pMpeg4Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcMpeg4Param, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcMpeg4Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstMpeg4Param = &pMpeg4Enc->mpeg4Component[pSrcMpeg4Param->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstMpeg4Param, pSrcMpeg4Param, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE));
+    }
+        break;
+    case OMX_IndexParamVideoH263:
+    {
+        OMX_VIDEO_PARAM_H263TYPE *pDstH263Param = NULL;
+        OMX_VIDEO_PARAM_H263TYPE *pSrcH263Param = (OMX_VIDEO_PARAM_H263TYPE *)pComponentParameterStructure;
+        SEC_MPEG4ENC_HANDLE      *pMpeg4Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcH263Param, sizeof(OMX_VIDEO_PARAM_H263TYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcH263Param->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstH263Param = &pMpeg4Enc->h263Component[pSrcH263Param->nPortIndex];
+
+        SEC_OSAL_Memcpy(pDstH263Param, pSrcH263Param, sizeof(OMX_VIDEO_PARAM_H263TYPE));
+    }
+        break;
+    case OMX_IndexParamStandardComponentRole:
+    {
+        OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
+
+        ret = SEC_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if ((pSECComponent->currentState != OMX_StateLoaded) && (pSECComponent->currentState != OMX_StateWaitForResources)) {
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+
+        if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_MPEG4_ENC_ROLE)) {
+            pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
+            //((SEC_MPEG4ENC_HANDLE *)(((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType = CODEC_TYPE_MPEG4;
+        } else if (!SEC_OSAL_Strcmp((char*)pComponentRole->cRole, SEC_OMX_COMPONENT_H263_ENC_ROLE)) {
+            pSECComponent->pSECPort[OUTPUT_PORT_INDEX].portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingH263;
+            //((SEC_MPEG4ENC_HANDLE *)(((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType = CODEC_TYPE_H263;
+        } else {
+            ret = OMX_ErrorBadParameter;
+            goto EXIT;
+        }
+    }
+        break;
+    case OMX_IndexParamVideoProfileLevelCurrent:
+    {
+        OMX_VIDEO_PARAM_PROFILELEVELTYPE *pSrcProfileLevel = (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_MPEG4TYPE        *pDstMpeg4Param = NULL;
+        OMX_VIDEO_PARAM_H263TYPE         *pDstH263Param = NULL;
+        SEC_MPEG4ENC_HANDLE              *pMpeg4Enc = NULL;
+        OMX_S32                           codecType;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcProfileLevel, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcProfileLevel->nPortIndex >= ALL_PORT_NUM) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        codecType = pMpeg4Enc->hMFCMpeg4Handle.codecType;
+        if (codecType == CODEC_TYPE_MPEG4) {
+            /*
+             * To do: Check validity of profile & level parameters
+             */
+
+            pDstMpeg4Param = &pMpeg4Enc->mpeg4Component[pSrcProfileLevel->nPortIndex];
+            pDstMpeg4Param->eProfile = pSrcProfileLevel->eProfile;
+            pDstMpeg4Param->eLevel = pSrcProfileLevel->eLevel;
+        } else {
+            /*
+             * To do: Check validity of profile & level parameters
+             */
+
+            pDstH263Param = &pMpeg4Enc->h263Component[pSrcProfileLevel->nPortIndex];
+            pDstH263Param->eProfile = pSrcProfileLevel->eProfile;
+            pDstH263Param->eLevel = pSrcProfileLevel->eLevel;
+        }
+    }
+        break;
+    case OMX_IndexParamVideoErrorCorrection:
+    {
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pSrcErrorCorrectionType = (OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *)pComponentParameterStructure;
+        OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE *pDstErrorCorrectionType = NULL;
+        SEC_MPEG4ENC_HANDLE                 *pMpeg4Enc = NULL;
+
+        ret = SEC_OMX_Check_SizeVersion(pSrcErrorCorrectionType, sizeof(OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE));
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pSrcErrorCorrectionType->nPortIndex != OUTPUT_PORT_INDEX) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        pDstErrorCorrectionType = &pMpeg4Enc->errorCorrectionType[OUTPUT_PORT_INDEX];
+
+        pDstErrorCorrectionType->bEnableHEC = pSrcErrorCorrectionType->bEnableHEC;
+        pDstErrorCorrectionType->bEnableResync = pSrcErrorCorrectionType->bEnableResync;
+        pDstErrorCorrectionType->nResynchMarkerSpacing = pSrcErrorCorrectionType->nResynchMarkerSpacing;
+        pDstErrorCorrectionType->bEnableDataPartitioning = pSrcErrorCorrectionType->bEnableDataPartitioning;
+        pDstErrorCorrectionType->bEnableRVLC = pSrcErrorCorrectionType->bEnableRVLC;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoEncodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
+        break;
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_GetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentConfigStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    default:
+        ret = SEC_OMX_VideoEncodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_SetConfig(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        pComponentConfigStructure)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_MPEG4ENC_HANDLE        *pMpeg4Enc = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL || pComponentConfigStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    pVideoEnc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+
+    switch (nIndex) {
+    case OMX_IndexConfigVideoIntraPeriod:
+    {
+        SEC_OMX_VIDEOENC_COMPONENT *pVEncBase = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+        pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+        OMX_U32 nPFrames = (*((OMX_U32 *)pComponentConfigStructure)) - 1;
+
+        if (pMpeg4Enc->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4)
+            pMpeg4Enc->mpeg4Component[OUTPUT_PORT_INDEX].nPFrames = nPFrames;
+        else
+            pMpeg4Enc->h263Component[OUTPUT_PORT_INDEX].nPFrames = nPFrames;
+
+        ret = OMX_ErrorNone;
+    }
+        break;
+    default:
+        ret = SEC_OMX_VideoEncodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
+        break;
+    }
+
+EXIT:
+    if (ret == OMX_ErrorNone)
+        pVideoEnc->configChange = OMX_TRUE;
+
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_GetExtensionIndex(
+    OMX_IN OMX_HANDLETYPE  hComponent,
+    OMX_IN OMX_STRING      cParameterName,
+    OMX_OUT OMX_INDEXTYPE *pIndexType)
+{
+    OMX_ERRORTYPE           ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    if ((cParameterName == NULL) || (pIndexType == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECComponent->currentState == OMX_StateInvalid) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+    if (SEC_OSAL_Strcmp(cParameterName, SEC_INDEX_CONFIG_VIDEO_INTRAPERIOD) == 0) {
+        *pIndexType = OMX_IndexConfigVideoIntraPeriod;
+        ret = OMX_ErrorNone;
+    } else {
+        ret = SEC_OMX_VideoEncodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
+    }
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_ComponentRoleEnum(
+    OMX_IN  OMX_HANDLETYPE hComponent,
+    OMX_OUT OMX_U8        *cRole,
+    OMX_IN  OMX_U32        nIndex)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    OMX_S32                  codecType;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (cRole == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) {
+        ret = OMX_ErrorNoMore;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    codecType = ((SEC_MPEG4ENC_HANDLE *)(((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle))->hMFCMpeg4Handle.codecType;
+    if (codecType == CODEC_TYPE_MPEG4)
+        SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_MPEG4_ENC_ROLE);
+    else
+        SEC_OSAL_Strcpy((char *)cRole, SEC_OMX_COMPONENT_H263_ENC_ROLE);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_EncodeThread(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    SEC_MPEG4ENC_HANDLE   *pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    while (pVideoEnc->NBEncThread.bExitEncodeThread == OMX_FALSE) {
+        SEC_OSAL_SemaphoreWait(pVideoEnc->NBEncThread.hEncFrameStart);
+
+        if (pVideoEnc->NBEncThread.bExitEncodeThread == OMX_FALSE) {
+            pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncExe(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle);
+            SEC_OSAL_SemaphorePost(pVideoEnc->NBEncThread.hEncFrameEnd);
+        }
+    }
+
+EXIT:
+    FunctionOut();
+    SEC_OSAL_ThreadExit(NULL);
+
+    return ret;
+}
+
+/* MFC Init */
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Init(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT     *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+    SEC_OMX_BASEPORT          *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_MPEG4ENC_HANDLE       *pMpeg4Enc = NULL;
+    OMX_HANDLETYPE             hMFCHandle = NULL;
+    OMX_S32                    returnCodec = 0;
+    CSC_METHOD csc_method = CSC_METHOD_SW;
+
+    FunctionIn();
+
+    pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFC = OMX_FALSE;
+    pSECComponent->bUseFlagEOF = OMX_FALSE;
+    pSECComponent->bSaveFlagEOS = OMX_FALSE;
+
+    /* MFC(Multi Format Codec) encoder and CMM(Codec Memory Management) driver open */
+    switch (pSECInputPort->portDefinition.format.video.eColorFormat) {
+    case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+    case OMX_SEC_COLOR_FormatNV21LPhysicalAddress:
+        hMFCHandle = (OMX_PTR)SsbSipMfcEncOpen();
+        break;
+    default: {
+        SSBIP_MFC_BUFFER_TYPE buf_type = CACHE;
+        hMFCHandle = (OMX_PTR)SsbSipMfcEncOpenExt(&buf_type);
+        break;
+    }
+    }
+
+    if (hMFCHandle == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle = hMFCHandle;
+
+    /* set MFC ENC VIDEO PARAM and initialize MFC encoder instance */
+    if (pMpeg4Enc->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4) {
+        Set_Mpeg4Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam), pSECComponent);
+        returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam));
+    } else {
+        Set_H263Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam), pSECComponent);
+        returnCodec = SsbSipMfcEncInit(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam));
+    }
+    if (returnCodec != MFC_RET_OK) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+
+    /* Allocate encoder's input buffer */
+    returnCodec = SsbSipMfcEncGetInBuf(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.inputInfo));
+    if (returnCodec != MFC_RET_OK) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoEnc->MFCEncInputBuffer[0].YPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YPhyAddr;
+    pVideoEnc->MFCEncInputBuffer[0].CPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CPhyAddr;
+    pVideoEnc->MFCEncInputBuffer[0].YVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr;
+    pVideoEnc->MFCEncInputBuffer[0].CVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr;
+    pVideoEnc->MFCEncInputBuffer[0].YBufferSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YSize;
+    pVideoEnc->MFCEncInputBuffer[0].CBufferSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CSize;
+    pVideoEnc->MFCEncInputBuffer[0].YDataSize = 0;
+    pVideoEnc->MFCEncInputBuffer[0].CDataSize = 0;
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr : 0x%x", pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr : 0x%x", pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr);
+
+    returnCodec = SsbSipMfcEncGetInBuf(hMFCHandle, &(pMpeg4Enc->hMFCMpeg4Handle.inputInfo));
+    if (returnCodec != MFC_RET_OK) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    pVideoEnc->MFCEncInputBuffer[1].YPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YPhyAddr;
+    pVideoEnc->MFCEncInputBuffer[1].CPhyAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CPhyAddr;
+    pVideoEnc->MFCEncInputBuffer[1].YVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr;
+    pVideoEnc->MFCEncInputBuffer[1].CVirAddr = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr;
+    pVideoEnc->MFCEncInputBuffer[1].YBufferSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YSize;
+    pVideoEnc->MFCEncInputBuffer[1].CBufferSize = pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CSize;
+    pVideoEnc->MFCEncInputBuffer[1].YDataSize = 0;
+    pVideoEnc->MFCEncInputBuffer[1].CDataSize = 0;
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr : 0x%x", pMpeg4Enc->hMFCMpeg4Handle.inputInfo.YVirAddr);
+    SEC_OSAL_Log(SEC_LOG_TRACE, "pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr : 0x%x", pMpeg4Enc->hMFCMpeg4Handle.inputInfo.CVirAddr);
+
+    pVideoEnc->indexInputBuffer = 0;
+
+    pVideoEnc->bFirstFrame = OMX_TRUE;
+
+#ifdef NONBLOCK_MODE_PROCESS
+    pVideoEnc->NBEncThread.bExitEncodeThread = OMX_FALSE;
+    pVideoEnc->NBEncThread.bEncoderRun = OMX_FALSE;
+    SEC_OSAL_SemaphoreCreate(&(pVideoEnc->NBEncThread.hEncFrameStart));
+    SEC_OSAL_SemaphoreCreate(&(pVideoEnc->NBEncThread.hEncFrameEnd));
+    if (OMX_ErrorNone == SEC_OSAL_ThreadCreate(&pVideoEnc->NBEncThread.hNBEncodeThread,
+                                                SEC_MFC_EncodeThread,
+                                                pOMXComponent)) {
+        pMpeg4Enc->hMFCMpeg4Handle.returnCodec = MFC_RET_OK;
+    }
+#endif
+    SEC_OSAL_Memset(pSECComponent->timeStamp, -19771003, sizeof(OMX_TICKS) * MAX_TIMESTAMP);
+    SEC_OSAL_Memset(pSECComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
+    pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp = 0;
+
+    pVideoEnc->csc_handle = csc_init(&csc_method);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Terminate */
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+    SEC_MPEG4ENC_HANDLE   *pMpeg4Enc = NULL;
+    OMX_HANDLETYPE         hMFCHandle = NULL;
+
+    FunctionIn();
+
+    pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+#ifdef NONBLOCK_MODE_PROCESS
+    if (pVideoEnc->NBEncThread.hNBEncodeThread != NULL) {
+        pVideoEnc->NBEncThread.bExitEncodeThread = OMX_TRUE;
+        SEC_OSAL_SemaphorePost(pVideoEnc->NBEncThread.hEncFrameStart);
+        SEC_OSAL_ThreadTerminate(pVideoEnc->NBEncThread.hNBEncodeThread);
+        pVideoEnc->NBEncThread.hNBEncodeThread = NULL;
+    }
+
+    if(pVideoEnc->NBEncThread.hEncFrameEnd != NULL) {
+        SEC_OSAL_SemaphoreTerminate(pVideoEnc->NBEncThread.hEncFrameEnd);
+        pVideoEnc->NBEncThread.hEncFrameEnd = NULL;
+    }
+
+    if(pVideoEnc->NBEncThread.hEncFrameStart != NULL) {
+        SEC_OSAL_SemaphoreTerminate(pVideoEnc->NBEncThread.hEncFrameStart);
+        pVideoEnc->NBEncThread.hEncFrameStart = NULL;
+    }
+#endif
+
+    hMFCHandle = pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle;
+    if (hMFCHandle != NULL) {
+        SsbSipMfcEncClose(hMFCHandle);
+        hMFCHandle = pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle = NULL;
+    }
+
+    if (pVideoEnc->csc_handle != NULL) {
+        csc_deinit(pVideoEnc->csc_handle);
+        pVideoEnc->csc_handle = NULL;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode_Nonblock(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT     *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+    SEC_MPEG4ENC_HANDLE       *pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    OMX_HANDLETYPE             hMFCHandle = pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle;
+    SSBSIP_MFC_ENC_INPUT_INFO *pInputInfo = &(pMpeg4Enc->hMFCMpeg4Handle.inputInfo);
+    SSBSIP_MFC_ENC_OUTPUT_INFO outputInfo;
+    SEC_OMX_BASEPORT          *pSECPort = NULL;
+    MFC_ENC_ADDR_INFO          addrInfo;
+    OMX_U32                    oneFrameSize = pInputData->dataLen;
+
+    FunctionIn();
+
+    if (pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFC == OMX_FALSE) {
+        pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncGetOutBuf(hMFCHandle, &outputInfo);
+        if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec != MFC_RET_OK)
+        {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, pMpeg4Enc->hMFCMpeg4Handle.returnCodec);
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+
+        pOutputData->dataBuffer = outputInfo.StrmVirAddr;
+        pOutputData->allocSize = outputInfo.headerSize;
+        pOutputData->dataLen = outputInfo.headerSize;
+        pOutputData->timeStamp = 0;
+        pOutputData->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
+        pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
+
+        pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFC = OMX_TRUE;
+
+        ret = OMX_ErrorInputDataEncodeYet;
+        goto EXIT;
+    }
+
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+
+    if (oneFrameSize <= 0) {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    if (((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) ||
+        (pSECComponent->getAllDelayBuffer == OMX_TRUE)){
+        /* Dummy input data for get out encoded last frame */
+        pInputInfo->YPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YPhyAddr;
+        pInputInfo->CPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CPhyAddr;
+        pInputInfo->YVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr;
+        pInputInfo->CVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr;
+    } else {
+        switch (pSECPort->portDefinition.format.video.eColorFormat) {
+        case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+        case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+        case OMX_SEC_COLOR_FormatNV21LPhysicalAddress: {
+#ifndef USE_METADATABUFFERTYPE
+            /* USE_FIMC_FRAME_BUFFER */
+            SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));
+            SEC_OSAL_Memcpy(&addrInfo.pAddrC, pInputData->dataBuffer + sizeof(addrInfo.pAddrY), sizeof(addrInfo.pAddrC));
+#else
+            OMX_PTR ppBuf[3];
+            SEC_OSAL_GetInfoFromMetaData(pInputData, ppBuf);
+
+            SEC_OSAL_Memcpy(&addrInfo.pAddrY, ppBuf[0], sizeof(addrInfo.pAddrY));
+            SEC_OSAL_Memcpy(&addrInfo.pAddrC, ppBuf[1], sizeof(addrInfo.pAddrC));
+#endif
+            pInputInfo->YPhyAddr = addrInfo.pAddrY;
+            pInputInfo->CPhyAddr = addrInfo.pAddrC;
+            break;
+        }
+        case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+            addrInfo.pAddrY = *((void **)pInputData->dataBuffer);
+            addrInfo.pAddrC = (void *)((char *)addrInfo.pAddrY + pInputInfo->YSize);
+
+            pInputInfo->YPhyAddr = addrInfo.pAddrY;
+            pInputInfo->CPhyAddr = addrInfo.pAddrC;
+            break;
+        default:
+            pInputInfo->YPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YPhyAddr;
+            pInputInfo->CPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CPhyAddr;
+            pInputInfo->YVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr;
+            pInputInfo->CVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr;
+            break;
+        }
+    }
+
+    pSECComponent->timeStamp[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
+    pSECComponent->nFlags[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags;
+
+    if ((pMpeg4Enc->hMFCMpeg4Handle.returnCodec == MFC_RET_OK) &&
+        (pVideoEnc->bFirstFrame == OMX_FALSE)) {
+        OMX_S32 indexTimestamp = 0;
+
+        /* wait for mfc encode done */
+        if (pVideoEnc->NBEncThread.bEncoderRun != OMX_FALSE) {
+            SEC_OSAL_SemaphoreWait(pVideoEnc->NBEncThread.hEncFrameEnd);
+            pVideoEnc->NBEncThread.bEncoderRun = OMX_FALSE;
+        }
+
+        SEC_OSAL_SleepMillisec(0);
+        pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncGetOutBuf(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle, &outputInfo);
+        if ((SsbSipMfcEncGetConfig(pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))){
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+        }
+
+        if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec == MFC_RET_OK) {
+            /** Fill Output Buffer **/
+            pOutputData->dataBuffer = outputInfo.StrmVirAddr;
+            pOutputData->allocSize = outputInfo.dataSize;
+            pOutputData->dataLen = outputInfo.dataSize;
+            pOutputData->usedDataLen = 0;
+
+            pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
+            if (outputInfo.frameType == MFC_FRAME_TYPE_I_FRAME)
+                pOutputData->nFlags |= OMX_BUFFERFLAG_SYNCFRAME;
+
+            SEC_OSAL_Log(SEC_LOG_TRACE, "MFC Encode OK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+
+            ret = OMX_ErrorNone;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, pMpeg4Enc->hMFCMpeg4Handle.returnCodec);
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+
+        if (pSECComponent->getAllDelayBuffer == OMX_TRUE) {
+            ret = OMX_ErrorInputDataEncodeYet;
+        }
+        if ((pInputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pInputData->nFlags = (pOutputData->nFlags & (~OMX_BUFFERFLAG_EOS));
+            pSECComponent->getAllDelayBuffer = OMX_TRUE;
+            ret = OMX_ErrorInputDataEncodeYet;
+        }
+        if ((pOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS) {
+            pSECComponent->getAllDelayBuffer = OMX_FALSE;
+            pOutputData->dataLen = 0;
+            pOutputData->usedDataLen = 0;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "OMX_BUFFERFLAG_EOS!!!");
+            ret = OMX_ErrorNone;
+        }
+    }
+    if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec != MFC_RET_OK) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "In %s : SsbSipMfcEncExe Failed!!!\n", __func__);
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    pMpeg4Enc->hMFCMpeg4Handle.returnCodec = SsbSipMfcEncSetInBuf(hMFCHandle, pInputInfo);
+    if (pMpeg4Enc->hMFCMpeg4Handle.returnCodec != MFC_RET_OK) {
+       SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncSetInBuf failed, ret:%d", __FUNCTION__, pMpeg4Enc->hMFCMpeg4Handle.returnCodec);
+       ret = OMX_ErrorUndefined;
+       goto EXIT;
+    } else {
+        pVideoEnc->indexInputBuffer++;
+        pVideoEnc->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+    }
+
+    if (pVideoEnc->configChange == OMX_TRUE) {
+        if (pMpeg4Enc->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4)
+            Change_Mpeg4Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam), pSECComponent);
+        else
+            Change_H263Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam), pSECComponent);
+        pVideoEnc->configChange = OMX_FALSE;
+    }
+
+    SsbSipMfcEncSetConfig(hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp));
+
+    /* mfc encode start */
+    SEC_OSAL_SemaphorePost(pVideoEnc->NBEncThread.hEncFrameStart);
+    pVideoEnc->NBEncThread.bEncoderRun = OMX_TRUE;
+    pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp++;
+    pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp %= MAX_TIMESTAMP;
+    pVideoEnc->bFirstFrame = OMX_FALSE;
+    SEC_OSAL_SleepMillisec(0);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_MFC_Mpeg4_Encode_Block(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE              ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT     *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle);
+    SEC_MPEG4ENC_HANDLE       *pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    OMX_HANDLETYPE             hMFCHandle = pMpeg4Enc->hMFCMpeg4Handle.hMFCHandle;
+    SSBSIP_MFC_ENC_INPUT_INFO *pInputInfo = &(pMpeg4Enc->hMFCMpeg4Handle.inputInfo);
+    SSBSIP_MFC_ENC_OUTPUT_INFO outputInfo;
+    SEC_OMX_BASEPORT          *pSECPort = NULL;
+    MFC_ENC_ADDR_INFO          addrInfo;
+    OMX_U32                    oneFrameSize = pInputData->dataLen;
+    OMX_S32                    returnCodec = 0;
+
+    FunctionIn();
+
+    if (pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFC == OMX_FALSE) {
+        returnCodec = SsbSipMfcEncGetOutBuf(hMFCHandle, &outputInfo);
+        if (returnCodec != MFC_RET_OK)
+        {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, returnCodec);
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+
+        pOutputData->dataBuffer = outputInfo.StrmVirAddr;
+        pOutputData->allocSize = outputInfo.headerSize;
+        pOutputData->dataLen = outputInfo.headerSize;
+        pOutputData->timeStamp = 0;
+        pOutputData->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
+        pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
+
+        pMpeg4Enc->hMFCMpeg4Handle.bConfiguredMFC = OMX_TRUE;
+
+        ret = OMX_ErrorInputDataEncodeYet;
+        goto EXIT;
+    }
+
+    if ((pInputData->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
+        (pSECComponent->bUseFlagEOF == OMX_FALSE))
+        pSECComponent->bUseFlagEOF = OMX_TRUE;
+
+    if (oneFrameSize <= 0) {
+        pOutputData->timeStamp = pInputData->timeStamp;
+        pOutputData->nFlags = pInputData->nFlags;
+
+        ret = OMX_ErrorNone;
+        goto EXIT;
+    }
+
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    switch (pSECPort->portDefinition.format.video.eColorFormat) {
+    case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV12LPhysicalAddress:
+    case OMX_SEC_COLOR_FormatNV21LPhysicalAddress: {
+#ifndef USE_METADATABUFFERTYPE
+        /* USE_FIMC_FRAME_BUFFER */
+        SEC_OSAL_Memcpy(&addrInfo.pAddrY, pInputData->dataBuffer, sizeof(addrInfo.pAddrY));
+        SEC_OSAL_Memcpy(&addrInfo.pAddrC, pInputData->dataBuffer + sizeof(addrInfo.pAddrY), sizeof(addrInfo.pAddrC));
+#else
+        OMX_PTR ppBuf[3];
+        SEC_OSAL_GetInfoFromMetaData(pInputData,ppBuf);
+
+        SEC_OSAL_Memcpy(&addrInfo.pAddrY, ppBuf[0], sizeof(addrInfo.pAddrY));
+        SEC_OSAL_Memcpy(&addrInfo.pAddrC, ppBuf[1], sizeof(addrInfo.pAddrC));
+#endif
+        pInputInfo->YPhyAddr = addrInfo.pAddrY;
+        pInputInfo->CPhyAddr = addrInfo.pAddrC;
+        break;
+    }
+    case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
+        addrInfo.pAddrY = *((void **)pInputData->dataBuffer);
+        addrInfo.pAddrC = (void *)((char *)addrInfo.pAddrY + pInputInfo->YSize);
+
+        pInputInfo->YPhyAddr = addrInfo.pAddrY;
+        pInputInfo->CPhyAddr = addrInfo.pAddrC;
+        break;
+    default:
+        pInputInfo->YPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YPhyAddr;
+        pInputInfo->CPhyAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CPhyAddr;
+        pInputInfo->YVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].YVirAddr;
+        pInputInfo->CVirAddr = pVideoEnc->MFCEncInputBuffer[pVideoEnc->indexInputBuffer].CVirAddr;
+        break;
+    }
+
+    returnCodec = SsbSipMfcEncSetInBuf(hMFCHandle, pInputInfo);
+    if (returnCodec != MFC_RET_OK) {
+       SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncSetInBuf failed, ret:%d", __FUNCTION__, returnCodec);
+       ret = OMX_ErrorUndefined;
+       goto EXIT;
+    } else {
+        pVideoEnc->indexInputBuffer++;
+        pVideoEnc->indexInputBuffer %= MFC_INPUT_BUFFER_NUM_MAX;
+    }
+
+    if (pVideoEnc->configChange == OMX_TRUE) {
+        if (pMpeg4Enc->hMFCMpeg4Handle.codecType == CODEC_TYPE_MPEG4)
+            Change_Mpeg4Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.mpeg4MFCParam), pSECComponent);
+        else
+            Change_H263Enc_Param(&(pMpeg4Enc->hMFCMpeg4Handle.h263MFCParam), pSECComponent);
+        pVideoEnc->configChange = OMX_FALSE;
+    }
+
+    pSECComponent->timeStamp[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->timeStamp;
+    pSECComponent->nFlags[pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp] = pInputData->nFlags;
+    SsbSipMfcEncSetConfig(hMFCHandle, MFC_ENC_SETCONF_FRAME_TAG, &(pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp));
+
+    returnCodec = SsbSipMfcEncExe(hMFCHandle);
+    if (returnCodec == MFC_RET_OK) {
+        OMX_S32 indexTimestamp = 0;
+
+        pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp++;
+        pMpeg4Enc->hMFCMpeg4Handle.indexTimestamp %= MAX_TIMESTAMP;
+
+        returnCodec = SsbSipMfcEncGetOutBuf(hMFCHandle, &outputInfo);
+
+        if ((SsbSipMfcEncGetConfig(hMFCHandle, MFC_ENC_GETCONF_FRAME_TAG, &indexTimestamp) != MFC_RET_OK) ||
+            (((indexTimestamp < 0) || (indexTimestamp >= MAX_TIMESTAMP)))) {
+            pOutputData->timeStamp = pInputData->timeStamp;
+            pOutputData->nFlags = pInputData->nFlags;
+        } else {
+            pOutputData->timeStamp = pSECComponent->timeStamp[indexTimestamp];
+            pOutputData->nFlags = pSECComponent->nFlags[indexTimestamp];
+        }
+
+        if (returnCodec == MFC_RET_OK) {
+            /** Fill Output Buffer **/
+            pOutputData->dataBuffer = outputInfo.StrmVirAddr;
+            pOutputData->allocSize = outputInfo.dataSize;
+            pOutputData->dataLen = outputInfo.dataSize;
+            pOutputData->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
+            if (outputInfo.frameType == MFC_FRAME_TYPE_I_FRAME)
+                pOutputData->nFlags |= OMX_BUFFERFLAG_SYNCFRAME;
+
+            ret = OMX_ErrorNone;
+        } else {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncGetOutBuf failed, ret:%d", __FUNCTION__, returnCodec);
+            ret = OMX_ErrorUndefined;
+        }
+    } else {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SsbSipMfcEncExe failed, ret:%d", __FUNCTION__, returnCodec);
+        ret = OMX_ErrorUndefined;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+/* MFC Encode */
+OMX_ERRORTYPE SEC_MFC_Mpeg4Enc_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, SEC_OMX_DATA *pInputData, SEC_OMX_DATA *pOutputData)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    SEC_OMX_BASEPORT        *pInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    SEC_OMX_BASEPORT        *pOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+
+    FunctionIn();
+
+    if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) ||
+            (!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) {
+        goto EXIT;
+    }
+    if (OMX_FALSE == SEC_Check_BufferProcess_State(pSECComponent)) {
+        goto EXIT;
+    }
+
+#ifdef NONBLOCK_MODE_PROCESS
+    ret = SEC_MFC_Mpeg4_Encode_Nonblock(pOMXComponent, pInputData, pOutputData);
+#else
+    ret = SEC_MFC_Mpeg4_Encode_Block(pOMXComponent, pInputData, pOutputData);
+#endif
+    if (ret != OMX_ErrorNone) {
+        if (ret == OMX_ErrorInputDataEncodeYet) {
+            pOutputData->usedDataLen = 0;
+            pOutputData->remainDataLen = pOutputData->dataLen;
+        } else {
+            pSECComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+                                            pSECComponent->callbackData,
+                                            OMX_EventError, ret, 0, NULL);
+        }
+    } else {
+        pInputData->usedDataLen += pInputData->dataLen;
+        pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
+        pInputData->dataLen -= pInputData->usedDataLen;
+        pInputData->usedDataLen = 0;
+
+        pOutputData->usedDataLen = 0;
+        pOutputData->remainDataLen = pOutputData->dataLen;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_OMX_BASEPORT        *pSECPort = NULL;
+    SEC_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+    SEC_MPEG4ENC_HANDLE     *pMpeg4Enc = NULL;
+    OMX_S32                  codecType = -1;
+    int i = 0;
+
+    FunctionIn();
+
+    if ((hComponent == NULL) || (componentName == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+    if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_MPEG4_ENC, componentName) == 0) {
+        codecType = CODEC_TYPE_MPEG4;
+    } else if (SEC_OSAL_Strcmp(SEC_OMX_COMPONENT_H263_ENC, componentName) == 0) {
+        codecType = CODEC_TYPE_H263;
+    } else {
+        ret = OMX_ErrorBadParameter;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret);
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_VideoEncodeComponentInit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_OMX_VideoDecodeComponentInit error, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    pSECComponent->codecType = HW_VIDEO_ENC_CODEC;
+
+    pSECComponent->componentName = (OMX_STRING)SEC_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
+    if (pSECComponent->componentName == NULL) {
+        SEC_OMX_VideoEncodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pSECComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
+
+    pMpeg4Enc = SEC_OSAL_Malloc(sizeof(SEC_MPEG4ENC_HANDLE));
+    if (pMpeg4Enc == NULL) {
+        SEC_OMX_VideoEncodeComponentDeinit(pOMXComponent);
+        ret = OMX_ErrorInsufficientResources;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_MPEG4ENC_HANDLE alloc error, ret: %X", __FUNCTION__, ret);
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(pMpeg4Enc, 0, sizeof(SEC_MPEG4ENC_HANDLE));
+    pVideoEnc = (SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle;
+    pVideoEnc->hCodecHandle = (OMX_HANDLETYPE)pMpeg4Enc;
+    pMpeg4Enc->hMFCMpeg4Handle.codecType = codecType;
+
+    if (codecType == CODEC_TYPE_MPEG4)
+        SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_MPEG4_ENC);
+    else
+        SEC_OSAL_Strcpy(pSECComponent->componentName, SEC_OMX_COMPONENT_H263_ENC);
+
+    /* Set componentVersion */
+    pSECComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->componentVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->componentVersion.s.nStep         = STEP_NUMBER;
+    /* Set specVersion */
+    pSECComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
+    pSECComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
+    pSECComponent->specVersion.s.nRevision     = REVISION_NUMBER;
+    pSECComponent->specVersion.s.nStep         = STEP_NUMBER;
+
+    /* Android CapabilityFlags */
+    pSECComponent->capabilityFlags.iIsOMXComponentMultiThreaded                   = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalInputBufferAlloc  = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsExternalOutputBufferAlloc = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsMovableInputBuffers       = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentSupportsPartialFrames             = OMX_FALSE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesNALStartCodes                 = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentCanHandleIncompleteFrames         = OMX_TRUE;
+    pSECComponent->capabilityFlags.iOMXComponentUsesFullAVCFrames                 = OMX_TRUE;
+
+    /* Input port */
+    pSECPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nBitrate = 64000;
+    pSECPort->portDefinition.format.video.xFramerate= (15 << 16);
+    pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+    SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "raw/video");
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_INPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    /* Output port */
+    pSECPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+    pSECPort->portDefinition.format.video.nFrameWidth = DEFAULT_FRAME_WIDTH;
+    pSECPort->portDefinition.format.video.nFrameHeight= DEFAULT_FRAME_HEIGHT;
+    pSECPort->portDefinition.format.video.nBitrate = 64000;
+    pSECPort->portDefinition.format.video.xFramerate= (15 << 16);
+    if (codecType == CODEC_TYPE_MPEG4) {
+        pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
+        SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+        SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "video/mpeg4");
+    } else {
+        pSECPort->portDefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingH263;
+        SEC_OSAL_Memset(pSECPort->portDefinition.format.video.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
+        SEC_OSAL_Strcpy(pSECPort->portDefinition.format.video.cMIMEType, "video/h263");
+    }
+    pSECPort->portDefinition.format.video.pNativeRender = 0;
+    pSECPort->portDefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
+    pSECPort->portDefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
+    pSECPort->portDefinition.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE;
+    pSECPort->portDefinition.bEnabled = OMX_TRUE;
+
+    if (codecType == CODEC_TYPE_MPEG4) {
+        for(i = 0; i < ALL_PORT_NUM; i++) {
+            INIT_SET_SIZE_VERSION(&pMpeg4Enc->mpeg4Component[i], OMX_VIDEO_PARAM_MPEG4TYPE);
+            pMpeg4Enc->mpeg4Component[i].nPortIndex = i;
+            pMpeg4Enc->mpeg4Component[i].eProfile   = OMX_VIDEO_MPEG4ProfileSimple;
+            pMpeg4Enc->mpeg4Component[i].eLevel     = OMX_VIDEO_MPEG4Level4;
+
+            pMpeg4Enc->mpeg4Component[i].nPFrames = 10;
+            pMpeg4Enc->mpeg4Component[i].nBFrames = 0;          /* No support for B frames */
+            pMpeg4Enc->mpeg4Component[i].nMaxPacketSize = 256;  /* Default value */
+            pMpeg4Enc->mpeg4Component[i].nAllowedPictureTypes =  OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP;
+            pMpeg4Enc->mpeg4Component[i].bGov = OMX_FALSE;
+
+        }
+    } else {
+        for(i = 0; i < ALL_PORT_NUM; i++) {
+            INIT_SET_SIZE_VERSION(&pMpeg4Enc->h263Component[i], OMX_VIDEO_PARAM_H263TYPE);
+            pMpeg4Enc->h263Component[i].nPortIndex = i;
+            pMpeg4Enc->h263Component[i].eProfile   = OMX_VIDEO_H263ProfileBaseline;
+            pMpeg4Enc->h263Component[i].eLevel     = OMX_VIDEO_H263Level45;
+
+            pMpeg4Enc->h263Component[i].nPFrames = 20;
+            pMpeg4Enc->h263Component[i].nBFrames = 0;          /* No support for B frames */
+            pMpeg4Enc->h263Component[i].bPLUSPTYPEAllowed = OMX_FALSE;
+            pMpeg4Enc->h263Component[i].nAllowedPictureTypes = OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP;
+            pMpeg4Enc->h263Component[i].bForceRoundingTypeToZero = OMX_TRUE;
+            pMpeg4Enc->h263Component[i].nPictureHeaderRepetition = 0;
+            pMpeg4Enc->h263Component[i].nGOBHeaderInterval = 0;
+        }
+    }
+
+    pOMXComponent->GetParameter      = &SEC_MFC_Mpeg4Enc_GetParameter;
+    pOMXComponent->SetParameter      = &SEC_MFC_Mpeg4Enc_SetParameter;
+    pOMXComponent->GetConfig         = &SEC_MFC_Mpeg4Enc_GetConfig;
+    pOMXComponent->SetConfig         = &SEC_MFC_Mpeg4Enc_SetConfig;
+    pOMXComponent->GetExtensionIndex = &SEC_MFC_Mpeg4Enc_GetExtensionIndex;
+    pOMXComponent->ComponentRoleEnum = &SEC_MFC_Mpeg4Enc_ComponentRoleEnum;
+    pOMXComponent->ComponentDeInit   = &SEC_OMX_ComponentDeinit;
+
+    pSECComponent->sec_mfc_componentInit      = &SEC_MFC_Mpeg4Enc_Init;
+    pSECComponent->sec_mfc_componentTerminate = &SEC_MFC_Mpeg4Enc_Terminate;
+    pSECComponent->sec_mfc_bufferProcess      = &SEC_MFC_Mpeg4Enc_bufferProcess;
+    pSECComponent->sec_checkInputFrame        = NULL;
+
+    pSECComponent->currentState = OMX_StateLoaded;
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE            ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE       *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT   *pSECComponent = NULL;
+    SEC_MPEG4ENC_HANDLE     *pMpeg4Enc = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+
+    SEC_OSAL_Free(pSECComponent->componentName);
+    pSECComponent->componentName = NULL;
+
+    pMpeg4Enc = (SEC_MPEG4ENC_HANDLE *)((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle;
+    if (pMpeg4Enc != NULL) {
+        SEC_OSAL_Free(pMpeg4Enc);
+        pMpeg4Enc = ((SEC_OMX_VIDEOENC_COMPONENT *)pSECComponent->hComponentHandle)->hCodecHandle = NULL;
+    }
+
+    ret = SEC_OMX_VideoEncodeComponentDeinit(pOMXComponent);
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.h b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.h
new file mode 100644
index 0000000..aa32c42
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/SEC_OMX_Mpeg4enc.h
@@ -0,0 +1,77 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OMX_Mpeg4enc.h
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_MPEG4_ENC_COMPONENT
+#define SEC_OMX_MPEG4_ENC_COMPONENT
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "SsbSipMfcApi.h"
+
+
+typedef enum _CODEC_TYPE
+{
+    CODEC_TYPE_H263,
+    CODEC_TYPE_MPEG4
+} CODEC_TYPE;
+
+typedef struct _SEC_MFC_MPEG4ENC_HANDLE
+{
+    OMX_HANDLETYPE             hMFCHandle;
+    SSBSIP_MFC_ENC_MPEG4_PARAM mpeg4MFCParam;
+    SSBSIP_MFC_ENC_H263_PARAM  h263MFCParam;
+    SSBSIP_MFC_ENC_INPUT_INFO  inputInfo;
+    OMX_U32                    indexTimestamp;
+    OMX_BOOL                   bConfiguredMFC;
+    CODEC_TYPE                 codecType;
+    OMX_S32                    returnCodec;
+} SEC_MFC_MPEG4ENC_HANDLE;
+
+typedef struct _SEC_MPEG4ENC_HANDLE
+{
+    /* OMX Codec specific */
+    OMX_VIDEO_PARAM_H263TYPE  h263Component[ALL_PORT_NUM];
+    OMX_VIDEO_PARAM_MPEG4TYPE mpeg4Component[ALL_PORT_NUM];
+    OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
+
+    /* SEC MFC Codec specific */
+    SEC_MFC_MPEG4ENC_HANDLE   hMFCMpeg4Handle;
+} SEC_MPEG4ENC_HANDLE;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+OSCL_EXPORT_REF OMX_ERRORTYPE SEC_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
+                OMX_ERRORTYPE SEC_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/library_register.c b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/library_register.c
new file mode 100644
index 0000000..d43b2d7
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/library_register.c
@@ -0,0 +1,64 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.c
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+#include "library_register.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_MPEG4_ENC"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent)
+{
+	FunctionIn();
+
+	if (ppSECComponent == NULL)
+		goto EXIT;
+
+	/* component 1 - video encoder MPEG4 */
+	SEC_OSAL_Strcpy(ppSECComponent[0]->componentName, SEC_OMX_COMPONENT_MPEG4_ENC);
+	SEC_OSAL_Strcpy(ppSECComponent[0]->roles[0], SEC_OMX_COMPONENT_MPEG4_ENC_ROLE);
+	ppSECComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+	/* component 2 - video encoder H.263 */
+	SEC_OSAL_Strcpy(ppSECComponent[1]->componentName, SEC_OMX_COMPONENT_H263_ENC);
+	SEC_OSAL_Strcpy(ppSECComponent[1]->roles[0], SEC_OMX_COMPONENT_H263_ENC_ROLE);
+	ppSECComponent[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
+
+EXIT:
+	FunctionOut();
+	return MAX_COMPONENT_NUM;
+}
+
diff --git a/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/library_register.h b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/library_register.h
new file mode 100644
index 0000000..42a168b
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/component/video/enc/mpeg4/library_register.h
@@ -0,0 +1,59 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        library_register.h
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_MPEG4_ENC_REG
+#define SEC_OMX_MPEG4_ENC_REG
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Component.h"
+#include "SEC_OMX_Component_Register.h"
+
+
+#define OSCL_EXPORT_REF __attribute__((visibility("default")))
+#define MAX_COMPONENT_NUM       2
+#define MAX_COMPONENT_ROLE_NUM  1
+
+/* MPEG4 */
+#define SEC_OMX_COMPONENT_MPEG4_ENC         "OMX.SEC.MPEG4.Encoder"
+#define SEC_OMX_COMPONENT_MPEG4_ENC_ROLE    "video_encoder.mpeg4"
+
+/* H.263 */
+#define SEC_OMX_COMPONENT_H263_ENC          "OMX.SEC.H263.Encoder"
+#define SEC_OMX_COMPONENT_H263_ENC_ROLE     "video_encoder.h263"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OSCL_EXPORT_REF int SEC_OMX_COMPONENT_Library_Register(SECRegisterComponentType **ppSECComponent);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
+
diff --git a/exynos4/multimedia/openmax/sec_omx/core/Android.mk b/exynos4/multimedia/openmax/sec_omx/core/Android.mk
new file mode 100644
index 0000000..8922e4b
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/core/Android.mk
@@ -0,0 +1,26 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := SEC_OMX_Component_Register.c \
+	SEC_OMX_Core.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libSEC_OMX_Core
+
+LOCAL_CFLAGS :=
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_STATIC_LIBRARIES := libsecosal libsecbasecomponent
+LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils \
+	libSEC_OMX_Resourcemanager
+
+LOCAL_C_INCLUDES := $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_TOP)/component/common
+
+include $(BUILD_SHARED_LIBRARY)
+
diff --git a/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Component_Register.c b/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Component_Register.c
new file mode 100644
index 0000000..27a8805
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Component_Register.c
@@ -0,0 +1,264 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Component_Register.c
+ * @brief      SEC OpenMAX IL Component Register
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <errno.h>
+#include <assert.h>
+#include <dirent.h>
+
+#include "OMX_Component.h"
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Library.h"
+#include "SEC_OMX_Component_Register.h"
+#include "SEC_OMX_Macros.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_COMP_REGS"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+OMX_ERRORTYPE SEC_OMX_Component_Register(SEC_OMX_COMPONENT_REGLIST **compList, OMX_U32 *compNum)
+{
+    OMX_ERRORTYPE  ret = OMX_ErrorNone;
+    int            componentNum = 0, roleNum = 0, totalCompNum = 0;
+    int            read;
+    char          *libName;
+    size_t         len;
+    const char    *errorMsg;
+    DIR           *dir;
+    struct dirent *d;
+
+    int (*SEC_OMX_COMPONENT_Library_Register)(SECRegisterComponentType **secComponents);
+    SECRegisterComponentType **secComponentsTemp;
+    SEC_OMX_COMPONENT_REGLIST *componentList;
+
+    FunctionIn();
+
+    dir = opendir(SEC_OMX_INSTALL_PATH);
+    if (dir == NULL) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    componentList = (SEC_OMX_COMPONENT_REGLIST *)SEC_OSAL_Malloc(sizeof(SEC_OMX_COMPONENT_REGLIST) * MAX_OMX_COMPONENT_NUM);
+    SEC_OSAL_Memset(componentList, 0, sizeof(SEC_OMX_COMPONENT_REGLIST) * MAX_OMX_COMPONENT_NUM);
+    libName = SEC_OSAL_Malloc(MAX_OMX_COMPONENT_LIBNAME_SIZE);
+
+    while ((d = readdir(dir)) != NULL) {
+        OMX_HANDLETYPE soHandle;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s", d->d_name);
+
+        if (SEC_OSAL_Strncmp(d->d_name, "libOMX.SEC.", SEC_OSAL_Strlen("libOMX.SEC.")) == 0) {
+            SEC_OSAL_Memset(libName, 0, MAX_OMX_COMPONENT_LIBNAME_SIZE);
+            SEC_OSAL_Strcpy(libName, SEC_OMX_INSTALL_PATH);
+            SEC_OSAL_Strcat(libName, d->d_name);
+            SEC_OSAL_Log(SEC_LOG_ERROR, "Path & libName : %s", libName);
+            if ((soHandle = SEC_OSAL_dlopen(libName, RTLD_NOW)) != NULL) {
+                SEC_OSAL_dlerror();    /* clear error*/
+                if ((SEC_OMX_COMPONENT_Library_Register = SEC_OSAL_dlsym(soHandle, "SEC_OMX_COMPONENT_Library_Register")) != NULL) {
+                    int i = 0;
+                    unsigned int j = 0;
+
+                    componentNum = (*SEC_OMX_COMPONENT_Library_Register)(NULL);
+                    secComponentsTemp = (SECRegisterComponentType **)SEC_OSAL_Malloc(sizeof(SECRegisterComponentType*) * componentNum);
+                    for (i = 0; i < componentNum; i++) {
+                        secComponentsTemp[i] = SEC_OSAL_Malloc(sizeof(SECRegisterComponentType));
+                        SEC_OSAL_Memset(secComponentsTemp[i], 0, sizeof(SECRegisterComponentType));
+                    }
+                    (*SEC_OMX_COMPONENT_Library_Register)(secComponentsTemp);
+
+                    for (i = 0; i < componentNum; i++) {
+                        SEC_OSAL_Strcpy(componentList[totalCompNum].component.componentName, secComponentsTemp[i]->componentName);
+                        for (j = 0; j < secComponentsTemp[i]->totalRoleNum; j++)
+                            SEC_OSAL_Strcpy(componentList[totalCompNum].component.roles[j], secComponentsTemp[i]->roles[j]);
+                        componentList[totalCompNum].component.totalRoleNum = secComponentsTemp[i]->totalRoleNum;
+
+                        SEC_OSAL_Strcpy(componentList[totalCompNum].libName, libName);
+
+                        totalCompNum++;
+                    }
+                    for (i = 0; i < componentNum; i++) {
+                        SEC_OSAL_Free(secComponentsTemp[i]);
+                    }
+
+                    SEC_OSAL_Free(secComponentsTemp);
+                } else {
+                    if ((errorMsg = SEC_OSAL_dlerror()) != NULL)
+                        SEC_OSAL_Log(SEC_LOG_WARNING, "dlsym failed: %s", errorMsg);
+                }
+                SEC_OSAL_dlclose(soHandle);
+            } else {
+                SEC_OSAL_Log(SEC_LOG_WARNING, "dlopen failed: %s", SEC_OSAL_dlerror());
+            }
+        } else {
+            /* not a component name line. skip */
+            continue;
+        }
+    }
+
+    SEC_OSAL_Free(libName);
+
+    closedir(dir);
+
+    *compList = componentList;
+    *compNum = totalCompNum;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_Component_Unregister(SEC_OMX_COMPONENT_REGLIST *componentList)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    SEC_OSAL_Memset(componentList, 0, sizeof(SEC_OMX_COMPONENT_REGLIST) * MAX_OMX_COMPONENT_NUM);
+    SEC_OSAL_Free(componentList);
+
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentAPICheck(OMX_COMPONENTTYPE *component)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    if ((NULL == component->GetComponentVersion)    ||
+        (NULL == component->SendCommand)            ||
+        (NULL == component->GetParameter)           ||
+        (NULL == component->SetParameter)           ||
+        (NULL == component->GetConfig)              ||
+        (NULL == component->SetConfig)              ||
+        (NULL == component->GetExtensionIndex)      ||
+        (NULL == component->GetState)               ||
+        (NULL == component->ComponentTunnelRequest) ||
+        (NULL == component->UseBuffer)              ||
+        (NULL == component->AllocateBuffer)         ||
+        (NULL == component->FreeBuffer)             ||
+        (NULL == component->EmptyThisBuffer)        ||
+        (NULL == component->FillThisBuffer)         ||
+        (NULL == component->SetCallbacks)           ||
+        (NULL == component->ComponentDeInit)        ||
+        (NULL == component->UseEGLImage)            ||
+        (NULL == component->ComponentRoleEnum))
+        ret = OMX_ErrorInvalidComponent;
+    else
+        ret = OMX_ErrorNone;
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentLoad(SEC_OMX_COMPONENT *sec_component)
+{
+    OMX_ERRORTYPE      ret = OMX_ErrorNone;
+    OMX_HANDLETYPE     libHandle;
+    OMX_COMPONENTTYPE *pOMXComponent;
+
+    FunctionIn();
+
+    OMX_ERRORTYPE (*SEC_OMX_ComponentInit)(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
+
+    libHandle = SEC_OSAL_dlopen((OMX_STRING)sec_component->libName, RTLD_NOW);
+    if (!libHandle) {
+        ret = OMX_ErrorInvalidComponentName;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInvalidComponentName, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    SEC_OMX_ComponentInit = SEC_OSAL_dlsym(libHandle, "SEC_OMX_ComponentInit");
+    if (!SEC_OMX_ComponentInit) {
+        SEC_OSAL_dlclose(libHandle);
+        ret = OMX_ErrorInvalidComponent;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInvalidComponent, Line:%d", __LINE__);
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)SEC_OSAL_Malloc(sizeof(OMX_COMPONENTTYPE));
+    INIT_SET_SIZE_VERSION(pOMXComponent, OMX_COMPONENTTYPE);
+    ret = (*SEC_OMX_ComponentInit)((OMX_HANDLETYPE)pOMXComponent, (OMX_STRING)sec_component->componentName);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Free(pOMXComponent);
+        SEC_OSAL_dlclose(libHandle);
+        ret = OMX_ErrorInvalidComponent;
+        SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInvalidComponent, Line:%d", __LINE__);
+        goto EXIT;
+    } else {
+        if (SEC_OMX_ComponentAPICheck(pOMXComponent) != OMX_ErrorNone) {
+            if (NULL != pOMXComponent->ComponentDeInit)
+                pOMXComponent->ComponentDeInit(pOMXComponent);
+            SEC_OSAL_Free(pOMXComponent);
+            SEC_OSAL_dlclose(libHandle);
+            ret = OMX_ErrorInvalidComponent;
+            SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_ErrorInvalidComponent, Line:%d", __LINE__);
+            goto EXIT;
+        }
+        sec_component->libHandle = libHandle;
+        sec_component->pOMXComponent = pOMXComponent;
+        ret = OMX_ErrorNone;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OMX_ComponentUnload(SEC_OMX_COMPONENT *sec_component)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE *pOMXComponent = NULL;
+
+    FunctionIn();
+
+    if (!sec_component) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pOMXComponent = sec_component->pOMXComponent;
+    if (pOMXComponent != NULL) {
+        pOMXComponent->ComponentDeInit(pOMXComponent);
+        SEC_OSAL_Free(pOMXComponent);
+        sec_component->pOMXComponent = NULL;
+    }
+
+    if (sec_component->libHandle != NULL) {
+        SEC_OSAL_dlclose(sec_component->libHandle);
+        sec_component->libHandle = NULL;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
diff --git a/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Component_Register.h b/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Component_Register.h
new file mode 100644
index 0000000..75b8ac5
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Component_Register.h
@@ -0,0 +1,75 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Component_Register.h
+ * @brief      SEC OpenMAX IL Component Register
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_COMPONENT_REG
+#define SEC_OMX_COMPONENT_REG
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+#include "OMX_Component.h"
+
+
+typedef struct _SECRegisterComponentType
+{
+    OMX_U8  componentName[MAX_OMX_COMPONENT_NAME_SIZE];
+    OMX_U8  roles[MAX_OMX_COMPONENT_ROLE_NUM][MAX_OMX_COMPONENT_ROLE_SIZE];
+    OMX_U32 totalRoleNum;
+} SECRegisterComponentType;
+
+typedef struct _SEC_OMX_COMPONENT_REGLIST
+{
+    SECRegisterComponentType component;
+    OMX_U8  libName[MAX_OMX_COMPONENT_LIBNAME_SIZE];
+} SEC_OMX_COMPONENT_REGLIST;
+
+struct SEC_OMX_COMPONENT;
+typedef struct _SEC_OMX_COMPONENT
+{
+    OMX_U8                    componentName[MAX_OMX_COMPONENT_NAME_SIZE];
+    OMX_U8                    libName[MAX_OMX_COMPONENT_LIBNAME_SIZE];
+    OMX_HANDLETYPE            libHandle;
+    OMX_COMPONENTTYPE        *pOMXComponent;
+    struct _SEC_OMX_COMPONENT *nextOMXComp;
+} SEC_OMX_COMPONENT;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+OMX_ERRORTYPE SEC_OMX_Component_Register(SEC_OMX_COMPONENT_REGLIST **compList, OMX_U32 *compNum);
+OMX_ERRORTYPE SEC_OMX_Component_Unregister(SEC_OMX_COMPONENT_REGLIST *componentList);
+OMX_ERRORTYPE SEC_OMX_ComponentLoad(SEC_OMX_COMPONENT *sec_component);
+OMX_ERRORTYPE SEC_OMX_ComponentUnload(SEC_OMX_COMPONENT *sec_component);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Core.c b/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Core.c
new file mode 100644
index 0000000..fa7477b
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Core.c
@@ -0,0 +1,364 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Core.c
+ * @brief      SEC OpenMAX IL Core
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ *             HyeYeon Chung (hyeon.chung@samsung.com)
+ *             Yunji Kim (yunji.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OMX_Core.h"
+#include "SEC_OMX_Component_Register.h"
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Mutex.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OMX_Resourcemanager.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_OMX_CORE"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+static int gInitialized = 0;
+static OMX_U32 gComponentNum = 0;
+
+static SEC_OMX_COMPONENT_REGLIST *gComponentList = NULL;
+static SEC_OMX_COMPONENT *gLoadComponentList = NULL;
+static OMX_HANDLETYPE ghLoadComponentListMutex = NULL;
+
+
+OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_Init(void)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    FunctionIn();
+
+    if (gInitialized == 0) {
+        if (SEC_OMX_Component_Register(&gComponentList, &gComponentNum)) {
+            ret = OMX_ErrorInsufficientResources;
+            SEC_OSAL_Log(SEC_LOG_ERROR, "SEC_OMX_Init : %s", "OMX_ErrorInsufficientResources");
+            goto EXIT;
+        }
+
+        ret = SEC_OMX_ResourceManager_Init();
+        if (OMX_ErrorNone != ret) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "SEC_OMX_Init : SEC_OMX_ResourceManager_Init failed");
+            goto EXIT;
+        }
+
+        ret = SEC_OSAL_MutexCreate(&ghLoadComponentListMutex);
+        if (OMX_ErrorNone != ret) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "SEC_OMX_Init : SEC_OSAL_MutexCreate(&ghLoadComponentListMutex) failed");
+            goto EXIT;
+        }
+
+        gInitialized = 1;
+        SEC_OSAL_Log(SEC_LOG_TRACE, "SEC_OMX_Init : %s", "OMX_ErrorNone");
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_Deinit(void)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    FunctionIn();
+
+    SEC_OSAL_MutexTerminate(ghLoadComponentListMutex);
+    ghLoadComponentListMutex = NULL;
+
+    SEC_OMX_ResourceManager_Deinit();
+
+    if (OMX_ErrorNone != SEC_OMX_Component_Unregister(gComponentList)) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+    gComponentList = NULL;
+    gComponentNum = 0;
+    gInitialized = 0;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_ComponentNameEnum(
+    OMX_OUT OMX_STRING cComponentName,
+    OMX_IN  OMX_U32 nNameLength,
+    OMX_IN  OMX_U32 nIndex)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    FunctionIn();
+
+    if (nIndex >= gComponentNum) {
+        ret = OMX_ErrorNoMore;
+        goto EXIT;
+    }
+
+    snprintf(cComponentName, nNameLength, "%s", gComponentList[nIndex].component.componentName);
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_GetHandle(
+    OMX_OUT OMX_HANDLETYPE *pHandle,
+    OMX_IN  OMX_STRING cComponentName,
+    OMX_IN  OMX_PTR pAppData,
+    OMX_IN  OMX_CALLBACKTYPE *pCallBacks)
+{
+    OMX_ERRORTYPE      ret = OMX_ErrorNone;
+    SEC_OMX_COMPONENT *loadComponent;
+    SEC_OMX_COMPONENT *currentComponent;
+    unsigned int i = 0;
+
+    FunctionIn();
+
+    if (gInitialized != 1) {
+        ret = OMX_ErrorNotReady;
+        goto EXIT;
+    }
+
+    if ((pHandle == NULL) || (cComponentName == NULL) || (pCallBacks == NULL)) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    SEC_OSAL_Log(SEC_LOG_TRACE, "ComponentName : %s", cComponentName);
+
+    for (i = 0; i < gComponentNum; i++) {
+        if (SEC_OSAL_Strcmp(cComponentName, gComponentList[i].component.componentName) == 0) {
+            loadComponent = SEC_OSAL_Malloc(sizeof(SEC_OMX_COMPONENT));
+            SEC_OSAL_Memset(loadComponent, 0, sizeof(SEC_OMX_COMPONENT));
+
+            SEC_OSAL_Strcpy(loadComponent->libName, gComponentList[i].libName);
+            SEC_OSAL_Strcpy(loadComponent->componentName, gComponentList[i].component.componentName);
+            ret = SEC_OMX_ComponentLoad(loadComponent);
+            if (ret != OMX_ErrorNone) {
+                SEC_OSAL_Free(loadComponent);
+                SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+                goto EXIT;
+            }
+
+            ret = loadComponent->pOMXComponent->SetCallbacks(loadComponent->pOMXComponent, pCallBacks, pAppData);
+            if (ret != OMX_ErrorNone) {
+                SEC_OMX_ComponentUnload(loadComponent);
+                SEC_OSAL_Free(loadComponent);
+                SEC_OSAL_Log(SEC_LOG_ERROR, "OMX_Error, Line:%d", __LINE__);
+                goto EXIT;
+            }
+
+            SEC_OSAL_MutexLock(ghLoadComponentListMutex);
+            if (gLoadComponentList == NULL) {
+                gLoadComponentList = loadComponent;
+            } else {
+                currentComponent = gLoadComponentList;
+                while (currentComponent->nextOMXComp != NULL) {
+                    currentComponent = currentComponent->nextOMXComp;
+                }
+                currentComponent->nextOMXComp = loadComponent;
+            }
+            SEC_OSAL_MutexUnlock(ghLoadComponentListMutex);
+
+            *pHandle = loadComponent->pOMXComponent;
+            ret = OMX_ErrorNone;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "SEC_OMX_GetHandle : %s", "OMX_ErrorNone");
+            goto EXIT;
+        }
+    }
+
+    ret = OMX_ErrorComponentNotFound;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_FreeHandle(OMX_IN OMX_HANDLETYPE hComponent)
+{
+    OMX_ERRORTYPE      ret = OMX_ErrorNone;
+    SEC_OMX_COMPONENT *currentComponent;
+    SEC_OMX_COMPONENT *deleteComponent;
+
+    FunctionIn();
+
+    if (gInitialized != 1) {
+        ret = OMX_ErrorNotReady;
+        goto EXIT;
+    }
+
+    if (!hComponent) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    SEC_OSAL_MutexLock(ghLoadComponentListMutex);
+    currentComponent = gLoadComponentList;
+    if (gLoadComponentList->pOMXComponent == hComponent) {
+        deleteComponent = gLoadComponentList;
+        gLoadComponentList = gLoadComponentList->nextOMXComp;
+    } else {
+        while ((currentComponent != NULL) && (((SEC_OMX_COMPONENT *)(currentComponent->nextOMXComp))->pOMXComponent != hComponent))
+            currentComponent = currentComponent->nextOMXComp;
+
+        if (((SEC_OMX_COMPONENT *)(currentComponent->nextOMXComp))->pOMXComponent == hComponent) {
+            deleteComponent = currentComponent->nextOMXComp;
+            currentComponent->nextOMXComp = deleteComponent->nextOMXComp;
+        } else if (currentComponent == NULL) {
+            ret = OMX_ErrorComponentNotFound;
+            SEC_OSAL_MutexUnlock(ghLoadComponentListMutex);
+            goto EXIT;
+        }
+    }
+    SEC_OSAL_MutexUnlock(ghLoadComponentListMutex);
+
+    SEC_OMX_ComponentUnload(deleteComponent);
+    SEC_OSAL_Free(deleteComponent);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_SetupTunnel(
+    OMX_IN OMX_HANDLETYPE hOutput,
+    OMX_IN OMX_U32 nPortOutput,
+    OMX_IN OMX_HANDLETYPE hInput,
+    OMX_IN OMX_U32 nPortInput)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNotImplemented;
+
+EXIT:
+    return ret;
+}
+
+OMX_API OMX_ERRORTYPE SEC_OMX_GetContentPipe(
+    OMX_OUT OMX_HANDLETYPE *hPipe,
+    OMX_IN  OMX_STRING szURI)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNotImplemented;
+
+EXIT:
+    return ret;
+}
+
+OMX_API OMX_ERRORTYPE SEC_OMX_GetComponentsOfRole (
+    OMX_IN    OMX_STRING role,
+    OMX_INOUT OMX_U32 *pNumComps,
+    OMX_INOUT OMX_U8  **compNames)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    int           max_role_num = 0;
+    OMX_STRING    RoleString[MAX_OMX_COMPONENT_ROLE_SIZE];
+    int i = 0, j = 0;
+
+    FunctionIn();
+
+    if (gInitialized != 1) {
+        ret = OMX_ErrorNotReady;
+        goto EXIT;
+    }
+
+    *pNumComps = 0;
+
+    for (i = 0; i < MAX_OMX_COMPONENT_NUM; i++) {
+        max_role_num = gComponentList[i].component.totalRoleNum;
+
+        for (j = 0; j < max_role_num; j++) {
+            if (SEC_OSAL_Strcmp(gComponentList[i].component.roles[j], role) == 0) {
+                if (compNames != NULL) {
+                    SEC_OSAL_Strcpy((OMX_STRING)compNames[*pNumComps], gComponentList[i].component.componentName);
+                }
+                *pNumComps = (*pNumComps + 1);
+            }
+        }
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_API OMX_ERRORTYPE SEC_OMX_GetRolesOfComponent (
+    OMX_IN    OMX_STRING compName,
+    OMX_INOUT OMX_U32 *pNumRoles,
+    OMX_OUT   OMX_U8 **roles)
+{
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    OMX_BOOL      detectComp = OMX_FALSE;
+    int           compNum = 0, totalRoleNum = 0;
+    int i = 0;
+
+    FunctionIn();
+
+    if (gInitialized != 1) {
+        ret = OMX_ErrorNotReady;
+        goto EXIT;
+    }
+
+    for (i = 0; i < MAX_OMX_COMPONENT_NUM; i++) {
+        if (gComponentList != NULL) {
+            if (SEC_OSAL_Strcmp(gComponentList[i].component.componentName, compName) == 0) {
+                *pNumRoles = totalRoleNum = gComponentList[i].component.totalRoleNum;
+                compNum = i;
+                detectComp = OMX_TRUE;
+                break;
+            }
+        } else {
+            ret = OMX_ErrorUndefined;
+            goto EXIT;
+        }
+    }
+
+    if (detectComp == OMX_FALSE) {
+        *pNumRoles = 0;
+        ret = OMX_ErrorComponentNotFound;
+        goto EXIT;
+    }
+
+    if (roles != NULL) {
+        for (i = 0; i < totalRoleNum; i++) {
+            SEC_OSAL_Strcpy(roles[i], gComponentList[compNum].component.roles[i]);
+        }
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Core.h b/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Core.h
new file mode 100644
index 0000000..c60cd52
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/core/SEC_OMX_Core.h
@@ -0,0 +1,78 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OMX_Core.h
+ * @brief      SEC OpenMAX IL Core
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ *             HyeYeon Chung (hyeon.chung@samsung.com)
+ *             Yunji Kim (yunji.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_CORE
+#define SEC_OMX_CORE
+
+#include "SEC_OMX_Def.h"
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+SEC_EXPORT_REF OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_Init(void);
+SEC_EXPORT_REF OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_Deinit(void);
+SEC_EXPORT_REF OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_ComponentNameEnum(
+    OMX_OUT   OMX_STRING        cComponentName,
+    OMX_IN    OMX_U32           nNameLength,
+    OMX_IN    OMX_U32           nIndex);
+SEC_EXPORT_REF OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_GetHandle(
+    OMX_OUT   OMX_HANDLETYPE   *pHandle,
+    OMX_IN    OMX_STRING        cComponentName,
+    OMX_IN    OMX_PTR           pAppData,
+    OMX_IN    OMX_CALLBACKTYPE *pCallBacks);
+SEC_EXPORT_REF OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_FreeHandle(
+    OMX_IN    OMX_HANDLETYPE    hComponent);
+SEC_EXPORT_REF OMX_API OMX_ERRORTYPE OMX_APIENTRY SEC_OMX_SetupTunnel(
+    OMX_IN    OMX_HANDLETYPE    hOutput,
+    OMX_IN    OMX_U32           nPortOutput,
+    OMX_IN    OMX_HANDLETYPE    hInput,
+    OMX_IN    OMX_U32           nPortInput);
+SEC_EXPORT_REF OMX_API OMX_ERRORTYPE              SEC_OMX_GetContentPipe(
+    OMX_OUT   OMX_HANDLETYPE   *hPipe,
+    OMX_IN    OMX_STRING        szURI);
+SEC_EXPORT_REF OMX_API OMX_ERRORTYPE              SEC_OMX_GetComponentsOfRole(
+    OMX_IN    OMX_STRING        role,
+    OMX_INOUT OMX_U32          *pNumComps,
+    OMX_INOUT OMX_U8          **compNames);
+SEC_EXPORT_REF OMX_API OMX_ERRORTYPE              SEC_OMX_GetRolesOfComponent(
+    OMX_IN    OMX_STRING        compName,
+    OMX_INOUT OMX_U32          *pNumRoles,
+    OMX_OUT   OMX_U8          **roles);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Audio.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Audio.h
new file mode 100644
index 0000000..04f1a99
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Audio.h
@@ -0,0 +1,1311 @@
+/*
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ *
+ */
+
+/** @file OMX_Audio.h - OpenMax IL version 1.1.2
+ *  The structures needed by Audio components to exchange
+ *  parameters and configuration data with the componenmilts.
+ */
+
+#ifndef OMX_Audio_h
+#define OMX_Audio_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* Each OMX header must include all required header files to allow the
+ *  header to compile without errors.  The includes below are required
+ *  for this header file to compile successfully 
+ */
+
+#include <OMX_Core.h>
+
+/** @defgroup midi MIDI
+ * @ingroup audio
+ */
+ 
+/** @defgroup effects Audio effects
+ * @ingroup audio
+ */
+
+/** @defgroup audio OpenMAX IL Audio Domain
+ * Structures for OpenMAX IL Audio domain
+ * @{
+ */
+
+/** Enumeration used to define the possible audio codings.  
+ *  If "OMX_AUDIO_CodingUnused" is selected, the coding selection must 
+ *  be done in a vendor specific way.  Since this is for an audio 
+ *  processing element this enum is relevant.  However, for another 
+ *  type of component other enums would be in this area.
+ */
+typedef enum OMX_AUDIO_CODINGTYPE {
+    OMX_AUDIO_CodingUnused = 0,  /**< Placeholder value when coding is N/A  */
+    OMX_AUDIO_CodingAutoDetect,  /**< auto detection of audio format */
+    OMX_AUDIO_CodingPCM,         /**< Any variant of PCM coding */
+    OMX_AUDIO_CodingADPCM,       /**< Any variant of ADPCM encoded data */
+    OMX_AUDIO_CodingAMR,         /**< Any variant of AMR encoded data */
+    OMX_AUDIO_CodingGSMFR,       /**< Any variant of GSM fullrate (i.e. GSM610) */
+    OMX_AUDIO_CodingGSMEFR,      /**< Any variant of GSM Enhanced Fullrate encoded data*/
+    OMX_AUDIO_CodingGSMHR,       /**< Any variant of GSM Halfrate encoded data */
+    OMX_AUDIO_CodingPDCFR,       /**< Any variant of PDC Fullrate encoded data */
+    OMX_AUDIO_CodingPDCEFR,      /**< Any variant of PDC Enhanced Fullrate encoded data */
+    OMX_AUDIO_CodingPDCHR,       /**< Any variant of PDC Halfrate encoded data */
+    OMX_AUDIO_CodingTDMAFR,      /**< Any variant of TDMA Fullrate encoded data (TIA/EIA-136-420) */
+    OMX_AUDIO_CodingTDMAEFR,     /**< Any variant of TDMA Enhanced Fullrate encoded data (TIA/EIA-136-410) */
+    OMX_AUDIO_CodingQCELP8,      /**< Any variant of QCELP 8kbps encoded data */
+    OMX_AUDIO_CodingQCELP13,     /**< Any variant of QCELP 13kbps encoded data */
+    OMX_AUDIO_CodingEVRC,        /**< Any variant of EVRC encoded data */
+    OMX_AUDIO_CodingSMV,         /**< Any variant of SMV encoded data */
+    OMX_AUDIO_CodingG711,        /**< Any variant of G.711 encoded data */
+    OMX_AUDIO_CodingG723,        /**< Any variant of G.723 dot 1 encoded data */
+    OMX_AUDIO_CodingG726,        /**< Any variant of G.726 encoded data */
+    OMX_AUDIO_CodingG729,        /**< Any variant of G.729 encoded data */
+    OMX_AUDIO_CodingAAC,         /**< Any variant of AAC encoded data */
+    OMX_AUDIO_CodingMP3,         /**< Any variant of MP3 encoded data */
+    OMX_AUDIO_CodingSBC,         /**< Any variant of SBC encoded data */
+    OMX_AUDIO_CodingVORBIS,      /**< Any variant of VORBIS encoded data */
+    OMX_AUDIO_CodingWMA,         /**< Any variant of WMA encoded data */
+    OMX_AUDIO_CodingRA,          /**< Any variant of RA encoded data */
+    OMX_AUDIO_CodingMIDI,        /**< Any variant of MIDI encoded data */
+    OMX_AUDIO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_CodingMax = 0x7FFFFFFF
+} OMX_AUDIO_CODINGTYPE;
+
+
+/** The PortDefinition structure is used to define all of the parameters 
+ *  necessary for the compliant component to setup an input or an output audio 
+ *  path.  If additional information is needed to define the parameters of the
+ *  port (such as frequency), additional structures must be sent such as the
+ *  OMX_AUDIO_PARAM_PCMMODETYPE structure to supply the extra parameters for the port.
+ */
+typedef struct OMX_AUDIO_PORTDEFINITIONTYPE {
+    OMX_STRING cMIMEType;            /**< MIME type of data for the port */
+    OMX_NATIVE_DEVICETYPE pNativeRender; /** < platform specific reference
+                                               for an output device, 
+                                               otherwise this field is 0 */
+    OMX_BOOL bFlagErrorConcealment;  /**< Turns on error concealment if it is 
+                                          supported by the OMX component */
+    OMX_AUDIO_CODINGTYPE eEncoding;  /**< Type of data expected for this 
+                                          port (e.g. PCM, AMR, MP3, etc) */
+} OMX_AUDIO_PORTDEFINITIONTYPE;
+
+
+/**  Port format parameter.  This structure is used to enumerate
+  *  the various data input/output format supported by the port.
+  */
+typedef struct OMX_AUDIO_PARAM_PORTFORMATTYPE {
+    OMX_U32 nSize;                  /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
+    OMX_U32 nPortIndex;             /**< Indicates which port to set */
+    OMX_U32 nIndex;                 /**< Indicates the enumeration index for the format from 0x0 to N-1 */
+    OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this port (e.g. PCM, AMR, MP3, etc) */
+} OMX_AUDIO_PARAM_PORTFORMATTYPE;
+
+
+/** PCM mode type  */ 
+typedef enum OMX_AUDIO_PCMMODETYPE { 
+    OMX_AUDIO_PCMModeLinear = 0,  /**< Linear PCM encoded data */ 
+    OMX_AUDIO_PCMModeALaw,        /**< A law PCM encoded data (G.711) */ 
+    OMX_AUDIO_PCMModeMULaw,       /**< Mu law PCM encoded data (G.711)  */ 
+    OMX_AUDIO_PCMModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_PCMModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_PCMModeMax = 0x7FFFFFFF 
+} OMX_AUDIO_PCMMODETYPE; 
+
+
+typedef enum OMX_AUDIO_CHANNELTYPE {
+    OMX_AUDIO_ChannelNone = 0x0,    /**< Unused or empty */
+    OMX_AUDIO_ChannelLF   = 0x1,    /**< Left front */
+    OMX_AUDIO_ChannelRF   = 0x2,    /**< Right front */
+    OMX_AUDIO_ChannelCF   = 0x3,    /**< Center front */
+    OMX_AUDIO_ChannelLS   = 0x4,    /**< Left surround */
+    OMX_AUDIO_ChannelRS   = 0x5,    /**< Right surround */
+    OMX_AUDIO_ChannelLFE  = 0x6,    /**< Low frequency effects */
+    OMX_AUDIO_ChannelCS   = 0x7,    /**< Back surround */
+    OMX_AUDIO_ChannelLR   = 0x8,    /**< Left rear. */
+    OMX_AUDIO_ChannelRR   = 0x9,    /**< Right rear. */
+    OMX_AUDIO_ChannelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_ChannelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_ChannelMax  = 0x7FFFFFFF 
+} OMX_AUDIO_CHANNELTYPE;
+
+#define OMX_AUDIO_MAXCHANNELS 16  /**< maximum number distinct audio channels that a buffer may contain */
+#define OMX_MIN_PCMPAYLOAD_MSEC 5 /**< Minimum audio buffer payload size for uncompressed (PCM) audio */
+
+/** PCM format description */ 
+typedef struct OMX_AUDIO_PARAM_PCMMODETYPE { 
+    OMX_U32 nSize;                    /**< Size of this structure, in Bytes */ 
+    OMX_VERSIONTYPE nVersion;         /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;               /**< port that this structure applies to */ 
+    OMX_U32 nChannels;                /**< Number of channels (e.g. 2 for stereo) */ 
+    OMX_NUMERICALDATATYPE eNumData;   /**< indicates PCM data as signed or unsigned */ 
+    OMX_ENDIANTYPE eEndian;           /**< indicates PCM data as little or big endian */ 
+    OMX_BOOL bInterleaved;            /**< True for normal interleaved data; false for 
+                                           non-interleaved data (e.g. block data) */ 
+    OMX_U32 nBitPerSample;            /**< Bit per sample */ 
+    OMX_U32 nSamplingRate;            /**< Sampling rate of the source data.  Use 0 for 
+                                           variable or unknown sampling rate. */ 
+    OMX_AUDIO_PCMMODETYPE ePCMMode;   /**< PCM mode enumeration */ 
+    OMX_AUDIO_CHANNELTYPE eChannelMapping[OMX_AUDIO_MAXCHANNELS]; /**< Slot i contains channel defined by eChannelMap[i] */
+
+} OMX_AUDIO_PARAM_PCMMODETYPE; 
+
+
+/** Audio channel mode.  This is used by both AAC and MP3, although the names are more appropriate
+ * for the MP3.  For example, JointStereo for MP3 is CouplingChannels for AAC. 
+ */
+typedef enum OMX_AUDIO_CHANNELMODETYPE {
+    OMX_AUDIO_ChannelModeStereo = 0,  /**< 2 channels, the bitrate allocation between those 
+                                          two channels changes accordingly to each channel information */
+    OMX_AUDIO_ChannelModeJointStereo, /**< mode that takes advantage of what is common between 
+                                           2 channels for higher compression gain */
+    OMX_AUDIO_ChannelModeDual,        /**< 2 mono-channels, each channel is encoded with half 
+                                           the bitrate of the overall bitrate */
+    OMX_AUDIO_ChannelModeMono,        /**< Mono channel mode */
+    OMX_AUDIO_ChannelModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_ChannelModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_ChannelModeMax = 0x7FFFFFFF
+} OMX_AUDIO_CHANNELMODETYPE;
+
+
+typedef enum OMX_AUDIO_MP3STREAMFORMATTYPE {
+    OMX_AUDIO_MP3StreamFormatMP1Layer3 = 0, /**< MP3 Audio MPEG 1 Layer 3 Stream format */
+    OMX_AUDIO_MP3StreamFormatMP2Layer3,     /**< MP3 Audio MPEG 2 Layer 3 Stream format */
+    OMX_AUDIO_MP3StreamFormatMP2_5Layer3,   /**< MP3 Audio MPEG2.5 Layer 3 Stream format */
+    OMX_AUDIO_MP3StreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_MP3StreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_MP3StreamFormatMax = 0x7FFFFFFF
+} OMX_AUDIO_MP3STREAMFORMATTYPE;
+
+/** MP3 params */
+typedef struct OMX_AUDIO_PARAM_MP3TYPE {
+    OMX_U32 nSize;                 /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;      /**< OMX specification version information */
+    OMX_U32 nPortIndex;            /**< port that this structure applies to */
+    OMX_U32 nChannels;             /**< Number of channels */
+    OMX_U32 nBitRate;              /**< Bit rate of the input data.  Use 0 for variable
+                                        rate or unknown bit rates */
+    OMX_U32 nSampleRate;           /**< Sampling rate of the source data.  Use 0 for
+                                        variable or unknown sampling rate. */
+    OMX_U32 nAudioBandWidth;       /**< Audio band width (in Hz) to which an encoder should
+                                        limit the audio signal. Use 0 to let encoder decide */
+    OMX_AUDIO_CHANNELMODETYPE eChannelMode;   /**< Channel mode enumeration */
+    OMX_AUDIO_MP3STREAMFORMATTYPE eFormat;  /**< MP3 stream format */
+} OMX_AUDIO_PARAM_MP3TYPE;
+
+
+typedef enum OMX_AUDIO_AACSTREAMFORMATTYPE {
+    OMX_AUDIO_AACStreamFormatMP2ADTS = 0, /**< AAC Audio Data Transport Stream 2 format */
+    OMX_AUDIO_AACStreamFormatMP4ADTS,     /**< AAC Audio Data Transport Stream 4 format */
+    OMX_AUDIO_AACStreamFormatMP4LOAS,     /**< AAC Low Overhead Audio Stream format */
+    OMX_AUDIO_AACStreamFormatMP4LATM,     /**< AAC Low overhead Audio Transport Multiplex */
+    OMX_AUDIO_AACStreamFormatADIF,        /**< AAC Audio Data Interchange Format */
+    OMX_AUDIO_AACStreamFormatMP4FF,       /**< AAC inside MPEG-4/ISO File Format */
+    OMX_AUDIO_AACStreamFormatRAW,         /**< AAC Raw Format */
+    OMX_AUDIO_AACStreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_AACStreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_AACStreamFormatMax = 0x7FFFFFFF
+} OMX_AUDIO_AACSTREAMFORMATTYPE;
+
+
+/** AAC mode type.  Note that the term profile is used with the MPEG-2
+ * standard and the term object type and profile is used with MPEG-4 */
+typedef enum OMX_AUDIO_AACPROFILETYPE{
+  OMX_AUDIO_AACObjectNull = 0,      /**< Null, not used */
+  OMX_AUDIO_AACObjectMain = 1,      /**< AAC Main object */
+  OMX_AUDIO_AACObjectLC,            /**< AAC Low Complexity object (AAC profile) */
+  OMX_AUDIO_AACObjectSSR,           /**< AAC Scalable Sample Rate object */
+  OMX_AUDIO_AACObjectLTP,           /**< AAC Long Term Prediction object */
+  OMX_AUDIO_AACObjectHE,            /**< AAC High Efficiency (object type SBR, HE-AAC profile) */
+  OMX_AUDIO_AACObjectScalable,      /**< AAC Scalable object */
+  OMX_AUDIO_AACObjectERLC = 17,     /**< ER AAC Low Complexity object (Error Resilient AAC-LC) */
+  OMX_AUDIO_AACObjectLD = 23,       /**< AAC Low Delay object (Error Resilient) */
+  OMX_AUDIO_AACObjectHE_PS = 29,    /**< AAC High Efficiency with Parametric Stereo coding (HE-AAC v2, object type PS) */
+  OMX_AUDIO_AACObjectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+  OMX_AUDIO_AACObjectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+  OMX_AUDIO_AACObjectMax = 0x7FFFFFFF
+} OMX_AUDIO_AACPROFILETYPE;
+
+
+/** AAC tool usage (for nAACtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
+ * Required for encoder configuration and optional as decoder info output.
+ * For MP3, OMX_AUDIO_CHANNELMODETYPE is sufficient. */
+#define OMX_AUDIO_AACToolNone 0x00000000 /**< no AAC tools allowed (encoder config) or active (decoder info output) */
+#define OMX_AUDIO_AACToolMS   0x00000001 /**< MS: Mid/side joint coding tool allowed or active */
+#define OMX_AUDIO_AACToolIS   0x00000002 /**< IS: Intensity stereo tool allowed or active */
+#define OMX_AUDIO_AACToolTNS  0x00000004 /**< TNS: Temporal Noise Shaping tool allowed or active */
+#define OMX_AUDIO_AACToolPNS  0x00000008 /**< PNS: MPEG-4 Perceptual Noise substitution tool allowed or active */
+#define OMX_AUDIO_AACToolLTP  0x00000010 /**< LTP: MPEG-4 Long Term Prediction tool allowed or active */
+#define OMX_AUDIO_AACToolAll  0x7FFFFFFF /**< all AAC tools allowed or active (*/
+
+/** MPEG-4 AAC error resilience (ER) tool usage (for nAACERtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
+ * Required for ER encoder configuration and optional as decoder info output */
+#define OMX_AUDIO_AACERNone  0x00000000  /**< no AAC ER tools allowed/used */
+#define OMX_AUDIO_AACERVCB11 0x00000001  /**< VCB11: Virtual Code Books for AAC section data */
+#define OMX_AUDIO_AACERRVLC  0x00000002  /**< RVLC: Reversible Variable Length Coding */
+#define OMX_AUDIO_AACERHCR   0x00000004  /**< HCR: Huffman Codeword Reordering */
+#define OMX_AUDIO_AACERAll   0x7FFFFFFF  /**< all AAC ER tools allowed/used */
+
+
+/** AAC params */
+typedef struct OMX_AUDIO_PARAM_AACPROFILETYPE {
+    OMX_U32 nSize;                 /**< Size of this structure, in Bytes */
+    OMX_VERSIONTYPE nVersion;      /**< OMX specification version information */
+    OMX_U32 nPortIndex;            /**< Port that this structure applies to */
+    OMX_U32 nChannels;             /**< Number of channels */
+    OMX_U32 nSampleRate;           /**< Sampling rate of the source data.  Use 0 for
+                                        variable or unknown sampling rate. */
+    OMX_U32 nBitRate;              /**< Bit rate of the input data.  Use 0 for variable
+                                        rate or unknown bit rates */
+    OMX_U32 nAudioBandWidth;       /**< Audio band width (in Hz) to which an encoder should
+                                        limit the audio signal. Use 0 to let encoder decide */
+    OMX_U32 nFrameLength;          /**< Frame length (in audio samples per channel) of the codec.
+                                        Can be 1024 or 960 (AAC-LC), 2048 (HE-AAC), 480 or 512 (AAC-LD).
+                                        Use 0 to let encoder decide */
+    OMX_U32 nAACtools;             /**< AAC tool usage */
+    OMX_U32 nAACERtools;           /**< MPEG-4 AAC error resilience tool usage */
+    OMX_AUDIO_AACPROFILETYPE eAACProfile;   /**< AAC profile enumeration */
+    OMX_AUDIO_AACSTREAMFORMATTYPE eAACStreamFormat; /**< AAC stream format enumeration */
+    OMX_AUDIO_CHANNELMODETYPE eChannelMode;   /**< Channel mode enumeration */
+} OMX_AUDIO_PARAM_AACPROFILETYPE;
+
+
+/** VORBIS params */
+typedef struct OMX_AUDIO_PARAM_VORBISTYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex;       /**< port that this structure applies to */
+    OMX_U32 nChannels;        /**< Number of channels */
+    OMX_U32 nBitRate;         /**< Bit rate of the encoded data data.  Use 0 for variable
+                                   rate or unknown bit rates. Encoding is set to the
+                                   bitrate closest to specified  value (in bps) */
+    OMX_U32 nMinBitRate;      /**< Sets minimum bitrate (in bps). */
+    OMX_U32 nMaxBitRate;      /**< Sets maximum bitrate (in bps). */
+
+    OMX_U32 nSampleRate;      /**< Sampling rate of the source data.  Use 0 for
+                                   variable or unknown sampling rate. */
+    OMX_U32 nAudioBandWidth;  /**< Audio band width (in Hz) to which an encoder should
+                                   limit the audio signal. Use 0 to let encoder decide */
+    OMX_S32 nQuality;		  /**< Sets encoding quality to n, between -1 (low) and 10 (high).
+                                   In the default mode of operation, teh quality level is 3.
+                                   Normal quality range is 0 - 10. */
+    OMX_BOOL bManaged;		  /**< Set  bitrate  management  mode. This turns off the
+                                   normal VBR encoding, but allows hard or soft bitrate
+                                   constraints to be enforced by the encoder. This mode can
+                                   be slower, and may also be lower quality. It is
+                                   primarily useful for streaming. */
+    OMX_BOOL bDownmix;		  /**< Downmix input from stereo to mono (has no effect on 
+                                   non-stereo streams). Useful for lower-bitrate encoding. */     
+} OMX_AUDIO_PARAM_VORBISTYPE;
+
+
+/** WMA Version */
+typedef enum OMX_AUDIO_WMAFORMATTYPE {
+  OMX_AUDIO_WMAFormatUnused = 0, /**< format unused or unknown */
+  OMX_AUDIO_WMAFormat7,          /**< Windows Media Audio format 7 */
+  OMX_AUDIO_WMAFormat8,          /**< Windows Media Audio format 8 */
+  OMX_AUDIO_WMAFormat9,          /**< Windows Media Audio format 9 */
+  OMX_AUDIO_WMAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+  OMX_AUDIO_WMAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+  OMX_AUDIO_WMAFormatMax = 0x7FFFFFFF
+} OMX_AUDIO_WMAFORMATTYPE;
+
+
+/** WMA Profile */
+typedef enum OMX_AUDIO_WMAPROFILETYPE {
+  OMX_AUDIO_WMAProfileUnused = 0,  /**< profile unused or unknown */
+  OMX_AUDIO_WMAProfileL1,          /**< Windows Media audio version 9 profile L1 */
+  OMX_AUDIO_WMAProfileL2,          /**< Windows Media audio version 9 profile L2 */
+  OMX_AUDIO_WMAProfileL3,          /**< Windows Media audio version 9 profile L3 */
+  OMX_AUDIO_WMAProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+  OMX_AUDIO_WMAProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+  OMX_AUDIO_WMAProfileMax = 0x7FFFFFFF
+} OMX_AUDIO_WMAPROFILETYPE;
+
+
+/** WMA params */
+typedef struct OMX_AUDIO_PARAM_WMATYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex;       /**< port that this structure applies to */
+    OMX_U16 nChannels;        /**< Number of channels */
+    OMX_U32 nBitRate;         /**< Bit rate of the input data.  Use 0 for variable
+                                   rate or unknown bit rates */
+    OMX_AUDIO_WMAFORMATTYPE eFormat; /**< Version of WMA stream / data */
+	OMX_AUDIO_WMAPROFILETYPE eProfile;  /**< Profile of WMA stream / data */
+    OMX_U32 nSamplingRate;    /**< Sampling rate of the source data */
+    OMX_U16 nBlockAlign;      /**< is the block alignment, or block size, in bytes of the audio codec */
+    OMX_U16 nEncodeOptions;   /**< WMA Type-specific data */
+    OMX_U32 nSuperBlockAlign; /**< WMA Type-specific data */
+} OMX_AUDIO_PARAM_WMATYPE;
+
+/** 
+ * RealAudio format
+ */
+typedef enum OMX_AUDIO_RAFORMATTYPE {
+    OMX_AUDIO_RAFormatUnused = 0, /**< Format unused or unknown */
+    OMX_AUDIO_RA8,                /**< RealAudio 8 codec */
+    OMX_AUDIO_RA9,                /**< RealAudio 9 codec */
+    OMX_AUDIO_RA10_AAC,           /**< MPEG-4 AAC codec for bitrates of more than 128kbps */
+    OMX_AUDIO_RA10_CODEC,         /**< RealAudio codec for bitrates less than 128 kbps */
+    OMX_AUDIO_RA10_LOSSLESS,      /**< RealAudio Lossless */
+    OMX_AUDIO_RA10_MULTICHANNEL,  /**< RealAudio Multichannel */
+    OMX_AUDIO_RA10_VOICE,         /**< RealAudio Voice for bitrates below 15 kbps */
+    OMX_AUDIO_RAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_RAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_RAFormatMax = 0x7FFFFFFF
+} OMX_AUDIO_RAFORMATTYPE;
+
+/** RA (Real Audio) params */ 
+typedef struct OMX_AUDIO_PARAM_RATYPE { 
+    OMX_U32 nSize;              /**< Size of this structure, in Bytes */ 
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;         /**< Port that this structure applies to */ 
+    OMX_U32 nChannels;          /**< Number of channels */ 
+    OMX_U32 nSamplingRate;      /**< is the sampling rate of the source data */ 
+    OMX_U32 nBitsPerFrame;      /**< is the value for bits per frame  */ 
+    OMX_U32 nSamplePerFrame;    /**< is the value for samples per frame */ 
+    OMX_U32 nCouplingQuantBits; /**< is the number of coupling quantization bits in the stream */ 
+    OMX_U32 nCouplingStartRegion;   /**< is the coupling start region in the stream  */ 
+    OMX_U32 nNumRegions;        /**< is the number of regions value */ 
+    OMX_AUDIO_RAFORMATTYPE eFormat; /**< is the RealAudio audio format */
+} OMX_AUDIO_PARAM_RATYPE; 
+
+
+/** SBC Allocation Method Type */
+typedef enum OMX_AUDIO_SBCALLOCMETHODTYPE {
+  OMX_AUDIO_SBCAllocMethodLoudness, /**< Loudness allocation method */
+  OMX_AUDIO_SBCAllocMethodSNR,      /**< SNR allocation method */
+  OMX_AUDIO_SBCAllocMethodKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+  OMX_AUDIO_SBCAllocMethodVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+  OMX_AUDIO_SBCAllocMethodMax = 0x7FFFFFFF
+} OMX_AUDIO_SBCALLOCMETHODTYPE;
+
+
+/** SBC params */
+typedef struct OMX_AUDIO_PARAM_SBCTYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_U32 nPortIndex;        /**< port that this structure applies to */
+    OMX_U32 nChannels;         /**< Number of channels */
+    OMX_U32 nBitRate;          /**< Bit rate of the input data.  Use 0 for variable
+                                    rate or unknown bit rates */
+    OMX_U32 nSampleRate;       /**< Sampling rate of the source data.  Use 0 for
+                                    variable or unknown sampling rate. */
+    OMX_U32 nBlocks;           /**< Number of blocks */
+    OMX_U32 nSubbands;         /**< Number of subbands */
+    OMX_U32 nBitPool;          /**< Bitpool value */
+    OMX_BOOL bEnableBitrate;   /**< Use bitrate value instead of bitpool */
+    OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */
+    OMX_AUDIO_SBCALLOCMETHODTYPE eSBCAllocType;   /**< SBC Allocation method type */
+} OMX_AUDIO_PARAM_SBCTYPE;
+
+
+/** ADPCM stream format parameters */ 
+typedef struct OMX_AUDIO_PARAM_ADPCMTYPE { 
+    OMX_U32 nSize;              /**< size of the structure in bytes */ 
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;         /**< port that this structure applies to */ 
+    OMX_U32 nChannels;          /**< Number of channels in the data stream (not 
+                                     necessarily the same as the number of channels 
+                                     to be rendered. */ 
+    OMX_U32 nBitsPerSample;     /**< Number of bits in each sample */ 
+    OMX_U32 nSampleRate;        /**< Sampling rate of the source data.  Use 0 for 
+                                    variable or unknown sampling rate. */ 
+} OMX_AUDIO_PARAM_ADPCMTYPE; 
+
+
+/** G723 rate */
+typedef enum OMX_AUDIO_G723RATE {
+    OMX_AUDIO_G723ModeUnused = 0,  /**< AMRNB Mode unused / unknown */
+    OMX_AUDIO_G723ModeLow,         /**< 5300 bps */
+    OMX_AUDIO_G723ModeHigh,        /**< 6300 bps */
+    OMX_AUDIO_G723ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_G723ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_G723ModeMax = 0x7FFFFFFF
+} OMX_AUDIO_G723RATE;
+
+
+/** G723 - Sample rate must be 8 KHz */
+typedef struct OMX_AUDIO_PARAM_G723TYPE { 
+    OMX_U32 nSize;                /**< size of the structure in bytes */ 
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */ 
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not 
+                                       necessarily the same as the number of channels 
+                                       to be rendered. */ 
+    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */ 
+    OMX_AUDIO_G723RATE eBitRate;  /**< todo: Should this be moved to a config? */
+    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */ 
+    OMX_BOOL bPostFilter;         /**< Enable Post Filter */ 
+} OMX_AUDIO_PARAM_G723TYPE; 
+
+
+/** ITU G726 (ADPCM) rate */
+typedef enum OMX_AUDIO_G726MODE {
+    OMX_AUDIO_G726ModeUnused = 0,  /**< G726 Mode unused / unknown */
+    OMX_AUDIO_G726Mode16,          /**< 16 kbps */
+    OMX_AUDIO_G726Mode24,          /**< 24 kbps */
+    OMX_AUDIO_G726Mode32,          /**< 32 kbps, most common rate, also G721 */
+    OMX_AUDIO_G726Mode40,          /**< 40 kbps */
+    OMX_AUDIO_G726ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_G726ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_G726ModeMax = 0x7FFFFFFF
+} OMX_AUDIO_G726MODE;
+
+
+/** G.726 stream format parameters - must be at 8KHz */ 
+typedef struct OMX_AUDIO_PARAM_G726TYPE { 
+    OMX_U32 nSize;              /**< size of the structure in bytes */ 
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;         /**< port that this structure applies to */ 
+    OMX_U32 nChannels;          /**< Number of channels in the data stream (not 
+                                     necessarily the same as the number of channels 
+                                     to be rendered. */ 
+     OMX_AUDIO_G726MODE eG726Mode;
+} OMX_AUDIO_PARAM_G726TYPE; 
+
+
+/** G729 coder type */
+typedef enum OMX_AUDIO_G729TYPE {
+    OMX_AUDIO_G729 = 0,           /**< ITU G.729  encoded data */
+    OMX_AUDIO_G729A,              /**< ITU G.729 annex A  encoded data */
+    OMX_AUDIO_G729B,              /**< ITU G.729 with annex B encoded data */
+    OMX_AUDIO_G729AB,             /**< ITU G.729 annexes A and B encoded data */
+    OMX_AUDIO_G729KhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_G729VendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_G729Max = 0x7FFFFFFF
+} OMX_AUDIO_G729TYPE;
+
+
+/** G729 stream format parameters - fixed 6KHz sample rate */
+typedef struct OMX_AUDIO_PARAM_G729TYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex;       /**< port that this structure applies to */
+    OMX_U32 nChannels;        /**< Number of channels in the data stream (not
+                                   necessarily the same as the number of channels
+                                   to be rendered. */
+    OMX_BOOL bDTX;            /**< Enable Discontinuous Transmisssion */
+    OMX_AUDIO_G729TYPE eBitType;
+} OMX_AUDIO_PARAM_G729TYPE;
+
+
+/** AMR Frame format */ 
+typedef enum OMX_AUDIO_AMRFRAMEFORMATTYPE { 
+    OMX_AUDIO_AMRFrameFormatConformance = 0,  /**< Frame Format is AMR Conformance 
+                                                   (Standard) Format */ 
+    OMX_AUDIO_AMRFrameFormatIF1,              /**< Frame Format is AMR Interface 
+                                                   Format 1 */ 
+    OMX_AUDIO_AMRFrameFormatIF2,              /**< Frame Format is AMR Interface 
+                                                   Format 2*/ 
+    OMX_AUDIO_AMRFrameFormatFSF,              /**< Frame Format is AMR File Storage 
+                                                   Format */ 
+    OMX_AUDIO_AMRFrameFormatRTPPayload,       /**< Frame Format is AMR Real-Time 
+                                                   Transport Protocol Payload Format */ 
+    OMX_AUDIO_AMRFrameFormatITU,              /**< Frame Format is ITU Format (added at Motorola request) */ 
+    OMX_AUDIO_AMRFrameFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_AMRFrameFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_AMRFrameFormatMax = 0x7FFFFFFF 
+} OMX_AUDIO_AMRFRAMEFORMATTYPE; 
+
+
+/** AMR band mode */
+typedef enum OMX_AUDIO_AMRBANDMODETYPE {
+    OMX_AUDIO_AMRBandModeUnused = 0,          /**< AMRNB Mode unused / unknown */
+    OMX_AUDIO_AMRBandModeNB0,                 /**< AMRNB Mode 0 =  4750 bps */
+    OMX_AUDIO_AMRBandModeNB1,                 /**< AMRNB Mode 1 =  5150 bps */
+    OMX_AUDIO_AMRBandModeNB2,                 /**< AMRNB Mode 2 =  5900 bps */ 
+    OMX_AUDIO_AMRBandModeNB3,                 /**< AMRNB Mode 3 =  6700 bps */
+    OMX_AUDIO_AMRBandModeNB4,                 /**< AMRNB Mode 4 =  7400 bps */
+    OMX_AUDIO_AMRBandModeNB5,                 /**< AMRNB Mode 5 =  7950 bps */
+    OMX_AUDIO_AMRBandModeNB6,                 /**< AMRNB Mode 6 = 10200 bps */
+    OMX_AUDIO_AMRBandModeNB7,                 /**< AMRNB Mode 7 = 12200 bps */
+    OMX_AUDIO_AMRBandModeWB0,                 /**< AMRWB Mode 0 =  6600 bps */
+    OMX_AUDIO_AMRBandModeWB1,                 /**< AMRWB Mode 1 =  8850 bps */
+    OMX_AUDIO_AMRBandModeWB2,                 /**< AMRWB Mode 2 = 12650 bps */ 
+    OMX_AUDIO_AMRBandModeWB3,                 /**< AMRWB Mode 3 = 14250 bps */ 
+    OMX_AUDIO_AMRBandModeWB4,                 /**< AMRWB Mode 4 = 15850 bps */
+    OMX_AUDIO_AMRBandModeWB5,                 /**< AMRWB Mode 5 = 18250 bps */
+    OMX_AUDIO_AMRBandModeWB6,                 /**< AMRWB Mode 6 = 19850 bps */
+    OMX_AUDIO_AMRBandModeWB7,                 /**< AMRWB Mode 7 = 23050 bps */
+    OMX_AUDIO_AMRBandModeWB8,                 /**< AMRWB Mode 8 = 23850 bps */      
+    OMX_AUDIO_AMRBandModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_AMRBandModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_AMRBandModeMax = 0x7FFFFFFF
+} OMX_AUDIO_AMRBANDMODETYPE;
+     
+
+/** AMR Discontinuous Transmission mode */ 
+typedef enum OMX_AUDIO_AMRDTXMODETYPE { 
+    OMX_AUDIO_AMRDTXModeOff = 0,        /**< AMR Discontinuous Transmission Mode is disabled */ 
+    OMX_AUDIO_AMRDTXModeOnVAD1,         /**< AMR Discontinuous Transmission Mode using 
+                                             Voice Activity Detector 1 (VAD1) is enabled */ 
+    OMX_AUDIO_AMRDTXModeOnVAD2,         /**< AMR Discontinuous Transmission Mode using 
+                                             Voice Activity Detector 2 (VAD2) is enabled */       
+    OMX_AUDIO_AMRDTXModeOnAuto,         /**< The codec will automatically select between 
+                                             Off, VAD1 or VAD2 modes */ 
+
+    OMX_AUDIO_AMRDTXasEFR,             /**< DTX as EFR instead of AMR standard (3GPP 26.101, frame type =8,9,10) */
+
+    OMX_AUDIO_AMRDTXModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_AMRDTXModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_AMRDTXModeMax = 0x7FFFFFFF 
+} OMX_AUDIO_AMRDTXMODETYPE; 
+ 
+
+/** AMR params */
+typedef struct OMX_AUDIO_PARAM_AMRTYPE {
+    OMX_U32 nSize;                          /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;               /**< OMX specification version information */
+    OMX_U32 nPortIndex;                     /**< port that this structure applies to */
+    OMX_U32 nChannels;                      /**< Number of channels */
+    OMX_U32 nBitRate;                       /**< Bit rate read only field */
+    OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode; /**< AMR Band Mode enumeration */ 
+    OMX_AUDIO_AMRDTXMODETYPE  eAMRDTXMode;  /**< AMR DTX Mode enumeration */
+    OMX_AUDIO_AMRFRAMEFORMATTYPE eAMRFrameFormat; /**< AMR frame format enumeration */
+} OMX_AUDIO_PARAM_AMRTYPE;
+
+
+/** GSM_FR (ETSI 06.10, 3GPP 46.010) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_GSMFRTYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex;       /**< port that this structure applies to */
+    OMX_BOOL bDTX;            /**< Enable Discontinuous Transmisssion */
+    OMX_BOOL bHiPassFilter;   /**< Enable High Pass Filter */
+} OMX_AUDIO_PARAM_GSMFRTYPE;
+
+
+/** GSM-HR (ETSI 06.20, 3GPP 46.020) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_GSMHRTYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex;       /**< port that this structure applies to */
+    OMX_BOOL bDTX;            /**< Enable Discontinuous Transmisssion */
+    OMX_BOOL bHiPassFilter;   /**< Enable High Pass Filter */
+} OMX_AUDIO_PARAM_GSMHRTYPE;
+
+
+/** GSM-EFR (ETSI 06.60, 3GPP 46.060) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_GSMEFRTYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex;       /**< port that this structure applies to */
+    OMX_BOOL bDTX;            /**< Enable Discontinuous Transmisssion */
+    OMX_BOOL bHiPassFilter;   /**< Enable High Pass Filter */
+} OMX_AUDIO_PARAM_GSMEFRTYPE;
+
+
+/** TDMA FR (TIA/EIA-136-420, VSELP 7.95kbps coder) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_TDMAFRTYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
+                                       necessarily the same as the number of channels
+                                       to be rendered. */
+    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
+    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
+} OMX_AUDIO_PARAM_TDMAFRTYPE;
+
+
+/** TDMA EFR (TIA/EIA-136-410, ACELP 7.4kbps coder) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_TDMAEFRTYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
+                                       necessarily the same as the number of channels
+                                       to be rendered. */
+    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
+    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
+} OMX_AUDIO_PARAM_TDMAEFRTYPE;
+
+
+/** PDC FR ( RCR-27, VSELP 6.7kbps coder) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_PDCFRTYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
+                                       necessarily the same as the number of channels
+                                       to be rendered. */
+    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
+    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
+} OMX_AUDIO_PARAM_PDCFRTYPE;
+
+
+/** PDC EFR ( RCR-27, ACELP 6.7kbps coder) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_PDCEFRTYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
+                                       necessarily the same as the number of channels
+                                       to be rendered. */
+    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
+    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
+} OMX_AUDIO_PARAM_PDCEFRTYPE;
+
+/** PDC HR ( RCR-27, PSI-CELP 3.45kbps coder) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_PDCHRTYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
+                                       necessarily the same as the number of channels
+                                       to be rendered. */
+    OMX_BOOL bDTX;                /**< Enable Discontinuous Transmisssion */
+    OMX_BOOL bHiPassFilter;       /**< Enable High Pass Filter */
+} OMX_AUDIO_PARAM_PDCHRTYPE;
+
+
+/** CDMA Rate types */
+typedef enum OMX_AUDIO_CDMARATETYPE {
+    OMX_AUDIO_CDMARateBlank = 0,          /**< CDMA encoded frame is blank */
+    OMX_AUDIO_CDMARateFull,               /**< CDMA encoded frame in full rate */
+    OMX_AUDIO_CDMARateHalf,               /**< CDMA encoded frame in half rate */
+    OMX_AUDIO_CDMARateQuarter,            /**< CDMA encoded frame in quarter rate */
+    OMX_AUDIO_CDMARateEighth,             /**< CDMA encoded frame in eighth rate (DTX)*/
+    OMX_AUDIO_CDMARateErasure,            /**< CDMA erasure frame */
+    OMX_AUDIO_CDMARateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_CDMARateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_CDMARateMax = 0x7FFFFFFF
+} OMX_AUDIO_CDMARATETYPE;
+
+
+/** QCELP8 (TIA/EIA-96, up to 8kbps coder) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_QCELP8TYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
+                                       necessarily the same as the number of channels
+                                       to be rendered. */
+    OMX_U32 nBitRate;             /**< Bit rate of the input data.  Use 0 for variable
+                                       rate or unknown bit rates */
+    OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
+    OMX_U32 nMinBitRate;          /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
+    OMX_U32 nMaxBitRate;          /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
+} OMX_AUDIO_PARAM_QCELP8TYPE;
+
+
+/** QCELP13 ( CDMA, EIA/TIA-733, 13.3kbps coder) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_QCELP13TYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
+                                       necessarily the same as the number of channels
+                                       to be rendered. */
+    OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
+    OMX_U32 nMinBitRate;          /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
+    OMX_U32 nMaxBitRate;          /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
+} OMX_AUDIO_PARAM_QCELP13TYPE;
+
+
+/** EVRC ( CDMA, EIA/TIA-127, RCELP up to 8.55kbps coder) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_EVRCTYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
+                                       necessarily the same as the number of channels
+                                       to be rendered. */
+    OMX_AUDIO_CDMARATETYPE eCDMARate; /**< actual Frame rate */
+    OMX_BOOL bRATE_REDUCon;       /**< RATE_REDUCtion is requested for this frame */
+    OMX_U32 nMinBitRate;          /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
+    OMX_U32 nMaxBitRate;          /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
+    OMX_BOOL bHiPassFilter;       /**< Enable encoder's High Pass Filter */
+    OMX_BOOL bNoiseSuppressor;    /**< Enable encoder's noise suppressor pre-processing */
+    OMX_BOOL bPostFilter;         /**< Enable decoder's post Filter */
+} OMX_AUDIO_PARAM_EVRCTYPE;
+
+
+/** SMV ( up to 8.55kbps coder) stream format parameters */
+typedef struct OMX_AUDIO_PARAM_SMVTYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_U32 nChannels;            /**< Number of channels in the data stream (not
+                                       necessarily the same as the number of channels
+                                       to be rendered. */
+    OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
+    OMX_BOOL bRATE_REDUCon;           /**< RATE_REDUCtion is requested for this frame */
+    OMX_U32 nMinBitRate;          /**< minmal rate for the encoder = 1,2,3,4, default = 1 ??*/
+    OMX_U32 nMaxBitRate;          /**< maximal rate for the encoder = 1,2,3,4, default = 4 ??*/
+    OMX_BOOL bHiPassFilter;       /**< Enable encoder's High Pass Filter ??*/
+    OMX_BOOL bNoiseSuppressor;    /**< Enable encoder's noise suppressor pre-processing */
+    OMX_BOOL bPostFilter;         /**< Enable decoder's post Filter ??*/
+} OMX_AUDIO_PARAM_SMVTYPE;
+
+
+/** MIDI Format 
+ * @ingroup midi
+ */
+typedef enum OMX_AUDIO_MIDIFORMATTYPE
+{
+    OMX_AUDIO_MIDIFormatUnknown = 0, /**< MIDI Format unknown or don't care */
+    OMX_AUDIO_MIDIFormatSMF0,        /**< Standard MIDI File Type 0 */
+    OMX_AUDIO_MIDIFormatSMF1,        /**< Standard MIDI File Type 1 */
+    OMX_AUDIO_MIDIFormatSMF2,        /**< Standard MIDI File Type 2 */
+    OMX_AUDIO_MIDIFormatSPMIDI,      /**< SP-MIDI */
+    OMX_AUDIO_MIDIFormatXMF0,        /**< eXtensible Music Format type 0 */
+    OMX_AUDIO_MIDIFormatXMF1,        /**< eXtensible Music Format type 1 */
+    OMX_AUDIO_MIDIFormatMobileXMF,   /**< Mobile XMF (eXtensible Music Format type 2) */
+    OMX_AUDIO_MIDIFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_MIDIFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_MIDIFormatMax = 0x7FFFFFFF
+} OMX_AUDIO_MIDIFORMATTYPE;
+
+
+/** MIDI params 
+ * @ingroup midi
+ */
+typedef struct OMX_AUDIO_PARAM_MIDITYPE {
+    OMX_U32 nSize;                 /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;      /**< OMX specification version information */
+    OMX_U32 nPortIndex;            /**< port that this structure applies to */
+    OMX_U32 nFileSize;             /**< size of the MIDI file in bytes, where the entire 
+                                        MIDI file passed in, otherwise if 0x0, the MIDI data 
+                                        is merged and streamed (instead of passed as an 
+                                        entire MIDI file) */
+    OMX_BU32 sMaxPolyphony;        /**< Specifies the maximum simultaneous polyphonic 
+                                        voices. A value of zero indicates that the default 
+                                        polyphony of the device is used  */                                    
+    OMX_BOOL bLoadDefaultSound;    /**< Whether to load default sound 
+                                        bank at initialization */
+    OMX_AUDIO_MIDIFORMATTYPE eMidiFormat; /**< Version of the MIDI file */                                                                           
+} OMX_AUDIO_PARAM_MIDITYPE;
+
+
+/** Type of the MIDI sound bank 
+ * @ingroup midi
+ */
+typedef enum OMX_AUDIO_MIDISOUNDBANKTYPE {
+    OMX_AUDIO_MIDISoundBankUnused = 0,           /**< unused/unknown soundbank type */
+    OMX_AUDIO_MIDISoundBankDLS1,                 /**< DLS version 1 */
+    OMX_AUDIO_MIDISoundBankDLS2,                 /**< DLS version 2 */
+    OMX_AUDIO_MIDISoundBankMobileDLSBase,        /**< Mobile DLS, using the base functionality */
+    OMX_AUDIO_MIDISoundBankMobileDLSPlusOptions, /**< Mobile DLS, using the specification-defined optional feature set */
+    OMX_AUDIO_MIDISoundBankKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_MIDISoundBankVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_MIDISoundBankMax = 0x7FFFFFFF
+} OMX_AUDIO_MIDISOUNDBANKTYPE;
+
+
+/** Bank Layout describes how bank MSB & LSB are used in the DLS instrument definitions sound bank 
+ * @ingroup midi
+ */
+typedef enum OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE {
+   OMX_AUDIO_MIDISoundBankLayoutUnused = 0,   /**< unused/unknown soundbank type */
+   OMX_AUDIO_MIDISoundBankLayoutGM,           /**< GS layout (based on bank MSB 0x00) */
+   OMX_AUDIO_MIDISoundBankLayoutGM2,          /**< General MIDI 2 layout (using MSB 0x78/0x79, LSB 0x00) */
+   OMX_AUDIO_MIDISoundBankLayoutUser,         /**< Does not conform to any bank numbering standards */
+   OMX_AUDIO_MIDISoundBankLayoutKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+   OMX_AUDIO_MIDISoundBankLayoutVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+   OMX_AUDIO_MIDISoundBankLayoutMax = 0x7FFFFFFF
+} OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE;
+
+
+/** MIDI params to load/unload user soundbank 
+ * @ingroup midi
+ */
+typedef struct OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex;       /**< port that this structure applies to */
+    OMX_U32 nDLSIndex;        /**< DLS file index to be loaded */
+    OMX_U32 nDLSSize;         /**< Size in bytes */
+    OMX_PTR pDLSData;         /**< Pointer to DLS file data */
+    OMX_AUDIO_MIDISOUNDBANKTYPE eMidiSoundBank;   /**< Midi sound bank type enumeration */
+    OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE eMidiSoundBankLayout; /**< Midi sound bank layout enumeration */
+} OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE;
+
+
+/** Structure for Live MIDI events and MIP messages. 
+ * (MIP = Maximum Instantaneous Polyphony; part of the SP-MIDI standard.) 
+ * @ingroup midi
+ */
+typedef struct OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex;       /**< Port that this structure applies to */
+    OMX_U32 nMidiEventSize;   /**< Size of immediate MIDI events or MIP message in bytes  */
+    OMX_U8 nMidiEvents[1];    /**< MIDI event array to be rendered immediately, or an
+                                   array for the MIP message buffer, where the size is 
+                                   indicated by nMidiEventSize */
+} OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE;
+
+
+/** MIDI sound bank/ program pair in a given channel 
+ * @ingroup midi
+ */
+typedef struct OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U32 nPortIndex;         /**< Port that this structure applies to */
+    OMX_U32 nChannel;           /**< Valid channel values range from 1 to 16 */
+    OMX_U16 nIDProgram;         /**< Valid program ID range is 1 to 128 */
+    OMX_U16 nIDSoundBank;       /**< Sound bank ID */
+    OMX_U32 nUserSoundBankIndex;/**< User soundbank index, easier to access soundbanks 
+                                     by index if multiple banks are present */
+} OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE;
+
+
+/** MIDI control 
+ * @ingroup midi
+ */
+typedef struct OMX_AUDIO_CONFIG_MIDICONTROLTYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_BS32 sPitchTransposition; /**< Pitch transposition in semitones, stored as Q22.10 
+                                       format based on JAVA MMAPI (JSR-135) requirement */
+    OMX_BU32 sPlayBackRate;       /**< Relative playback rate, stored as Q14.17 fixed-point
+                                       number based on JSR-135 requirement */
+    OMX_BU32 sTempo ;             /**< Tempo in beats per minute (BPM), stored as Q22.10 
+                                       fixed-point number based on JSR-135 requirement */
+    OMX_U32 nMaxPolyphony;        /**< Specifies the maximum simultaneous polyphonic 
+                                       voices. A value of zero indicates that the default 
+                                       polyphony of the device is used  */
+    OMX_U32 nNumRepeat;           /**< Number of times to repeat playback */
+    OMX_U32 nStopTime;            /**< Time in milliseconds to indicate when playback 
+                                       will stop automatically.  Set to zero if not used */
+    OMX_U16 nChannelMuteMask;     /**< 16 bit mask for channel mute status */
+    OMX_U16 nChannelSoloMask;     /**< 16 bit mask for channel solo status */
+    OMX_U32 nTrack0031MuteMask;   /**< 32 bit mask for track mute status. Note: This is for tracks 0-31 */
+    OMX_U32 nTrack3263MuteMask;   /**< 32 bit mask for track mute status. Note: This is for tracks 32-63 */
+    OMX_U32 nTrack0031SoloMask;   /**< 32 bit mask for track solo status. Note: This is for tracks 0-31 */
+    OMX_U32 nTrack3263SoloMask;   /**< 32 bit mask for track solo status. Note: This is for tracks 32-63 */
+
+} OMX_AUDIO_CONFIG_MIDICONTROLTYPE;
+
+
+/** MIDI Playback States 
+ * @ingroup midi
+ */
+typedef enum OMX_AUDIO_MIDIPLAYBACKSTATETYPE {
+  OMX_AUDIO_MIDIPlayBackStateUnknown = 0,      /**< Unknown state or state does not map to 
+  													other defined states */
+  OMX_AUDIO_MIDIPlayBackStateClosedEngaged,    /**< No MIDI resource is currently open. 
+                                                    The MIDI engine is currently processing 
+                                                    MIDI events. */
+  OMX_AUDIO_MIDIPlayBackStateParsing,          /**< A MIDI resource is open and is being 
+                                                    primed. The MIDI engine is currently 
+                                                    processing MIDI events. */
+  OMX_AUDIO_MIDIPlayBackStateOpenEngaged,      /**< A MIDI resource is open and primed but 
+                                                    not playing. The MIDI engine is currently
+                                                    processing MIDI events. The transition to
+                                                    this state is only possible from the 
+                                                    OMX_AUDIO_MIDIPlayBackStatePlaying state,
+                                                    when the 'playback head' reaches the end
+                                                    of media data or the playback stops due
+                                                    to stop time set.*/
+  OMX_AUDIO_MIDIPlayBackStatePlaying,          /**< A MIDI resource is open and currently
+                                                    playing. The MIDI engine is currently
+                                                    processing MIDI events.*/
+  OMX_AUDIO_MIDIPlayBackStatePlayingPartially, /**< Best-effort playback due to SP-MIDI/DLS
+                                                    resource constraints */
+  OMX_AUDIO_MIDIPlayBackStatePlayingSilently,  /**< Due to system resource constraints and
+                                                    SP-MIDI content constraints, there is
+                                                    no audible MIDI content during playback
+                                                    currently. The situation may change if
+                                                    resources are freed later.*/
+  OMX_AUDIO_MIDIPlayBackStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+  OMX_AUDIO_MIDIPlayBackStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+  OMX_AUDIO_MIDIPlayBackStateMax = 0x7FFFFFFF
+} OMX_AUDIO_MIDIPLAYBACKSTATETYPE;
+
+
+/** MIDI status 
+ * @ingroup midi
+ */
+typedef struct OMX_AUDIO_CONFIG_MIDISTATUSTYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U32 nPortIndex;         /**< port that this structure applies to */
+    OMX_U16 nNumTracks;         /**< Number of MIDI tracks in the file, read only field. 
+                                     NOTE: May not return a meaningful value until the entire 
+                                     file is parsed and buffered.  */
+    OMX_U32 nDuration;          /**< The length of the currently open MIDI resource 
+                                     in milliseconds. NOTE: May not return a meaningful value 
+                                     until the entire file is parsed and buffered.  */  
+    OMX_U32 nPosition;          /**< Current Position of the MIDI resource being played 
+                                     in milliseconds */
+    OMX_BOOL bVibra;            /**< Does Vibra track exist? NOTE: May not return a meaningful 
+                                     value until the entire file is parsed and buffered. */
+    OMX_U32 nNumMetaEvents;     /**< Total number of MIDI Meta Events in the currently 
+                                     open MIDI resource. NOTE: May not return a meaningful value 
+                                     until the entire file is parsed and buffered.  */
+    OMX_U32 nNumActiveVoices;   /**< Number of active voices in the currently playing 
+                                     MIDI resource. NOTE: May not return a meaningful value until 
+                                     the entire file is parsed and buffered. */
+    OMX_AUDIO_MIDIPLAYBACKSTATETYPE eMIDIPlayBackState;  /**< MIDI playback state enumeration, read only field */
+} OMX_AUDIO_CONFIG_MIDISTATUSTYPE;
+
+
+/** MIDI Meta Event structure one per Meta Event.
+ *  MIDI Meta Events are like audio metadata, except that they are interspersed 
+ *  with the MIDI content throughout the file and are not localized in the header. 
+ *  As such, it is necessary to retrieve information about these Meta Events from 
+ *  the engine, as it encounters these Meta Events within the MIDI content. 
+ *  For example, SMF files can have up to 14 types of MIDI Meta Events (copyright, 
+ *  author, default tempo, etc.) scattered throughout the file. 
+ *  @ingroup midi
+ */
+typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE{ 
+    OMX_U32 nSize;            /**< size of the structure in bytes */ 
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;       /**< port that this structure applies to */ 
+    OMX_U32 nIndex;           /**< Index of Meta Event */ 
+    OMX_U8 nMetaEventType;    /**< Meta Event Type, 7bits (i.e. 0 - 127) */ 
+    OMX_U32 nMetaEventSize;   /**< size of the Meta Event in bytes */ 
+    OMX_U32 nTrack;           /**< track number for the meta event */
+    OMX_U32 nPosition;        /**< Position of the meta-event in milliseconds */
+} OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE; 
+
+
+/** MIDI Meta Event Data structure - one per Meta Event. 
+ * @ingroup midi
+ */ 
+typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE{ 
+    OMX_U32 nSize;            /**< size of the structure in bytes */ 
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;       /**< port that this structure applies to */ 
+    OMX_U32 nIndex;           /**< Index of Meta Event */ 
+    OMX_U32 nMetaEventSize;   /**< size of the Meta Event in bytes */ 
+    OMX_U8 nData[1];          /**< array of one or more bytes of meta data 
+                                   as indicated by the nMetaEventSize field */ 
+} OMX_AUDIO_CONFIG__MIDIMETAEVENTDATATYPE; 
+
+
+/** Audio Volume adjustment for a port */
+typedef struct OMX_AUDIO_CONFIG_VOLUMETYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U32 nPortIndex;         /**< Port index indicating which port to 
+                                     set.  Select the input port to set 
+                                     just that port's volume.  Select the 
+                                     output port to adjust the master 
+                                     volume. */
+    OMX_BOOL bLinear;           /**< Is the volume to be set in linear (0.100) 
+                                     or logarithmic scale (mB) */
+    OMX_BS32 sVolume;           /**< Volume linear setting in the 0..100 range, OR
+                                     Volume logarithmic setting for this port.  The values
+                                     for volume are in mB (millibels = 1/100 dB) relative
+                                     to a gain of 1 (e.g. the output is the same as the 
+                                     input level).  Values are in mB from nMax 
+                                     (maximum volume) to nMin mB (typically negative).
+                                     Since the volume is "voltage"
+                                     and not a "power", it takes a setting of
+                                     -600 mB to decrease the volume by 1/2.  If
+                                     a component cannot accurately set the 
+                                     volume to the requested value, it must
+                                     set the volume to the closest value BELOW
+                                     the requested value.  When getting the
+                                     volume setting, the current actual volume
+                                     must be returned. */
+} OMX_AUDIO_CONFIG_VOLUMETYPE;
+
+
+/** Audio Volume adjustment for a channel */
+typedef struct OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U32 nPortIndex;         /**< Port index indicating which port to 
+                                     set.  Select the input port to set 
+                                     just that port's volume.  Select the 
+                                     output port to adjust the master 
+                                     volume. */
+    OMX_U32 nChannel;           /**< channel to select from 0 to N-1, 
+                                     using OMX_ALL to apply volume settings
+                                     to all channels */
+    OMX_BOOL bLinear;           /**< Is the volume to be set in linear (0.100) or 
+                                     logarithmic scale (mB) */
+    OMX_BS32 sVolume;           /**< Volume linear setting in the 0..100 range, OR
+                                     Volume logarithmic setting for this port.  
+                                     The values for volume are in mB 
+                                     (millibels = 1/100 dB) relative to a gain
+                                     of 1 (e.g. the output is the same as the 
+                                     input level).  Values are in mB from nMax 
+                                     (maximum volume) to nMin mB (typically negative).  
+                                     Since the volume is "voltage"
+                                     and not a "power", it takes a setting of
+                                     -600 mB to decrease the volume by 1/2.  If
+                                     a component cannot accurately set the 
+                                     volume to the requested value, it must
+                                     set the volume to the closest value BELOW
+                                     the requested value.  When getting the
+                                     volume setting, the current actual volume
+                                     must be returned. */
+    OMX_BOOL bIsMIDI;           /**< TRUE if nChannel refers to a MIDI channel,
+                                     FALSE otherwise */
+} OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE;
+
+
+/** Audio balance setting */
+typedef struct OMX_AUDIO_CONFIG_BALANCETYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U32 nPortIndex;         /**< Port index indicating which port to 
+                                     set.  Select the input port to set 
+                                     just that port's balance.  Select the 
+                                     output port to adjust the master 
+                                     balance. */
+    OMX_S32 nBalance;           /**< balance setting for this port 
+                                     (-100 to 100, where -100 indicates
+                                     all left, and no right */
+} OMX_AUDIO_CONFIG_BALANCETYPE;
+
+
+/** Audio Port mute */
+typedef struct OMX_AUDIO_CONFIG_MUTETYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U32 nPortIndex;         /**< Port index indicating which port to 
+                                     set.  Select the input port to set 
+                                     just that port's mute.  Select the 
+                                     output port to adjust the master 
+                                     mute. */
+    OMX_BOOL bMute;             /**< Mute setting for this port */
+} OMX_AUDIO_CONFIG_MUTETYPE;
+
+
+/** Audio Channel mute */
+typedef struct OMX_AUDIO_CONFIG_CHANNELMUTETYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U32 nPortIndex;         /**< port that this structure applies to */
+    OMX_U32 nChannel;           /**< channel to select from 0 to N-1, 
+                                     using OMX_ALL to apply mute settings
+                                     to all channels */
+    OMX_BOOL bMute;             /**< Mute setting for this channel */
+    OMX_BOOL bIsMIDI;           /**< TRUE if nChannel refers to a MIDI channel,
+                                     FALSE otherwise */ 
+} OMX_AUDIO_CONFIG_CHANNELMUTETYPE;
+
+
+
+/** Enable / Disable for loudness control, which boosts bass and to a 
+ *  smaller extent high end frequencies to compensate for hearing
+ *  ability at the extreme ends of the audio spectrum
+ */ 
+typedef struct OMX_AUDIO_CONFIG_LOUDNESSTYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_U32 nPortIndex;        /**< port that this structure applies to */
+    OMX_BOOL bLoudness;        /**< Enable/disable for loudness */
+} OMX_AUDIO_CONFIG_LOUDNESSTYPE;
+
+
+/** Enable / Disable for bass, which controls low frequencies
+ */ 
+typedef struct OMX_AUDIO_CONFIG_BASSTYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_U32 nPortIndex;        /**< port that this structure applies to */
+    OMX_BOOL bEnable;          /**< Enable/disable for bass control */
+    OMX_S32 nBass;             /**< bass setting for the port, as a 
+                                    continuous value from -100 to 100  
+                                    (0 means no change in bass level)*/
+} OMX_AUDIO_CONFIG_BASSTYPE;
+
+
+/** Enable / Disable for treble, which controls high frequencies tones
+ */ 
+typedef struct OMX_AUDIO_CONFIG_TREBLETYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_U32 nPortIndex;        /**< port that this structure applies to */
+    OMX_BOOL bEnable;          /**< Enable/disable for treble control */
+    OMX_S32  nTreble;          /**< treble setting for the port, as a
+                                    continuous value from -100 to 100  
+                                    (0 means no change in treble level) */
+} OMX_AUDIO_CONFIG_TREBLETYPE;
+
+
+/** An equalizer is typically used for two reasons: to compensate for an 
+ *  sub-optimal frequency response of a system to make it sound more natural 
+ *  or to create intentionally some unnatural coloring to the sound to create
+ *  an effect.
+ *  @ingroup effects
+ */
+typedef struct OMX_AUDIO_CONFIG_EQUALIZERTYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_U32 nPortIndex;        /**< port that this structure applies to */
+    OMX_BOOL bEnable;          /**< Enable/disable for equalizer */
+    OMX_BU32 sBandIndex;       /**< Band number to be set.  Upper Limit is 
+                                    N-1, where N is the number of bands, lower limit is 0 */
+    OMX_BU32 sCenterFreq;      /**< Center frequecies in Hz.  This is a
+                                    read only element and is used to determine 
+                                    the lower, center and upper frequency of 
+                                    this band.  */
+    OMX_BS32 sBandLevel;       /**< band level in millibels */
+} OMX_AUDIO_CONFIG_EQUALIZERTYPE;
+
+
+/** Stereo widening mode type 
+ * @ingroup effects
+ */ 
+typedef enum OMX_AUDIO_STEREOWIDENINGTYPE {
+    OMX_AUDIO_StereoWideningHeadphones,    /**< Stereo widening for loudspeakers */
+    OMX_AUDIO_StereoWideningLoudspeakers,  /**< Stereo widening for closely spaced loudspeakers */
+    OMX_AUDIO_StereoWideningKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_AUDIO_StereoWideningVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_AUDIO_StereoWideningMax = 0x7FFFFFFF
+} OMX_AUDIO_STEREOWIDENINGTYPE;
+
+
+/** Control for stereo widening, which is a special 2-channel
+ *  case of the audio virtualizer effect. For example, for 5.1-channel 
+ *  output, it translates to virtual surround sound. 
+ * @ingroup effects
+ */ 
+typedef struct OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_U32 nPortIndex;        /**< port that this structure applies to */
+    OMX_BOOL bEnable;          /**< Enable/disable for stereo widening control */
+    OMX_AUDIO_STEREOWIDENINGTYPE eWideningType; /**< Stereo widening algorithm type */
+    OMX_U32  nStereoWidening;  /**< stereo widening setting for the port,
+                                    as a continuous value from 0 to 100  */
+} OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE;
+
+
+/** The chorus effect (or ``choralizer'') is any signal processor which makes
+ *  one sound source (such as a voice) sound like many such sources singing 
+ *  (or playing) in unison. Since performance in unison is never exact, chorus 
+ *  effects simulate this by making independently modified copies of the input 
+ *  signal. Modifications may include (1) delay, (2) frequency shift, and 
+ *  (3) amplitude modulation.
+ * @ingroup effects
+ */
+typedef struct OMX_AUDIO_CONFIG_CHORUSTYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_U32 nPortIndex;        /**< port that this structure applies to */
+    OMX_BOOL bEnable;          /**< Enable/disable for chorus */
+    OMX_BU32 sDelay;           /**< average delay in milliseconds */
+    OMX_BU32 sModulationRate;  /**< rate of modulation in millihertz */
+    OMX_U32 nModulationDepth;  /**< depth of modulation as a percentage of 
+                                    delay (i.e. 0 to 100) */
+    OMX_BU32 nFeedback;        /**< Feedback from chorus output to input in percentage */
+} OMX_AUDIO_CONFIG_CHORUSTYPE;
+
+
+/** Reverberation is part of the reflected sound that follows the early 
+ *  reflections. In a typical room, this consists of a dense succession of 
+ *  echoes whose energy decays exponentially. The reverberation effect structure 
+ *  as defined here includes both (early) reflections as well as (late) reverberations. 
+ * @ingroup effects
+ */
+typedef struct OMX_AUDIO_CONFIG_REVERBERATIONTYPE {
+    OMX_U32 nSize;                /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;     /**< OMX specification version information */
+    OMX_U32 nPortIndex;           /**< port that this structure applies to */
+    OMX_BOOL bEnable;             /**< Enable/disable for reverberation control */
+    OMX_BS32 sRoomLevel;          /**< Intensity level for the whole room effect 
+                                       (i.e. both early reflections and late 
+                                       reverberation) in millibels */
+    OMX_BS32 sRoomHighFreqLevel;  /**< Attenuation at high frequencies
+                                       relative to the intensity at low
+                                       frequencies in millibels */
+    OMX_BS32 sReflectionsLevel;   /**< Intensity level of early reflections
+                                       (relative to room value), in millibels */
+    OMX_BU32 sReflectionsDelay;   /**< Delay time of the first reflection relative 
+                                       to the direct path, in milliseconds */
+    OMX_BS32 sReverbLevel;        /**< Intensity level of late reverberation
+                                       relative to room level, in millibels */
+    OMX_BU32 sReverbDelay;        /**< Time delay from the first early reflection 
+                                       to the beginning of the late reverberation 
+                                       section, in milliseconds */
+    OMX_BU32 sDecayTime;          /**< Late reverberation decay time at low
+                                       frequencies, in milliseconds */
+    OMX_BU32 nDecayHighFreqRatio; /**< Ratio of high frequency decay time relative 
+                                       to low frequency decay time in percent  */
+    OMX_U32 nDensity;             /**< Modal density in the late reverberation decay,
+                                       in percent (i.e. 0 - 100) */
+    OMX_U32 nDiffusion;           /**< Echo density in the late reverberation decay,
+                                       in percent (i.e. 0 - 100) */
+    OMX_BU32 sReferenceHighFreq;  /**< Reference high frequency in Hertz. This is 
+                                       the frequency used as the reference for all 
+                                       the high-frequency settings above */
+
+} OMX_AUDIO_CONFIG_REVERBERATIONTYPE;
+
+
+/** Possible settings for the Echo Cancelation structure to use 
+ * @ingroup effects
+ */
+typedef enum OMX_AUDIO_ECHOCANTYPE {
+   OMX_AUDIO_EchoCanOff = 0,    /**< Echo Cancellation is disabled */
+   OMX_AUDIO_EchoCanNormal,     /**< Echo Cancellation normal operation - 
+                                     echo from plastics and face */
+   OMX_AUDIO_EchoCanHFree,      /**< Echo Cancellation optimized for 
+                                     Hands Free operation */
+   OMX_AUDIO_EchoCanCarKit,    /**< Echo Cancellation optimized for 
+                                     Car Kit (longer echo) */
+   OMX_AUDIO_EchoCanKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+   OMX_AUDIO_EchoCanVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+   OMX_AUDIO_EchoCanMax = 0x7FFFFFFF
+} OMX_AUDIO_ECHOCANTYPE;
+
+
+/** Enable / Disable for echo cancelation, which removes undesired echo's
+ *  from the audio
+ * @ingroup effects
+ */ 
+typedef struct OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_U32 nPortIndex;        /**< port that this structure applies to */
+    OMX_AUDIO_ECHOCANTYPE eEchoCancelation; /**< Echo cancelation settings */
+} OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE;
+
+
+/** Enable / Disable for noise reduction, which undesired noise from
+ * the audio
+ * @ingroup effects
+ */ 
+typedef struct OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_U32 nPortIndex;        /**< port that this structure applies to */
+    OMX_BOOL bNoiseReduction;  /**< Enable/disable for noise reduction */
+} OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
+
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Component.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Component.h
new file mode 100644
index 0000000..d595640
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Component.h
@@ -0,0 +1,579 @@
+/*
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ *
+ */
+
+/** OMX_Component.h - OpenMax IL version 1.1.2
+ *  The OMX_Component header file contains the definitions used to define
+ *  the public interface of a component.  This header file is intended to
+ *  be used by both the application and the component.
+ */
+
+#ifndef OMX_Component_h
+#define OMX_Component_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+
+/* Each OMX header must include all required header files to allow the
+ *  header to compile without errors.  The includes below are required
+ *  for this header file to compile successfully 
+ */
+
+#include <OMX_Audio.h>
+#include <OMX_Video.h>
+#include <OMX_Image.h>
+#include <OMX_Other.h>
+
+/** @ingroup comp */
+typedef enum OMX_PORTDOMAINTYPE { 
+    OMX_PortDomainAudio, 
+    OMX_PortDomainVideo, 
+    OMX_PortDomainImage, 
+    OMX_PortDomainOther,
+    OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_PortDomainMax = 0x7ffffff
+} OMX_PORTDOMAINTYPE;
+
+/** @ingroup comp */
+typedef struct OMX_PARAM_PORTDEFINITIONTYPE {
+    OMX_U32 nSize;                 /**< Size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;      /**< OMX specification version information */
+    OMX_U32 nPortIndex;            /**< Port number the structure applies to */
+    OMX_DIRTYPE eDir;              /**< Direction (input or output) of this port */
+    OMX_U32 nBufferCountActual;    /**< The actual number of buffers allocated on this port */
+    OMX_U32 nBufferCountMin;       /**< The minimum number of buffers this port requires */
+    OMX_U32 nBufferSize;           /**< Size, in bytes, for buffers to be used for this channel */
+    OMX_BOOL bEnabled;             /**< Ports default to enabled and are enabled/disabled by
+                                        OMX_CommandPortEnable/OMX_CommandPortDisable.
+                                        When disabled a port is unpopulated. A disabled port
+                                        is not populated with buffers on a transition to IDLE. */
+    OMX_BOOL bPopulated;           /**< Port is populated with all of its buffers as indicated by
+                                        nBufferCountActual. A disabled port is always unpopulated. 
+                                        An enabled port is populated on a transition to OMX_StateIdle
+                                        and unpopulated on a transition to loaded. */
+    OMX_PORTDOMAINTYPE eDomain;    /**< Domain of the port. Determines the contents of metadata below. */
+    union {
+        OMX_AUDIO_PORTDEFINITIONTYPE audio;
+        OMX_VIDEO_PORTDEFINITIONTYPE video;
+        OMX_IMAGE_PORTDEFINITIONTYPE image;
+        OMX_OTHER_PORTDEFINITIONTYPE other;
+    } format;
+    OMX_BOOL bBuffersContiguous;
+    OMX_U32 nBufferAlignment;
+} OMX_PARAM_PORTDEFINITIONTYPE;
+
+/** @ingroup comp */
+typedef struct OMX_PARAM_U32TYPE { 
+    OMX_U32 nSize;                    /**< Size of this structure, in Bytes */ 
+    OMX_VERSIONTYPE nVersion;         /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;               /**< port that this structure applies to */ 
+    OMX_U32 nU32;                     /**< U32 value */
+} OMX_PARAM_U32TYPE;
+
+/** @ingroup rpm */
+typedef enum OMX_SUSPENSIONPOLICYTYPE {
+    OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */
+    OMX_SuspensionEnabled,  /**< Suspension allowed */   
+    OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_SuspensionPolicyMax = 0x7fffffff
+} OMX_SUSPENSIONPOLICYTYPE;
+
+/** @ingroup rpm */
+typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE {
+    OMX_U32 nSize;                  
+    OMX_VERSIONTYPE nVersion;        
+    OMX_SUSPENSIONPOLICYTYPE ePolicy;
+} OMX_PARAM_SUSPENSIONPOLICYTYPE;
+
+/** @ingroup rpm */
+typedef enum OMX_SUSPENSIONTYPE {
+    OMX_NotSuspended, /**< component is not suspended */
+    OMX_Suspended,    /**< component is suspended */
+    OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_SuspendMax = 0x7FFFFFFF
+} OMX_SUSPENSIONTYPE;
+
+/** @ingroup rpm */
+typedef struct OMX_PARAM_SUSPENSIONTYPE {
+    OMX_U32 nSize;                  
+    OMX_VERSIONTYPE nVersion;       
+    OMX_SUSPENSIONTYPE eType;             
+} OMX_PARAM_SUSPENSIONTYPE ;
+
+typedef struct OMX_CONFIG_BOOLEANTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_BOOL bEnabled;    
+} OMX_CONFIG_BOOLEANTYPE;
+
+/* Parameter specifying the content uri to use. */
+/** @ingroup cp */
+typedef struct OMX_PARAM_CONTENTURITYPE
+{
+    OMX_U32 nSize;                      /**< size of the structure in bytes, including
+                                             actual URI name */
+    OMX_VERSIONTYPE nVersion;           /**< OMX specification version information */
+    OMX_U8 contentURI[1];               /**< The URI name */
+} OMX_PARAM_CONTENTURITYPE;
+
+/* Parameter specifying the pipe to use. */
+/** @ingroup cp */
+typedef struct OMX_PARAM_CONTENTPIPETYPE
+{
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_HANDLETYPE hPipe;       /**< The pipe handle*/
+} OMX_PARAM_CONTENTPIPETYPE;
+
+/** @ingroup rpm */
+typedef struct OMX_RESOURCECONCEALMENTTYPE {
+    OMX_U32 nSize;             /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+    OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment 
+                                            methods (like degrading algorithm quality to 
+                                            lower resource consumption or functional bypass) 
+                                            on a component as a resolution to resource conflicts. */
+} OMX_RESOURCECONCEALMENTTYPE;
+
+
+/** @ingroup metadata */
+typedef enum OMX_METADATACHARSETTYPE {
+    OMX_MetadataCharsetUnknown = 0,
+    OMX_MetadataCharsetASCII,
+    OMX_MetadataCharsetBinary,
+    OMX_MetadataCharsetCodePage1252,
+    OMX_MetadataCharsetUTF8,
+    OMX_MetadataCharsetJavaConformantUTF8,
+    OMX_MetadataCharsetUTF7,
+    OMX_MetadataCharsetImapUTF7,
+    OMX_MetadataCharsetUTF16LE, 
+    OMX_MetadataCharsetUTF16BE,
+    OMX_MetadataCharsetGB12345,
+    OMX_MetadataCharsetHZGB2312,
+    OMX_MetadataCharsetGB2312,
+    OMX_MetadataCharsetGB18030,
+    OMX_MetadataCharsetGBK,
+    OMX_MetadataCharsetBig5,
+    OMX_MetadataCharsetISO88591,
+    OMX_MetadataCharsetISO88592,
+    OMX_MetadataCharsetISO88593,
+    OMX_MetadataCharsetISO88594,
+    OMX_MetadataCharsetISO88595,
+    OMX_MetadataCharsetISO88596,
+    OMX_MetadataCharsetISO88597,
+    OMX_MetadataCharsetISO88598,
+    OMX_MetadataCharsetISO88599,
+    OMX_MetadataCharsetISO885910,
+    OMX_MetadataCharsetISO885913,
+    OMX_MetadataCharsetISO885914,
+    OMX_MetadataCharsetISO885915,
+    OMX_MetadataCharsetShiftJIS,
+    OMX_MetadataCharsetISO2022JP,
+    OMX_MetadataCharsetISO2022JP1,
+    OMX_MetadataCharsetISOEUCJP,
+    OMX_MetadataCharsetSMS7Bit,
+    OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_MetadataCharsetTypeMax= 0x7FFFFFFF
+} OMX_METADATACHARSETTYPE;
+
+/** @ingroup metadata */
+typedef enum OMX_METADATASCOPETYPE
+{
+    OMX_MetadataScopeAllLevels,
+    OMX_MetadataScopeTopLevel,
+    OMX_MetadataScopePortLevel,
+    OMX_MetadataScopeNodeLevel,
+    OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_MetadataScopeTypeMax = 0x7fffffff
+} OMX_METADATASCOPETYPE;
+
+/** @ingroup metadata */
+typedef enum OMX_METADATASEARCHMODETYPE
+{
+    OMX_MetadataSearchValueSizeByIndex,
+    OMX_MetadataSearchItemByIndex,
+    OMX_MetadataSearchNextItemByKey,
+    OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_MetadataSearchTypeMax = 0x7fffffff
+} OMX_METADATASEARCHMODETYPE;
+/** @ingroup metadata */
+typedef struct OMX_CONFIG_METADATAITEMCOUNTTYPE
+{
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_METADATASCOPETYPE eScopeMode;
+    OMX_U32 nScopeSpecifier;
+    OMX_U32 nMetadataItemCount;
+} OMX_CONFIG_METADATAITEMCOUNTTYPE;
+
+/** @ingroup metadata */
+typedef struct OMX_CONFIG_METADATAITEMTYPE
+{
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_METADATASCOPETYPE eScopeMode;
+    OMX_U32 nScopeSpecifier;
+    OMX_U32 nMetadataItemIndex;  
+    OMX_METADATASEARCHMODETYPE eSearchMode;
+    OMX_METADATACHARSETTYPE eKeyCharset;
+    OMX_U8 nKeySizeUsed;
+    OMX_U8 nKey[128];
+    OMX_METADATACHARSETTYPE eValueCharset;
+    OMX_STRING sLanguageCountry;
+    OMX_U32 nValueMaxSize;
+    OMX_U32 nValueSizeUsed;
+    OMX_U8 nValue[1];
+} OMX_CONFIG_METADATAITEMTYPE;
+
+/* @ingroup metadata */
+typedef struct OMX_CONFIG_CONTAINERNODECOUNTTYPE
+{
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_BOOL bAllKeys;
+    OMX_U32 nParentNodeID;
+    OMX_U32 nNumNodes;
+} OMX_CONFIG_CONTAINERNODECOUNTTYPE;
+
+/** @ingroup metadata */
+typedef struct OMX_CONFIG_CONTAINERNODEIDTYPE
+{
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_BOOL bAllKeys;
+    OMX_U32 nParentNodeID;
+    OMX_U32 nNodeIndex; 
+    OMX_U32 nNodeID; 
+    OMX_STRING cNodeName;
+    OMX_BOOL bIsLeafType;
+} OMX_CONFIG_CONTAINERNODEIDTYPE;
+
+/** @ingroup metadata */
+typedef struct OMX_PARAM_METADATAFILTERTYPE 
+{ 
+    OMX_U32 nSize; 
+    OMX_VERSIONTYPE nVersion; 
+    OMX_BOOL bAllKeys;	/* if true then this structure refers to all keys and 
+                         * the three key fields below are ignored */
+    OMX_METADATACHARSETTYPE eKeyCharset;
+    OMX_U32 nKeySizeUsed; 
+    OMX_U8   nKey [128]; 
+    OMX_U32 nLanguageCountrySizeUsed;
+    OMX_U8 nLanguageCountry[128];
+    OMX_BOOL bEnabled;	/* if true then key is part of filter (e.g. 
+                         * retained for query later). If false then
+                         * key is not part of filter */
+} OMX_PARAM_METADATAFILTERTYPE; 
+
+/** The OMX_HANDLETYPE structure defines the component handle.  The component 
+ *  handle is used to access all of the component's public methods and also
+ *  contains pointers to the component's private data area.  The component
+ *  handle is initialized by the OMX core (with help from the component)
+ *  during the process of loading the component.  After the component is
+ *  successfully loaded, the application can safely access any of the
+ *  component's public functions (although some may return an error because
+ *  the state is inappropriate for the access).
+ * 
+ *  @ingroup comp
+ */
+typedef struct OMX_COMPONENTTYPE
+{
+    /** The size of this structure, in bytes.  It is the responsibility
+        of the allocator of this structure to fill in this value.  Since
+        this structure is allocated by the GetHandle function, this
+        function will fill in this value. */
+    OMX_U32 nSize;
+
+    /** nVersion is the version of the OMX specification that the structure 
+        is built against.  It is the responsibility of the creator of this 
+        structure to initialize this value and every user of this structure 
+        should verify that it knows how to use the exact version of 
+        this structure found herein. */
+    OMX_VERSIONTYPE nVersion;
+
+    /** pComponentPrivate is a pointer to the component private data area.  
+        This member is allocated and initialized by the component when the 
+        component is first loaded.  The application should not access this 
+        data area. */
+    OMX_PTR pComponentPrivate;
+
+    /** pApplicationPrivate is a pointer that is a parameter to the 
+        OMX_GetHandle method, and contains an application private value 
+        provided by the IL client.  This application private data is 
+        returned to the IL Client by OMX in all callbacks */
+    OMX_PTR pApplicationPrivate;
+
+    /** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL 
+        specification for details on the GetComponentVersion method.
+     */
+    OMX_ERRORTYPE (*GetComponentVersion)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_OUT OMX_STRING pComponentName,
+            OMX_OUT OMX_VERSIONTYPE* pComponentVersion,
+            OMX_OUT OMX_VERSIONTYPE* pSpecVersion,
+            OMX_OUT OMX_UUIDTYPE* pComponentUUID);
+
+    /** refer to OMX_SendCommand in OMX_core.h or the OMX IL 
+        specification for details on the SendCommand method.
+     */
+    OMX_ERRORTYPE (*SendCommand)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_IN  OMX_COMMANDTYPE Cmd,
+            OMX_IN  OMX_U32 nParam1,
+            OMX_IN  OMX_PTR pCmdData);
+
+    /** refer to OMX_GetParameter in OMX_core.h or the OMX IL 
+        specification for details on the GetParameter method.
+     */
+    OMX_ERRORTYPE (*GetParameter)(
+            OMX_IN  OMX_HANDLETYPE hComponent, 
+            OMX_IN  OMX_INDEXTYPE nParamIndex,  
+            OMX_INOUT OMX_PTR pComponentParameterStructure);
+
+
+    /** refer to OMX_SetParameter in OMX_core.h or the OMX IL 
+        specification for details on the SetParameter method.
+     */
+    OMX_ERRORTYPE (*SetParameter)(
+            OMX_IN  OMX_HANDLETYPE hComponent, 
+            OMX_IN  OMX_INDEXTYPE nIndex,
+            OMX_IN  OMX_PTR pComponentParameterStructure);
+
+
+    /** refer to OMX_GetConfig in OMX_core.h or the OMX IL 
+        specification for details on the GetConfig method.
+     */
+    OMX_ERRORTYPE (*GetConfig)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_IN  OMX_INDEXTYPE nIndex, 
+            OMX_INOUT OMX_PTR pComponentConfigStructure);
+
+
+    /** refer to OMX_SetConfig in OMX_core.h or the OMX IL 
+        specification for details on the SetConfig method.
+     */
+    OMX_ERRORTYPE (*SetConfig)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_IN  OMX_INDEXTYPE nIndex, 
+            OMX_IN  OMX_PTR pComponentConfigStructure);
+
+
+    /** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL 
+        specification for details on the GetExtensionIndex method.
+     */
+    OMX_ERRORTYPE (*GetExtensionIndex)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_IN  OMX_STRING cParameterName,
+            OMX_OUT OMX_INDEXTYPE* pIndexType);
+
+
+    /** refer to OMX_GetState in OMX_core.h or the OMX IL 
+        specification for details on the GetState method.
+     */
+    OMX_ERRORTYPE (*GetState)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_OUT OMX_STATETYPE* pState);
+
+    
+    /** The ComponentTunnelRequest method will interact with another OMX
+        component to determine if tunneling is possible and to setup the
+        tunneling.  The return codes for this method can be used to 
+        determine if tunneling is not possible, or if tunneling is not
+        supported.  
+        
+        Base profile components (i.e. non-interop) do not support this
+        method and should return OMX_ErrorNotImplemented 
+
+        The interop profile component MUST support tunneling to another 
+        interop profile component with a compatible port parameters.  
+        A component may also support proprietary communication.
+        
+        If proprietary communication is supported the negotiation of 
+        proprietary communication is done outside of OMX in a vendor 
+        specific way. It is only required that the proper result be 
+        returned and the details of how the setup is done is left 
+        to the component implementation.  
+    
+        When this method is invoked when nPort in an output port, the
+        component will:
+        1.  Populate the pTunnelSetup structure with the output port's 
+            requirements and constraints for the tunnel.
+
+        When this method is invoked when nPort in an input port, the
+        component will:
+        1.  Query the necessary parameters from the output port to 
+            determine if the ports are compatible for tunneling
+        2.  If the ports are compatible, the component should store
+            the tunnel step provided by the output port
+        3.  Determine which port (either input or output) is the buffer
+            supplier, and call OMX_SetParameter on the output port to
+            indicate this selection.
+        
+        The component will return from this call within 5 msec.
+    
+        @param [in] hComp
+            Handle of the component to be accessed.  This is the component
+            handle returned by the call to the OMX_GetHandle method.
+        @param [in] nPort
+            nPort is used to select the port on the component to be used
+            for tunneling.
+        @param [in] hTunneledComp
+            Handle of the component to tunnel with.  This is the component 
+            handle returned by the call to the OMX_GetHandle method.  When
+            this parameter is 0x0 the component should setup the port for
+            communication with the application / IL Client.
+        @param [in] nPortOutput
+            nPortOutput is used indicate the port the component should
+            tunnel with.
+        @param [in] pTunnelSetup
+            Pointer to the tunnel setup structure.  When nPort is an output port
+            the component should populate the fields of this structure.  When
+            When nPort is an input port the component should review the setup
+            provided by the component with the output port.
+        @return OMX_ERRORTYPE
+            If the command successfully executes, the return code will be
+            OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+        @ingroup tun
+    */
+
+    OMX_ERRORTYPE (*ComponentTunnelRequest)(
+        OMX_IN  OMX_HANDLETYPE hComp,
+        OMX_IN  OMX_U32 nPort,
+        OMX_IN  OMX_HANDLETYPE hTunneledComp,
+        OMX_IN  OMX_U32 nTunneledPort,
+        OMX_INOUT  OMX_TUNNELSETUPTYPE* pTunnelSetup); 
+
+    /** refer to OMX_UseBuffer in OMX_core.h or the OMX IL 
+        specification for details on the UseBuffer method.
+        @ingroup buf
+     */
+    OMX_ERRORTYPE (*UseBuffer)(
+            OMX_IN OMX_HANDLETYPE hComponent,
+            OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
+            OMX_IN OMX_U32 nPortIndex,
+            OMX_IN OMX_PTR pAppPrivate,
+            OMX_IN OMX_U32 nSizeBytes,
+            OMX_IN OMX_U8* pBuffer);
+
+    /** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL 
+        specification for details on the AllocateBuffer method.
+        @ingroup buf
+     */
+    OMX_ERRORTYPE (*AllocateBuffer)(
+            OMX_IN OMX_HANDLETYPE hComponent,
+            OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer,
+            OMX_IN OMX_U32 nPortIndex,
+            OMX_IN OMX_PTR pAppPrivate,
+            OMX_IN OMX_U32 nSizeBytes);
+
+    /** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL 
+        specification for details on the FreeBuffer method.
+        @ingroup buf
+     */
+    OMX_ERRORTYPE (*FreeBuffer)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_IN  OMX_U32 nPortIndex,
+            OMX_IN  OMX_BUFFERHEADERTYPE* pBuffer);
+
+    /** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL 
+        specification for details on the EmptyThisBuffer method.
+        @ingroup buf
+     */
+    OMX_ERRORTYPE (*EmptyThisBuffer)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_IN  OMX_BUFFERHEADERTYPE* pBuffer);
+
+    /** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL 
+        specification for details on the FillThisBuffer method.
+        @ingroup buf
+     */
+    OMX_ERRORTYPE (*FillThisBuffer)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_IN  OMX_BUFFERHEADERTYPE* pBuffer);
+
+    /** The SetCallbacks method is used by the core to specify the callback
+        structure from the application to the component.  This is a blocking
+        call.  The component will return from this call within 5 msec.
+        @param [in] hComponent
+            Handle of the component to be accessed.  This is the component
+            handle returned by the call to the GetHandle function.
+        @param [in] pCallbacks
+            pointer to an OMX_CALLBACKTYPE structure used to provide the 
+            callback information to the component
+        @param [in] pAppData
+            pointer to an application defined value.  It is anticipated that 
+            the application will pass a pointer to a data structure or a "this
+            pointer" in this area to allow the callback (in the application)
+            to determine the context of the call
+        @return OMX_ERRORTYPE
+            If the command successfully executes, the return code will be
+            OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+     */
+    OMX_ERRORTYPE (*SetCallbacks)(
+            OMX_IN  OMX_HANDLETYPE hComponent,
+            OMX_IN  OMX_CALLBACKTYPE* pCallbacks, 
+            OMX_IN  OMX_PTR pAppData);
+
+    /** ComponentDeInit method is used to deinitialize the component
+        providing a means to free any resources allocated at component
+        initialization.  NOTE:  After this call the component handle is
+        not valid for further use.
+        @param [in] hComponent
+            Handle of the component to be accessed.  This is the component
+            handle returned by the call to the GetHandle function.
+        @return OMX_ERRORTYPE
+            If the command successfully executes, the return code will be
+            OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+     */
+    OMX_ERRORTYPE (*ComponentDeInit)(
+            OMX_IN  OMX_HANDLETYPE hComponent);
+
+    /** @ingroup buf */
+    OMX_ERRORTYPE (*UseEGLImage)(
+            OMX_IN OMX_HANDLETYPE hComponent,
+            OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
+            OMX_IN OMX_U32 nPortIndex,
+            OMX_IN OMX_PTR pAppPrivate,
+            OMX_IN void* eglImage);
+
+    OMX_ERRORTYPE (*ComponentRoleEnum)(
+        OMX_IN OMX_HANDLETYPE hComponent,
+		OMX_OUT OMX_U8 *cRole,
+		OMX_IN OMX_U32 nIndex);
+
+} OMX_COMPONENTTYPE;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_ContentPipe.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_ContentPipe.h
new file mode 100644
index 0000000..5f6310c
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_ContentPipe.h
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ *
+ */
+
+/** OMX_ContentPipe.h - OpenMax IL version 1.1.2
+ *  The OMX_ContentPipe header file contains the definitions used to define
+ *  the public interface for content piples.  This header file is intended to
+ *  be used by the component.
+ */
+
+#ifndef OMX_CONTENTPIPE_H
+#define OMX_CONTENTPIPE_H
+
+#ifndef KD_EACCES
+/* OpenKODE error codes. CPResult values may be zero (indicating success
+   or one of the following values) */
+#define KD_EACCES (1)
+#define KD_EADDRINUSE (2)
+#define KD_EAGAIN (5)
+#define KD_EBADF (7)
+#define KD_EBUSY (8)
+#define KD_ECONNREFUSED (9)
+#define KD_ECONNRESET (10)
+#define KD_EDEADLK (11)
+#define KD_EDESTADDRREQ (12)
+#define KD_ERANGE (35)
+#define KD_EEXIST (13)
+#define KD_EFBIG (14)
+#define KD_EHOSTUNREACH (15)
+#define KD_EINVAL (17)
+#define KD_EIO (18)
+#define KD_EISCONN (20)
+#define KD_EISDIR (21)
+#define KD_EMFILE (22)
+#define KD_ENAMETOOLONG (23)
+#define KD_ENOENT (24)
+#define KD_ENOMEM (25)
+#define KD_ENOSPC (26)
+#define KD_ENOSYS (27)
+#define KD_ENOTCONN (28)
+#define KD_EPERM (33)
+#define KD_ETIMEDOUT (36)
+#define KD_EILSEQ (19)
+#endif
+
+/** Map types from OMX standard types only here so interface is as generic as possible. */
+typedef OMX_U32    CPresult;
+typedef char *     CPstring;  
+typedef void *     CPhandle;
+typedef OMX_U32    CPuint;
+typedef OMX_S32    CPint;  
+typedef char       CPbyte;  
+typedef OMX_BOOL   CPbool;
+
+/** enumeration of origin types used in the CP_PIPETYPE's Seek function 
+ * @ingroup cp
+ */
+typedef enum CP_ORIGINTYPE {
+    CP_OriginBegin,      
+    CP_OriginCur,      
+    CP_OriginEnd,      
+    CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    CP_OriginVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    CP_OriginMax = 0X7FFFFFFF
+} CP_ORIGINTYPE;
+
+/** enumeration of contact access types used in the CP_PIPETYPE's Open function 
+ * @ingroup cp
+ */
+typedef enum CP_ACCESSTYPE {
+    CP_AccessRead,      
+    CP_AccessWrite,  
+    CP_AccessReadWrite ,  
+    CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    CP_AccessVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    CP_AccessMax = 0X7FFFFFFF
+} CP_ACCESSTYPE;
+
+/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function 
+ * @ingroup cp
+ */
+typedef enum CP_CHECKBYTESRESULTTYPE
+{
+    CP_CheckBytesOk,                    /**< There are at least the request number 
+                                              of bytes available */
+    CP_CheckBytesNotReady,              /**< The pipe is still retrieving bytes 
+                                              and presently lacks sufficient bytes. 
+                                              Client will be called when they are 
+                                              sufficient bytes are available. */
+    CP_CheckBytesInsufficientBytes  ,     /**< The pipe has retrieved all bytes 
+                                              but those available are less than those 
+                                              requested */
+    CP_CheckBytesAtEndOfStream,         /**< The pipe has reached the end of stream
+                                              and no more bytes are available. */
+    CP_CheckBytesOutOfBuffers,          /**< All read/write buffers are currently in use. */
+    CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    CP_CheckBytesVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    CP_CheckBytesMax = 0X7FFFFFFF
+} CP_CHECKBYTESRESULTTYPE;
+
+/** enumeration of content pipe events sent to the client callback. 
+ * @ingroup cp
+ */
+typedef enum CP_EVENTTYPE{
+    CP_BytesAvailable,      	    /** bytes requested in a CheckAvailableBytes call are now available*/
+    CP_Overflow,  		           /** enumeration of content pipe events sent to the client callback*/
+    CP_PipeDisconnected  ,  		    /** enumeration of content pipe events sent to the client callback*/
+    CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    CP_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    CP_EventMax = 0X7FFFFFFF
+} CP_EVENTTYPE;
+
+/** content pipe definition 
+ * @ingroup cp
+ */
+typedef struct CP_PIPETYPE
+{
+    /** Open a content stream for reading or writing. */ 
+    CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess );
+
+    /** Close a content stream. */ 
+    CPresult (*Close)( CPhandle hContent );
+
+    /** Create a content source and open it for writing. */ 
+    CPresult (*Create)( CPhandle *hContent, CPstring szURI );
+
+    /** Check the that specified number of bytes are available for reading or writing (depending on access type).*/
+    CPresult (*CheckAvailableBytes)( CPhandle hContent, CPuint nBytesRequested, CP_CHECKBYTESRESULTTYPE *eResult );
+
+    /** Seek to certain position in the content relative to the specified origin. */
+    CPresult (*SetPosition)( CPhandle  hContent, CPint nOffset, CP_ORIGINTYPE eOrigin);
+
+    /** Retrieve the current position relative to the start of the content. */
+    CPresult (*GetPosition)( CPhandle hContent, CPuint *pPosition);
+
+    /** Retrieve data of the specified size from the content stream (advance content pointer by size of data).
+       Note: pipe client provides pointer. This function is appropriate for small high frequency reads. */
+    CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize); 
+
+    /** Retrieve a buffer allocated by the pipe that contains the requested number of bytes. 
+       Buffer contains the next block of bytes, as specified by nSize, of the content. nSize also
+       returns the size of the block actually read. Content pointer advances the by the returned size. 
+       Note: pipe provides pointer. This function is appropriate for large reads. The client must call 
+       ReleaseReadBuffer when done with buffer. 
+
+       In some cases the requested block may not reside in contiguous memory within the
+       pipe implementation. For instance if the pipe leverages a circular buffer then the requested 
+       block may straddle the boundary of the circular buffer. By default a pipe implementation 
+       performs a copy in this case to provide the block to the pipe client in one contiguous buffer.
+       If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory 
+       boundary. Here the client may retrieve the data in segments over successive calls. */
+    CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy);
+
+    /** Release a buffer obtained by ReadBuffer back to the pipe. */
+    CPresult (*ReleaseReadBuffer)(CPhandle hContent, CPbyte *pBuffer);
+
+    /** Write data of the specified size to the content (advance content pointer by size of data).
+       Note: pipe client provides pointer. This function is appropriate for small high frequency writes. */
+    CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize); 
+
+    /** Retrieve a buffer allocated by the pipe used to write data to the content. 
+       Client will fill buffer with output data. Note: pipe provides pointer. This function is appropriate
+       for large writes. The client must call WriteBuffer when done it has filled the buffer with data.*/
+    CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize);
+
+    /** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the 
+       the contents of the buffer to content and advance content pointer by the size of the buffer */
+    CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize);
+
+    /** Register a per-handle client callback with the content pipe. */
+    CPresult (*RegisterCallback)( CPhandle hContent, CPresult (*ClientCallback)(CP_EVENTTYPE eEvent, CPuint iParam));
+
+} CP_PIPETYPE;
+
+#endif
+
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Core.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Core.h
new file mode 100644
index 0000000..a076f2f
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Core.h
@@ -0,0 +1,1431 @@
+/*
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ *
+ */
+
+/** OMX_Core.h - OpenMax IL version 1.1.2
+ *  The OMX_Core header file contains the definitions used by both the
+ *  application and the component to access common items.
+ */
+
+#ifndef OMX_Core_h
+#define OMX_Core_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* Each OMX header shall include all required header files to allow the
+ *  header to compile without errors.  The includes below are required
+ *  for this header file to compile successfully 
+ */
+
+#include <OMX_Index.h>
+
+
+/** The OMX_COMMANDTYPE enumeration is used to specify the action in the
+ *  OMX_SendCommand macro.  
+ *  @ingroup core
+ */
+typedef enum OMX_COMMANDTYPE
+{
+    OMX_CommandStateSet,    /**< Change the component state */
+    OMX_CommandFlush,       /**< Flush the data queue(s) of a component */
+    OMX_CommandPortDisable, /**< Disable a port on a component. */
+    OMX_CommandPortEnable,  /**< Enable a port on a component. */
+    OMX_CommandMarkBuffer,  /**< Mark a component/buffer for observation */
+    OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_CommandMax = 0X7FFFFFFF
+} OMX_COMMANDTYPE;
+
+
+
+/** The OMX_STATETYPE enumeration is used to indicate or change the component
+ *  state.  This enumeration reflects the current state of the component when
+ *  used with the OMX_GetState macro or becomes the parameter in a state change
+ *  command when used with the OMX_SendCommand macro.
+ *
+ *  The component will be in the Loaded state after the component is initially
+ *  loaded into memory.  In the Loaded state, the component is not allowed to
+ *  allocate or hold resources other than to build it's internal parameter
+ *  and configuration tables.  The application will send one or more
+ *  SetParameters/GetParameters and SetConfig/GetConfig commands to the
+ *  component and the component will record each of these parameter and
+ *  configuration changes for use later.  When the application sends the
+ *  Idle command, the component will acquire the resources needed for the
+ *  specified configuration and will transition to the idle state if the
+ *  allocation is successful.  If the component cannot successfully
+ *  transition to the idle state for any reason, the state of the component
+ *  shall be fully rolled back to the Loaded state (e.g. all allocated 
+ *  resources shall be released).  When the component receives the command
+ *  to go to the Executing state, it shall begin processing buffers by
+ *  sending all input buffers it holds to the application.  While
+ *  the component is in the Idle state, the application may also send the
+ *  Pause command.  If the component receives the pause command while in the
+ *  Idle state, the component shall send all input buffers it holds to the 
+ *  application, but shall not begin processing buffers.  This will allow the
+ *  application to prefill buffers.
+ * 
+ *  @ingroup comp
+ */
+
+typedef enum OMX_STATETYPE
+{
+    OMX_StateInvalid,      /**< component has detected that it's internal data 
+                                structures are corrupted to the point that
+                                it cannot determine it's state properly */
+    OMX_StateLoaded,      /**< component has been loaded but has not completed
+                                initialization.  The OMX_SetParameter macro
+                                and the OMX_GetParameter macro are the only 
+                                valid macros allowed to be sent to the 
+                                component in this state. */
+    OMX_StateIdle,        /**< component initialization has been completed
+                                successfully and the component is ready to
+                                to start. */
+    OMX_StateExecuting,   /**< component has accepted the start command and
+                                is processing data (if data is available) */
+    OMX_StatePause,       /**< component has received pause command */
+    OMX_StateWaitForResources, /**< component is waiting for resources, either after 
+                                preemption or before it gets the resources requested.
+                                See specification for complete details. */
+    OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_StateMax = 0X7FFFFFFF
+} OMX_STATETYPE;
+
+/** The OMX_ERRORTYPE enumeration defines the standard OMX Errors.  These 
+ *  errors should cover most of the common failure cases.  However, 
+ *  vendors are free to add additional error messages of their own as 
+ *  long as they follow these rules:
+ *  1.  Vendor error messages shall be in the range of 0x90000000 to
+ *      0x9000FFFF.
+ *  2.  Vendor error messages shall be defined in a header file provided
+ *      with the component.  No error messages are allowed that are
+ *      not defined.
+ */
+typedef enum OMX_ERRORTYPE
+{
+  OMX_ErrorNone = 0,
+
+  /** There were insufficient resources to perform the requested operation */
+  OMX_ErrorInsufficientResources = (OMX_S32) 0x80001000,
+
+  /** There was an error, but the cause of the error could not be determined */
+  OMX_ErrorUndefined = (OMX_S32) 0x80001001,
+
+  /** The component name string was not valid */
+  OMX_ErrorInvalidComponentName = (OMX_S32) 0x80001002,
+
+  /** No component with the specified name string was found */
+  OMX_ErrorComponentNotFound = (OMX_S32) 0x80001003,
+
+  /** The component specified did not have a "OMX_ComponentInit" or
+      "OMX_ComponentDeInit entry point */
+  OMX_ErrorInvalidComponent = (OMX_S32) 0x80001004,
+
+  /** One or more parameters were not valid */
+  OMX_ErrorBadParameter = (OMX_S32) 0x80001005,
+
+  /** The requested function is not implemented */
+  OMX_ErrorNotImplemented = (OMX_S32) 0x80001006,
+
+  /** The buffer was emptied before the next buffer was ready */
+  OMX_ErrorUnderflow = (OMX_S32) 0x80001007,
+
+  /** The buffer was not available when it was needed */
+  OMX_ErrorOverflow = (OMX_S32) 0x80001008,
+
+  /** The hardware failed to respond as expected */
+  OMX_ErrorHardware = (OMX_S32) 0x80001009,
+
+  /** The component is in the state OMX_StateInvalid */
+  OMX_ErrorInvalidState = (OMX_S32) 0x8000100A,
+
+  /** Stream is found to be corrupt */
+  OMX_ErrorStreamCorrupt = (OMX_S32) 0x8000100B,
+
+  /** Ports being connected are not compatible */
+  OMX_ErrorPortsNotCompatible = (OMX_S32) 0x8000100C,
+
+  /** Resources allocated to an idle component have been
+      lost resulting in the component returning to the loaded state */
+  OMX_ErrorResourcesLost = (OMX_S32) 0x8000100D,
+
+  /** No more indicies can be enumerated */
+  OMX_ErrorNoMore = (OMX_S32) 0x8000100E,
+
+  /** The component detected a version mismatch */
+  OMX_ErrorVersionMismatch = (OMX_S32) 0x8000100F,
+
+  /** The component is not ready to return data at this time */
+  OMX_ErrorNotReady = (OMX_S32) 0x80001010,
+
+  /** There was a timeout that occurred */
+  OMX_ErrorTimeout = (OMX_S32) 0x80001011,
+
+  /** This error occurs when trying to transition into the state you are already in */
+  OMX_ErrorSameState = (OMX_S32) 0x80001012,
+
+  /** Resources allocated to an executing or paused component have been 
+      preempted, causing the component to return to the idle state */
+  OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013, 
+
+  /** A non-supplier port sends this error to the IL client (via the EventHandler callback) 
+      during the allocation of buffers (on a transition from the LOADED to the IDLE state or
+      on a port restart) when it deems that it has waited an unusually long time for the supplier 
+      to send it an allocated buffer via a UseBuffer call. */
+  OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014,
+
+  /** A non-supplier port sends this error to the IL client (via the EventHandler callback) 
+      during the deallocation of buffers (on a transition from the IDLE to LOADED state or 
+      on a port stop) when it deems that it has waited an unusually long time for the supplier 
+      to request the deallocation of a buffer header via a FreeBuffer call. */
+  OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015,
+
+  /** A supplier port sends this error to the IL client (via the EventHandler callback) 
+      during the stopping of a port (either on a transition from the IDLE to LOADED 
+      state or a port stop) when it deems that it has waited an unusually long time for 
+      the non-supplier to return a buffer via an EmptyThisBuffer or FillThisBuffer call. */
+  OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016,
+
+  /** Attempting a state transtion that is not allowed */
+  OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017,
+
+  /* Attempting a command that is not allowed during the present state. */
+  OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018, 
+
+  /** The values encapsulated in the parameter or config structure are not supported. */
+  OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019,
+
+  /** The parameter or config indicated by the given index is not supported. */
+  OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A,
+
+  /** The port index supplied is incorrect. */
+  OMX_ErrorBadPortIndex = (OMX_S32) 0x8000101B,
+
+  /** The port has lost one or more of its buffers and it thus unpopulated. */
+  OMX_ErrorPortUnpopulated = (OMX_S32) 0x8000101C,
+
+  /** Component suspended due to temporary loss of resources */
+  OMX_ErrorComponentSuspended = (OMX_S32) 0x8000101D,
+
+  /** Component suspended due to an inability to acquire dynamic resources */
+  OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E,
+
+  /** When the macroblock error reporting is enabled the component returns new error 
+  for every frame that has errors */
+  OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F,
+
+  /** A component reports this error when it cannot parse or determine the format of an input stream. */
+  OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020, 
+
+  /** The content open operation failed. */
+  OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021,
+
+  /** The content creation operation failed. */
+  OMX_ErrorContentPipeCreationFailed = (OMX_S32) 0x80001022,
+
+  /** Separate table information is being used */
+  OMX_ErrorSeperateTablesUsed = (OMX_S32) 0x80001023,
+
+  /** Tunneling is unsupported by the component*/
+  OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024,
+
+  OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+  OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, /**< Reserved region for introducing Vendor Extensions */
+  OMX_ErrorMax = 0x7FFFFFFF
+} OMX_ERRORTYPE;
+
+/** @ingroup core */
+typedef OMX_ERRORTYPE (* OMX_COMPONENTINITTYPE)(OMX_IN  OMX_HANDLETYPE hComponent);
+
+/** @ingroup core */
+typedef struct OMX_COMPONENTREGISTERTYPE
+{
+  const char          * pName;       /* Component name, 128 byte limit (including '\0') applies */
+  OMX_COMPONENTINITTYPE pInitialize; /* Component instance initialization function */
+} OMX_COMPONENTREGISTERTYPE;
+
+/** @ingroup core */
+extern OMX_COMPONENTREGISTERTYPE OMX_ComponentRegistered[];
+
+/** @ingroup rpm */
+typedef struct OMX_PRIORITYMGMTTYPE {
+ OMX_U32 nSize;             /**< size of the structure in bytes */
+ OMX_VERSIONTYPE nVersion;  /**< OMX specification version information */
+ OMX_U32 nGroupPriority;            /**< Priority of the component group */
+ OMX_U32 nGroupID;                  /**< ID of the component group */
+} OMX_PRIORITYMGMTTYPE;
+
+/* Component name and Role names are limited to 128 characters including the terminating '\0'. */
+#define OMX_MAX_STRINGNAME_SIZE 128
+
+/** @ingroup comp */
+typedef struct OMX_PARAM_COMPONENTROLETYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE];  /**< name of standard component which defines component role */
+} OMX_PARAM_COMPONENTROLETYPE;
+
+/** End of Stream Buffer Flag: 
+  *
+  * A component sets EOS when it has no more data to emit on a particular 
+  * output port. Thus an output port shall set EOS on the last buffer it 
+  * emits. A component's determination of when an output port should 
+  * cease sending data is implemenation specific.
+  * @ingroup buf
+  */
+
+#define OMX_BUFFERFLAG_EOS 0x00000001 
+
+/** Start Time Buffer Flag: 
+ *
+ * The source of a stream (e.g. a demux component) sets the STARTTIME
+ * flag on the buffer that contains the starting timestamp for the
+ * stream. The starting timestamp corresponds to the first data that
+ * should be displayed at startup or after a seek.
+ * The first timestamp of the stream is not necessarily the start time.
+ * For instance, in the case of a seek to a particular video frame, 
+ * the target frame may be an interframe. Thus the first buffer of 
+ * the stream will be the intra-frame preceding the target frame and
+ * the starttime will occur with the target frame (with any other
+ * required frames required to reconstruct the target intervening).
+ *
+ * The STARTTIME flag is directly associated with the buffer's 
+ * timestamp ' thus its association to buffer data and its 
+ * propagation is identical to the timestamp's.
+ *
+ * When a Sync Component client receives a buffer with the 
+ * STARTTIME flag it shall perform a SetConfig on its sync port 
+ * using OMX_ConfigTimeClientStartTime and passing the buffer's
+ * timestamp.
+ * 
+ * @ingroup buf
+ */
+
+#define OMX_BUFFERFLAG_STARTTIME 0x00000002
+
+ 
+
+/** Decode Only Buffer Flag: 
+ *
+ * The source of a stream (e.g. a demux component) sets the DECODEONLY
+ * flag on any buffer that should shall be decoded but should not be
+ * displayed. This flag is used, for instance, when a source seeks to 
+ * a target interframe that requires the decode of frames preceding the 
+ * target to facilitate the target's reconstruction. In this case the 
+ * source would emit the frames preceding the target downstream 
+ * but mark them as decode only.
+ *
+ * The DECODEONLY is associated with buffer data and propagated in a 
+ * manner identical to the buffer timestamp.
+ *
+ * A component that renders data should ignore all buffers with 
+ * the DECODEONLY flag set.
+ * 
+ * @ingroup buf
+ */
+
+#define OMX_BUFFERFLAG_DECODEONLY 0x00000004
+
+
+/* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt 
+ * @ingroup buf
+ */
+
+#define OMX_BUFFERFLAG_DATACORRUPT 0x00000008
+
+/* End of Frame: The buffer contains exactly one end of frame and no data
+ *  occurs after the end of frame. This flag is an optional hint. The absence
+ *  of this flag does not imply the absence of an end of frame within the buffer. 
+ * @ingroup buf
+*/
+#define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010
+
+/* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame ' 
+ *  a frame that has no dependency on any other frame information 
+ *  @ingroup buf
+ */
+#define OMX_BUFFERFLAG_SYNCFRAME 0x00000020
+
+/* Extra data present flag: there is extra data appended to the data stream
+ * residing in the buffer 
+ * @ingroup buf  
+ */
+#define OMX_BUFFERFLAG_EXTRADATA 0x00000040
+
+/** Codec Config Buffer Flag: 
+* OMX_BUFFERFLAG_CODECCONFIG is an optional flag that is set by an
+* output port when all bytes in the buffer form part or all of a set of
+* codec specific configuration data.  Examples include SPS/PPS nal units
+* for OMX_VIDEO_CodingAVC or AudioSpecificConfig data for
+* OMX_AUDIO_CodingAAC.  Any component that for a given stream sets 
+* OMX_BUFFERFLAG_CODECCONFIG shall not mix codec configuration bytes
+* with frame data in the same buffer, and shall send all buffers
+* containing codec configuration bytes before any buffers containing
+* frame data that those configurations bytes describe.
+* If the stream format for a particular codec has a frame specific
+* header at the start of each frame, for example OMX_AUDIO_CodingMP3 or
+* OMX_AUDIO_CodingAAC in ADTS mode, then these shall be presented as
+* normal without setting OMX_BUFFERFLAG_CODECCONFIG.
+ * @ingroup buf
+ */
+#define OMX_BUFFERFLAG_CODECCONFIG 0x00000080
+
+
+
+/** @ingroup buf */
+typedef struct OMX_BUFFERHEADERTYPE
+{
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U8* pBuffer;            /**< Pointer to actual block of memory 
+                                     that is acting as the buffer */
+    OMX_U32 nAllocLen;          /**< size of the buffer allocated, in bytes */
+    OMX_U32 nFilledLen;         /**< number of bytes currently in the 
+                                     buffer */
+    OMX_U32 nOffset;            /**< start offset of valid data in bytes from
+                                     the start of the buffer */
+    OMX_PTR pAppPrivate;        /**< pointer to any data the application
+                                     wants to associate with this buffer */
+    OMX_PTR pPlatformPrivate;   /**< pointer to any data the platform
+                                     wants to associate with this buffer */ 
+    OMX_PTR pInputPortPrivate;  /**< pointer to any data the input port
+                                     wants to associate with this buffer */
+    OMX_PTR pOutputPortPrivate; /**< pointer to any data the output port
+                                     wants to associate with this buffer */
+    OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a 
+                                              mark event upon processing this buffer. */
+    OMX_PTR pMarkData;          /**< Application specific data associated with 
+                                     the mark sent on a mark event to disambiguate 
+                                     this mark from others. */
+    OMX_U32 nTickCount;         /**< Optional entry that the component and
+                                     application can update with a tick count
+                                     when they access the component.  This
+                                     value should be in microseconds.  Since
+                                     this is a value relative to an arbitrary
+                                     starting point, this value cannot be used 
+                                     to determine absolute time.  This is an
+                                     optional entry and not all components
+                                     will update it.*/
+ OMX_TICKS nTimeStamp;          /**< Timestamp corresponding to the sample 
+                                     starting at the first logical sample 
+                                     boundary in the buffer. Timestamps of 
+                                     successive samples within the buffer may
+                                     be inferred by adding the duration of the 
+                                     of the preceding buffer to the timestamp
+                                     of the preceding buffer.*/
+  OMX_U32     nFlags;           /**< buffer specific flags */
+  OMX_U32 nOutputPortIndex;     /**< The index of the output port (if any) using 
+                                     this buffer */
+  OMX_U32 nInputPortIndex;      /**< The index of the input port (if any) using
+                                     this buffer */
+} OMX_BUFFERHEADERTYPE;
+
+/** The OMX_EXTRADATATYPE enumeration is used to define the 
+ * possible extra data payload types.
+ * NB: this enum is binary backwards compatible with the previous
+ * OMX_EXTRADATA_QUANT define.  This should be replaced with
+ * OMX_ExtraDataQuantization.
+ */
+typedef enum OMX_EXTRADATATYPE
+{
+   OMX_ExtraDataNone = 0,                       /**< Indicates that no more extra data sections follow */        
+   OMX_ExtraDataQuantization,                   /**< The data payload contains quantization data */
+   OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+   OMX_ExtraDataVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+   OMX_ExtraDataMax = 0x7FFFFFFF
+} OMX_EXTRADATATYPE;
+
+
+typedef struct OMX_OTHER_EXTRADATATYPE  {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;               
+    OMX_U32 nPortIndex;
+    OMX_EXTRADATATYPE eType;       /* Extra Data type */
+    OMX_U32 nDataSize;   /* Size of the supporting data to follow */
+    OMX_U8  data[1];     /* Supporting data hint  */
+} OMX_OTHER_EXTRADATATYPE;
+
+/** @ingroup comp */
+typedef struct OMX_PORT_PARAM_TYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U32 nPorts;             /**< The number of ports for this component */
+    OMX_U32 nStartPortNumber;   /** first port number for this type of port */
+} OMX_PORT_PARAM_TYPE; 
+
+/** @ingroup comp */
+typedef enum OMX_EVENTTYPE
+{
+    OMX_EventCmdComplete,         /**< component has sucessfully completed a command */
+    OMX_EventError,               /**< component has detected an error condition */
+    OMX_EventMark,                /**< component has detected a buffer mark */
+    OMX_EventPortSettingsChanged, /**< component is reported a port settings change */
+    OMX_EventBufferFlag,          /**< component has detected an EOS */ 
+    OMX_EventResourcesAcquired,   /**< component has been granted resources and is
+                                       automatically starting the state change from
+                                       OMX_StateWaitForResources to OMX_StateIdle. */
+   OMX_EventComponentResumed,     /**< Component resumed due to reacquisition of resources */
+   OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */
+   OMX_EventPortFormatDetected,      /**< Component has detected a supported format. */
+   OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+   OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+   OMX_EventMax = 0x7FFFFFFF
+} OMX_EVENTTYPE;
+
+typedef struct OMX_CALLBACKTYPE
+{
+    /** The EventHandler method is used to notify the application when an
+        event of interest occurs.  Events are defined in the OMX_EVENTTYPE
+        enumeration.  Please see that enumeration for details of what will
+        be returned for each type of event. Callbacks should not return
+        an error to the component, so if an error occurs, the application 
+        shall handle it internally.  This is a blocking call.
+
+        The application should return from this call within 5 msec to avoid
+        blocking the component for an excessively long period of time.
+
+        @param hComponent
+            handle of the component to access.  This is the component
+            handle returned by the call to the GetHandle function.
+        @param pAppData
+            pointer to an application defined value that was provided in the 
+            pAppData parameter to the OMX_GetHandle method for the component.
+            This application defined value is provided so that the application 
+            can have a component specific context when receiving the callback.
+        @param eEvent
+            Event that the component wants to notify the application about.
+        @param nData1
+            nData will be the OMX_ERRORTYPE for an error event and will be 
+            an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event.
+         @param nData2
+            nData2 will hold further information related to the event. Can be OMX_STATETYPE for
+            a OMX_CommandStateSet command or port index for a OMX_PortSettingsChanged event.
+            Default value is 0 if not used. )
+        @param pEventData
+            Pointer to additional event-specific data (see spec for meaning).
+      */
+
+   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);
+
+    /** The EmptyBufferDone method is used to return emptied buffers from an
+        input port back to the application for reuse.  This is a blocking call 
+        so the application should not attempt to refill the buffers during this
+        call, but should queue them and refill them in another thread.  There
+        is no error return, so the application shall handle any errors generated
+        internally.  
+        
+        The application should return from this call within 5 msec.
+        
+        @param hComponent
+            handle of the component to access.  This is the component
+            handle returned by the call to the GetHandle function.
+        @param pAppData
+            pointer to an application defined value that was provided in the 
+            pAppData parameter to the OMX_GetHandle method for the component.
+            This application defined value is provided so that the application 
+            can have a component specific context when receiving the callback.
+        @param pBuffer
+            pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
+            or AllocateBuffer indicating the buffer that was emptied.
+        @ingroup buf
+     */
+    OMX_ERRORTYPE (*EmptyBufferDone)(
+        OMX_IN OMX_HANDLETYPE hComponent,
+        OMX_IN OMX_PTR pAppData,
+        OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
+
+    /** The FillBufferDone method is used to return filled buffers from an
+        output port back to the application for emptying and then reuse.  
+        This is a blocking call so the application should not attempt to 
+        empty the buffers during this call, but should queue the buffers 
+        and empty them in another thread.  There is no error return, so 
+        the application shall handle any errors generated internally.  The 
+        application shall also update the buffer header to indicate the
+        number of bytes placed into the buffer.  
+
+        The application should return from this call within 5 msec.
+        
+        @param hComponent
+            handle of the component to access.  This is the component
+            handle returned by the call to the GetHandle function.
+        @param pAppData
+            pointer to an application defined value that was provided in the 
+            pAppData parameter to the OMX_GetHandle method for the component.
+            This application defined value is provided so that the application 
+            can have a component specific context when receiving the callback.
+        @param pBuffer
+            pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
+            or AllocateBuffer indicating the buffer that was filled.
+        @ingroup buf
+     */
+    OMX_ERRORTYPE (*FillBufferDone)(
+        OMX_OUT OMX_HANDLETYPE hComponent,
+        OMX_OUT OMX_PTR pAppData,
+        OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
+
+} OMX_CALLBACKTYPE;
+
+/** The OMX_BUFFERSUPPLIERTYPE enumeration is used to dictate port supplier
+    preference when tunneling between two ports.
+    @ingroup tun buf
+*/
+typedef enum OMX_BUFFERSUPPLIERTYPE
+{
+    OMX_BufferSupplyUnspecified = 0x0, /**< port supplying the buffers is unspecified,
+                                              or don't care */
+    OMX_BufferSupplyInput,             /**< input port supplies the buffers */
+    OMX_BufferSupplyOutput,            /**< output port supplies the buffers */
+    OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_BufferSupplyMax = 0x7FFFFFFF
+} OMX_BUFFERSUPPLIERTYPE;
+
+
+/** buffer supplier parameter 
+ * @ingroup tun
+ */
+typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE {
+    OMX_U32 nSize; /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex; /**< port that this structure applies to */
+    OMX_BUFFERSUPPLIERTYPE eBufferSupplier; /**< buffer supplier */
+} OMX_PARAM_BUFFERSUPPLIERTYPE;
+
+
+/**< indicates that buffers received by an input port of a tunnel 
+     may not modify the data in the buffers 
+     @ingroup tun
+ */
+#define OMX_PORTTUNNELFLAG_READONLY 0x00000001 
+
+
+/** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output
+    port to an input port as part the two ComponentTunnelRequest calls
+    resulting from a OMX_SetupTunnel call from the IL Client. 
+    @ingroup tun
+ */   
+typedef struct OMX_TUNNELSETUPTYPE
+{
+    OMX_U32 nTunnelFlags;             /**< bit flags for tunneling */
+    OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */
+} OMX_TUNNELSETUPTYPE; 
+
+/* OMX Component headers is included to enable the core to use
+   macros for functions into the component for OMX release 1.0.  
+   Developers should not access any structures or data from within
+   the component header directly */
+/* TO BE REMOVED - #include <OMX_Component.h> */
+
+/** GetComponentVersion will return information about the component.  
+    This is a blocking call.  This macro will go directly from the
+    application to the component (via a core macro).  The
+    component will return from this call within 5 msec.
+    @param [in] hComponent
+        handle of component to execute the command
+    @param [out] pComponentName
+        pointer to an empty string of length 128 bytes.  The component 
+        will write its name into this string.  The name will be 
+        terminated by a single zero byte.  The name of a component will 
+        be 127 bytes or less to leave room for the trailing zero byte.  
+        An example of a valid component name is "OMX.ABC.ChannelMixer\0".
+    @param [out] pComponentVersion
+        pointer to an OMX Version structure that the component will fill 
+        in.  The component will fill in a value that indicates the 
+        component version.  NOTE: the component version is NOT the same 
+        as the OMX Specification version (found in all structures).  The 
+        component version is defined by the vendor of the component and 
+        its value is entirely up to the component vendor.
+    @param [out] pSpecVersion
+        pointer to an OMX Version structure that the component will fill 
+        in.  The SpecVersion is the version of the specification that the 
+        component was built against.  Please note that this value may or 
+        may not match the structure's version.  For example, if the 
+        component was built against the 2.0 specification, but the 
+        application (which creates the structure is built against the 
+        1.0 specification the versions would be different.
+    @param [out] pComponentUUID
+        pointer to the UUID of the component which will be filled in by 
+        the component.  The UUID is a unique identifier that is set at 
+        RUN time for the component and is unique to each instantion of 
+        the component.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp
+ */
+#define OMX_GetComponentVersion(                            \
+        hComponent,                                         \
+        pComponentName,                                     \
+        pComponentVersion,                                  \
+        pSpecVersion,                                       \
+        pComponentUUID)                                     \
+    ((OMX_COMPONENTTYPE*)hComponent)->GetComponentVersion(  \
+        hComponent,                                         \
+        pComponentName,                                     \
+        pComponentVersion,                                  \
+        pSpecVersion,                                       \
+        pComponentUUID)                 /* Macro End */
+
+
+/** Send a command to the component.  This call is a non-blocking call.
+    The component should check the parameters and then queue the command
+    to the component thread to be executed.  The component thread shall 
+    send the EventHandler() callback at the conclusion of the command. 
+    This macro will go directly from the application to the component (via
+    a core macro).  The component will return from this call within 5 msec.
+    
+    When the command is "OMX_CommandStateSet" the component will queue a
+    state transition to the new state idenfied in nParam.
+    
+    When the command is "OMX_CommandFlush", to flush a port's buffer queues,
+    the command will force the component to return all buffers NOT CURRENTLY 
+    BEING PROCESSED to the application, in the order in which the buffers 
+    were received.
+    
+    When the command is "OMX_CommandPortDisable" or 
+    "OMX_CommandPortEnable", the component's port (given by the value of
+    nParam) will be stopped or restarted. 
+    
+    When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the
+    pCmdData will point to a OMX_MARKTYPE structure containing the component
+    handle of the component to examine the buffer chain for the mark.  nParam1
+    contains the index of the port on which the buffer mark is applied.
+
+    Specification text for more details. 
+    
+    @param [in] hComponent
+        handle of component to execute the command
+    @param [in] Cmd
+        Command for the component to execute
+    @param [in] nParam
+        Parameter for the command to be executed.  When Cmd has the value 
+        OMX_CommandStateSet, value is a member of OMX_STATETYPE.  When Cmd has 
+        the value OMX_CommandFlush, value of nParam indicates which port(s) 
+        to flush. -1 is used to flush all ports a single port index will 
+        only flush that port.  When Cmd has the value "OMX_CommandPortDisable"
+        or "OMX_CommandPortEnable", the component's port is given by 
+        the value of nParam.  When Cmd has the value "OMX_CommandMarkBuffer"
+        the components pot is given by the value of nParam.
+    @param [in] pCmdData
+        Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value
+        "OMX_CommandMarkBuffer".     
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp
+ */
+#define OMX_SendCommand(                                    \
+         hComponent,                                        \
+         Cmd,                                               \
+         nParam,                                            \
+         pCmdData)                                          \
+     ((OMX_COMPONENTTYPE*)hComponent)->SendCommand(         \
+         hComponent,                                        \
+         Cmd,                                               \
+         nParam,                                            \
+         pCmdData)                          /* Macro End */
+
+
+/** The OMX_GetParameter macro will get one of the current parameter 
+    settings from the component.  This macro cannot only be invoked when 
+    the component is in the OMX_StateInvalid state.  The nParamIndex
+    parameter is used to indicate which structure is being requested from
+    the component.  The application shall allocate the correct structure 
+    and shall fill in the structure size and version information before 
+    invoking this macro.  When the parameter applies to a port, the
+    caller shall fill in the appropriate nPortIndex value indicating the
+    port on which the parameter applies. If the component has not had 
+    any settings changed, then the component should return a set of 
+    valid DEFAULT  parameters for the component.  This is a blocking 
+    call.  
+    
+    The component should return from this call within 20 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [in] nParamIndex
+        Index of the structure to be filled.  This value is from the
+        OMX_INDEXTYPE enumeration.
+    @param [in,out] pComponentParameterStructure
+        Pointer to application allocated structure to be filled by the 
+        component.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp
+ */
+#define OMX_GetParameter(                                   \
+        hComponent,                                         \
+        nParamIndex,                                        \
+        pComponentParameterStructure)                        \
+    ((OMX_COMPONENTTYPE*)hComponent)->GetParameter(         \
+        hComponent,                                         \
+        nParamIndex,                                        \
+        pComponentParameterStructure)    /* Macro End */
+
+
+/** The OMX_SetParameter macro will send an initialization parameter
+    structure to a component.  Each structure shall be sent one at a time,
+    in a separate invocation of the macro.  This macro can only be
+    invoked when the component is in the OMX_StateLoaded state, or the
+    port is disabled (when the parameter applies to a port). The 
+    nParamIndex parameter is used to indicate which structure is being
+    passed to the component.  The application shall allocate the 
+    correct structure and shall fill in the structure size and version 
+    information (as well as the actual data) before invoking this macro.
+    The application is free to dispose of this structure after the call
+    as the component is required to copy any data it shall retain.  This 
+    is a blocking call.  
+    
+    The component should return from this call within 20 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [in] nIndex
+        Index of the structure to be sent.  This value is from the
+        OMX_INDEXTYPE enumeration.
+    @param [in] pComponentParameterStructure
+        pointer to application allocated structure to be used for
+        initialization by the component.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp
+ */
+#define OMX_SetParameter(                                   \
+        hComponent,                                         \
+        nParamIndex,                                        \
+        pComponentParameterStructure)                        \
+    ((OMX_COMPONENTTYPE*)hComponent)->SetParameter(         \
+        hComponent,                                         \
+        nParamIndex,                                        \
+        pComponentParameterStructure)    /* Macro End */
+
+
+/** The OMX_GetConfig macro will get one of the configuration structures 
+    from a component.  This macro can be invoked anytime after the 
+    component has been loaded.  The nParamIndex call parameter is used to 
+    indicate which structure is being requested from the component.  The 
+    application shall allocate the correct structure and shall fill in the 
+    structure size and version information before invoking this macro.  
+    If the component has not had this configuration parameter sent before, 
+    then the component should return a set of valid DEFAULT values for the 
+    component.  This is a blocking call.  
+    
+    The component should return from this call within 5 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [in] nIndex
+        Index of the structure to be filled.  This value is from the
+        OMX_INDEXTYPE enumeration.
+    @param [in,out] pComponentConfigStructure
+        pointer to application allocated structure to be filled by the 
+        component.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp
+*/        
+#define OMX_GetConfig(                                      \
+        hComponent,                                         \
+        nConfigIndex,                                       \
+        pComponentConfigStructure)                           \
+    ((OMX_COMPONENTTYPE*)hComponent)->GetConfig(            \
+        hComponent,                                         \
+        nConfigIndex,                                       \
+        pComponentConfigStructure)       /* Macro End */
+
+
+/** The OMX_SetConfig macro will send one of the configuration 
+    structures to a component.  Each structure shall be sent one at a time,
+    each in a separate invocation of the macro.  This macro can be invoked 
+    anytime after the component has been loaded.  The application shall 
+    allocate the correct structure and shall fill in the structure size 
+    and version information (as well as the actual data) before invoking 
+    this macro.  The application is free to dispose of this structure after 
+    the call as the component is required to copy any data it shall retain.  
+    This is a blocking call.  
+    
+    The component should return from this call within 5 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [in] nConfigIndex
+        Index of the structure to be sent.  This value is from the
+        OMX_INDEXTYPE enumeration above.
+    @param [in] pComponentConfigStructure
+        pointer to application allocated structure to be used for
+        initialization by the component.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp
+ */
+#define OMX_SetConfig(                                      \
+        hComponent,                                         \
+        nConfigIndex,                                       \
+        pComponentConfigStructure)                           \
+    ((OMX_COMPONENTTYPE*)hComponent)->SetConfig(            \
+        hComponent,                                         \
+        nConfigIndex,                                       \
+        pComponentConfigStructure)       /* Macro End */
+
+
+/** The OMX_GetExtensionIndex macro will invoke a component to translate 
+    a vendor specific configuration or parameter string into an OMX 
+    structure index.  There is no requirement for the vendor to support 
+    this command for the indexes already found in the OMX_INDEXTYPE 
+    enumeration (this is done to save space in small components).  The 
+    component shall support all vendor supplied extension indexes not found
+    in the master OMX_INDEXTYPE enumeration.  This is a blocking call.  
+    
+    The component should return from this call within 5 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the GetHandle function.
+    @param [in] cParameterName
+        OMX_STRING that shall be less than 128 characters long including
+        the trailing null byte.  This is the string that will get 
+        translated by the component into a configuration index.
+    @param [out] pIndexType
+        a pointer to a OMX_INDEXTYPE to receive the index value.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp
+ */
+#define OMX_GetExtensionIndex(                              \
+        hComponent,                                         \
+        cParameterName,                                     \
+        pIndexType)                                         \
+    ((OMX_COMPONENTTYPE*)hComponent)->GetExtensionIndex(    \
+        hComponent,                                         \
+        cParameterName,                                     \
+        pIndexType)                     /* Macro End */
+
+
+/** The OMX_GetState macro will invoke the component to get the current 
+    state of the component and place the state value into the location
+    pointed to by pState.  
+    
+    The component should return from this call within 5 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [out] pState
+        pointer to the location to receive the state.  The value returned
+        is one of the OMX_STATETYPE members 
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp
+ */
+#define OMX_GetState(                                       \
+        hComponent,                                         \
+        pState)                                             \
+    ((OMX_COMPONENTTYPE*)hComponent)->GetState(             \
+        hComponent,                                         \
+        pState)                         /* Macro End */
+
+
+/** The OMX_UseBuffer macro will request that the component use
+    a buffer (and allocate its own buffer header) already allocated 
+    by another component, or by the IL Client. This is a blocking 
+    call.
+    
+    The component should return from this call within 20 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [out] ppBuffer
+        pointer to an OMX_BUFFERHEADERTYPE structure used to receive the 
+        pointer to the buffer header
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp buf
+ */
+
+#define OMX_UseBuffer(                                      \
+           hComponent,                                      \
+           ppBufferHdr,                                     \
+           nPortIndex,                                      \
+           pAppPrivate,                                     \
+           nSizeBytes,                                      \
+           pBuffer)                                         \
+    ((OMX_COMPONENTTYPE*)hComponent)->UseBuffer(            \
+           hComponent,                                      \
+           ppBufferHdr,                                     \
+           nPortIndex,                                      \
+           pAppPrivate,                                     \
+           nSizeBytes,                                      \
+           pBuffer)
+
+
+/** The OMX_AllocateBuffer macro will request that the component allocate 
+    a new buffer and buffer header.  The component will allocate the 
+    buffer and the buffer header and return a pointer to the buffer 
+    header.  This is a blocking call.
+    
+    The component should return from this call within 5 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [out] ppBuffer
+        pointer to an OMX_BUFFERHEADERTYPE structure used to receive 
+        the pointer to the buffer header
+    @param [in] nPortIndex
+        nPortIndex is used to select the port on the component the buffer will
+        be used with.  The port can be found by using the nPortIndex
+        value as an index into the Port Definition array of the component.
+    @param [in] pAppPrivate
+        pAppPrivate is used to initialize the pAppPrivate member of the 
+        buffer header structure.
+    @param [in] nSizeBytes
+        size of the buffer to allocate.  Used when bAllocateNew is true.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp buf
+ */    
+#define OMX_AllocateBuffer(                                 \
+        hComponent,                                         \
+        ppBuffer,                                           \
+        nPortIndex,                                         \
+        pAppPrivate,                                        \
+        nSizeBytes)                                         \
+    ((OMX_COMPONENTTYPE*)hComponent)->AllocateBuffer(       \
+        hComponent,                                         \
+        ppBuffer,                                           \
+        nPortIndex,                                         \
+        pAppPrivate,                                        \
+        nSizeBytes)                     /* Macro End */
+
+
+/** The OMX_FreeBuffer macro will release a buffer header from the component
+    which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If  
+    the component allocated the buffer (see the OMX_UseBuffer macro) then 
+    the component shall free the buffer and buffer header. This is a 
+    blocking call. 
+    
+    The component should return from this call within 20 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [in] nPortIndex
+        nPortIndex is used to select the port on the component the buffer will
+        be used with.
+    @param [in] pBuffer
+        pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
+        or AllocateBuffer.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp buf
+ */
+#define OMX_FreeBuffer(                                     \
+        hComponent,                                         \
+        nPortIndex,                                         \
+        pBuffer)                                            \
+    ((OMX_COMPONENTTYPE*)hComponent)->FreeBuffer(           \
+        hComponent,                                         \
+        nPortIndex,                                         \
+        pBuffer)                        /* Macro End */
+
+
+/** The OMX_EmptyThisBuffer macro will send a buffer full of data to an 
+    input port of a component.  The buffer will be emptied by the component
+    and returned to the application via the EmptyBufferDone call back.
+    This is a non-blocking call in that the component will record the buffer
+    and return immediately and then empty the buffer, later, at the proper 
+    time.  As expected, this macro may be invoked only while the component 
+    is in the OMX_StateExecuting.  If nPortIndex does not specify an input
+    port, the component shall return an error.  
+    
+    The component should return from this call within 5 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [in] pBuffer
+        pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
+        or AllocateBuffer.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp buf
+ */
+#define OMX_EmptyThisBuffer(                                \
+        hComponent,                                         \
+        pBuffer)                                            \
+    ((OMX_COMPONENTTYPE*)hComponent)->EmptyThisBuffer(      \
+        hComponent,                                         \
+        pBuffer)                        /* Macro End */
+
+
+/** The OMX_FillThisBuffer macro will send an empty buffer to an 
+    output port of a component.  The buffer will be filled by the component
+    and returned to the application via the FillBufferDone call back.
+    This is a non-blocking call in that the component will record the buffer
+    and return immediately and then fill the buffer, later, at the proper 
+    time.  As expected, this macro may be invoked only while the component 
+    is in the OMX_ExecutingState.  If nPortIndex does not specify an output
+    port, the component shall return an error.  
+    
+    The component should return from this call within 5 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [in] pBuffer
+        pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
+        or AllocateBuffer.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp buf
+ */
+#define OMX_FillThisBuffer(                                 \
+        hComponent,                                         \
+        pBuffer)                                            \
+    ((OMX_COMPONENTTYPE*)hComponent)->FillThisBuffer(       \
+        hComponent,                                         \
+        pBuffer)                        /* Macro End */
+
+
+
+/** The OMX_UseEGLImage macro will request that the component use
+    a EGLImage provided by EGL (and allocate its own buffer header)
+    This is a blocking call.
+    
+    The component should return from this call within 20 msec.
+    
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the OMX_GetHandle function.
+    @param [out] ppBuffer
+        pointer to an OMX_BUFFERHEADERTYPE structure used to receive the 
+        pointer to the buffer header.  Note that the memory location used
+        for this buffer is NOT visible to the IL Client.
+    @param [in] nPortIndex
+        nPortIndex is used to select the port on the component the buffer will
+        be used with.  The port can be found by using the nPortIndex
+        value as an index into the Port Definition array of the component.
+    @param [in] pAppPrivate
+        pAppPrivate is used to initialize the pAppPrivate member of the 
+        buffer header structure.
+    @param [in] eglImage
+        eglImage contains the handle of the EGLImage to use as a buffer on the
+        specified port.  The component is expected to validate properties of 
+        the EGLImage against the configuration of the port to ensure the component
+        can use the EGLImage as a buffer.          
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup comp buf
+ */
+#define OMX_UseEGLImage(                                    \
+           hComponent,                                      \
+           ppBufferHdr,                                     \
+           nPortIndex,                                      \
+           pAppPrivate,                                     \
+           eglImage)                                        \
+    ((OMX_COMPONENTTYPE*)hComponent)->UseEGLImage(          \
+           hComponent,                                      \
+           ppBufferHdr,                                     \
+           nPortIndex,                                      \
+           pAppPrivate,                                     \
+           eglImage)
+
+/** The OMX_Init method is used to initialize the OMX core.  It shall be the
+    first call made into OMX and it should only be executed one time without
+    an interviening OMX_Deinit call.  
+    
+    The core should return from this call within 20 msec.
+
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup core
+ */
+OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void);
+
+
+/** The OMX_Deinit method is used to deinitialize the OMX core.  It shall be 
+    the last call made into OMX. In the event that the core determines that 
+    thare are components loaded when this call is made, the core may return 
+    with an error rather than try to unload the components.
+        
+    The core should return from this call within 20 msec.
+    
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup core
+ */
+OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void);
+
+
+/** The OMX_ComponentNameEnum method will enumerate through all the names of
+    recognised valid components in the system. This function is provided
+    as a means to detect all the components in the system run-time. There is
+    no strict ordering to the enumeration order of component names, although
+    each name will only be enumerated once.  If the OMX core supports run-time
+    installation of new components, it is only requried to detect newly
+    installed components when the first call to enumerate component names
+    is made (i.e. when nIndex is 0x0).
+    
+    The core should return from this call in 20 msec.
+    
+    @param [out] cComponentName
+        pointer to a null terminated string with the component name.  The
+        names of the components are strings less than 127 bytes in length
+        plus the trailing null for a maximum size of 128 bytes.  An example 
+        of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0".  Names are 
+        assigned by the vendor, but shall start with "OMX." and then have 
+        the Vendor designation next.
+    @param [in] nNameLength
+        number of characters in the cComponentName string.  With all 
+        component name strings restricted to less than 128 characters 
+        (including the trailing null) it is recomended that the caller
+        provide a input string for the cComponentName of 128 characters.
+    @param [in] nIndex
+        number containing the enumeration index for the component. 
+        Multiple calls to OMX_ComponentNameEnum with increasing values
+        of nIndex will enumerate through the component names in the
+        system until OMX_ErrorNoMore is returned.  The value of nIndex
+        is 0 to (N-1), where N is the number of valid installed components
+        in the system.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  When the value of nIndex exceeds the number of 
+        components in the system minus 1, OMX_ErrorNoMore will be
+        returned. Otherwise the appropriate OMX error will be returned.
+    @ingroup core
+ */
+OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum(
+    OMX_OUT OMX_STRING cComponentName,
+    OMX_IN  OMX_U32 nNameLength,
+    OMX_IN  OMX_U32 nIndex);
+
+
+/** The OMX_GetHandle method will locate the component specified by the
+    component name given, load that component into memory and then invoke
+    the component's methods to create an instance of the component.  
+    
+    The core should return from this call within 20 msec.
+    
+    @param [out] pHandle
+        pointer to an OMX_HANDLETYPE pointer to be filled in by this method.
+    @param [in] cComponentName
+        pointer to a null terminated string with the component name.  The
+        names of the components are strings less than 127 bytes in length
+        plus the trailing null for a maximum size of 128 bytes.  An example 
+        of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0".  Names are 
+        assigned by the vendor, but shall start with "OMX." and then have 
+        the Vendor designation next.
+    @param [in] pAppData
+        pointer to an application defined value that will be returned
+        during callbacks so that the application can identify the source
+        of the callback.
+    @param [in] pCallBacks
+        pointer to a OMX_CALLBACKTYPE structure that will be passed to the
+        component to initialize it with.  
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup core
+ */
+OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle(
+    OMX_OUT OMX_HANDLETYPE* pHandle, 
+    OMX_IN  OMX_STRING cComponentName,
+    OMX_IN  OMX_PTR pAppData,
+    OMX_IN  OMX_CALLBACKTYPE* pCallBacks);
+
+
+/** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle 
+    method.  If the component reference count goes to zero, the component will
+    be unloaded from memory.  
+    
+    The core should return from this call within 20 msec when the component is 
+    in the OMX_StateLoaded state.
+
+    @param [in] hComponent
+        Handle of the component to be accessed.  This is the component
+        handle returned by the call to the GetHandle function.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+    @ingroup core
+ */
+OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle(
+    OMX_IN  OMX_HANDLETYPE hComponent);
+
+
+
+/** The OMX_SetupTunnel method will handle the necessary calls to the components
+    to setup the specified tunnel the two components.  NOTE: This is
+    an actual method (not a #define macro).  This method will make calls into
+    the component ComponentTunnelRequest method to do the actual tunnel 
+    connection.  
+
+    The ComponentTunnelRequest method on both components will be called. 
+    This method shall not be called unless the component is in the 
+    OMX_StateLoaded state except when the ports used for the tunnel are
+    disabled. In this case, the component may be in the OMX_StateExecuting,
+    OMX_StatePause, or OMX_StateIdle states. 
+
+    The core should return from this call within 20 msec.
+    
+    @param [in] hOutput
+        Handle of the component to be accessed.  Also this is the handle
+        of the component whose port, specified in the nPortOutput parameter
+        will be used the source for the tunnel. This is the component handle
+        returned by the call to the OMX_GetHandle function.  There is a 
+        requirement that hOutput be the source for the data when
+        tunelling (i.e. nPortOutput is an output port).  If 0x0, the component
+        specified in hInput will have it's port specified in nPortInput
+        setup for communication with the application / IL client.
+    @param [in] nPortOutput
+        nPortOutput is used to select the source port on component to be
+        used in the tunnel. 
+    @param [in] hInput
+        This is the component to setup the tunnel with. This is the handle
+        of the component whose port, specified in the nPortInput parameter
+        will be used the destination for the tunnel. This is the component handle
+        returned by the call to the OMX_GetHandle function.  There is a 
+        requirement that hInput be the destination for the data when
+        tunelling (i.e. nPortInut is an input port).   If 0x0, the component
+        specified in hOutput will have it's port specified in nPortPOutput
+        setup for communication with the application / IL client.
+    @param [in] nPortInput
+        nPortInput is used to select the destination port on component to be
+        used in the tunnel.
+    @return OMX_ERRORTYPE
+        If the command successfully executes, the return code will be
+        OMX_ErrorNone.  Otherwise the appropriate OMX error will be returned.
+        When OMX_ErrorNotImplemented is returned, one or both components is 
+        a non-interop component and does not support tunneling.
+        
+        On failure, the ports of both components are setup for communication
+        with the application / IL Client.
+    @ingroup core tun
+ */
+OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel(
+    OMX_IN  OMX_HANDLETYPE hOutput,
+    OMX_IN  OMX_U32 nPortOutput,
+    OMX_IN  OMX_HANDLETYPE hInput,
+    OMX_IN  OMX_U32 nPortInput);
+    
+/** @ingroup cp */
+OMX_API OMX_ERRORTYPE   OMX_GetContentPipe(
+    OMX_OUT OMX_HANDLETYPE *hPipe,
+    OMX_IN OMX_STRING szURI);
+
+/** The OMX_GetComponentsOfRole method will return the number of components that support the given
+    role and (if the compNames field is non-NULL) the names of those components. The call will fail if 
+    an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
+    client should:
+        * first call this function with the compNames field NULL to determine the number of component names
+        * second call this function with the compNames field pointing to an array of names allocated 
+          according to the number returned by the first call.
+
+    The core should return from this call within 5 msec.
+    
+    @param [in] role
+        This is generic standard component name consisting only of component class 
+        name and the type within that class (e.g. 'audio_decoder.aac').
+    @param [inout] pNumComps
+        This is used both as input and output. 
+ 
+        If compNames is NULL, the input is ignored and the output specifies how many components support
+        the given role.
+     
+        If compNames is not NULL, on input it bounds the size of the input structure and 
+        on output, it specifies the number of components string names listed within the compNames parameter.
+    @param [inout] compNames
+        If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts 
+        a list of the names of all physical components that implement the specified standard component name. 
+        Each name is NULL terminated. numComps indicates the number of names.
+    @ingroup core
+ */
+OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole ( 
+	OMX_IN      OMX_STRING role,
+    OMX_INOUT   OMX_U32 *pNumComps,
+    OMX_INOUT   OMX_U8  **compNames);
+
+/** The OMX_GetRolesOfComponent method will return the number of roles supported by the given
+    component and (if the roles field is non-NULL) the names of those roles. The call will fail if 
+    an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
+    client should:
+        * first call this function with the roles field NULL to determine the number of role names
+        * second call this function with the roles field pointing to an array of names allocated 
+          according to the number returned by the first call.
+
+    The core should return from this call within 5 msec.
+
+    @param [in] compName
+        This is the name of the component being queried about.
+    @param [inout] pNumRoles
+        This is used both as input and output. 
+ 
+        If roles is NULL, the input is ignored and the output specifies how many roles the component supports.
+     
+        If compNames is not NULL, on input it bounds the size of the input structure and 
+        on output, it specifies the number of roles string names listed within the roles parameter.
+    @param [out] roles
+        If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings 
+        which accepts a list of the names of all standard components roles implemented on the 
+        specified component name. numComps indicates the number of names.
+    @ingroup core
+ */
+OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent ( 
+	OMX_IN      OMX_STRING compName, 
+    OMX_INOUT   OMX_U32 *pNumRoles,
+    OMX_OUT     OMX_U8 **roles);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
+
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_IVCommon.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_IVCommon.h
new file mode 100644
index 0000000..4c4995c
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_IVCommon.h
@@ -0,0 +1,920 @@
+/**
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ *
+ */
+
+/** 
+ * @file OMX_IVCommon.h - OpenMax IL version 1.1.2
+ *  The structures needed by Video and Image components to exchange
+ *  parameters and configuration data with the components.
+ */
+#ifndef OMX_IVCommon_h
+#define OMX_IVCommon_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * Each OMX header must include all required header files to allow the header
+ * to compile without errors.  The includes below are required for this header
+ * file to compile successfully 
+ */
+
+#include <OMX_Core.h>
+
+/** @defgroup iv OpenMAX IL Imaging and Video Domain
+ * Common structures for OpenMAX IL Imaging and Video domains
+ * @{
+ */
+
+
+/** 
+ * Enumeration defining possible uncompressed image/video formats. 
+ *
+ * ENUMS:
+ *  Unused                 : Placeholder value when format is N/A
+ *  Monochrome             : black and white
+ *  8bitRGB332             : Red 7:5, Green 4:2, Blue 1:0
+ *  12bitRGB444            : Red 11:8, Green 7:4, Blue 3:0
+ *  16bitARGB4444          : Alpha 15:12, Red 11:8, Green 7:4, Blue 3:0
+ *  16bitARGB1555          : Alpha 15, Red 14:10, Green 9:5, Blue 4:0
+ *  16bitRGB565            : Red 15:11, Green 10:5, Blue 4:0
+ *  16bitBGR565            : Blue 15:11, Green 10:5, Red 4:0
+ *  18bitRGB666            : Red 17:12, Green 11:6, Blue 5:0
+ *  18bitARGB1665          : Alpha 17, Red 16:11, Green 10:5, Blue 4:0
+ *  19bitARGB1666          : Alpha 18, Red 17:12, Green 11:6, Blue 5:0
+ *  24bitRGB888            : Red 24:16, Green 15:8, Blue 7:0
+ *  24bitBGR888            : Blue 24:16, Green 15:8, Red 7:0
+ *  24bitARGB1887          : Alpha 23, Red 22:15, Green 14:7, Blue 6:0
+ *  25bitARGB1888          : Alpha 24, Red 23:16, Green 15:8, Blue 7:0
+ *  32bitBGRA8888          : Blue 31:24, Green 23:16, Red 15:8, Alpha 7:0
+ *  32bitARGB8888          : Alpha 31:24, Red 23:16, Green 15:8, Blue 7:0
+ *  YUV411Planar           : U,Y are subsampled by a factor of 4 horizontally
+ *  YUV411PackedPlanar     : packed per payload in planar slices
+ *  YUV420Planar           : Three arrays Y,U,V.
+ *  YUV420PackedPlanar     : packed per payload in planar slices
+ *  YUV420SemiPlanar       : Two arrays, one is all Y, the other is U and V
+ *  YUV422Planar           : Three arrays Y,U,V.
+ *  YUV422PackedPlanar     : packed per payload in planar slices
+ *  YUV422SemiPlanar       : Two arrays, one is all Y, the other is U and V
+ *  YCbYCr                 : Organized as 16bit YUYV (i.e. YCbYCr)
+ *  YCrYCb                 : Organized as 16bit YVYU (i.e. YCrYCb)
+ *  CbYCrY                 : Organized as 16bit UYVY (i.e. CbYCrY)
+ *  CrYCbY                 : Organized as 16bit VYUY (i.e. CrYCbY)
+ *  YUV444Interleaved      : Each pixel contains equal parts YUV
+ *  RawBayer8bit           : SMIA camera output format
+ *  RawBayer10bit          : SMIA camera output format
+ *  RawBayer8bitcompressed : SMIA camera output format
+ */
+typedef enum OMX_COLOR_FORMATTYPE {
+    OMX_COLOR_FormatUnused,
+    OMX_COLOR_FormatMonochrome,
+    OMX_COLOR_Format8bitRGB332,
+    OMX_COLOR_Format12bitRGB444,
+    OMX_COLOR_Format16bitARGB4444,
+    OMX_COLOR_Format16bitARGB1555,
+    OMX_COLOR_Format16bitRGB565,
+    OMX_COLOR_Format16bitBGR565,
+    OMX_COLOR_Format18bitRGB666,
+    OMX_COLOR_Format18bitARGB1665,
+    OMX_COLOR_Format19bitARGB1666, 
+    OMX_COLOR_Format24bitRGB888,
+    OMX_COLOR_Format24bitBGR888,
+    OMX_COLOR_Format24bitARGB1887,
+    OMX_COLOR_Format25bitARGB1888,
+    OMX_COLOR_Format32bitBGRA8888,
+    OMX_COLOR_Format32bitARGB8888,
+    OMX_COLOR_FormatYUV411Planar,
+    OMX_COLOR_FormatYUV411PackedPlanar,
+    OMX_COLOR_FormatYUV420Planar,
+    OMX_COLOR_FormatYUV420PackedPlanar,
+    OMX_COLOR_FormatYUV420SemiPlanar,
+    OMX_COLOR_FormatYUV422Planar,
+    OMX_COLOR_FormatYUV422PackedPlanar,
+    OMX_COLOR_FormatYUV422SemiPlanar,
+    OMX_COLOR_FormatYCbYCr,
+    OMX_COLOR_FormatYCrYCb,
+    OMX_COLOR_FormatCbYCrY,
+    OMX_COLOR_FormatCrYCbY,
+    OMX_COLOR_FormatYUV444Interleaved,
+    OMX_COLOR_FormatRawBayer8bit,
+    OMX_COLOR_FormatRawBayer10bit,
+    OMX_COLOR_FormatRawBayer8bitcompressed,
+    OMX_COLOR_FormatL2, 
+    OMX_COLOR_FormatL4, 
+    OMX_COLOR_FormatL8, 
+    OMX_COLOR_FormatL16, 
+    OMX_COLOR_FormatL24, 
+    OMX_COLOR_FormatL32,
+    OMX_COLOR_FormatYUV420PackedSemiPlanar,
+    OMX_COLOR_FormatYUV422PackedSemiPlanar,
+    OMX_COLOR_Format18BitBGR666,
+    OMX_COLOR_Format24BitARGB6666,
+    OMX_COLOR_Format24BitABGR6666,
+    OMX_COLOR_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_COLOR_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_COLOR_FormatMax = 0x7FFFFFFF
+} OMX_COLOR_FORMATTYPE;
+
+
+/** 
+ * Defines the matrix for conversion from RGB to YUV or vice versa.
+ * iColorMatrix should be initialized with the fixed point values 
+ * used in converting between formats.
+ */
+typedef struct OMX_CONFIG_COLORCONVERSIONTYPE {
+    OMX_U32 nSize;              /**< Size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version info */ 
+    OMX_U32 nPortIndex;         /**< Port that this struct applies to */
+    OMX_S32 xColorMatrix[3][3]; /**< Stored in signed Q16 format */
+    OMX_S32 xColorOffset[4];    /**< Stored in signed Q16 format */
+}OMX_CONFIG_COLORCONVERSIONTYPE;
+
+
+/** 
+ * Structure defining percent to scale each frame dimension.  For example:  
+ * To make the width 50% larger, use fWidth = 1.5 and to make the width
+ * 1/2 the original size, use fWidth = 0.5
+ */
+typedef struct OMX_CONFIG_SCALEFACTORTYPE {
+    OMX_U32 nSize;            /**< Size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version info */ 
+    OMX_U32 nPortIndex;       /**< Port that this struct applies to */
+    OMX_S32 xWidth;           /**< Fixed point value stored as Q16 */
+    OMX_S32 xHeight;          /**< Fixed point value stored as Q16 */
+}OMX_CONFIG_SCALEFACTORTYPE;
+
+
+/** 
+ * Enumeration of possible image filter types 
+ */
+typedef enum OMX_IMAGEFILTERTYPE {
+    OMX_ImageFilterNone,
+    OMX_ImageFilterNoise,
+    OMX_ImageFilterEmboss,
+    OMX_ImageFilterNegative,
+    OMX_ImageFilterSketch,
+    OMX_ImageFilterOilPaint,
+    OMX_ImageFilterHatch,
+    OMX_ImageFilterGpen,
+    OMX_ImageFilterAntialias, 
+    OMX_ImageFilterDeRing,       
+    OMX_ImageFilterSolarize,
+    OMX_ImageFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_ImageFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_ImageFilterMax = 0x7FFFFFFF
+} OMX_IMAGEFILTERTYPE;
+
+
+/** 
+ * Image filter configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize        : Size of the structure in bytes       
+ *  nVersion     : OMX specification version information
+ *  nPortIndex   : Port that this structure applies to 
+ *  eImageFilter : Image filter type enumeration      
+ */
+typedef struct OMX_CONFIG_IMAGEFILTERTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_IMAGEFILTERTYPE eImageFilter;
+} OMX_CONFIG_IMAGEFILTERTYPE;
+
+
+/** 
+ * Customized U and V for color enhancement 
+ *
+ * STRUCT MEMBERS:
+ *  nSize             : Size of the structure in bytes
+ *  nVersion          : OMX specification version information 
+ *  nPortIndex        : Port that this structure applies to
+ *  bColorEnhancement : Enable/disable color enhancement
+ *  nCustomizedU      : Practical values: 16-240, range: 0-255, value set for 
+ *                      U component
+ *  nCustomizedV      : Practical values: 16-240, range: 0-255, value set for 
+ *                      V component
+ */
+typedef struct OMX_CONFIG_COLORENHANCEMENTTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion; 
+    OMX_U32 nPortIndex;
+    OMX_BOOL bColorEnhancement;
+    OMX_U8 nCustomizedU;
+    OMX_U8 nCustomizedV;
+} OMX_CONFIG_COLORENHANCEMENTTYPE;
+
+
+/** 
+ * Define color key and color key mask 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information 
+ *  nPortIndex : Port that this structure applies to
+ *  nARGBColor : 32bit Alpha, Red, Green, Blue Color
+ *  nARGBMask  : 32bit Mask for Alpha, Red, Green, Blue channels
+ */
+typedef struct OMX_CONFIG_COLORKEYTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nARGBColor;
+    OMX_U32 nARGBMask;
+} OMX_CONFIG_COLORKEYTYPE;
+
+
+/** 
+ * List of color blend types for pre/post processing 
+ *
+ * ENUMS:
+ *  None          : No color blending present
+ *  AlphaConstant : Function is (alpha_constant * src) + 
+ *                  (1 - alpha_constant) * dst)
+ *  AlphaPerPixel : Function is (alpha * src) + (1 - alpha) * dst)
+ *  Alternate     : Function is alternating pixels from src and dst
+ *  And           : Function is (src & dst)
+ *  Or            : Function is (src | dst)
+ *  Invert        : Function is ~src
+ */
+typedef enum OMX_COLORBLENDTYPE {
+    OMX_ColorBlendNone,
+    OMX_ColorBlendAlphaConstant,
+    OMX_ColorBlendAlphaPerPixel,
+    OMX_ColorBlendAlternate,
+    OMX_ColorBlendAnd,
+    OMX_ColorBlendOr,
+    OMX_ColorBlendInvert,
+    OMX_ColorBlendKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_ColorBlendVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_ColorBlendMax = 0x7FFFFFFF
+} OMX_COLORBLENDTYPE;
+
+
+/** 
+ * Color blend configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize             : Size of the structure in bytes                        
+ *  nVersion          : OMX specification version information                
+ *  nPortIndex        : Port that this structure applies to                   
+ *  nRGBAlphaConstant : Constant global alpha values when global alpha is used
+ *  eColorBlend       : Color blend type enumeration                         
+ */
+typedef struct OMX_CONFIG_COLORBLENDTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nRGBAlphaConstant;
+    OMX_COLORBLENDTYPE  eColorBlend;
+} OMX_CONFIG_COLORBLENDTYPE;
+
+
+/** 
+ * Hold frame dimension
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes      
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to     
+ *  nWidth     : Frame width in pixels                 
+ *  nHeight    : Frame height in pixels                
+ */
+typedef struct OMX_FRAMESIZETYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nWidth;
+    OMX_U32 nHeight;
+} OMX_FRAMESIZETYPE;
+
+
+/**
+ * Rotation configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes             
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to
+ *  nRotation  : +/- integer rotation value               
+ */
+typedef struct OMX_CONFIG_ROTATIONTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_S32 nRotation; 
+} OMX_CONFIG_ROTATIONTYPE;
+
+
+/** 
+ * Possible mirroring directions for pre/post processing 
+ *
+ * ENUMS:
+ *  None       : No mirroring                         
+ *  Vertical   : Vertical mirroring, flip on X axis   
+ *  Horizontal : Horizontal mirroring, flip on Y axis  
+ *  Both       : Both vertical and horizontal mirroring
+ */
+typedef enum OMX_MIRRORTYPE {
+    OMX_MirrorNone = 0,
+    OMX_MirrorVertical,
+    OMX_MirrorHorizontal,
+    OMX_MirrorBoth, 
+    OMX_MirrorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_MirrorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_MirrorMax = 0x7FFFFFFF   
+} OMX_MIRRORTYPE;
+
+
+/** 
+ * Mirroring configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes      
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to  
+ *  eMirror    : Mirror type enumeration              
+ */
+typedef struct OMX_CONFIG_MIRRORTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion; 
+    OMX_U32 nPortIndex;
+    OMX_MIRRORTYPE  eMirror;
+} OMX_CONFIG_MIRRORTYPE;
+
+
+/** 
+ * Position information only 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes               
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to
+ *  nX         : X coordinate for the point                     
+ *  nY         : Y coordinate for the point 
+ */                      
+typedef struct OMX_CONFIG_POINTTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_S32 nX;
+    OMX_S32 nY;
+} OMX_CONFIG_POINTTYPE;
+
+
+/** 
+ * Frame size plus position 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes                    
+ *  nVersion   : OMX specification version information      
+ *  nPortIndex : Port that this structure applies to    
+ *  nLeft      : X Coordinate of the top left corner of the rectangle
+ *  nTop       : Y Coordinate of the top left corner of the rectangle
+ *  nWidth     : Width of the rectangle                              
+ *  nHeight    : Height of the rectangle                             
+ */
+typedef struct OMX_CONFIG_RECTTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;  
+    OMX_U32 nPortIndex; 
+    OMX_S32 nLeft; 
+    OMX_S32 nTop;
+    OMX_U32 nWidth;
+    OMX_U32 nHeight;
+} OMX_CONFIG_RECTTYPE;
+
+
+/** 
+ * Deblocking state; it is required to be set up before starting the codec 
+ *
+ * STRUCT MEMBERS:
+ *  nSize       : Size of the structure in bytes      
+ *  nVersion    : OMX specification version information 
+ *  nPortIndex  : Port that this structure applies to
+ *  bDeblocking : Enable/disable deblocking mode    
+ */
+typedef struct OMX_PARAM_DEBLOCKINGTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_BOOL bDeblocking;
+} OMX_PARAM_DEBLOCKINGTYPE;
+
+
+/** 
+ * Stabilization state 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes          
+ *  nVersion   : OMX specification version information    
+ *  nPortIndex : Port that this structure applies to   
+ *  bStab      : Enable/disable frame stabilization state
+ */
+typedef struct OMX_CONFIG_FRAMESTABTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_BOOL bStab;
+} OMX_CONFIG_FRAMESTABTYPE;
+
+
+/** 
+ * White Balance control type 
+ *
+ * STRUCT MEMBERS:
+ *  SunLight : Referenced in JSR-234
+ *  Flash    : Optimal for device's integrated flash
+ */
+typedef enum OMX_WHITEBALCONTROLTYPE {
+    OMX_WhiteBalControlOff = 0,
+    OMX_WhiteBalControlAuto,
+    OMX_WhiteBalControlSunLight,
+    OMX_WhiteBalControlCloudy,
+    OMX_WhiteBalControlShade,
+    OMX_WhiteBalControlTungsten,
+    OMX_WhiteBalControlFluorescent,
+    OMX_WhiteBalControlIncandescent,
+    OMX_WhiteBalControlFlash,
+    OMX_WhiteBalControlHorizon,
+    OMX_WhiteBalControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_WhiteBalControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_WhiteBalControlMax = 0x7FFFFFFF
+} OMX_WHITEBALCONTROLTYPE;
+
+
+/** 
+ * White Balance control configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize            : Size of the structure in bytes       
+ *  nVersion         : OMX specification version information
+ *  nPortIndex       : Port that this structure applies to                 
+ *  eWhiteBalControl : White balance enumeration            
+ */
+typedef struct OMX_CONFIG_WHITEBALCONTROLTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_WHITEBALCONTROLTYPE eWhiteBalControl;
+} OMX_CONFIG_WHITEBALCONTROLTYPE;
+
+
+/** 
+ * Exposure control type 
+ */
+typedef enum OMX_EXPOSURECONTROLTYPE {
+    OMX_ExposureControlOff = 0,
+    OMX_ExposureControlAuto,
+    OMX_ExposureControlNight,
+    OMX_ExposureControlBackLight,
+    OMX_ExposureControlSpotLight,
+    OMX_ExposureControlSports,
+    OMX_ExposureControlSnow,
+    OMX_ExposureControlBeach,
+    OMX_ExposureControlLargeAperture,
+    OMX_ExposureControlSmallApperture,
+    OMX_ExposureControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_ExposureControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_ExposureControlMax = 0x7FFFFFFF
+} OMX_EXPOSURECONTROLTYPE;
+
+
+/** 
+ * White Balance control configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize            : Size of the structure in bytes      
+ *  nVersion         : OMX specification version information
+ *  nPortIndex       : Port that this structure applies to                
+ *  eExposureControl : Exposure control enumeration         
+ */
+typedef struct OMX_CONFIG_EXPOSURECONTROLTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_EXPOSURECONTROLTYPE eExposureControl;
+} OMX_CONFIG_EXPOSURECONTROLTYPE;
+
+
+/** 
+ * Defines sensor supported mode. 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes           
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to 
+ *  nFrameRate : Single shot mode is indicated by a 0     
+ *  bOneShot   : Enable for single shot, disable for streaming
+ *  sFrameSize : Framesize                                          
+ */
+typedef struct OMX_PARAM_SENSORMODETYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nFrameRate;
+    OMX_BOOL bOneShot;
+    OMX_FRAMESIZETYPE sFrameSize;
+} OMX_PARAM_SENSORMODETYPE;
+
+
+/** 
+ * Defines contrast level 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes                              
+ *  nVersion   : OMX specification version information                
+ *  nPortIndex : Port that this structure applies to                 
+ *  nContrast  : Values allowed for contrast -100 to 100, zero means no change
+ */
+typedef struct OMX_CONFIG_CONTRASTTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_S32 nContrast;
+} OMX_CONFIG_CONTRASTTYPE;
+
+
+/** 
+ * Defines brightness level 
+ *
+ * STRUCT MEMBERS:
+ *  nSize       : Size of the structure in bytes          
+ *  nVersion    : OMX specification version information 
+ *  nPortIndex  : Port that this structure applies to 
+ *  nBrightness : 0-100%        
+ */
+typedef struct OMX_CONFIG_BRIGHTNESSTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nBrightness;
+} OMX_CONFIG_BRIGHTNESSTYPE;
+
+
+/** 
+ * Defines backlight level configuration for a video sink, e.g. LCD panel 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information 
+ *  nPortIndex : Port that this structure applies to
+ *  nBacklight : Values allowed for backlight 0-100%
+ *  nTimeout   : Number of milliseconds before backlight automatically turns 
+ *               off.  A value of 0x0 disables backight timeout 
+ */
+typedef struct OMX_CONFIG_BACKLIGHTTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nBacklight;
+    OMX_U32 nTimeout;
+} OMX_CONFIG_BACKLIGHTTYPE;
+
+
+/** 
+ * Defines setting for Gamma 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information 
+ *  nPortIndex : Port that this structure applies to
+ *  nGamma     : Values allowed for gamma -100 to 100, zero means no change
+ */
+typedef struct OMX_CONFIG_GAMMATYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_S32 nGamma;
+} OMX_CONFIG_GAMMATYPE;
+
+
+/** 
+ * Define for setting saturation 
+ * 
+ * STRUCT MEMBERS:
+ *  nSize       : Size of the structure in bytes
+ *  nVersion    : OMX specification version information
+ *  nPortIndex  : Port that this structure applies to
+ *  nSaturation : Values allowed for saturation -100 to 100, zero means 
+ *                no change
+ */
+typedef struct OMX_CONFIG_SATURATIONTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_S32 nSaturation;
+} OMX_CONFIG_SATURATIONTYPE;
+
+
+/** 
+ * Define for setting Lightness 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to
+ *  nLightness : Values allowed for lightness -100 to 100, zero means no 
+ *               change
+ */
+typedef struct OMX_CONFIG_LIGHTNESSTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_S32 nLightness;
+} OMX_CONFIG_LIGHTNESSTYPE;
+
+
+/** 
+ * Plane blend configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes 
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Index of input port associated with the plane.
+ *  nDepth     : Depth of the plane in relation to the screen. Higher 
+ *               numbered depths are "behind" lower number depths.  
+ *               This number defaults to the Port Index number.
+ *  nAlpha     : Transparency blending component for the entire plane.  
+ *               See blending modes for more detail.
+ */
+typedef struct OMX_CONFIG_PLANEBLENDTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nDepth;
+    OMX_U32 nAlpha;
+} OMX_CONFIG_PLANEBLENDTYPE;
+
+
+/** 
+ * Define interlace type
+ *
+ * STRUCT MEMBERS:
+ *  nSize                 : Size of the structure in bytes 
+ *  nVersion              : OMX specification version information 
+ *  nPortIndex            : Port that this structure applies to
+ *  bEnable               : Enable control variable for this functionality 
+ *                          (see below)
+ *  nInterleavePortIndex  : Index of input or output port associated with  
+ *                          the interleaved plane. 
+ *  pPlanarPortIndexes[4] : Index of input or output planar ports.
+ */
+typedef struct OMX_PARAM_INTERLEAVETYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_BOOL bEnable;
+    OMX_U32 nInterleavePortIndex;
+} OMX_PARAM_INTERLEAVETYPE;
+
+
+/** 
+ * Defines the picture effect used for an input picture 
+ */
+typedef enum OMX_TRANSITIONEFFECTTYPE {
+    OMX_EffectNone,
+    OMX_EffectFadeFromBlack,
+    OMX_EffectFadeToBlack,
+    OMX_EffectUnspecifiedThroughConstantColor,
+    OMX_EffectDissolve,
+    OMX_EffectWipe,
+    OMX_EffectUnspecifiedMixOfTwoScenes,
+    OMX_EffectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_EffectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_EffectMax = 0x7FFFFFFF
+} OMX_TRANSITIONEFFECTTYPE;
+
+
+/** 
+ * Structure used to configure current transition effect 
+ *
+ * STRUCT MEMBERS:
+ * nSize      : Size of the structure in bytes
+ * nVersion   : OMX specification version information 
+ * nPortIndex : Port that this structure applies to
+ * eEffect    : Effect to enable
+ */
+typedef struct OMX_CONFIG_TRANSITIONEFFECTTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_TRANSITIONEFFECTTYPE eEffect;
+} OMX_CONFIG_TRANSITIONEFFECTTYPE;
+
+
+/** 
+ * Defines possible data unit types for encoded video data. The data unit 
+ * types are used both for encoded video input for playback as well as
+ * encoded video output from recording. 
+ */
+typedef enum OMX_DATAUNITTYPE {
+    OMX_DataUnitCodedPicture,
+    OMX_DataUnitVideoSegment,
+    OMX_DataUnitSeveralSegments,
+    OMX_DataUnitArbitraryStreamSection,
+    OMX_DataUnitKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_DataUnitVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_DataUnitMax = 0x7FFFFFFF
+} OMX_DATAUNITTYPE;
+
+
+/** 
+ * Defines possible encapsulation types for coded video data unit. The 
+ * encapsulation information is used both for encoded video input for 
+ * playback as well as encoded video output from recording. 
+ */
+typedef enum OMX_DATAUNITENCAPSULATIONTYPE {
+    OMX_DataEncapsulationElementaryStream,
+    OMX_DataEncapsulationGenericPayload,
+    OMX_DataEncapsulationRtpPayload,
+    OMX_DataEncapsulationKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_DataEncapsulationVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_DataEncapsulationMax = 0x7FFFFFFF
+} OMX_DATAUNITENCAPSULATIONTYPE;
+
+
+/** 
+ * Structure used to configure the type of being decoded/encoded 
+ */
+typedef struct OMX_PARAM_DATAUNITTYPE {
+    OMX_U32 nSize;            /**< Size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;       /**< Port that this structure applies to */
+    OMX_DATAUNITTYPE eUnitType;
+    OMX_DATAUNITENCAPSULATIONTYPE eEncapsulationType;
+} OMX_PARAM_DATAUNITTYPE;
+
+
+/**
+ * Defines dither types 
+ */
+typedef enum OMX_DITHERTYPE {
+    OMX_DitherNone,
+    OMX_DitherOrdered,
+    OMX_DitherErrorDiffusion,
+    OMX_DitherOther,
+    OMX_DitherKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_DitherVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_DitherMax = 0x7FFFFFFF
+} OMX_DITHERTYPE;
+
+
+/** 
+ * Structure used to configure current type of dithering 
+ */
+typedef struct OMX_CONFIG_DITHERTYPE {
+    OMX_U32 nSize;            /**< Size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 
+    OMX_U32 nPortIndex;       /**< Port that this structure applies to */
+    OMX_DITHERTYPE eDither;   /**< Type of dithering to use */
+} OMX_CONFIG_DITHERTYPE;
+
+typedef struct OMX_CONFIG_CAPTUREMODETYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;     /**< Port that this structure applies to */
+    OMX_BOOL bContinuous;   /**< If true then ignore frame rate and emit capture 
+                             *   data as fast as possible (otherwise obey port's frame rate). */
+    OMX_BOOL bFrameLimited; /**< If true then terminate capture after the port emits the 
+                             *   specified number of frames (otherwise the port does not 
+                             *   terminate the capture until instructed to do so by the client). 
+                             *   Even if set, the client may manually terminate the capture prior 
+                             *   to reaching the limit. */
+    OMX_U32 nFrameLimit;      /**< Limit on number of frames emitted during a capture (only
+                               *   valid if bFrameLimited is set). */
+} OMX_CONFIG_CAPTUREMODETYPE;
+
+typedef enum OMX_METERINGTYPE {
+ 
+    OMX_MeteringModeAverage,     /**< Center-weighted average metering. */
+    OMX_MeteringModeSpot,  	      /**< Spot (partial) metering. */
+    OMX_MeteringModeMatrix,      /**< Matrix or evaluative metering. */
+ 
+    OMX_MeteringKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_MeteringVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_EVModeMax = 0x7fffffff
+} OMX_METERINGTYPE;
+ 
+typedef struct OMX_CONFIG_EXPOSUREVALUETYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_METERINGTYPE eMetering;
+    OMX_S32 xEVCompensation;      /**< Fixed point value stored as Q16 */
+    OMX_U32 nApertureFNumber;     /**< e.g. nApertureFNumber = 2 implies "f/2" - Q16 format */
+    OMX_BOOL bAutoAperture;		/**< Whether aperture number is defined automatically */
+    OMX_U32 nShutterSpeedMsec;    /**< Shutterspeed in milliseconds */ 
+    OMX_BOOL bAutoShutterSpeed;	/**< Whether shutter speed is defined automatically */ 
+    OMX_U32 nSensitivity;         /**< e.g. nSensitivity = 100 implies "ISO 100" */
+    OMX_BOOL bAutoSensitivity;	/**< Whether sensitivity is defined automatically */
+} OMX_CONFIG_EXPOSUREVALUETYPE;
+
+/** 
+ * Focus region configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize           : Size of the structure in bytes
+ *  nVersion        : OMX specification version information
+ *  nPortIndex      : Port that this structure applies to
+ *  bCenter         : Use center region as focus region of interest
+ *  bLeft           : Use left region as focus region of interest
+ *  bRight          : Use right region as focus region of interest
+ *  bTop            : Use top region as focus region of interest
+ *  bBottom         : Use bottom region as focus region of interest
+ *  bTopLeft        : Use top left region as focus region of interest
+ *  bTopRight       : Use top right region as focus region of interest
+ *  bBottomLeft     : Use bottom left region as focus region of interest
+ *  bBottomRight    : Use bottom right region as focus region of interest
+ */
+typedef struct OMX_CONFIG_FOCUSREGIONTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_BOOL bCenter;
+    OMX_BOOL bLeft;
+    OMX_BOOL bRight;
+    OMX_BOOL bTop;
+    OMX_BOOL bBottom;
+    OMX_BOOL bTopLeft;
+    OMX_BOOL bTopRight;
+    OMX_BOOL bBottomLeft;
+    OMX_BOOL bBottomRight;
+} OMX_CONFIG_FOCUSREGIONTYPE;
+
+/** 
+ * Focus Status type 
+ */
+typedef enum OMX_FOCUSSTATUSTYPE {
+    OMX_FocusStatusOff = 0,
+    OMX_FocusStatusRequest,
+    OMX_FocusStatusReached,
+    OMX_FocusStatusUnableToReach,
+    OMX_FocusStatusLost,
+    OMX_FocusStatusKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_FocusStatusVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_FocusStatusMax = 0x7FFFFFFF
+} OMX_FOCUSSTATUSTYPE;
+
+/** 
+ * Focus status configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize               : Size of the structure in bytes
+ *  nVersion            : OMX specification version information
+ *  nPortIndex          : Port that this structure applies to
+ *  eFocusStatus        : Specifies the focus status
+ *  bCenterStatus       : Use center region as focus region of interest
+ *  bLeftStatus         : Use left region as focus region of interest
+ *  bRightStatus        : Use right region as focus region of interest
+ *  bTopStatus          : Use top region as focus region of interest
+ *  bBottomStatus       : Use bottom region as focus region of interest
+ *  bTopLeftStatus      : Use top left region as focus region of interest
+ *  bTopRightStatus     : Use top right region as focus region of interest
+ *  bBottomLeftStatus   : Use bottom left region as focus region of interest
+ *  bBottomRightStatus  : Use bottom right region as focus region of interest
+ */
+typedef struct OMX_PARAM_FOCUSSTATUSTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_FOCUSSTATUSTYPE eFocusStatus;
+    OMX_BOOL bCenterStatus;
+    OMX_BOOL bLeftStatus;
+    OMX_BOOL bRightStatus;
+    OMX_BOOL bTopStatus;
+    OMX_BOOL bBottomStatus;
+    OMX_BOOL bTopLeftStatus;
+    OMX_BOOL bTopRightStatus;
+    OMX_BOOL bBottomLeftStatus;
+    OMX_BOOL bBottomRightStatus;
+} OMX_PARAM_FOCUSSTATUSTYPE;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Image.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Image.h
new file mode 100644
index 0000000..a6d4666
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Image.h
@@ -0,0 +1,328 @@
+/**
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ */
+
+/** 
+ * @file OMX_Image.h - OpenMax IL version 1.1.2
+ * The structures needed by Image components to exchange parameters and 
+ * configuration data with the components.
+ */
+#ifndef OMX_Image_h
+#define OMX_Image_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/**
+ * Each OMX header must include all required header files to allow the 
+ * header to compile without errors.  The includes below are required  
+ * for this header file to compile successfully 
+ */
+
+#include <OMX_IVCommon.h>
+
+/** @defgroup imaging OpenMAX IL Imaging Domain
+ * @ingroup iv
+ * Structures for OpenMAX IL Imaging domain
+ * @{
+ */
+
+/** 
+ * Enumeration used to define the possible image compression coding. 
+ */
+typedef enum OMX_IMAGE_CODINGTYPE {
+    OMX_IMAGE_CodingUnused,      /**< Value when format is N/A */
+    OMX_IMAGE_CodingAutoDetect,  /**< Auto detection of image format */
+    OMX_IMAGE_CodingJPEG,        /**< JPEG/JFIF image format */
+    OMX_IMAGE_CodingJPEG2K,      /**< JPEG 2000 image format */
+    OMX_IMAGE_CodingEXIF,        /**< EXIF image format */
+    OMX_IMAGE_CodingTIFF,        /**< TIFF image format */
+    OMX_IMAGE_CodingGIF,         /**< Graphics image format */
+    OMX_IMAGE_CodingPNG,         /**< PNG image format */
+    OMX_IMAGE_CodingLZW,         /**< LZW image format */
+    OMX_IMAGE_CodingBMP,         /**< Windows Bitmap format */
+    OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_IMAGE_CodingMax = 0x7FFFFFFF
+} OMX_IMAGE_CODINGTYPE;
+
+
+/**
+ * Data structure used to define an image path. The number of image paths 
+ * for input and output will vary by type of the image component.  
+ * 
+ *  Input (aka Source) : Zero Inputs, one Output,
+ *  Splitter           : One Input, 2 or more Outputs,
+ *  Processing Element : One Input, one output,
+ *  Mixer              : 2 or more inputs, one output,
+ *  Output (aka Sink)  : One Input, zero outputs.
+ * 
+ * The PortDefinition structure is used to define all of the parameters 
+ * necessary for the compliant component to setup an input or an output  
+ * image path.  If additional vendor specific data is required, it should  
+ * be transmitted to the component using the CustomCommand function.   
+ * Compliant components will prepopulate this structure with optimal  
+ * values during the OMX_GetParameter() command.
+ *
+ * STRUCT MEMBERS:
+ *  cMIMEType             : MIME type of data for the port
+ *  pNativeRender         : Platform specific reference for a display if a 
+ *                          sync, otherwise this field is 0
+ *  nFrameWidth           : Width of frame to be used on port if 
+ *                          uncompressed format is used.  Use 0 for 
+ *                          unknown, don't care or variable
+ *  nFrameHeight          : Height of frame to be used on port if 
+ *                          uncompressed format is used. Use 0 for 
+ *                          unknown, don't care or variable
+ *  nStride               : Number of bytes per span of an image (i.e. 
+ *                          indicates the number of bytes to get from
+ *                          span N to span N+1, where negative stride 
+ *                          indicates the image is bottom up
+ *  nSliceHeight          : Height used when encoding in slices
+ *  bFlagErrorConcealment : Turns on error concealment if it is supported by 
+ *                          the OMX component
+ *  eCompressionFormat    : Compression format used in this instance of  
+ *                          the component. When OMX_IMAGE_CodingUnused is 
+ *                          specified, eColorFormat is valid
+ *  eColorFormat          : Decompressed format used by this component
+ *  pNativeWindow         : Platform specific reference for a window object if a 
+ *                          display sink , otherwise this field is 0x0. 
+ */
+typedef struct OMX_IMAGE_PORTDEFINITIONTYPE {
+    OMX_STRING cMIMEType;
+    OMX_NATIVE_DEVICETYPE pNativeRender;
+    OMX_U32 nFrameWidth; 
+    OMX_U32 nFrameHeight;
+    OMX_S32 nStride;     
+    OMX_U32 nSliceHeight;
+    OMX_BOOL bFlagErrorConcealment;
+    OMX_IMAGE_CODINGTYPE eCompressionFormat;
+    OMX_COLOR_FORMATTYPE eColorFormat;
+    OMX_NATIVE_WINDOWTYPE pNativeWindow;
+} OMX_IMAGE_PORTDEFINITIONTYPE;
+
+
+/**  
+ * Port format parameter.  This structure is used to enumerate the various 
+ * data input/output format supported by the port.
+ * 
+ * STRUCT MEMBERS:
+ *  nSize              : Size of the structure in bytes
+ *  nVersion           : OMX specification version information
+ *  nPortIndex         : Indicates which port to set
+ *  nIndex             : Indicates the enumeration index for the format from 
+ *                       0x0 to N-1
+ *  eCompressionFormat : Compression format used in this instance of the 
+ *                       component. When OMX_IMAGE_CodingUnused is specified, 
+ *                       eColorFormat is valid
+ *  eColorFormat       : Decompressed format used by this component
+ */
+typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nIndex;
+    OMX_IMAGE_CODINGTYPE eCompressionFormat;
+    OMX_COLOR_FORMATTYPE eColorFormat;
+} OMX_IMAGE_PARAM_PORTFORMATTYPE;
+
+
+/** 
+ * Flash control type 
+ *
+ * ENUMS
+ *  Torch : Flash forced constantly on
+ */
+typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
+    OMX_IMAGE_FlashControlOn = 0,
+    OMX_IMAGE_FlashControlOff,
+    OMX_IMAGE_FlashControlAuto,
+    OMX_IMAGE_FlashControlRedEyeReduction,
+    OMX_IMAGE_FlashControlFillin,
+    OMX_IMAGE_FlashControlTorch,
+    OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
+} OMX_IMAGE_FLASHCONTROLTYPE;
+
+
+/** 
+ * Flash control configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize         : Size of the structure in bytes
+ *  nVersion      : OMX specification version information
+ *  nPortIndex    : Port that this structure applies to
+ *  eFlashControl : Flash control type
+ */
+typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
+} OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
+
+
+/** 
+ * Focus control type 
+ */
+typedef enum OMX_IMAGE_FOCUSCONTROLTYPE {
+    OMX_IMAGE_FocusControlOn = 0,
+    OMX_IMAGE_FocusControlOff,
+    OMX_IMAGE_FocusControlAuto,
+    OMX_IMAGE_FocusControlAutoLock,
+    OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_IMAGE_FocusControlMax = 0x7FFFFFFF
+} OMX_IMAGE_FOCUSCONTROLTYPE;
+
+ 
+/** 
+ * Focus control configuration 
+ *
+ * STRUCT MEMBERS:
+ *  nSize           : Size of the structure in bytes
+ *  nVersion        : OMX specification version information
+ *  nPortIndex      : Port that this structure applies to
+ *  eFocusControl   : Focus control
+ *  nFocusSteps     : Focus can take on values from 0 mm to infinity. 
+ *                    Interest is only in number of steps over this range.
+ *  nFocusStepIndex : Current focus step index
+ */
+typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
+    OMX_U32 nFocusSteps;
+    OMX_U32 nFocusStepIndex;
+} OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
+
+
+/** 
+ * Q Factor for JPEG compression, which controls the tradeoff between image
+ * quality and size.  Q Factor provides a more simple means of controlling
+ * JPEG compression quality, without directly programming Quantization
+ * tables for chroma and luma 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes         
+ *  nVersion   : OMX specification version information 
+ *  nPortIndex : Port that this structure applies to 
+ *  nQFactor   : JPEG Q factor value in the range of 1-100. A factor of 1 
+ *               produces the smallest, worst quality images, and a factor 
+ *               of 100 produces the largest, best quality images.  A 
+ *               typical default is 75 for small good quality images               
+ */
+typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
+    OMX_U32 nSize;            
+    OMX_VERSIONTYPE nVersion; 
+    OMX_U32 nPortIndex;       
+    OMX_U32 nQFactor;                                        
+} OMX_IMAGE_PARAM_QFACTORTYPE;
+
+/** 
+ * Quantization table type 
+ */
+
+typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
+    OMX_IMAGE_QuantizationTableLuma = 0,
+    OMX_IMAGE_QuantizationTableChroma,
+    OMX_IMAGE_QuantizationTableChromaCb,
+    OMX_IMAGE_QuantizationTableChromaCr,
+    OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
+} OMX_IMAGE_QUANTIZATIONTABLETYPE;
+
+/** 
+ * JPEG quantization tables are used to determine DCT compression for
+ * YUV data, as an alternative to specifying Q factor, providing exact 
+ * control of compression 
+ *
+ * STRUCT MEMBERS:
+ *  nSize                   : Size of the structure in bytes
+ *  nVersion                : OMX specification version information 
+ *  nPortIndex              : Port that this structure applies to
+ *  eQuantizationTable      : Quantization table type
+ *  nQuantizationMatrix[64] : JPEG quantization table of coefficients stored 
+ *                            in increasing columns then by rows of data (i.e. 
+ *                            row 1, ... row 8). Quantization values are in 
+ *                            the range 0-255 and stored in linear order
+ *                            (i.e. the component will zig-zag the 
+ *                            quantization table data if required internally) 
+ */
+typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
+    OMX_U8 nQuantizationMatrix[64];
+} OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
+
+
+/** 
+ * Huffman table type, the same Huffman table is applied for chroma and 
+ * luma component 
+ */
+typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
+    OMX_IMAGE_HuffmanTableAC = 0,
+    OMX_IMAGE_HuffmanTableDC,
+    OMX_IMAGE_HuffmanTableACLuma,
+    OMX_IMAGE_HuffmanTableACChroma,
+    OMX_IMAGE_HuffmanTableDCLuma,
+    OMX_IMAGE_HuffmanTableDCChroma,
+    OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
+} OMX_IMAGE_HUFFMANTABLETYPE;
+
+/** 
+ * JPEG Huffman table 
+ *
+ * STRUCT MEMBERS:
+ *  nSize                            : Size of the structure in bytes
+ *  nVersion                         : OMX specification version information
+ *  nPortIndex                       : Port that this structure applies to
+ *  eHuffmanTable                    : Huffman table type
+ *  nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each 
+ *                                     possible length
+ *  nHuffmanTable[256]               : 0-255, the size used for AC and DC 
+ *                                     HuffmanTable are 16 and 162 
+ */
+typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
+    OMX_U8 nNumberOfHuffmanCodeOfLength[16];
+    OMX_U8 nHuffmanTable[256];
+}OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Index.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Index.h
new file mode 100644
index 0000000..44d4ea7
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Index.h
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ *
+ */
+
+/** @file OMX_Index.h - OpenMax IL version 1.1.2
+ *  The OMX_Index header file contains the definitions for both applications
+ *  and components .
+ */
+
+
+#ifndef OMX_Index_h
+#define OMX_Index_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* Each OMX header must include all required header files to allow the
+ *  header to compile without errors.  The includes below are required
+ *  for this header file to compile successfully 
+ */
+#include <OMX_Types.h>
+
+
+/** The OMX_INDEXTYPE enumeration is used to select a structure when either
+ *  getting or setting parameters and/or configuration data.  Each entry in 
+ *  this enumeration maps to an OMX specified structure.  When the 
+ *  OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods
+ *  are used, the second parameter will always be an entry from this enumeration
+ *  and the third entry will be the structure shown in the comments for the entry.
+ *  For example, if the application is initializing a cropping function, the 
+ *  OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter 
+ *  and would send a pointer to an initialized OMX_RECTTYPE structure as the 
+ *  third parameter.
+ *  
+ *  The enumeration entries named with the OMX_Config prefix are sent using
+ *  the OMX_SetConfig command and the enumeration entries named with the
+ *  OMX_PARAM_ prefix are sent using the OMX_SetParameter command.
+ */
+typedef enum OMX_INDEXTYPE {
+
+    OMX_IndexComponentStartUnused = 0x01000000,
+    OMX_IndexParamPriorityMgmt,             /**< reference: OMX_PRIORITYMGMTTYPE */
+    OMX_IndexParamAudioInit,                /**< reference: OMX_PORT_PARAM_TYPE */
+    OMX_IndexParamImageInit,                /**< reference: OMX_PORT_PARAM_TYPE */
+    OMX_IndexParamVideoInit,                /**< reference: OMX_PORT_PARAM_TYPE */
+    OMX_IndexParamOtherInit,                /**< reference: OMX_PORT_PARAM_TYPE */
+    OMX_IndexParamNumAvailableStreams,      /**< reference: OMX_PARAM_U32TYPE */
+    OMX_IndexParamActiveStream,             /**< reference: OMX_PARAM_U32TYPE */
+    OMX_IndexParamSuspensionPolicy,         /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */
+    OMX_IndexParamComponentSuspended,       /**< reference: OMX_PARAM_SUSPENSIONTYPE */
+    OMX_IndexConfigCapturing,               /**< reference: OMX_CONFIG_BOOLEANTYPE */ 
+    OMX_IndexConfigCaptureMode,             /**< reference: OMX_CONFIG_CAPTUREMODETYPE */ 
+    OMX_IndexAutoPauseAfterCapture,         /**< reference: OMX_CONFIG_BOOLEANTYPE */ 
+    OMX_IndexParamContentURI,               /**< reference: OMX_PARAM_CONTENTURITYPE */
+    OMX_IndexParamCustomContentPipe,        /**< reference: OMX_PARAM_CONTENTPIPETYPE */ 
+    OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */
+    OMX_IndexConfigMetadataItemCount,       /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */
+    OMX_IndexConfigContainerNodeCount,      /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */
+    OMX_IndexConfigMetadataItem,            /**< reference: OMX_CONFIG_METADATAITEMTYPE */
+    OMX_IndexConfigCounterNodeID,           /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */
+    OMX_IndexParamMetadataFilterType,       /**< reference: OMX_PARAM_METADATAFILTERTYPE */
+    OMX_IndexParamMetadataKeyFilter,        /**< reference: OMX_PARAM_METADATAFILTERTYPE */
+    OMX_IndexConfigPriorityMgmt,            /**< reference: OMX_PRIORITYMGMTTYPE */
+    OMX_IndexParamStandardComponentRole,    /**< reference: OMX_PARAM_COMPONENTROLETYPE */
+
+    OMX_IndexPortStartUnused = 0x02000000,
+    OMX_IndexParamPortDefinition,           /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */
+    OMX_IndexParamCompBufferSupplier,       /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */ 
+    OMX_IndexReservedStartUnused = 0x03000000,
+
+    /* Audio parameters and configurations */
+    OMX_IndexAudioStartUnused = 0x04000000,
+    OMX_IndexParamAudioPortFormat,          /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */
+    OMX_IndexParamAudioPcm,                 /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */
+    OMX_IndexParamAudioAac,                 /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */
+    OMX_IndexParamAudioRa,                  /**< reference: OMX_AUDIO_PARAM_RATYPE */
+    OMX_IndexParamAudioMp3,                 /**< reference: OMX_AUDIO_PARAM_MP3TYPE */
+    OMX_IndexParamAudioAdpcm,               /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */
+    OMX_IndexParamAudioG723,                /**< reference: OMX_AUDIO_PARAM_G723TYPE */
+    OMX_IndexParamAudioG729,                /**< reference: OMX_AUDIO_PARAM_G729TYPE */
+    OMX_IndexParamAudioAmr,                 /**< reference: OMX_AUDIO_PARAM_AMRTYPE */
+    OMX_IndexParamAudioWma,                 /**< reference: OMX_AUDIO_PARAM_WMATYPE */
+    OMX_IndexParamAudioSbc,                 /**< reference: OMX_AUDIO_PARAM_SBCTYPE */
+    OMX_IndexParamAudioMidi,                /**< reference: OMX_AUDIO_PARAM_MIDITYPE */
+    OMX_IndexParamAudioGsm_FR,              /**< reference: OMX_AUDIO_PARAM_GSMFRTYPE */
+    OMX_IndexParamAudioMidiLoadUserSound,   /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */
+    OMX_IndexParamAudioG726,                /**< reference: OMX_AUDIO_PARAM_G726TYPE */
+    OMX_IndexParamAudioGsm_EFR,             /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */
+    OMX_IndexParamAudioGsm_HR,              /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */
+    OMX_IndexParamAudioPdc_FR,              /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */
+    OMX_IndexParamAudioPdc_EFR,             /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */
+    OMX_IndexParamAudioPdc_HR,              /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */
+    OMX_IndexParamAudioTdma_FR,             /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */
+    OMX_IndexParamAudioTdma_EFR,            /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */
+    OMX_IndexParamAudioQcelp8,              /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */
+    OMX_IndexParamAudioQcelp13,             /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */
+    OMX_IndexParamAudioEvrc,                /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */
+    OMX_IndexParamAudioSmv,                 /**< reference: OMX_AUDIO_PARAM_SMVTYPE */
+    OMX_IndexParamAudioVorbis,              /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */
+
+    OMX_IndexConfigAudioMidiImmediateEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */
+    OMX_IndexConfigAudioMidiControl,        /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */
+    OMX_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */
+    OMX_IndexConfigAudioMidiStatus,         /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */
+    OMX_IndexConfigAudioMidiMetaEvent,      /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */
+    OMX_IndexConfigAudioMidiMetaEventData,  /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */
+    OMX_IndexConfigAudioVolume,             /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */
+    OMX_IndexConfigAudioBalance,            /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */
+    OMX_IndexConfigAudioChannelMute,        /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */
+    OMX_IndexConfigAudioMute,               /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */
+    OMX_IndexConfigAudioLoudness,           /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */
+    OMX_IndexConfigAudioEchoCancelation,    /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */
+    OMX_IndexConfigAudioNoiseReduction,     /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */
+    OMX_IndexConfigAudioBass,               /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */
+    OMX_IndexConfigAudioTreble,             /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */
+    OMX_IndexConfigAudioStereoWidening,     /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */
+    OMX_IndexConfigAudioChorus,             /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */
+    OMX_IndexConfigAudioEqualizer,          /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */
+    OMX_IndexConfigAudioReverberation,      /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */
+    OMX_IndexConfigAudioChannelVolume,      /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */
+
+    /* Image specific parameters and configurations */
+    OMX_IndexImageStartUnused = 0x05000000,
+    OMX_IndexParamImagePortFormat,          /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */
+    OMX_IndexParamFlashControl,             /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
+    OMX_IndexConfigFocusControl,            /**< reference: OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */
+    OMX_IndexParamQFactor,                  /**< reference: OMX_IMAGE_PARAM_QFACTORTYPE */
+    OMX_IndexParamQuantizationTable,        /**< reference: OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */
+    OMX_IndexParamHuffmanTable,             /**< reference: OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */
+    OMX_IndexConfigFlashControl,            /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
+
+    /* Video specific parameters and configurations */
+    OMX_IndexVideoStartUnused = 0x06000000,
+    OMX_IndexParamVideoPortFormat,          /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */
+    OMX_IndexParamVideoQuantization,        /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONTYPE */
+    OMX_IndexParamVideoFastUpdate,          /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */
+    OMX_IndexParamVideoBitrate,             /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */
+    OMX_IndexParamVideoMotionVector,        /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */
+    OMX_IndexParamVideoIntraRefresh,        /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */
+    OMX_IndexParamVideoErrorCorrection,     /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */
+    OMX_IndexParamVideoVBSMC,               /**< reference: OMX_VIDEO_PARAM_VBSMCTYPE */
+    OMX_IndexParamVideoMpeg2,               /**< reference: OMX_VIDEO_PARAM_MPEG2TYPE */
+    OMX_IndexParamVideoMpeg4,               /**< reference: OMX_VIDEO_PARAM_MPEG4TYPE */
+    OMX_IndexParamVideoWmv,                 /**< reference: OMX_VIDEO_PARAM_WMVTYPE */
+    OMX_IndexParamVideoRv,                  /**< reference: OMX_VIDEO_PARAM_RVTYPE */
+    OMX_IndexParamVideoAvc,                 /**< reference: OMX_VIDEO_PARAM_AVCTYPE */
+    OMX_IndexParamVideoH263,                /**< reference: OMX_VIDEO_PARAM_H263TYPE */
+    OMX_IndexParamVideoProfileLevelQuerySupported, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
+    OMX_IndexParamVideoProfileLevelCurrent, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
+    OMX_IndexConfigVideoBitrate,            /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */
+    OMX_IndexConfigVideoFramerate,          /**< reference: OMX_CONFIG_FRAMERATETYPE */
+    OMX_IndexConfigVideoIntraVOPRefresh,    /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */
+    OMX_IndexConfigVideoIntraMBRefresh,     /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
+    OMX_IndexConfigVideoMBErrorReporting,   /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */
+    OMX_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */
+    OMX_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
+    OMX_IndexParamVideoSliceFMO,            /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */
+    OMX_IndexConfigVideoAVCIntraPeriod,     /**< reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */
+    OMX_IndexConfigVideoNalSize,            /**< reference: OMX_VIDEO_CONFIG_NALSIZE */
+
+    /* Image & Video common Configurations */
+    OMX_IndexCommonStartUnused = 0x07000000,
+    OMX_IndexParamCommonDeblocking,         /**< reference: OMX_PARAM_DEBLOCKINGTYPE */
+    OMX_IndexParamCommonSensorMode,         /**< reference: OMX_PARAM_SENSORMODETYPE */
+    OMX_IndexParamCommonInterleave,         /**< reference: OMX_PARAM_INTERLEAVETYPE */
+    OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */
+    OMX_IndexConfigCommonScale,             /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
+    OMX_IndexConfigCommonImageFilter,       /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */
+    OMX_IndexConfigCommonColorEnhancement,  /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */
+    OMX_IndexConfigCommonColorKey,          /**< reference: OMX_CONFIG_COLORKEYTYPE */
+    OMX_IndexConfigCommonColorBlend,        /**< reference: OMX_CONFIG_COLORBLENDTYPE */
+    OMX_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */
+    OMX_IndexConfigCommonRotate,            /**< reference: OMX_CONFIG_ROTATIONTYPE */
+    OMX_IndexConfigCommonMirror,            /**< reference: OMX_CONFIG_MIRRORTYPE */
+    OMX_IndexConfigCommonOutputPosition,    /**< reference: OMX_CONFIG_POINTTYPE */
+    OMX_IndexConfigCommonInputCrop,         /**< reference: OMX_CONFIG_RECTTYPE */
+    OMX_IndexConfigCommonOutputCrop,        /**< reference: OMX_CONFIG_RECTTYPE */
+    OMX_IndexConfigCommonDigitalZoom,       /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
+    OMX_IndexConfigCommonOpticalZoom,       /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/
+    OMX_IndexConfigCommonWhiteBalance,      /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */
+    OMX_IndexConfigCommonExposure,          /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */
+    OMX_IndexConfigCommonContrast,          /**< reference: OMX_CONFIG_CONTRASTTYPE */
+    OMX_IndexConfigCommonBrightness,        /**< reference: OMX_CONFIG_BRIGHTNESSTYPE */
+    OMX_IndexConfigCommonBacklight,         /**< reference: OMX_CONFIG_BACKLIGHTTYPE */
+    OMX_IndexConfigCommonGamma,             /**< reference: OMX_CONFIG_GAMMATYPE */
+    OMX_IndexConfigCommonSaturation,        /**< reference: OMX_CONFIG_SATURATIONTYPE */
+    OMX_IndexConfigCommonLightness,         /**< reference: OMX_CONFIG_LIGHTNESSTYPE */
+    OMX_IndexConfigCommonExclusionRect,     /**< reference: OMX_CONFIG_RECTTYPE */
+    OMX_IndexConfigCommonDithering,         /**< reference: OMX_CONFIG_DITHERTYPE */
+    OMX_IndexConfigCommonPlaneBlend,        /**< reference: OMX_CONFIG_PLANEBLENDTYPE */
+    OMX_IndexConfigCommonExposureValue,     /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */
+    OMX_IndexConfigCommonOutputSize,        /**< reference: OMX_FRAMESIZETYPE */
+    OMX_IndexParamCommonExtraQuantData,     /**< reference: OMX_OTHER_EXTRADATATYPE */
+    OMX_IndexConfigCommonFocusRegion,       /**< reference: OMX_CONFIG_FOCUSREGIONTYPE */
+    OMX_IndexConfigCommonFocusStatus,       /**< reference: OMX_PARAM_FOCUSSTATUSTYPE */
+    OMX_IndexConfigCommonTransitionEffect,  /**< reference: OMX_CONFIG_TRANSITIONEFFECTTYPE */
+
+    /* Reserved Configuration range */
+    OMX_IndexOtherStartUnused = 0x08000000,
+    OMX_IndexParamOtherPortFormat,          /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */
+    OMX_IndexConfigOtherPower,              /**< reference: OMX_OTHER_CONFIG_POWERTYPE */
+    OMX_IndexConfigOtherStats,              /**< reference: OMX_OTHER_CONFIG_STATSTYPE */
+
+
+    /* Reserved Time range */
+    OMX_IndexTimeStartUnused = 0x09000000,
+    OMX_IndexConfigTimeScale,               /**< reference: OMX_TIME_CONFIG_SCALETYPE */
+    OMX_IndexConfigTimeClockState,          /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */
+    OMX_IndexConfigTimeActiveRefClock,      /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */
+    OMX_IndexConfigTimeCurrentMediaTime,    /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
+    OMX_IndexConfigTimeCurrentWallTime,     /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
+    OMX_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
+    OMX_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
+    OMX_IndexConfigTimeMediaTimeRequest,    /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */
+    OMX_IndexConfigTimeClientStartTime,     /**<reference:  OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
+    OMX_IndexConfigTimePosition,            /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE */
+    OMX_IndexConfigTimeSeekMode,            /**< reference: OMX_TIME_CONFIG_SEEKMODETYPE */
+
+
+    OMX_IndexKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    /* Vendor specific area */
+    OMX_IndexVendorStartUnused = 0x7F000000,
+    /* Vendor specific structures should be in the range of 0x7F000000 
+       to 0x7FFFFFFE.  This range is not broken out by vendor, so
+       private indexes are not guaranteed unique and therefore should
+       only be sent to the appropriate component. */
+
+    OMX_IndexMax = 0x7FFFFFFF
+
+} OMX_INDEXTYPE;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Other.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Other.h
new file mode 100644
index 0000000..caf7f38
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Other.h
@@ -0,0 +1,337 @@
+/*
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ *
+ */
+
+/** @file OMX_Other.h - OpenMax IL version 1.1.2
+ *  The structures needed by Other components to exchange
+ *  parameters and configuration data with the components.
+ */
+
+#ifndef OMX_Other_h
+#define OMX_Other_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* Each OMX header must include all required header files to allow the
+ *  header to compile without errors.  The includes below are required
+ *  for this header file to compile successfully 
+ */
+
+#include <OMX_Core.h>
+
+
+/** 
+ * Enumeration of possible data types which match to multiple domains or no
+ * domain at all.  For types which are vendor specific, a value above
+ * OMX_OTHER_VENDORTSTART should be used.
+ */
+typedef enum OMX_OTHER_FORMATTYPE {
+    OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time, 
+                                   time deltas, etc */
+    OMX_OTHER_FormatPower,    /**< Perhaps used for enabling/disabling power 
+                                   management, setting clocks? */
+    OMX_OTHER_FormatStats,    /**< Could be things such as frame rate, frames 
+                                   dropped, etc */
+    OMX_OTHER_FormatBinary,   /**< Arbitrary binary data */
+    OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific 
+                                                formats */
+
+    OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_OTHER_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_OTHER_FormatMax = 0x7FFFFFFF
+} OMX_OTHER_FORMATTYPE;
+
+/** 
+ * Enumeration of seek modes.
+ */
+typedef enum OMX_TIME_SEEKMODETYPE {
+    OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation
+                                * of the requested seek position over   
+                                * the actual seek position if it
+                                * results in a faster seek. */
+    OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek 
+                                * position over an approximation
+                                * of the requested seek position even
+                                * if it results in a slower seek. */
+    OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_TIME_SeekModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_TIME_SeekModeMax = 0x7FFFFFFF
+} OMX_TIME_SEEKMODETYPE;
+
+/* Structure representing the seekmode of the component */
+typedef struct OMX_TIME_CONFIG_SEEKMODETYPE {
+    OMX_U32 nSize;                  /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
+    OMX_TIME_SEEKMODETYPE eType;    /**< The seek mode */
+} OMX_TIME_CONFIG_SEEKMODETYPE;
+
+/** Structure representing a time stamp used with the following configs 
+ * on the Clock Component (CC):
+ * 
+ * OMX_IndexConfigTimeCurrentWallTime: query of the CCÂ’s current wall  
+ *     time
+ * OMX_IndexConfigTimeCurrentMediaTime: query of the CCÂ’s current media
+ *     time
+ * OMX_IndexConfigTimeCurrentAudioReference and  
+ * OMX_IndexConfigTimeCurrentVideoReference: audio/video reference 
+ *     clock sending SC its reference time
+ * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends 
+ *     this structure to the Clock Component via a SetConfig on its 
+ *     client port when it receives a buffer with
+ *     OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp
+ *     specified by that buffer for nStartTimestamp. 
+ *
+ * ItÂ’s also used with the following config on components in general:
+ *
+ * OMX_IndexConfigTimePosition: IL client querying component position 
+ * (GetConfig) or commanding a component to seek to the given location
+ * (SetConfig)
+ */	
+typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE {
+    OMX_U32 nSize;               /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;    /**< OMX specification version
+                                  *   information */
+    OMX_U32 nPortIndex;     /**< port that this structure applies to */
+    OMX_TICKS nTimestamp;  	     /**< timestamp .*/ 
+} OMX_TIME_CONFIG_TIMESTAMPTYPE;  
+
+/** Enumeration of possible reference clocks to the media time. */
+typedef enum OMX_TIME_UPDATETYPE {
+      OMX_TIME_UpdateRequestFulfillment,    /**< Update is the fulfillment of a media time request. */
+      OMX_TIME_UpdateScaleChanged,	        /**< Update was generated because the scale chagned. */
+      OMX_TIME_UpdateClockStateChanged,     /**< Update was generated because the clock state changed. */
+      OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+      OMX_TIME_UpdateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+      OMX_TIME_UpdateMax = 0x7FFFFFFF
+} OMX_TIME_UPDATETYPE;
+
+/** Enumeration of possible reference clocks to the media time. */
+typedef enum OMX_TIME_REFCLOCKTYPE {
+      OMX_TIME_RefClockNone,    /**< Use no references. */
+      OMX_TIME_RefClockAudio,	/**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */
+      OMX_TIME_RefClockVideo,   /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */
+      OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+      OMX_TIME_RefClockVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+      OMX_TIME_RefClockMax = 0x7FFFFFFF
+} OMX_TIME_REFCLOCKTYPE;
+
+/** Enumeration of clock states. */
+typedef enum OMX_TIME_CLOCKSTATE {
+      OMX_TIME_ClockStateRunning,             /**< Clock running. */
+      OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the 
+                                               *   prescribed clients emit their
+                                               *   start time. */
+      OMX_TIME_ClockStateStopped,             /**< Clock stopped. */
+      OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+      OMX_TIME_ClockStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+      OMX_TIME_ClockStateMax = 0x7FFFFFFF
+} OMX_TIME_CLOCKSTATE;
+
+/** Structure representing a media time request to the clock component.
+ *
+ *  A client component sends this structure to the Clock Component via a SetConfig
+ *  on its client port to specify a media timestamp the Clock Component
+ *  should emit.  The Clock Component should fulfill the request by sending a
+ *  OMX_TIME_MEDIATIMETYPE when its media clock matches the requested 
+ *  timestamp.
+ *
+ *  The client may require a media time request be fulfilled slightly
+ *  earlier than the media time specified. In this case the client specifies 
+ *  an offset which is equal to the difference between wall time corresponding 
+ *  to the requested media time and the wall time when it will be 
+ *  fulfilled. 
+ *
+ *  A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to
+ *  time events according to timestamps. If a client must perform an operation O at
+ *  a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a 
+ *  media time request at T (perhaps specifying an offset to ensure the request fulfillment
+ *  is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE
+ *  structure back to the client component, the client may perform operation O (perhaps having
+ *  to wait a slight amount more time itself as specified by the return values).
+ */
+
+typedef struct OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version information */
+    OMX_U32 nPortIndex;         /**< port that this structure applies to */
+    OMX_PTR pClientPrivate;     /**< Client private data to disabiguate this media time 
+                                 *   from others (e.g. the number of the frame to deliver). 
+                                 *   Duplicated in the media time structure that fulfills 
+                                 *   this request. A value of zero is reserved for time scale 
+                                 *   updates. */
+    OMX_TICKS nMediaTimestamp;  /**< Media timestamp requested.*/ 
+    OMX_TICKS nOffset;          /**< Amount of wall clock time by which this
+                                 *   request should be fulfilled early */
+} OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE;
+
+/**< Structure sent from the clock component client either when fulfilling 
+ *   a media time request or when the time scale has changed. 
+ *
+ *   In the former case the Clock Component fills this structure and times its emission 
+ *   to a client component (via the client port) according to the corresponding media 
+ *   time request sent by the client. The Clock Component should time the emission to occur
+ *   when the requested timestamp matches the Clock Component's media time but also the 
+ *   prescribed offset early. 
+ *
+ *   Upon scale changes the clock component clears the nClientPrivate data, sends the current
+ *   media time and sets the nScale to the new scale via the client port. It emits a 
+ *   OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to 
+ *   alter processing to accomodate scaling. For instance a video component might skip inter-frames 
+ *   in the case of extreme fastforward. Likewise an audio component might add or remove samples 
+ *   from an audio frame to scale audio data. 
+ *
+ *   It is expected that some clock components may not be able to fulfill requests
+ *   at exactly the prescribed time. This is acceptable so long as the request is 
+ *   fulfilled at least as early as described and not later. This structure provides 
+ *   fields the client may use to wait for the remaining time.
+ *
+ *   The client may use either the nOffset or nWallTimeAtMedia fields to determine the 
+ *   wall time until the nMediaTimestamp actually occurs. In the latter case the
+ *   client can get a more accurate value for offset by getting the current wall
+ *   from the cloc component and subtracting it from nWallTimeAtMedia. 
+ */
+
+typedef struct OMX_TIME_MEDIATIMETYPE {
+    OMX_U32 nSize;                  /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
+    OMX_U32 nClientPrivate;         /**< Client private data to disabiguate this media time 
+                                     *   from others. Copied from the media time request. 
+                                     *   A value of zero is reserved for time scale updates. */
+    OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */
+    OMX_TICKS nMediaTimestamp;      /**< Media time requested. If no media time was 
+                                     *   requested then this is the current media time. */ 
+    OMX_TICKS nOffset;              /**< Amount of wall clock time by which this
+                                     *   request was actually fulfilled early */
+
+    OMX_TICKS nWallTimeAtMediaTime; /**< Wall time corresponding to nMediaTimeStamp.
+                                     *   A client may compare this value to current
+                                     *   media time obtained from the Clock Component to determine
+                                     *   the wall time until the media timestamp is really
+                                     *   current. */
+    OMX_S32 xScale;                 /**< Current media time scale in Q16 format. */
+    OMX_TIME_CLOCKSTATE eState;     /* Seeking Change. Added 7/12.*/
+                                    /**< State of the media time. */
+} OMX_TIME_MEDIATIMETYPE;  
+
+/** Structure representing the current media time scale factor. Applicable only to clock 
+ *  component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via
+ *  the clock component client ports. Upon recieving this config the clock component changes 
+ *  the rate by which the media time increases or decreases effectively implementing trick modes. 
+ */ 
+typedef struct OMX_TIME_CONFIG_SCALETYPE {
+    OMX_U32 nSize;                  /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
+    OMX_S32 xScale;                 /**< This is a value in Q16 format which is used for
+                                     * scaling the media time */
+} OMX_TIME_CONFIG_SCALETYPE;
+ 
+/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPEÂ’s nWaitMask field */
+#define OMX_CLOCKPORT0 0x00000001
+#define OMX_CLOCKPORT1 0x00000002
+#define OMX_CLOCKPORT2 0x00000004
+#define OMX_CLOCKPORT3 0x00000008
+#define OMX_CLOCKPORT4 0x00000010
+#define OMX_CLOCKPORT5 0x00000020
+#define OMX_CLOCKPORT6 0x00000040
+#define OMX_CLOCKPORT7 0x00000080
+
+/** Structure representing the current mode of the media clock. 
+ *  IL Client uses this config to change or query the mode of the 
+ *  media clock of the clock component. Applicable only to clock
+ *  component. 
+ *  
+ *  On a SetConfig if eState is OMX_TIME_ClockStateRunning media time
+ *  starts immediately at the prescribed start time. If
+ *  OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores
+ *  the given nStartTime and waits for all clients specified in the 
+ *  nWaitMask to send starttimes (via 
+ *  OMX_IndexConfigTimeClientStartTime). The Clock Component then starts 
+ *  the media clock using the earliest start time supplied. */    
+typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE {
+    OMX_U32 nSize;              /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;   /**< OMX specification version 
+                                 *   information */
+    OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */
+    OMX_TICKS nStartTime;       /**< Start time of the media time. */
+    OMX_TICKS nOffset;          /**< Time to offset the media time by 
+                                 * (e.g. preroll). Media time will be
+                                 * reported to be nOffset ticks earlier.     
+                                 */
+    OMX_U32 nWaitMask;          /**< Mask of OMX_CLOCKPORT values. */
+} OMX_TIME_CONFIG_CLOCKSTATETYPE;
+
+/** Structure representing the reference clock currently being used to
+ *  compute media time. IL client uses this config to change or query the 
+ *  clock component's active reference clock */
+typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE {
+    OMX_U32 nSize;                  /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion;       /**< OMX specification version information */
+    OMX_TIME_REFCLOCKTYPE eClock;   /**< Reference clock used to compute media time */                        
+} OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE;
+
+/** Descriptor for setting specifics of power type.
+ *  Note: this structure is listed for backwards compatibility. */
+typedef struct OMX_OTHER_CONFIG_POWERTYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_BOOL bEnablePM;       /**< Flag to enable Power Management */
+} OMX_OTHER_CONFIG_POWERTYPE;
+
+
+/** Descriptor for setting specifics of stats type.
+ *  Note: this structure is listed for backwards compatibility. */
+typedef struct OMX_OTHER_CONFIG_STATSTYPE {
+    OMX_U32 nSize;            /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    /* what goes here */
+} OMX_OTHER_CONFIG_STATSTYPE;
+
+
+/**
+ * The PortDefinition structure is used to define all of the parameters 
+ * necessary for the compliant component to setup an input or an output other 
+ * path.
+ */
+typedef struct OMX_OTHER_PORTDEFINITIONTYPE {
+    OMX_OTHER_FORMATTYPE eFormat;  /**< Type of data expected for this channel */
+} OMX_OTHER_PORTDEFINITIONTYPE;
+
+/**  Port format parameter.  This structure is used to enumerate
+  *  the various data input/output format supported by the port.
+  */
+typedef struct OMX_OTHER_PARAM_PORTFORMATTYPE {
+    OMX_U32 nSize; /**< size of the structure in bytes */
+    OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
+    OMX_U32 nPortIndex; /**< Indicates which port to set */
+    OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */
+    OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
+} OMX_OTHER_PARAM_PORTFORMATTYPE; 
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Types.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Types.h
new file mode 100644
index 0000000..31be916
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Types.h
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ *
+ */
+
+/** OMX_Types.h - OpenMax IL version 1.1.2
+ *  The OMX_Types header file contains the primitive type definitions used by 
+ *  the core, the application and the component.  This file may need to be
+ *  modified to be used on systems that do not have "char" set to 8 bits, 
+ *  "short" set to 16 bits and "long" set to 32 bits.
+ */
+
+#ifndef OMX_Types_h
+#define OMX_Types_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** The OMX_API and OMX_APIENTRY are platform specific definitions used
+ *  to declare OMX function prototypes.  They are modified to meet the
+ *  requirements for a particular platform */
+#ifdef __SYMBIAN32__   
+#   ifdef __OMX_EXPORTS
+#       define OMX_API __declspec(dllexport)
+#   else
+#       ifdef _WIN32
+#           define OMX_API __declspec(dllexport) 
+#       else
+#           define OMX_API __declspec(dllimport)
+#       endif
+#   endif
+#else
+#   ifdef _WIN32
+#      ifdef __OMX_EXPORTS
+#          define OMX_API __declspec(dllexport)
+#      else
+#          define OMX_API __declspec(dllimport)
+#      endif
+#   else
+#      ifdef __OMX_EXPORTS
+#          define OMX_API
+#      else
+#          define OMX_API extern
+#      endif
+#   endif
+#endif
+
+#ifndef OMX_APIENTRY
+#define OMX_APIENTRY 
+#endif 
+
+/** OMX_IN is used to identify inputs to an OMX function.  This designation 
+    will also be used in the case of a pointer that points to a parameter 
+    that is used as an output. */
+#ifndef OMX_IN
+#define OMX_IN
+#endif
+
+/** OMX_OUT is used to identify outputs from an OMX function.  This 
+    designation will also be used in the case of a pointer that points 
+    to a parameter that is used as an input. */
+#ifndef OMX_OUT
+#define OMX_OUT
+#endif
+
+
+/** OMX_INOUT is used to identify parameters that may be either inputs or
+    outputs from an OMX function at the same time.  This designation will 
+    also be used in the case of a pointer that  points to a parameter that 
+    is used both as an input and an output. */
+#ifndef OMX_INOUT
+#define OMX_INOUT
+#endif
+
+/** OMX_ALL is used to as a wildcard to select all entities of the same type
+ *  when specifying the index, or referring to a object by an index.  (i.e.
+ *  use OMX_ALL to indicate all N channels). When used as a port index
+ *  for a config or parameter this OMX_ALL denotes that the config or
+ *  parameter applies to the entire component not just one port. */
+#define OMX_ALL 0xFFFFFFFF
+
+/** In the following we define groups that help building doxygen documentation */
+
+/** @defgroup core OpenMAX IL core
+ * Functions and structure related to the OMX IL core
+ */
+ 
+ /** @defgroup comp OpenMAX IL component
+ * Functions and structure related to the OMX IL component
+ */
+ 
+/** @defgroup rpm Resource and Policy Management 
+ * Structures for resource and policy management of components
+ */
+
+/** @defgroup buf Buffer Management
+ * Buffer handling functions and structures
+ */
+  
+/** @defgroup tun Tunneling
+ * @ingroup core comp
+ * Structures and functions to manage tunnels among component ports
+ */
+ 
+/** @defgroup cp Content Pipes
+ *  @ingroup core
+ */
+ 
+ /** @defgroup metadata Metadata handling
+  * 
+  */ 
+
+/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
+typedef unsigned char OMX_U8;
+
+/** OMX_S8 is an 8 bit signed quantity that is byte aligned */
+typedef signed char OMX_S8;
+
+/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
+typedef unsigned short OMX_U16;
+
+/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
+typedef signed short OMX_S16;
+
+/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
+typedef unsigned long OMX_U32;
+
+/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
+typedef signed long OMX_S32;
+
+
+/* Users with compilers that cannot accept the "long long" designation should
+   define the OMX_SKIP64BIT macro.  It should be noted that this may cause 
+   some components to fail to compile if the component was written to require
+   64 bit integral types.  However, these components would NOT compile anyway
+   since the compiler does not support the way the component was written.
+*/
+#ifndef OMX_SKIP64BIT
+#ifdef __SYMBIAN32__
+/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
+typedef unsigned long long OMX_U64;
+
+/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
+typedef signed long long OMX_S64;
+
+#elif defined(WIN32)
+
+/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */   
+typedef unsigned __int64  OMX_U64;
+
+/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
+typedef signed   __int64  OMX_S64;
+
+#else /* WIN32 */
+
+/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
+typedef unsigned long long OMX_U64;
+
+/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
+typedef signed long long OMX_S64;
+
+#endif /* WIN32 */
+#endif
+
+
+/** The OMX_BOOL type is intended to be used to represent a true or a false 
+    value when passing parameters to and from the OMX core and components.  The
+    OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary.
+ */
+typedef enum OMX_BOOL {
+    OMX_FALSE = 0,
+    OMX_TRUE = !OMX_FALSE,
+    OMX_BOOL_MAX = 0x7FFFFFFF
+} OMX_BOOL; 
+ 
+/** The OMX_PTR type is intended to be used to pass pointers between the OMX
+    applications and the OMX Core and components.  This is a 32 bit pointer and
+    is aligned on a 32 bit boundary.
+ */
+typedef void* OMX_PTR;
+
+/** The OMX_STRING type is intended to be used to pass "C" type strings between
+    the application and the core and component.  The OMX_STRING type is a 32 
+    bit pointer to a zero terminated string.  The  pointer is word aligned and 
+    the string is byte aligned.  
+ */
+typedef char* OMX_STRING;
+
+/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
+    buffers between the application and the component and core.  The OMX_BYTE 
+    type is a 32 bit pointer to a zero terminated string.  The  pointer is word
+    aligned and the string is byte aligned.
+ */
+typedef unsigned char* OMX_BYTE;
+
+/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
+    at runtime.  This identifier should be generated by a component in a way
+    that guarantees that every instance of the identifier running on the system
+    is unique. */
+typedef unsigned char OMX_UUIDTYPE[128];
+
+/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
+    an output port.  This enumeration is common across all component types.    
+ */
+typedef enum OMX_DIRTYPE
+{
+    OMX_DirInput,              /**< Port is an input port */
+    OMX_DirOutput,             /**< Port is an output port */
+    OMX_DirMax = 0x7FFFFFFF
+} OMX_DIRTYPE;
+
+/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering 
+    for numerical data (i.e. big endian, or little endian).    
+ */
+typedef enum OMX_ENDIANTYPE
+{
+    OMX_EndianBig, /**< big endian */
+    OMX_EndianLittle, /**< little endian */
+    OMX_EndianMax = 0x7FFFFFFF
+} OMX_ENDIANTYPE;
+
+
+/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data 
+    is signed or unsigned
+ */
+typedef enum OMX_NUMERICALDATATYPE
+{
+    OMX_NumericalDataSigned, /**< signed data */
+    OMX_NumericalDataUnsigned, /**< unsigned data */
+    OMX_NumercialDataMax = 0x7FFFFFFF
+} OMX_NUMERICALDATATYPE;
+
+
+/** Unsigned bounded value type */
+typedef struct OMX_BU32 {
+    OMX_U32 nValue; /**< actual value */
+    OMX_U32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
+    OMX_U32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
+} OMX_BU32;
+
+
+/** Signed bounded value type */
+typedef struct OMX_BS32 {
+    OMX_S32 nValue; /**< actual value */
+    OMX_S32 nMin;   /**< minimum for value (i.e. nValue >= nMin) */
+    OMX_S32 nMax;   /**< maximum for value (i.e. nValue <= nMax) */
+} OMX_BS32;
+
+
+/** Structure representing some time or duration in microseconds. This structure
+  *  must be interpreted as a signed 64 bit value. The quantity is signed to accommodate 
+  *  negative deltas and preroll scenarios. The quantity is represented in microseconds 
+  *  to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
+  *  on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g. 
+  *  individual audio samples delivered at 192 kHz). The quantity is 64 bit to 
+  *  accommodate a large dynamic range (signed 32 bit values would allow only for plus
+  *  or minus 35 minutes).
+  *
+  *  Implementations with limited precision may convert the signed 64 bit value to 
+  *  a signed 32 bit value internally but risk loss of precision.  
+  */
+#ifndef OMX_SKIP64BIT
+typedef OMX_S64 OMX_TICKS;
+#else
+typedef struct OMX_TICKS
+{
+    OMX_U32 nLowPart;    /** low bits of the signed 64 bit tick value */
+    OMX_U32 nHighPart;   /** high bits of the signed 64 bit tick value */
+} OMX_TICKS;
+#endif
+#define OMX_TICKS_PER_SECOND 1000000
+
+/** Define the public interface for the OMX Handle.  The core will not use
+    this value internally, but the application should only use this value.
+ */
+typedef void* OMX_HANDLETYPE;
+
+typedef struct OMX_MARKTYPE
+{
+    OMX_HANDLETYPE hMarkTargetComponent;   /**< The component that will 
+                                                generate a mark event upon 
+                                                processing the mark. */
+    OMX_PTR pMarkData;   /**< Application specific data associated with 
+                              the mark sent on a mark event to disambiguate 
+                              this mark from others. */
+} OMX_MARKTYPE;
+
+
+/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
+ *  platform & operating specific object used to reference the display 
+ *  or can be used by a audio port for native audio rendering */
+typedef void* OMX_NATIVE_DEVICETYPE;
+
+/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
+ *  platform & operating specific object used to reference the window */
+typedef void* OMX_NATIVE_WINDOWTYPE;
+
+/** The OMX_VERSIONTYPE union is used to specify the version for
+    a structure or component.  For a component, the version is entirely
+    specified by the component vendor.  Components doing the same function
+    from different vendors may or may not have the same version.  For 
+    structures, the version shall be set by the entity that allocates the
+    structure.  For structures specified in the OMX 1.1 specification, the
+    value of the version shall be set to 1.1.0.0 in all cases.  Access to the
+    OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
+    by accessing one of the structure elements to, for example, check only
+    the Major revision.
+ */
+typedef union OMX_VERSIONTYPE
+{
+    struct
+    {
+        OMX_U8 nVersionMajor;   /**< Major version accessor element */
+        OMX_U8 nVersionMinor;   /**< Minor version accessor element */
+        OMX_U8 nRevision;       /**< Revision version accessor element */
+        OMX_U8 nStep;           /**< Step version accessor element */
+    } s;
+    OMX_U32 nVersion;           /**< 32 bit value to make accessing the
+                                    version easily done in a single word
+                                    size copy/compare operation */
+} OMX_VERSIONTYPE;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
diff --git a/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Video.h b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Video.h
new file mode 100644
index 0000000..163e450
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/khronos/OMX_Video.h
@@ -0,0 +1,1060 @@
+/**
+ * Copyright (c) 2008 The Khronos Group Inc. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions: 
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+ *
+ */
+
+/** 
+ *  @file OMX_Video.h - OpenMax IL version 1.1.2
+ *  The structures is needed by Video components to exchange parameters 
+ *  and configuration data with OMX components.
+ */
+#ifndef OMX_Video_h
+#define OMX_Video_h
+
+/** @defgroup video OpenMAX IL Video Domain
+ * @ingroup iv
+ * Structures for OpenMAX IL Video domain
+ * @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/**
+ * Each OMX header must include all required header files to allow the
+ * header to compile without errors.  The includes below are required
+ * for this header file to compile successfully 
+ */
+
+#include <OMX_IVCommon.h>
+
+
+/**
+ * Enumeration used to define the possible video compression codings.  
+ * NOTE:  This essentially refers to file extensions. If the coding is 
+ *        being used to specify the ENCODE type, then additional work 
+ *        must be done to configure the exact flavor of the compression 
+ *        to be used.  For decode cases where the user application can 
+ *        not differentiate between MPEG-4 and H.264 bit streams, it is 
+ *        up to the codec to handle this.
+ */
+typedef enum OMX_VIDEO_CODINGTYPE {
+    OMX_VIDEO_CodingUnused,     /**< Value when coding is N/A */
+    OMX_VIDEO_CodingAutoDetect, /**< Autodetection of coding type */
+    OMX_VIDEO_CodingMPEG2,      /**< AKA: H.262 */
+    OMX_VIDEO_CodingH263,       /**< H.263 */
+    OMX_VIDEO_CodingMPEG4,      /**< MPEG-4 */
+    OMX_VIDEO_CodingWMV,        /**< all versions of Windows Media Video */
+    OMX_VIDEO_CodingRV,         /**< all versions of Real Video */
+    OMX_VIDEO_CodingAVC,        /**< H.264/AVC */
+    OMX_VIDEO_CodingMJPEG,      /**< Motion JPEG */
+    OMX_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_CodingMax = 0x7FFFFFFF
+} OMX_VIDEO_CODINGTYPE;
+
+
+/**
+ * Data structure used to define a video path.  The number of Video paths for 
+ * input and output will vary by type of the Video component.  
+ * 
+ *    Input (aka Source) : zero Inputs, one Output,
+ *    Splitter           : one Input, 2 or more Outputs,
+ *    Processing Element : one Input, one output,
+ *    Mixer              : 2 or more inputs, one output,
+ *    Output (aka Sink)  : one Input, zero outputs.
+ * 
+ * The PortDefinition structure is used to define all of the parameters 
+ * necessary for the compliant component to setup an input or an output video 
+ * path.  If additional vendor specific data is required, it should be 
+ * transmitted to the component using the CustomCommand function.  Compliant 
+ * components will prepopulate this structure with optimal values during the 
+ * GetDefaultInitParams command.
+ *
+ * STRUCT MEMBERS:
+ *  cMIMEType             : MIME type of data for the port
+ *  pNativeRender         : Platform specific reference for a display if a 
+ *                          sync, otherwise this field is 0
+ *  nFrameWidth           : Width of frame to be used on channel if 
+ *                          uncompressed format is used.  Use 0 for unknown,
+ *                          don't care or variable
+ *  nFrameHeight          : Height of frame to be used on channel if 
+ *                          uncompressed format is used. Use 0 for unknown,
+ *                          don't care or variable
+ *  nStride               : Number of bytes per span of an image 
+ *                          (i.e. indicates the number of bytes to get
+ *                          from span N to span N+1, where negative stride
+ *                          indicates the image is bottom up
+ *  nSliceHeight          : Height used when encoding in slices
+ *  nBitrate              : Bit rate of frame to be used on channel if 
+ *                          compressed format is used. Use 0 for unknown, 
+ *                          don't care or variable
+ *  xFramerate            : Frame rate to be used on channel if uncompressed 
+ *                          format is used. Use 0 for unknown, don't care or 
+ *                          variable.  Units are Q16 frames per second.
+ *  bFlagErrorConcealment : Turns on error concealment if it is supported by 
+ *                          the OMX component
+ *  eCompressionFormat    : Compression format used in this instance of the 
+ *                          component. When OMX_VIDEO_CodingUnused is 
+ *                          specified, eColorFormat is used
+ *  eColorFormat : Decompressed format used by this component
+ *  pNativeWindow : Platform specific reference for a window object if a 
+ *                          display sink , otherwise this field is 0x0. 
+ */
+typedef struct OMX_VIDEO_PORTDEFINITIONTYPE {
+    OMX_STRING cMIMEType;
+    OMX_NATIVE_DEVICETYPE pNativeRender;
+    OMX_U32 nFrameWidth;
+    OMX_U32 nFrameHeight;
+    OMX_S32 nStride;
+    OMX_U32 nSliceHeight;
+    OMX_U32 nBitrate;
+    OMX_U32 xFramerate;
+    OMX_BOOL bFlagErrorConcealment;
+    OMX_VIDEO_CODINGTYPE eCompressionFormat;
+    OMX_COLOR_FORMATTYPE eColorFormat;
+    OMX_NATIVE_WINDOWTYPE pNativeWindow;
+} OMX_VIDEO_PORTDEFINITIONTYPE;
+
+/**  
+ * Port format parameter.  This structure is used to enumerate the various 
+ * data input/output format supported by the port.
+ * 
+ * STRUCT MEMBERS:
+ *  nSize              : Size of the structure in bytes
+ *  nVersion           : OMX specification version information
+ *  nPortIndex         : Indicates which port to set
+ *  nIndex             : Indicates the enumeration index for the format from 
+ *                       0x0 to N-1
+ *  eCompressionFormat : Compression format used in this instance of the 
+ *                       component. When OMX_VIDEO_CodingUnused is specified, 
+ *                       eColorFormat is used 
+ *  eColorFormat       : Decompressed format used by this component
+ *  xFrameRate         : Indicates the video frame rate in Q16 format
+ */
+typedef struct OMX_VIDEO_PARAM_PORTFORMATTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nIndex;
+    OMX_VIDEO_CODINGTYPE eCompressionFormat; 
+    OMX_COLOR_FORMATTYPE eColorFormat;
+    OMX_U32 xFramerate;
+} OMX_VIDEO_PARAM_PORTFORMATTYPE;
+
+
+/**
+ * This is a structure for configuring video compression quantization 
+ * parameter values.  Codecs may support different QP values for different
+ * frame types.
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version info
+ *  nPortIndex : Port that this structure applies to
+ *  nQpI       : QP value to use for index frames
+ *  nQpP       : QP value to use for P frames
+ *  nQpB       : QP values to use for bidirectional frames 
+ */
+typedef struct OMX_VIDEO_PARAM_QUANTIZATIONTYPE {
+    OMX_U32 nSize;            
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nQpI;
+    OMX_U32 nQpP;
+    OMX_U32 nQpB;
+} OMX_VIDEO_PARAM_QUANTIZATIONTYPE;
+
+
+/** 
+ * Structure for configuration of video fast update parameters. 
+ *  
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version info 
+ *  nPortIndex : Port that this structure applies to
+ *  bEnableVFU : Enable/Disable video fast update
+ *  nFirstGOB  : Specifies the number of the first macroblock row
+ *  nFirstMB   : specifies the first MB relative to the specified first GOB
+ *  nNumMBs    : Specifies the number of MBs to be refreshed from nFirstGOB 
+ *               and nFirstMB
+ */
+typedef struct OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE {
+    OMX_U32 nSize;            
+    OMX_VERSIONTYPE nVersion; 
+    OMX_U32 nPortIndex;       
+    OMX_BOOL bEnableVFU;      
+    OMX_U32 nFirstGOB;                            
+    OMX_U32 nFirstMB;                            
+    OMX_U32 nNumMBs;                                  
+} OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE;
+
+
+/** 
+ * Enumeration of possible bitrate control types 
+ */
+typedef enum OMX_VIDEO_CONTROLRATETYPE {
+    OMX_Video_ControlRateDisable,
+    OMX_Video_ControlRateVariable,
+    OMX_Video_ControlRateConstant,
+    OMX_Video_ControlRateVariableSkipFrames,
+    OMX_Video_ControlRateConstantSkipFrames,
+    OMX_Video_ControlRateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_Video_ControlRateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_Video_ControlRateMax = 0x7FFFFFFF
+} OMX_VIDEO_CONTROLRATETYPE;
+
+
+/** 
+ * Structure for configuring bitrate mode of a codec. 
+ *
+ * STRUCT MEMBERS:
+ *  nSize          : Size of the struct in bytes
+ *  nVersion       : OMX spec version info
+ *  nPortIndex     : Port that this struct applies to
+ *  eControlRate   : Control rate type enum
+ *  nTargetBitrate : Target bitrate to encode with
+ */
+typedef struct OMX_VIDEO_PARAM_BITRATETYPE {
+    OMX_U32 nSize;                          
+    OMX_VERSIONTYPE nVersion;               
+    OMX_U32 nPortIndex;                     
+    OMX_VIDEO_CONTROLRATETYPE eControlRate; 
+    OMX_U32 nTargetBitrate;                 
+} OMX_VIDEO_PARAM_BITRATETYPE;
+
+
+/** 
+ * Enumeration of possible motion vector (MV) types 
+ */
+typedef enum OMX_VIDEO_MOTIONVECTORTYPE {
+    OMX_Video_MotionVectorPixel,
+    OMX_Video_MotionVectorHalfPel,
+    OMX_Video_MotionVectorQuarterPel,
+    OMX_Video_MotionVectorEighthPel,
+    OMX_Video_MotionVectorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_Video_MotionVectorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_Video_MotionVectorMax = 0x7FFFFFFF
+} OMX_VIDEO_MOTIONVECTORTYPE;
+
+
+/**
+ * Structure for configuring the number of motion vectors used as well
+ * as their accuracy.
+ * 
+ * STRUCT MEMBERS:
+ *  nSize            : Size of the struct in bytes
+ *  nVersion         : OMX spec version info
+ *  nPortIndex       : port that this structure applies to
+ *  eAccuracy        : Enumerated MV accuracy
+ *  bUnrestrictedMVs : Allow unrestricted MVs
+ *  bFourMV          : Allow use of 4 MVs
+ *  sXSearchRange    : Search range in horizontal direction for MVs
+ *  sYSearchRange    : Search range in vertical direction for MVs
+ */
+typedef struct OMX_VIDEO_PARAM_MOTIONVECTORTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_VIDEO_MOTIONVECTORTYPE eAccuracy;
+    OMX_BOOL bUnrestrictedMVs;
+    OMX_BOOL bFourMV;
+    OMX_S32 sXSearchRange;
+    OMX_S32 sYSearchRange;
+} OMX_VIDEO_PARAM_MOTIONVECTORTYPE;
+
+
+/** 
+ * Enumeration of possible methods to use for Intra Refresh 
+ */
+typedef enum OMX_VIDEO_INTRAREFRESHTYPE {
+    OMX_VIDEO_IntraRefreshCyclic,
+    OMX_VIDEO_IntraRefreshAdaptive,
+    OMX_VIDEO_IntraRefreshBoth,
+    OMX_VIDEO_IntraRefreshKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_IntraRefreshVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_IntraRefreshMax = 0x7FFFFFFF
+} OMX_VIDEO_INTRAREFRESHTYPE;
+
+
+/**
+ * Structure for configuring intra refresh mode 
+ * 
+ * STRUCT MEMBERS:
+ *  nSize        : Size of the structure in bytes
+ *  nVersion     : OMX specification version information
+ *  nPortIndex   : Port that this structure applies to
+ *  eRefreshMode : Cyclic, Adaptive, or Both
+ *  nAirMBs      : Number of intra macroblocks to refresh in a frame when 
+ *                 AIR is enabled
+ *  nAirRef      : Number of times a motion marked macroblock has to be  
+ *                 intra coded
+ *  nCirMBs      : Number of consecutive macroblocks to be coded as "intra"  
+ *                 when CIR is enabled
+ */
+typedef struct OMX_VIDEO_PARAM_INTRAREFRESHTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_VIDEO_INTRAREFRESHTYPE eRefreshMode;
+    OMX_U32 nAirMBs;
+    OMX_U32 nAirRef;
+    OMX_U32 nCirMBs;
+} OMX_VIDEO_PARAM_INTRAREFRESHTYPE;
+
+
+/**
+ * Structure for enabling various error correction methods for video 
+ * compression.
+ *
+ * STRUCT MEMBERS:
+ *  nSize                   : Size of the structure in bytes
+ *  nVersion                : OMX specification version information 
+ *  nPortIndex              : Port that this structure applies to 
+ *  bEnableHEC              : Enable/disable header extension codes (HEC)
+ *  bEnableResync           : Enable/disable resynchronization markers
+ *  nResynchMarkerSpacing   : Resynch markers interval (in bits) to be 
+ *                            applied in the stream 
+ *  bEnableDataPartitioning : Enable/disable data partitioning 
+ *  bEnableRVLC             : Enable/disable reversible variable length 
+ *                            coding
+ */
+typedef struct OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_BOOL bEnableHEC;
+    OMX_BOOL bEnableResync;
+    OMX_U32  nResynchMarkerSpacing;
+    OMX_BOOL bEnableDataPartitioning;
+    OMX_BOOL bEnableRVLC;
+} OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE;
+
+
+/** 
+ * Configuration of variable block-size motion compensation (VBSMC) 
+ * 
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information 
+ *  nPortIndex : Port that this structure applies to
+ *  b16x16     : Enable inter block search 16x16
+ *  b16x8      : Enable inter block search 16x8
+ *  b8x16      : Enable inter block search 8x16
+ *  b8x8       : Enable inter block search 8x8
+ *  b8x4       : Enable inter block search 8x4
+ *  b4x8       : Enable inter block search 4x8
+ *  b4x4       : Enable inter block search 4x4
+ */
+typedef struct OMX_VIDEO_PARAM_VBSMCTYPE {
+    OMX_U32 nSize; 
+    OMX_VERSIONTYPE nVersion; 
+    OMX_U32 nPortIndex;       
+    OMX_BOOL b16x16; 
+    OMX_BOOL b16x8; 
+    OMX_BOOL b8x16;
+    OMX_BOOL b8x8;
+    OMX_BOOL b8x4;
+    OMX_BOOL b4x8;
+    OMX_BOOL b4x4;
+} OMX_VIDEO_PARAM_VBSMCTYPE;
+
+
+/** 
+ * H.263 profile types, each profile indicates support for various 
+ * performance bounds and different annexes.
+ *
+ * ENUMS:
+ *  Baseline           : Baseline Profile: H.263 (V1), no optional modes                                                    
+ *  H320 Coding        : H.320 Coding Efficiency Backward Compatibility 
+ *                       Profile: H.263+ (V2), includes annexes I, J, L.4
+ *                       and T
+ *  BackwardCompatible : Backward Compatibility Profile: H.263 (V1), 
+ *                       includes annex F                                    
+ *  ISWV2              : Interactive Streaming Wireless Profile: H.263+ 
+ *                       (V2), includes annexes I, J, K and T                 
+ *  ISWV3              : Interactive Streaming Wireless Profile: H.263++  
+ *                       (V3), includes profile 3 and annexes V and W.6.3.8   
+ *  HighCompression    : Conversational High Compression Profile: H.263++  
+ *                       (V3), includes profiles 1 & 2 and annexes D and U   
+ *  Internet           : Conversational Internet Profile: H.263++ (V3),  
+ *                       includes profile 5 and annex K                       
+ *  Interlace          : Conversational Interlace Profile: H.263++ (V3),  
+ *                       includes profile 5 and annex W.6.3.11               
+ *  HighLatency        : High Latency Profile: H.263++ (V3), includes  
+ *                       profile 6 and annexes O.1 and P.5                       
+ */
+typedef enum OMX_VIDEO_H263PROFILETYPE {
+    OMX_VIDEO_H263ProfileBaseline            = 0x01,        
+    OMX_VIDEO_H263ProfileH320Coding          = 0x02,          
+    OMX_VIDEO_H263ProfileBackwardCompatible  = 0x04,  
+    OMX_VIDEO_H263ProfileISWV2               = 0x08,               
+    OMX_VIDEO_H263ProfileISWV3               = 0x10,               
+    OMX_VIDEO_H263ProfileHighCompression     = 0x20,     
+    OMX_VIDEO_H263ProfileInternet            = 0x40,            
+    OMX_VIDEO_H263ProfileInterlace           = 0x80,           
+    OMX_VIDEO_H263ProfileHighLatency         = 0x100,         
+    OMX_VIDEO_H263ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_H263ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_H263ProfileMax                 = 0x7FFFFFFF  
+} OMX_VIDEO_H263PROFILETYPE;
+
+
+/** 
+ * H.263 level types, each level indicates support for various frame sizes, 
+ * bit rates, decoder frame rates.
+ */
+typedef enum OMX_VIDEO_H263LEVELTYPE {
+    OMX_VIDEO_H263Level10  = 0x01,  
+    OMX_VIDEO_H263Level20  = 0x02,      
+    OMX_VIDEO_H263Level30  = 0x04,      
+    OMX_VIDEO_H263Level40  = 0x08,      
+    OMX_VIDEO_H263Level45  = 0x10,      
+    OMX_VIDEO_H263Level50  = 0x20,      
+    OMX_VIDEO_H263Level60  = 0x40,      
+    OMX_VIDEO_H263Level70  = 0x80, 
+    OMX_VIDEO_H263LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_H263LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_H263LevelMax = 0x7FFFFFFF  
+} OMX_VIDEO_H263LEVELTYPE;
+
+
+/** 
+ * Specifies the picture type. These values should be OR'd to signal all 
+ * pictures types which are allowed.
+ *
+ * ENUMS:
+ *  Generic Picture Types:          I, P and B
+ *  H.263 Specific Picture Types:   SI and SP
+ *  H.264 Specific Picture Types:   EI and EP
+ *  MPEG-4 Specific Picture Types:  S
+ */
+typedef enum OMX_VIDEO_PICTURETYPE {
+    OMX_VIDEO_PictureTypeI   = 0x01,
+    OMX_VIDEO_PictureTypeP   = 0x02,
+    OMX_VIDEO_PictureTypeB   = 0x04,
+    OMX_VIDEO_PictureTypeSI  = 0x08,
+    OMX_VIDEO_PictureTypeSP  = 0x10,
+    OMX_VIDEO_PictureTypeEI  = 0x11,
+    OMX_VIDEO_PictureTypeEP  = 0x12,
+    OMX_VIDEO_PictureTypeS   = 0x14,
+    OMX_VIDEO_PictureTypeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_PictureTypeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_PictureTypeMax = 0x7FFFFFFF
+} OMX_VIDEO_PICTURETYPE;
+
+
+/** 
+ * H.263 Params 
+ *
+ * STRUCT MEMBERS:
+ *  nSize                    : Size of the structure in bytes
+ *  nVersion                 : OMX specification version information 
+ *  nPortIndex               : Port that this structure applies to
+ *  nPFrames                 : Number of P frames between each I frame
+ *  nBFrames                 : Number of B frames between each I frame
+ *  eProfile                 : H.263 profile(s) to use
+ *  eLevel                   : H.263 level(s) to use
+ *  bPLUSPTYPEAllowed        : Indicating that it is allowed to use PLUSPTYPE 
+ *                             (specified in the 1998 version of H.263) to 
+ *                             indicate custom picture sizes or clock 
+ *                             frequencies 
+ *  nAllowedPictureTypes     : Specifies the picture types allowed in the 
+ *                             bitstream
+ *  bForceRoundingTypeToZero : value of the RTYPE bit (bit 6 of MPPTYPE) is 
+ *                             not constrained. It is recommended to change 
+ *                             the value of the RTYPE bit for each reference 
+ *                             picture in error-free communication
+ *  nPictureHeaderRepetition : Specifies the frequency of picture header 
+ *                             repetition
+ *  nGOBHeaderInterval       : Specifies the interval of non-empty GOB  
+ *                             headers in units of GOBs
+ */
+typedef struct OMX_VIDEO_PARAM_H263TYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nPFrames;
+    OMX_U32 nBFrames;
+    OMX_VIDEO_H263PROFILETYPE eProfile;
+	OMX_VIDEO_H263LEVELTYPE eLevel;
+    OMX_BOOL bPLUSPTYPEAllowed;
+    OMX_U32 nAllowedPictureTypes;
+    OMX_BOOL bForceRoundingTypeToZero;
+    OMX_U32 nPictureHeaderRepetition;
+    OMX_U32 nGOBHeaderInterval;
+} OMX_VIDEO_PARAM_H263TYPE;
+
+
+/** 
+ * MPEG-2 profile types, each profile indicates support for various 
+ * performance bounds and different annexes.
+ */
+typedef enum OMX_VIDEO_MPEG2PROFILETYPE {
+    OMX_VIDEO_MPEG2ProfileSimple = 0,  /**< Simple Profile */
+    OMX_VIDEO_MPEG2ProfileMain,        /**< Main Profile */
+    OMX_VIDEO_MPEG2Profile422,         /**< 4:2:2 Profile */
+    OMX_VIDEO_MPEG2ProfileSNR,         /**< SNR Profile */
+    OMX_VIDEO_MPEG2ProfileSpatial,     /**< Spatial Profile */
+    OMX_VIDEO_MPEG2ProfileHigh,        /**< High Profile */
+    OMX_VIDEO_MPEG2ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_MPEG2ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_MPEG2ProfileMax = 0x7FFFFFFF  
+} OMX_VIDEO_MPEG2PROFILETYPE;
+
+
+/** 
+ * MPEG-2 level types, each level indicates support for various frame 
+ * sizes, bit rates, decoder frame rates.  No need 
+ */
+typedef enum OMX_VIDEO_MPEG2LEVELTYPE {
+    OMX_VIDEO_MPEG2LevelLL = 0,  /**< Low Level */ 
+    OMX_VIDEO_MPEG2LevelML,      /**< Main Level */ 
+    OMX_VIDEO_MPEG2LevelH14,     /**< High 1440 */ 
+    OMX_VIDEO_MPEG2LevelHL,      /**< High Level */   
+    OMX_VIDEO_MPEG2LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_MPEG2LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_MPEG2LevelMax = 0x7FFFFFFF  
+} OMX_VIDEO_MPEG2LEVELTYPE;
+
+
+/** 
+ * MPEG-2 params 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to
+ *  nPFrames   : Number of P frames between each I frame
+ *  nBFrames   : Number of B frames between each I frame
+ *  eProfile   : MPEG-2 profile(s) to use
+ *  eLevel     : MPEG-2 levels(s) to use
+ */
+typedef struct OMX_VIDEO_PARAM_MPEG2TYPE {
+    OMX_U32 nSize;           
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;      
+    OMX_U32 nPFrames;        
+    OMX_U32 nBFrames;        
+    OMX_VIDEO_MPEG2PROFILETYPE eProfile;
+	OMX_VIDEO_MPEG2LEVELTYPE eLevel;   
+} OMX_VIDEO_PARAM_MPEG2TYPE;
+
+
+/** 
+ * MPEG-4 profile types, each profile indicates support for various 
+ * performance bounds and different annexes.
+ * 
+ * ENUMS:
+ *  - Simple Profile, Levels 1-3
+ *  - Simple Scalable Profile, Levels 1-2
+ *  - Core Profile, Levels 1-2
+ *  - Main Profile, Levels 2-4
+ *  - N-bit Profile, Level 2
+ *  - Scalable Texture Profile, Level 1
+ *  - Simple Face Animation Profile, Levels 1-2
+ *  - Simple Face and Body Animation (FBA) Profile, Levels 1-2
+ *  - Basic Animated Texture Profile, Levels 1-2
+ *  - Hybrid Profile, Levels 1-2
+ *  - Advanced Real Time Simple Profiles, Levels 1-4
+ *  - Core Scalable Profile, Levels 1-3
+ *  - Advanced Coding Efficiency Profile, Levels 1-4
+ *  - Advanced Core Profile, Levels 1-2
+ *  - Advanced Scalable Texture, Levels 2-3
+ */
+typedef enum OMX_VIDEO_MPEG4PROFILETYPE {
+    OMX_VIDEO_MPEG4ProfileSimple           = 0x01,        
+    OMX_VIDEO_MPEG4ProfileSimpleScalable   = 0x02,    
+    OMX_VIDEO_MPEG4ProfileCore             = 0x04,              
+    OMX_VIDEO_MPEG4ProfileMain             = 0x08,             
+    OMX_VIDEO_MPEG4ProfileNbit             = 0x10,              
+    OMX_VIDEO_MPEG4ProfileScalableTexture  = 0x20,   
+    OMX_VIDEO_MPEG4ProfileSimpleFace       = 0x40,        
+    OMX_VIDEO_MPEG4ProfileSimpleFBA        = 0x80,         
+    OMX_VIDEO_MPEG4ProfileBasicAnimated    = 0x100,     
+    OMX_VIDEO_MPEG4ProfileHybrid           = 0x200,            
+    OMX_VIDEO_MPEG4ProfileAdvancedRealTime = 0x400,  
+    OMX_VIDEO_MPEG4ProfileCoreScalable     = 0x800,      
+    OMX_VIDEO_MPEG4ProfileAdvancedCoding   = 0x1000,    
+    OMX_VIDEO_MPEG4ProfileAdvancedCore     = 0x2000,      
+    OMX_VIDEO_MPEG4ProfileAdvancedScalable = 0x4000,
+    OMX_VIDEO_MPEG4ProfileAdvancedSimple   = 0x8000,
+    OMX_VIDEO_MPEG4ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_MPEG4ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_MPEG4ProfileMax              = 0x7FFFFFFF  
+} OMX_VIDEO_MPEG4PROFILETYPE;
+
+
+/** 
+ * MPEG-4 level types, each level indicates support for various frame 
+ * sizes, bit rates, decoder frame rates.  No need 
+ */
+typedef enum OMX_VIDEO_MPEG4LEVELTYPE {
+    OMX_VIDEO_MPEG4Level0  = 0x01,   /**< Level 0 */   
+    OMX_VIDEO_MPEG4Level0b = 0x02,   /**< Level 0b */   
+    OMX_VIDEO_MPEG4Level1  = 0x04,   /**< Level 1 */ 
+    OMX_VIDEO_MPEG4Level2  = 0x08,   /**< Level 2 */ 
+    OMX_VIDEO_MPEG4Level3  = 0x10,   /**< Level 3 */ 
+    OMX_VIDEO_MPEG4Level4  = 0x20,   /**< Level 4 */  
+    OMX_VIDEO_MPEG4Level4a = 0x40,   /**< Level 4a */  
+    OMX_VIDEO_MPEG4Level5  = 0x80,   /**< Level 5 */  
+    OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_MPEG4LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF  
+} OMX_VIDEO_MPEG4LEVELTYPE;
+
+
+/** 
+ * MPEG-4 configuration.  This structure handles configuration options
+ * which are specific to MPEG4 algorithms
+ *
+ * STRUCT MEMBERS:
+ *  nSize                : Size of the structure in bytes
+ *  nVersion             : OMX specification version information
+ *  nPortIndex           : Port that this structure applies to
+ *  nSliceHeaderSpacing  : Number of macroblocks between slice header (H263+ 
+ *                         Annex K). Put zero if not used
+ *  bSVH                 : Enable Short Video Header mode
+ *  bGov                 : Flag to enable GOV
+ *  nPFrames             : Number of P frames between each I frame (also called 
+ *                         GOV period)
+ *  nBFrames             : Number of B frames between each I frame
+ *  nIDCVLCThreshold     : Value of intra DC VLC threshold
+ *  bACPred              : Flag to use ac prediction
+ *  nMaxPacketSize       : Maximum size of packet in bytes.
+ *  nTimeIncRes          : Used to pass VOP time increment resolution for MPEG4. 
+ *                         Interpreted as described in MPEG4 standard.
+ *  eProfile             : MPEG-4 profile(s) to use.
+ *  eLevel               : MPEG-4 level(s) to use.
+ *  nAllowedPictureTypes : Specifies the picture types allowed in the bitstream
+ *  nHeaderExtension     : Specifies the number of consecutive video packet
+ *                         headers within a VOP
+ *  bReversibleVLC       : Specifies whether reversible variable length coding 
+ *                         is in use
+ */
+typedef struct OMX_VIDEO_PARAM_MPEG4TYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nSliceHeaderSpacing;
+    OMX_BOOL bSVH;
+    OMX_BOOL bGov;
+    OMX_U32 nPFrames;
+    OMX_U32 nBFrames;
+    OMX_U32 nIDCVLCThreshold;
+    OMX_BOOL bACPred;
+    OMX_U32 nMaxPacketSize;
+    OMX_U32 nTimeIncRes;
+    OMX_VIDEO_MPEG4PROFILETYPE eProfile;
+    OMX_VIDEO_MPEG4LEVELTYPE eLevel;
+    OMX_U32 nAllowedPictureTypes;
+    OMX_U32 nHeaderExtension;
+    OMX_BOOL bReversibleVLC;
+} OMX_VIDEO_PARAM_MPEG4TYPE;
+
+
+/** 
+ * WMV Versions 
+ */
+typedef enum OMX_VIDEO_WMVFORMATTYPE {
+    OMX_VIDEO_WMVFormatUnused = 0x01,   /**< Format unused or unknown */
+    OMX_VIDEO_WMVFormat7      = 0x02,   /**< Windows Media Video format 7 */
+    OMX_VIDEO_WMVFormat8      = 0x04,   /**< Windows Media Video format 8 */
+    OMX_VIDEO_WMVFormat9      = 0x08,   /**< Windows Media Video format 9 */
+    OMX_VIDEO_WMFFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_WMFFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_WMVFormatMax    = 0x7FFFFFFF
+} OMX_VIDEO_WMVFORMATTYPE;
+
+
+/** 
+ * WMV Params 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to
+ *  eFormat    : Version of WMV stream / data
+ */
+typedef struct OMX_VIDEO_PARAM_WMVTYPE {
+    OMX_U32 nSize; 
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_VIDEO_WMVFORMATTYPE eFormat;
+} OMX_VIDEO_PARAM_WMVTYPE;
+
+
+/** 
+ * Real Video Version 
+ */
+typedef enum OMX_VIDEO_RVFORMATTYPE {
+    OMX_VIDEO_RVFormatUnused = 0, /**< Format unused or unknown */
+    OMX_VIDEO_RVFormat8,          /**< Real Video format 8 */
+    OMX_VIDEO_RVFormat9,          /**< Real Video format 9 */
+    OMX_VIDEO_RVFormatG2,         /**< Real Video Format G2 */
+    OMX_VIDEO_RVFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_RVFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_RVFormatMax = 0x7FFFFFFF
+} OMX_VIDEO_RVFORMATTYPE;
+
+
+/** 
+ * Real Video Params 
+ *
+ * STUCT MEMBERS:
+ *  nSize              : Size of the structure in bytes
+ *  nVersion           : OMX specification version information 
+ *  nPortIndex         : Port that this structure applies to
+ *  eFormat            : Version of RV stream / data
+ *  nBitsPerPixel      : Bits per pixel coded in the frame
+ *  nPaddedWidth       : Padded width in pixel of a video frame
+ *  nPaddedHeight      : Padded Height in pixels of a video frame
+ *  nFrameRate         : Rate of video in frames per second
+ *  nBitstreamFlags    : Flags which internal information about the bitstream
+ *  nBitstreamVersion  : Bitstream version
+ *  nMaxEncodeFrameSize: Max encoded frame size
+ *  bEnablePostFilter  : Turn on/off post filter
+ *  bEnableTemporalInterpolation : Turn on/off temporal interpolation
+ *  bEnableLatencyMode : When enabled, the decoder does not display a decoded 
+ *                       frame until it has detected that no enhancement layer 
+ *  					 frames or dependent B frames will be coming. This 
+ *  					 detection usually occurs when a subsequent non-B 
+ *  					 frame is encountered 
+ */
+typedef struct OMX_VIDEO_PARAM_RVTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_VIDEO_RVFORMATTYPE eFormat;
+    OMX_U16 nBitsPerPixel;
+    OMX_U16 nPaddedWidth;
+    OMX_U16 nPaddedHeight;
+    OMX_U32 nFrameRate;
+    OMX_U32 nBitstreamFlags;
+    OMX_U32 nBitstreamVersion;
+    OMX_U32 nMaxEncodeFrameSize;
+    OMX_BOOL bEnablePostFilter;
+    OMX_BOOL bEnableTemporalInterpolation;
+    OMX_BOOL bEnableLatencyMode;
+} OMX_VIDEO_PARAM_RVTYPE;
+
+
+/** 
+ * AVC profile types, each profile indicates support for various 
+ * performance bounds and different annexes.
+ */
+typedef enum OMX_VIDEO_AVCPROFILETYPE {
+    OMX_VIDEO_AVCProfileBaseline = 0x01,   /**< Baseline profile */
+    OMX_VIDEO_AVCProfileMain     = 0x02,   /**< Main profile */
+    OMX_VIDEO_AVCProfileExtended = 0x04,   /**< Extended profile */
+    OMX_VIDEO_AVCProfileHigh     = 0x08,   /**< High profile */
+    OMX_VIDEO_AVCProfileHigh10   = 0x10,   /**< High 10 profile */
+    OMX_VIDEO_AVCProfileHigh422  = 0x20,   /**< High 4:2:2 profile */
+    OMX_VIDEO_AVCProfileHigh444  = 0x40,   /**< High 4:4:4 profile */
+    OMX_VIDEO_AVCProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_AVCProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_AVCProfileMax      = 0x7FFFFFFF  
+} OMX_VIDEO_AVCPROFILETYPE;
+
+
+/** 
+ * AVC level types, each level indicates support for various frame sizes, 
+ * bit rates, decoder frame rates.  No need 
+ */
+typedef enum OMX_VIDEO_AVCLEVELTYPE {
+    OMX_VIDEO_AVCLevel1   = 0x01,     /**< Level 1 */
+    OMX_VIDEO_AVCLevel1b  = 0x02,     /**< Level 1b */
+    OMX_VIDEO_AVCLevel11  = 0x04,     /**< Level 1.1 */
+    OMX_VIDEO_AVCLevel12  = 0x08,     /**< Level 1.2 */
+    OMX_VIDEO_AVCLevel13  = 0x10,     /**< Level 1.3 */
+    OMX_VIDEO_AVCLevel2   = 0x20,     /**< Level 2 */
+    OMX_VIDEO_AVCLevel21  = 0x40,     /**< Level 2.1 */
+    OMX_VIDEO_AVCLevel22  = 0x80,     /**< Level 2.2 */
+    OMX_VIDEO_AVCLevel3   = 0x100,    /**< Level 3 */
+    OMX_VIDEO_AVCLevel31  = 0x200,    /**< Level 3.1 */
+    OMX_VIDEO_AVCLevel32  = 0x400,    /**< Level 3.2 */
+    OMX_VIDEO_AVCLevel4   = 0x800,    /**< Level 4 */
+    OMX_VIDEO_AVCLevel41  = 0x1000,   /**< Level 4.1 */
+    OMX_VIDEO_AVCLevel42  = 0x2000,   /**< Level 4.2 */
+    OMX_VIDEO_AVCLevel5   = 0x4000,   /**< Level 5 */
+    OMX_VIDEO_AVCLevel51  = 0x8000,   /**< Level 5.1 */
+    OMX_VIDEO_AVCLevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_AVCLevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_AVCLevelMax = 0x7FFFFFFF  
+} OMX_VIDEO_AVCLEVELTYPE;
+
+
+/** 
+ * AVC loop filter modes 
+ *
+ * OMX_VIDEO_AVCLoopFilterEnable               : Enable
+ * OMX_VIDEO_AVCLoopFilterDisable              : Disable
+ * OMX_VIDEO_AVCLoopFilterDisableSliceBoundary : Disabled on slice boundaries
+ */
+typedef enum OMX_VIDEO_AVCLOOPFILTERTYPE {
+    OMX_VIDEO_AVCLoopFilterEnable = 0,
+    OMX_VIDEO_AVCLoopFilterDisable,
+    OMX_VIDEO_AVCLoopFilterDisableSliceBoundary,
+    OMX_VIDEO_AVCLoopFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_AVCLoopFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_AVCLoopFilterMax = 0x7FFFFFFF
+} OMX_VIDEO_AVCLOOPFILTERTYPE;
+
+
+/** 
+ * AVC params 
+ *
+ * STRUCT MEMBERS:
+ *  nSize                     : Size of the structure in bytes
+ *  nVersion                  : OMX specification version information
+ *  nPortIndex                : Port that this structure applies to
+ *  nSliceHeaderSpacing       : Number of macroblocks between slice header, put  
+ *                              zero if not used
+ *  nPFrames                  : Number of P frames between each I frame
+ *  nBFrames                  : Number of B frames between each I frame
+ *  bUseHadamard              : Enable/disable Hadamard transform
+ *  nRefFrames                : Max number of reference frames to use for inter
+ *                              motion search (1-16)
+ *  nRefIdxTrailing           : Pic param set ref frame index (index into ref
+ *                              frame buffer of trailing frames list), B frame
+ *                              support
+ *  nRefIdxForward            : Pic param set ref frame index (index into ref
+ *                              frame buffer of forward frames list), B frame
+ *                              support
+ *  bEnableUEP                : Enable/disable unequal error protection. This 
+ *                              is only valid of data partitioning is enabled.
+ *  bEnableFMO                : Enable/disable flexible macroblock ordering
+ *  bEnableASO                : Enable/disable arbitrary slice ordering
+ *  bEnableRS                 : Enable/disable sending of redundant slices
+ *  eProfile                  : AVC profile(s) to use
+ *  eLevel                    : AVC level(s) to use
+ *  nAllowedPictureTypes      : Specifies the picture types allowed in the 
+ *                              bitstream
+ *  bFrameMBsOnly             : specifies that every coded picture of the 
+ *                              coded video sequence is a coded frame 
+ *                              containing only frame macroblocks
+ *  bMBAFF                    : Enable/disable switching between frame and 
+ *                              field macroblocks within a picture
+ *  bEntropyCodingCABAC       : Entropy decoding method to be applied for the 
+ *                              syntax elements for which two descriptors appear 
+ *                              in the syntax tables
+ *  bWeightedPPrediction      : Enable/disable weighted prediction shall not 
+ *                              be applied to P and SP slices
+ *  nWeightedBipredicitonMode : Default weighted prediction is applied to B 
+ *                              slices 
+ *  bconstIpred               : Enable/disable intra prediction
+ *  bDirect8x8Inference       : Specifies the method used in the derivation 
+ *                              process for luma motion vectors for B_Skip, 
+ *                              B_Direct_16x16 and B_Direct_8x8 as specified 
+ *                              in subclause 8.4.1.2 of the AVC spec 
+ *  bDirectSpatialTemporal    : Flag indicating spatial or temporal direct
+ *                              mode used in B slice coding (related to 
+ *                              bDirect8x8Inference) . Spatial direct mode is 
+ *                              more common and should be the default.
+ *  nCabacInitIdx             : Index used to init CABAC contexts
+ *  eLoopFilterMode           : Enable/disable loop filter
+ */
+typedef struct OMX_VIDEO_PARAM_AVCTYPE {
+    OMX_U32 nSize;                 
+    OMX_VERSIONTYPE nVersion;      
+    OMX_U32 nPortIndex;            
+    OMX_U32 nSliceHeaderSpacing;  
+    OMX_U32 nPFrames;     
+    OMX_U32 nBFrames;     
+    OMX_BOOL bUseHadamard;
+    OMX_U32 nRefFrames;  
+	OMX_U32 nRefIdx10ActiveMinus1;
+	OMX_U32 nRefIdx11ActiveMinus1;
+    OMX_BOOL bEnableUEP;  
+    OMX_BOOL bEnableFMO;  
+    OMX_BOOL bEnableASO;  
+    OMX_BOOL bEnableRS;   
+    OMX_VIDEO_AVCPROFILETYPE eProfile;
+	OMX_VIDEO_AVCLEVELTYPE eLevel; 
+    OMX_U32 nAllowedPictureTypes;  
+	OMX_BOOL bFrameMBsOnly;        									
+    OMX_BOOL bMBAFF;               
+    OMX_BOOL bEntropyCodingCABAC;  
+    OMX_BOOL bWeightedPPrediction; 
+    OMX_U32 nWeightedBipredicitonMode; 
+    OMX_BOOL bconstIpred ;
+    OMX_BOOL bDirect8x8Inference;  
+	OMX_BOOL bDirectSpatialTemporal;
+	OMX_U32 nCabacInitIdc;
+	OMX_VIDEO_AVCLOOPFILTERTYPE eLoopFilterMode;
+} OMX_VIDEO_PARAM_AVCTYPE;
+
+typedef struct OMX_VIDEO_PARAM_PROFILELEVELTYPE {
+   OMX_U32 nSize;                 
+   OMX_VERSIONTYPE nVersion;      
+   OMX_U32 nPortIndex;            
+   OMX_U32 eProfile;      /**< type is OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263PROFILETYPE, 
+                                 or OMX_VIDEO_MPEG4PROFILETYPE depending on context */
+   OMX_U32 eLevel;        /**< type is OMX_VIDEO_AVCLEVELTYPE, OMX_VIDEO_H263LEVELTYPE, 
+                                 or OMX_VIDEO_MPEG4PROFILETYPE depending on context */
+   OMX_U32 nProfileIndex; /**< Used to query for individual profile support information,
+                               This parameter is valid only for 
+                               OMX_IndexParamVideoProfileLevelQuerySupported index,
+                               For all other indices this parameter is to be ignored. */
+} OMX_VIDEO_PARAM_PROFILELEVELTYPE;
+
+/** 
+ * Structure for dynamically configuring bitrate mode of a codec. 
+ *
+ * STRUCT MEMBERS:
+ *  nSize          : Size of the struct in bytes
+ *  nVersion       : OMX spec version info
+ *  nPortIndex     : Port that this struct applies to
+ *  nEncodeBitrate : Target average bitrate to be generated in bps
+ */
+typedef struct OMX_VIDEO_CONFIG_BITRATETYPE {
+    OMX_U32 nSize;                          
+    OMX_VERSIONTYPE nVersion;               
+    OMX_U32 nPortIndex;                     
+    OMX_U32 nEncodeBitrate;                 
+} OMX_VIDEO_CONFIG_BITRATETYPE;
+
+/** 
+ * Defines Encoder Frame Rate setting
+ *
+ * STRUCT MEMBERS:
+ *  nSize            : Size of the structure in bytes
+ *  nVersion         : OMX specification version information 
+ *  nPortIndex       : Port that this structure applies to
+ *  xEncodeFramerate : Encoding framerate represented in Q16 format
+ */
+typedef struct OMX_CONFIG_FRAMERATETYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 xEncodeFramerate; /* Q16 format */
+} OMX_CONFIG_FRAMERATETYPE;
+
+typedef struct OMX_CONFIG_INTRAREFRESHVOPTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_BOOL IntraRefreshVOP;
+} OMX_CONFIG_INTRAREFRESHVOPTYPE;
+
+typedef struct OMX_CONFIG_MACROBLOCKERRORMAPTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nErrMapSize;           /* Size of the Error Map in bytes */
+    OMX_U8  ErrMap[1];             /* Error map hint */
+} OMX_CONFIG_MACROBLOCKERRORMAPTYPE;
+
+typedef struct OMX_CONFIG_MBERRORREPORTINGTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_BOOL bEnabled;
+} OMX_CONFIG_MBERRORREPORTINGTYPE;
+
+typedef struct OMX_PARAM_MACROBLOCKSTYPE {
+    OMX_U32 nSize;
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nMacroblocks;
+} OMX_PARAM_MACROBLOCKSTYPE;
+
+/** 
+ * AVC Slice Mode modes 
+ *
+ * OMX_VIDEO_SLICEMODE_AVCDefault   : Normal frame encoding, one slice per frame
+ * OMX_VIDEO_SLICEMODE_AVCMBSlice   : NAL mode, number of MBs per frame
+ * OMX_VIDEO_SLICEMODE_AVCByteSlice : NAL mode, number of bytes per frame
+ */
+typedef enum OMX_VIDEO_AVCSLICEMODETYPE {
+    OMX_VIDEO_SLICEMODE_AVCDefault = 0,
+    OMX_VIDEO_SLICEMODE_AVCMBSlice,
+    OMX_VIDEO_SLICEMODE_AVCByteSlice,
+    OMX_VIDEO_SLICEMODE_AVCKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 
+    OMX_VIDEO_SLICEMODE_AVCVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
+    OMX_VIDEO_SLICEMODE_AVCLevelMax = 0x7FFFFFFF
+} OMX_VIDEO_AVCSLICEMODETYPE;
+
+/** 
+ * AVC FMO Slice Mode Params 
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to
+ *  nNumSliceGroups : Specifies the number of slice groups
+ *  nSliceGroupMapType : Specifies the type of slice groups
+ *  eSliceMode : Specifies the type of slice
+ */
+typedef struct OMX_VIDEO_PARAM_AVCSLICEFMO {
+    OMX_U32 nSize; 
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U8 nNumSliceGroups;
+    OMX_U8 nSliceGroupMapType;
+    OMX_VIDEO_AVCSLICEMODETYPE eSliceMode;
+} OMX_VIDEO_PARAM_AVCSLICEFMO;
+
+/** 
+ * AVC IDR Period Configs
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to
+ *  nIDRPeriod : Specifies periodicity of IDR frames
+ *  nPFrames : Specifies internal of coding Intra frames
+ */
+typedef struct OMX_VIDEO_CONFIG_AVCINTRAPERIOD {
+    OMX_U32 nSize; 
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nIDRPeriod;
+    OMX_U32 nPFrames;
+} OMX_VIDEO_CONFIG_AVCINTRAPERIOD;
+
+/** 
+ * AVC NAL Size Configs
+ *
+ * STRUCT MEMBERS:
+ *  nSize      : Size of the structure in bytes
+ *  nVersion   : OMX specification version information
+ *  nPortIndex : Port that this structure applies to
+ *  nNaluBytes : Specifies the NAL unit size
+ */
+typedef struct OMX_VIDEO_CONFIG_NALSIZE {
+    OMX_U32 nSize; 
+    OMX_VERSIONTYPE nVersion;
+    OMX_U32 nPortIndex;
+    OMX_U32 nNaluBytes;
+} OMX_VIDEO_CONFIG_NALSIZE;
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+/* File EOF */
+
diff --git a/exynos4/multimedia/openmax/sec_omx/include/sec/SEC_OMX_Def.h b/exynos4/multimedia/openmax/sec_omx/include/sec/SEC_OMX_Def.h
new file mode 100644
index 0000000..2b4df69
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/sec/SEC_OMX_Def.h
@@ -0,0 +1,182 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    SEC_OMX_Def.h
+ * @brief   SEC_OMX specific define
+ * @author  SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_DEF
+#define SEC_OMX_DEF
+
+#include "OMX_Types.h"
+#include "OMX_IVCommon.h"
+
+#define VERSIONMAJOR_NUMBER                1
+#define VERSIONMINOR_NUMBER                0
+#define REVISION_NUMBER                    0
+#define STEP_NUMBER                        0
+
+
+#define MAX_OMX_COMPONENT_NUM              20
+#define MAX_OMX_COMPONENT_ROLE_NUM         10
+#define MAX_OMX_COMPONENT_NAME_SIZE        OMX_MAX_STRINGNAME_SIZE
+#define MAX_OMX_COMPONENT_ROLE_SIZE        OMX_MAX_STRINGNAME_SIZE
+#define MAX_OMX_COMPONENT_LIBNAME_SIZE     OMX_MAX_STRINGNAME_SIZE * 2
+#define MAX_OMX_MIMETYPE_SIZE              OMX_MAX_STRINGNAME_SIZE
+
+#define MAX_TIMESTAMP        17
+#define MAX_FLAGS            17
+
+#define SEC_OMX_INSTALL_PATH "/system/lib/omx/"
+
+typedef enum _SEC_CODEC_TYPE
+{
+    SW_CODEC,
+    HW_VIDEO_DEC_CODEC,
+    HW_VIDEO_ENC_CODEC,
+    HW_AUDIO_DEC_CODEC,
+    HW_AUDIO_ENC_CODEC
+} SEC_CODEC_TYPE;
+
+typedef struct _SEC_OMX_PRIORITYMGMTTYPE
+{
+    OMX_U32 nGroupPriority; /* the value 0 represents the highest priority */
+                            /* for a group of components                   */
+    OMX_U32 nGroupID;
+} SEC_OMX_PRIORITYMGMTTYPE;
+
+typedef enum _SEC_OMX_INDEXTYPE
+{
+#define SEC_INDEX_PARAM_ENABLE_THUMBNAIL "OMX.SEC.index.ThumbnailMode"
+    OMX_IndexVendorThumbnailMode        = 0x7F000001,
+#define SEC_INDEX_CONFIG_VIDEO_INTRAPERIOD "OMX.SEC.index.VideoIntraPeriod"
+    OMX_IndexConfigVideoIntraPeriod     = 0x7F000002,
+
+    /* for Android Native Window */
+#define SEC_INDEX_PARAM_ENABLE_ANB "OMX.google.android.index.enableAndroidNativeBuffers"
+    OMX_IndexParamEnableAndroidBuffers    = 0x7F000011,
+#define SEC_INDEX_PARAM_GET_ANB "OMX.google.android.index.getAndroidNativeBufferUsage"
+    OMX_IndexParamGetAndroidNativeBuffer  = 0x7F000012,
+#define SEC_INDEX_PARAM_USE_ANB "OMX.google.android.index.useAndroidNativeBuffer"
+    OMX_IndexParamUseAndroidNativeBuffer  = 0x7F000013,
+    /* for Android Store Metadata Inbuffer */
+#define SEC_INDEX_PARAM_STORE_METADATA_BUFFER "OMX.google.android.index.storeMetaDataInBuffers"
+    OMX_IndexParamStoreMetaDataBuffer     = 0x7F000014,
+
+    /* for Android PV OpenCore*/
+    OMX_COMPONENT_CAPABILITY_TYPE_INDEX = 0xFF7A347
+} SEC_OMX_INDEXTYPE;
+
+typedef enum _SEC_OMX_ERRORTYPE
+{
+    OMX_ErrorNoEOF = (OMX_S32) 0x90000001,
+    OMX_ErrorInputDataDecodeYet = (OMX_S32) 0x90000002,
+    OMX_ErrorInputDataEncodeYet = (OMX_S32) 0x90000003,
+    OMX_ErrorMFCInit = (OMX_S32) 0x90000004
+} SEC_OMX_ERRORTYPE;
+
+typedef enum _SEC_OMX_COMMANDTYPE
+{
+    SEC_OMX_CommandComponentDeInit = 0x7F000001,
+    SEC_OMX_CommandEmptyBuffer,
+    SEC_OMX_CommandFillBuffer
+} SEC_OMX_COMMANDTYPE;
+
+typedef enum _SEC_OMX_TRANS_STATETYPE {
+    SEC_OMX_TransStateInvalid,
+    SEC_OMX_TransStateLoadedToIdle,
+    SEC_OMX_TransStateIdleToExecuting,
+    SEC_OMX_TransStateExecutingToIdle,
+    SEC_OMX_TransStateIdleToLoaded,
+    SEC_OMX_TransStateMax = 0X7FFFFFFF
+} SEC_OMX_TRANS_STATETYPE;
+
+typedef enum _SEC_OMX_COLOR_FORMATTYPE {
+    OMX_SEC_COLOR_FormatNV12TPhysicalAddress = 0x7F000001, /**< Reserved region for introducing Vendor Extensions */
+    OMX_SEC_COLOR_FormatNV12LPhysicalAddress = 0x7F000002,
+    OMX_SEC_COLOR_FormatNV12LVirtualAddress = 0x7F000003,
+    OMX_SEC_COLOR_FormatNV12Tiled            = 0x7FC00002,  /* 0x7FC00002 */
+#ifdef S3D_SUPPORT
+    OMX_SEC_COLOR_FormatNV12Tiled_SBS_LR     = 0x7FC00003,  /* 0x7FC00003 */
+    OMX_SEC_COLOR_FormatNV12Tiled_SBS_RL     = 0x7FC00004,  /* 0x7FC00004 */
+    OMX_SEC_COLOR_FormatNV12Tiled_TB_LR     = 0x7FC00005,  /* 0x7FC00005 */
+    OMX_SEC_COLOR_FormatNV12Tiled_TB_RL   = 0x7FC00006,  /* 0x7FC00006 */
+    OMX_SEC_COLOR_FormatYUV420SemiPlanar_SBS_LR     = 0x7FC00007,  /* 0x7FC00007 */
+    OMX_SEC_COLOR_FormatYUV420SemiPlanar_SBS_RL     = 0x7FC00008,  /* 0x7FC00008 */
+    OMX_SEC_COLOR_FormatYUV420SemiPlanar_TB_LR     = 0x7FC00009,  /* 0x7FC00009 */
+    OMX_SEC_COLOR_FormatYUV420SemiPlanar_TB_RL   = 0x7FC0000A,  /* 0x7FC0000A */
+    OMX_SEC_COLOR_FormatYUV420Planar_SBS_LR     = 0x7FC0000B,  /* 0x7FC0000B */
+    OMX_SEC_COLOR_FormatYUV420Planar_SBS_RL     = 0x7FC0000C,  /* 0x7FC0000C */
+    OMX_SEC_COLOR_FormatYUV420Planar_TB_LR     = 0x7FC0000D,  /* 0x7FC0000D */
+    OMX_SEC_COLOR_FormatYUV420Planar_TB_RL   = 0x7FC0000E,  /* 0x7FC0000E */
+#endif
+    OMX_SEC_COLOR_FormatNV21LPhysicalAddress = 0x7F000010,
+    OMX_SEC_COLOR_FormatNV21Linear           = 0x7F000011,
+
+    /* for Android Native Window */
+    OMX_SEC_COLOR_FormatANBYUV420SemiPlanar  = 0x100,
+    /* for Android SurfaceMediaSource*/
+    OMX_COLOR_FormatAndroidOpaque            = 0x7F000789
+}SEC_OMX_COLOR_FORMATTYPE;
+
+typedef enum _SEC_OMX_SUPPORTFORMAT_TYPE
+{
+    supportFormat_0 = 0x00,
+    supportFormat_1,
+    supportFormat_2,
+    supportFormat_3,
+    supportFormat_4,
+    supportFormat_5,
+    supportFormat_6,
+    supportFormat_7,
+    supportFormat_8
+} SEC_OMX_SUPPORTFORMAT_TYPE;
+
+/* for Android PV OpenCore*/
+typedef struct _OMXComponentCapabilityFlagsType
+{
+    /* OMX COMPONENT CAPABILITY RELATED MEMBERS */
+    OMX_BOOL iIsOMXComponentMultiThreaded;
+    OMX_BOOL iOMXComponentSupportsExternalOutputBufferAlloc;
+    OMX_BOOL iOMXComponentSupportsExternalInputBufferAlloc;
+    OMX_BOOL iOMXComponentSupportsMovableInputBuffers;
+    OMX_BOOL iOMXComponentSupportsPartialFrames;
+    OMX_BOOL iOMXComponentUsesNALStartCodes;
+    OMX_BOOL iOMXComponentCanHandleIncompleteFrames;
+    OMX_BOOL iOMXComponentUsesFullAVCFrames;
+} OMXComponentCapabilityFlagsType;
+
+typedef struct _SEC_OMX_VIDEO_PROFILELEVEL
+{
+    OMX_S32  profile;
+    OMX_S32  level;
+} SEC_OMX_VIDEO_PROFILELEVEL;
+
+#define OMX_VIDEO_CodingVPX     0x09    /**< Google VPX, formerly known as On2 VP8 */
+
+#ifndef __OMX_EXPORTS
+#define __OMX_EXPORTS
+#define SEC_EXPORT_REF __attribute__((visibility("default")))
+#define SEC_IMPORT_REF __attribute__((visibility("default")))
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/include/sec/SEC_OMX_Macros.h b/exynos4/multimedia/openmax/sec_omx/include/sec/SEC_OMX_Macros.h
new file mode 100644
index 0000000..853d0ac
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/include/sec/SEC_OMX_Macros.h
@@ -0,0 +1,66 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    SEC_OMX_Macros.h
+ * @brief   Macros
+ * @author  SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OMX_MACROS
+#define SEC_OMX_MACROS
+
+#include "SEC_OMX_Def.h"
+#include "SEC_OSAL_Memory.h"
+
+
+/*
+ * MACROS
+ */
+#define ALIGN(x, a)       (((x) + (a) - 1) & ~((a) - 1))
+#define ALIGN_TO_16B(x)   ((((x) + (1 <<  4) - 1) >>  4) <<  4)
+#define ALIGN_TO_32B(x)   ((((x) + (1 <<  5) - 1) >>  5) <<  5)
+#define ALIGN_TO_128B(x)  ((((x) + (1 <<  7) - 1) >>  7) <<  7)
+#define ALIGN_TO_8KB(x)   ((((x) + (1 << 13) - 1) >> 13) << 13)
+
+#define INIT_SET_SIZE_VERSION(_struct_, _structType_)               \
+    do {                                                            \
+        SEC_OSAL_Memset((_struct_), 0, sizeof(_structType_));       \
+        (_struct_)->nSize = sizeof(_structType_);                   \
+        (_struct_)->nVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; \
+        (_struct_)->nVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; \
+        (_struct_)->nVersion.s.nRevision = REVISION_NUMBER;         \
+        (_struct_)->nVersion.s.nStep = STEP_NUMBER;                 \
+    } while (0)
+
+/*
+ * Port Specific
+ */
+#define SEC_TUNNEL_ESTABLISHED 0x0001
+#define SEC_TUNNEL_IS_SUPPLIER 0x0002
+
+#define CHECK_PORT_BEING_FLUSHED(port)                 (port->bIsPortFlushed == OMX_TRUE)
+#define CHECK_PORT_BEING_DISABLED(port)                (port->bIsPortDisabled == OMX_TRUE)
+#define CHECK_PORT_ENABLED(port)                       (port->portDefinition.bEnabled == OMX_TRUE)
+#define CHECK_PORT_POPULATED(port)                     (port->portDefinition.bPopulated == OMX_TRUE)
+#define CHECK_PORT_TUNNELED(port)                      (port->tunnelFlags & SEC_TUNNEL_ESTABLISHED)
+#define CHECK_PORT_BUFFER_SUPPLIER(port)               (port->tunnelFlags & SEC_TUNNEL_IS_SUPPLIER)
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/Android.mk b/exynos4/multimedia/openmax/sec_omx/osal/Android.mk
new file mode 100644
index 0000000..5dcbeee
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/Android.mk
@@ -0,0 +1,45 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+	SEC_OSAL_Android.cpp \
+	SEC_OSAL_Event.c \
+	SEC_OSAL_Queue.c \
+	SEC_OSAL_ETC.c \
+	SEC_OSAL_Mutex.c \
+	SEC_OSAL_Thread.c \
+	SEC_OSAL_Memory.c \
+	SEC_OSAL_Semaphore.c \
+	SEC_OSAL_Library.c \
+	SEC_OSAL_Log.c
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE := libsecosal
+
+LOCAL_CFLAGS :=
+
+ifeq ($(BOARD_USE_S3D_SUPPORT), true)
+LOCAL_CFLAGS += -DS3D_SUPPORT
+endif
+
+LOCAL_STATIC_LIBRARIES :=
+LOCAL_SHARED_LIBRARIES := libcutils libutils \
+	libui \
+	libhardware \
+	libandroid_runtime \
+	libsurfaceflinger_client \
+	libbinder \
+	libmedia
+
+LOCAL_C_INCLUDES := \
+    $(SEC_OMX_INC)/khronos \
+	$(SEC_OMX_INC)/sec \
+	$(SEC_OMX_TOP)/osal \
+	$(SEC_OMX_COMPONENT)/common \
+	$(SEC_OMX_COMPONENT)/video/dec \
+	$(BOARD_HAL_PATH)/include \
+	$(BOARD_HAL_PATH)/libump/include
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Android.cpp b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Android.cpp
new file mode 100644
index 0000000..2a51de9
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Android.cpp
@@ -0,0 +1,581 @@
+/*
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Android.cpp
+ * @brief
+ * @author      Seungbeom Kim (sbcrux.kim@samsung.com)
+ * @author      Hyeyeon Chung (hyeon.chung@samsung.com)
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @author      Jinsung Yang (jsgood.yang@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2011.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <ui/android_native_buffer.h>
+#include <ui/GraphicBuffer.h>
+#include <ui/GraphicBufferMapper.h>
+#include <ui/Rect.h>
+#include <media/stagefright/HardwareAPI.h>
+#include <hardware/hardware.h>
+#include <media/stagefright/MetadataBufferType.h>
+
+#include "gralloc_priv.h"
+
+#include "SEC_OSAL_Semaphore.h"
+#include "SEC_OMX_Baseport.h"
+#include "SEC_OMX_Basecomponent.h"
+#include "SEC_OMX_Macros.h"
+#include "SEC_OMX_Vdec.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_OSAL_Android"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+using namespace android;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE useAndroidNativeBuffer(
+    SEC_OMX_BASEPORT      *pSECPort,
+    OMX_BUFFERHEADERTYPE **ppBufferHdr,
+    OMX_U32                nPortIndex,
+    OMX_PTR                pAppPrivate,
+    OMX_U32                nSizeBytes,
+    OMX_U8                *pBuffer)
+{
+    OMX_ERRORTYPE         ret = OMX_ErrorNone;
+    OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL;
+    unsigned int          i = 0;
+
+    FunctionIn();
+
+    if (pSECPort == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pSECPort->portState != OMX_StateIdle) {
+        ret = OMX_ErrorIncorrectStateOperation;
+        goto EXIT;
+    }
+    if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+        ret = OMX_ErrorBadPortIndex;
+        goto EXIT;
+    }
+
+    temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)SEC_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE));
+    if (temp_bufferHeader == NULL) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+    SEC_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE));
+
+    for (i = 0; i < pSECPort->portDefinition.nBufferCountActual; i++) {
+        if (pSECPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) {
+            pSECPort->bufferHeader[i] = temp_bufferHeader;
+            pSECPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED);
+            INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE);
+            temp_bufferHeader->pBuffer        = pBuffer;
+            temp_bufferHeader->nAllocLen      = nSizeBytes;
+            temp_bufferHeader->pAppPrivate    = pAppPrivate;
+            if (nPortIndex == INPUT_PORT_INDEX)
+                temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX;
+            else
+                temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX;
+
+            pSECPort->assignedBufferNum++;
+            if (pSECPort->assignedBufferNum == pSECPort->portDefinition.nBufferCountActual) {
+                pSECPort->portDefinition.bPopulated = OMX_TRUE;
+                /* SEC_OSAL_MutexLock(pSECComponent->compMutex); */
+                SEC_OSAL_SemaphorePost(pSECPort->loadedResource);
+                /* SEC_OSAL_MutexUnlock(pSECComponent->compMutex); */
+            }
+            *ppBufferHdr = temp_bufferHeader;
+            goto EXIT;
+        }
+    }
+
+    SEC_OSAL_Free(temp_bufferHeader);
+    ret = OMX_ErrorInsufficientResources;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_LockANBHandle(
+    OMX_IN OMX_U32 handle,
+    OMX_IN OMX_U32 width,
+    OMX_IN OMX_U32 height,
+    OMX_IN OMX_COLOR_FORMATTYPE format,
+    OMX_OUT OMX_PTR *vaddr)
+{
+    FunctionIn();
+
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    GraphicBufferMapper &mapper = GraphicBufferMapper::get();
+    buffer_handle_t bufferHandle = (buffer_handle_t) handle;
+    Rect bounds(width, height);
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "%s: handle: 0x%x", __func__, handle);
+
+    int usage = 0;
+
+    switch (format) {
+    case OMX_COLOR_FormatYUV420Planar:
+    case OMX_COLOR_FormatYUV420SemiPlanar:
+#ifdef S3D_SUPPORT
+    case OMX_SEC_COLOR_FormatNV12Tiled_SBS_LR:
+    case OMX_SEC_COLOR_FormatNV12Tiled_SBS_RL:
+    case OMX_SEC_COLOR_FormatNV12Tiled_TB_LR:
+    case OMX_SEC_COLOR_FormatNV12Tiled_TB_RL:
+    case OMX_SEC_COLOR_FormatYUV420SemiPlanar_SBS_LR:
+    case OMX_SEC_COLOR_FormatYUV420SemiPlanar_SBS_RL:
+    case OMX_SEC_COLOR_FormatYUV420SemiPlanar_TB_LR:
+    case OMX_SEC_COLOR_FormatYUV420SemiPlanar_TB_RL:
+    case OMX_SEC_COLOR_FormatYUV420Planar_SBS_LR:
+    case OMX_SEC_COLOR_FormatYUV420Planar_SBS_RL:
+    case OMX_SEC_COLOR_FormatYUV420Planar_TB_LR:
+    case OMX_SEC_COLOR_FormatYUV420Planar_TB_RL:
+#endif
+    case OMX_SEC_COLOR_FormatANBYUV420SemiPlanar:
+        usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_YUV_ADDR;
+        break;
+    default:
+        usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN;
+        break;
+    }
+
+    if (mapper.lock(bufferHandle, usage, bounds, vaddr) != 0) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: mapper.lock() fail", __func__);
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "%s: buffer locked: 0x%x", __func__, *vaddr);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_UnlockANBHandle(OMX_IN OMX_U32 handle)
+{
+    FunctionIn();
+
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    GraphicBufferMapper &mapper = GraphicBufferMapper::get();
+    buffer_handle_t bufferHandle = (buffer_handle_t) handle;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "%s: handle: 0x%x", __func__, handle);
+
+    if (mapper.unlock(bufferHandle) != 0) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: mapper.unlock() fail", __func__);
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "%s: buffer unlocked: 0x%x", __func__, handle);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_GetPhysANBHandle(
+    OMX_IN OMX_U32 handle,
+    OMX_OUT OMX_PTR *paddr)
+{
+    FunctionIn();
+
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    GraphicBufferMapper &mapper = GraphicBufferMapper::get();
+    buffer_handle_t bufferHandle = (buffer_handle_t) handle;
+
+    SEC_OSAL_Log(SEC_LOG_TRACE, "%s: handle: 0x%x", __func__, handle);
+
+    if (mapper.getphys(bufferHandle, paddr) != 0) {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: mapper.getphys() fail", __func__);
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_LockANB(
+    OMX_IN OMX_PTR pBuffer,
+    OMX_IN OMX_U32 width,
+    OMX_IN OMX_U32 height,
+    OMX_IN OMX_COLOR_FORMATTYPE format,
+    OMX_OUT OMX_U32 *pStride,
+    OMX_OUT OMX_PTR *vaddr)
+{
+    FunctionIn();
+
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    android_native_buffer_t *pANB = (android_native_buffer_t *) pBuffer;
+
+    ret = SEC_OSAL_LockANBHandle((OMX_U32)pANB->handle, width, height, format, vaddr);
+    *pStride = pANB->stride;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_UnlockANB(OMX_IN OMX_PTR pBuffer)
+{
+    FunctionIn();
+
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    android_native_buffer_t *pANB = (android_native_buffer_t *) pBuffer;
+
+    ret = SEC_OSAL_UnlockANBHandle((OMX_U32)pANB->handle);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_GetPhysANB(
+    OMX_IN OMX_PTR pBuffer,
+    OMX_OUT OMX_PTR *paddr)
+{
+    FunctionIn();
+
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    android_native_buffer_t *pANB = (android_native_buffer_t *) pBuffer;
+
+    ret = SEC_OSAL_GetPhysANBHandle((OMX_U32)pANB->handle, paddr);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_GetANBParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_INOUT OMX_PTR     ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    switch (nIndex) {
+    case OMX_IndexParamGetAndroidNativeBuffer:
+    {
+        GetAndroidNativeBufferUsageParams *pANBParams = (GetAndroidNativeBufferUsageParams *) ComponentParameterStructure;
+        OMX_U32 portIndex = pANBParams->nPortIndex;
+
+        SEC_OSAL_Log(SEC_LOG_TRACE, "%s: OMX_IndexParamGetAndroidNativeBuffer", __func__);
+
+        ret = SEC_OMX_Check_SizeVersion(pANBParams, sizeof(GetAndroidNativeBufferUsageParams));
+        if (ret != OMX_ErrorNone) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_OMX_Check_SizeVersion(GetAndroidNativeBufferUsageParams) is failed", __func__);
+            goto EXIT;
+        }
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        /* NOTE: OMX_IndexParamGetAndroidNativeBuffer returns original 'nUsage' without any
+         * modifications since currently not defined what the 'nUsage' is for.
+         */
+        pANBParams->nUsage |= 0;
+    }
+        break;
+
+    default:
+    {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: Unsupported index (%d)", __func__, nIndex);
+        ret = OMX_ErrorUnsupportedIndex;
+        goto EXIT;
+    }
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SetANBParameter(
+    OMX_IN OMX_HANDLETYPE hComponent,
+    OMX_IN OMX_INDEXTYPE  nIndex,
+    OMX_IN OMX_PTR        ComponentParameterStructure)
+{
+    OMX_ERRORTYPE          ret = OMX_ErrorNone;
+    OMX_COMPONENTTYPE     *pOMXComponent = NULL;
+    SEC_OMX_BASECOMPONENT *pSECComponent = NULL;
+    SEC_OMX_VIDEODEC_COMPONENT *pVideoDec = NULL;
+
+    FunctionIn();
+
+    if (hComponent == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
+    ret = SEC_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
+    if (ret != OMX_ErrorNone) {
+        goto EXIT;
+    }
+
+    if (pOMXComponent->pComponentPrivate == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pSECComponent = (SEC_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
+    if (pSECComponent->currentState == OMX_StateInvalid ) {
+        ret = OMX_ErrorInvalidState;
+        goto EXIT;
+    }
+
+    if (ComponentParameterStructure == NULL) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    pVideoDec = (SEC_OMX_VIDEODEC_COMPONENT *)pSECComponent->hComponentHandle;
+
+    switch (nIndex) {
+    case OMX_IndexParamEnableAndroidBuffers:
+    {
+        EnableAndroidNativeBuffersParams *pANBParams = (EnableAndroidNativeBuffersParams *) ComponentParameterStructure;
+        OMX_U32 portIndex = pANBParams->nPortIndex;
+        SEC_OMX_BASEPORT *pSECPort = NULL;
+
+        SEC_OSAL_Log(SEC_LOG_TRACE, "%s: OMX_IndexParamEnableAndroidNativeBuffers", __func__);
+
+        ret = SEC_OMX_Check_SizeVersion(pANBParams, sizeof(EnableAndroidNativeBuffersParams));
+        if (ret != OMX_ErrorNone) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_OMX_Check_SizeVersion(EnableAndroidNativeBuffersParams) is failed", __func__);
+            goto EXIT;
+        }
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+        if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pSECPort->bIsANBEnabled = pANBParams->enable;
+    }
+        break;
+
+    case OMX_IndexParamUseAndroidNativeBuffer:
+    {
+        UseAndroidNativeBufferParams *pANBParams = (UseAndroidNativeBufferParams *) ComponentParameterStructure;
+        OMX_U32 portIndex = pANBParams->nPortIndex;
+        SEC_OMX_BASEPORT *pSECPort = NULL;
+        android_native_buffer_t *pANB;
+        OMX_U32 nSizeBytes;
+
+        SEC_OSAL_Log(SEC_LOG_TRACE, "%s: OMX_IndexParamUseAndroidNativeBuffer, portIndex: %d", __func__, portIndex);
+
+        ret = SEC_OMX_Check_SizeVersion(pANBParams, sizeof(UseAndroidNativeBufferParams));
+        if (ret != OMX_ErrorNone) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_OMX_Check_SizeVersion(UseAndroidNativeBufferParams) is failed", __func__);
+            goto EXIT;
+        }
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+        if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        if (pSECPort->portState != OMX_StateIdle) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: Port state should be IDLE", __func__);
+            ret = OMX_ErrorIncorrectStateOperation;
+            goto EXIT;
+        }
+
+        pANB = pANBParams->nativeBuffer.get();
+
+        /* MALI alignment restriction */
+        nSizeBytes = ALIGN(pANB->width, 16) * ALIGN(pANB->height, 16);
+        nSizeBytes += ALIGN(pANB->width / 2, 16) * ALIGN(pANB->height / 2, 16) * 2;
+
+        ret = useAndroidNativeBuffer(pSECPort,
+                                     pANBParams->bufferHeader,
+                                     pANBParams->nPortIndex,
+                                     pANBParams->pAppPrivate,
+                                     nSizeBytes,
+                                     (OMX_U8 *) pANB);
+        if (ret != OMX_ErrorNone) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: useAndroidNativeBuffer is failed", __func__);
+            goto EXIT;
+        }
+    }
+        break;
+
+    case OMX_IndexParamStoreMetaDataBuffer:
+    {
+        StoreMetaDataInBuffersParams *pANBParams = (StoreMetaDataInBuffersParams *) ComponentParameterStructure;
+        OMX_U32 portIndex = pANBParams->nPortIndex;
+        SEC_OMX_BASEPORT *pSECPort = NULL;
+
+        SEC_OSAL_Log(SEC_LOG_TRACE, "%s: OMX_IndexParamStoreMetaDataBuffer", __func__);
+
+        ret = SEC_OMX_Check_SizeVersion(pANBParams, sizeof(StoreMetaDataInBuffersParams));
+        if (ret != OMX_ErrorNone) {
+            SEC_OSAL_Log(SEC_LOG_ERROR, "%s: SEC_OMX_Check_SizeVersion(StoreMetaDataInBuffersParams) is failed", __func__);
+            goto EXIT;
+        }
+
+        if (portIndex >= pSECComponent->portParam.nPorts) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pSECPort = &pSECComponent->pSECPort[portIndex];
+        if (CHECK_PORT_TUNNELED(pSECPort) && CHECK_PORT_BUFFER_SUPPLIER(pSECPort)) {
+            ret = OMX_ErrorBadPortIndex;
+            goto EXIT;
+        }
+
+        pSECPort->bStoreMetaData = pANBParams->bStoreMetaData;
+    }
+        break;
+
+    default:
+    {
+        SEC_OSAL_Log(SEC_LOG_ERROR, "%s: Unsupported index (%d)", __func__, nIndex);
+        ret = OMX_ErrorUnsupportedIndex;
+        goto EXIT;
+    }
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_GetInfoFromMetaData(OMX_IN SEC_OMX_DATA *pBuffer,
+                                           OMX_OUT OMX_PTR *ppBuf)
+{
+    OMX_ERRORTYPE      ret = OMX_ErrorNone;
+    MetadataBufferType type;
+    buffer_handle_t    pBufHandle;
+
+    FunctionIn();
+
+/*
+ * meta data contains the following data format.
+ * payload depends on the MetadataBufferType
+ * --------------------------------------------------------------
+ * | MetadataBufferType                         |          payload                           |
+ * --------------------------------------------------------------
+ *
+ * If MetadataBufferType is kMetadataBufferTypeCameraSource, then
+ * --------------------------------------------------------------
+ * | kMetadataBufferTypeCameraSource  | physical addr. of Y |physical addr. of CbCr |
+ * --------------------------------------------------------------
+ *
+ * If MetadataBufferType is kMetadataBufferTypeGrallocSource, then
+ * --------------------------------------------------------------
+ * | kMetadataBufferTypeGrallocSource    | buffer_handle_t |
+ * --------------------------------------------------------------
+ */
+
+    /* MetadataBufferType */
+    memcpy(&type, (MetadataBufferType *)(pBuffer->dataBuffer), sizeof(type));
+
+    if (type == kMetadataBufferTypeCameraSource) {
+        /* physical addr. of Y */
+        ppBuf[0] = (OMX_PTR)(pBuffer->dataBuffer + sizeof(type));
+        /* physical addr. of CbCr */
+        ppBuf[1] = (OMX_PTR)(pBuffer->dataBuffer + sizeof(type) + sizeof(pBuffer->dataBuffer));
+    } else if (type == kMetadataBufferTypeGrallocSource) {
+        /* buffer_handle_t */
+        memcpy(&pBufHandle, pBuffer->dataBuffer + sizeof(type), sizeof(buffer_handle_t));
+        ppBuf[0] = (OMX_PTR)pBufHandle;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Android.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Android.h
new file mode 100644
index 0000000..67029f5
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Android.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2011 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Android.h
+ * @brief
+ * @author      Seungbeom Kim (sbcrux.kim@samsung.com)
+ * @author      Hyeyeon Chung (hyeon.chung@samsung.com)
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @author      Jinsung Yang (jsgood.yang@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2011.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_ANDROID
+#define SEC_OSAL_ANDROID
+
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+#include "OMX_Index.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OSAL_GetANBParameter(OMX_IN OMX_HANDLETYPE hComponent,
+                                       OMX_IN OMX_INDEXTYPE nIndex,
+                                       OMX_INOUT OMX_PTR ComponentParameterStructure);
+
+OMX_ERRORTYPE SEC_OSAL_SetANBParameter(OMX_IN OMX_HANDLETYPE hComponent,
+                                       OMX_IN OMX_INDEXTYPE nIndex,
+                                       OMX_IN OMX_PTR ComponentParameterStructure);
+
+OMX_ERRORTYPE SEC_OSAL_LockANB(OMX_IN OMX_PTR pBuffer,
+                               OMX_IN OMX_U32 width,
+                               OMX_IN OMX_U32 height,
+                               OMX_IN OMX_COLOR_FORMATTYPE format,
+                               OMX_OUT OMX_U32 *pStride,
+                               OMX_OUT OMX_PTR *vaddr);
+
+OMX_ERRORTYPE SEC_OSAL_GetPhysANB(OMX_IN OMX_PTR pBuffer,
+                                  OMX_OUT OMX_PTR *paddr);
+
+OMX_ERRORTYPE SEC_OSAL_UnlockANB(OMX_IN OMX_PTR pBuffer);
+
+OMX_ERRORTYPE SEC_OSAL_LockANBHandle(OMX_IN OMX_U32 pBuffer,
+                                     OMX_IN OMX_U32 width,
+                                     OMX_IN OMX_U32 height,
+                                     OMX_IN OMX_COLOR_FORMATTYPE format,
+                                     OMX_OUT OMX_PTR *vaddr);
+
+OMX_ERRORTYPE SEC_OSAL_UnlockANBHandle(OMX_IN OMX_U32 pBuffer);
+
+OMX_ERRORTYPE SEC_OSAL_GetPhysANBHandle(OMX_IN OMX_U32 pBuffer,
+                                        OMX_OUT OMX_PTR *paddr);
+
+OMX_ERRORTYPE SEC_OSAL_GetInfoFromMetaData(OMX_IN SEC_OMX_DATA *pBuffer,
+                                           OMX_OUT OMX_PTR *pOutBuffer);
+
+OMX_ERRORTYPE SEC_OSAL_CheckANB(OMX_IN SEC_OMX_DATA *pBuffer,
+                                OMX_OUT OMX_BOOL *bIsANBEnabled);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_ETC.c b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_ETC.c
new file mode 100644
index 0000000..2082368
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_ETC.c
@@ -0,0 +1,237 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_ETC.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_ETC.h"
+#include "SEC_OSAL_Log.h"
+
+static struct timeval perfStart[PERF_ID_MAX+1], perfStop[PERF_ID_MAX+1];
+static unsigned long perfTime[PERF_ID_MAX+1], totalPerfTime[PERF_ID_MAX+1];
+static unsigned int perfFrameCount[PERF_ID_MAX+1], perfOver30ms[PERF_ID_MAX+1];
+
+#ifndef HAVE_GETLINE
+ssize_t getline(char **ppLine, size_t *pLen, FILE *pStream)
+{
+    char *pCurrentPointer = NULL;
+    size_t const chunk = 512;
+
+    size_t defaultBufferSize = chunk + 1;
+    size_t retSize = 0;
+
+    if (*ppLine == NULL) {
+        *ppLine = (char *)malloc(defaultBufferSize);
+        if (*ppLine == NULL) {
+            retSize = -1;
+            goto EXIT;
+        }
+        *pLen = defaultBufferSize;
+    }
+    else {
+        if (*pLen < defaultBufferSize) {
+            *ppLine = (char *)realloc(*ppLine, defaultBufferSize);
+            if (*ppLine == NULL) {
+                retSize = -1;
+                goto EXIT;
+            }
+            *pLen = defaultBufferSize;
+        }
+    }
+
+    while (1) {
+        size_t i;
+        size_t j = 0;
+        size_t readByte = 0;
+
+        pCurrentPointer = *ppLine + readByte;
+
+        i = fread(pCurrentPointer, 1, chunk, pStream);
+        if (i < chunk && ferror(pStream)) {
+            retSize = -1;
+            goto EXIT;
+        }
+        while (j < i) {
+            ++j;
+            if (*pCurrentPointer++ == (char)'\n') {
+                *pCurrentPointer = '\0';
+                if (j != i) {
+                    if (fseek(pStream, j - i, SEEK_CUR)) {
+                        retSize = -1;
+                        goto EXIT;
+                }
+                    if (feof(pStream))
+                        clearerr(pStream);
+                }
+                readByte += j;
+                retSize = readByte;
+                goto EXIT;
+            }
+        }
+
+        readByte += j;
+        if (feof(pStream)) {
+            if (readByte) {
+                retSize = readByte;
+                goto EXIT;
+            }
+            if (!i) {
+                retSize = -1;
+                goto EXIT;
+            }
+        }
+
+        i = ((readByte + (chunk * 2)) / chunk) * chunk;
+        if (i != *pLen) {
+            *ppLine = (char *)realloc(*ppLine, i);
+            if (*ppLine == NULL) {
+                retSize = -1;
+                goto EXIT;
+        }
+            *pLen = i;
+        }
+    }
+
+EXIT:
+    return retSize;
+}
+#endif /* HAVE_GETLINE */
+
+OMX_PTR SEC_OSAL_Strcpy(OMX_PTR dest, OMX_PTR src)
+{
+    return strcpy(dest, src);
+}
+
+OMX_PTR SEC_OSAL_Strncpy(OMX_PTR dest, OMX_PTR src, size_t num)
+{
+    return strncpy(dest, src, num);
+}
+
+OMX_S32 SEC_OSAL_Strcmp(OMX_PTR str1, OMX_PTR str2)
+{
+    return strcmp(str1, str2);
+}
+
+OMX_S32 SEC_OSAL_Strncmp(OMX_PTR str1, OMX_PTR str2, size_t num)
+{
+    return strncmp(str1, str2, num);
+}
+
+OMX_PTR SEC_OSAL_Strcat(OMX_PTR dest, OMX_PTR src)
+{
+    return strcat(dest, src);
+}
+
+OMX_PTR SEC_OSAL_Strncat(OMX_PTR dest, OMX_PTR src, size_t num)
+{
+    return strncat(dest, src, num);
+}
+
+size_t SEC_OSAL_Strlen(const char *str)
+{
+    return strlen(str);
+}
+
+static OMX_U32 MeasureTime(struct timeval *start, struct timeval *stop)
+{
+    unsigned long sec, usec, time;
+
+    sec = stop->tv_sec - start->tv_sec;
+    if (stop->tv_usec >= start->tv_usec) {
+        usec = stop->tv_usec - start->tv_usec;
+    } else {
+        usec = stop->tv_usec + 1000000 - start->tv_usec;
+        sec--;
+    }
+
+    time = sec * 1000000 + (usec);
+
+    return time;
+}
+
+void SEC_OSAL_PerfInit(PERF_ID_TYPE id)
+{
+    memset(&perfStart[id], 0, sizeof(perfStart[id]));
+    memset(&perfStop[id], 0, sizeof(perfStop[id]));
+    perfTime[id] = 0;
+    totalPerfTime[id] = 0;
+    perfFrameCount[id] = 0;
+    perfOver30ms[id] = 0;
+}
+
+void SEC_OSAL_PerfStart(PERF_ID_TYPE id)
+{
+    gettimeofday(&perfStart[id], NULL);
+}
+
+void SEC_OSAL_PerfStop(PERF_ID_TYPE id)
+{
+    gettimeofday(&perfStop[id], NULL);
+
+    perfTime[id] = MeasureTime(&perfStart[id], &perfStop[id]);
+    totalPerfTime[id] += perfTime[id];
+    perfFrameCount[id]++;
+
+    if (perfTime[id] > 30000)
+        perfOver30ms[id]++;
+}
+
+OMX_U32 SEC_OSAL_PerfFrame(PERF_ID_TYPE id)
+{
+    return perfTime[id];
+}
+
+OMX_U32 SEC_OSAL_PerfTotal(PERF_ID_TYPE id)
+{
+    return totalPerfTime[id];
+}
+
+OMX_U32 SEC_OSAL_PerfFrameCount(PERF_ID_TYPE id)
+{
+    return perfFrameCount[id];
+}
+
+int SEC_OSAL_PerfOver30ms(PERF_ID_TYPE id)
+{
+    return perfOver30ms[id];
+}
+
+void SEC_OSAL_PerfPrint(OMX_STRING prefix, PERF_ID_TYPE id)
+{
+    OMX_U32 perfTotal;
+    int frameCount;
+
+    frameCount = SEC_OSAL_PerfFrameCount(id);
+    perfTotal = SEC_OSAL_PerfTotal(id);
+
+    SEC_OSAL_Log(SEC_LOG_INFO, "%s Frame Count: %d", prefix, frameCount);
+    SEC_OSAL_Log(SEC_LOG_INFO, "%s Avg Time: %.2f ms, Over 30ms: %d",
+                prefix, (float)perfTotal / (float)(frameCount * 1000),
+                SEC_OSAL_PerfOver30ms(id));
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_ETC.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_ETC.h
new file mode 100644
index 0000000..2275abb
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_ETC.h
@@ -0,0 +1,66 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_ETC.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_ETC
+#define SEC_OSAL_ETC
+
+#include "OMX_Types.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_PTR SEC_OSAL_Strcpy(OMX_PTR dest, OMX_PTR src);
+OMX_S32 SEC_OSAL_Strncmp(OMX_PTR str1, OMX_PTR str2, size_t num);
+OMX_S32 SEC_OSAL_Strcmp(OMX_PTR str1, OMX_PTR str2);
+OMX_PTR SEC_OSAL_Strcat(OMX_PTR dest, OMX_PTR src);
+size_t SEC_OSAL_Strlen(const char *str);
+ssize_t getline(char **ppLine, size_t *len, FILE *stream);
+
+/* perf */
+typedef enum _PERF_ID_TYPE {
+    PERF_ID_CSC = 0,
+    PERF_ID_DEC,
+    PERF_ID_ENC,
+    PERF_ID_USER,
+    PERF_ID_MAX,
+} PERF_ID_TYPE;
+
+void SEC_OSAL_PerfInit(PERF_ID_TYPE id);
+void SEC_OSAL_PerfStart(PERF_ID_TYPE id);
+void SEC_OSAL_PerfStop(PERF_ID_TYPE id);
+OMX_U32 SEC_OSAL_PerfFrame(PERF_ID_TYPE id);
+OMX_U32 SEC_OSAL_PerfTotal(PERF_ID_TYPE id);
+OMX_U32 SEC_OSAL_PerfFrameCount(PERF_ID_TYPE id);
+int SEC_OSAL_PerfOver30ms(PERF_ID_TYPE id);
+void SEC_OSAL_PerfPrint(OMX_STRING prefix, PERF_ID_TYPE id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Event.c b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Event.c
new file mode 100644
index 0000000..383b62c
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Event.c
@@ -0,0 +1,217 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/*
+ * @file        SEC_OSAL_Event.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Mutex.h"
+#include "SEC_OSAL_Event.h"
+
+#undef  SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_OSAL_EVENT"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+OMX_ERRORTYPE SEC_OSAL_SignalCreate(OMX_HANDLETYPE *eventHandle)
+{
+    SEC_OSAL_THREADEVENT *event;
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    event = (SEC_OSAL_THREADEVENT *)SEC_OSAL_Malloc(sizeof(SEC_OSAL_THREADEVENT));
+    if (!event) {
+        ret = OMX_ErrorInsufficientResources;
+        goto EXIT;
+    }
+
+    SEC_OSAL_Memset(event, 0, sizeof(SEC_OSAL_THREADEVENT));
+    event->signal = OMX_FALSE;
+
+    ret = SEC_OSAL_MutexCreate(&event->mutex);
+    if (ret != OMX_ErrorNone) {
+        SEC_OSAL_Free(event);
+        goto EXIT;
+    }
+
+    if (pthread_cond_init(&event->condition, NULL)) {
+        SEC_OSAL_MutexTerminate(event->mutex);
+        SEC_OSAL_Free(event);
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    *eventHandle = (OMX_HANDLETYPE)event;
+    ret = OMX_ErrorNone;
+
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SignalTerminate(OMX_HANDLETYPE eventHandle)
+{
+    SEC_OSAL_THREADEVENT *event = (SEC_OSAL_THREADEVENT *)eventHandle;
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    if (!event) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    ret = SEC_OSAL_MutexLock(event->mutex);
+    if (ret != OMX_ErrorNone) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    if (pthread_cond_destroy(&event->condition)) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    ret = SEC_OSAL_MutexUnlock(event->mutex);
+    if (ret != OMX_ErrorNone) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    ret = SEC_OSAL_MutexTerminate(event->mutex);
+    if (ret != OMX_ErrorNone) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    SEC_OSAL_Free(event);
+
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SignalReset(OMX_HANDLETYPE eventHandle)
+{
+    SEC_OSAL_THREADEVENT *event = (SEC_OSAL_THREADEVENT *)eventHandle;
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    if (!event) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    ret = SEC_OSAL_MutexLock(event->mutex);
+    if (ret != OMX_ErrorNone) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    event->signal = OMX_FALSE;
+
+    SEC_OSAL_MutexUnlock(event->mutex);
+
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SignalSet(OMX_HANDLETYPE eventHandle)
+{
+    SEC_OSAL_THREADEVENT *event = (SEC_OSAL_THREADEVENT *)eventHandle;
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    if (!event) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    ret = SEC_OSAL_MutexLock(event->mutex);
+    if (ret != OMX_ErrorNone) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    event->signal = OMX_TRUE;
+    pthread_cond_signal(&event->condition);
+
+    SEC_OSAL_MutexUnlock(event->mutex);
+
+EXIT:
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SignalWait(OMX_HANDLETYPE eventHandle, OMX_U32 ms)
+{
+    SEC_OSAL_THREADEVENT *event = (SEC_OSAL_THREADEVENT *)eventHandle;
+    OMX_ERRORTYPE         ret = OMX_ErrorNone;
+    struct timespec       timeout;
+    struct timeval        now;
+    int                   funcret = 0;
+    OMX_U32               tv_us;
+
+    FunctionIn();
+
+    if (!event) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    gettimeofday(&now, NULL);
+
+    tv_us = now.tv_usec + ms * 1000;
+    timeout.tv_sec = now.tv_sec + tv_us / 1000000;
+    timeout.tv_nsec = (tv_us % 1000000) * 1000;
+
+    ret = SEC_OSAL_MutexLock(event->mutex);
+    if (ret != OMX_ErrorNone) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+
+    if (ms == 0) {
+        if (!event->signal)
+            ret = OMX_ErrorTimeout;
+    } else if (ms == DEF_MAX_WAIT_TIME) {
+        while (!event->signal)
+            pthread_cond_wait(&event->condition, (pthread_mutex_t *)(event->mutex));
+        ret = OMX_ErrorNone;
+    } else {
+        while (!event->signal) {
+            funcret = pthread_cond_timedwait(&event->condition, (pthread_mutex_t *)(event->mutex), &timeout);
+            if ((!event->signal) && (funcret == ETIMEDOUT)) {
+                ret = OMX_ErrorTimeout;
+                break;
+            }
+        }
+    }
+
+    SEC_OSAL_MutexUnlock(event->mutex);
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Event.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Event.h
new file mode 100644
index 0000000..8ae2eb5
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Event.h
@@ -0,0 +1,61 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Event.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_EVENT
+#define SEC_OSAL_EVENT
+
+#include <pthread.h>
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#define DEF_MAX_WAIT_TIME 0xFFFFFFFF
+
+typedef struct _SEC_OSAL_THREADEVENT
+{
+    OMX_BOOL       signal;
+    OMX_HANDLETYPE mutex;
+    pthread_cond_t condition;
+} SEC_OSAL_THREADEVENT;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+OMX_ERRORTYPE SEC_OSAL_SignalCreate(OMX_HANDLETYPE *eventHandle);
+OMX_ERRORTYPE SEC_OSAL_SignalTerminate(OMX_HANDLETYPE eventHandle);
+OMX_ERRORTYPE SEC_OSAL_SignalReset(OMX_HANDLETYPE eventHandle);
+OMX_ERRORTYPE SEC_OSAL_SignalSet(OMX_HANDLETYPE eventHandle);
+OMX_ERRORTYPE SEC_OSAL_SignalWait(OMX_HANDLETYPE eventHandle, OMX_U32 ms);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Library.c b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Library.c
new file mode 100644
index 0000000..f400794
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Library.c
@@ -0,0 +1,54 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Library.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#include "SEC_OSAL_Library.h"
+
+
+void *SEC_OSAL_dlopen(const char *filename, int flag)
+{
+    return dlopen(filename, flag);
+}
+
+void *SEC_OSAL_dlsym(void *handle, const char *symbol)
+{
+    return dlsym(handle, symbol);
+}
+
+int SEC_OSAL_dlclose(void *handle)
+{
+    return dlclose(handle);
+}
+
+const char *SEC_OSAL_dlerror(void)
+{
+    return dlerror();
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Library.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Library.h
new file mode 100644
index 0000000..27ac42e
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Library.h
@@ -0,0 +1,46 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file       SEC_OSAL_Library.h
+ * @brief
+ * @author     SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *    2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_LIBRARY
+#define SEC_OSAL_LIBRARY
+
+#include "OMX_Types.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *SEC_OSAL_dlopen(const char *filename, int flag);
+void *SEC_OSAL_dlsym(void *handle, const char *symbol);
+int   SEC_OSAL_dlclose(void *handle);
+const char *SEC_OSAL_dlerror(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Log.c b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Log.c
new file mode 100644
index 0000000..0aa956a
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Log.c
@@ -0,0 +1,56 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Log.c
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <utils/Log.h>
+
+#include "SEC_OSAL_Log.h"
+
+
+void _SEC_OSAL_Log(SEC_LOG_LEVEL logLevel, const char *tag, const char *msg, ...)
+{
+    va_list argptr;
+
+    va_start(argptr, msg);
+
+    switch (logLevel) {
+    case SEC_LOG_TRACE:
+        __android_log_vprint(ANDROID_LOG_DEBUG, tag, msg, argptr);
+        break;
+    case SEC_LOG_INFO:
+        __android_log_vprint(ANDROID_LOG_INFO, tag, msg, argptr);
+        break;
+    case SEC_LOG_WARNING:
+        __android_log_vprint(ANDROID_LOG_WARN, tag, msg, argptr);
+        break;
+    case SEC_LOG_ERROR:
+        __android_log_vprint(ANDROID_LOG_ERROR, tag, msg, argptr);
+        break;
+    default:
+        __android_log_vprint(ANDROID_LOG_VERBOSE, tag, msg, argptr);
+    }
+
+    va_end(argptr);
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Log.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Log.h
new file mode 100644
index 0000000..d4f2617
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Log.h
@@ -0,0 +1,79 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Log.h
+ * @brief
+ * @author      Yunji Kim (yunji.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ *   2010.8.27 : Add trace function
+ */
+
+#ifndef SEC_OSAL_LOG
+#define SEC_OSAL_LOG
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SEC_LOG_OFF
+#define SEC_LOG
+#endif
+
+#ifndef SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_LOG"
+#endif
+
+#ifdef SEC_TRACE_ON
+#define SEC_TRACE
+#endif
+
+typedef enum _LOG_LEVEL
+{
+    SEC_LOG_TRACE,
+    SEC_LOG_INFO,
+    SEC_LOG_WARNING,
+    SEC_LOG_ERROR
+} SEC_LOG_LEVEL;
+
+#ifdef SEC_LOG
+#define SEC_OSAL_Log(a, ...)    ((void)_SEC_OSAL_Log(a, SEC_LOG_TAG, __VA_ARGS__))
+#else
+#define SEC_OSAL_Log(a, ...)                                                \
+    do {                                                                \
+        if (a == SEC_LOG_ERROR)                                     \
+            ((void)_SEC_OSAL_Log(a, SEC_LOG_TAG, __VA_ARGS__)); \
+    } while (0)
+#endif
+
+#ifdef SEC_TRACE
+#define FunctionIn() _SEC_OSAL_Log(SEC_LOG_TRACE, SEC_LOG_TAG, "%s In , Line: %d", __FUNCTION__, __LINE__)
+#define FunctionOut() _SEC_OSAL_Log(SEC_LOG_TRACE, SEC_LOG_TAG, "%s Out , Line: %d", __FUNCTION__, __LINE__)
+#else
+#define FunctionIn() ((void *)0)
+#define FunctionOut() ((void *)0)
+#endif
+
+extern void _SEC_OSAL_Log(SEC_LOG_LEVEL logLevel, const char *tag, const char *msg, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Memory.c b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Memory.c
new file mode 100644
index 0000000..bf5224d
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Memory.c
@@ -0,0 +1,71 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Memory.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OSAL_Memory.h"
+
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+static int mem_cnt = 0;
+
+OMX_PTR SEC_OSAL_Malloc(OMX_U32 size)
+{
+    mem_cnt++;
+    SEC_OSAL_Log(SEC_LOG_TRACE, "alloc count: %d", mem_cnt);
+
+    return (OMX_PTR)malloc(size);
+}
+
+void SEC_OSAL_Free(OMX_PTR addr)
+{
+    mem_cnt--;
+    SEC_OSAL_Log(SEC_LOG_TRACE, "free count: %d", mem_cnt);
+
+    if (addr)
+        free(addr);
+
+    return;
+}
+
+OMX_PTR SEC_OSAL_Memset(OMX_PTR dest, OMX_S32 c, OMX_S32 n)
+{
+    return memset(dest, c, n);
+}
+
+OMX_PTR SEC_OSAL_Memcpy(OMX_PTR dest, OMX_PTR src, OMX_S32 n)
+{
+    return memcpy(dest, src, n);
+}
+
+OMX_PTR SEC_OSAL_Memmove(OMX_PTR dest, OMX_PTR src, OMX_S32 n)
+{
+    return memmove(dest, src, n);
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Memory.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Memory.h
new file mode 100644
index 0000000..fed5cac
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Memory.h
@@ -0,0 +1,48 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Memory.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_MEMORY
+#define SEC_OSAL_MEMORY
+
+#include "OMX_Types.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_PTR SEC_OSAL_Malloc(OMX_U32 size);
+void    SEC_OSAL_Free(OMX_PTR addr);
+OMX_PTR SEC_OSAL_Memset(OMX_PTR dest, OMX_S32 c, OMX_S32 n);
+OMX_PTR SEC_OSAL_Memcpy(OMX_PTR dest, OMX_PTR src, OMX_S32 n);
+OMX_PTR SEC_OSAL_Memmove(OMX_PTR dest, OMX_PTR src, OMX_S32 n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Mutex.c b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Mutex.c
new file mode 100644
index 0000000..b8f7b79
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Mutex.c
@@ -0,0 +1,93 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Mutex.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Mutex.h"
+
+
+OMX_ERRORTYPE SEC_OSAL_MutexCreate(OMX_HANDLETYPE *mutexHandle)
+{
+    pthread_mutex_t *mutex;
+
+    mutex = (pthread_mutex_t *)SEC_OSAL_Malloc(sizeof(pthread_mutex_t));
+    if (!mutex)
+        return OMX_ErrorInsufficientResources;
+
+    if (pthread_mutex_init(mutex, NULL) != 0) {
+        SEC_OSAL_Free(mutex);
+        return OMX_ErrorUndefined;
+    }
+
+    *mutexHandle = (OMX_HANDLETYPE)mutex;
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_MutexTerminate(OMX_HANDLETYPE mutexHandle)
+{
+    pthread_mutex_t *mutex = (pthread_mutex_t *)mutexHandle;
+
+    if (mutex == NULL)
+        return OMX_ErrorBadParameter;
+
+    if (pthread_mutex_destroy(mutex) != 0)
+        return OMX_ErrorUndefined;
+
+    SEC_OSAL_Free(mutex);
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_MutexLock(OMX_HANDLETYPE mutexHandle)
+{
+    pthread_mutex_t *mutex = (pthread_mutex_t *)mutexHandle;
+    int result;
+
+    if (mutex == NULL)
+        return OMX_ErrorBadParameter;
+
+    if (pthread_mutex_lock(mutex) != 0)
+        return OMX_ErrorUndefined;
+
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_MutexUnlock(OMX_HANDLETYPE mutexHandle)
+{
+    pthread_mutex_t *mutex = (pthread_mutex_t *)mutexHandle;
+    int result;
+
+    if (mutex == NULL)
+        return OMX_ErrorBadParameter;
+
+    if (pthread_mutex_unlock(mutex) != 0)
+        return OMX_ErrorUndefined;
+
+    return OMX_ErrorNone;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Mutex.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Mutex.h
new file mode 100644
index 0000000..2dd63bc
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Mutex.h
@@ -0,0 +1,47 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Mutex.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+*/
+
+#ifndef SEC_OSAL_MUTEX
+#define SEC_OSAL_MUTEX
+
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OSAL_MutexCreate(OMX_HANDLETYPE *mutexHandle);
+OMX_ERRORTYPE SEC_OSAL_MutexTerminate(OMX_HANDLETYPE mutexHandle);
+OMX_ERRORTYPE SEC_OSAL_MutexLock(OMX_HANDLETYPE mutexHandle);
+OMX_ERRORTYPE SEC_OSAL_MutexUnlock(OMX_HANDLETYPE mutexHandle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Queue.c b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Queue.c
new file mode 100644
index 0000000..4ecd8dc
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Queue.c
@@ -0,0 +1,174 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Queue.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Mutex.h"
+#include "SEC_OSAL_Queue.h"
+
+
+OMX_ERRORTYPE SEC_OSAL_QueueCreate(SEC_QUEUE *queueHandle)
+{
+    int i = 0;
+    SEC_QElem *newqelem = NULL;
+    SEC_QElem *currentqelem = NULL;
+    SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    if (!queue)
+        return OMX_ErrorBadParameter;
+
+    ret = SEC_OSAL_MutexCreate(&queue->qMutex);
+    if (ret != OMX_ErrorNone)
+        return ret;
+
+    queue->first = (SEC_QElem *)SEC_OSAL_Malloc(sizeof(SEC_QElem));
+    if (queue->first == NULL)
+        return OMX_ErrorInsufficientResources;
+
+    SEC_OSAL_Memset(queue->first, 0, sizeof(SEC_QElem));
+    currentqelem = queue->last = queue->first;
+    queue->numElem = 0;
+
+    for (i = 0; i < (MAX_QUEUE_ELEMENTS - 2); i++) {
+        newqelem = (SEC_QElem *)SEC_OSAL_Malloc(sizeof(SEC_QElem));
+        if (newqelem == NULL) {
+            while (queue->first != NULL) {
+                currentqelem = queue->first->qNext;
+                SEC_OSAL_Free((OMX_PTR)queue->first);
+                queue->first = currentqelem;
+            }
+            return OMX_ErrorInsufficientResources;
+        } else {
+            SEC_OSAL_Memset(newqelem, 0, sizeof(SEC_QElem));
+            currentqelem->qNext = newqelem;
+            currentqelem = newqelem;
+        }
+    }
+
+    currentqelem->qNext = queue->first;
+
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_QueueTerminate(SEC_QUEUE *queueHandle)
+{
+    int i = 0;
+    SEC_QElem *currentqelem = NULL;
+    SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    if (!queue)
+        return OMX_ErrorBadParameter;
+
+    for ( i = 0; i < (MAX_QUEUE_ELEMENTS - 2); i++) {
+        currentqelem = queue->first->qNext;
+        SEC_OSAL_Free(queue->first);
+        queue->first = currentqelem;
+    }
+
+    if(queue->first) {
+        SEC_OSAL_Free(queue->first);
+        queue->first = NULL;
+    }
+
+    ret = SEC_OSAL_MutexTerminate(queue->qMutex);
+
+    return ret;
+}
+
+int SEC_OSAL_Queue(SEC_QUEUE *queueHandle, void *data)
+{
+    SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+    if (queue == NULL)
+        return -1;
+
+    SEC_OSAL_MutexLock(queue->qMutex);
+
+    if ((queue->last->data != NULL) || (queue->numElem >= MAX_QUEUE_ELEMENTS)) {
+        SEC_OSAL_MutexUnlock(queue->qMutex);
+        return -1;
+    }
+    queue->last->data = data;
+    queue->last = queue->last->qNext;
+    queue->numElem++;
+
+    SEC_OSAL_MutexUnlock(queue->qMutex);
+    return 0;
+}
+
+void *SEC_OSAL_Dequeue(SEC_QUEUE *queueHandle)
+{
+    void *data = NULL;
+    SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+    if (queue == NULL)
+        return NULL;
+
+    SEC_OSAL_MutexLock(queue->qMutex);
+
+    if ((queue->first->data == NULL) || (queue->numElem <= 0)) {
+        SEC_OSAL_MutexUnlock(queue->qMutex);
+        return NULL;
+    }
+    data = queue->first->data;
+    queue->first->data = NULL;
+    queue->first = queue->first->qNext;
+    queue->numElem--;
+
+    SEC_OSAL_MutexUnlock(queue->qMutex);
+    return data;
+}
+
+int SEC_OSAL_GetElemNum(SEC_QUEUE *queueHandle)
+{
+    int ElemNum = 0;
+    SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+    if (queue == NULL)
+        return -1;
+
+    SEC_OSAL_MutexLock(queue->qMutex);
+    ElemNum = queue->numElem;
+    SEC_OSAL_MutexUnlock(queue->qMutex);
+    return ElemNum;
+}
+
+int SEC_OSAL_SetElemNum(SEC_QUEUE *queueHandle, int ElemNum)
+{
+    SEC_QUEUE *queue = (SEC_QUEUE *)queueHandle;
+    if (queue == NULL)
+        return -1;
+
+    SEC_OSAL_MutexLock(queue->qMutex);
+    queue->numElem = ElemNum; 
+    SEC_OSAL_MutexUnlock(queue->qMutex);
+    return ElemNum;
+}
+
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Queue.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Queue.h
new file mode 100644
index 0000000..d1dee11
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Queue.h
@@ -0,0 +1,66 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file    SEC_OSAL_Queue.h
+ * @brief
+ * @author    SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version    1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_QUEUE
+#define SEC_OSAL_QUEUE
+
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#define MAX_QUEUE_ELEMENTS    10
+
+typedef struct _SEC_QElem
+{
+    void             *data;
+    struct _SEC_QElem *qNext;
+} SEC_QElem;
+
+typedef struct _SEC_QUEUE
+{
+    SEC_QElem     *first;
+    SEC_QElem     *last;
+    int            numElem;
+    OMX_HANDLETYPE qMutex;
+} SEC_QUEUE;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OSAL_QueueCreate(SEC_QUEUE *queueHandle);
+OMX_ERRORTYPE SEC_OSAL_QueueTerminate(SEC_QUEUE *queueHandle);
+int           SEC_OSAL_Queue(SEC_QUEUE *queueHandle, void *data);
+void         *SEC_OSAL_Dequeue(SEC_QUEUE *queueHandle);
+int           SEC_OSAL_GetElemNum(SEC_QUEUE *queueHandle);
+int           SEC_OSAL_SetElemNum(SEC_QUEUE *queueHandle, int ElemNum);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Semaphore.c b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Semaphore.c
new file mode 100644
index 0000000..be9b9cb
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Semaphore.c
@@ -0,0 +1,134 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Semaphore.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <semaphore.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Semaphore.h"
+
+#undef SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_LOG_SEMA"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+OMX_ERRORTYPE SEC_OSAL_SemaphoreCreate(OMX_HANDLETYPE *semaphoreHandle)
+{
+    sem_t *sema;
+
+    sema = (sem_t *)SEC_OSAL_Malloc(sizeof(sem_t));
+    if (!sema)
+        return OMX_ErrorInsufficientResources;
+
+    if (sem_init(sema, 0, 0) != 0) {
+        SEC_OSAL_Free(sema);
+        return OMX_ErrorUndefined;
+    }
+
+    *semaphoreHandle = (OMX_HANDLETYPE)sema;
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SemaphoreTerminate(OMX_HANDLETYPE semaphoreHandle)
+{
+    sem_t *sema = (sem_t *)semaphoreHandle;
+
+    if (sema == NULL)
+        return OMX_ErrorBadParameter;
+
+    if (sem_destroy(sema) != 0)
+        return OMX_ErrorUndefined;
+
+    SEC_OSAL_Free(sema);
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SemaphoreWait(OMX_HANDLETYPE semaphoreHandle)
+{
+    sem_t *sema = (sem_t *)semaphoreHandle;
+
+    FunctionIn();
+
+    if (sema == NULL)
+        return OMX_ErrorBadParameter;
+
+    if (sem_wait(sema) != 0)
+        return OMX_ErrorUndefined;
+
+    FunctionOut();
+
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_SemaphorePost(OMX_HANDLETYPE semaphoreHandle)
+{
+    sem_t *sema = (sem_t *)semaphoreHandle;
+
+    FunctionIn();
+
+    if (sema == NULL)
+        return OMX_ErrorBadParameter;
+
+    if (sem_post(sema) != 0)
+        return OMX_ErrorUndefined;
+
+    FunctionOut();
+
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_Set_SemaphoreCount(OMX_HANDLETYPE semaphoreHandle, OMX_S32 val)
+{
+    sem_t *sema = (sem_t *)semaphoreHandle;
+
+    if (sema == NULL)
+        return OMX_ErrorBadParameter;
+
+    if (sem_init(sema, 0, val) != 0)
+        return OMX_ErrorUndefined;
+
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE SEC_OSAL_Get_SemaphoreCount(OMX_HANDLETYPE semaphoreHandle, OMX_S32 *val)
+{
+    sem_t *sema = (sem_t *)semaphoreHandle;
+    int semaVal = 0;
+
+    if (sema == NULL)
+        return OMX_ErrorBadParameter;
+
+    if (sem_getvalue(sema, &semaVal) != 0)
+        return OMX_ErrorUndefined;
+
+    *val = (OMX_S32)semaVal;
+
+    return OMX_ErrorNone;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Semaphore.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Semaphore.h
new file mode 100644
index 0000000..431cba4
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Semaphore.h
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Semaphore.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_SEMAPHORE
+#define SEC_OSAL_SEMAPHORE
+
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OSAL_SemaphoreCreate(OMX_HANDLETYPE *semaphoreHandle);
+OMX_ERRORTYPE SEC_OSAL_SemaphoreTerminate(OMX_HANDLETYPE semaphoreHandle);
+OMX_ERRORTYPE SEC_OSAL_SemaphoreWait(OMX_HANDLETYPE semaphoreHandle);
+OMX_ERRORTYPE SEC_OSAL_SemaphorePost(OMX_HANDLETYPE semaphoreHandle);
+OMX_ERRORTYPE SEC_OSAL_Set_SemaphoreCount(OMX_HANDLETYPE semaphoreHandle, OMX_S32 val);
+OMX_ERRORTYPE SEC_OSAL_Get_SemaphoreCount(OMX_HANDLETYPE semaphoreHandle, OMX_S32 *val);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Thread.c b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Thread.c
new file mode 100644
index 0000000..730b4a9
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Thread.c
@@ -0,0 +1,158 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Thread.c
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <errno.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "SEC_OSAL_Memory.h"
+#include "SEC_OSAL_Thread.h"
+
+#undef SEC_LOG_TAG
+#define SEC_LOG_TAG    "SEC_LOG_THREAD"
+#define SEC_LOG_OFF
+#include "SEC_OSAL_Log.h"
+
+
+typedef struct _SEC_THREAD_HANDLE_TYPE
+{
+    pthread_t          pthread;
+    pthread_attr_t     attr;
+    struct sched_param schedparam;
+    int                stack_size;
+} SEC_THREAD_HANDLE_TYPE;
+
+
+OMX_ERRORTYPE SEC_OSAL_ThreadCreate(OMX_HANDLETYPE *threadHandle, OMX_PTR function_name, OMX_PTR argument)
+{
+    FunctionIn();
+
+    int result = 0;
+    int detach_ret = 0;
+    SEC_THREAD_HANDLE_TYPE *thread;
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+
+    thread = SEC_OSAL_Malloc(sizeof(SEC_THREAD_HANDLE_TYPE));
+    SEC_OSAL_Memset(thread, 0, sizeof(SEC_THREAD_HANDLE_TYPE));
+
+    pthread_attr_init(&thread->attr);
+    if (thread->stack_size != 0)
+        pthread_attr_setstacksize(&thread->attr, thread->stack_size);
+
+    /* set priority */
+    if (thread->schedparam.sched_priority != 0)
+        pthread_attr_setschedparam(&thread->attr, &thread->schedparam);
+
+    detach_ret = pthread_attr_setdetachstate(&thread->attr, PTHREAD_CREATE_JOINABLE);
+    if (detach_ret != 0) {
+        SEC_OSAL_Free(thread);
+        *threadHandle = NULL;
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    result = pthread_create(&thread->pthread, &thread->attr, function_name, (void *)argument);
+    /* pthread_setschedparam(thread->pthread, SCHED_RR, &thread->schedparam); */
+
+    switch (result) {
+    case 0:
+        *threadHandle = (OMX_HANDLETYPE)thread;
+        ret = OMX_ErrorNone;
+        break;
+    case EAGAIN:
+        SEC_OSAL_Free(thread);
+        *threadHandle = NULL;
+        ret = OMX_ErrorInsufficientResources;
+        break;
+    default:
+        SEC_OSAL_Free(thread);
+        *threadHandle = NULL;
+        ret = OMX_ErrorUndefined;
+        break;
+    }
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_ThreadTerminate(OMX_HANDLETYPE threadHandle)
+{
+    FunctionIn();
+
+    OMX_ERRORTYPE ret = OMX_ErrorNone;
+    SEC_THREAD_HANDLE_TYPE *thread = (SEC_THREAD_HANDLE_TYPE *)threadHandle;
+
+    if (!thread) {
+        ret = OMX_ErrorBadParameter;
+        goto EXIT;
+    }
+    if (pthread_join(thread->pthread, NULL) != 0) {
+        ret = OMX_ErrorUndefined;
+        goto EXIT;
+    }
+
+    SEC_OSAL_Free(thread);
+    ret = OMX_ErrorNone;
+
+EXIT:
+    FunctionOut();
+
+    return ret;
+}
+
+OMX_ERRORTYPE SEC_OSAL_ThreadCancel(OMX_HANDLETYPE threadHandle)
+{
+    SEC_THREAD_HANDLE_TYPE *thread = (SEC_THREAD_HANDLE_TYPE *)threadHandle;
+
+    if (!thread)
+        return OMX_ErrorBadParameter;
+
+    /* thread_cancel(thread->pthread); */
+    pthread_exit(&thread->pthread);
+    pthread_join(thread->pthread, NULL);
+
+    SEC_OSAL_Free(thread);
+    return OMX_ErrorNone;
+}
+
+void SEC_OSAL_ThreadExit(void *value_ptr)
+{
+    pthread_exit(value_ptr);
+    return;
+}
+
+void SEC_OSAL_SleepMillisec(OMX_U32 ms)
+{
+    usleep(ms * 1000);
+    return;
+}
diff --git a/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Thread.h b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Thread.h
new file mode 100644
index 0000000..ce1262d
--- /dev/null
+++ b/exynos4/multimedia/openmax/sec_omx/osal/SEC_OSAL_Thread.h
@@ -0,0 +1,48 @@
+/*
+ *
+ * Copyright 2010 Samsung Electronics S.LSI Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file        SEC_OSAL_Thread.h
+ * @brief
+ * @author      SeungBeom Kim (sbcrux.kim@samsung.com)
+ * @version     1.1.0
+ * @history
+ *   2010.7.15 : Create
+ */
+
+#ifndef SEC_OSAL_THREAD
+#define SEC_OSAL_THREAD
+
+#include "OMX_Types.h"
+#include "OMX_Core.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+OMX_ERRORTYPE SEC_OSAL_ThreadCreate(OMX_HANDLETYPE *threadHandle, OMX_PTR function_name, OMX_PTR argument);
+OMX_ERRORTYPE SEC_OSAL_ThreadTerminate(OMX_HANDLETYPE threadHandle);
+OMX_ERRORTYPE SEC_OSAL_ThreadCancel(OMX_HANDLETYPE threadHandle);
+void          SEC_OSAL_ThreadExit(void *value_ptr);
+void          SEC_OSAL_SleepMillisec(OMX_U32 ms);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif