summaryrefslogtreecommitdiff
path: root/mm-video-v4l2
diff options
context:
space:
mode:
authorCong Jiajia <jcong@codeaurora.org>2017-09-25 13:47:50 +0800
committerCong Jiajia <jcong@codeaurora.org>2017-09-26 16:20:24 +0800
commitfff55246caa9c7b7e0371240842aadacad69157a (patch)
treef5a8047f8bf7a35c5f5c804407115a3f631858b1 /mm-video-v4l2
parent233d9ad6668509b210b3f9f3ac9ff21eea41b69c (diff)
downloadmedia-fff55246caa9c7b7e0371240842aadacad69157a.tar.gz
mm-video-v4l2: venc: return correct supported color formats
add new api dev_get_supported_color_format() and implement them in individual s/w and h/w components Change-Id: I4adf86bcc774e7881b068860154a4046d3b057b7
Diffstat (limited to 'mm-video-v4l2')
-rw-r--r--mm-video-v4l2/vidc/venc/inc/omx_swvenc_mpeg4.h1
-rw-r--r--mm-video-v4l2/vidc/venc/inc/omx_video_base.h1
-rw-r--r--mm-video-v4l2/vidc/venc/inc/omx_video_encoder.h3
-rwxr-xr-xmm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h1
-rw-r--r--mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp19
-rw-r--r--mm-video-v4l2/vidc/venc/src/omx_video_base.cpp43
-rw-r--r--mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp4
-rw-r--r--mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp40
8 files changed, 73 insertions, 39 deletions
diff --git a/mm-video-v4l2/vidc/venc/inc/omx_swvenc_mpeg4.h b/mm-video-v4l2/vidc/venc/inc/omx_swvenc_mpeg4.h
index 260419b0..2a215c2b 100644
--- a/mm-video-v4l2/vidc/venc/inc/omx_swvenc_mpeg4.h
+++ b/mm-video-v4l2/vidc/venc/inc/omx_swvenc_mpeg4.h
@@ -143,6 +143,7 @@ class omx_venc: public omx_video
return false;
}
OMX_ERRORTYPE dev_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILELEVELTYPE */*profileLevelType*/);
+ bool dev_get_supported_color_format(unsigned index, OMX_U32 *colorFormat);
bool dev_is_video_session_supported(OMX_U32 width, OMX_U32 height);
bool dev_color_align(OMX_BUFFERHEADERTYPE *buffer, OMX_U32 width,
OMX_U32 height);
diff --git a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
index 5bc226f4..6f1b45b9 100644
--- a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
+++ b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
@@ -298,6 +298,7 @@ class omx_video: public qc_omx_component
virtual bool dev_get_temporal_layer_caps(OMX_U32 * /*nMaxLayers*/,
OMX_U32 * /*nMaxBLayers*/, OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE */*SupportedPattern*/) = 0;
virtual OMX_ERRORTYPE dev_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILELEVELTYPE *) = 0;
+ virtual bool dev_get_supported_color_format(unsigned index, OMX_U32 *colorFormat) = 0;
#ifdef _ANDROID_ICS_
void omx_release_meta_buffer(OMX_BUFFERHEADERTYPE *buffer);
#endif
diff --git a/mm-video-v4l2/vidc/venc/inc/omx_video_encoder.h b/mm-video-v4l2/vidc/venc/inc/omx_video_encoder.h
index 746523ef..aafb77e3 100644
--- a/mm-video-v4l2/vidc/venc/inc/omx_video_encoder.h
+++ b/mm-video-v4l2/vidc/venc/inc/omx_video_encoder.h
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010-2015, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -87,6 +87,7 @@ class omx_venc: public omx_video
bool dev_get_temporal_layer_caps(OMX_U32 * /*nMaxLayers*/,
OMX_U32 * /*nMaxBLayers*/, OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE */*SupportedPattern*/);
OMX_ERRORTYPE dev_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILELEVELTYPE *);
+ bool dev_get_supported_color_format(unsigned index, OMX_U32 *colorFormat);
bool dev_is_video_session_supported(OMX_U32 width, OMX_U32 height);
bool dev_color_align(OMX_BUFFERHEADERTYPE *buffer, OMX_U32 width,
OMX_U32 height);
diff --git a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
index b161037b..9aa29861 100755
--- a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
+++ b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
@@ -337,6 +337,7 @@ class venc_dev
bool venc_get_temporal_layer_caps(OMX_U32 * /*nMaxLayers*/,
OMX_U32 * /*nMaxBLayers*/, OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE */*SupportedPattern*/);
OMX_ERRORTYPE venc_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevelType);
+ bool venc_get_supported_color_format(unsigned index, OMX_U32 *colorFormat);
bool venc_check_for_hybrid_hp(OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern);
bool venc_check_for_hierp(OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern);
int venc_find_hier_type(OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE &temporalSettings);
diff --git a/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp b/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp
index b9febfa6..ede520ef 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp
@@ -2117,6 +2117,25 @@ OMX_ERRORTYPE omx_venc::dev_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILEL
return eRet;
}
+bool omx_venc::dev_get_supported_color_format(unsigned index, OMX_U32 *colorFormat) {
+ // we support two formats
+ // index 0 - Venus flavour of YUV420SP
+ // index 1 - opaque which internally maps to YUV420SP
+ // index 2 - vannilla YUV420SP
+ // this can be extended in the future
+ int supportedFormats[] = {
+ [0] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
+ [1] = QOMX_COLOR_FormatYVU420SemiPlanar,
+ [2] = QOMX_COLOR_FormatAndroidOpaque,
+ [3] = OMX_COLOR_FormatYUV420SemiPlanar,
+ };
+
+ if (index > (sizeof(supportedFormats)/sizeof(*supportedFormats) - 1))
+ return false;
+ *colorFormat = supportedFormats[index];
+ return true;
+}
+
bool omx_venc::dev_loaded_start()
{
ENTER_FUNC();
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
index 384e353a..873a4357 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -1611,46 +1611,13 @@ OMX_ERRORTYPE omx_video::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
if (portFmt->nPortIndex == (OMX_U32) PORT_INDEX_IN) {
unsigned index = portFmt->nIndex;
-
-#ifdef _UBWC_
- //we support following formats
- //index 0 - Compressed (UBWC) Venus flavour of YUV420SP
- //index 1 - Venus flavour of YUV420SP
- //index 2 - Compressed (UBWC) TP10 (10bit packed)
- //index 3 - Compressed (UBWC) Venus flavour of RGBA8888
- //index 4 - Venus flavour of RGBA8888
- //index 5 - opaque which internally maps to YUV420SP.
- //index 6 - vannilla YUV420SP
- //this can be extended in the future
- int supportedFormats[] = {
- [0] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed,
- [1] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
- [2] = QOMX_COLOR_FormatYVU420SemiPlanar,
- [3] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m10bitCompressed,
- [4] = QOMX_COLOR_Format32bitRGBA8888Compressed,
- [5] = QOMX_COLOR_Format32bitRGBA8888,
- [6] = QOMX_COLOR_FormatAndroidOpaque,
- [7] = OMX_COLOR_FormatYUV420SemiPlanar,
- };
-#else
- //we support two formats
- //index 0 - Venus flavour of YUV420SP
- //index 1 - opaque which internally maps to YUV420SP.
- //index 2 - vannilla YUV420SP
- //this can be extended in the future
- int supportedFormats[] = {
- [0] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
- [1] = QOMX_COLOR_FormatYVU420SemiPlanar,
- [2] = QOMX_COLOR_FormatAndroidOpaque,
- [3] = OMX_COLOR_FormatYUV420SemiPlanar,
- };
-#endif
- if (index > (sizeof(supportedFormats)/sizeof(*supportedFormats) - 1))
- eRet = OMX_ErrorNoMore;
- else {
+ OMX_U32 colorFormat = OMX_COLOR_FormatUnused;
+ if(dev_get_supported_color_format(index, &colorFormat)) {
memcpy(portFmt, &m_sInPortFormat, sizeof(m_sInPortFormat));
portFmt->nIndex = index; //restore index set from client
- portFmt->eColorFormat = (OMX_COLOR_FORMATTYPE)supportedFormats[index];
+ portFmt->eColorFormat = (OMX_COLOR_FORMATTYPE)colorFormat;
+ } else {
+ eRet = OMX_ErrorNoMore;
}
} else if (portFmt->nPortIndex == (OMX_U32) PORT_INDEX_OUT) {
memcpy(portFmt, &m_sOutPortFormat, sizeof(m_sOutPortFormat));
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
index d0ac14ab..a92a8d19 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -2236,6 +2236,10 @@ OMX_ERRORTYPE omx_venc::dev_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILEL
return handle->venc_get_supported_profile_level(profileLevelType);
}
+bool omx_venc::dev_get_supported_color_format(unsigned index, OMX_U32 *colorFormat) {
+ return handle->venc_get_supported_color_format(index, colorFormat);
+}
+
bool omx_venc::dev_loaded_start()
{
return handle->venc_loaded_start();
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index 3dfd26b3..45dc253e 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -1030,6 +1030,46 @@ OMX_ERRORTYPE venc_dev::venc_get_supported_profile_level(OMX_VIDEO_PARAM_PROFILE
return eRet;
}
+bool venc_dev::venc_get_supported_color_format(unsigned index, OMX_U32 *colorFormat) {
+#ifdef _UBWC_
+ //we support following formats
+ //index 0 - Compressed (UBWC) Venus flavour of YUV420SP
+ //index 1 - Venus flavour of YUV420SP
+ //index 2 - Compressed (UBWC) TP10 (10bit packed)
+ //index 3 - Compressed (UBWC) Venus flavour of RGBA8888
+ //index 4 - Venus flavour of RGBA8888
+ //index 5 - opaque which internally maps to YUV420SP.
+ //index 6 - vannilla YUV420SP
+ //this can be extended in the future
+ int supportedFormats[] = {
+ [0] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed,
+ [1] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
+ [2] = QOMX_COLOR_FormatYVU420SemiPlanar,
+ [3] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m10bitCompressed,
+ [4] = QOMX_COLOR_Format32bitRGBA8888Compressed,
+ [5] = QOMX_COLOR_Format32bitRGBA8888,
+ [6] = QOMX_COLOR_FormatAndroidOpaque,
+ [7] = OMX_COLOR_FormatYUV420SemiPlanar,
+ };
+#else
+ //we support two formats
+ //index 0 - Venus flavour of YUV420SP
+ //index 1 - opaque which internally maps to YUV420SP.
+ //index 2 - vannilla YUV420SP
+ //this can be extended in the future
+ int supportedFormats[] = {
+ [0] = QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m,
+ [1] = QOMX_COLOR_FormatYVU420SemiPlanar,
+ [2] = QOMX_COLOR_FormatAndroidOpaque,
+ [3] = OMX_COLOR_FormatYUV420SemiPlanar,
+ }
+#endif
+ if (index > (sizeof(supportedFormats)/sizeof(*supportedFormats) - 1))
+ return false;
+ *colorFormat = supportedFormats[index];
+ return true;
+}
+
OMX_ERRORTYPE venc_dev::allocate_extradata(struct extradata_buffer_info *extradata_info, int flags)
{
if (extradata_info->allocated) {