Fails to build with pocketsphinx 5
After having installed pocketsphinx version 5.0.2 (from https://github.com/cmusphinx/pocketsphinx/), subtitlecomposer fails to build:
/build/subtitlecomposer-0.7.1/src/speechplugins/pocketsphinx/pocketsphinxplugin.cpp: In member function 'virtual bool SubtitleComposer::PocketSphinxPlugin::init()':
/build/subtitlecomposer-0.7.1/src/speechplugins/pocketsphinx/pocketsphinxplugin.cpp:34:22: error: 'cmd_ln_init' was not declared in this scope; did you mean 'cmd_ln_t'?
34 | m_psConfig = cmd_ln_init(nullptr, ps_args(), true,
| ^~~~~~~~~~~
| cmd_ln_t
/build/subtitlecomposer-0.7.1/src/speechplugins/pocketsphinx/pocketsphinxplugin.cpp:60:25: error: 'cmd_ln_int32_r' was not declared in this scope
60 | m_psFrameRate = cmd_ln_int32_r(m_psConfig, "-frate");
| ^~~~~~~~~~~~~~
/build/subtitlecomposer-0.7.1/src/speechplugins/pocketsphinx/pocketsphinxplugin.cpp: In member function 'virtual void SubtitleComposer::PocketSphinxPlugin::cleanup()':
/build/subtitlecomposer-0.7.1/src/speechplugins/pocketsphinx/pocketsphinxplugin.cpp:79:17: error: 'cmd_ln_free_r' was not declared in this scope
79 | cmd_ln_free_r(m_psConfig);
| ^~~~~~~~~~~~~
This is apparently an intentional API break of pocketsphinx: from pocketsphinx.h:
* @section faq_sec Frequently Asked Questions
*
* @subsection faq_api My code no longer compiles! Why?
*
* Some APIs were intentionally broken by the 5.0.0 release. The most
* likely culprit here is the configuration API, where the old
* "options" which started with a `-` are now "parameters" which do
* not, and instead of a `cmd_ln_t` it is now a `ps_config_t`. There
* is no backward compatibility, you have to change your code
* manually. This is straightforward for the most part. For example,
* instead of writing:
*
* cmdln = cmd_ln_init(NULL, "-samprate", "16000", NULL);
* cmd_ln_set_int32_r(NULL, "-maxwpf", 40);
*
* You should write:
*
* config = ps_config_init(NULL);
* ps_config_set_int(config, "samprate", 16000);
* ps_config_set_int(config, "maxwpf", 40);
So this needs to be done in subtitlecomposer.