diff --git a/inc/mpp_log.h b/inc/mpp_log.h new file mode 100644 index 00000000..2b38eab2 --- /dev/null +++ b/inc/mpp_log.h @@ -0,0 +1,99 @@ +/* + * Copyright 2022 Rockchip Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __MPP_LOG_H__ +#define __MPP_LOG_H__ + +#include "rk_type.h" +#include "mpp_log_def.h" + +/* + * _c function will add condition check + * _f function will add function name to the log + * _cf function will add both function name and condition check + */ + +/* + * mpp runtime log system usage: + * mpp_logf is for fatal logging. For use when aborting + * mpp_loge is for error logging. For use with unrecoverable failures. + * mpp_logw is for warning logging. For use with recoverable failures. + * mpp_logi is for informational logging. + * mpp_logd is for debug logging. + * mpp_logv is for verbose logging + */ + +#define mpp_logf(fmt, ...) _mpp_log_l(MPP_LOG_FATAL, MODULE_TAG, fmt, NULL, ## __VA_ARGS__) +#define mpp_loge(fmt, ...) _mpp_log_l(MPP_LOG_ERROR, MODULE_TAG, fmt, NULL, ## __VA_ARGS__) +#define mpp_logw(fmt, ...) _mpp_log_l(MPP_LOG_WARN, MODULE_TAG, fmt, NULL, ## __VA_ARGS__) +#define mpp_logi(fmt, ...) _mpp_log_l(MPP_LOG_INFO, MODULE_TAG, fmt, NULL, ## __VA_ARGS__) +#define mpp_logd(fmt, ...) _mpp_log_l(MPP_LOG_DEBUG, MODULE_TAG, fmt, NULL, ## __VA_ARGS__) +#define mpp_logv(fmt, ...) _mpp_log_l(MPP_LOG_VERBOSE, MODULE_TAG, fmt, NULL, ## __VA_ARGS__) + +#define mpp_logf_f(fmt, ...) _mpp_log_l(MPP_LOG_FATAL, MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) +#define mpp_loge_f(fmt, ...) _mpp_log_l(MPP_LOG_ERROR, MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) +#define mpp_logw_f(fmt, ...) _mpp_log_l(MPP_LOG_WARN, MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) +#define mpp_logi_f(fmt, ...) _mpp_log_l(MPP_LOG_INFO, MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) +#define mpp_logd_f(fmt, ...) _mpp_log_l(MPP_LOG_DEBUG, MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) +#define mpp_logv_f(fmt, ...) _mpp_log_l(MPP_LOG_VERBOSE, MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) + +#define mpp_logf_c(cond, fmt, ...) do { if (cond) mpp_logf(fmt, ## __VA_ARGS__); } while (0) +#define mpp_loge_c(cond, fmt, ...) do { if (cond) mpp_loge(fmt, ## __VA_ARGS__); } while (0) +#define mpp_logw_c(cond, fmt, ...) do { if (cond) mpp_logw(fmt, ## __VA_ARGS__); } while (0) +#define mpp_logi_c(cond, fmt, ...) do { if (cond) mpp_logi(fmt, ## __VA_ARGS__); } while (0) +#define mpp_logd_c(cond, fmt, ...) do { if (cond) mpp_logd(fmt, ## __VA_ARGS__); } while (0) +#define mpp_logv_c(cond, fmt, ...) do { if (cond) mpp_logv(fmt, ## __VA_ARGS__); } while (0) + +#define mpp_logf_cf(cond, fmt, ...) do { if (cond) mpp_logf_f(fmt, ## __VA_ARGS__); } while (0) +#define mpp_loge_cf(cond, fmt, ...) do { if (cond) mpp_loge_f(fmt, ## __VA_ARGS__); } while (0) +#define mpp_logw_cf(cond, fmt, ...) do { if (cond) mpp_logw_f(fmt, ## __VA_ARGS__); } while (0) +#define mpp_logi_cf(cond, fmt, ...) do { if (cond) mpp_logi_f(fmt, ## __VA_ARGS__); } while (0) +#define mpp_logd_cf(cond, fmt, ...) do { if (cond) mpp_logd_f(fmt, ## __VA_ARGS__); } while (0) +#define mpp_logv_cf(cond, fmt, ...) do { if (cond) mpp_logv_f(fmt, ## __VA_ARGS__); } while (0) + +/* + * mpp runtime log system usage: + * mpp_err is for error status message, it will print for sure. + * mpp_log is for important message like open/close/reset/flush, it will print too. + */ + +#define mpp_log(fmt, ...) mpp_logi(fmt, ## __VA_ARGS__) +#define mpp_err(fmt, ...) mpp_loge(fmt, ## __VA_ARGS__) + +#define mpp_log_f(fmt, ...) mpp_logi_f(fmt, ## __VA_ARGS__) +#define mpp_err_f(fmt, ...) mpp_loge_f(fmt, ## __VA_ARGS__) + +#define mpp_log_c(cond, fmt, ...) do { if (cond) mpp_log(fmt, ## __VA_ARGS__); } while (0) +#define mpp_log_cf(cond, fmt, ...) do { if (cond) mpp_log_f(fmt, ## __VA_ARGS__); } while (0) + +#ifdef __cplusplus +extern "C" { +#endif + +void _mpp_log_l(int level, const char *tag, const char *fmt, const char *func, ...); + +void mpp_set_log_level(int level); +int mpp_get_log_level(void); + +/* deprecated function */ +void _mpp_log(const char *tag, const char *fmt, const char *func, ...); +void _mpp_err(const char *tag, const char *fmt, const char *func, ...); + +#ifdef __cplusplus +} +#endif + +#endif /*__MPP_LOG_H__*/ diff --git a/inc/mpp_log_def.h b/inc/mpp_log_def.h new file mode 100644 index 00000000..0b17c1b9 --- /dev/null +++ b/inc/mpp_log_def.h @@ -0,0 +1,37 @@ +/* + * Copyright 2022 Rockchip Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __MPP_LOG_DEF_H__ +#define __MPP_LOG_DEF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define MPP_LOG_UNKNOWN 0 /* internal use only */ +#define MPP_LOG_FATAL 1 /* fatal error on aborting */ +#define MPP_LOG_ERROR 2 /* error log on unrecoverable failures */ +#define MPP_LOG_WARN 3 /* warning log on recoverable failures */ +#define MPP_LOG_INFO 4 /* Informational log */ +#define MPP_LOG_DEBUG 5 /* Debug log */ +#define MPP_LOG_VERBOSE 6 /* Verbose log */ +#define MPP_LOG_SILENT 7 /* internal use only */ + +#ifdef __cplusplus +} +#endif + +#endif /*__MPP_LOG_DEF_H__*/ diff --git a/mpp/base/inc/mpp_bitput.h b/mpp/base/inc/mpp_bitput.h index 5dc05df0..cf620bca 100644 --- a/mpp/base/inc/mpp_bitput.h +++ b/mpp/base/inc/mpp_bitput.h @@ -18,13 +18,9 @@ #ifndef __MPP_BITPUT_H__ #define __MPP_BITPUT_H__ -#include -#include - #include "rk_type.h" -#include "mpp_log.h" -#include "mpp_common.h" #include "mpp_err.h" +#include "mpp_common.h" typedef struct bitput_ctx_t { RK_U32 buflen; //!< max buf length, 64bit uint diff --git a/mpp/base/inc/mpp_bitread.h b/mpp/base/inc/mpp_bitread.h index 76deee8c..394e07ba 100644 --- a/mpp/base/inc/mpp_bitread.h +++ b/mpp/base/inc/mpp_bitread.h @@ -20,9 +20,8 @@ #include #include -#include "mpp_log.h" -#include "mpp_common.h" #include "mpp_err.h" +#include "mpp_common.h" #define __BITREAD_ERR __bitread_error diff --git a/mpp/base/mpp_bitwrite.c b/mpp/base/mpp_bitwrite.c index c57b9c01..2cbee89f 100644 --- a/mpp/base/mpp_bitwrite.c +++ b/mpp/base/mpp_bitwrite.c @@ -14,8 +14,8 @@ * limitations under the License. */ -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_bitwrite.h" diff --git a/mpp/base/mpp_buf_slot.cpp b/mpp/base/mpp_buf_slot.cpp index aecdc0a3..8d735d5f 100644 --- a/mpp/base/mpp_buf_slot.cpp +++ b/mpp/base/mpp_buf_slot.cpp @@ -18,10 +18,10 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" #include "mpp_list.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_frame_impl.h" diff --git a/mpp/base/mpp_buffer.cpp b/mpp/base/mpp_buffer.cpp index 988d5c87..dd3299b0 100644 --- a/mpp/base/mpp_buffer.cpp +++ b/mpp/base/mpp_buffer.cpp @@ -18,8 +18,8 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_buffer_impl.h" MPP_RET mpp_buffer_import_with_tag(MppBufferGroup group, MppBufferInfo *info, MppBuffer *buffer, diff --git a/mpp/base/mpp_buffer_impl.cpp b/mpp/base/mpp_buffer_impl.cpp index e6f2ccca..ed3b695e 100644 --- a/mpp/base/mpp_buffer_impl.cpp +++ b/mpp/base/mpp_buffer_impl.cpp @@ -18,10 +18,10 @@ #include -#include "mpp_log.h" #include "mpp_env.h" #include "mpp_hash.h" #include "mpp_lock.h" +#include "mpp_debug.h" #include "mpp_mem_pool.h" #include "mpp_buffer_impl.h" @@ -912,9 +912,9 @@ MppBufferGroupImpl *MppBufferService::get_group(const char *tag, const char *cal RK_U32 id = get_group_id(); if (tag) { - snprintf(p->tag, sizeof(p->tag), "%s_%d", tag, id); + snprintf(p->tag, sizeof(p->tag) - 1, "%s_%d", tag, id); } else { - snprintf(p->tag, sizeof(p->tag), "unknown"); + snprintf(p->tag, sizeof(p->tag) - 1, "unknown"); } p->group_id = id; diff --git a/mpp/base/mpp_cfg.cpp b/mpp/base/mpp_cfg.cpp index f734a39d..4ff11c21 100644 --- a/mpp/base/mpp_cfg.cpp +++ b/mpp/base/mpp_cfg.cpp @@ -18,8 +18,8 @@ #include -#include "mpp_log.h" #include "mpp_cfg.h" +#include "mpp_debug.h" const char *cfg_type_names[] = { "RK_S32", diff --git a/mpp/base/mpp_cluster.cpp b/mpp/base/mpp_cluster.cpp index b8422f99..121de536 100644 --- a/mpp/base/mpp_cluster.cpp +++ b/mpp/base/mpp_cluster.cpp @@ -18,11 +18,12 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" #include "mpp_lock.h" #include "mpp_time.h" +#include "mpp_debug.h" +#include "mpp_common.h" #include "mpp_cluster.h" #include "mpp_dev_defs.h" diff --git a/mpp/base/mpp_dec_cfg.cpp b/mpp/base/mpp_dec_cfg.cpp index 75896b38..75335857 100644 --- a/mpp/base/mpp_dec_cfg.cpp +++ b/mpp/base/mpp_dec_cfg.cpp @@ -19,9 +19,9 @@ #include "rk_vdec_cfg.h" #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_thread.h" diff --git a/mpp/base/mpp_enc_cfg.cpp b/mpp/base/mpp_enc_cfg.cpp index c46dca77..58917d46 100644 --- a/mpp/base/mpp_enc_cfg.cpp +++ b/mpp/base/mpp_enc_cfg.cpp @@ -21,9 +21,9 @@ #include "rk_venc_cfg.h" #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_thread.h" diff --git a/mpp/base/mpp_enc_refs.cpp b/mpp/base/mpp_enc_refs.cpp index 86e2a9ca..60780a34 100644 --- a/mpp/base/mpp_enc_refs.cpp +++ b/mpp/base/mpp_enc_refs.cpp @@ -19,8 +19,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_enc_ref.h" diff --git a/mpp/base/mpp_packet.cpp b/mpp/base/mpp_packet.cpp index 6f4a446e..fbb0174e 100644 --- a/mpp/base/mpp_packet.cpp +++ b/mpp/base/mpp_packet.cpp @@ -18,7 +18,7 @@ #include -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_mem_pool.h" #include "mpp_packet_impl.h" #include "mpp_meta_impl.h" diff --git a/mpp/base/mpp_task_impl.cpp b/mpp/base/mpp_task_impl.cpp index 0b910bca..613c3c27 100644 --- a/mpp/base/mpp_task_impl.cpp +++ b/mpp/base/mpp_task_impl.cpp @@ -19,8 +19,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_task_impl.h" #include "mpp_meta_impl.h" diff --git a/mpp/base/test/mpp_buffer_test.c b/mpp/base/test/mpp_buffer_test.c index 4fdf45e2..81ee5b3b 100644 --- a/mpp/base/test/mpp_buffer_test.c +++ b/mpp/base/test/mpp_buffer_test.c @@ -21,8 +21,8 @@ #if defined(_WIN32) #include "vld.h" #endif -#include "mpp_log.h" #include "mpp_env.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_buffer.h" #include "mpp_allocator.h" diff --git a/mpp/base/test/mpp_meta_test.c b/mpp/base/test/mpp_meta_test.c index d435bc6f..355853dc 100644 --- a/mpp/base/test/mpp_meta_test.c +++ b/mpp/base/test/mpp_meta_test.c @@ -18,8 +18,8 @@ #include -#include "mpp_log.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_meta_impl.h" #define TEST_MAX 2 diff --git a/mpp/base/test/mpp_task_test.c b/mpp/base/test/mpp_task_test.c index 9de43e3b..cda425d0 100644 --- a/mpp/base/test/mpp_task_test.c +++ b/mpp/base/test/mpp_task_test.c @@ -1,5 +1,5 @@ -#include "mpp_log.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_thread.h" #include "mpp_task.h" diff --git a/mpp/codec/dec/av1/av1d_api.c b/mpp/codec/dec/av1/av1d_api.c index b390cad5..2557a0be 100644 --- a/mpp/codec/dec/av1/av1d_api.c +++ b/mpp/codec/dec/av1/av1d_api.c @@ -21,7 +21,7 @@ #include #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_packet_impl.h" #include "av1d_codec.h" diff --git a/mpp/codec/dec/av1/av1d_cbs.c b/mpp/codec/dec/av1/av1d_cbs.c index 0621864c..0e2fa3b1 100644 --- a/mpp/codec/dec/av1/av1d_cbs.c +++ b/mpp/codec/dec/av1/av1d_cbs.c @@ -18,6 +18,7 @@ #include #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_bitread.h" #include "av1d_parser.h" diff --git a/mpp/codec/dec/av1/av1d_parser.c b/mpp/codec/dec/av1/av1d_parser.c index 07a85b33..2966edad 100644 --- a/mpp/codec/dec/av1/av1d_parser.c +++ b/mpp/codec/dec/av1/av1d_parser.c @@ -21,7 +21,7 @@ #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_compat_impl.h" diff --git a/mpp/codec/dec/avs/avsd_api.c b/mpp/codec/dec/avs/avsd_api.c index 0928a45c..c031504e 100644 --- a/mpp/codec/dec/avs/avsd_api.c +++ b/mpp/codec/dec/avs/avsd_api.c @@ -21,9 +21,9 @@ #include #include -#include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_env.h" +#include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_packet_impl.h" #include "avsd_syntax.h" diff --git a/mpp/codec/dec/avs/avsd_parse.c b/mpp/codec/dec/avs/avsd_parse.c index 13845c10..22fae998 100644 --- a/mpp/codec/dec/avs/avsd_parse.c +++ b/mpp/codec/dec/avs/avsd_parse.c @@ -21,7 +21,6 @@ #include #include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_packet_impl.h" #include "hal_dec_task.h" diff --git a/mpp/codec/dec/avs/avsd_parse.h b/mpp/codec/dec/avs/avsd_parse.h index a7988b44..c999a0b2 100644 --- a/mpp/codec/dec/avs/avsd_parse.h +++ b/mpp/codec/dec/avs/avsd_parse.h @@ -17,6 +17,8 @@ #ifndef __AVSD_PARSE_H__ #define __AVSD_PARSE_H__ +#include "mpp_debug.h" + #include "parser_api.h" #include "mpp_bitread.h" diff --git a/mpp/codec/dec/dummy/dummy_dec_api.c b/mpp/codec/dec/dummy/dummy_dec_api.c index f0899ea7..f0500b89 100644 --- a/mpp/codec/dec/dummy/dummy_dec_api.c +++ b/mpp/codec/dec/dummy/dummy_dec_api.c @@ -18,8 +18,8 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "dummy_dec_api.h" diff --git a/mpp/codec/dec/h263/h263d_api.c b/mpp/codec/dec/h263/h263d_api.c index ba9e2bf4..989ea1b1 100644 --- a/mpp/codec/dec/h263/h263d_api.c +++ b/mpp/codec/dec/h263/h263d_api.c @@ -19,8 +19,8 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "h263d_api.h" diff --git a/mpp/codec/dec/h263/h263d_parser.c b/mpp/codec/dec/h263/h263d_parser.c index 1edcb589..ea82b088 100644 --- a/mpp/codec/dec/h263/h263d_parser.c +++ b/mpp/codec/dec/h263/h263d_parser.c @@ -18,8 +18,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_bitread.h" #include "h263d_parser.h" diff --git a/mpp/codec/dec/h264/h264d_global.h b/mpp/codec/dec/h264/h264d_global.h index cc00052d..c9b064eb 100644 --- a/mpp/codec/dec/h264/h264d_global.h +++ b/mpp/codec/dec/h264/h264d_global.h @@ -21,7 +21,7 @@ #include #include "rk_type.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_bitread.h" #include "mpp_mem_pool.h" diff --git a/mpp/codec/dec/h265/h265d_parser.h b/mpp/codec/dec/h265/h265d_parser.h index f41b8dc1..6634bd8c 100644 --- a/mpp/codec/dec/h265/h265d_parser.h +++ b/mpp/codec/dec/h265/h265d_parser.h @@ -32,7 +32,7 @@ #include #include -#include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_bitread.h" #include "mpp_buf_slot.h" #include "mpp_mem_pool.h" diff --git a/mpp/codec/dec/jpeg/jpegd_parser.c b/mpp/codec/dec/jpeg/jpegd_parser.c index 13def37f..8459bc56 100644 --- a/mpp/codec/dec/jpeg/jpegd_parser.c +++ b/mpp/codec/dec/jpeg/jpegd_parser.c @@ -22,6 +22,7 @@ #include "mpp_env.h" #include "mpp_mem.h" #include "mpp_soc.h" +#include "mpp_debug.h" #include "mpp_bitread.h" #include "mpp_packet_impl.h" @@ -993,7 +994,7 @@ static MPP_RET jpegd_prepare(void *ctx, MppPacket pkt, HalDecTask *task) static FILE *jpg_file; static char name[32]; - snprintf(name, sizeof(name), "/data/input%02d.jpg", + snprintf(name, sizeof(name) - 1, "/data/input%02d.jpg", JpegCtx->input_jpeg_count); jpg_file = fopen(name, "wb+"); if (jpg_file) { diff --git a/mpp/codec/dec/jpeg/jpegd_parser.h b/mpp/codec/dec/jpeg/jpegd_parser.h index bb398f4f..72f20f59 100644 --- a/mpp/codec/dec/jpeg/jpegd_parser.h +++ b/mpp/codec/dec/jpeg/jpegd_parser.h @@ -21,7 +21,6 @@ #include #include -#include "mpp_mem.h" #include "mpp_bitread.h" #include "jpegd_syntax.h" diff --git a/mpp/codec/dec/m2v/m2vd_api.c b/mpp/codec/dec/m2v/m2vd_api.c index 010edd04..6eba3e79 100644 --- a/mpp/codec/dec/m2v/m2vd_api.c +++ b/mpp/codec/dec/m2v/m2vd_api.c @@ -18,11 +18,6 @@ #include -#include "mpp_env.h" -#include "mpp_mem.h" -#include "mpp_log.h" -#include "mpp_packet_impl.h" - #include "m2vd_api.h" #include "m2vd_parser.h" #include "m2vd_codec.h" diff --git a/mpp/codec/dec/m2v/m2vd_com.h b/mpp/codec/dec/m2v/m2vd_com.h index 3daecf9f..0182af16 100644 --- a/mpp/codec/dec/m2v/m2vd_com.h +++ b/mpp/codec/dec/m2v/m2vd_com.h @@ -20,8 +20,7 @@ #include #include -#include "rk_type.h" -#include "mpp_log.h" +#include "mpp_debug.h" #define M2VD_DEMO_MODE 0 diff --git a/mpp/codec/dec/m2v/m2vd_parser.c b/mpp/codec/dec/m2v/m2vd_parser.c index b8bd118b..1d1f809a 100755 --- a/mpp/codec/dec/m2v/m2vd_parser.c +++ b/mpp/codec/dec/m2v/m2vd_parser.c @@ -19,6 +19,7 @@ #include #include "mpp_env.h" +#include "mpp_debug.h" #include "mpp_packet_impl.h" #include "m2vd_parser.h" diff --git a/mpp/codec/dec/mpg4/mpg4d_api.c b/mpp/codec/dec/mpg4/mpg4d_api.c index 26d96660..59aa300d 100644 --- a/mpp/codec/dec/mpg4/mpg4d_api.c +++ b/mpp/codec/dec/mpg4/mpg4d_api.c @@ -19,8 +19,8 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpg4d_api.h" diff --git a/mpp/codec/dec/mpg4/mpg4d_parser.c b/mpp/codec/dec/mpg4/mpg4d_parser.c index 2853e644..f07289f5 100644 --- a/mpp/codec/dec/mpg4/mpg4d_parser.c +++ b/mpp/codec/dec/mpg4/mpg4d_parser.c @@ -20,15 +20,15 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_bitread.h" #include "mpg4d_parser.h" #include "mpg4d_syntax.h" - RK_U32 mpg4d_debug = 0; + #define mpg4d_dbg(flag, fmt, ...) _mpp_dbg(mpg4d_debug, flag, fmt, ## __VA_ARGS__) #define mpg4d_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpg4d_debug, flag, fmt, ## __VA_ARGS__) diff --git a/mpp/codec/dec/vp8/vp8d_parser.c b/mpp/codec/dec/vp8/vp8d_parser.c index 5c7623f7..793fba49 100644 --- a/mpp/codec/dec/vp8/vp8d_parser.c +++ b/mpp/codec/dec/vp8/vp8d_parser.c @@ -18,10 +18,13 @@ #include +#include "mpp_env.h" +#include "mpp_mem.h" +#include "mpp_debug.h" +#include "mpp_frame.h" + #include "vp8d_parser.h" #include "vp8d_codec.h" -#include "mpp_frame.h" -#include "mpp_env.h" #define FUN_T(tag) \ do {\ diff --git a/mpp/codec/dec/vp8/vp8d_parser.h b/mpp/codec/dec/vp8/vp8d_parser.h index d0bdf16d..47fd4817 100644 --- a/mpp/codec/dec/vp8/vp8d_parser.h +++ b/mpp/codec/dec/vp8/vp8d_parser.h @@ -18,8 +18,7 @@ #ifndef __VP8D_PARSER_H__ #define __VP8D_PARSER_H__ -#include "mpp_bitread.h" -#include "mpp_mem.h" +#include #include "parser_api.h" #include "vp8d_syntax.h" diff --git a/mpp/codec/dec/vp9/vp9d_api.c b/mpp/codec/dec/vp9/vp9d_api.c index 1d67c352..b301eeef 100644 --- a/mpp/codec/dec/vp9/vp9d_api.c +++ b/mpp/codec/dec/vp9/vp9d_api.c @@ -22,7 +22,6 @@ #include #include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_packet_impl.h" #include "vp9d_codec.h" diff --git a/mpp/codec/dec/vp9/vp9d_parser.c b/mpp/codec/dec/vp9/vp9d_parser.c index 01c06f5f..b5709792 100644 --- a/mpp/codec/dec/vp9/vp9d_parser.c +++ b/mpp/codec/dec/vp9/vp9d_parser.c @@ -20,7 +20,7 @@ #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_bitread.h" #include "mpp_packet_impl.h" diff --git a/mpp/codec/dec/vp9/vp9d_parser.h b/mpp/codec/dec/vp9/vp9d_parser.h index 43ae6f2f..e55df154 100644 --- a/mpp/codec/dec/vp9/vp9d_parser.h +++ b/mpp/codec/dec/vp9/vp9d_parser.h @@ -19,7 +19,7 @@ #include -#include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_bitread.h" #include "parser_api.h" diff --git a/mpp/codec/enc/h264/h264e_api_v2.c b/mpp/codec/enc/h264/h264e_api_v2.c index 36575231..d140018b 100644 --- a/mpp/codec/enc/h264/h264e_api_v2.c +++ b/mpp/codec/enc/h264/h264e_api_v2.c @@ -19,7 +19,6 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_common.h" diff --git a/mpp/codec/enc/h264/h264e_debug.h b/mpp/codec/enc/h264/h264e_debug.h index 91ea60e5..03e03311 100644 --- a/mpp/codec/enc/h264/h264e_debug.h +++ b/mpp/codec/enc/h264/h264e_debug.h @@ -17,7 +17,7 @@ #ifndef __H264E_DEBUG_H__ #define __H264E_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define H264E_DBG_FUNCTION (0x00000001) #define H264E_DBG_FLOW (0x00000002) diff --git a/mpp/codec/enc/h265/h265e_codec.h b/mpp/codec/enc/h265/h265e_codec.h index e81ee958..b6c60082 100644 --- a/mpp/codec/enc/h265/h265e_codec.h +++ b/mpp/codec/enc/h265/h265e_codec.h @@ -16,7 +16,7 @@ #ifndef __H265E_CODEC_H__ #define __H265E_CODEC_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_rc.h" diff --git a/mpp/codec/enc/h265/h265e_dpb.c b/mpp/codec/enc/h265/h265e_dpb.c index 9aa3a2ee..255c89f4 100644 --- a/mpp/codec/enc/h265/h265e_dpb.c +++ b/mpp/codec/enc/h265/h265e_dpb.c @@ -18,8 +18,8 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "h265e_codec.h" diff --git a/mpp/codec/enc/h265/h265e_slice.c b/mpp/codec/enc/h265/h265e_slice.c index 35a67032..8549e01d 100644 --- a/mpp/codec/enc/h265/h265e_slice.c +++ b/mpp/codec/enc/h265/h265e_slice.c @@ -18,7 +18,7 @@ #include -#include "mpp_log.h" +#include "mpp_debug.h" #include "h265e_codec.h" #include "h265e_slice.h" diff --git a/mpp/codec/enc/jpeg/jpege_api_v2.c b/mpp/codec/enc/jpeg/jpege_api_v2.c index e2730773..98281ca6 100644 --- a/mpp/codec/enc/jpeg/jpege_api_v2.c +++ b/mpp/codec/enc/jpeg/jpege_api_v2.c @@ -19,10 +19,9 @@ #include #include "mpp_err.h" -#include "mpp_log.h" #include "mpp_env.h" -#include "mpp_common.h" #include "mpp_mem.h" +#include "mpp_common.h" #include "mpp_2str.h" #include "jpege_debug.h" diff --git a/mpp/codec/enc/jpeg/jpege_debug.h b/mpp/codec/enc/jpeg/jpege_debug.h index 200f8676..f74483ed 100644 --- a/mpp/codec/enc/jpeg/jpege_debug.h +++ b/mpp/codec/enc/jpeg/jpege_debug.h @@ -17,7 +17,7 @@ #ifndef __JPEGE_DEBUG_H__ #define __JPEGE_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define JPEGE_DBG_FUNCTION (0x00000001) #define JPEGE_DBG_INPUT (0x00000010) diff --git a/mpp/codec/enc/vp8/vp8e_api_v2.c b/mpp/codec/enc/vp8/vp8e_api_v2.c index 9fcc23fa..ed044f27 100644 --- a/mpp/codec/enc/vp8/vp8e_api_v2.c +++ b/mpp/codec/enc/vp8/vp8e_api_v2.c @@ -19,8 +19,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_rc.h" #include "mpp_enc_cfg_impl.h" diff --git a/mpp/codec/enc/vp8/vp8e_debug.h b/mpp/codec/enc/vp8/vp8e_debug.h index 0392746f..3b5a27e9 100644 --- a/mpp/codec/enc/vp8/vp8e_debug.h +++ b/mpp/codec/enc/vp8/vp8e_debug.h @@ -17,9 +17,7 @@ #ifndef __VP8E_DEBUG_H__ #define __VP8E_DEBUG_H__ -#include "rk_type.h" - -#include "mpp_log.h" +#include "mpp_debug.h" #define VP8E_DBG_RC_FUNCTION (0x00010000) #define VP8E_DBG_RC_BPS (0x00020000) diff --git a/mpp/codec/enc_impl.cpp b/mpp/codec/enc_impl.cpp index d2f3c0e4..f9eb9464 100644 --- a/mpp/codec/enc_impl.cpp +++ b/mpp/codec/enc_impl.cpp @@ -19,7 +19,7 @@ #include #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_packet_impl.h" diff --git a/mpp/codec/inc/mpp_rc.h b/mpp/codec/inc/mpp_rc.h index 5368fd5b..94e4f52d 100644 --- a/mpp/codec/inc/mpp_rc.h +++ b/mpp/codec/inc/mpp_rc.h @@ -19,7 +19,6 @@ #include "rk_venc_cmd.h" -#include "mpp_log.h" #include "mpp_list.h" /* diff --git a/mpp/codec/mpp_dec.cpp b/mpp/codec/mpp_dec.cpp index 4591b5b1..10841104 100644 --- a/mpp/codec/mpp_dec.cpp +++ b/mpp/codec/mpp_dec.cpp @@ -20,8 +20,8 @@ #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp.h" diff --git a/mpp/codec/mpp_enc_debug.h b/mpp/codec/mpp_enc_debug.h index 3ba175fa..f3522640 100644 --- a/mpp/codec/mpp_enc_debug.h +++ b/mpp/codec/mpp_enc_debug.h @@ -17,7 +17,7 @@ #ifndef __MPP_ENC_DEBUG_H__ #define __MPP_ENC_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define MPP_ENC_DBG_FUNCTION (0x00000001) #define MPP_ENC_DBG_CONTROL (0x00000002) diff --git a/mpp/codec/rc/rc_data.cpp b/mpp/codec/rc/rc_data.cpp index 78a87cfd..728ecb9c 100644 --- a/mpp/codec/rc/rc_data.cpp +++ b/mpp/codec/rc/rc_data.cpp @@ -17,9 +17,9 @@ #define MODULE_TAG "rc_data" #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_list.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "rc_data.h" diff --git a/mpp/codec/rc/rc_data_impl.cpp b/mpp/codec/rc/rc_data_impl.cpp index cbbd5cd8..90b8600d 100644 --- a/mpp/codec/rc/rc_data_impl.cpp +++ b/mpp/codec/rc/rc_data_impl.cpp @@ -19,9 +19,9 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_list.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "rc_data.h" diff --git a/mpp/codec/rc/rc_debug.h b/mpp/codec/rc/rc_debug.h index bb2f2972..754f5627 100644 --- a/mpp/codec/rc/rc_debug.h +++ b/mpp/codec/rc/rc_debug.h @@ -17,7 +17,7 @@ #ifndef __RC_DEBUG_H__ #define __RC_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define RC_DBG_FUNCTION (0x00000001) #define RC_DBG_API_IMPL (0x00000002) diff --git a/mpp/hal/common/h264/hal_h264e_debug.h b/mpp/hal/common/h264/hal_h264e_debug.h index 1f711de4..8fea4628 100644 --- a/mpp/hal/common/h264/hal_h264e_debug.h +++ b/mpp/hal/common/h264/hal_h264e_debug.h @@ -17,7 +17,7 @@ #ifndef __HAL_H264E_DEBUG_H__ #define __HAL_H264E_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define HAL_H264E_DBG_SIMPLE (0x00000001) #define HAL_H264E_DBG_FUNCTION (0x00000002) diff --git a/mpp/hal/common/h265/hal_h265e_api_v2.c b/mpp/hal/common/h265/hal_h265e_api_v2.c index 95ea4a97..2316882a 100644 --- a/mpp/hal/common/h265/hal_h265e_api_v2.c +++ b/mpp/hal/common/h265/hal_h265e_api_v2.c @@ -22,7 +22,7 @@ #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_platform.h" #include "vepu5xx.h" diff --git a/mpp/hal/common/h265/hal_h265e_debug.h b/mpp/hal/common/h265/hal_h265e_debug.h index 759f131f..03652c0b 100644 --- a/mpp/hal/common/h265/hal_h265e_debug.h +++ b/mpp/hal/common/h265/hal_h265e_debug.h @@ -17,7 +17,7 @@ #ifndef __HAL_H265E_DEBUG_H__ #define __HAL_H265E_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define HAL_H265E_DBG_FUNCTION (0x00000001) #define HAL_H265E_DBG_SIMPLE (0x00000002) diff --git a/mpp/hal/common/hal_bufs.c b/mpp/hal/common/hal_bufs.c index b206be4f..ccd74c72 100644 --- a/mpp/hal/common/hal_bufs.c +++ b/mpp/hal/common/hal_bufs.c @@ -18,8 +18,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "hal_bufs.h" diff --git a/mpp/hal/common/hal_info.c b/mpp/hal/common/hal_info.c index 569d4b1a..69a323e9 100644 --- a/mpp/hal/common/hal_info.c +++ b/mpp/hal/common/hal_info.c @@ -17,8 +17,9 @@ #include #include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_2str.h" +#include "mpp_debug.h" +#include "mpp_common.h" #include "hal_info.h" diff --git a/mpp/hal/hal_task.cpp b/mpp/hal/hal_task.cpp index cfcd0edf..f52934cc 100644 --- a/mpp/hal/hal_task.cpp +++ b/mpp/hal/hal_task.cpp @@ -19,9 +19,9 @@ #include #include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_list.h" #include "mpp_lock.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "hal_task.h" diff --git a/mpp/hal/rkdec/avsd/hal_avsd_api.c b/mpp/hal/rkdec/avsd/hal_avsd_api.c index 228f603f..59f0f354 100644 --- a/mpp/hal/rkdec/avsd/hal_avsd_api.c +++ b/mpp/hal/rkdec/avsd/hal_avsd_api.c @@ -22,7 +22,6 @@ #include #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" #include "mpp_common.h" diff --git a/mpp/hal/rkdec/avsd/hal_avsd_reg.c b/mpp/hal/rkdec/avsd/hal_avsd_reg.c index e47d6e20..0e2ca8ed 100644 --- a/mpp/hal/rkdec/avsd/hal_avsd_reg.c +++ b/mpp/hal/rkdec/avsd/hal_avsd_reg.c @@ -17,7 +17,6 @@ #define MODULE_TAG "hal_avsd_reg" -#include "mpp_log.h" #include "mpp_common.h" #include "avsd_syntax.h" diff --git a/mpp/hal/rkdec/avsd/hal_avsd_reg.h b/mpp/hal/rkdec/avsd/hal_avsd_reg.h index cd05c8ba..ebcf33b9 100644 --- a/mpp/hal/rkdec/avsd/hal_avsd_reg.h +++ b/mpp/hal/rkdec/avsd/hal_avsd_reg.h @@ -17,6 +17,7 @@ #ifndef __HAL_AVSD_REG_H__ #define __HAL_AVSD_REG_H__ +#include "mpp_debug.h" #include "mpp_device.h" #include "parser_api.h" diff --git a/mpp/hal/rkdec/h264d/hal_h264d_api.c b/mpp/hal/rkdec/h264d/hal_h264d_api.c index bd30f79d..eaddb766 100644 --- a/mpp/hal/rkdec/h264d/hal_h264d_api.c +++ b/mpp/hal/rkdec/h264d/hal_h264d_api.c @@ -24,7 +24,6 @@ #include #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" #include "mpp_platform.h" diff --git a/mpp/hal/rkdec/h264d/hal_h264d_global.h b/mpp/hal/rkdec/h264d/hal_h264d_global.h index f29b6e36..4023e95b 100644 --- a/mpp/hal/rkdec/h264d/hal_h264d_global.h +++ b/mpp/hal/rkdec/h264d/hal_h264d_global.h @@ -20,7 +20,7 @@ #define __HAL_H264D_GLOBAL_H__ #include "mpp_hal.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_device.h" #include "hal_bufs.h" diff --git a/mpp/hal/rkdec/h265d/hal_h265d_api.c b/mpp/hal/rkdec/h265d/hal_h265d_api.c index d69608fd..47930ba5 100644 --- a/mpp/hal/rkdec/h265d/hal_h265d_api.c +++ b/mpp/hal/rkdec/h265d/hal_h265d_api.c @@ -20,8 +20,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "hal_h265d_ctx.h" #include "hal_h265d_api.h" diff --git a/mpp/hal/rkdec/h265d/hal_h265d_com.c b/mpp/hal/rkdec/h265d/hal_h265d_com.c index 11e29ed3..1683a2ff 100644 --- a/mpp/hal/rkdec/h265d/hal_h265d_com.c +++ b/mpp/hal/rkdec/h265d/hal_h265d_com.c @@ -18,7 +18,6 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_common.h" #include "mpp_bitread.h" diff --git a/mpp/hal/rkdec/h265d/hal_h265d_debug.h b/mpp/hal/rkdec/h265d/hal_h265d_debug.h index 7e4915aa..ec781d00 100644 --- a/mpp/hal/rkdec/h265d/hal_h265d_debug.h +++ b/mpp/hal/rkdec/h265d/hal_h265d_debug.h @@ -18,9 +18,7 @@ #ifndef __HAL_H265D_DEBUG_H__ #define __HAL_H265D_DEBUG_H__ -#include "rk_type.h" -#include "mpp_err.h" -#include "mpp_log.h" +#include "mpp_debug.h" #define H265H_DBG_FUNCTION (0x00000001) #define H265H_DBG_RPS (0x00000002) diff --git a/mpp/hal/rkdec/h265d/hal_h265d_rkv.c b/mpp/hal/rkdec/h265d/hal_h265d_rkv.c index 2b6d47f0..d8fd1b50 100644 --- a/mpp/hal/rkdec/h265d/hal_h265d_rkv.c +++ b/mpp/hal/rkdec/h265d/hal_h265d_rkv.c @@ -19,7 +19,6 @@ #include #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_bitread.h" #include "mpp_bitput.h" diff --git a/mpp/hal/rkdec/h265d/hal_h265d_rkv_reg.h b/mpp/hal/rkdec/h265d/hal_h265d_rkv_reg.h index 1ae401da..d0ecb797 100644 --- a/mpp/hal/rkdec/h265d/hal_h265d_rkv_reg.h +++ b/mpp/hal/rkdec/h265d/hal_h265d_rkv_reg.h @@ -29,7 +29,6 @@ #define __HAL_H265D_REG_H__ #include "rk_type.h" -#include "mpp_log.h" #define HEVC_DECODER_REG_NUM (48) #define RKVDEC_REG_PERF_CYCLE_INDEX (64) diff --git a/mpp/hal/rkdec/h265d/hal_h265d_vdpu34x.c b/mpp/hal/rkdec/h265d/hal_h265d_vdpu34x.c index 4399159d..544c23aa 100644 --- a/mpp/hal/rkdec/h265d/hal_h265d_vdpu34x.c +++ b/mpp/hal/rkdec/h265d/hal_h265d_vdpu34x.c @@ -20,7 +20,6 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_bitread.h" #include "mpp_bitput.h" diff --git a/mpp/hal/rkdec/vp9d/hal_vp9d_api.c b/mpp/hal/rkdec/vp9d/hal_vp9d_api.c index ff090818..e30bd09b 100644 --- a/mpp/hal/rkdec/vp9d/hal_vp9d_api.c +++ b/mpp/hal/rkdec/vp9d/hal_vp9d_api.c @@ -19,7 +19,6 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "hal_vp9d_debug.h" #include "hal_vp9d_api.h" diff --git a/mpp/hal/rkdec/vp9d/hal_vp9d_debug.h b/mpp/hal/rkdec/vp9d/hal_vp9d_debug.h index c20f387d..3962def0 100644 --- a/mpp/hal/rkdec/vp9d/hal_vp9d_debug.h +++ b/mpp/hal/rkdec/vp9d/hal_vp9d_debug.h @@ -17,7 +17,7 @@ #ifndef __HAL_VP9D_DEBUG_H__ #define __HAL_VP9D_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define HAL_VP9D_DBG_FUNC (0x00000001) #define HAL_VP9D_DBG_PAR (0x00000002) diff --git a/mpp/hal/rkdec/vp9d/hal_vp9d_rkv.c b/mpp/hal/rkdec/vp9d/hal_vp9d_rkv.c index d2252cfb..5601bd4e 100644 --- a/mpp/hal/rkdec/vp9d/hal_vp9d_rkv.c +++ b/mpp/hal/rkdec/vp9d/hal_vp9d_rkv.c @@ -20,7 +20,6 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_common.h" diff --git a/mpp/hal/rkdec/vp9d/hal_vp9d_vdpu34x.c b/mpp/hal/rkdec/vp9d/hal_vp9d_vdpu34x.c index bbee778d..4f9cbdfd 100644 --- a/mpp/hal/rkdec/vp9d/hal_vp9d_vdpu34x.c +++ b/mpp/hal/rkdec/vp9d/hal_vp9d_vdpu34x.c @@ -20,7 +20,6 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_common.h" #include "mpp_device.h" diff --git a/mpp/hal/rkenc/common/vepu541_common.c b/mpp/hal/rkenc/common/vepu541_common.c index 6199b6ea..0c62c902 100644 --- a/mpp/hal/rkenc/common/vepu541_common.c +++ b/mpp/hal/rkenc/common/vepu541_common.c @@ -18,8 +18,8 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "vepu541_common.h" diff --git a/mpp/hal/vpu/av1d/hal_av1d_api.c b/mpp/hal/vpu/av1d/hal_av1d_api.c index 70991ac2..a075948a 100644 --- a/mpp/hal/vpu/av1d/hal_av1d_api.c +++ b/mpp/hal/vpu/av1d/hal_av1d_api.c @@ -22,7 +22,6 @@ #include #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" #include "mpp_platform.h" diff --git a/mpp/hal/vpu/av1d/hal_av1d_common.h b/mpp/hal/vpu/av1d/hal_av1d_common.h index a472d36c..cda67451 100644 --- a/mpp/hal/vpu/av1d/hal_av1d_common.h +++ b/mpp/hal/vpu/av1d/hal_av1d_common.h @@ -19,7 +19,7 @@ #define __HAL_AV1D_GLOBAL_H__ #include "mpp_hal.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_device.h" #include "hal_bufs.h" diff --git a/mpp/hal/vpu/common/vepu_common.c b/mpp/hal/vpu/common/vepu_common.c index 73fea1c9..e49a5973 100644 --- a/mpp/hal/vpu/common/vepu_common.c +++ b/mpp/hal/vpu/common/vepu_common.c @@ -17,8 +17,8 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_frame.h" diff --git a/mpp/hal/vpu/h263d/hal_h263d_api.c b/mpp/hal/vpu/h263d/hal_h263d_api.c index 8d9e81b0..f3109de1 100644 --- a/mpp/hal/vpu/h263d/hal_h263d_api.c +++ b/mpp/hal/vpu/h263d/hal_h263d_api.c @@ -17,7 +17,7 @@ #include #include "mpp_env.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_platform.h" #include "mpp_hal.h" diff --git a/mpp/hal/vpu/h263d/hal_h263d_vdpu1.c b/mpp/hal/vpu/h263d/hal_h263d_vdpu1.c index 14a1aefc..828e4b0b 100644 --- a/mpp/hal/vpu/h263d/hal_h263d_vdpu1.c +++ b/mpp/hal/vpu/h263d/hal_h263d_vdpu1.c @@ -19,9 +19,9 @@ #include #include -#include "mpp_log.h" #include "mpp_err.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "h263d_syntax.h" #include "hal_h263d_api.h" diff --git a/mpp/hal/vpu/h263d/hal_h263d_vdpu2.c b/mpp/hal/vpu/h263d/hal_h263d_vdpu2.c index fa40dece..bdd31058 100644 --- a/mpp/hal/vpu/h263d/hal_h263d_vdpu2.c +++ b/mpp/hal/vpu/h263d/hal_h263d_vdpu2.c @@ -19,9 +19,9 @@ #include #include -#include "mpp_log.h" #include "mpp_err.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "h263d_syntax.h" #include "hal_h263d_api.h" diff --git a/mpp/hal/vpu/jpegd/hal_jpegd_api.c b/mpp/hal/vpu/jpegd/hal_jpegd_api.c index 48e56a13..6e804110 100644 --- a/mpp/hal/vpu/jpegd/hal_jpegd_api.c +++ b/mpp/hal/vpu/jpegd/hal_jpegd_api.c @@ -19,7 +19,7 @@ #include #include "mpp_env.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "osal_2str.h" #include "mpp_hal.h" diff --git a/mpp/hal/vpu/jpegd/hal_jpegd_common.c b/mpp/hal/vpu/jpegd/hal_jpegd_common.c index ecee03b8..d1098ef0 100644 --- a/mpp/hal/vpu/jpegd/hal_jpegd_common.c +++ b/mpp/hal/vpu/jpegd/hal_jpegd_common.c @@ -21,8 +21,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_bitread.h" #include "mpp_bitput.h" diff --git a/mpp/hal/vpu/jpegd/hal_jpegd_rkv.c b/mpp/hal/vpu/jpegd/hal_jpegd_rkv.c index 3df19f4b..155375f5 100644 --- a/mpp/hal/vpu/jpegd/hal_jpegd_rkv.c +++ b/mpp/hal/vpu/jpegd/hal_jpegd_rkv.c @@ -20,8 +20,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_frame.h" #include "mpp_common.h" @@ -743,7 +743,7 @@ MPP_RET hal_jpegd_rkv_wait(void *hal, HalTaskInfo *task) mpp_buf_slot_get_prop(ctx->frame_slots, task->dec.output, SLOT_BUFFER, &outputBuf); base = mpp_buffer_get_ptr(outputBuf); - snprintf(name, sizeof(name), "/data/tmp/output%02d.yuv", ctx->output_yuv_count); + snprintf(name, sizeof(name) - 1, "/data/tmp/output%02d.yuv", ctx->output_yuv_count); jpg_file = fopen(name, "wb+"); if (jpg_file) { JpegdSyntax *s = (JpegdSyntax *) task->dec.syntax.data; diff --git a/mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c b/mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c index d6542abe..7a759c9d 100644 --- a/mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c +++ b/mpp/hal/vpu/jpegd/hal_jpegd_vdpu1.c @@ -21,8 +21,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_frame.h" #include "mpp_common.h" @@ -996,7 +996,7 @@ MPP_RET hal_jpegd_vdpu1_wait(void *hal, HalTaskInfo *task) SLOT_BUFFER, &outputBuf); base = mpp_buffer_get_ptr(outputBuf); - snprintf(name, sizeof(name), "/tmp/output%02d.yuv", + snprintf(name, sizeof(name) - 1, "/tmp/output%02d.yuv", JpegHalCtx->output_yuv_count); jpg_file = fopen(name, "wb+"); if (jpg_file) { diff --git a/mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c b/mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c index 898e9c21..f7a2809d 100644 --- a/mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c +++ b/mpp/hal/vpu/jpegd/hal_jpegd_vdpu2.c @@ -21,8 +21,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_frame.h" #include "mpp_common.h" @@ -974,7 +974,7 @@ MPP_RET hal_jpegd_vdpu2_wait(void *hal, HalTaskInfo *task) SLOT_BUFFER, &outputBuf); base = mpp_buffer_get_ptr(outputBuf); - snprintf(name, sizeof(name), "/tmp/output%02d.yuv", + snprintf(name, sizeof(name) - 1, "/tmp/output%02d.yuv", JpegHalCtx->output_yuv_count); jpg_file = fopen(name, "wb+"); if (jpg_file) { diff --git a/mpp/hal/vpu/jpege/hal_jpege_debug.h b/mpp/hal/vpu/jpege/hal_jpege_debug.h index dff69a73..ef19e1db 100644 --- a/mpp/hal/vpu/jpege/hal_jpege_debug.h +++ b/mpp/hal/vpu/jpege/hal_jpege_debug.h @@ -17,7 +17,7 @@ #ifndef __HAL_JPEGE_DEBUG_H__ #define __HAL_JPEGE_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define HAL_JPEGE_DBG_FUNCTION (0x00000001) #define HAL_JPEGE_DBG_SIMPLE (0x00000002) diff --git a/mpp/hal/vpu/jpege/hal_jpege_hdr.c b/mpp/hal/vpu/jpege/hal_jpege_hdr.c index 45f4595b..defa03a5 100644 --- a/mpp/hal/vpu/jpege/hal_jpege_hdr.c +++ b/mpp/hal/vpu/jpege/hal_jpege_hdr.c @@ -14,8 +14,8 @@ * limitations under the License. */ -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "hal_jpege_hdr.h" diff --git a/mpp/hal/vpu/m2vd/hal_m2vd_api.c b/mpp/hal/vpu/m2vd/hal_m2vd_api.c index 0bc377fd..bb9bfd81 100644 --- a/mpp/hal/vpu/m2vd/hal_m2vd_api.c +++ b/mpp/hal/vpu/m2vd/hal_m2vd_api.c @@ -18,14 +18,13 @@ #include -#include "mpp_log.h" -#include "mpp_platform.h" #include "mpp_env.h" + +#include "mpp_platform.h" #include "hal_m2vd_base.h" #include "hal_m2vd_vpu1.h" #include "hal_m2vd_vpu2.h" - RK_U32 m2vh_debug = 0; static MPP_RET hal_m2vd_gen_regs(void *hal, HalTaskInfo *task) diff --git a/mpp/hal/vpu/m2vd/hal_m2vd_base.h b/mpp/hal/vpu/m2vd/hal_m2vd_base.h index cb713f80..44488240 100644 --- a/mpp/hal/vpu/m2vd/hal_m2vd_base.h +++ b/mpp/hal/vpu/m2vd/hal_m2vd_base.h @@ -18,10 +18,13 @@ #define __HAL_M2VD_BASE_H__ #include + +#include "mpp_debug.h" + #include "mpp_hal.h" #include "mpp_buf_slot.h" #include "mpp_device.h" -#include "mpp_mem.h" + #include "m2vd_syntax.h" #define M2VD_BUF_SIZE_QPTAB (256) diff --git a/mpp/hal/vpu/m2vd/hal_m2vd_vdpu1.c b/mpp/hal/vpu/m2vd/hal_m2vd_vdpu1.c index a4b2278c..0a0402b4 100644 --- a/mpp/hal/vpu/m2vd/hal_m2vd_vdpu1.c +++ b/mpp/hal/vpu/m2vd/hal_m2vd_vdpu1.c @@ -18,7 +18,7 @@ #include -#include "mpp_log.h" +#include "mpp_mem.h" #include "mpp_common.h" #include "hal_m2vd_base.h" diff --git a/mpp/hal/vpu/m2vd/hal_m2vd_vdpu2.c b/mpp/hal/vpu/m2vd/hal_m2vd_vdpu2.c index 73cb065d..64951c01 100644 --- a/mpp/hal/vpu/m2vd/hal_m2vd_vdpu2.c +++ b/mpp/hal/vpu/m2vd/hal_m2vd_vdpu2.c @@ -19,7 +19,7 @@ #include #include "mpp_env.h" -#include "mpp_log.h" +#include "mpp_mem.h" #include "mpp_common.h" #include "hal_m2vd_base.h" diff --git a/mpp/hal/vpu/mpg4d/hal_m4vd_api.c b/mpp/hal/vpu/mpg4d/hal_m4vd_api.c index bf71f780..b94389c0 100644 --- a/mpp/hal/vpu/mpg4d/hal_m4vd_api.c +++ b/mpp/hal/vpu/mpg4d/hal_m4vd_api.c @@ -22,10 +22,10 @@ #include #include -#include "mpp_log.h" #include "mpp_err.h" #include "mpp_mem.h" #include "mpp_env.h" +#include "mpp_debug.h" #include "mpp_platform.h" #include "hal_mpg4d_api.h" diff --git a/mpp/hal/vpu/mpg4d/hal_m4vd_com.c b/mpp/hal/vpu/mpg4d/hal_m4vd_com.c index 621e3cc4..0c8af61b 100644 --- a/mpp/hal/vpu/mpg4d/hal_m4vd_com.c +++ b/mpp/hal/vpu/mpg4d/hal_m4vd_com.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "mpp_log.h" +#include "mpp_debug.h" #include "hal_m4vd_com.h" RK_U8 default_intra_matrix[64] = { diff --git a/mpp/hal/vpu/mpg4d/hal_m4vd_vdpu1.c b/mpp/hal/vpu/mpg4d/hal_m4vd_vdpu1.c index 9338ca7c..522b13dc 100644 --- a/mpp/hal/vpu/mpg4d/hal_m4vd_vdpu1.c +++ b/mpp/hal/vpu/mpg4d/hal_m4vd_vdpu1.c @@ -19,9 +19,9 @@ #include #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" +#include "mpp_debug.h" #include "mpp_buffer.h" #include "mpp_common.h" diff --git a/mpp/hal/vpu/mpg4d/hal_m4vd_vdpu2.c b/mpp/hal/vpu/mpg4d/hal_m4vd_vdpu2.c index 97ec1614..ba82aa6d 100644 --- a/mpp/hal/vpu/mpg4d/hal_m4vd_vdpu2.c +++ b/mpp/hal/vpu/mpg4d/hal_m4vd_vdpu2.c @@ -19,9 +19,9 @@ #include #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" +#include "mpp_debug.h" #include "mpp_buffer.h" #include "mpp_common.h" diff --git a/mpp/hal/vpu/vp8d/hal_vp8d_vdpu1.c b/mpp/hal/vpu/vp8d/hal_vp8d_vdpu1.c index 34f28066..0cd506d8 100644 --- a/mpp/hal/vpu/vp8d/hal_vp8d_vdpu1.c +++ b/mpp/hal/vpu/vp8d/hal_vp8d_vdpu1.c @@ -15,11 +15,12 @@ */ #define MODULE_TAG "hal_vp8d_vdpu1" + #include -#include "mpp_log.h" #include "mpp_env.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "hal_vp8d_vdpu1.h" #include "hal_vp8d_vdpu1_reg.h" diff --git a/mpp/hal/vpu/vp8d/hal_vp8d_vdpu2.c b/mpp/hal/vpu/vp8d/hal_vp8d_vdpu2.c index 9370a3fa..881eff30 100644 --- a/mpp/hal/vpu/vp8d/hal_vp8d_vdpu2.c +++ b/mpp/hal/vpu/vp8d/hal_vp8d_vdpu2.c @@ -15,11 +15,12 @@ */ #define MODULE_TAG "hal_vp8d_vdpu2" + #include -#include "mpp_log.h" #include "mpp_env.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "hal_vp8d_vdpu2.h" #include "hal_vp8d_vdpu2_reg.h" diff --git a/mpp/hal/vpu/vp8e/hal_vp8e_api_v2.c b/mpp/hal/vpu/vp8e/hal_vp8e_api_v2.c index 24a06658..f5bb973f 100644 --- a/mpp/hal/vpu/vp8e/hal_vp8e_api_v2.c +++ b/mpp/hal/vpu/vp8e/hal_vp8e_api_v2.c @@ -19,7 +19,6 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_common.h" diff --git a/mpp/hal/vpu/vp8e/hal_vp8e_base.c b/mpp/hal/vpu/vp8e/hal_vp8e_base.c index eb6e1a2c..cba8da93 100644 --- a/mpp/hal/vpu/vp8e/hal_vp8e_base.c +++ b/mpp/hal/vpu/vp8e/hal_vp8e_base.c @@ -18,7 +18,6 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_buffer.h" #include "mpp_common.h" diff --git a/mpp/hal/vpu/vp8e/hal_vp8e_debug.h b/mpp/hal/vpu/vp8e/hal_vp8e_debug.h index 93190130..2b9e28c4 100644 --- a/mpp/hal/vpu/vp8e/hal_vp8e_debug.h +++ b/mpp/hal/vpu/vp8e/hal_vp8e_debug.h @@ -17,7 +17,7 @@ #ifndef __HAL_VP8E_DEBUG_H__ #define __HAL_VP8E_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define VP8E_DBG_HAL_FUNCTION (0x00000001) #define VP8E_DBG_HAL_REG (0x00000002) diff --git a/mpp/legacy/rk_list.cpp b/mpp/legacy/rk_list.cpp index 54f30744..3513c13f 100644 --- a/mpp/legacy/rk_list.cpp +++ b/mpp/legacy/rk_list.cpp @@ -1,8 +1,12 @@ -#define ALOG_TAG "RK_LIST" -#include "rk_list.h" -#include +#define ALOG_TAG "rk_list" + #include #include +#include + +#include "rk_list.h" +#include "mpp_log.h" + //#define _RK_LIST_DEUBG #define _RK_LIST_ERROR diff --git a/mpp/legacy/vpu.c b/mpp/legacy/vpu.c index 2352e4b8..7d951a62 100644 --- a/mpp/legacy/vpu.c +++ b/mpp/legacy/vpu.c @@ -25,7 +25,7 @@ #include "rk_mpi.h" #include "mpp_env.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_platform.h" diff --git a/mpp/legacy/vpu_api.cpp b/mpp/legacy/vpu_api.cpp index 0dd5e23f..4aaf31b9 100644 --- a/mpp/legacy/vpu_api.cpp +++ b/mpp/legacy/vpu_api.cpp @@ -20,9 +20,9 @@ #include #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_soc.h" diff --git a/mpp/legacy/vpu_api_legacy.cpp b/mpp/legacy/vpu_api_legacy.cpp index 9487a042..5a11807f 100644 --- a/mpp/legacy/vpu_api_legacy.cpp +++ b/mpp/legacy/vpu_api_legacy.cpp @@ -19,10 +19,10 @@ #include #include "string.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "vpu_api_legacy.h" diff --git a/mpp/legacy/vpu_api_mlvec.cpp b/mpp/legacy/vpu_api_mlvec.cpp index f7d4968e..e71922fd 100644 --- a/mpp/legacy/vpu_api_mlvec.cpp +++ b/mpp/legacy/vpu_api_mlvec.cpp @@ -19,8 +19,8 @@ #include #include "string.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "vpu_api_mlvec.h" diff --git a/mpp/legacy/vpu_mem_legacy.c b/mpp/legacy/vpu_mem_legacy.c index 536dd869..fb9a6046 100644 --- a/mpp/legacy/vpu_mem_legacy.c +++ b/mpp/legacy/vpu_mem_legacy.c @@ -15,10 +15,10 @@ */ #include -#include "mpp_log.h" + #include "mpp_mem.h" #include "mpp_env.h" - +#include "mpp_debug.h" #include "mpp_buffer.h" #include "vpu.h" diff --git a/mpp/mpi.cpp b/mpp/mpi.cpp index c48e916d..ad6a17aa 100644 --- a/mpp/mpi.cpp +++ b/mpp/mpi.cpp @@ -20,13 +20,13 @@ #include "rk_mpi.h" -#include "mpp_log.h" +#include "mpp_env.h" #include "mpp_mem.h" +#include "mpp_debug.h" +#include "mpp_common.h" #include "mpi_impl.h" #include "mpp_info.h" -#include "mpp_common.h" -#include "mpp_env.h" RK_U32 mpi_debug = 0; @@ -432,6 +432,7 @@ static MppApi mpp_api = { MPP_RET mpp_create(MppCtx *ctx, MppApi **mpi) { mpp_env_get_u32("mpi_debug", &mpi_debug, 0); + mpp_get_log_level(); if (NULL == ctx || NULL == mpi) { mpp_err_f("invalid input ctx %p mpi %p\n", ctx, mpi); diff --git a/mpp/mpp.cpp b/mpp/mpp.cpp index b279a999..a0c514f3 100644 --- a/mpp/mpp.cpp +++ b/mpp/mpp.cpp @@ -21,12 +21,12 @@ #include "rk_mpi.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_env.h" #include "mpp_time.h" #include "mpp_impl.h" #include "mpp_2str.h" +#include "mpp_debug.h" #include "mpp.h" #include "mpp_hal.h" diff --git a/mpp/mpp_impl.cpp b/mpp/mpp_impl.cpp index 8210f062..94680af3 100644 --- a/mpp/mpp_impl.cpp +++ b/mpp/mpp_impl.cpp @@ -25,9 +25,9 @@ #include "rk_mpi_cmd.h" #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_thread.h" #include "mpp_common.h" @@ -122,7 +122,7 @@ static FILE *try_env_file(const char *env, const char *path, pid_t tid) mpp_env_get_str(env, &fname, path); if (fname == path) { - snprintf(name, sizeof(name), "%s-%d", path, tid); + snprintf(name, sizeof(name) - 1, "%s-%d", path, tid); fname = name; } diff --git a/mpp/vproc/iep/iep.cpp b/mpp/vproc/iep/iep.cpp index 41526986..5bdc173b 100644 --- a/mpp/vproc/iep/iep.cpp +++ b/mpp/vproc/iep/iep.cpp @@ -21,8 +21,8 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "iep_api.h" diff --git a/mpp/vproc/iep/test/iep_test.cpp b/mpp/vproc/iep/test/iep_test.cpp index 5d85f8fe..e212a488 100644 --- a/mpp/vproc/iep/test/iep_test.cpp +++ b/mpp/vproc/iep/test/iep_test.cpp @@ -18,9 +18,9 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_thread.h" #include "mpp_buffer.h" @@ -475,12 +475,12 @@ int main(int argc, char **argv) } break; case 'f': { mpp_log("input filename: %s\n", optarg); - strncpy(cfg.src_url, optarg, sizeof(cfg.src_url)); + strncpy(cfg.src_url, optarg, sizeof(cfg.src_url) - 1); cfg.fp_src = fopen(cfg.src_url, "rb"); } break; case 'F': { mpp_log("output filename: %s\n", optarg); - strncpy(cfg.dst_url, optarg, sizeof(cfg.dst_url)); + strncpy(cfg.dst_url, optarg, sizeof(cfg.dst_url) - 1); cfg.fp_dst = fopen(cfg.dst_url, "w+b"); } break; case 'm': { @@ -497,7 +497,7 @@ int main(int argc, char **argv) } break; case 'x': { mpp_log("configure filename: %s\n", optarg); - strncpy(cfg.cfg_url, optarg, sizeof(cfg.cfg_url)); + strncpy(cfg.cfg_url, optarg, sizeof(cfg.cfg_url) - 1); cfg.ini = iniparser_load(cfg.cfg_url); if (cfg.ini) parse_cfg(&cfg); diff --git a/mpp/vproc/iep2/iep2.c b/mpp/vproc/iep2/iep2.c index 4ac80309..121b4cda 100644 --- a/mpp/vproc/iep2/iep2.c +++ b/mpp/vproc/iep2/iep2.c @@ -24,9 +24,9 @@ #include #include -#include "mpp_log.h" -#include "mpp_buffer.h" #include "mpp_env.h" +#include "mpp_debug.h" +#include "mpp_buffer.h" #include "iep2_ff.h" #include "iep2_pd.h" diff --git a/mpp/vproc/iep2/iep2_ff.c b/mpp/vproc/iep2/iep2_ff.c index c74bfbb3..5eac326b 100644 --- a/mpp/vproc/iep2/iep2_ff.c +++ b/mpp/vproc/iep2/iep2_ff.c @@ -14,11 +14,12 @@ * limitations under the License. */ +#define MODULE_TAG "iep2" + #include #include #include -#include "mpp_log.h" #include "mpp_common.h" #include "iep2.h" diff --git a/mpp/vproc/iep2/iep2_gmv.c b/mpp/vproc/iep2/iep2_gmv.c index 3a443251..6e1ae438 100644 --- a/mpp/vproc/iep2/iep2_gmv.c +++ b/mpp/vproc/iep2/iep2_gmv.c @@ -14,15 +14,16 @@ * limitations under the License. */ -#include "iep2_gmv.h" +#define MODULE_TAG "iep2" #include #include #include #include "mpp_common.h" -#include "mpp_log.h" + #include "iep2_api.h" +#include "iep2_gmv.h" static void iep2_sort(uint32_t bin[], int map[], int size) { diff --git a/mpp/vproc/iep2/iep2_osd.c b/mpp/vproc/iep2/iep2_osd.c index dcac4300..dab19e44 100644 --- a/mpp/vproc/iep2/iep2_osd.c +++ b/mpp/vproc/iep2/iep2_osd.c @@ -20,7 +20,6 @@ #include #include -#include "mpp_log.h" #include "mpp_common.h" #include "mpp_buffer.h" diff --git a/mpp/vproc/iep2/iep2_pd.c b/mpp/vproc/iep2/iep2_pd.c index 5c27cc45..21774151 100644 --- a/mpp/vproc/iep2/iep2_pd.c +++ b/mpp/vproc/iep2/iep2_pd.c @@ -24,7 +24,6 @@ #include #include "mpp_common.h" -#include "mpp_log.h" #include "iep_common.h" #include "iep2.h" diff --git a/mpp/vproc/iep2/test/iep2_test.c b/mpp/vproc/iep2/test/iep2_test.c index 1706921f..0bfd4e35 100644 --- a/mpp/vproc/iep2/test/iep2_test.c +++ b/mpp/vproc/iep2/test/iep2_test.c @@ -18,9 +18,9 @@ #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_thread.h" #include "mpp_buffer.h" @@ -388,17 +388,17 @@ int main(int argc, char **argv) } break; case 'i': { mpp_log("input filename: %s\n", optarg); - strncpy(cfg.src_url, optarg, sizeof(cfg.src_url)); + strncpy(cfg.src_url, optarg, sizeof(cfg.src_url) - 1); cfg.fp_src = fopen(cfg.src_url, "rb"); } break; case 'o': { mpp_log("output filename: %s\n", optarg); - strncpy(cfg.dst_url, optarg, sizeof(cfg.dst_url)); + strncpy(cfg.dst_url, optarg, sizeof(cfg.dst_url) - 1); cfg.fp_dst = fopen(cfg.dst_url, "w+b"); } break; case 'v': { mpp_log("verify file: %s\n", optarg); - strncpy(cfg.slt_url, optarg, sizeof(cfg.slt_url)); + strncpy(cfg.slt_url, optarg, sizeof(cfg.slt_url) - 1); cfg.fp_slt = fopen(cfg.slt_url, "w+b"); } break; case 'f': { diff --git a/mpp/vproc/inc/iep_common.h b/mpp/vproc/inc/iep_common.h index 06be2c16..65d1efa2 100644 --- a/mpp/vproc/inc/iep_common.h +++ b/mpp/vproc/inc/iep_common.h @@ -17,8 +17,7 @@ #ifndef __IEP_COMMON_H__ #define __IEP_COMMON_H__ -#include "rk_type.h" -#include "mpp_err.h" +#include "mpp_debug.h" #define IEP_DBG_FUNCTION (0x00000001) #define IEP_DBG_TRACE (0x00000002) diff --git a/mpp/vproc/rga/rga.cpp b/mpp/vproc/rga/rga.cpp index 8e05c4df..b4e817f6 100755 --- a/mpp/vproc/rga/rga.cpp +++ b/mpp/vproc/rga/rga.cpp @@ -23,7 +23,7 @@ #include #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "rga.h" diff --git a/mpp/vproc/rga/test/rga_test.cpp b/mpp/vproc/rga/test/rga_test.cpp index 5c17bf7a..736a5827 100644 --- a/mpp/vproc/rga/test/rga_test.cpp +++ b/mpp/vproc/rga/test/rga_test.cpp @@ -16,7 +16,6 @@ #include -#include "rk_type.h" #include "mpp_log.h" #include "mpp_frame.h" #include "mpp_common.h" @@ -79,7 +78,7 @@ static RK_S32 rga_test_parse_options(int argc, char **argv, RgaTestCmd *cmd) switch (*opt) { case 'i' : if (next) { - strncpy(cmd->input_file, next, MAX_NAME_LENGTH); + strncpy(cmd->input_file, next, MAX_NAME_LENGTH - 1); cmd->input_file[strlen(next)] = '\0'; cmd->have_input = 1; } else { @@ -89,7 +88,7 @@ static RK_S32 rga_test_parse_options(int argc, char **argv, RgaTestCmd *cmd) break; case 'o' : if (next) { - strncpy(cmd->output_file, next, MAX_NAME_LENGTH); + strncpy(cmd->output_file, next, MAX_NAME_LENGTH - 1); cmd->output_file[strlen(next)] = '\0'; cmd->have_output = 1; } else { diff --git a/osal/allocator/allocator_drm.c b/osal/allocator/allocator_drm.c index 3bdb041c..145b1675 100644 --- a/osal/allocator/allocator_drm.c +++ b/osal/allocator/allocator_drm.c @@ -31,7 +31,7 @@ #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_runtime.h" diff --git a/osal/allocator/allocator_ext_dma.c b/osal/allocator/allocator_ext_dma.c index f5a48ed1..92223b6e 100644 --- a/osal/allocator/allocator_ext_dma.c +++ b/osal/allocator/allocator_ext_dma.c @@ -18,8 +18,7 @@ #include #include "mpp_mem.h" -#include "mpp_log.h" -#include "os_mem.h" +#include "mpp_debug.h" #include "allocator_ext_dma.h" diff --git a/osal/allocator/allocator_ion.c b/osal/allocator/allocator_ion.c index 559eaea1..b6d3b6e2 100755 --- a/osal/allocator/allocator_ion.c +++ b/osal/allocator/allocator_ion.c @@ -34,7 +34,7 @@ #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_thread.h" diff --git a/osal/allocator/allocator_std.c b/osal/allocator/allocator_std.c index 4a048d3a..d703fafa 100644 --- a/osal/allocator/allocator_std.c +++ b/osal/allocator/allocator_std.c @@ -18,7 +18,7 @@ #include "os_mem.h" #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "allocator_std.h" diff --git a/osal/android/os_env.c b/osal/android/os_env.c index b06fff6f..0cf044f0 100644 --- a/osal/android/os_env.c +++ b/osal/android/os_env.c @@ -64,7 +64,7 @@ RK_S32 os_get_env_str(const char *name, const char **value, const char *default_ RK_S32 os_set_env_u32(const char *name, RK_U32 value) { char buf[PROP_VALUE_MAX + 1 + 2]; - snprintf(buf, sizeof(buf), "0x%x", value); + snprintf(buf, sizeof(buf) - 1, "0x%x", value); int len = __system_property_set(name, buf); return (len) ? (0) : (-1); } diff --git a/osal/android/os_log.c b/osal/android/os_log.c index 546faaf2..9346cae5 100644 --- a/osal/android/os_log.c +++ b/osal/android/os_log.c @@ -17,13 +17,34 @@ #if defined(__ANDROID__) #include -void os_log(const char* tag, const char* msg, va_list list) +void os_log_trace(const char* tag, const char* msg, va_list list) +{ + __android_log_vprint(ANDROID_LOG_VERBOSE, tag, msg, list); +} + +void os_log_debug(const char* tag, const char* msg, va_list list) +{ + __android_log_vprint(ANDROID_LOG_DEBUG, tag, msg, list); +} + +void os_log_info(const char* tag, const char* msg, va_list list) { __android_log_vprint(ANDROID_LOG_INFO, tag, msg, list); } -void os_err(const char* tag, const char* msg, va_list list) +void os_log_warn(const char* tag, const char* msg, va_list list) +{ + __android_log_vprint(ANDROID_LOG_WARN, tag, msg, list); +} + +void os_log_error(const char* tag, const char* msg, va_list list) { __android_log_vprint(ANDROID_LOG_ERROR, tag, msg, list); } + +void os_log_fatal(const char* tag, const char* msg, va_list list) +{ + __android_log_vprint(ANDROID_LOG_FATAL, tag, msg, list); +} + #endif diff --git a/osal/driver/inc/mpp_device_debug.h b/osal/driver/inc/mpp_device_debug.h index 289cda49..1f018e0b 100644 --- a/osal/driver/inc/mpp_device_debug.h +++ b/osal/driver/inc/mpp_device_debug.h @@ -17,7 +17,7 @@ #ifndef __MPP_DEVICE_DEBUG_H__ #define __MPP_DEVICE_DEBUG_H__ -#include "mpp_log.h" +#include "mpp_debug.h" #define MPP_DEVICE_DBG_FUNC (0x00000001) #define MPP_DEVICE_DBG_PROBE (0x00000002) diff --git a/osal/driver/mpp_device.c b/osal/driver/mpp_device.c index c0963b82..83d1f04b 100644 --- a/osal/driver/mpp_device.c +++ b/osal/driver/mpp_device.c @@ -19,7 +19,6 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_common.h" diff --git a/osal/driver/mpp_server.cpp b/osal/driver/mpp_server.cpp index 9edd2132..7a2809ea 100644 --- a/osal/driver/mpp_server.cpp +++ b/osal/driver/mpp_server.cpp @@ -21,7 +21,6 @@ #include #include -#include "mpp_log.h" #include "mpp_env.h" #include "mpp_list.h" #include "mpp_time.h" diff --git a/osal/driver/mpp_service.c b/osal/driver/mpp_service.c index b60e1c3c..6eec3cbc 100644 --- a/osal/driver/mpp_service.c +++ b/osal/driver/mpp_service.c @@ -21,9 +21,9 @@ #include #include -#include "mpp_log.h" #include "mpp_env.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "osal_2str.h" diff --git a/osal/driver/vcodec_service.c b/osal/driver/vcodec_service.c index c56d733e..1815fe54 100644 --- a/osal/driver/vcodec_service.c +++ b/osal/driver/vcodec_service.c @@ -23,10 +23,10 @@ #include #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_time.h" #include "mpp_list.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "vpu.h" diff --git a/osal/inc/mpp_log.h b/osal/inc/mpp_debug.h similarity index 66% rename from osal/inc/mpp_log.h rename to osal/inc/mpp_debug.h index 3c30942e..5ed55c2e 100644 --- a/osal/inc/mpp_log.h +++ b/osal/inc/mpp_debug.h @@ -1,5 +1,5 @@ /* - * Copyright 2015 Rockchip Electronics Co. LTD + * Copyright 2022 Rockchip Electronics Co. LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,45 +14,14 @@ * limitations under the License. */ -#ifndef __MPP_LOG_H__ -#define __MPP_LOG_H__ +#ifndef __MPP_DEBUG_H__ +#define __MPP_DEBUG_H__ -#include #include #include "rk_type.h" - -/* - * mpp runtime log system usage: - * mpp_err is for error status message, it will print for sure. - * mpp_log is for important message like open/close/reset/flush, it will print too. - * mpp_dbg is for all optional message. it can be controlled by debug and flag. - */ - -#define mpp_log(fmt, ...) _mpp_log(MODULE_TAG, fmt, NULL, ## __VA_ARGS__) -#define mpp_err(fmt, ...) _mpp_err(MODULE_TAG, fmt, NULL, ## __VA_ARGS__) - -#define _mpp_dbg(debug, flag, fmt, ...) \ - do { \ - if (debug & flag) \ - mpp_log(fmt, ## __VA_ARGS__); \ - } while (0) - -#define mpp_dbg(flag, fmt, ...) _mpp_dbg(mpp_debug, flag, fmt, ## __VA_ARGS__) - -/* - * _f function will add function name to the log - */ -#define mpp_log_f(fmt, ...) _mpp_log(MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) -#define mpp_err_f(fmt, ...) _mpp_err(MODULE_TAG, fmt, __FUNCTION__, ## __VA_ARGS__) -#define _mpp_dbg_f(debug, flag, fmt, ...) \ - do { \ - if (debug & flag) \ - mpp_log_f(fmt, ## __VA_ARGS__); \ - } while (0) - -#define mpp_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpp_debug, flag, fmt, ## __VA_ARGS__) - +#include "mpp_err.h" +#include "mpp_log.h" #define MPP_DBG_TIMING (0x00000001) #define MPP_DBG_PTS (0x00000002) @@ -64,6 +33,12 @@ #define MPP_DBG_DUMP_OUT (0x00000400) #define MPP_DBG_DUMP_CFG (0x00000800) +#define _mpp_dbg(debug, flag, fmt, ...) mpp_log_c((debug) & (flag), fmt, ## __VA_ARGS__) +#define _mpp_dbg_f(debug, flag, fmt, ...) mpp_log_cf((debug) & (flag), fmt, ## __VA_ARGS__) + +#define mpp_dbg(flag, fmt, ...) _mpp_dbg(mpp_debug, flag, fmt, ## __VA_ARGS__) +#define mpp_dbg_f(flag, fmt, ...) _mpp_dbg_f(mpp_debug, flag, fmt, ## __VA_ARGS__) + #define mpp_dbg_pts(fmt, ...) mpp_dbg(MPP_DBG_PTS, fmt, ## __VA_ARGS__) #define mpp_dbg_info(fmt, ...) mpp_dbg(MPP_DBG_INFO, fmt, ## __VA_ARGS__) #define mpp_dbg_platform(fmt, ...) mpp_dbg(MPP_DBG_PLATFORM, fmt, ## __VA_ARGS__) @@ -125,14 +100,8 @@ extern "C" { extern RK_U32 mpp_debug; -void mpp_log_enable(RK_S32 id); -void mpp_log_disable(RK_S32 id); - -void _mpp_log(const char *tag, const char *fmt, const char *func, ...); -void _mpp_err(const char *tag, const char *fmt, const char *func, ...); - #ifdef __cplusplus } #endif -#endif /*__MPP_LOG_H__*/ +#endif /*__MPP_DEBUG_H__*/ diff --git a/osal/inc/mpp_thread.h b/osal/inc/mpp_thread.h index 379b8722..fa0cb5fa 100644 --- a/osal/inc/mpp_thread.h +++ b/osal/inc/mpp_thread.h @@ -65,7 +65,7 @@ typedef enum { #ifdef __cplusplus -#include "mpp_log.h" +#include "mpp_debug.h" class Mutex; class Condition; diff --git a/osal/linux/os_env.c b/osal/linux/os_env.c index 96e68d5c..a0cac63a 100644 --- a/osal/linux/os_env.c +++ b/osal/linux/os_env.c @@ -52,7 +52,7 @@ RK_S32 os_get_env_str(const char *name, const char **value, const char *default_ RK_S32 os_set_env_u32(const char *name, RK_U32 value) { char buf[ENV_BUF_SIZE_LINUX]; - snprintf(buf, sizeof(buf), "%u", value); + snprintf(buf, sizeof(buf) - 1, "%u", value); return setenv(name, buf, 1); } diff --git a/osal/linux/os_log.cpp b/osal/linux/os_log.cpp index 4844ae68..35cf1e88 100644 --- a/osal/linux/os_log.cpp +++ b/osal/linux/os_log.cpp @@ -54,18 +54,46 @@ SyslogWrapper::~SyslogWrapper() closelog(); } -void os_log(const char* tag, const char* msg, va_list list) +void os_log_trace(const char* tag, const char* msg, va_list list) { char line[LINE_SZ] = {0}; - snprintf(line, sizeof(line), "%s: %s", tag, msg); + snprintf(line, sizeof(line) - 1, "%s: %s", tag, msg); + vsyslog(LOG_NOTICE, line, list); +} + +void os_log_debug(const char* tag, const char* msg, va_list list) +{ + char line[LINE_SZ] = {0}; + snprintf(line, sizeof(line) - 1, "%s: %s", tag, msg); + vsyslog(LOG_DEBUG, line, list); +} + +void os_log_info(const char* tag, const char* msg, va_list list) +{ + char line[LINE_SZ] = {0}; + snprintf(line, sizeof(line) - 1, "%s: %s", tag, msg); vsyslog(LOG_INFO, line, list); } -void os_err(const char* tag, const char* msg, va_list list) +void os_log_warn(const char* tag, const char* msg, va_list list) { char line[LINE_SZ] = {0}; - snprintf(line, sizeof(line), "%s: %s", tag, msg); + snprintf(line, sizeof(line) - 1, "%s: %s", tag, msg); + vsyslog(LOG_WARNING, line, list); +} + +void os_log_error(const char* tag, const char* msg, va_list list) +{ + char line[LINE_SZ] = {0}; + snprintf(line, sizeof(line) - 1, "%s: %s", tag, msg); vsyslog(LOG_ERR, line, list); } +void os_log_fatal(const char* tag, const char* msg, va_list list) +{ + char line[LINE_SZ] = {0}; + snprintf(line, sizeof(line) - 1, "%s: %s", tag, msg); + vsyslog(LOG_CRIT, line, list); +} + #endif diff --git a/osal/mpp_allocator.cpp b/osal/mpp_allocator.cpp index dc3ff450..b1895484 100644 --- a/osal/mpp_allocator.cpp +++ b/osal/mpp_allocator.cpp @@ -16,8 +16,8 @@ #define MODULE_TAG "mpp_allocator" -#include "mpp_log.h" #include "mpp_mem.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_allocator.h" #include "mpp_allocator_impl.h" diff --git a/osal/mpp_compat.cpp b/osal/mpp_compat.cpp index bde7b7ec..f72ea056 100644 --- a/osal/mpp_compat.cpp +++ b/osal/mpp_compat.cpp @@ -16,7 +16,7 @@ #define MODULE_TAG "mpp_compat" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_compat.h" diff --git a/osal/mpp_log.cpp b/osal/mpp_log.cpp index 68b51c52..f9cec972 100644 --- a/osal/mpp_log.cpp +++ b/osal/mpp_log.cpp @@ -20,29 +20,26 @@ #include #include -#include "mpp_log.h" -#include "mpp_mem.h" +#include "mpp_env.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "os_log.h" #define MPP_LOG_MAX_LEN 256 -typedef void (*mpp_log_callback)(const char*, const char*, va_list); - - #ifdef __cplusplus extern "C" { #endif RK_U32 mpp_debug = 0; -static RK_U32 mpp_log_enabled = 1; // TODO: add log timing information and switch flag static const char *msg_log_warning = "log message is long\n"; static const char *msg_log_nothing = "\n"; +static int mpp_log_level = MPP_LOG_INFO; -static void __mpp_log(mpp_log_callback func, const char *tag, const char *fmt, +static void __mpp_log(os_log_callback func, const char *tag, const char *fmt, const char *fname, va_list args) { char msg[MPP_LOG_MAX_LEN + 1]; @@ -83,32 +80,78 @@ void _mpp_log(const char *tag, const char *fmt, const char *fname, ...) { va_list args; - if (!mpp_log_enabled) - return; + mpp_logw("warning: use new logx function\n"); va_start(args, fname); - __mpp_log(os_log, tag, fmt, fname, args); + __mpp_log(os_log_info, tag, fmt, fname, args); va_end(args); } void _mpp_err(const char *tag, const char *fmt, const char *fname, ...) { va_list args; + + mpp_logw("warning: use new logx function\n"); + va_start(args, fname); - __mpp_log(os_err, tag, fmt, fname, args); + __mpp_log(os_log_error, tag, fmt, fname, args); va_end(args); } -void mpp_log_enable(RK_S32 id) +void _mpp_log_l(int level, const char *tag, const char *fmt, const char *fname, ...) { - (void)id; - mpp_log_enabled = 1; + static os_log_callback log_func[] = { + NULL, /* MPP_LOG_DEFAULT */ + os_log_fatal, /* MPP_LOG_FATAL */ + os_log_error, /* MPP_LOG_ERROR */ + os_log_warn, /* MPP_LOG_WARN */ + os_log_info, /* MPP_LOG_INFO */ + os_log_debug, /* MPP_LOG_DEBUG */ + os_log_trace, /* MPP_LOG_VERBOSE */ + os_log_info, /* MPP_LOG_DEFAULT */ + }; + + va_list args; + int log_level; + + if (level <= MPP_LOG_UNKNOWN || level >= MPP_LOG_SILENT) + return; + + log_level = mpp_log_level; + if (log_level >= MPP_LOG_SILENT) + return; + + if (level > log_level) + return; + + va_start(args, fname); + __mpp_log(log_func[level], tag, fmt, fname, args); + va_end(args); } -void mpp_log_disable(RK_S32 id) +void mpp_set_log_level(int level) { - (void)id; - mpp_log_enabled = 0; + if (level <= MPP_LOG_UNKNOWN || level > MPP_LOG_SILENT) { + mpp_logw("log level should in range [%d : %d] invalid intput %d\n", + MPP_LOG_FATAL, MPP_LOG_SILENT, level); + level = MPP_LOG_INFO; + } + + mpp_log_level = level; +} + +int mpp_get_log_level(void) +{ + int level; + + mpp_env_get_u32("mpp_log_level", (RK_U32 *)&level, mpp_log_level); + + if (level <= MPP_LOG_UNKNOWN || level > MPP_LOG_SILENT) + level = MPP_LOG_INFO; + + mpp_log_level = level; + + return level; } #ifdef __cplusplus diff --git a/osal/mpp_mem.cpp b/osal/mpp_mem.cpp index 30540f5d..f7dc84cd 100644 --- a/osal/mpp_mem.cpp +++ b/osal/mpp_mem.cpp @@ -18,13 +18,10 @@ #include -#include "rk_type.h" -#include "mpp_err.h" - -#include "mpp_log.h" #include "mpp_env.h" #include "mpp_mem.h" #include "mpp_list.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "os_mem.h" diff --git a/osal/mpp_mem_pool.cpp b/osal/mpp_mem_pool.cpp index c430ae73..4d81c4cd 100644 --- a/osal/mpp_mem_pool.cpp +++ b/osal/mpp_mem_pool.cpp @@ -20,9 +20,9 @@ #include "mpp_err.h" #include "mpp_env.h" -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_list.h" +#include "mpp_debug.h" #include "mpp_mem_pool.h" diff --git a/osal/mpp_platform.cpp b/osal/mpp_platform.cpp index 6fec4faf..2aa29492 100644 --- a/osal/mpp_platform.cpp +++ b/osal/mpp_platform.cpp @@ -19,7 +19,7 @@ #include #include "mpp_env.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_platform.h" #include "mpp_service.h" diff --git a/osal/mpp_runtime.cpp b/osal/mpp_runtime.cpp index 63b2796f..78ea3f45 100644 --- a/osal/mpp_runtime.cpp +++ b/osal/mpp_runtime.cpp @@ -116,7 +116,7 @@ MppRuntimeService::MppRuntimeService() /* Detect hardware buffer type is ion or drm */ RK_U32 i, j; char path[MAX_DTS_PATH_LEN]; - RK_U32 path_len = MAX_DTS_PATH_LEN; + RK_U32 path_len = MAX_DTS_PATH_LEN - 1; RK_U32 dts_path_len = snprintf(path, path_len, "%s", mpp_dts_base); char *p = path + dts_path_len; RK_U32 allocator_found = 0; diff --git a/osal/mpp_soc.cpp b/osal/mpp_soc.cpp index 2056767f..654cf037 100644 --- a/osal/mpp_soc.cpp +++ b/osal/mpp_soc.cpp @@ -21,7 +21,7 @@ #include #include -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_soc.h" diff --git a/osal/mpp_thread.cpp b/osal/mpp_thread.cpp index 6c745c0a..9183a1dc 100644 --- a/osal/mpp_thread.cpp +++ b/osal/mpp_thread.cpp @@ -38,9 +38,9 @@ MppThread::MppThread(MppThreadFunc func, void *ctx, const char *name) mStatus[THREAD_CONTROL] = MPP_THREAD_RUNNING; if (name) - strncpy(mName, name, sizeof(mName)); + strncpy(mName, name, sizeof(mName) - 1); else - snprintf(mName, sizeof(mName), "mpp_thread"); + snprintf(mName, sizeof(mName) - 1, "mpp_thread"); } MppThreadStatus MppThread::get_status(MppThreadSignal id) diff --git a/osal/mpp_time.cpp b/osal/mpp_time.cpp index 74856ece..26362023 100644 --- a/osal/mpp_time.cpp +++ b/osal/mpp_time.cpp @@ -21,9 +21,9 @@ #include #include -#include "mpp_log.h" #include "mpp_mem.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "mpp_thread.h" @@ -84,7 +84,7 @@ MppClock mpp_clock_get(const char *name) MppClockImpl *impl = mpp_calloc(MppClockImpl, 1); if (impl) { impl->check = clock_name; - snprintf(impl->name, sizeof(impl->name), name, NULL); + snprintf(impl->name, sizeof(impl->name) - 1, name, NULL); } else mpp_err_f("malloc failed\n"); @@ -307,7 +307,7 @@ MppTimer mpp_timer_get(const char *name) impl->initial = 1000; impl->interval = 1000; impl->check = timer_name; - snprintf(impl->name, sizeof(impl->name), name, NULL); + snprintf(impl->name, sizeof(impl->name) - 1, name, NULL); return impl; } while (0); diff --git a/osal/os_log.h b/osal/os_log.h index 98dfdda1..e8239c33 100644 --- a/osal/os_log.h +++ b/osal/os_log.h @@ -24,12 +24,18 @@ #ifndef __OS_LOG_H__ #define __OS_LOG_H__ +typedef void (*os_log_callback)(const char*, const char*, va_list); + #ifdef __cplusplus extern "C" { #endif -void os_log(const char* tag, const char* msg, va_list list); -void os_err(const char* tag, const char* msg, va_list list); +void os_log_trace(const char* tag, const char* msg, va_list list); +void os_log_debug(const char* tag, const char* msg, va_list list); +void os_log_info (const char* tag, const char* msg, va_list list); +void os_log_warn (const char* tag, const char* msg, va_list list); +void os_log_error(const char* tag, const char* msg, va_list list); +void os_log_fatal(const char* tag, const char* msg, va_list list); #ifdef __cplusplus } diff --git a/osal/test/mpp_env_test.c b/osal/test/mpp_env_test.c index 29721cfd..28bb5b32 100644 --- a/osal/test/mpp_env_test.c +++ b/osal/test/mpp_env_test.c @@ -15,6 +15,7 @@ */ #define MODULE_TAG "mpp_env_test" + #include "mpp_env.h" #include "mpp_log.h" diff --git a/osal/test/mpp_log_test.c b/osal/test/mpp_log_test.c index 65f0ab4c..a99433fa 100644 --- a/osal/test/mpp_log_test.c +++ b/osal/test/mpp_log_test.c @@ -20,22 +20,112 @@ int main() { + mpp_logi("mpp log test start\n"); - mpp_err("mpp log test start\n"); + mpp_set_log_level(MPP_LOG_INFO); + mpp_logi("\nset log level to MPP_LOG_VERBOSE\n"); + mpp_set_log_level(MPP_LOG_VERBOSE); - mpp_err_f("log_f test\n"); + mpp_logf("test mpp_logf\n"); + mpp_loge("test mpp_loge\n"); + mpp_logw("test mpp_logw\n"); + mpp_logi("test mpp_logi\n"); + mpp_logd("test mpp_logd\n"); + mpp_logv("test mpp_logv\n"); - mpp_log("log disabled\n"); + mpp_set_log_level(MPP_LOG_INFO); + mpp_logi("\nset log level to MPP_LOG_DEBUG\n"); + mpp_set_log_level(MPP_LOG_DEBUG); - mpp_log_disable(1); + mpp_logf("test mpp_logf\n"); + mpp_loge("test mpp_loge\n"); + mpp_logw("test mpp_logw\n"); + mpp_logi("test mpp_logi\n"); + mpp_logd("test mpp_logd\n"); + mpp_logv("test mpp_logv\n"); - mpp_log("nothing should be show here\n"); + mpp_set_log_level(MPP_LOG_INFO); + mpp_logi("\nset log level to MPP_LOG_INFO\n"); + mpp_set_log_level(MPP_LOG_INFO); - mpp_log_enable(1); + mpp_logf("test mpp_logf\n"); + mpp_loge("test mpp_loge\n"); + mpp_logw("test mpp_logw\n"); + mpp_logi("test mpp_logi\n"); + mpp_logd("test mpp_logd\n"); + mpp_logv("test mpp_logv\n"); - mpp_log("log enabled\n"); + mpp_set_log_level(MPP_LOG_INFO); + mpp_logi("\nset log level to MPP_LOG_WARN\n"); + mpp_set_log_level(MPP_LOG_WARN); - mpp_err("mpp log test done\n"); + mpp_logf("test mpp_logf\n"); + mpp_loge("test mpp_loge\n"); + mpp_logw("test mpp_logw\n"); + mpp_logi("test mpp_logi\n"); + mpp_logd("test mpp_logd\n"); + mpp_logv("test mpp_logv\n"); + + mpp_set_log_level(MPP_LOG_INFO); + mpp_logi("\nset log level to MPP_LOG_ERROR\n"); + mpp_set_log_level(MPP_LOG_ERROR); + + mpp_logf("test mpp_logf\n"); + mpp_loge("test mpp_loge\n"); + mpp_logw("test mpp_logw\n"); + mpp_logi("test mpp_logi\n"); + mpp_logd("test mpp_logd\n"); + mpp_logv("test mpp_logv\n"); + + mpp_set_log_level(MPP_LOG_INFO); + mpp_logi("\nset log level to MPP_LOG_FATAL\n"); + mpp_set_log_level(MPP_LOG_FATAL); + + mpp_logf("test mpp_logf\n"); + mpp_loge("test mpp_loge\n"); + mpp_logw("test mpp_logw\n"); + mpp_logi("test mpp_logi\n"); + mpp_logd("test mpp_logd\n"); + mpp_logv("test mpp_logv\n"); + + mpp_set_log_level(MPP_LOG_INFO); + mpp_logi("\nset log level to MPP_LOG_SILENT\n"); + mpp_set_log_level(MPP_LOG_SILENT); + + mpp_logf("test mpp_logf\n"); + mpp_loge("test mpp_loge\n"); + mpp_logw("test mpp_logw\n"); + mpp_logi("test mpp_logi\n"); + mpp_logd("test mpp_logd\n"); + mpp_logv("test mpp_logv\n"); + + mpp_set_log_level(MPP_LOG_INFO); + mpp_logi("\nchange MODULE_TAG to log_test\n"); + +#undef MODULE_TAG +#define MODULE_TAG "log_test" + + mpp_logi("\nlog with tag changed to log_test\n"); + +#undef MODULE_TAG +#define MODULE_TAG "mpp_log_test" + + mpp_logi("\ndeprecated function test\n"); + + mpp_log("call mpp_log -- info log\n"); + mpp_log_f("call mpp_log_f -- info log with function name\n"); + + mpp_log("\n"); + + mpp_err("call mpp_err -- error log\n"); + mpp_err_f("call mpp_err_f -- error log with function name\n"); + + mpp_logi("\ndeprecated function log\n"); + + _mpp_log(MODULE_TAG, "log test", "_mpp_log"); + _mpp_err(MODULE_TAG, "log test", "_mpp_err"); + + mpp_log("\nmpp log test done\n"); return 0; } diff --git a/osal/test/mpp_thread_test.c b/osal/test/mpp_thread_test.c index 9f1a0dd6..d74643ca 100644 --- a/osal/test/mpp_thread_test.c +++ b/osal/test/mpp_thread_test.c @@ -22,7 +22,7 @@ #include "rk_type.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_thread.h" #include "mpp_time.h" diff --git a/osal/windows/os_log.c b/osal/windows/os_log.c index 0e2b7ba9..b338e916 100644 --- a/osal/windows/os_log.c +++ b/osal/windows/os_log.c @@ -20,18 +20,38 @@ #define LINE_SZ 1024 -void os_log(const char* tag, const char* msg, va_list list) +void os_log_info(const char* tag, const char* msg, va_list list) { char line[LINE_SZ] = {0}; _snprintf(line, sizeof(line), "%s: %s", tag, msg); vfprintf(stdout, line, list); } -void os_err(const char* tag, const char* msg, va_list list) +void os_log_error(const char* tag, const char* msg, va_list list) { char line[LINE_SZ] = {0}; _snprintf(line, sizeof(line), "%s: %s", tag, msg); vfprintf(stderr, line, list); } +void os_log_trace(const char* tag, const char* msg, va_list list) +{ + os_log_info(const char * tag, const char * msg, va_list list); +} + +void os_log_debug(const char* tag, const char* msg, va_list list) +{ + os_log_info(const char * tag, const char * msg, va_list list); +} + +void os_log_warn(const char* tag, const char* msg, va_list list) +{ + os_log_error(const char * tag, const char * msg, va_list list); +} + +void os_log_fatal(const char* tag, const char* msg, va_list list) +{ + os_log_error(const char * tag, const char * msg, va_list list); +} + #endif diff --git a/test/mpi_dec_mt_test.c b/test/mpi_dec_mt_test.c index 9284f3f6..eace7048 100644 --- a/test/mpi_dec_mt_test.c +++ b/test/mpi_dec_mt_test.c @@ -30,7 +30,6 @@ #include "mpp_time.h" #include "mpp_common.h" -#include "utils.h" #include "mpi_dec_utils.h" typedef struct { diff --git a/test/mpi_dec_multi_test.c b/test/mpi_dec_multi_test.c index 9253156d..bb0a15fc 100644 --- a/test/mpi_dec_multi_test.c +++ b/test/mpi_dec_multi_test.c @@ -21,6 +21,8 @@ #define MODULE_TAG "mpi_dec_multi_test" #include +#include + #include "rk_mpi.h" #include "mpp_mem.h" @@ -28,9 +30,7 @@ #include "mpp_time.h" #include "mpp_common.h" -#include "utils.h" #include "mpi_dec_utils.h" -#include /* For each instance thread setup */ typedef struct { diff --git a/test/mpi_dec_test.c b/test/mpi_dec_test.c index d2052091..22beed0a 100644 --- a/test/mpi_dec_test.c +++ b/test/mpi_dec_test.c @@ -28,7 +28,6 @@ #include "mpp_time.h" #include "mpp_common.h" #include "mpi_dec_utils.h" -#include "utils.h" typedef struct { MpiDecTestCmd *cmd; diff --git a/test/mpi_enc_mt_test.cpp b/test/mpi_enc_mt_test.cpp index cbd15450..dcf972d5 100644 --- a/test/mpi_enc_mt_test.cpp +++ b/test/mpi_enc_mt_test.cpp @@ -21,10 +21,10 @@ #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_time.h" #include "mpp_list.h" #include "mpp_lock.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "utils.h" diff --git a/test/mpi_enc_test.c b/test/mpi_enc_test.c index 001cb441..94f648be 100644 --- a/test/mpi_enc_test.c +++ b/test/mpi_enc_test.c @@ -25,8 +25,8 @@ #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_time.h" +#include "mpp_debug.h" #include "mpp_common.h" #include "utils.h" diff --git a/test/mpi_rc2_test.c b/test/mpi_rc2_test.c index 4664805e..f9794750 100644 --- a/test/mpi_rc2_test.c +++ b/test/mpi_rc2_test.c @@ -21,7 +21,6 @@ #include "rk_mpi.h" -#include "mpp_log.h" #include "mpp_env.h" #include "mpp_mem.h" #include "mpp_time.h" diff --git a/test/mpp_event_trigger.c b/test/mpp_event_trigger.c index fd106cfb..e858af14 100644 --- a/test/mpp_event_trigger.c +++ b/test/mpp_event_trigger.c @@ -25,8 +25,7 @@ #include "mpp_event_trigger.h" -#include "mpp_log.h" -#include "rk_type.h" +#include "mpp_debug.h" struct event_ctx_impl { int (*notify)(void *param); diff --git a/test/mpp_parse_cfg.c b/test/mpp_parse_cfg.c index ed1f1013..350f6ca1 100644 --- a/test/mpp_parse_cfg.c +++ b/test/mpp_parse_cfg.c @@ -20,7 +20,6 @@ #include "mpp_parse_cfg.h" #include "mpp_log.h" -#include "rk_type.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) diff --git a/utils/mpi_dec_utils.c b/utils/mpi_dec_utils.c index 1e5fcbeb..30562c1a 100644 --- a/utils/mpi_dec_utils.c +++ b/utils/mpi_dec_utils.c @@ -20,11 +20,9 @@ #include #include "rk_mpi.h" -#include "utils.h" #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_lock.h" #include "mpp_time.h" #include "mpp_common.h" diff --git a/utils/mpi_enc_utils.c b/utils/mpi_enc_utils.c index ad266e17..0bef396f 100644 --- a/utils/mpi_enc_utils.c +++ b/utils/mpi_enc_utils.c @@ -19,7 +19,7 @@ #include #include "mpp_mem.h" -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_buffer.h" #include "rk_mpi.h" diff --git a/utils/mpp_enc_roi_utils.c b/utils/mpp_enc_roi_utils.c index 48f39f77..f3c6e464 100644 --- a/utils/mpp_enc_roi_utils.c +++ b/utils/mpp_enc_roi_utils.c @@ -22,9 +22,9 @@ #include "mpp_env.h" #include "mpp_mem.h" -#include "mpp_log.h" #include "mpp_soc.h" #include "mpp_common.h" +#include "mpp_debug.h" #include "mpp_enc_roi_utils.h" diff --git a/utils/utils.h b/utils/utils.h index a642f844..4996293d 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -19,7 +19,7 @@ #include -#include "mpp_log.h" +#include "mpp_debug.h" #include "mpp_frame.h" typedef struct OptionInfo_t {