当前位置: 首页>>代码示例>>C++>>正文


C++ pjmedia_endpt_get_codec_mgr函数代码示例

本文整理汇总了C++中pjmedia_endpt_get_codec_mgr函数的典型用法代码示例。如果您正苦于以下问题:C++ pjmedia_endpt_get_codec_mgr函数的具体用法?C++ pjmedia_endpt_get_codec_mgr怎么用?C++ pjmedia_endpt_get_codec_mgr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pjmedia_endpt_get_codec_mgr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PJ_DEF

/*
 * Unregister G722 codec factory from pjmedia endpoint and deinitialize
 * the G722 codec library.
 */
PJ_DEF(pj_status_t) pjmedia_codec_g722_deinit(void)
{
    pjmedia_codec_mgr *codec_mgr;
    pj_status_t status;

    if (g722_codec_factory.pool == NULL)
	return PJ_SUCCESS;

    /* Get the codec manager. */
    codec_mgr = pjmedia_endpt_get_codec_mgr(g722_codec_factory.endpt);
    if (!codec_mgr) {
	pj_pool_release(g722_codec_factory.pool);
	g722_codec_factory.pool = NULL;
	return PJ_EINVALIDOP;
    }

    /* Unregister G722 codec factory. */
    status = pjmedia_codec_mgr_unregister_factory(codec_mgr,
						  &g722_codec_factory.base);
    
    /* Destroy mutex. */
    pj_mutex_destroy(g722_codec_factory.mutex);

    /* Destroy pool. */
    pj_pool_release(g722_codec_factory.pool);
    g722_codec_factory.pool = NULL;
    
    TRACE_((THIS_FILE, "G722 codec factory shutdown"));
    return status;
}
开发者ID:AmoebaLabs,项目名称:pjsip,代码行数:34,代码来源:g722.c

示例2: pj_mutex_lock

 */ PJ_DEF(pj_status_t) pjmedia_codec_opus_deinit(void) {
  pjmedia_codec_mgr *codec_mgr;
  pj_status_t status;

  if (opus_factory.endpt == NULL) {
    /* Not registered. */
    return PJ_SUCCESS;
  }

  /* Lock mutex. */
  pj_mutex_lock(opus_factory.mutex);

  /* Get the codec manager. */
  codec_mgr = pjmedia_endpt_get_codec_mgr(opus_factory.endpt);
  if (!codec_mgr) {
    opus_factory.endpt = NULL;
    pj_mutex_unlock(opus_factory.mutex);
    return PJ_EINVALIDOP;
  }

  /* Unregister opus codec factory. */
  status = pjmedia_codec_mgr_unregister_factory(codec_mgr, &opus_factory.base);
  opus_factory.endpt = NULL;

  /* Destroy mutex. */
  pj_mutex_destroy(opus_factory.mutex);
  opus_factory.mutex = NULL;

  /* Release pool. */
  pj_pool_release(opus_factory.pool);
  opus_factory.pool = NULL;

  return status;
}
开发者ID:AntonioLebara,项目名称:ios-pjsip,代码行数:34,代码来源:opus.c

示例3: cleanup

static void cleanup()
{
    if (app.srtp) pjmedia_transport_close(app.srtp);
    if (app.wav) {
        pj_ssize_t pos = pjmedia_wav_writer_port_get_pos(app.wav);
        if (pos >= 0) {
            unsigned msec;
            msec = (unsigned)pos / 2 * 1000 / PJMEDIA_PIA_SRATE(&app.wav->info);
            printf("Written: %dm:%02ds.%03d\n",
                    msec / 1000 / 60,
                    (msec / 1000) % 60,
                    msec % 1000);
        }
	pjmedia_port_destroy(app.wav);
    }
    if (app.pcap) pj_pcap_close(app.pcap);
    if (app.codec) {
	pjmedia_codec_mgr *cmgr;
	pjmedia_codec_close(app.codec);
	cmgr = pjmedia_endpt_get_codec_mgr(app.mept);
	pjmedia_codec_mgr_dealloc_codec(cmgr, app.codec);
    }
    if (app.aud_strm) {
	pjmedia_aud_stream_stop(app.aud_strm);
	pjmedia_aud_stream_destroy(app.aud_strm);
    }
    if (app.mept) pjmedia_endpt_destroy(app.mept);
    if (app.pool) pj_pool_release(app.pool);
    pj_caching_pool_destroy(&app.cp);
    pj_shutdown();
}
开发者ID:iamroger,项目名称:voip,代码行数:31,代码来源:pcaputil.c

