1 /* 2 * Copyright (C) 2023 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 #ifndef AVCODEC_SAMPLE_LOG_H 17 #define AVCODEC_SAMPLE_LOG_H 18 19 #include "avcodec_log.h" 20 21 namespace OHOS { 22 namespace MediaAVCodec { 23 namespace Sample { 24 extern const bool VERBOSE_LOG; 25 26 #define AVCODEC_LOGV(fmt, ...) \ 27 if (VERBOSE_LOG) { \ 28 AVCODEC_LOGI(fmt, ##__VA_ARGS__); \ 29 } 30 31 #define CHECK_AND_CONTINUE(cond) \ 32 if (1) { \ 33 if (!(cond)) { \ 34 continue; \ 35 } \ 36 } else void (0) 37 38 #define CHECK_AND_BREAK(cond) \ 39 if (1) { \ 40 if (!(cond)) { \ 41 break; \ 42 } \ 43 } else void (0) 44 45 #define CHECK_AND_RETURN(cond) \ 46 if (1) { \ 47 if (!(cond)) { \ 48 return; \ 49 } \ 50 } else void (0) 51 52 #define CHECK_AND_RETURN_RET(cond, ret) \ 53 if (1) { \ 54 if (!(cond)) { \ 55 return ret; \ 56 } \ 57 } else void (0) 58 } // Sample 59 } // MediaAVCodec 60 } // OHOS 61 #endif // AVCODEC_SAMPLE_LOG_H