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 665B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Logger function
  3. * Copyright (C) 2010-2011 Unix Solutions Ltd.
  4. *
  5. * Released under MIT license.
  6. * See LICENSE-MIT.txt for license terms.
  7. */
  8. #include <stdio.h>
  9. #include <stdarg.h>
  10. #include "log.h"
  11. void ts_LOG_default(const char *msg) {
  12. fprintf(stdout, "%s", msg);
  13. }
  14. static void (*ts_LOG_callback)(const char *msg) = ts_LOG_default;
  15. void ts_LOGf(const char *fmt, ...) {
  16. char msg[1024];
  17. va_list args;
  18. va_start(args, fmt);
  19. vsnprintf(msg, sizeof(msg)-1, fmt, args);
  20. va_end(args);
  21. msg[sizeof(msg)-2] = '\n';
  22. msg[sizeof(msg)-1] = '\0';
  23. ts_LOG_callback(msg);
  24. }
  25. void ts_set_log_func(void (*LOG_func)(const char *msg)) {
  26. ts_LOG_callback = LOG_func;
  27. }