示例4: PJ_DEF

/*
 * Unregister AMR codec factory from pjmedia endpoint and deinitialize
 * the AMR codec library.
 */
PJ_DEF(pj_status_t) pjmedia_codec_opencore_amr_deinit(void)
{
    pjmedia_codec_mgr *codec_mgr;
    pj_status_t status;

    amr_codec_factory.init[IDX_AMR_NB] = PJ_FALSE;
    amr_codec_factory.init[IDX_AMR_WB] = PJ_FALSE;
    
    if (amr_codec_factory.pool == NULL)
	return PJ_SUCCESS;

    /* Get the codec manager. */
    codec_mgr = pjmedia_endpt_get_codec_mgr(amr_codec_factory.endpt);
    if (!codec_mgr) {
	pj_pool_release(amr_codec_factory.pool);
	amr_codec_factory.pool = NULL;
	return PJ_EINVALIDOP;
    }

    /* Unregister AMR codec factory. */
    status = pjmedia_codec_mgr_unregister_factory(codec_mgr,
						  &amr_codec_factory.base);
    
    /* Destroy pool. */
    pj_pool_release(amr_codec_factory.pool);
    amr_codec_factory.pool = NULL;
    
    return status;
}
开发者ID:iamroger,项目名称:voip,代码行数:33,代码来源:opencore_amr.c

示例5: PJ_DEF

/*
 * Unregister Opus codec factory from pjmedia endpoint and
 * deinitialize the codec.
 */
PJ_DEF(pj_status_t) pjmedia_codec_opus_deinit( void )
{
    pj_status_t status;
    pjmedia_codec_mgr *codec_mgr;

    if (opus_codec_factory.pool == NULL)
	return PJ_SUCCESS;

    /* Get the codec manager */
    codec_mgr = pjmedia_endpt_get_codec_mgr(opus_codec_factory.endpt);
    if (!codec_mgr) {
	PJ_LOG(2, (THIS_FILE, "Unable to get the codec manager"));
	pj_pool_release(opus_codec_factory.pool);
	opus_codec_factory.pool = NULL;
	return PJ_EINVALIDOP;
    }

    /* Unregister the codec factory */
    status = pjmedia_codec_mgr_unregister_factory(codec_mgr,
						  &opus_codec_factory.base);
    if (status != PJ_SUCCESS)
	PJ_LOG(2, (THIS_FILE, "Unable to unregister the codec factory"));

    /* Release the memory pool */
    pj_pool_release(opus_codec_factory.pool);
    opus_codec_factory.pool = NULL;

    return status;
}
开发者ID:chriszeng87,项目名称:pjproject,代码行数:33,代码来源:opus.c

示例6: PJ_DEF

/*
 * Unregister CODEC2 codec factory from pjmedia endpoint and deinitialize
 * the CODEC2 codec library.
 */
