mirror of
https://github.com/google/liblc3.git
synced 2026-07-19 13:30:50 +00:00
msvc: Fix MSVC compilation and CI
This commit is contained in:
committed by
Antoine SOULIER
parent
ae0fb3757f
commit
bfea2c04c1
@@ -29,6 +29,21 @@ jobs:
|
|||||||
CC: gcc
|
CC: gcc
|
||||||
- run: meson compile -C builddir/
|
- run: meson compile -C builddir/
|
||||||
|
|
||||||
|
build-msvc-meson:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
cache: 'pip'
|
||||||
|
- run: pip install meson ninja
|
||||||
|
- uses: TheMrMilchmann/setup-msvc-dev@v3
|
||||||
|
with:
|
||||||
|
arch: x64
|
||||||
|
- run: meson setup builddir
|
||||||
|
- run: meson compile -C builddir
|
||||||
|
|
||||||
build-wasm:
|
build-wasm:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
+27
-23
@@ -262,9 +262,9 @@ typedef LC3_DECODER_MEM_T(10000, 48000) lc3_decoder_mem_48k_t;
|
|||||||
* sr_hz Sample rate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000
|
* sr_hz Sample rate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000
|
||||||
* return Number of PCM samples, -1 on bad parameters
|
* return Number of PCM samples, -1 on bad parameters
|
||||||
*/
|
*/
|
||||||
int lc3_hr_frame_samples(bool hrmode, int dt_us, int sr_hz);
|
LC3_EXPORT int lc3_hr_frame_samples(bool hrmode, int dt_us, int sr_hz);
|
||||||
|
|
||||||
int lc3_frame_samples(int dt_us, int sr_hz);
|
LC3_EXPORT int lc3_frame_samples(int dt_us, int sr_hz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the size of frames, from bitrate
|
* Return the size of frames, from bitrate
|
||||||
@@ -275,9 +275,10 @@ int lc3_frame_samples(int dt_us, int sr_hz);
|
|||||||
* respectively the minimum and maximum allowed size.
|
* respectively the minimum and maximum allowed size.
|
||||||
* return The floor size in bytes of the frames, -1 on bad parameters
|
* return The floor size in bytes of the frames, -1 on bad parameters
|
||||||
*/
|
*/
|
||||||
int lc3_hr_frame_bytes(bool hrmode, int dt_us, int sr_hz, int bitrate);
|
LC3_EXPORT int lc3_hr_frame_bytes(
|
||||||
|
bool hrmode, int dt_us, int sr_hz, int bitrate);
|
||||||
|
|
||||||
int lc3_frame_bytes(int dt_us, int bitrate);
|
LC3_EXPORT int lc3_frame_bytes(int dt_us, int bitrate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the size of frame blocks, from bitrate
|
* Return the size of frame blocks, from bitrate
|
||||||
@@ -290,10 +291,10 @@ int lc3_frame_bytes(int dt_us, int bitrate);
|
|||||||
* respectively the minimum and maximum allowed size.
|
* respectively the minimum and maximum allowed size.
|
||||||
* return The floor size in bytes of the frames, -1 on bad parameters
|
* return The floor size in bytes of the frames, -1 on bad parameters
|
||||||
*/
|
*/
|
||||||
int lc3_hr_frame_block_bytes(bool hrmode,
|
LC3_EXPORT int lc3_hr_frame_block_bytes(
|
||||||
int dt_us, int sr_hz, int nchannels, int bitrate);
|
bool hrmode, int dt_us, int sr_hz, int nchannels, int bitrate);
|
||||||
|
|
||||||
int lc3_frame_block_bytes(int dt_us, int nframes, int bitrate);
|
LC3_EXPORT int lc3_frame_block_bytes(int dt_us, int nframes, int bitrate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve the bitrate, from the size of frames
|
* Resolve the bitrate, from the size of frames
|
||||||
@@ -303,9 +304,10 @@ int lc3_frame_block_bytes(int dt_us, int nframes, int bitrate);
|
|||||||
* nbytes Size in bytes of the frames or frame blocks
|
* nbytes Size in bytes of the frames or frame blocks
|
||||||
* return The ceiled bitrate in bps, -1 on bad parameters
|
* return The ceiled bitrate in bps, -1 on bad parameters
|
||||||
*/
|
*/
|
||||||
int lc3_hr_resolve_bitrate(bool hrmode, int dt_us, int sr_hz, int nbytes);
|
LC3_EXPORT int lc3_hr_resolve_bitrate(
|
||||||
|
bool hrmode, int dt_us, int sr_hz, int nbytes);
|
||||||
|
|
||||||
int lc3_resolve_bitrate(int dt_us, int nbytes);
|
LC3_EXPORT int lc3_resolve_bitrate(int dt_us, int nbytes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return algorithmic delay, as a number of samples
|
* Return algorithmic delay, as a number of samples
|
||||||
@@ -314,9 +316,9 @@ int lc3_resolve_bitrate(int dt_us, int nbytes);
|
|||||||
* sr_hz Sample rate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000
|
* sr_hz Sample rate in Hz, 8000, 16000, 24000, 32000, 48000 or 96000
|
||||||
* return Number of algorithmic delay samples, -1 on bad parameters
|
* return Number of algorithmic delay samples, -1 on bad parameters
|
||||||
*/
|
*/
|
||||||
int lc3_hr_delay_samples(bool hrmode, int dt_us, int sr_hz);
|
LC3_EXPORT int lc3_hr_delay_samples(bool hrmode, int dt_us, int sr_hz);
|
||||||
|
|
||||||
int lc3_delay_samples(int dt_us, int sr_hz);
|
LC3_EXPORT int lc3_delay_samples(int dt_us, int sr_hz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return size needed for an encoder
|
* Return size needed for an encoder
|
||||||
@@ -328,9 +330,9 @@ int lc3_delay_samples(int dt_us, int sr_hz);
|
|||||||
* The `sr_hz` parameter is the sample rate of the PCM input stream,
|
* The `sr_hz` parameter is the sample rate of the PCM input stream,
|
||||||
* and will match `sr_pcm_hz` of `lc3_hr_setup_encoder()`.
|
* and will match `sr_pcm_hz` of `lc3_hr_setup_encoder()`.
|
||||||
*/
|
*/
|
||||||
unsigned lc3_hr_encoder_size(bool hrmode, int dt_us, int sr_hz);
|
LC3_EXPORT unsigned lc3_hr_encoder_size(bool hrmode, int dt_us, int sr_hz);
|
||||||
|
|
||||||
unsigned lc3_encoder_size(int dt_us, int sr_hz);
|
LC3_EXPORT unsigned lc3_encoder_size(int dt_us, int sr_hz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup encoder
|
* Setup encoder
|
||||||
@@ -347,10 +349,10 @@ unsigned lc3_encoder_size(int dt_us, int sr_hz);
|
|||||||
* sample rate `sr_hz`. The size of the context needed, given by
|
* sample rate `sr_hz`. The size of the context needed, given by
|
||||||
* `lc3_hr_encoder_size()` will be set accordingly to `sr_pcm_hz`.
|
* `lc3_hr_encoder_size()` will be set accordingly to `sr_pcm_hz`.
|
||||||
*/
|
*/
|
||||||
lc3_encoder_t lc3_hr_setup_encoder(bool hrmode,
|
LC3_EXPORT lc3_encoder_t lc3_hr_setup_encoder(
|
||||||
int dt_us, int sr_hz, int sr_pcm_hz, void *mem);
|
bool hrmode, int dt_us, int sr_hz, int sr_pcm_hz, void *mem);
|
||||||
|
|
||||||
lc3_encoder_t lc3_setup_encoder(
|
LC3_EXPORT lc3_encoder_t lc3_setup_encoder(
|
||||||
int dt_us, int sr_hz, int sr_pcm_hz, void *mem);
|
int dt_us, int sr_hz, int sr_pcm_hz, void *mem);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -362,7 +364,8 @@ lc3_encoder_t lc3_setup_encoder(
|
|||||||
* out Output buffer of `nbytes` size
|
* out Output buffer of `nbytes` size
|
||||||
* return 0: On success -1: Wrong parameters
|
* return 0: On success -1: Wrong parameters
|
||||||
*/
|
*/
|
||||||
int lc3_encode(lc3_encoder_t encoder, enum lc3_pcm_format fmt,
|
LC3_EXPORT int lc3_encode(
|
||||||
|
lc3_encoder_t encoder, enum lc3_pcm_format fmt,
|
||||||
const void *pcm, int stride, int nbytes, void *out);
|
const void *pcm, int stride, int nbytes, void *out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -375,9 +378,9 @@ int lc3_encode(lc3_encoder_t encoder, enum lc3_pcm_format fmt,
|
|||||||
* The `sr_hz` parameter is the sample rate of the PCM output stream,
|
* The `sr_hz` parameter is the sample rate of the PCM output stream,
|
||||||
* and will match `sr_pcm_hz` of `lc3_hr_setup_decoder()`.
|
* and will match `sr_pcm_hz` of `lc3_hr_setup_decoder()`.
|
||||||
*/
|
*/
|
||||||
unsigned lc3_hr_decoder_size(bool hrmode, int dt_us, int sr_hz);
|
LC3_EXPORT unsigned lc3_hr_decoder_size(bool hrmode, int dt_us, int sr_hz);
|
||||||
|
|
||||||
unsigned lc3_decoder_size(int dt_us, int sr_hz);
|
LC3_EXPORT unsigned lc3_decoder_size(int dt_us, int sr_hz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup decoder
|
* Setup decoder
|
||||||
@@ -394,10 +397,10 @@ unsigned lc3_decoder_size(int dt_us, int sr_hz);
|
|||||||
* sample rate `sr_hz`. The size of the context needed, given by
|
* sample rate `sr_hz`. The size of the context needed, given by
|
||||||
* `lc3_hr_decoder_size()` will be set accordingly to `sr_pcm_hz`.
|
* `lc3_hr_decoder_size()` will be set accordingly to `sr_pcm_hz`.
|
||||||
*/
|
*/
|
||||||
lc3_decoder_t lc3_hr_setup_decoder(bool hrmode,
|
LC3_EXPORT lc3_decoder_t lc3_hr_setup_decoder(
|
||||||
int dt_us, int sr_hz, int sr_pcm_hz, void *mem);
|
bool hrmode, int dt_us, int sr_hz, int sr_pcm_hz, void *mem);
|
||||||
|
|
||||||
lc3_decoder_t lc3_setup_decoder(
|
LC3_EXPORT lc3_decoder_t lc3_setup_decoder(
|
||||||
int dt_us, int sr_hz, int sr_pcm_hz, void *mem);
|
int dt_us, int sr_hz, int sr_pcm_hz, void *mem);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -408,7 +411,8 @@ lc3_decoder_t lc3_setup_decoder(
|
|||||||
* pcm, stride Output PCM samples, and count between two consecutives
|
* pcm, stride Output PCM samples, and count between two consecutives
|
||||||
* return 0: On success 1: PLC operated -1: Wrong parameters
|
* return 0: On success 1: PLC operated -1: Wrong parameters
|
||||||
*/
|
*/
|
||||||
int lc3_decode(lc3_decoder_t decoder, const void *in, int nbytes,
|
LC3_EXPORT int lc3_decode(
|
||||||
|
lc3_decoder_t decoder, const void *in, int nbytes,
|
||||||
enum lc3_pcm_format fmt, void *pcm, int stride);
|
enum lc3_pcm_format fmt, void *pcm, int stride);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -173,4 +173,15 @@ struct lc3_decoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change the visibility of interface functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define LC3_EXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define LC3_EXPORT __attribute__((visibility ("default")))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* __LC3_PRIVATE_H */
|
#endif /* __LC3_PRIVATE_H */
|
||||||
|
|||||||
+3
-1
@@ -20,7 +20,9 @@ project('lc3', 'c',
|
|||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
|
||||||
if cc.get_id() != 'msvc'
|
if cc.get_id() == 'msvc'
|
||||||
|
add_project_arguments(['/wd4244', '/wd4305', '/fp:fast'], language: 'c')
|
||||||
|
else
|
||||||
add_project_arguments('-ffast-math', language: 'c')
|
add_project_arguments('-ffast-math', language: 'c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -82,14 +82,6 @@
|
|||||||
#endif /* __clang__ */
|
#endif /* __clang__ */
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change the visibility of interface functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define LC3_EXPORT \
|
|
||||||
__attribute__((visibility ("default")))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macros
|
* Macros
|
||||||
* MIN/MAX Minimum and maximum between 2 values
|
* MIN/MAX Minimum and maximum between 2 values
|
||||||
|
|||||||
Reference in New Issue
Block a user