static decoder_t *pAvDecoder = NULL;
static void AvLogOutCallback(void *ptr, int level, const char *fmt, va_list vl)
{
if (level > av_log_get_level()) {
return;
}
/*
FILE *fp = fopen("AvLogOut.txt", "a+");
if (fp) {
vfprintf(fp, fmt, vl);
fflush(fp);
fclose(fp);
}
*/
if (pAvDecoder != NULL) {
va_list vl2;
va_copy(vl2, vl);
int msg_len = vsnprintf(NULL, 0, fmt, vl2);
va_end(vl2);
if (msg_len <= 0) return;
char *msg = malloc(msg_len + 1 + 1);
if (!msg) return;
msg_len = vsnprintf(msg, msg_len+1, fmt, vl);
if (msg_len > 0) {
msg_Dbg(pAvDecoder, "av_log: %s", msg);
}
free(msg);
}
}
static int OpenVideoCodec( decoder_t *p_dec )
{
av_log_set_callback(AvLogOutCallback);
vlc_init_avutil(p_dec);
}
沒有留言:
張貼留言