PJ_DEF(pj_status_t) pjmedia_codec_codec2_deinit(void)
{
    pjmedia_codec_mgr *codec_mgr;
    pj_status_t status;

    if (codec2_codec_factory.pool == NULL)
	return PJ_SUCCESS;

    /* Get the codec manager. */
    codec_mgr = pjmedia_endpt_get_codec_mgr(codec2_codec_factory.endpt);
    if (!codec_mgr) {
	pj_pool_release(codec2_codec_factory.pool);
	codec2_codec_factory.pool = NULL;
	return PJ_EINVALIDOP;
    }

    /* Unregister GSM codec factory. */
    status = pjmedia_codec_mgr_unregister_factory(codec_mgr,
						  &codec2_codec_factory.base);
    
    /* Destroy mutex. */
    pj_mutex_destroy(codec2_codec_factory.mutex);

    /* Destroy pool. */
    pj_pool_release(codec2_codec_factory.pool);
    codec2_codec_factory.pool = NULL;

    return status;
}
开发者ID:Agostin,项目名称:csipsimple,代码行数:33,代码来源:pj_codec2.c

示例7: PJ_DEF

PJ_DEF(pj_status_t) pjmedia_codec_l16_init(pjmedia_endpt *endpt,
					   unsigned options)
{
    pjmedia_codec_mgr *codec_mgr;
    pj_status_t status;


    PJ_UNUSED_ARG(options);


    if (l16_factory.endpt != NULL) {
	/* Already initialized. */
	return PJ_SUCCESS;
    }

    /* Init factory */
    l16_factory.base.op = &l16_factory_op;
    l16_factory.base.factory_data = NULL;
    l16_factory.endpt = endpt;

    /* Create pool */
    l16_factory.pool = pjmedia_endpt_create_pool(endpt, "l16", 4000, 4000);
    if (!l16_factory.pool)
	return PJ_ENOMEM;

    /* Create mutex. */
    status = pj_mutex_create_simple(l16_factory.pool, "l16", 
				    &l16_factory.mutex);
    if (status != PJ_SUCCESS)
	goto on_error;

    /* Get the codec manager. */
    codec_mgr = pjmedia_endpt_get_codec_mgr(endpt);
    if (!codec_mgr) {
	return PJ_EINVALIDOP;
    }

    /* Register codec factory to endpoint. */
    status = pjmedia_codec_mgr_register_factory(codec_mgr, 
						&l16_factory.base);
    if (status != PJ_SUCCESS)
	return status;


    return PJ_SUCCESS;

on_error:
    if (l16_factory.mutex) {
	pj_mutex_destroy(l16_factory.mutex);
	l16_factory.mutex = NULL;
    }
    if (l16_factory.pool) {
	pj_pool_release(l16_factory.pool);
	l16_factory.pool = NULL;
    }
    return status;
}
开发者ID:carlosdelfino,项目名称:WorkshopTelefoniaAutomacao,代码行数:57,代码来源:l16.c

示例8: PJ_DEF

PJ_DEF(pj_status_t) pjmedia_codec_opus_init(pjmedia_endpt *endpt) {
  pjmedia_codec_mgr *codec_mgr;
  pj_status_t status;

  if (opus_factory.endpt != NULL) {
    /* Already initialized. */
    return PJ_SUCCESS;
  }

  /* Init factory */
  opus_factory.base.op = &opus_factory_op;
  opus_factory.base.factory_data = NULL;
  opus_factory.endpt = endpt;
  if (opus_factory.internal_clock_rate == 0) {
    opus_factory.internal_clock_rate = 48000;
  }

  /* Create pool */
  opus_factory.pool =
      pjmedia_endpt_create_pool(endpt, "opus codecs", 4000, 4000);
  if (!opus_factory.pool) return PJ_ENOMEM;

  /* Init list */
  pj_list_init(&opus_factory.codec_list);

  /* Create mutex. */
  status = pj_mutex_create_simple(opus_factory.pool, "opus codecs",
                                  &opus_factory.mutex);
  if (status != PJ_SUCCESS) goto on_error;
  PJ_LOG(5, (THIS_FILE, "Init opus"));

  /* Get the codec manager. */
  codec_mgr = pjmedia_endpt_get_codec_mgr(endpt);
  if (!codec_mgr) {
    return PJ_EINVALIDOP;
  }

  PJ_LOG(5, (THIS_FILE, "Init opus > DONE"));

  /* Register codec factory to endpoint. */
  status = pjmedia_codec_mgr_register_factory(codec_mgr, &opus_factory.base);
  if (status != PJ_SUCCESS) return status;

  return PJ_SUCCESS;

on_error:
  if (opus_factory.mutex) {
    pj_mutex_destroy(opus_factory.mutex);
    opus_factory.mutex = NULL;
  }
  if (opus_factory.pool) {
    pj_pool_release(opus_factory.pool);
    opus_factory.pool = NULL;
  }

  return status;
}
开发者ID:AntonioLebara,项目名称:ios-pjsip,代码行数:57,代码来源:opus.c

