Skip to content
Snippets Groups Projects
codec_g726.c 25.2 KiB
Newer Older
  • Learn to ignore specific revisions
  •  */
    
    static struct ast_translator lintog726 = {
      "lintog726",
      AST_FORMAT_SLINEAR,
      AST_FORMAT_G726,
      lintog726_new,
      lintog726_framein,
      lintog726_frameout,
      g726_destroy,
      /* NULL */
      lintog726_sample
    };
    
    
    static void 
    parse_config(void)
    {
      struct ast_config *cfg;
      struct ast_variable *var;
      if ((cfg = ast_config_load("codecs.conf"))) {
        if ((var = ast_variable_browse(cfg, "plc"))) {
          while (var) {
           if (!strcasecmp(var->name, "genericplc")) {
             useplc = ast_true(var->value) ? 1 : 0;
             if (option_verbose > 2)
    
               ast_verbose(VERBOSE_PREFIX_3 "codec_g726: %susing generic PLC\n", useplc ? "" : "not ");
    
        ast_config_destroy(cfg);
    
    int
    unload_module (void)
    {
      int res;
      ast_mutex_lock (&localuser_lock);
      res = ast_unregister_translator (&lintog726);
      if (!res)
        res = ast_unregister_translator (&g726tolin);
      if (localusecnt)
        res = -1;
      ast_mutex_unlock (&localuser_lock);
      return res;
    }
    
    int
    load_module (void)
    {
      int res;
    
      res = ast_register_translator (&g726tolin);
      if (!res)
        res = ast_register_translator (&lintog726);
      else
        ast_unregister_translator (&g726tolin);
      return res;
    }
    
    /*
     * Return a description of this module.
     */
    
    char *
    description (void)
    {
      return tdesc;
    }
    
    int
    usecount (void)
    {
      int res;
      STANDARD_USECOUNT (res);
      return res;
    }
    
    char *
    key ()
    {
      return ASTERISK_GPL_KEY;
    }