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


C++ PJ_ARRAY_SIZE函数代码示例

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


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

示例1: pjmedia_format_id_to_PixelFormat

pj_status_t pjmedia_format_id_to_PixelFormat(pjmedia_format_id fmt_id,
					     enum AVPixelFormat *pixel_format)
{
    unsigned i;
    for (i=0; i<PJ_ARRAY_SIZE(ffmpeg_fmt_table); ++i) {
	const struct ffmpeg_fmt_table_t *t = &ffmpeg_fmt_table[i];
	if (t->id==fmt_id && t->pf != AV(PIX_FMT_NONE)) {
	    *pixel_format = t->pf;
	    return PJ_SUCCESS;
	}
    }

    *pixel_format = AV(PIX_FMT_NONE);
    return PJ_ENOTFOUND;
}
开发者ID:RyanLee27,项目名称:pjproject,代码行数:15,代码来源:ffmpeg_util.c

示例2: pjmedia_format_id_to_CodecID

pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id,
					 unsigned *codec_id)
{
    unsigned i;
    for (i=0; i<PJ_ARRAY_SIZE(ffmpeg_codec_table); ++i) {
	const struct ffmpeg_codec_table_t *t = &ffmpeg_codec_table[i];
	if (t->id==fmt_id && t->codec_id != AV(PIX_FMT_NONE)) {
	    *codec_id = t->codec_id;
	    return PJ_SUCCESS;
	}
    }

    *codec_id = (unsigned)AV(PIX_FMT_NONE);
    return PJ_ENOTFOUND;
}
开发者ID:RyanLee27,项目名称:pjproject,代码行数:15,代码来源:ffmpeg_util.c

示例3: PJ_DEF

/*
 * Set the user data associated with the buddy object.
 */
PJ_DEF(pj_status_t) pjsua_buddy_set_user_data( pjsua_buddy_id buddy_id,
					       void *user_data)
{
    PJ_ASSERT_RETURN(buddy_id>=0 && 
		       buddy_id<(int)PJ_ARRAY_SIZE(pjsua_var.buddy),
		     PJ_EINVAL);

    PJSUA_LOCK();

    pjsua_var.buddy[buddy_id].user_data = user_data;

    PJSUA_UNLOCK();

    return PJ_SUCCESS;
}
开发者ID:svn2github,项目名称:pjproject,代码行数:18,代码来源:pjsua_pres.c

示例4: get_libsrtp_errstr

PJ_END_DECL

const char* get_libsrtp_errstr(int err)
{
#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0)
    static char *liberr[] = {
	"ok",				    /* err_status_ok            = 0  */
	"unspecified failure",		    /* err_status_fail          = 1  */
	"unsupported parameter",	    /* err_status_bad_param     = 2  */
	"couldn't allocate memory",	    /* err_status_alloc_fail    = 3  */
	"couldn't deallocate properly",	    /* err_status_dealloc_fail  = 4  */
	"couldn't initialize",		    /* err_status_init_fail     = 5  */
	"can't process as much data as requested", 
					    /* err_status_terminus      = 6  */
	"authentication failure",	    /* err_status_auth_fail     = 7  */
	"cipher failure",		    /* err_status_cipher_fail   = 8  */
	"replay check failed (bad index)",  /* err_status_replay_fail   = 9  */
	"replay check failed (index too old)", 
					    /* err_status_replay_old    = 10 */
	"algorithm failed test routine",    /* err_status_algo_fail     = 11 */
	"unsupported operation",	    /* err_status_no_such_op    = 12 */
	"no appropriate context found",	    /* err_status_no_ctx        = 13 */
	"unable to perform desired validation", 
					    /* err_status_cant_check    = 14 */
	"can't use key any more",	    /* err_status_key_expired   = 15 */
	"error in use of socket",	    /* err_status_socket_err    = 16 */
	"error in use POSIX signals",	    /* err_status_signal_err    = 17 */
	"nonce check failed",		    /* err_status_nonce_bad     = 18 */
	"couldn't read data",		    /* err_status_read_fail     = 19 */
	"couldn't write data",		    /* err_status_write_fail    = 20 */
	"error pasring data",		    /* err_status_parse_err     = 21 */
	"error encoding data",		    /* err_status_encode_err    = 22 */
	"error while using semaphores",	    /* err_status_semaphore_err = 23 */
	"error while using pfkey"	    /* err_status_pfkey_err     = 24 */
    };
    if (err >= 0 && err < (int)PJ_ARRAY_SIZE(liberr)) {
	return liberr[err];
    } else {
	static char msg[32];
	pj_ansi_snprintf(msg, sizeof(msg), "Unknown libsrtp error %d", err);
	return msg;
    }
#else
    static char msg[32];
    pj_ansi_snprintf(msg, sizeof(msg), "libsrtp error %d", err);
    return msg;
#endif
}
开发者ID:max3903,项目名称:SFLphone,代码行数:48,代码来源:transport_srtp.c