示例9: pjmedia_codec_opus_set_default_param

pjmedia_codec_opus_set_default_param(const pjmedia_codec_opus_config *cfg,
				     pjmedia_codec_param *param )
{
    const pj_str_t opus_str = {"opus", 4};
    const pjmedia_codec_info *info[1];
    pjmedia_codec_mgr *codec_mgr;
    unsigned count = 1;
    pj_status_t status;

    TRACE_((THIS_FILE, "%s:%d: - TRACE", __FUNCTION__, __LINE__));
    PJ_ASSERT_RETURN(cfg, PJ_EINVAL);

    codec_mgr = pjmedia_endpt_get_codec_mgr(opus_codec_factory.endpt);

    status = pjmedia_codec_mgr_find_codecs_by_id(codec_mgr, &opus_str,
						 &count, info, NULL);
    if (status != PJ_SUCCESS)
	return status;

    /* Set sample rate */
    if (cfg->sample_rate != 8000 && cfg->sample_rate != 12000 &&
	cfg->sample_rate != 16000 && cfg->sample_rate != 24000 &&
	cfg->sample_rate != 48000)
    {
	return PJ_EINVAL;
    }
    param->info.clock_rate = opus_cfg.sample_rate = cfg->sample_rate;

    /* Set channel count */
    if (cfg->channel_cnt != 1 && cfg->channel_cnt != 2)
        return PJ_EINVAL;
    param->info.channel_cnt = opus_cfg.channel_cnt = cfg->channel_cnt;

    /* Set bit_rate */
    if (cfg->bit_rate < 6000 || cfg->bit_rate > 510000) {
	return PJ_EINVAL;
    }
    opus_cfg.bit_rate = cfg->bit_rate;

    /* Set expected packet loss */
    if (cfg->packet_loss >= 100)
	return PJ_EINVAL;
    opus_cfg.packet_loss = cfg->packet_loss;

    /* Set complexity */
    if (cfg->complexity > 10)
	return PJ_EINVAL;
    opus_cfg.complexity = cfg->complexity;

    opus_cfg.cbr = cfg->cbr;
    
    generate_fmtp(param);

    status = pjmedia_codec_mgr_set_default_param(codec_mgr, info[0], param);
    return status;
}
开发者ID:chriszeng87,项目名称:pjproject,代码行数:56,代码来源:opus.c

示例10: PJ_DEF

/*
 * Initialize and register GSM codec factory to pjmedia endpoint.
 */
