log.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef FFMPEG_LOG_H
  21. #define FFMPEG_LOG_H
  22. #include <stdarg.h>
  23. /**
  24. * Used by av_log
  25. */
  26. typedef struct AVCLASS AVClass;
  27. struct AVCLASS {
  28. const char* class_name;
  29. const char* (*item_name)(void*); /* actually passing a pointer to an AVCodecContext
  30. or AVFormatContext, which begin with an AVClass.
  31. Needed because av_log is in libavcodec and has no visibility
  32. of AVIn/OutputFormat */
  33. const struct AVOption *option;
  34. };
  35. /* av_log API */
  36. #if LIBAVUTIL_VERSION_INT < (50<<16)
  37. #define AV_LOG_QUIET -1
  38. #define AV_LOG_FATAL 0
  39. #define AV_LOG_ERROR 0
  40. #define AV_LOG_WARNING 1
  41. #define AV_LOG_INFO 1
  42. #define AV_LOG_VERBOSE 1
  43. #define AV_LOG_DEBUG 2
  44. #else
  45. #define AV_LOG_QUIET -8
  46. /**
  47. * something went really wrong and we will crash now
  48. */
  49. #define AV_LOG_PANIC 0
  50. /**
  51. * something went wrong and recovery is not possible
  52. * like no header in a format which depends on it or a combination
  53. * of parameters which are not allowed
  54. */
  55. #define AV_LOG_FATAL 8
  56. /**
  57. * something went wrong and cannot losslessly be recovered
  58. * but not all future data is affected
  59. */
  60. #define AV_LOG_ERROR 16
  61. /**
  62. * something somehow does not look correct / something which may or may not
  63. * lead to some problems like use of -vstrict -2
  64. */
  65. #define AV_LOG_WARNING 24
  66. #define AV_LOG_INFO 32
  67. #define AV_LOG_VERBOSE 40
  68. /**
  69. * stuff which is only useful for libav* developers
  70. */
  71. #define AV_LOG_DEBUG 48
  72. #endif
  73. #if LIBAVUTIL_VERSION_INT < (50<<16)
  74. extern int av_log_level;
  75. #endif
  76. /**
  77. * Send the specified message to the log if the level is less than or equal to
  78. * the current av_log_level. By default, all logging messages are sent to
  79. * stderr. This behavior can be altered by setting a different av_vlog callback
  80. * function.
  81. *
  82. * @param avcl A pointer to an arbitrary struct of which the first field is a
  83. * pointer to an AVClass struct.
  84. * @param level The importance level of the message, lower values signifying
  85. * higher importance.
  86. * @param fmt The format string (printf-compatible) that specifies how
  87. * subsequent arguments are converted to output.
  88. * @see av_vlog
  89. */
  90. #ifdef __GNUC__
  91. extern void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
  92. #else
  93. extern void av_log(void*, int level, const char *fmt, ...);
  94. #endif
  95. extern void av_vlog(void*, int level, const char *fmt, va_list);
  96. extern int av_log_get_level(void);
  97. extern void av_log_set_level(int);
  98. extern void av_log_set_callback(void (*)(void*, int, const char*, va_list));
  99. extern void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
  100. #endif /* FFMPEG_LOG_H */