示例5: find_codec_desc_by_info

static const struct alt_codec_desc* find_codec_desc_by_info(const pjmedia_vid_codec_info *info)
{
    unsigned i;
    for (i=0; i<PJ_ARRAY_SIZE(alt_vid_codecs); ++i) {
	struct alt_codec_desc *desc = &alt_vid_codecs[i];
	if ((desc->info.fmt_id == info->fmt_id) &&
            ((desc->info.dir & info->dir) == info->dir) &&
	    (desc->info.pt == info->pt) &&
	    (desc->info.packings & info->packings))
        {
            return desc;
        }
    }

    return NULL;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:16,代码来源:alt_pjsua_vid.c

示例6: PjsuaOnStarted

/* Called when pjsua is started */
void PjsuaOnStarted(pj_status_t status, const char* title)
{
    wchar_t wtitle[128];
    char err_msg[128];

    if (status != PJ_SUCCESS || title == NULL) {
        char err_str[PJ_ERR_MSG_SIZE];
        pj_strerror(status, err_str, sizeof(err_str));
        pj_ansi_snprintf(err_msg, sizeof(err_msg), "%s: %s",
                         (title?title:"App start error"), err_str);
        title = err_msg;
    }

    pj_ansi_to_unicode(title, strlen(title), wtitle, PJ_ARRAY_SIZE(wtitle));
    SetWindowText(g_hWndLbl, wtitle);
}
开发者ID:knox-carl,项目名称:pjsip,代码行数:17,代码来源:main_wm.c

示例7: max_common_substr_len

static unsigned max_common_substr_len(const pj_str_t* str1, const pj_str_t* str2)
{
    unsigned max_len = 0;
    /* We compare only on first MAX_COMPARE_LEN char */
    unsigned tree[MAX_COMPARE_LEN][MAX_COMPARE_LEN];
    unsigned m1=0, m2=0;
    int i=0, j=0;

    if(str1->slen == 0 || str2->slen == 0)
    {
        return 0;
    }

    /* Init tree */
    for(i=0;i < MAX_COMPARE_LEN;i++) {
        pj_bzero(tree[i], PJ_ARRAY_SIZE( tree[i] ));
    }

    m1 = PJ_MIN(str1->slen, MAX_COMPARE_LEN);
    m2 = PJ_MIN(str2->slen, MAX_COMPARE_LEN);

    for (i = 0; i < m1; i++) {
        for (j = 0; j < m2; j++) {
            if (str1->ptr[i] != str2->ptr[j])
            {
                tree[i][j] = 0;
            }
            else
            {
                if ((i == 0) || (j == 0))
                {
                    tree[i][j] = 1;
                }
                else
                {
                    tree[i][j] = 1 + tree[i - 1][j - 1];
                }

                if (tree[i][j] > max_len)
                {
                    max_len = tree[i][j];
                }
            }
        }
    }
    return max_len;
}
开发者ID:0x0B501E7E,项目名称:CSipSimple,代码行数:47,代码来源:pj_callback.cpp

示例8: vidport_test

static int vidport_test(void)
{
    int i, j, k, l;
    int cap_id, rend_id;
    pjmedia_format_id test_fmts[] = {
        PJMEDIA_FORMAT_RGBA,
        PJMEDIA_FORMAT_I420
    };

    PJ_LOG(3, (THIS_FILE, " Video port tests:"));

    /* Capturer's role: active/passive. */
    for (i = 1; i >= 0; i--) {
	/* Capturer's device has_callback: TRUE/FALSE. */
	for (j = 1; j >= 0; j--) {
	    cap_id = find_device(PJMEDIA_DIR_CAPTURE, j);
	    if (cap_id < 0)
		continue;

	    /* Renderer's device has callback: TRUE/FALSE. */
	    for (k = 1; k >= 0; k--) {
		rend_id = find_device(PJMEDIA_DIR_RENDER, k);
		if (rend_id < 0)
		    continue;

		/* Check various formats to test format conversion. */
		for (l = 0; l < PJ_ARRAY_SIZE(test_fmts); ++l) {
		    pjmedia_format fmt;

		    PJ_LOG(3,(THIS_FILE,
			      "capturer %s (stream: %s) ===> "
			      "renderer %s (stream: %s)",
			      (i? "active": "passive"),
			      (j? "active": "passive"),
			      (i? "passive": "active"),
			      (k? "active": "passive")));

		    pjmedia_format_init_video(&fmt, test_fmts[l],
					      640, 480, 25, 1);
		    capture_render_loopback(i, cap_id, rend_id, &fmt);
		}
	    }
	}
    }

    return 0;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:47,代码来源:vid_port_test.c

示例9: PJ_DEF

/* Register customized SDP format negotiation callback function. */
PJ_DEF(pj_status_t) pjmedia_sdp_neg_register_fmt_match_cb(
					const pj_str_t *fmt_name,
					pjmedia_sdp_neg_fmt_match_cb cb)
{
    struct fmt_match_cb_t *f = NULL;
    unsigned i;

    PJ_ASSERT_RETURN(fmt_name, PJ_EINVAL);

    /* Check if the callback for the format name has been registered */
    for (i = 0; i < fmt_match_cb_cnt; ++i) {
	if (pj_stricmp(fmt_name, &fmt_match_cb[i].fmt_name) == 0)
	    break;
    }

    /* Unregistration */
    
    if (cb == NULL) {
	if (i == fmt_match_cb_cnt)
	    return PJ_ENOTFOUND;

	pj_array_erase(fmt_match_cb, sizeof(fmt_match_cb[0]),
		       fmt_match_cb_cnt, i);
	fmt_match_cb_cnt--;

	return PJ_SUCCESS;
    }

    /* Registration */

    if (i < fmt_match_cb_cnt) {
	/* The same format name has been registered before */
	if (cb != fmt_match_cb[i].cb)
	    return PJ_EEXISTS;
	else
	    return PJ_SUCCESS;
    }

    if (fmt_match_cb_cnt >= PJ_ARRAY_SIZE(fmt_match_cb))
	return PJ_ETOOMANY;

    f = &fmt_match_cb[fmt_match_cb_cnt++];
    f->fmt_name = *fmt_name;
    f->cb = cb;

    return PJ_SUCCESS;
}
开发者ID:avble,项目名称:natClientEx,代码行数:48,代码来源:sdp_neg.c

示例10: init_media

/*
 * Init media stack.
 */
static pj_status_t init_media()
{
    unsigned	i;
    pj_uint16_t	rtp_port;
    pj_status_t	status;


    /* Initialize media endpoint so that at least error subsystem is properly
     * initialized.
     */
    status = pjmedia_endpt_create(&app.cp.factory, 
				  pjsip_endpt_get_ioqueue(app.sip_endpt), 0, 
				  &app.med_endpt);
    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);


    /* Must register all codecs to be supported */
    pjmedia_codec_register_audio_codecs(app.med_endpt, NULL);

    /* Init dummy socket addresses */
    app.skinfo_cnt = 0;
    for (i=0, rtp_port=4000; i<PJ_ARRAY_SIZE(app.skinfo); ++i, rtp_port+=2) {
	pjmedia_sock_info *skinfo;

	skinfo = &app.skinfo[i];
	
	pj_sockaddr_in_init(&skinfo->rtp_addr_name.ipv4, &app.local_addr,
			    (pj_uint16_t)rtp_port);
	pj_sockaddr_in_init(&skinfo->rtp_addr_name.ipv4, &app.local_addr,
			    (pj_uint16_t)(rtp_port+1));
	app.skinfo_cnt++;
    }

    /* Generate dummy SDP */
    dummy_sdp_str.slen = pj_ansi_strlen(dummy_sdp_str.ptr);
    status = pjmedia_sdp_parse(app.pool, dummy_sdp_str.ptr, dummy_sdp_str.slen, 
			       &app.dummy_sdp);
    if (status != PJ_SUCCESS) {
	app_perror(THIS_FILE, "Error parsing dummy SDP", status);
	return status;
    }


    /* Done */
    return PJ_SUCCESS;
}
开发者ID:ClearwaterCore,项目名称:pjsip-upstream,代码行数:49,代码来源:pjsip-perf.c

示例11: pjsua_pres_init

/*
 * Init presence
 */
pj_status_t pjsua_pres_init()
{
    unsigned i;
    pj_status_t status;

    status = pjsip_endpt_register_module( pjsua_var.endpt, &mod_pjsua_pres);
    if (status != PJ_SUCCESS) {
	pjsua_perror(THIS_FILE, "Unable to register pjsua presence module", 
		     status);
    }

    for (i=0; i<PJ_ARRAY_SIZE(pjsua_var.buddy); ++i) {
	reset_buddy(i);
    }

    return status;
}
开发者ID:svn2github,项目名称:pjproject,代码行数:20,代码来源:pjsua_pres.c

示例12: PJ_DEF

/*
 * Get transport type from name.
 */
PJ_DEF(pjsip_transport_type_e) pjsip_transport_get_type_from_name(const pj_str_t *name)
{
    unsigned i;

    if (name->slen == 0)
	return PJSIP_TRANSPORT_UNSPECIFIED;

    /* Get transport type from name. */
    for (i=0; i<PJ_ARRAY_SIZE(transport_names); ++i) {
	if (pj_stricmp(name, &transport_names[i].name) == 0) {
	    return transport_names[i].type;
	}
    }

    pj_assert(!"Invalid transport name");
    return PJSIP_TRANSPORT_UNSPECIFIED;
}
开发者ID:ambush276,项目名称:rifle,代码行数:20,代码来源:sip_transport.c

示例13: PJ_ARRAY_SIZE

std::vector<std::string>
ip_utils::getAllIpInterface()
{
    pj_sockaddr addrList[16];
    unsigned addrCnt = PJ_ARRAY_SIZE(addrList);

    std::vector<std::string> ifaceList;

    if (pj_enum_ip_interface(pj_AF_UNSPEC(), &addrCnt, addrList) == PJ_SUCCESS) {
        for (unsigned i = 0; i < addrCnt; i++) {
            char addr[PJ_INET6_ADDRSTRLEN];
            pj_sockaddr_print(&addrList[i], addr, sizeof(addr), 0);
            ifaceList.push_back(std::string(addr));
        }
    }

    return ifaceList;
}
开发者ID:ThereIsNoYeti,项目名称:sflphone,代码行数:18,代码来源:ip_utils.cpp

示例14: alt_vid_codec_enum_codecs

static pj_status_t alt_vid_codec_enum_codecs( pjmedia_vid_codec_factory *factory,
					      unsigned *count,
					      pjmedia_vid_codec_info codecs[])
{
    unsigned i, max_cnt;

    PJ_ASSERT_RETURN(codecs && *count > 0, PJ_EINVAL);

    max_cnt = PJ_MIN(*count, PJ_ARRAY_SIZE(alt_vid_codecs));
    *count = 0;

    for (i=0; i<max_cnt; ++i) {
	pj_memcpy(&codecs[*count], &alt_vid_codecs[i].info,
		  sizeof(pjmedia_vid_codec_info));
	(*count)++;
    }

    return PJ_SUCCESS;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:19,代码来源:alt_pjsua_vid.c

示例15: PJ_DEF

PJ_DEF(const pjmedia_snd_dev_info*) pjmedia_snd_get_dev_info(unsigned index)
{
    pjmedia_snd_dev_info *oi = &g_sys.info[g_sys.info_counter];
    pjmedia_aud_dev_info di;

    g_sys.info_counter = (g_sys.info_counter+1) % PJ_ARRAY_SIZE(g_sys.info);

    if (pjmedia_aud_dev_get_info(index, &di) != PJ_SUCCESS)
	return NULL;

    pj_bzero(oi, sizeof(*oi));
    pj_ansi_strncpy(oi->name, di.name, sizeof(oi->name));
    oi->name[sizeof(oi->name)-1] = '\0';
    oi->input_count = di.input_count;
    oi->output_count = di.output_count;
    oi->default_samples_per_sec = di.default_samples_per_sec;

    return oi;
}
开发者ID:iamroger,项目名称:voip,代码行数:19,代码来源:sound_legacy.c


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