PJ_DEF(pj_status_t) pjmedia_codec_gsm_init( pjmedia_endpt *endpt )
{
    pjmedia_codec_mgr *codec_mgr;
    pj_status_t status;

    if (gsm_codec_factory.pool != NULL)
	return PJ_SUCCESS;

    /* Create GSM codec factory. */
    gsm_codec_factory.base.op = &gsm_factory_op;
    gsm_codec_factory.base.factory_data = NULL;
    gsm_codec_factory.endpt = endpt;

    gsm_codec_factory.pool = pjmedia_endpt_create_pool(endpt, "gsm", 4000, 
						       4000);
    if (!gsm_codec_factory.pool)
	return PJ_ENOMEM;

    pj_list_init(&gsm_codec_factory.codec_list);

    /* Create mutex. */
    status = pj_mutex_create_simple(gsm_codec_factory.pool, "gsm", 
				    &gsm_codec_factory.mutex);
    if (status != PJ_SUCCESS)
	goto on_error;

    /* Get the codec manager. */
    codec_mgr = pjmedia_endpt_get_codec_mgr(endpt);
    if (!codec_mgr) {
	status = PJ_EINVALIDOP;
	goto on_error;
    }

    /* Register codec factory to endpoint. */
    status = pjmedia_codec_mgr_register_factory(codec_mgr, 
						&gsm_codec_factory.base);
    if (status != PJ_SUCCESS)
	goto on_error;

    /* Done. */
    return PJ_SUCCESS;

on_error:
    pj_pool_release(gsm_codec_factory.pool);
    gsm_codec_factory.pool = NULL;
    return status;
}
开发者ID:Archipov,项目名称:android-client,代码行数:50,代码来源:gsm.c

示例11: PJ_DEF

/*
 * Unregister iLBC codec factory from pjmedia endpoint and deinitialize
 * the iLBC codec library.
 */
PJ_DEF(pj_status_t) pjmedia_codec_ilbc_deinit(void)
{
    pjmedia_codec_mgr *codec_mgr;
    pj_status_t status;


    /* Get the codec manager. */
    codec_mgr = pjmedia_endpt_get_codec_mgr(ilbc_factory.endpt);
    if (!codec_mgr)
	return PJ_EINVALIDOP;

    /* Unregister iLBC codec factory. */
    status = pjmedia_codec_mgr_unregister_factory(codec_mgr,
						  &ilbc_factory.base);
    
    return status;
}
开发者ID:RyanLee27,项目名称:pjproject,代码行数:21,代码来源:ilbc.c

示例12: PJ_DEF

/*
 * Initialize and register AMR-NB codec factory to pjmedia endpoint.
 */
PJ_DEF(pj_status_t) pjmedia_codec_opencore_amrnb_init( pjmedia_endpt *endpt )
{
    pjmedia_codec_mgr *codec_mgr;
    pj_status_t status;
    pj_str_t codec_name;

    if (amr_codec_factory.pool != NULL)
	return PJ_SUCCESS;

    /* Create AMR-NB codec factory. */
    amr_codec_factory.base.op = &amr_factory_op;
    amr_codec_factory.base.factory_data = NULL;
    amr_codec_factory.endpt = endpt;

    amr_codec_factory.pool = pjmedia_endpt_create_pool(endpt, "amrnb", 1000,
						       1000);
    if (!amr_codec_factory.pool)
	return PJ_ENOMEM;

    /* Get the codec manager. */
    codec_mgr = pjmedia_endpt_get_codec_mgr(endpt);
    if (!codec_mgr) {
	status = PJ_EINVALIDOP;
	goto on_error;
    }
    /* Register format match callback. */
    pj_cstr(&codec_name, "AMR");
    status = pjmedia_sdp_neg_register_fmt_match_cb( &codec_name,
    		&pjmedia_codec_amr_match_sdp);
    if (status != PJ_SUCCESS){
    	goto on_error;
    }
    /* Register codec factory to endpoint. */
    status = pjmedia_codec_mgr_register_factory(codec_mgr,
						&amr_codec_factory.base);
    if (status != PJ_SUCCESS)
	goto on_error;

    /* Done. */
    return PJ_SUCCESS;

on_error:
    pj_pool_release(amr_codec_factory.pool);
    amr_codec_factory.pool = NULL;
    return status;
}
开发者ID:RockHardJim,项目名称:idphone,代码行数:49,代码来源:amr_stagefright_dyn_codec.c

示例13: list_codecs

