diff --git a/src/debug.cpp b/src/debug.cpp index 079a554a0..d440efc7a 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -140,12 +140,15 @@ void log_msg(int level, const char *format, ...) { } -void log_msg_once(int level, uint32_t id, const char *msg) { +void log_msg_once(int level, uint32_t id, const char *msg, ...) { if (Logger::oneshot_messages.count(id) > 0 || log_level < level) { return; } Logger::oneshot_messages.insert(id); - Logger(level).Get() << msg; + va_list aq; + va_start(aq, msg); + log_vprintf(level, msg, aq); + va_end(aq); } /** diff --git a/src/debug.h b/src/debug.h index 60bf3774d..e944f9db9 100644 --- a/src/debug.h +++ b/src/debug.h @@ -96,7 +96,7 @@ void debug_file_dump(const char *key, void (*serialize)(const void *data, FILE * #define debug_msg(...) log_msg(LOG_LEVEL_DEBUG, __VA_ARGS__) void log_msg(int log_level, const char *format, ...) ATTRIBUTE(format (printf, 2, 3)); int log_vprintf(int level, const char *format, va_list ap); -void log_msg_once(int log_level, uint32_t id, const char *msg); +void log_msg_once(int log_level, uint32_t id, const char *msg, ...) ATTRIBUTE(format (printf, 3, 4));; void log_perror(int log_level, const char *msg); bool parse_log_cfg(const char *conf_str, @@ -303,7 +303,7 @@ private: int level; std::ostringstream oss; - friend void log_msg_once(int level, uint32_t id, const char *msg); + friend void log_msg_once(int level, uint32_t id, const char *msg, ...); static thread_local std::set oneshot_messages; }; diff --git a/src/video_display/gl.cpp b/src/video_display/gl.cpp index 3fcdf9bca..b741ad822 100644 --- a/src/video_display/gl.cpp +++ b/src/video_display/gl.cpp @@ -958,7 +958,7 @@ static void gl_render(struct state_gl *s, char *data) (unsigned char *) data, vc_get_linesize(s->current_display_desc.width, s->current_display_desc.color_spec), (unsigned char *) data, vc_get_linesize(s->current_display_desc.width, s->current_display_desc.color_spec), s->current_display_desc.height)) { - log_msg_once(LOG_LEVEL_ERROR, GL_DEINTERLACE_IMPOSSIBLE_MSG_ID, MOD_NAME "Cannot deinterlace, unsupported pixel format!\n"); + log_msg_once(LOG_LEVEL_ERROR, GL_DEINTERLACE_IMPOSSIBLE_MSG_ID, MOD_NAME "Cannot deinterlace, unsupported pixel format '%s'!\n", get_codec_name(s->current_display_desc.color_spec)); } } diff --git a/src/video_display/sdl2.cpp b/src/video_display/sdl2.cpp index be13def77..be69b2524 100644 --- a/src/video_display/sdl2.cpp +++ b/src/video_display/sdl2.cpp @@ -182,7 +182,7 @@ static void display_frame(struct state_sdl2 *s, struct video_frame *frame) int pitch; SDL_LockTexture(s->texture, NULL, (void **) &pixels, &pitch); if (!vc_deinterlace_ex(frame->color_spec, (unsigned char *) frame->tiles[0].data, vc_get_linesize(frame->tiles[0].width, frame->color_spec), pixels, pitch, frame->tiles[0].height)) { - log_msg_once(LOG_LEVEL_ERROR, SDL2_DEINTERLACE_IMPOSSIBLE_MSG_ID, MOD_NAME "Cannot deinterlace, unsupported pixel format!\n"); + log_msg_once(LOG_LEVEL_ERROR, SDL2_DEINTERLACE_IMPOSSIBLE_MSG_ID, MOD_NAME "Cannot deinterlace, unsupported pixel format '%s'!\n", get_codec_name(frame->color_spec)); } SDL_UnlockTexture(s->texture); } diff --git a/src/vo_postprocess/deinterlace.c b/src/vo_postprocess/deinterlace.c index f43eb2173..e11166105 100644 --- a/src/vo_postprocess/deinterlace.c +++ b/src/vo_postprocess/deinterlace.c @@ -51,6 +51,8 @@ #include "video_display.h" #include "vo_postprocess.h" +#define MOD_NAME "[deinterlace] " + struct state_deinterlace { struct video_frame *out; ///< for postprocess only }; @@ -120,9 +122,11 @@ static bool deinterlace_postprocess(void *state, struct video_frame *in, struct assert (in->tiles[0].data_len <= vc_get_linesize(in->tiles[0].width, in->color_spec) * in->tiles[0].height); assert (out->tiles[0].data_len <= vc_get_linesize(in->tiles[0].width, in->color_spec) * in->tiles[0].height); - vc_deinterlace_ex(in->color_spec, (unsigned char *) in->tiles[0].data, vc_get_linesize(in->tiles[0].width, in->color_spec), + if (!vc_deinterlace_ex(in->color_spec, (unsigned char *) in->tiles[0].data, vc_get_linesize(in->tiles[0].width, in->color_spec), (unsigned char *) out->tiles[0].data, vc_get_linesize(out->tiles[0].width, in->color_spec), - in->tiles[0].height); + in->tiles[0].height)) { + log_msg(LOG_LEVEL_ERROR, MOD_NAME "Cannot deinterlace, unsupported pixel format '%s'!\n", get_codec_name(in->color_spec)); + } memcpy(out->tiles[0].data, in->tiles[0].data, in->tiles[0].data_len); return true; diff --git a/src/vo_postprocess/double-framerate.cpp b/src/vo_postprocess/double-framerate.cpp index 65a17e0e8..2611076ea 100644 --- a/src/vo_postprocess/double-framerate.cpp +++ b/src/vo_postprocess/double-framerate.cpp @@ -189,7 +189,7 @@ static bool df_postprocess(void *state, struct video_frame *in, struct video_fra (unsigned char *) out->tiles[0].data, vc_get_linesize(out->tiles[0].width, out->color_spec), (unsigned char *) out->tiles[0].data, vc_get_linesize(out->tiles[0].width, out->color_spec), out->tiles[0].height)) { - log_msg_once(LOG_LEVEL_ERROR, DFR_DEINTERLACE_IMPOSSIBLE_MSG_ID, MOD_NAME "Cannot deinterlace, unsupported pixel format!\n"); + log_msg_once(LOG_LEVEL_ERROR, DFR_DEINTERLACE_IMPOSSIBLE_MSG_ID, MOD_NAME "Cannot deinterlace, unsupported pixel format '%s'!\n", get_codec_name(in->color_spec)); } }