summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2008-06-22 01:30:41 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2008-06-22 01:30:41 +0000
commitbcd3ce5903b6eaed835ecc4825938e18a53e52d8 (patch)
tree962ba804c8ad218c431e185326dccfc6907715be
parent82e0be62ef65856131ae7774554a64565d2fc762 (diff)
downloadffmpeg-streaming-bcd3ce5903b6eaed835ecc4825938e18a53e52d8.zip
ffmpeg-streaming-bcd3ce5903b6eaed835ecc4825938e18a53e52d8.tar.gz
add callback for av_log
Originally committed as revision 13866 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffserver.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/ffserver.c b/ffserver.c
index 4679166..5823960 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -318,12 +318,9 @@ static char *ctime1(char *buf2)
return buf2;
}
-static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
+static void http_vlog(const char *fmt, va_list vargs)
{
static int print_prefix = 1;
- va_list ap;
- va_start(ap, fmt);
-
if (logfile) {
if (print_prefix) {
char buf[32];
@@ -331,10 +328,29 @@ static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ..
fprintf(logfile, "%s ", buf);
}
print_prefix = strstr(fmt, "\n") != NULL;
- vfprintf(logfile, fmt, ap);
+ vfprintf(logfile, fmt, vargs);
fflush(logfile);
}
- va_end(ap);
+}
+
+void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
+{
+ va_list vargs;
+ va_start(vargs, fmt);
+ http_vlog(fmt, vargs);
+ va_end(vargs);
+}
+
+static void http_av_log(void *ptr, int level, const char *fmt, va_list vargs)
+{
+ static int print_prefix = 1;
+ AVClass *avc = ptr ? *(AVClass**)ptr : NULL;
+ if (level > av_log_level)
+ return;
+ if (print_prefix && avc)
+ http_log("[%s @ %p]", avc->item_name(ptr), avc);
+ print_prefix = strstr(fmt, "\n") != NULL;
+ http_vlog(fmt, vargs);
}
static void log_connection(HTTPContext *c)
@@ -4518,6 +4534,7 @@ int main(int argc, char **argv)
logfile = stdout;
else
logfile = fopen(logfilename, "a");
+ av_log_set_callback(http_av_log);
}
if (http_server() < 0) {
OpenPOWER on IntegriCloud