codecs: mp_msg conversion

This commit is contained in:
wm4 2013-12-21 18:46:24 +01:00
parent 71b6a52295
commit 5f0fbacf16
5 changed files with 13 additions and 11 deletions

View File

@ -141,7 +141,7 @@ int audio_init_best_codec(struct dec_audio *d_audio, char *audio_decoders)
struct mp_decoder_list *list =
audio_select_decoders(d_audio->header->codec, audio_decoders);
mp_print_decoders(MSGT_DECAUDIO, MSGL_V, "Codec list:", list);
mp_print_decoders(d_audio->log, MSGL_V, "Codec list:", list);
for (int n = 0; n < list->num_entries; n++) {
struct mp_decoder_entry *sel = &list->entries[n];

View File

@ -131,17 +131,17 @@ struct mp_decoder_list *mp_select_decoders(struct mp_decoder_list *all,
return list;
}
void mp_print_decoders(int msgt, int msgl, const char *header,
void mp_print_decoders(struct mp_log *log, int msgl, const char *header,
struct mp_decoder_list *list)
{
mp_msg(msgt, msgl, "%s\n", header);
mp_msg_log(log, msgl, "%s\n", header);
for (int n = 0; n < list->num_entries; n++) {
struct mp_decoder_entry *entry = &list->entries[n];
mp_msg(msgt, msgl, " %s:%s", entry->family, entry->decoder);
mp_msg_log(log, msgl, " %s:%s", entry->family, entry->decoder);
if (strcmp(entry->decoder, entry->codec) != 0)
mp_msg(msgt, msgl, " (%s)", entry->codec);
mp_msg(msgt, msgl, " - %s\n", entry->desc);
mp_msg_log(log, msgl, " (%s)", entry->codec);
mp_msg_log(log, msgl, " - %s\n", entry->desc);
}
if (list->num_entries == 0)
mp_msg(msgt, msgl, " (no decoders)\n");
mp_msg_log(log, msgl, " (no decoders)\n");
}

View File

@ -37,7 +37,8 @@ struct mp_decoder_list *mp_select_decoders(struct mp_decoder_list *all,
const char *codec,
const char *selection);
void mp_print_decoders(int msgt, int msgl, const char *header,
struct mp_log;
void mp_print_decoders(struct mp_log *log, int msgl, const char *header,
struct mp_decoder_list *list);
#endif

View File

@ -194,16 +194,17 @@ static MP_NORETURN void exit_player(struct MPContext *mpctx,
static bool handle_help_options(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
struct mp_log *log = mpctx->log;
int opt_exit = 0;
if (opts->audio_decoders && strcmp(opts->audio_decoders, "help") == 0) {
struct mp_decoder_list *list = audio_decoder_list();
mp_print_decoders(MSGT_CPLAYER, MSGL_INFO, "Audio decoders:", list);
mp_print_decoders(log, MSGL_INFO, "Audio decoders:", list);
talloc_free(list);
opt_exit = 1;
}
if (opts->video_decoders && strcmp(opts->video_decoders, "help") == 0) {
struct mp_decoder_list *list = video_decoder_list();
mp_print_decoders(MSGT_CPLAYER, MSGL_INFO, "Video decoders:", list);
mp_print_decoders(log, MSGL_INFO, "Video decoders:", list);
talloc_free(list);
opt_exit = 1;
}

View File

@ -172,7 +172,7 @@ bool video_init_best_codec(struct dec_video *d_video, char* video_decoders)
struct mp_decoder_list *list =
mp_select_video_decoders(d_video->header->codec, video_decoders);
mp_print_decoders(MSGT_DECVIDEO, MSGL_V, "Codec list:", list);
mp_print_decoders(d_video->log, MSGL_V, "Codec list:", list);
for (int n = 0; n < list->num_entries; n++) {
struct mp_decoder_entry *sel = &list->entries[n];