• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Shenzhen Kaihong DID Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "codec_utils.h"
17 #include "hdf_log.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif /* __cplusplus */
22 
23 #define HDF_LOG_TAG "codec_config_common"
24 
PrintArray(const char * where,const char * name,ResizableArray * array)25 void PrintArray(const char *where, const char *name, ResizableArray *array)
26 {
27     uint32_t index;
28 
29     if (array == NULL) {
30         return;
31     }
32     HDF_LOGI("%{public}s, %{public}s len: %{public}d", where, name, (int32_t)array->actualLen);
33     for (index = 0; index < array->actualLen; index++) {
34         HDF_LOGI("%{public}s, %{public}s-%{public}d: %{public}d",
35             where, name, index, (int32_t)array->element[index]);
36     }
37 }
38 
PrintCapability(const char * where,CodecCapbility * cap)39 void PrintCapability(const char *where, CodecCapbility *cap)
40 {
41     int32_t mime = 0;
42     if (cap == NULL) {
43         HDF_LOGE("%{public}s, null capability!", where);
44         return;
45     }
46     mime = (int32_t)cap->mime;
47     if (mime < 0) {
48         HDF_LOGE("%{public}s, print invalid capability!", where);
49         return;
50     }
51 
52     HDF_LOGI("%{public}s, --- start print cap ----------------------------", where);
53     HDF_LOGI("%{public}s, mime: %{public}d", where, (int32_t)cap->mime);
54     HDF_LOGI("%{public}s, type: %{public}d", where, (int32_t)cap->type);
55     HDF_LOGI("%{public}s, widthAlginment: %{public}d", where, (int32_t)cap->whAlignment.widthAlginment);
56     HDF_LOGI("%{public}s, heightAlginment: %{public}d", where, (int32_t)cap->whAlignment.heightAlginment);
57     HDF_LOGI("%{public}s, minwidth: %{public}d", where, (int32_t)cap->minSize.width);
58     HDF_LOGI("%{public}s, minHeight: %{public}d", where, (int32_t)cap->minSize.height);
59     HDF_LOGI("%{public}s, maxwidth: %{public}d", where, (int32_t)cap->maxSize.width);
60     HDF_LOGI("%{public}s, maxheight: %{public}d", where, (int32_t)cap->maxSize.height);
61     HDF_LOGI("%{public}s, minBitRate: %{public}d", where, (int32_t)cap->minBitRate);
62     HDF_LOGI("%{public}s, maxBitRate: %{public}d", where, (int32_t)cap->maxBitRate);
63     PrintArray(where, "supportProfiles", &(cap->supportProfiles));
64     PrintArray(where, "supportLevels", &(cap->supportLevels));
65     PrintArray(where, "supportPixelFormats", &(cap->supportPixelFormats));
66     HDF_LOGI("%{public}s, minInputBufferNum: %{public}d", where, (int32_t)cap->minInputBufferNum);
67     HDF_LOGI("%{public}s, minOutputBufferNum: %{public}d", where, (int32_t)cap->minOutputBufferNum);
68     HDF_LOGI("%{public}s, allocateMask: %{public}d", where, (int32_t)cap->allocateMask);
69     HDF_LOGI("%{public}s, capsMask: %{public}d", where, (int32_t)cap->capsMask);
70     HDF_LOGI("%{public}s, ------------------------------ end print cap ---", where);
71 }
72 
73 #ifdef __cplusplus
74 }
75 #endif /* __cplusplus */
76