cleanup: api stuff

This commit is contained in:
bnnm 2024-07-21 18:22:56 +02:00
parent 637c93b694
commit c701412dca
4 changed files with 32 additions and 28 deletions

View File

@ -8,8 +8,7 @@
/* vgmstream's public API
*
* By default vgmstream behaves like a simple decoder (extract samples until stream end), but you can configure it
* to loop N times or even downmix (since complex formats need those features). In other words, it also behaves
* a bit like a player.
* to loop N times or even downmix. In other words, it also behaves a bit like a player.
*
* It exposes multiple options and convenience functions beyond simple decoding mainly for various plugins,
* since it was faster moving shared behavior to core rather than reimplementing every time.
@ -19,14 +18,13 @@
* Notes:
* - vgmstream may dynamically allocate stuff as needed (not too much beyond some setup buffers, but varies per format)
* - previously the only way to use vgmstream was accesing its internals. Now there is an API internals may change in the future
* - some details described in the API may not happen at the moment (they are defined to consider internal changes)
* - some details described in the API may not happen at the moment (they are defined for future internal changes)
* - main reason it uses the slighly long-winded libvgmstream_* names is that internals use the vgmstream_* 'namespace'
* - c-strings should be in UTF-8
* - the API is still WIP and may be slightly buggy overall due to lack of time, to be improved later
* - vgmstream's features are mostly stable, but this API may be tweaked from time to time (check API_VERSION)
*
* Basic usage (also see api_example.c):
* - libvgmstream_get_version() // just in case
* - libvgmstream_init(...) // base context
* - libvgmstream_setup(...) // config if needed
* - libvgmstream_open(...) // setup format
@ -42,7 +40,6 @@
//#define LIBVGMSTREAM_CALL __cdecl //needed?
//LIBVGMSTREAM_API (type) LIBVGMSTREAM_CALL libvgmstream_function(...);
/* define external function behavior (during compilation) */
#if defined(LIBVGMSTREAM_EXPORT)
#define LIBVGMSTREAM_API __declspec(dllexport) /* when exporting/creating vgmstream DLL */
@ -52,21 +49,7 @@
#define LIBVGMSTREAM_API /* nothing, internal/default */
#endif
/* Current API version.
* - only refers to the API itself, as changes related to formats/etc don't alter this (since they are usually additive)
* - vgmstream's features are mostly stable, but this API may be tweaked from time to time
*/
#define LIBVGMSTREAM_API_VERSION_MAJOR 1 // breaking API/ABI changes
#define LIBVGMSTREAM_API_VERSION_MINOR 0 // compatible API/ABI changes
#define LIBVGMSTREAM_API_VERSION_PATCH 0 // fixes
/* returns API version in hex format: 0xMMmmpppp = MM-major, mm-minor, pppp-patch
* - use when loading vgmstream as a dynamic library to ensure API/ABI compatibility
*/
LIBVGMSTREAM_API uint32_t libvgmstream_get_version(void);
#include "api_version.h"
#include "api_decode.h"
#include "api_helpers.h"
#include "api_streamfile.h"

25
src/api_version.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef _API_VERSION_H_
#define _API_VERSION_H_
#include "api.h"
#if LIBVGMSTREAM_ENABLE
/* Current API version.
* - only refers to the API itself, as changes related to formats/etc don't alter this (since they are usually additive)
* - vgmstream's features are mostly stable, but this API may be tweaked from time to time
*/
#define LIBVGMSTREAM_API_VERSION_MAJOR 1 // breaking API/ABI changes
#define LIBVGMSTREAM_API_VERSION_MINOR 0 // compatible API/ABI changes
#define LIBVGMSTREAM_API_VERSION_PATCH 0 // fixes
/* returns API version in hex format: 0xMMmmpppp = MM-major, mm-minor, pppp-patch
* - use when loading vgmstream as a dynamic library to ensure API/ABI compatibility
*/
LIBVGMSTREAM_API uint32_t libvgmstream_get_version(void);
/* CHANGELOG:
*
* - 1.0.0: initial version
*/
#endif
#endif

View File

@ -85,6 +85,7 @@
<ClInclude Include="api_helpers.h" />
<ClInclude Include="api_streamfile.h" />
<ClInclude Include="api_tags.h" />
<ClInclude Include="api_version.h" />
<ClInclude Include="streamfile.h" />
<ClInclude Include="streamtypes.h" />
<ClInclude Include="util.h" />
@ -201,7 +202,6 @@
<ClInclude Include="util\reader_put.h" />
<ClInclude Include="util\reader_sf.h" />
<ClInclude Include="util\reader_text.h" />
<ClInclude Include="util\samples_ops.h" />
<ClInclude Include="util\sf_utils.h" />
<ClInclude Include="util\text_reader.h" />
<ClInclude Include="util\vgmstream_limits.h" />
@ -804,7 +804,6 @@
<ClCompile Include="util\miniz.c" />
<ClCompile Include="util\paths.c" />
<ClCompile Include="util\reader.c" />
<ClCompile Include="util\samples_ops.c" />
<ClCompile Include="util\sf_utils.c" />
<ClCompile Include="util\text_reader.c" />
</ItemGroup>

View File

@ -89,6 +89,9 @@
<ClInclude Include="api_tags.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="api_version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="streamfile.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -437,9 +440,6 @@
<ClInclude Include="util\reader_text.h">
<Filter>util\Header Files</Filter>
</ClInclude>
<ClInclude Include="util\samples_ops.h">
<Filter>util\Header Files</Filter>
</ClInclude>
<ClInclude Include="util\sf_utils.h">
<Filter>util\Header Files</Filter>
</ClInclude>
@ -2242,9 +2242,6 @@
<ClCompile Include="util\reader.c">
<Filter>util\Source Files</Filter>
</ClCompile>
<ClCompile Include="util\samples_ops.c">
<Filter>util\Source Files</Filter>
</ClCompile>
<ClCompile Include="util\sf_utils.c">
<Filter>util\Source Files</Filter>
</ClCompile>