93ef5d20841585745f9e25889102cfa043f5fcac
[platform/core/multimedia/mm-resource-manager.git] / src / common / mm_resource_manager_utils.c
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18
19 #include "common/mm_resource_manager_utils.h"
20
21
22
23 static const char* mm_resource_manager_res_str[MM_RESOURCE_MANAGER_RES_TYPE_MAX] = {
24         "video_decoder",
25         "video_overlay",
26         "camera",
27         "video_encoder",
28         "radio",
29         "audio_offload"
30 };
31
32 static const char* mm_resource_manager_app_class_str[MM_RESOURCE_MANAGER_APP_CLASS_MAX] = {
33         "media",
34         "interrupt"
35 };
36
37 static const char* mm_resource_manager_condition_str[MM_RESOURCE_MANAGER_RES_TYPE_COND_MAX] = {
38         "SD",
39         "HD",
40         "FHD",
41         "UHD"
42 };
43
44
45 const char* _mm_resource_manager_get_res_str(mm_resource_manager_res_type_e type)
46 {
47         MM_RM_RETVM_IF(type < 0 || type >= MM_RESOURCE_MANAGER_RES_TYPE_MAX, "",
48                         "Type is out of range");
49         return mm_resource_manager_res_str[type];
50 }
51
52 const char* _mm_resource_manager_get_app_class_str(mm_resource_manager_app_class_e cls)
53 {
54         MM_RM_RETVM_IF(cls < 0 || cls >= MM_RESOURCE_MANAGER_APP_CLASS_MAX, "",
55                         "App class is out of range");
56         return mm_resource_manager_app_class_str[cls];
57 }
58
59 const char* _mm_resource_manager_get_condition_str(mm_resource_manager_res_type_cond_e cond)
60 {
61         MM_RM_RETVM_IF(cond < 0 || cond >= MM_RESOURCE_MANAGER_RES_TYPE_COND_MAX, "",
62                         "Resource type condition is out of range");
63         return mm_resource_manager_condition_str[cond];
64 }
65
66 uint64_t _mm_rm_hash64(uint64_t id)
67 {
68         MM_RM_HASH64(id);
69         return id;
70 }