cli/audacious/foobar: print logs

This commit is contained in:
bnnm 2021-08-26 18:43:17 +02:00
parent f799aec0ca
commit d351710887
8 changed files with 26 additions and 5 deletions

View File

@ -8,7 +8,7 @@ ifeq ($(VGMSTREAM_VERSION),)
else
VGMSTREAM_VERSION=$(VGMSTREAM_VERSION)
endif
DEF_CFLAGS += -DVGMSTREAM_VERSION_AUTO
DEF_CFLAGS += -DVGMSTREAM_VERSION_AUTO -DVGM_LOG_OUTPUT
###############################################################################
### external defs

View File

@ -6,7 +6,7 @@ inputplugindir = $(plugindir)/$(INPUT_PLUGIN_DIR)
inputplugin_LTLIBRARIES = libvgmstream.la
AM_MAKEFLAGS=-f Makefile.autotools
AM_CXXFLAGS = -DVGMSTREAM_VERSION_AUTO -Wall -std=c++11 -fpermissive -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/ $(AUDACIOUS_CFLAGS) $(GTK_CFLAGS)
AM_CXXFLAGS = -DVGMSTREAM_VERSION_AUTO -DVGM_LOG_OUTPUT -Wall -std=c++11 -fpermissive -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/ $(AUDACIOUS_CFLAGS) $(GTK_CFLAGS)
AM_LIBS =
# sources/headers are updated automatically by ./bootstrap script (not all headers are needed though)

View File

@ -133,18 +133,27 @@ bool VgmstreamPlugin::is_our_file(const char * filename, VFSFile & file) {
return vgmstream_ctx_is_valid(filename, &cfg) > 0 ? true : false;
}
static void log_callback(int level, const char* str) {
if (level == VGM_LOG_LEVEL_DEBUG)
AUDDBG("vgmstream: %s", str);
else
AUDINFO("vgmstream: %s", str);
}
// called on startup (main thread)
bool VgmstreamPlugin::init() {
AUDINFO("plugin start\n");
AUDINFO("vgmstream plugin start\n");
vgmstream_settings_load();
vgmstream_set_log_callback(VGM_LOG_LEVEL_ALL, log_callback);
return true;
}
// called on stop (main thread)
void VgmstreamPlugin::cleanup() {
AUDINFO("plugin end\n");
AUDINFO("vgmstream plugin end\n");
vgmstream_settings_save();
}

View File

@ -6,7 +6,7 @@ if HAVE_LIBAO
bin_PROGRAMS += vgmstream123
endif
AM_CFLAGS = -DVGMSTREAM_VERSION_AUTO -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/ $(AO_CFLAGS)
AM_CFLAGS = -DVGMSTREAM_VERSION_AUTO -DVGM_LOG_OUTPUT -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/ext_includes/ $(AO_CFLAGS)
AM_MAKEFLAGS = -f Makefile.autotools
vgmstream_cli_SOURCES = vgmstream_cli.c

View File

@ -272,6 +272,8 @@ static int play_vgmstream(const char* filename, song_settings_t* cfg) {
return -1;
}
vgmstream_set_log_stdout(VGM_LOG_LEVEL_ALL);
sf->stream_index = cfg->stream_index;
vgmstream = init_vgmstream_from_STREAMFILE(sf);
close_streamfile(sf);

View File

@ -694,6 +694,8 @@ static int convert_file(cli_config* cfg) {
goto fail;
}
vgmstream_set_log_stdout(VGM_LOG_LEVEL_ALL);
sf->stream_index = cfg->subsong_index;
vgmstream = init_vgmstream_from_STREAMFILE(sf);
close_streamfile(sf);

View File

@ -24,6 +24,8 @@ macro(setup_target TARGET)
target_link_libraries(${TARGET} m)
endif()
target_compile_definitions(${TARGET} PRIVATE VGM_LOG_OUTPUT)
if(USE_MPEG)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_MPEG)
if(WIN32)

View File

@ -39,6 +39,10 @@ extern "C" {
#define PLUGIN_FILENAME "foo_input_vgmstream.dll"
static void log_callback(int level, const char* str) {
console::formatter() /*<< "vgmstream: "*/ << str;
}
// called every time a file is added to the playlist (to get info) or when playing
input_vgmstream::input_vgmstream() {
vgmstream = NULL;
@ -64,6 +68,8 @@ input_vgmstream::input_vgmstream() {
override_title = false;
load_settings();
vgmstream_set_log_callback(VGM_LOG_LEVEL_ALL, &log_callback);
}
// called on stop or when playlist info has been read