You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
4.5 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2009-2019. All rights reserved.
* Description: Defines avplay debugger api
* Author: Hisilicon
* Create: 2009-12-21
* History:
*/
#ifndef __AVPLAY_DEBUGGER_H__
#define __AVPLAY_DEBUGGER_H__
#include "avplay_context.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
/* Definition of debugger id */
typedef enum {
AVPLAY_DBG_ID_GET_BUF_TRY_CNT = 0,
AVPLAY_DBG_ID_GET_BUF_OK_CNT,
AVPLAY_DBG_ID_PUT_BUF_TRY_CNT,
AVPLAY_DBG_ID_PUT_BUF_OK_CNT,
AVPLAY_DBG_ID_ACQ_FRAME_TRY_CNT,
AVPLAY_DBG_ID_ACQ_FRAME_OK_CNT,
AVPLAY_DBG_ID_Q_FRAME_TRY_CNT,
AVPLAY_DBG_ID_Q_FRAME_OK_CNT,
AVPLAY_DBG_ID_Q_FRAME_ERR_CNT,
AVPLAY_DBG_ID_DQ_FRAME_ERR_CNT,
AVPLAY_DBG_ID_RLS_FRAME_ERR_CNT,
AVPLAY_DBG_ID_DMX_OVERFLOW_CNT,
AVPLAY_DBG_ID_ACQ_PES_TRY_CNT, /* pes: dmx->avplay */
AVPLAY_DBG_ID_ACQ_PES_OK_CNT,
AVPLAY_DBG_ID_DEQUEUE_PES_TRY_CNT, /* pes: vdec->avplay or adec->avplay */
AVPLAY_DBG_ID_DEQUEUE_PES_OK_CNT,
AVPLAY_DBG_ID_RLS_PES_ERR_CNT, /* pes: avplay->dmx */
AVPLAY_DBG_ID_Q_PES_ERR_CNT, /* pes: avplay->vdec or avplay->adec */
AVPLAY_DBG_ID_DQ_FRAME_TRY_CNT,
AVPLAY_DBG_ID_DQ_FRAME_OK_CNT,
AVPLAY_DBG_ID_MAX
} avplay_dbg_id;
td_s32 avplay_debugger_register(avplay_context *ctx);
td_s32 avplay_debugger_unregister(avplay_context *ctx);
td_s32 avplay_debugger_reset(td_handle avplay);
td_s32 avplay_debugger_add(td_handle avplay, td_u32 id, td_u8 offset, td_u32 val);
td_s32 avplay_debugger_sub(td_handle avplay, td_u32 id, td_u8 offset, td_u32 val);
td_s32 avplay_debugger_set(td_handle avplay, td_u32 id, td_u8 offset, td_u32 val);
#ifdef AVPLAY_SUPPORT_DEBUGGER
typedef struct {
td_u32 enum_val;
const td_char *str;
} avplay_enum_str_map;
const td_char *avplay_get_enum_string(td_u32 enum_val, const td_char *map_name,
const avplay_enum_str_map * const map, td_u32 map_cnt);
#define avplay_get_enum_str(e, map) \
avplay_get_enum_string(e, line_call(map), map, sizeof(map) / sizeof(avplay_enum_str_map))
#define debugger_register(ctx) do { \
(void)avplay_debugger_register(ctx); \
} while (0)
#define debugger_unregister(ctx) do { \
(void)avplay_debugger_unregister(ctx); \
} while (0)
#define debugger_reset(handle) do { \
(void)avplay_debugger_reset(handle); \
} while (0)
#define debugger_add(handle, id, offset, val) do { \
(void)avplay_debugger_add(handle, id, offset, val); \
} while (0)
#define debugger_add_when_success(ret, handle, id, offset, val) do { \
if ((ret) == TD_SUCCESS) { \
(void)avplay_debugger_add(handle, id, offset, val); \
} \
} while (0)
#define debugger_add_when_error(ret, handle, id, offset, val) do { \
if ((ret) != TD_SUCCESS) { \
(void)avplay_debugger_add(handle, id, offset, val); \
} \
} while (0)
#define debugger_inc(handle, id, offset) do { \
(void)avplay_debugger_add(handle, id, offset, 1); \
} while (0)
#define debugger_inc_when_success(ret, handle, id, offset) do { \
if ((ret) == TD_SUCCESS) { \
(void)avplay_debugger_add(handle, id, offset, 1); \
} \
} while (0)
#define debugger_inc_when_error(ret, handle, id, offset) do { \
if ((ret) != TD_SUCCESS) { \
(void)avplay_debugger_add(handle, id, offset, 1); \
} \
} while (0)
#define debugger_set(handle, id, offset, val) do { \
(void)avplay_debugger_set(handle, id, offset, val); \
} while (0)
#define debugger_set_when_success(ret, handle, id, offset, val) do { \
if ((ret) == TD_SUCCESS) { \
(void)avplay_debugger_set(handle, id, offset, val); \
} \
} while (0)
#define debugger_set_when_error(ret, handle, id, offset, val) do { \
if ((ret) != TD_SUCCESS) { \
(void)avplay_debugger_set(handle, id, offset, val); \
} \
} while (0)
#else
#define avplay_get_enum_str(e, map) AVPLAY_DEFAULT_STRING
#define debugger_register(ctx)
#define debugger_unregister(ctx)
#define debugger_reset(handle)
#define debugger_add(handle, id, offset, val)
#define debugger_add_when_success(ret, handle, id, offset, val)
#define debugger_add_when_error(ret, handle, id, offset, val)
#define debugger_inc(handle, id, offset)
#define debugger_inc_when_success(ret, handle, id, offset)
#define debugger_inc_when_error(ret, handle, id, offset)
#define debugger_set(handle, id, offset, val)
#define debugger_set_when_success(ret, handle, id, offset, val)
#define debugger_set_when_error(ret, handle, id, offset, val)
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif