[DVDnav-discuss] [PATCH] drop perror()

Andreas Öman andreas at lonelycoder.com
Sun Apr 20 23:07:55 CEST 2014


On Thu, Apr 17, 2014 at 3:22 PM, Jean-Baptiste Kempf <jb at videolan.org>wrote:

>
> But please make it thread-safe, not like the famous libavcodec stuff.
>

I was thinking about doing something very simple, like a global function
pointer.

void (*libdvdnav_log)(void *opaque, const char *fmt, ...);

And then just have a default implementation that prints to stderr. Then if
the app
uses multiple threads for DVD playback it will need to sort out locking by
itself.

I also suggest dropping all \n from the log messages.

This would make the default log-to-stderr either a bit racy (it would have
to first print the log message and then fprintf(stderr, "\n"); or it would
need to
append a \n to the format string before passing it into vfnprintf()

Thoughts welcome.


More information about the DVDnav-discuss mailing list