| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include "config.h" |
| 20 |
#include <stdio.h> |
| 21 |
#include <stdarg.h> |
| 22 |
|
| 23 |
#include "dvdread/dvd_reader.h" |
| 24 |
#include "logger.h" |
| 25 |
|
| 26 |
#ifdef _WIN32 |
| 27 |
#define TTY_DEVICE "CON" |
| 28 |
#else |
| 29 |
#define TTY_DEVICE "/dev/tty" |
| 30 |
#endif |
| 31 |
|
| 32 |
void DVDReadLog( void *priv, const dvd_logger_cb *logcb, |
| 33 |
dvd_logger_level_t level, const char *fmt, ... ) |
| 34 |
{ |
| 35 |
va_list list; |
| 36 |
va_start(list, fmt); |
| 37 |
if(logcb && logcb->pf_log) |
| 38 |
logcb->pf_log(priv, level, fmt, list); |
| 39 |
else |
| 40 |
{ |
| 41 |
static FILE *tty_stream = NULL; |
| 42 |
if (!tty_stream) |
| 43 |
tty_stream = fopen(TTY_DEVICE, "w"); |
| 44 |
|
| 45 |
FILE *stream = (level == DVD_LOGGER_LEVEL_ERROR) ? stderr : tty_stream; |
| 46 |
|
| 47 |
|
| 48 |
if (!stream) |
| 49 |
stream = stderr; |
| 50 |
|
| 51 |
fprintf(stream, "libdvdread: "); |
| 52 |
vfprintf(stream, fmt, list); |
| 53 |
fprintf(stream, "\n"); |
| 54 |
} |
| 55 |
va_end(list); |
| 56 |
} |