|
| 1 | +/***************************************************************************** |
| 2 | + * ijksoundtouch_log.h |
| 3 | + ***************************************************************************** |
| 4 | + * |
| 5 | + * Copyright (c) 2017 Bilibili |
| 6 | + * copyright (c) 2017 Raymond Zheng <raymondzheng1412@gmail.com> |
| 7 | + * |
| 8 | + * This file is part of ijkPlayer. |
| 9 | + * |
| 10 | + * ijkPlayer is free software; you can redistribute it and/or |
| 11 | + * modify it under the terms of the GNU Lesser General Public |
| 12 | + * License as published by the Free Software Foundation; either |
| 13 | + * version 2.1 of the License, or (at your option) any later version. |
| 14 | + * |
| 15 | + * ijkPlayer is distributed in the hope that it will be useful, |
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | + * Lesser General Public License for more details. |
| 19 | + * |
| 20 | + * You should have received a copy of the GNU Lesser General Public |
| 21 | + * License along with ijkPlayer; if not, write to the Free Software |
| 22 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 23 | + */ |
| 24 | + |
| 25 | +#ifndef IJKSDL__IJKSOUNDTOUCH_LOG_H |
| 26 | +#define IJKSDL__IJKSOUNDTOUCH_LOG_H |
| 27 | + |
| 28 | +#include <stdio.h> |
| 29 | + |
| 30 | +#ifdef __ANDROID__ |
| 31 | + |
| 32 | +#include <android/log.h> |
| 33 | + |
| 34 | +#define IJK_LOG_UNKNOWN ANDROID_LOG_UNKNOWN |
| 35 | +#define IJK_LOG_DEFAULT ANDROID_LOG_DEFAULT |
| 36 | + |
| 37 | +#define IJK_LOG_VERBOSE ANDROID_LOG_VERBOSE |
| 38 | +#define IJK_LOG_DEBUG ANDROID_LOG_DEBUG |
| 39 | +#define IJK_LOG_INFO ANDROID_LOG_INFO |
| 40 | +#define IJK_LOG_WARN ANDROID_LOG_WARN |
| 41 | +#define IJK_LOG_ERROR ANDROID_LOG_ERROR |
| 42 | +#define IJK_LOG_FATAL ANDROID_LOG_FATAL |
| 43 | +#define IJK_LOG_SILENT ANDROID_LOG_SILENT |
| 44 | + |
| 45 | +#define VLOG(level, TAG, ...) ((void)__android_log_vprint(level, TAG, __VA_ARGS__)) |
| 46 | +#define ALOG(level, TAG, ...) ((void)__android_log_print(level, TAG, __VA_ARGS__)) |
| 47 | + |
| 48 | +#else |
| 49 | + |
| 50 | +#define IJK_LOG_UNKNOWN 0 |
| 51 | +#define IJK_LOG_DEFAULT 1 |
| 52 | + |
| 53 | +#define IJK_LOG_VERBOSE 2 |
| 54 | +#define IJK_LOG_DEBUG 3 |
| 55 | +#define IJK_LOG_INFO 4 |
| 56 | +#define IJK_LOG_WARN 5 |
| 57 | +#define IJK_LOG_ERROR 6 |
| 58 | +#define IJK_LOG_FATAL 7 |
| 59 | +#define IJK_LOG_SILENT 8 |
| 60 | + |
| 61 | +#define VLOG(level, TAG, ...) ((void)vprintf(__VA_ARGS__)) |
| 62 | +#define ALOG(level, TAG, ...) ((void)printf(__VA_ARGS__)) |
| 63 | + |
| 64 | +#endif |
| 65 | + |
| 66 | +#define IJK_LOG_TAG "IJKMEDIA" |
| 67 | + |
| 68 | +#define VLOGV(...) VLOG(IJK_LOG_VERBOSE, IJK_LOG_TAG, __VA_ARGS__) |
| 69 | +#define VLOGD(...) VLOG(IJK_LOG_DEBUG, IJK_LOG_TAG, __VA_ARGS__) |
| 70 | +#define VLOGI(...) VLOG(IJK_LOG_INFO, IJK_LOG_TAG, __VA_ARGS__) |
| 71 | +#define VLOGW(...) VLOG(IJK_LOG_WARN, IJK_LOG_TAG, __VA_ARGS__) |
| 72 | +#define VLOGE(...) VLOG(IJK_LOG_ERROR, IJK_LOG_TAG, __VA_ARGS__) |
| 73 | + |
| 74 | +#define ALOGV(...) ALOG(IJK_LOG_VERBOSE, IJK_LOG_TAG, __VA_ARGS__) |
| 75 | +#define ALOGD(...) ALOG(IJK_LOG_DEBUG, IJK_LOG_TAG, __VA_ARGS__) |
| 76 | +#define ALOGI(...) ALOG(IJK_LOG_INFO, IJK_LOG_TAG, __VA_ARGS__) |
| 77 | +#define ALOGW(...) ALOG(IJK_LOG_WARN, IJK_LOG_TAG, __VA_ARGS__) |
| 78 | +#define ALOGE(...) ALOG(IJK_LOG_ERROR, IJK_LOG_TAG, __VA_ARGS__) |
| 79 | +#define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0) |
| 80 | + |
| 81 | +#endif |
0 commit comments