From 5e0c4ec3e8f17064bf6837d33e3583afbd9214e2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 19 Dec 2013 21:28:55 +0100 Subject: player: replace some overlooked mp_msgs There are still some using IDENTIFY, and some without context in configfiles.c. --- player/command.c | 30 +++++++++++------------------- player/lua.c | 8 ++++---- player/main.c | 4 ++-- player/osd.c | 11 +++++------ player/playloop.c | 4 ++-- player/screenshot.c | 2 +- player/sub.c | 8 +++----- player/video.c | 6 +++--- 8 files changed, 31 insertions(+), 42 deletions(-) diff --git a/player/command.c b/player/command.c index 5d2fa8df50..9247887c31 100644 --- a/player/command.c +++ b/player/command.c @@ -1146,8 +1146,7 @@ static int mp_property_program(m_option_t *prop, int action, void *arg, return M_PROPERTY_ERROR; if (prog.aid < 0 && prog.vid < 0) { - mp_msg(MSGT_CPLAYER, MSGL_ERR, - "Selected program contains no audio or video streams!\n"); + MP_ERR(mpctx, "Selected program contains no audio or video streams!\n"); return M_PROPERTY_ERROR; } mp_switch_track(mpctx, STREAM_VIDEO, @@ -2594,9 +2593,8 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) s.inc = cmd->args[1].v.d * cmd->scale; char *property = cmd->args[0].v.s; if (cmd->repeated && !check_property_autorepeat(property, mpctx)) { - mp_msg(MSGT_CPLAYER, MSGL_V, - "Dropping command '%.*s' from auto-repeated key.\n", - BSTR_P(cmd->original)); + MP_VERBOSE(mpctx, "Dropping command '%.*s' from auto-repeated key.\n", + BSTR_P(cmd->original)); break; } int r = mp_property_do(property, M_PROPERTY_SWITCH, &s, mpctx); @@ -2670,15 +2668,12 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_GET_STRING, &tmp, mpctx); if (r <= 0) { - mp_msg(MSGT_CPLAYER, MSGL_WARN, - "Failed to get value of property '%s'.\n", - cmd->args[0].v.s); - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_ERROR=%s\n", - property_error_string(r)); + MP_WARN(mpctx, "Failed to get value of property '%s'.\n", + cmd->args[0].v.s); + MP_INFO(mpctx, "ANS_ERROR=%s\n", property_error_string(r)); break; } - mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_%s=%s\n", - cmd->args[0].v.s, tmp); + MP_INFO(mpctx, "ANS_%s=%s\n", cmd->args[0].v.s, tmp); talloc_free(tmp); break; } @@ -2767,7 +2762,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) } case MP_CMD_PRINT_TEXT: { - mp_msg(MSGT_GLOBAL, MSGL_INFO, "%s\n", cmd->args[0].v.s); + MP_INFO(mpctx, "%s\n", cmd->args[0].v.s); break; } @@ -2809,8 +2804,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) mp_set_playlist_entry(mpctx, e ? e : mpctx->playlist->first); } } else { - mp_msg(MSGT_CPLAYER, MSGL_ERR, - "\nUnable to load playlist %s.\n", filename); + MP_ERR(mpctx, "Unable to load playlist %s.\n", filename); } break; } @@ -3073,8 +3067,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) case MP_CMD_VO_CMDLINE: if (mpctx->video_out) { char *s = cmd->args[0].v.s; - mp_msg(MSGT_CPLAYER, MSGL_INFO, "Setting vo cmd line to '%s'.\n", - s); + MP_INFO(mpctx, "Setting vo cmd line to '%s'.\n", s); if (vo_control(mpctx->video_out, VOCTRL_SET_COMMAND_LINE, s) > 0) { set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration, "vo='%s'", s); } else { @@ -3125,8 +3118,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) break; default: - mp_msg(MSGT_CPLAYER, MSGL_V, - "Received unknown cmd %s\n", cmd->name); + MP_VERBOSE(mpctx, "Received unknown cmd %s\n", cmd->name); } if (cmd->flags & MP_PAUSING) diff --git a/player/lua.c b/player/lua.c index f75bc96531..3687f75b87 100644 --- a/player/lua.c +++ b/player/lua.c @@ -95,9 +95,9 @@ static int mp_cpcall(lua_State *L, lua_CFunction fn, int args) static void report_error(lua_State *L) { + struct MPContext *mpctx = get_mpctx(L); const char *err = lua_tostring(L, -1); - mp_msg(MSGT_CPLAYER, MSGL_WARN, "[lua] Error: %s\n", - err ? err : "[unknown]"); + MP_WARN(mpctx, "Error: %s\n", err ? err : "[unknown]"); lua_pop(L, 1); } @@ -354,8 +354,8 @@ void mp_lua_script_dispatch(struct MPContext *mpctx, char *script_name, { struct script_ctx *ctx = find_script(mpctx->lua_ctx, script_name); if (!ctx) { - mp_msg(MSGT_CPLAYER, MSGL_V, - "Can't find script '%s' when handling input.\n", script_name); + MP_VERBOSE(mpctx, "Can't find script '%s' when handling input.\n", + script_name); return; } lua_State *L = ctx->state; diff --git a/player/main.c b/player/main.c index 037ea12d4d..217d01c00f 100644 --- a/player/main.c +++ b/player/main.c @@ -210,7 +210,7 @@ static bool handle_help_options(struct MPContext *mpctx) #if HAVE_X11 if (opts->vo.fstype_list && strcmp(opts->vo.fstype_list[0], "help") == 0) { fstype_help(); - mp_msg(MSGT_FIXME, MSGL_FIXME, "\n"); + MP_INFO(mpctx, "\n"); opt_exit = 1; } #endif @@ -379,7 +379,7 @@ static int mpv_main(int argc, char *argv[]) if (opts->encode_output.file && *opts->encode_output.file) { mpctx->encode_lavc_ctx = encode_lavc_init(&opts->encode_output); if(!mpctx->encode_lavc_ctx) { - mp_msg(MSGT_VO, MSGL_INFO, "Encoding initialization failed."); + MP_INFO(mpctx, "Encoding initialization failed."); exit_player(mpctx, EXIT_ERROR); } m_config_set_option0(mpctx->mconfig, "vo", "lavc"); diff --git a/player/osd.c b/player/osd.c index 6f73ea9bc3..c87585c42d 100644 --- a/player/osd.c +++ b/player/osd.c @@ -72,14 +72,13 @@ void write_status_line(struct MPContext *mpctx, const char *line) { struct MPOpts *opts = mpctx->opts; if (opts->slave_mode) { - mp_msg(MSGT_STATUSLINE, MSGL_STATUS, "%s\n", line); + MP_MSG(mpctx, MSGL_STATUS, "%s\n", line); } else if (erase_to_end_of_line) { - mp_msg(MSGT_STATUSLINE, MSGL_STATUS, - "%s%s\r", line, erase_to_end_of_line); + MP_MSG(mpctx, MSGL_STATUS, "%s%s\r", line, erase_to_end_of_line); } else { int pos = strlen(line); int width = get_term_width() - pos; - mp_msg(MSGT_STATUSLINE, MSGL_STATUS, "%s%*s\r", line, width, ""); + MP_MSG(mpctx, MSGL_STATUS, "%s%*s\r", line, width, ""); } } @@ -486,7 +485,7 @@ void update_osd_msg(struct MPContext *mpctx) mpctx->terminal_osd_text = talloc_strdup(mpctx, msg->msg); // Multi-line message => clear what will be the second line write_status_line(mpctx, ""); - mp_msg(MSGT_CPLAYER, MSGL_STATUS, "%s%s\n", opts->term_osd_esc, + MP_MSG(mpctx, MSGL_STATUS, "%s%s\n", opts->term_osd_esc, mpctx->terminal_osd_text); print_status(mpctx); } @@ -513,6 +512,6 @@ void update_osd_msg(struct MPContext *mpctx) // Clear the term osd line if (opts->term_osd && mpctx->terminal_osd_text[0]) { mpctx->terminal_osd_text[0] = '\0'; - mp_msg(MSGT_CPLAYER, MSGL_STATUS, "%s\n", opts->term_osd_esc); + MP_MSG(mpctx, MSGL_STATUS, "%s\n", opts->term_osd_esc); } } diff --git a/player/playloop.c b/player/playloop.c index d373cf1049..a018088cfc 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -1017,7 +1017,7 @@ void run_playloop(struct MPContext *mpctx) } } - mp_msg(MSGT_AVSYNC, MSGL_DBG2, "*** ftime=%5.3f ***\n", frame_time); + MP_TRACE(mpctx, "frametime=%5.3f\n", frame_time); if (mpctx->d_video->vfilter && mpctx->d_video->vfilter->initialized < 0) { MP_FATAL(mpctx, "\nFATAL: Could not initialize video filters " @@ -1059,7 +1059,7 @@ void run_playloop(struct MPContext *mpctx) mpctx->time_frame -= get_relative_time(mpctx); if (full_audio_buffers && !mpctx->restart_playback) { buffered_audio = ao_get_delay(mpctx->ao); - mp_msg(MSGT_AVSYNC, MSGL_DBG2, "delay=%f\n", buffered_audio); + MP_TRACE(mpctx, "audio delay=%f\n", buffered_audio); if (opts->autosync) { /* Smooth reported playback position from AO by averaging diff --git a/player/screenshot.c b/player/screenshot.c index 94fc25f563..d2879051b0 100644 --- a/player/screenshot.c +++ b/player/screenshot.c @@ -78,7 +78,7 @@ static void screenshot_msg(screenshot_ctx *ctx, int status, const char *msg, s = talloc_vasprintf(NULL, msg, ap); va_end(ap); - mp_msg(MSGT_CPLAYER, status == SMSG_ERR ? MSGL_ERR : MSGL_INFO, "%s\n", s); + MP_MSG(ctx->mpctx, status == SMSG_ERR ? MSGL_ERR : MSGL_INFO, "%s\n", s); if (ctx->osd) { set_osd_msg(ctx->mpctx, OSD_MSG_TEXT, 1, ctx->mpctx->opts->osd_duration, "%s", s); diff --git a/player/sub.c b/player/sub.c index 69ab7e3584..ceef81b319 100644 --- a/player/sub.c +++ b/player/sub.c @@ -107,8 +107,7 @@ void update_subtitles(struct MPContext *mpctx) if (!demux_has_packet(sh_stream)) break; if (subpts_s > curpts_s) { - mp_msg(MSGT_CPLAYER, MSGL_DBG2, - "Sub early: c_pts=%5.3f s_pts=%5.3f\n", + MP_DBG(mpctx, "Sub early: c_pts=%5.3f s_pts=%5.3f\n", curpts_s, subpts_s); // Libass handled subs can be fed to it in advance if (!sub_accept_packets_in_advance(dec_sub)) @@ -118,9 +117,8 @@ void update_subtitles(struct MPContext *mpctx) break; } struct demux_packet *pkt = demux_read_packet(sh_stream); - mp_msg(MSGT_CPLAYER, MSGL_V, "Sub: c_pts=%5.3f s_pts=%5.3f " - "duration=%5.3f len=%d\n", curpts_s, pkt->pts, pkt->duration, - pkt->len); + MP_DBG(mpctx, "Sub: c_pts=%5.3f s_pts=%5.3f duration=%5.3f len=%d\n", + curpts_s, pkt->pts, pkt->duration, pkt->len); sub_decode(dec_sub, pkt); talloc_free(pkt); } diff --git a/player/video.c b/player/video.c index 7f4f7a6795..0c7d399322 100644 --- a/player/video.c +++ b/player/video.c @@ -89,9 +89,9 @@ static void reconfig_video(struct MPContext *mpctx, struct mp_image_params p = d_video->vfilter->output_params; const struct vo_driver *info = mpctx->video_out->driver; - mp_msg(MSGT_CPLAYER, MSGL_INFO, "VO: [%s] %dx%d => %dx%d %s\n", - info->name, p.w, p.h, p.d_w, p.d_h, vo_format_name(p.imgfmt)); - mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Description: %s\n", info->description); + MP_INFO(mpctx, "VO: [%s] %dx%d => %dx%d %s\n", + info->name, p.w, p.h, p.d_w, p.d_h, vo_format_name(p.imgfmt)); + MP_VERBOSE(mpctx, "VO: Description: %s\n", info->description); int r = vo_reconfig(mpctx->video_out, &p, 0); if (r < 0) -- cgit v1.2.3