void list_codecs(pjmedia_endpt *ep) {
    unsigned int count = 100;
    int i;
    char buffer[100];
    pjmedia_codec_mgr *mgr = 0;
    pjmedia_codec_info codec[20];

    mgr = pjmedia_endpt_get_codec_mgr(ep);
    pjmedia_codec_mgr_enum_codecs(mgr, &count, codec, NULL);
    
    PJ_LOG(3, (__FILE__, "THERE ARE %d codecs", count));
    for ( i = 0; i < count; i++ ) {
        pj_bzero(buffer, sizeof(buffer));
        pjmedia_codec_info_to_id(&codec[i], buffer, sizeof(buffer));
        PJ_LOG(3, (__FILE__, "Codec : %s", buffer));
    }
}
开发者ID:mocidis,项目名称:media-endpoint,代码行数:17,代码来源:test-codecs.c

示例14: PJ_DEF

/*
 * Unregister Speex codec factory from pjmedia endpoint and deinitialize
 * the Speex codec library.
 */
PJ_DEF(pj_status_t) pjmedia_codec_speex_deinit(void)
{
    pjmedia_codec_mgr *codec_mgr;
    pj_status_t status;

    if (spx_factory.pool == NULL) {
	/* Already deinitialized */
	return PJ_SUCCESS;
    }

    pj_mutex_lock(spx_factory.mutex);

    /* We don't want to deinit if there's outstanding codec. */
    /* This is silly, as we'll always have codec in the list if
       we ever allocate a codec! A better behavior maybe is to 
       deallocate all codecs in the list.
    if (!pj_list_empty(&spx_factory.codec_list)) {
	pj_mutex_unlock(spx_factory.mutex);
	return PJ_EBUSY;
    }
    */

    /* Get the codec manager. */
    codec_mgr = pjmedia_endpt_get_codec_mgr(spx_factory.endpt);
    if (!codec_mgr) {
	pj_pool_release(spx_factory.pool);
	spx_factory.pool = NULL;
	return PJ_EINVALIDOP;
    }

    /* Unregister Speex codec factory. */
    status = pjmedia_codec_mgr_unregister_factory(codec_mgr,
						  &spx_factory.base);
    
    /* Destroy mutex. */
    pj_mutex_destroy(spx_factory.mutex);

    /* Destroy pool. */
    pj_pool_release(spx_factory.pool);
    spx_factory.pool = NULL;

    return status;
}
开发者ID:imace,项目名称:mbgapp,代码行数:47,代码来源:speex_codec.c

示例15: PJ_DEF

/*
 * Initialize and register G726 codec factory to pjmedia endpoint.
 */
PJ_DEF(pj_status_t) pjmedia_codec_g726_init( pjmedia_endpt *endpt )
{
    pjmedia_codec_mgr *codec_mgr;
    pj_status_t status;

    if (g726_codec_factory.pool != NULL)
	return PJ_SUCCESS;

    /* Create G726 codec factory. */
    g726_codec_factory.base.op = &g726_factory_op;
    g726_codec_factory.base.factory_data = NULL;
    g726_codec_factory.endpt = endpt;

    g726_codec_factory.pool = pjmedia_endpt_create_pool(endpt, "g726", 512, 512);
    if (!g726_codec_factory.pool)
	return PJ_ENOMEM;

    /* Get the codec manager. */
    codec_mgr = pjmedia_endpt_get_codec_mgr(endpt);
    if (!codec_mgr) {
	status = PJ_EINVALIDOP;
	goto on_error;
    }

    /* Register codec factory to endpoint. */
    status = pjmedia_codec_mgr_register_factory(codec_mgr, 
						&g726_codec_factory.base);
    if (status != PJ_SUCCESS)
	goto on_error;

    /* Done. */
    return PJ_SUCCESS;

on_error:
    pj_pool_release(g726_codec_factory.pool);
    g726_codec_factory.pool = NULL;
    return status;
}
开发者ID:0x0B501E7E,项目名称:CSipSimple,代码行数:41,代码来源:pj_g726.c


注:本文中的pjmedia_endpt_get_codec_mgr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。