summaryrefslogtreecommitdiff
path: root/mm-video-v4l2/vidc/common/inc
diff options
context:
space:
mode:
authorVaibhav Deshu Venkatesh <vdeshuve@codeaurora.org>2017-07-27 18:19:13 -0700
committerVaibhav Deshu Venkatesh <vdeshuve@codeaurora.org>2017-08-18 12:11:40 -0700
commitff86043037b4b58b16f3515a1536e3289a4709dd (patch)
tree0a7a63150a336c22363a02ef3754953c42cb15e2 /mm-video-v4l2/vidc/common/inc
parentde6a3125066053967d448ad73ca95d4b9fe957fb (diff)
downloadmedia-ff86043037b4b58b16f3515a1536e3289a4709dd.tar.gz
mm-video-v4l2: Publish supported profile/level correctly
Get supported profile/level from driver and publish them correctly to client from OMX. CRs-Fixed: 2054346 Change-Id: I56c8d1631445e02dd0330d664802d044cce4a26e
Diffstat (limited to 'mm-video-v4l2/vidc/common/inc')
-rw-r--r--mm-video-v4l2/vidc/common/inc/vidc_common.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/mm-video-v4l2/vidc/common/inc/vidc_common.h b/mm-video-v4l2/vidc/common/inc/vidc_common.h
new file mode 100644
index 00000000..012b246d
--- /dev/null
+++ b/mm-video-v4l2/vidc/common/inc/vidc_common.h
@@ -0,0 +1,66 @@
+/*--------------------------------------------------------------------------
+Copyright (c) 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
+met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+--------------------------------------------------------------------------*/
+#include <unordered_map>
+
+using pl_map = std::unordered_map<int, int>;
+using codec_map = std::unordered_map<int, pl_map *>;
+
+class profile_level_converter {
+ static pl_map profile_avc_omx_to_v4l2;
+ static pl_map profile_hevc_omx_to_v4l2;
+ static pl_map profile_mpeg2_omx_to_v4l2;
+ static pl_map level_avc_omx_to_v4l2;
+ static pl_map level_hevc_omx_to_v4l2;
+ static pl_map level_vp8_omx_to_v4l2;
+ static pl_map level_mpeg2_omx_to_v4l2;
+ static pl_map profile_avc_v4l2_to_omx;
+ static pl_map profile_hevc_v4l2_to_omx;
+ static pl_map profile_mpeg2_v4l2_to_omx;
+ static pl_map level_avc_v4l2_to_omx;
+ static pl_map level_hevc_v4l2_to_omx;
+ static pl_map level_vp8_v4l2_to_omx;
+ static pl_map level_mpeg2_v4l2_to_omx;
+
+ static codec_map profile_omx_to_v4l2_map;
+ static codec_map profile_v4l2_to_omx_map;
+ static codec_map level_omx_to_v4l2_map;
+ static codec_map level_v4l2_to_omx_map;
+
+ //Constructor that initializes and performs the mapping
+ profile_level_converter() = delete;
+ static bool find_item(pl_map *map, int key, int *value);
+ static bool find_map(codec_map map, int key, pl_map **value_map);
+
+ public:
+ static void init();
+ static bool convert_v4l2_profile_to_omx(int codec, int v4l2_profile, int *omx_profile);
+ static bool convert_omx_profile_to_v4l2(int codec, int omx_profile, int *v4l2_profile);
+ static bool convert_v4l2_level_to_omx(int codec, int v4l2_level, int *omx_level);
+ static bool convert_omx_level_to_v4l2(int codec, int omx_level, int *v4l2_level);
+};