1 /* 2 * Copyright (C) 2024 Huawei Device 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 "heif_utils.h" 17 18 namespace OHOS { 19 namespace ImagePlugin { code_to_fourcc(uint32_t code)20std::string code_to_fourcc(uint32_t code) 21 { 22 std::string fourcc = " "; 23 fourcc[BUFFER_INDEX_ZERO] = static_cast<char>((code >> THREE_BYTES_SHIFT) & 0xFF); 24 fourcc[BUFFER_INDEX_ONE] = static_cast<char>((code >> TWO_BYTES_SHIFT) & 0xFF); 25 fourcc[BUFFER_INDEX_TWO] = static_cast<char>((code >> ONE_BYTE_SHIFT) & 0xFF); 26 fourcc[BUFFER_INDEX_THREE] = static_cast<char>(code & 0xFF); 27 return fourcc; 28 } 29 } // namespace ImagePlugin 30 } // namespace OHOS 31