/*-------------------------------------------------------------------------- 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 using pl_map = std::unordered_map; using codec_map = std::unordered_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 profile_vp9_omx_to_v4l2; static pl_map profile_tme_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 level_vp9_omx_to_v4l2; static pl_map level_tme_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 profile_vp9_v4l2_to_omx; static pl_map profile_tme_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 pl_map level_vp9_v4l2_to_omx; static pl_map level_tme_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(const pl_map &map, int key, int *value); static bool find_map(const 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); };