libtsfuncs is a library for mpeg PSI parsing and generation. https://georgi.unixsol.org/programs/libtsfuncs/
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.

log.c 516B

12345678910111213141516171819202122232425
  1. #include <stdio.h>
  2. #include <stdarg.h>
  3. #include "log.h"
  4. void ts_LOG_default(const char *msg) {
  5. fprintf(stdout, "%s", msg);
  6. }
  7. static void (*ts_LOG_callback)(const char *msg) = ts_LOG_default;
  8. void ts_LOGf(const char *fmt, ...) {
  9. char msg[1024];
  10. va_list args;
  11. va_start(args, fmt);
  12. vsnprintf(msg, sizeof(msg)-1, fmt, args);
  13. va_end(args);
  14. msg[sizeof(msg)-2] = '\n';
  15. msg[sizeof(msg)-1] = '\0';
  16. ts_LOG_callback(msg);
  17. }
  18. void ts_set_log_func(void (*LOG_func)(const char *msg)) {
  19. ts_LOG_callback = LOG_func;
  20. }