[FFmpeg-trac] #10520(avfilter:new): Fails to build with pocketsphinx 5

FFmpeg trac at avcodec.org
Sun Aug 13 18:32:50 EEST 2023


#10520: Fails to build with pocketsphinx 5
-------------------------------------+-------------------------------------
             Reporter:  Samuel       |                     Type:  defect
  Thibault                           |
               Status:  new          |                 Priority:  normal
            Component:  avfilter     |                  Version:
                                     |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 How to reproduce:
 After having installed pocketsphinx version 5.0.2 (from
 https://github.com/cmusphinx/pocketsphinx/), ffmpeg fails to build:

 ```
 src/libavfilter/af_asr.c:42:5: error: unknown type name 'cmd_ln_t'
    42 |     cmd_ln_t *config;
       |     ^~~~~~~~
 src/libavfilter/af_asr.c: In function 'asr_init':
 src/libavfilter/af_asr.c:110:17: error: implicit declaration of function
 'cmd_ln_parse_r' [-Werror=implicit-function-declaration]
   110 |     s->config = cmd_ln_parse_r(NULL, ps_args(), 14, (char **)argv,
 0);
       |                 ^~~~~~~~~~~~~~
 src/libavfilter/af_asr.c:110:15: warning: assignment to 'int *' from 'int'
 makes pointer from integer without a cast [-Wint-conversion]
   110 |     s->config = cmd_ln_parse_r(NULL, ps_args(), 14, (char **)argv,
 0);
       |               ^
 src/libavfilter/af_asr.c:115:29: warning: passing argument 1 of
 'ps_default_search_args' from incompatible pointer type [-Wincompatible-
 pointer-types]
   115 |     ps_default_search_args(s->config);
       |                            ~^~~~~~~~
       |                             |
       |                             int *
 In file included from src/libavfilter/af_asr.c:21:
 /usr/include/pocketsphinx.h:465:42: note: expected 'ps_config_t *' {aka
 'struct cmd_ln_s *'} but argument is of type 'int *'
   465 | void ps_default_search_args(ps_config_t *config);
       |                             ~~~~~~~~~~~~~^~~~~~
 src/libavfilter/af_asr.c:116:22: warning: passing argument 1 of 'ps_init'
 from incompatible pointer type [-Wincompatible-pointer-types]
   116 |     s->ps = ps_init(s->config);
       |                     ~^~~~~~~~
       |                      |
       |                      int *
 /usr/include/pocketsphinx.h:498:36: note: expected 'ps_config_t *' {aka
 'struct cmd_ln_s *'} but argument is of type 'int *'
   498 | ps_decoder_t *ps_init(ps_config_t *config);
       |                       ~~~~~~~~~~~~~^~~~~~
 src/libavfilter/af_asr.c: In function 'asr_uninit':
 src/libavfilter/af_asr.c:148:5: error: implicit declaration of function
 'cmd_ln_free_r' [-Werror=implicit-function-declaration]
   148 |     cmd_ln_free_r(s->config);
       |     ^~~~~~~~~~~~~
 ```

 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 ffmpeg.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10520>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list