diff --git a/cli/api_example.c b/cli/api_example.c index 0fd82286..fbc036cf 100644 --- a/cli/api_example.c +++ b/cli/api_example.c @@ -121,7 +121,7 @@ static int api_example(const char* infile) { buf_bytes = err * sizeof(short) * lib->format->channels; } else { - err = libvgmstream_play(lib); + err = libvgmstream_render(lib); if (err < 0) goto fail; buf = lib->decoder->buf; diff --git a/src/base/api_decode_play.c b/src/base/api_decode_play.c index d7339008..97b8da85 100644 --- a/src/base/api_decode_play.c +++ b/src/base/api_decode_play.c @@ -51,7 +51,7 @@ static void update_decoder_info(libvgmstream_priv_t* priv, int samples_done) { priv->dec.done = priv->decode_done; } -LIBVGMSTREAM_API int libvgmstream_play(libvgmstream_t* lib) { +LIBVGMSTREAM_API int libvgmstream_render(libvgmstream_t* lib) { if (!lib || !lib->priv) return LIBVGMSTREAM_ERROR_GENERIC; @@ -85,7 +85,7 @@ LIBVGMSTREAM_API int libvgmstream_fill(libvgmstream_t* lib, void* buf, int buf_s return LIBVGMSTREAM_ERROR_GENERIC; if (priv->buf.consumed >= priv->buf.samples) { - int err = libvgmstream_play(lib); + int err = libvgmstream_render(lib); if (err < 0) return err; } diff --git a/src/base/api_helpers.c b/src/base/api_helpers.c index 9bc83ab0..42b498d2 100644 --- a/src/base/api_helpers.c +++ b/src/base/api_helpers.c @@ -88,4 +88,8 @@ LIBVGMSTREAM_API int libvgmstream_get_title(libvgmstream_t* lib, libvgmstream_ti return LIBVGMSTREAM_OK; } +LIBVGMSTREAM_API bool libvgmstream_is_virtual_filename(const char* filename) { + return vgmstream_is_virtual_filename(filename); +} + #endif diff --git a/src/libvgmstream.h b/src/libvgmstream.h index 17768520..3ac947eb 100644 --- a/src/libvgmstream.h +++ b/src/libvgmstream.h @@ -1,30 +1,29 @@ -/* libvgmstream: vgmstream's public API */ - #ifndef _LIBVGMSTREAM_H_ #define _LIBVGMSTREAM_H_ //#define LIBVGMSTREAM_ENABLE 1 #if LIBVGMSTREAM_ENABLE -/* By default vgmstream behaves like a decoder (decode samples until stream end), but you can configure +/* libvgmstream: vgmstream's public API + * + * Basic usage (also see api_example.c): + * - libvgmstream_init(...) // create context + * - libvgmstream_setup(...) // setup config (if needed) + * - libvgmstream_open_song(...) // open format + * - libvgmstream_render(...) // main decode + * - output samples + repeat libvgmstream_render until stream is done + * - libvgmstream_free(...) // cleanup + * + * By default vgmstream behaves like a decoder (returns samples until stream end), but you can configure * it to loop N times or even downmix. In other words, it also behaves a bit like a player. - * It exposes multiple convenience stuff mainly for various plugins that mostly repeat the same features. - * All this may make the API still WIP and a bit twisted, probably will improve later. Probably. - * + * It exposes multiple convenience stuff mainly for various plugins with similar features. + * This may make the API a bit odd, will probably improve later. Probably. + * * Notes: - * - now there is an API internals (vgmstream.h) may change in the future - * - may dynamically allocate stuff as needed (mainly some buffers, but varies per format) + * - now there is an API, internals (vgmstream.h) may change in the future so avoid accesing them * - some details described in the API may not happen at the moment (defined for future changes) * - uses long-winded libvgmstream_* names since internals alredy use the vgmstream_* 'namespace', #define as needed * - c-strings should be in UTF-8 - * - * Basic usage (also see api_example.c): - * - libvgmstream_init(...) // base context - * - libvgmstream_setup(...) // config if needed - * - libvgmstream_open_song(...) // setup format - * - libvgmstream_play(...) // main decode - * - output samples + repeat libvgmstream_play until stream is done - * - libvgmstream_free(...) // cleanup */ @@ -108,7 +107,9 @@ typedef struct { int64_t stream_samples; // file's max samples (not final play duration) int64_t loop_start; // loop start sample int64_t loop_end; // loop end sample - bool loop_flag; // if file loops (false + defined loops means looping was forcefully disabled) + bool loop_flag; // if file loops + // ** false + defined loops means looping was forcefully disabled + // ** true + undefined loops means the file loops in a way not representable by loop points bool play_forever; // if file loops forever based on current config (meaning _play never stops) int64_t play_samples; // totals after all calculations (after applying loop/fade/etc config) @@ -191,8 +192,8 @@ typedef struct { } libvgmstream_config_t; /* pass default config, that will be applied to song on open - * - invalid config or complex cases (ex. some TXTP) may ignore these settings. - * - called without a song loaded (before _open or after _close), otherwise ignored. + * - invalid config or complex cases (ex. some TXTP) may ignore these settings + * - should be called without a song loaded (before _open or after _close) * - without config vgmstream will decode the current stream once */ LIBVGMSTREAM_API void libvgmstream_setup(libvgmstream_t* lib, libvgmstream_config_t* cfg); @@ -227,7 +228,7 @@ LIBVGMSTREAM_API void libvgmstream_close_song(libvgmstream_t* lib); * - vgmstream supplies its own buffer, updated on lib->decoder->* values (may change between calls) * - returns < 0 on error */ -LIBVGMSTREAM_API int libvgmstream_play(libvgmstream_t* lib); +LIBVGMSTREAM_API int libvgmstream_render(libvgmstream_t* lib); /* Same as _play, but fills some external buffer (also updates lib->decoder->* values) * - returns < 0 on error, or N = number of filled samples. @@ -297,7 +298,7 @@ typedef struct { /* Returns if vgmstream can parse a filename by extension, to reject some files earlier * - doesn't check file contents (that's only done on _open) * - config may be NULL - * - mainly for plugins that fail early; libvgmstream doesn't use this + * - mainly for plugins that want to fail early; libvgmstream doesn't use this */ LIBVGMSTREAM_API bool libvgmstream_is_valid(const char* filename, libvgmstream_valid_t* cfg); @@ -321,6 +322,9 @@ LIBVGMSTREAM_API int libvgmstream_get_title(libvgmstream_t* lib, libvgmstream_ti */ LIBVGMSTREAM_API int libvgmstream_format_describe(libvgmstream_t* lib, char* dst, int dst_size); +/* Return true if vgmstream detects from the filename that file can be used even if doesn't physically exist. + */ +LIBVGMSTREAM_API bool libvgmstream_is_virtual_filename(const char* filename); /*****************************************************************************/ diff --git a/winamp/in_config.c b/winamp/in_config.c index 364edbbd..95824c17 100644 --- a/winamp/in_config.c +++ b/winamp/in_config.c @@ -60,29 +60,29 @@ static void ini_get_filename(In_Module* input_module, TCHAR *inifile) { if (IsWindow(input_module->hMainWindow) && SendMessage(input_module->hMainWindow, WM_WA_IPC,0,IPC_GETVERSION) >= 0x5000) { /* newer Winamp with per-user settings */ TCHAR *ini_dir = (TCHAR *)SendMessage(input_module->hMainWindow, WM_WA_IPC, 0, IPC_GETINIDIRECTORY); - cfg_strncpy(inifile, ini_dir, PATH_LIMIT); + cfg_strncpy(inifile, ini_dir, WINAMP_PATH_LIMIT); - cfg_strncat(inifile, TEXT("\\Plugins\\"), PATH_LIMIT); + cfg_strncat(inifile, TEXT("\\Plugins\\"), WINAMP_PATH_LIMIT); /* can't be certain that \Plugins already exists in the user dir */ CreateDirectory(inifile,NULL); - cfg_strncat(inifile, CONFIG_INI_NAME, PATH_LIMIT); + cfg_strncat(inifile, CONFIG_INI_NAME, WINAMP_PATH_LIMIT); } else { /* older winamp with single settings */ TCHAR *lastSlash; - GetModuleFileName(NULL, inifile, PATH_LIMIT); + GetModuleFileName(NULL, inifile, WINAMP_PATH_LIMIT); lastSlash = cfg_strrchr(inifile, TEXT('\\')); *(lastSlash + 1) = 0; /* XMPlay doesn't have a "plugins" subfolder */ if (settings.is_xmplay) - cfg_strncat(inifile, CONFIG_INI_NAME,PATH_LIMIT); + cfg_strncat(inifile, CONFIG_INI_NAME, WINAMP_PATH_LIMIT); else - cfg_strncat(inifile, TEXT("Plugins\\") CONFIG_INI_NAME,PATH_LIMIT); + cfg_strncat(inifile, TEXT("Plugins\\") CONFIG_INI_NAME, WINAMP_PATH_LIMIT); /* Maybe should query IPC_GETINIDIRECTORY and use that, not sure what ancient Winamps need. * There must be some proper way to handle dirs since other Winamp plugins save config in * XMPlay correctly (this feels like archaeology, try later) */ @@ -144,7 +144,7 @@ static void ini_set_b(const char *inifile, const char *entry, int val) { } /*static*/ void load_config(In_Module* input_module, winamp_settings_t* settings, winamp_settings_t* defaults) { - TCHAR inifile[PATH_LIMIT]; + TCHAR inifile[WINAMP_PATH_LIMIT]; ini_get_filename(input_module, inifile); @@ -176,7 +176,7 @@ static void ini_set_b(const char *inifile, const char *entry, int val) { } static void save_config(In_Module* input_module, winamp_settings_t* settings) { - TCHAR inifile[PATH_LIMIT]; + TCHAR inifile[WINAMP_PATH_LIMIT]; ini_get_filename(input_module, inifile); diff --git a/winamp/in_streamfile.c b/winamp/in_streamfile.c index a0fda4df..b8455287 100644 --- a/winamp/in_streamfile.c +++ b/winamp/in_streamfile.c @@ -61,14 +61,14 @@ static void wasf_get_name(WINAMP_STREAMFILE* sf, char* buffer, size_t length) { } static STREAMFILE* wasf_open(WINAMP_STREAMFILE* sf, const char* const filename, size_t buffersize) { - in_char wpath[PATH_LIMIT]; + in_char wpath[WINAMP_PATH_LIMIT]; if (!filename) return NULL; /* no need to wfdopen here, may use standard IO */ /* STREAMFILEs carry char/UTF8 names, convert to wchar for Winamp */ - wa_char_to_ichar(wpath, PATH_LIMIT, filename); + wa_char_to_ichar(wpath, WINAMP_PATH_LIMIT, filename); return open_winamp_streamfile_by_ipath(wpath); } @@ -109,11 +109,11 @@ fail: STREAMFILE* open_winamp_streamfile_by_ipath(const in_char* wpath) { FILE* infile = NULL; STREAMFILE* sf; - char path[PATH_LIMIT]; + char path[WINAMP_PATH_LIMIT]; /* convert to UTF-8 if needed for internal use */ - wa_ichar_to_char(path,PATH_LIMIT, wpath); + wa_ichar_to_char(path, WINAMP_PATH_LIMIT, wpath); /* open a FILE from a Winamp (possibly UTF-16) path */ infile = wa_fopen(wpath); diff --git a/winamp/in_utils.c b/winamp/in_utils.c index 6b96ed26..5e6d4a71 100644 --- a/winamp/in_utils.c +++ b/winamp/in_utils.c @@ -89,9 +89,9 @@ bool split_subsongs(const in_char* filename, int subsong_index, VGMSTREAM* vgmst /* The only way to pass info around in Winamp is encoding it into the filename, so a fake name * is created with the index. Then, winamp_Play (and related) intercepts and reads the index. */ for (i = 0; i < vgmstream->num_streams; i++) { - in_char stream_fn[PATH_LIMIT]; + in_char stream_fn[WINAMP_PATH_LIMIT]; - make_fn_subsong(stream_fn,PATH_LIMIT, filename, (i+1)); /* encode index in filename */ + make_fn_subsong(stream_fn, WINAMP_PATH_LIMIT, filename, (i+1)); /* encode index in filename */ /* insert at index */ { diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index d6c165f2..f86b2895 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -51,15 +51,15 @@ const char* tagfile_name = "!tags.m3u"; HANDLE decode_thread_handle = INVALID_HANDLE_VALUE; VGMSTREAM* vgmstream = NULL; -in_char lastfn[PATH_LIMIT] = {0}; /* name of the currently playing file */ +in_char lastfn[WINAMP_PATH_LIMIT] = {0}; /* name of the currently playing file */ winamp_settings_t defaults; winamp_settings_t settings; winamp_state_t state; -short sample_buffer[SAMPLE_BUFFER_SIZE*2 * VGMSTREAM_MAX_CHANNELS]; //todo maybe should be dynamic +short sample_buffer[SAMPLE_BUFFER_SIZE * 2 * VGMSTREAM_MAX_CHANNELS]; //todo maybe should be dynamic /* info cache (optimization) */ -in_char info_fn[PATH_LIMIT] = {0}; +in_char info_fn[WINAMP_PATH_LIMIT] = {0}; in_char info_title[GETFILEINFO_TITLE_LENGTH]; int info_time; int info_valid; @@ -116,11 +116,11 @@ static VGMSTREAM* init_vgmstream_winamp(const in_char* fn, int stream_index) { /* opens vgmstream with (possibly) an index */ static VGMSTREAM* init_vgmstream_winamp_fileinfo(const in_char* fn) { - in_char filename[PATH_LIMIT]; + in_char filename[WINAMP_PATH_LIMIT]; int stream_index = 0; /* check for info encoded in the filename */ - parse_fn_string(fn, NULL, filename,PATH_LIMIT); + parse_fn_string(fn, NULL, filename, WINAMP_PATH_LIMIT); parse_fn_int(fn, wa_L("$s"), &stream_index); return init_vgmstream_winamp(filename, stream_index); @@ -141,14 +141,14 @@ static int is_xmplay() { /* unicode utils */ static void get_title(in_char* dst, int dst_size, const in_char* fn, VGMSTREAM* infostream) { - in_char filename[PATH_LIMIT]; - char buffer[PATH_LIMIT]; - char filename_utf8[PATH_LIMIT]; + in_char filename[WINAMP_PATH_LIMIT]; + char buffer[WINAMP_PATH_LIMIT]; + char filename_utf8[WINAMP_PATH_LIMIT]; - parse_fn_string(fn, NULL, filename,PATH_LIMIT); + parse_fn_string(fn, NULL, filename,WINAMP_PATH_LIMIT); //parse_fn_int(fn, wa_L("$s"), &stream_index); - wa_ichar_to_char(filename_utf8, PATH_LIMIT, filename); + wa_ichar_to_char(filename_utf8, WINAMP_PATH_LIMIT, filename); /* infostream gets added at first with index 0, then once played it re-adds proper numbers */ if (infostream) { @@ -187,7 +187,7 @@ static double get_album_gain_volume(const in_char* fn) { if (settings.gain_type == REPLAYGAIN_NONE) return 1.0; - //;{ char f8[PATH_LIMIT]; wa_ichar_to_char(f8,PATH_LIMIT,(in_char*)fn); vgm_logi("get_album_gain_volume: file %s\n", f8); } + //;{ char f8[WINAMP_PATH_LIMIT]; wa_ichar_to_char(f8,WINAMP_PATH_LIMIT,(in_char*)fn); vgm_logi("get_album_gain_volume: file %s\n", f8); } replaygain[0] = '\0'; /* reset each time to make sure we read actual tags */ if (settings.gain_type == REPLAYGAIN_ALBUM @@ -281,7 +281,7 @@ void winamp_Quit() { int winamp_IsOurFile(const in_char *fn) { VGMSTREAM* infostream; vgmstream_ctx_valid_cfg cfg = {0}; - char filename_utf8[PATH_LIMIT]; + char filename_utf8[WINAMP_PATH_LIMIT]; int valid; /* Winamp file opening 101: @@ -315,7 +315,7 @@ int winamp_IsOurFile(const in_char *fn) { cfg.accept_unknown = settings.exts_unknown_on; cfg.accept_common = settings.exts_common_on; - wa_ichar_to_char(filename_utf8, PATH_LIMIT, fn); + wa_ichar_to_char(filename_utf8, WINAMP_PATH_LIMIT, fn); //;vgm_logi("winamp_IsOurFile: %s\n", filename_utf8); @@ -324,7 +324,7 @@ int winamp_IsOurFile(const in_char *fn) { * open/get info from the file (slower so keep some cache) */ info_valid = 0; /* may not be playable */ - wa_strncpy(info_fn, fn, PATH_LIMIT); /* copy now for repeat calls */ + wa_strncpy(info_fn, fn, WINAMP_PATH_LIMIT); /* copy now for repeat calls */ /* basic extension check */ valid = vgmstream_ctx_is_valid(filename_utf8, &cfg); @@ -369,17 +369,17 @@ int winamp_IsOurFile(const in_char *fn) { /* request to start playing a file */ int winamp_Play(const in_char *fn) { int max_latency; - in_char filename[PATH_LIMIT]; + in_char filename[WINAMP_PATH_LIMIT]; int stream_index = 0; - //;{ char f8[PATH_LIMIT]; wa_ichar_to_char(f8,PATH_LIMIT,fn); vgm_logi("winamp_Play: file %s\n", f8); } + //;{ char f8[WINAMP_PATH_LIMIT]; wa_ichar_to_char(f8,WINAMP_PATH_LIMIT,fn); vgm_logi("winamp_Play: file %s\n", f8); } /* shouldn't happen */ if (vgmstream) return 1; /* check for info encoded in the filename */ - parse_fn_string(fn, NULL, filename,PATH_LIMIT); + parse_fn_string(fn, NULL, filename,WINAMP_PATH_LIMIT); parse_fn_int(fn, wa_L("$s"), &stream_index); /* open the stream */ @@ -412,7 +412,7 @@ int winamp_Play(const in_char *fn) { /* save original name */ - wa_strncpy(lastfn,fn,PATH_LIMIT); + wa_strncpy(lastfn,fn,WINAMP_PATH_LIMIT); /* open the output plugin */ max_latency = input_module.outMod->Open(vgmstream->sample_rate, state.output_channels, 16, 0, 0); @@ -530,7 +530,7 @@ int winamp_InfoBox(const in_char *fn, HWND hwnd) { if (!vgmstream) return 0; - describe_vgmstream(vgmstream,description,sizeof(description)); + describe_vgmstream(vgmstream, description, sizeof(description)); } else { /* some other file in playlist given by filename */ @@ -544,7 +544,7 @@ int winamp_InfoBox(const in_char *fn, HWND hwnd) { vgmstream_mixing_autodownmix(infostream, settings.downmix_channels); vgmstream_mixing_enable(infostream, 0, NULL, NULL); - describe_vgmstream(infostream,description,sizeof(description)); + describe_vgmstream(infostream, description, sizeof(description)); close_vgmstream(infostream); infostream = NULL; @@ -592,7 +592,7 @@ void winamp_GetFileInfo(const in_char *fn, in_char *title, int *length_in_ms) { } else { VGMSTREAM* infostream = NULL; - //;{ char f8[PATH_LIMIT]; wa_ichar_to_char(f8,PATH_LIMIT,fn); vgm_logi("winamp_GetFileInfo: file %s\n", f8); } + //;{ char f8[WINAMP_PATH_LIMIT]; wa_ichar_to_char(f8,WINAMP_PATH_LIMIT,fn); vgm_logi("winamp_GetFileInfo: file %s\n", f8); } /* not changed from last IsOurFile (most common) */ if (info_valid && wa_strcmp(fn, info_fn) == 0) { @@ -789,13 +789,13 @@ __declspec(dllexport) In_Module * winampGetInModule2() { /* IN_TAGS */ /* ************************************* */ -/* could malloc and stuff but totals aren't much bigger than PATH_LIMITs anyway */ +/* could malloc and stuff but totals aren't much bigger than WINAMP_PATH_LIMITs anyway */ #define WINAMP_TAGS_ENTRY_MAX 30 #define WINAMP_TAGS_ENTRY_SIZE 2048 typedef struct { int loaded; - in_char filename[PATH_LIMIT]; /* tags are loaded for this file */ + in_char filename[WINAMP_PATH_LIMIT]; /* tags are loaded for this file */ int tag_count; char keys[WINAMP_TAGS_ENTRY_MAX][WINAMP_TAGS_ENTRY_SIZE+1]; @@ -809,10 +809,10 @@ winamp_tags last_tags; * Winamp requests one tag at a time and may reask for the same tag several times */ static void load_tagfile_info(in_char* filename) { STREAMFILE *tagFile = NULL; - in_char filename_clean[PATH_LIMIT]; - char filename_utf8[PATH_LIMIT]; - char tagfile_path_utf8[PATH_LIMIT]; - in_char tagfile_path_i[PATH_LIMIT]; + in_char filename_clean[WINAMP_PATH_LIMIT]; + char filename_utf8[WINAMP_PATH_LIMIT]; + char tagfile_path_utf8[WINAMP_PATH_LIMIT]; + in_char tagfile_path_i[WINAMP_PATH_LIMIT]; char *path; @@ -823,7 +823,7 @@ static void load_tagfile_info(in_char* filename) { } /* clean extra part for subsong tags */ - parse_fn_string(filename, NULL, filename_clean,PATH_LIMIT); + parse_fn_string(filename, NULL, filename_clean,WINAMP_PATH_LIMIT); if (wa_strcmp(last_tags.filename, filename_clean) == 0) { return; /* not changed, tags still apply */ @@ -832,18 +832,18 @@ static void load_tagfile_info(in_char* filename) { last_tags.loaded = 0; /* tags are now for this filename, find tagfile path */ - wa_ichar_to_char(filename_utf8, PATH_LIMIT, filename_clean); + wa_ichar_to_char(filename_utf8, WINAMP_PATH_LIMIT, filename_clean); strcpy(tagfile_path_utf8,filename_utf8); path = strrchr(tagfile_path_utf8,'\\'); if (path != NULL) { path[1] = '\0'; /* includes "\", remove after that from tagfile_path */ - strcat(tagfile_path_utf8,tagfile_name); + strcat(tagfile_path_utf8, tagfile_name); } else { /* ??? */ - strcpy(tagfile_path_utf8,tagfile_name); + strcpy(tagfile_path_utf8, tagfile_name); } - wa_char_to_ichar(tagfile_path_i, PATH_LIMIT, tagfile_path_utf8); + wa_char_to_ichar(tagfile_path_i, WINAMP_PATH_LIMIT, tagfile_path_utf8); wa_strcpy(last_tags.filename, filename_clean); last_tags.tag_count = 0; @@ -895,7 +895,7 @@ static int winampGetExtendedFileInfo_common(in_char* filename, char *metadata, c int i, tag_found; int max_len; - //;{ char f8[PATH_LIMIT]; wa_ichar_to_char(f8,PATH_LIMIT,filename); vgm_logi("winampGetExtendedFileInfo_common: file %s\n", f8); } + //;{ char f8[WINAMP_PATH_LIMIT]; wa_ichar_to_char(f8,WINAMP_PATH_LIMIT,filename); vgm_logi("winampGetExtendedFileInfo_common: file %s\n", f8); } /* load list current tags, if necessary */ load_tagfile_info(filename); @@ -952,13 +952,13 @@ fail: /* for Winamp 5.24 */ __declspec (dllexport) int winampGetExtendedFileInfo(char *filename, char *metadata, char *ret, int retlen) { - in_char filename_wchar[PATH_LIMIT]; + in_char filename_wchar[WINAMP_PATH_LIMIT]; int ok; if (settings.tagfile_disable) return 0; - wa_char_to_ichar(filename_wchar,PATH_LIMIT, filename); + wa_char_to_ichar(filename_wchar,WINAMP_PATH_LIMIT, filename); //;{ vgm_logi("winampGetExtendedFileInfo: file %s\n", filename); } @@ -971,16 +971,16 @@ __declspec (dllexport) int winampGetExtendedFileInfo(char *filename, char *metad /* for Winamp 5.3+ */ __declspec (dllexport) int winampGetExtendedFileInfoW(wchar_t *filename, char *metadata, wchar_t *ret, int retlen) { - in_char filename_ichar[PATH_LIMIT]; + in_char filename_ichar[WINAMP_PATH_LIMIT]; char ret_utf8[2048]; int ok; if (settings.tagfile_disable) return 0; - wa_wchar_to_ichar(filename_ichar,PATH_LIMIT, filename); + wa_wchar_to_ichar(filename_ichar,WINAMP_PATH_LIMIT, filename); - //;{ char f8[PATH_LIMIT]; wa_ichar_to_char(f8,PATH_LIMIT,filename); vgm_logi("winampGetExtendedFileInfoW: file %s\n", f8); } + //;{ char f8[WINAMP_PATH_LIMIT]; wa_ichar_to_char(f8,WINAMP_PATH_LIMIT,filename); vgm_logi("winampGetExtendedFileInfoW: file %s\n", f8); } ok = winampGetExtendedFileInfo_common(filename_ichar, metadata, ret_utf8,2048); if (ok == 0) @@ -1019,7 +1019,7 @@ short xsample_buffer[SAMPLE_BUFFER_SIZE*2 * VGMSTREAM_MAX_CHANNELS]; static void* winampGetExtendedRead_open_common(in_char *fn, int *size, int *bps, int *nch, int *srate) { VGMSTREAM* xvgmstream = NULL; - //;{ char f8[PATH_LIMIT]; wa_ichar_to_char(f8,PATH_LIMIT,fn); vgm_logi("winampGetExtendedRead_open_common: open common file %s\n", f8); } + //;{ char f8[WINAMP_PATH_LIMIT]; wa_ichar_to_char(f8,WINAMP_PATH_LIMIT,fn); vgm_logi("winampGetExtendedRead_open_common: open common file %s\n", f8); } /* open the stream */ xvgmstream = init_vgmstream_winamp_fileinfo(fn); @@ -1056,17 +1056,17 @@ static void* winampGetExtendedRead_open_common(in_char *fn, int *size, int *bps, } __declspec(dllexport) void* winampGetExtendedRead_open(const char *fn, int *size, int *bps, int *nch, int *srate) { - in_char filename_wchar[PATH_LIMIT]; + in_char filename_wchar[WINAMP_PATH_LIMIT]; - wa_char_to_ichar(filename_wchar, PATH_LIMIT, fn); + wa_char_to_ichar(filename_wchar, WINAMP_PATH_LIMIT, fn); return winampGetExtendedRead_open_common(filename_wchar, size, bps, nch, srate); } __declspec(dllexport) void* winampGetExtendedRead_openW(const wchar_t *fn, int *size, int *bps, int *nch, int *srate) { - in_char filename_ichar[PATH_LIMIT]; + in_char filename_ichar[WINAMP_PATH_LIMIT]; - wa_wchar_to_ichar(filename_ichar, PATH_LIMIT, fn); + wa_wchar_to_ichar(filename_ichar, WINAMP_PATH_LIMIT, fn); return winampGetExtendedRead_open_common(filename_ichar, size, bps, nch, srate); } diff --git a/winamp/in_vgmstream.h b/winamp/in_vgmstream.h index 83a67d3d..19191146 100644 --- a/winamp/in_vgmstream.h +++ b/winamp/in_vgmstream.h @@ -33,6 +33,8 @@ /* IN_CONFIG */ /* ************************************* */ +#define WINAMP_PATH_LIMIT 4096 + extern In_Module input_module; extern const int priority_values[7];