1/* 2* Copyright (c) 2009-2011 Intel Corporation. All rights reserved. 3* 4* Licensed under the Apache License, Version 2.0 (the "License"); 5* you may not use this file except in compliance with the License. 6* You may obtain a copy of the License at 7* 8* http://www.apache.org/licenses/LICENSE-2.0 9* 10* Unless required by applicable law or agreed to in writing, software 11* distributed under the License is distributed on an "AS IS" BASIS, 12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13* See the License for the specific language governing permissions and 14* limitations under the License. 15*/ 16 17 18#ifndef VIDEO_DECODER_TRACE_H_ 19#define VIDEO_DECODER_TRACE_H_ 20 21 22#define ENABLE_VIDEO_DECODER_TRACE 23//#define ANDROID 24 25 26#ifdef ENABLE_VIDEO_DECODER_TRACE 27 28#ifndef ANDROID 29 30#include <stdio.h> 31#include <stdarg.h> 32 33extern void TraceVideoDecoder(const char* cat, const char* fun, int line, const char* format, ...); 34#define VIDEO_DECODER_TRACE(cat, format, ...) \ 35TraceVideoDecoder(cat, __FUNCTION__, __LINE__, format, ##__VA_ARGS__) 36 37#define ETRACE(format, ...) VIDEO_DECODER_TRACE("ERROR: ", format, ##__VA_ARGS__) 38#define WTRACE(format, ...) VIDEO_DECODER_TRACE("WARNING: ", format, ##__VA_ARGS__) 39#define ITRACE(format, ...) VIDEO_DECODER_TRACE("INFO: ", format, ##__VA_ARGS__) 40#define VTRACE(format, ...) VIDEO_DECODER_TRACE("VERBOSE: ", format, ##__VA_ARGS__) 41 42#else 43// for Android OS 44 45//#define LOG_NDEBUG 0 46 47#define LOG_TAG "VideoDecoder" 48 49#include <wrs_omxil_core/log.h> 50#define ETRACE(...) LOGE(__VA_ARGS__) 51#define WTRACE(...) LOGW(__VA_ARGS__) 52#define ITRACE(...) LOGI(__VA_ARGS__) 53#define VTRACE(...) LOGV(__VA_ARGS__) 54 55#endif 56 57 58#else 59 60#define ETRACE(format, ...) 61#define WTRACE(format, ...) 62#define ITRACE(format, ...) 63#define VTRACE(format, ...) 64 65 66#endif /* ENABLE_VIDEO_DECODER_TRACE*/ 67 68 69#define CHECK_STATUS(FUNC)\ 70 if (status != DECODE_SUCCESS) {\ 71 if (status > DECODE_SUCCESS) {\ 72 WTRACE(FUNC" failed. status = %d", status);\ 73 } else {\ 74 ETRACE(FUNC" failed. status = %d", status);\ 75 }\ 76 return status;\ 77 } 78 79#define CHECK_VA_STATUS(FUNC)\ 80 if (vaStatus != VA_STATUS_SUCCESS) {\ 81 ETRACE(FUNC" failed. vaStatus = 0x%x", vaStatus);\ 82 return DECODE_DRIVER_FAIL;\ 83 } 84 85#define CHECK_VBP_STATUS(FUNC)\ 86 if (vbpStatus != VBP_OK) {\ 87 ETRACE(FUNC" failed. vbpStatus = %d", (int)vbpStatus);\ 88 if (vbpStatus == VBP_ERROR) {\ 89 return DECODE_FAIL;\ 90 }\ 91 return DECODE_PARSER_FAIL;\ 92 } 93 94#endif /*VIDEO_DECODER_TRACE_H_*/ 95 96 97