Haivision / srt

Secure, Reliable, Transport
https://www.srtalliance.org
Mozilla Public License 2.0
3.06k stars 840 forks source link

[FR] API function to get SRT build configuration #2163

Open maxsharabayko opened 2 years ago

maxsharabayko commented 2 years ago

It might be worth adding an SRT API function to retrieve the build configuration of SRT.

Possible items:

typedef struct SRT_BuildConfig_ {
    int iClockType; // see srt_clock_type()
    int iRndGenerator;
    // ...
} SRT_BUILDCONFIG;

/// returns 0 on success, -1 on error (e.g. wrong struct size)
int srt_getbuil_config(SRT_BUILDCONFIG& cfg, size_t sizeof_cfg);

Plus utility function to convert the structure to std::string.

P.S. The idea is initially suggested by @jlsantiago0.

jlsantiago0 commented 2 years ago

Additionally the information printed in scripts/ShowProjectConfig.cmake from https://github.com/Haivision/srt/pull/2161 could be used to construct a generated .h|.cpp source file(s) so that the top level build information could be accessed programmatically in the srt library itself. This would allow us to store the project build configuration in the library itself, so that it could be available when the user only has access to the prebuilt library.

Both runtime and buildtime configuration transparency would be very useful.

Also, it might be useful to print out some of this information during library initialization if possible.