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


C++ pj_ansi_strncpy函数代码示例

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


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

示例1: PJ_DEF

/*
 * Create the adapter.
 */
PJ_DEF(pj_status_t) pjmedia_tp_adapter_create( pjmedia_endpt *endpt,
        const char *name,
        pjmedia_transport *transport,
        pj_bool_t del_base,
        pjmedia_transport **p_tp)
{
    pj_pool_t *pool;
    struct tp_adapter *adapter;

    if (name == NULL)
        name = "tpad%p";

    /* Create the pool and initialize the adapter structure */
    pool = pjmedia_endpt_create_pool(endpt, name, 512, 512);
    adapter = PJ_POOL_ZALLOC_T(pool, struct tp_adapter);
    adapter->pool = pool;
    pj_ansi_strncpy(adapter->base.name, pool->obj_name,
                    sizeof(adapter->base.name));
    adapter->base.type = (pjmedia_transport_type)
                         (PJMEDIA_TRANSPORT_TYPE_USER + 1);
    adapter->base.op = &tp_adapter_op;

    /* Save the transport as the slave transport */
    adapter->slave_tp = transport;
    adapter->del_base = del_base;

    /* Done */
    *p_tp = &adapter->base;
    return PJ_SUCCESS;
}
开发者ID:NewCell,项目名称:Call-Text-v1,代码行数:33,代码来源:transport_adapter_sample.c

示例2: PJ_DEF

/*
 * pj_sem_create()
 */
PJ_DEF(pj_status_t) pj_sem_create( pj_pool_t *pool, 
                                   const char *name,
				   unsigned initial, 
                                   unsigned max,
                                   pj_sem_t **sem_ptr)
{
    pj_sem_t *sem;

    PJ_CHECK_STACK();
    PJ_ASSERT_RETURN(pool && sem_ptr, PJ_EINVAL);

    sem = pj_pool_alloc(pool, sizeof(*sem));    
    sem->hSemaphore = CreateSemaphore(NULL, initial, max, NULL);
    if (!sem->hSemaphore)
	return PJ_RETURN_OS_ERROR(GetLastError());

    /* Set name. */
    if (!name) {
	name = "sem%p";
    }
    if (strchr(name, '%')) {
	pj_ansi_snprintf(sem->obj_name, PJ_MAX_OBJ_NAME, name, sem);
    } else {
	pj_ansi_strncpy(sem->obj_name, name, PJ_MAX_OBJ_NAME);
	sem->obj_name[PJ_MAX_OBJ_NAME-1] = '\0';
    }

    LOG_MUTEX((sem->obj_name, "Semaphore created"));

    *sem_ptr = sem;
    return PJ_SUCCESS;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:35,代码来源:os_core_win32.c

示例3: init_mutex

static pj_status_t init_mutex(pj_mutex_t *mutex, const char *name)
{

    PJ_CHECK_STACK();

#if PJ_WIN32_WINNT >= 0x0400
    InitializeCriticalSection(&mutex->crit);
#else
    mutex->hMutex = CreateMutex(NULL, FALSE, NULL);
    if (!mutex->hMutex) {
	return PJ_RETURN_OS_ERROR(GetLastError());
    }
#endif

#if PJ_DEBUG
    /* Set owner. */
    mutex->nesting_level = 0;
    mutex->owner = NULL;
#endif

    /* Set name. */
    if (!name) {
	name = "mtx%p";
    }
    if (strchr(name, '%')) {
	pj_ansi_snprintf(mutex->obj_name, PJ_MAX_OBJ_NAME, name, mutex);
    } else {
	pj_ansi_strncpy(mutex->obj_name, name, PJ_MAX_OBJ_NAME);
	mutex->obj_name[PJ_MAX_OBJ_NAME-1] = '\0';
    }

    PJ_LOG(6, (mutex->obj_name, "Mutex created"));
    return PJ_SUCCESS;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:34,代码来源:os_core_win32.c

示例4: PJ_DEF

/* Create pool */
PJ_DEF(pj_pool_t*) pj_pool_create_imp( const char *file, int line,
				       void *factory,
				       const char *name,
				       pj_size_t initial_size,
				       pj_size_t increment_size,
				       pj_pool_callback *callback)
{
    pj_pool_t *pool;

    PJ_UNUSED_ARG(file);
    PJ_UNUSED_ARG(line);
    PJ_UNUSED_ARG(factory);
    PJ_UNUSED_ARG(initial_size);
    PJ_UNUSED_ARG(increment_size);

    pool = malloc(sizeof(struct pj_pool_t));
    if (!pool)
	return NULL;

    if (name) {
	pj_ansi_strncpy(pool->obj_name, name, sizeof(pool->obj_name));
	pool->obj_name[sizeof(pool->obj_name)-1] = '\0';
    } else {
	strcpy(pool->obj_name, "altpool");
    }

    pool->factory = NULL;
    pool->first_mem = NULL;
    pool->used_size = 0;
    pool->cb = callback;

    return pool;
}
开发者ID:deveck,项目名称:Deveck.TAM,代码行数:34,代码来源:pool_dbg.c

示例5: PJ_DEF

PJ_DEF(pj_status_t) pjmedia_silence_det_create( pj_pool_t *pool,
						unsigned clock_rate,
						unsigned samples_per_frame,
						pjmedia_silence_det **p_sd)
{
    pjmedia_silence_det *sd;

    PJ_ASSERT_RETURN(pool && p_sd, PJ_EINVAL);

    sd = pj_pool_zalloc(pool, sizeof(struct pjmedia_silence_det));

    pj_ansi_strncpy(sd->objname, THIS_FILE, PJ_MAX_OBJ_NAME);
    sd->objname[PJ_MAX_OBJ_NAME-1] = '\0';

    sd->ptime = samples_per_frame * 1000 / clock_rate;
    sd->signal_cnt = 0;
    sd->silence_cnt = 0;
    sd->weakest_signal = 0xFFFFFFFFUL;
    sd->loudest_silence = 0;
     
    /* Default settings */
    pjmedia_silence_det_set_params(sd, -1, -1, -1);

    /* Restart in fixed, silent mode */
    sd->in_talk = PJ_FALSE;
    pjmedia_silence_det_set_adaptive( sd, -1 );

    *p_sd = sd;
    return PJ_SUCCESS;
}
开发者ID:tibastral,项目名称:symphonie,代码行数:30,代码来源:silencedet.c

示例6: pj_assert

void MainWin::call()
{
    if (callButton_->text() == "Answer") {
	pjsua_call_setting call_setting;

	pj_assert(currentCall_ != -1);

	pjsua_call_setting_default(&call_setting);
	call_setting.vid_cnt = (vidEnabled_->checkState()==Qt::Checked);

	pjsua_call_answer2(currentCall_, &call_setting, 200, NULL, NULL);
	callButton_->setEnabled(false);
    } else {
	pj_status_t status;
	QString dst = url_->text();
	char uri[256];
	pjsua_call_setting call_setting;

	pj_ansi_strncpy(uri, dst.toAscii().data(), sizeof(uri));
	pj_str_t uri2 = pj_str((char*)uri);

	pj_assert(currentCall_ == -1);

	pjsua_call_setting_default(&call_setting);
	call_setting.vid_cnt = (vidEnabled_->checkState()==Qt::Checked);

	status = pjsua_call_make_call(accountId_, &uri2, &call_setting,
				      NULL, NULL, &currentCall_);
	if (status != PJ_SUCCESS) {
	    showError("make call", status);
	    return;
	}
    }
}
开发者ID:avble,项目名称:natClientEx,代码行数:34,代码来源:vidgui.cpp

示例7: PJ_DEF

/*
 * Create the ZRTP transport.
 */
PJ_DEF(pj_status_t) pjmedia_transport_zrtp_create(pjmedia_endpt *endpt,
        const char *name,
        pjmedia_transport *transport,
        pjmedia_transport **p_tp,
        pj_bool_t close_slave)
{
    pj_pool_t *pool;
    struct tp_zrtp *zrtp;
    pj_status_t rc;

    if (name == NULL)
        name = "tzrtp%p";

    /* Create the pool and initialize the adapter structure */
    pool = pjmedia_endpt_create_pool(endpt, name, 5*1024, 512);
    zrtp = PJ_POOL_ZALLOC_T(pool, struct tp_zrtp);
    zrtp->pool = pool;
    pj_ansi_strncpy(zrtp->base.name, pool->obj_name,
                    sizeof(zrtp->base.name));
    zrtp->base.type = (pjmedia_transport_type)
                      (PJMEDIA_TRANSPORT_TYPE_USER + 2);
    zrtp->base.op = &tp_zrtp_op;

#ifndef DYNAMIC_TIMER
    if (timer_pool == NULL)
    {
        timer_pool = pjmedia_endpt_create_pool(endpt, "zrtp_timer", 256, 256);
        rc = timer_initialize();
        if (rc != PJ_SUCCESS)
        {
            pj_pool_release(timer_pool);
            pj_pool_release(zrtp->pool);
            return rc;
        }
    }
#else
    zrtp->timer_heap = pjsip_endpt_get_timer_heap(pjsua_var.endpt);
#endif

    /* Create the empty wrapper */
    zrtp->zrtpCtx = zrtp_CreateWrapper();

    /* Initialize standard values */
    zrtp->clientIdString = clientId;    /* Set standard name */
    zrtp->zrtpSeq = 1;                  /* TODO: randomize */
    rc = pj_mutex_create_simple(zrtp->pool, "zrtp", &zrtp->zrtpMutex);
    zrtp->zrtpBuffer = pj_pool_zalloc(pool, MAX_ZRTP_SIZE);
    zrtp->sendBuffer = pj_pool_zalloc(pool, MAX_RTP_BUFFER_LEN);
    zrtp->sendBufferCtrl = pj_pool_zalloc(pool, MAX_RTCP_BUFFER_LEN);

    zrtp->slave_tp = transport;
    zrtp->close_slave = close_slave;
    zrtp->mitmMode = PJ_FALSE;

    /* Done */
    zrtp->refcount++;
    *p_tp = &zrtp->base;
    return PJ_SUCCESS;
}
开发者ID:CryptoCall,项目名称:ZRTP4PJ,代码行数:62,代码来源:transport_zrtp.c

示例8: PJ_DEF

PJ_DEF(pj_status_t) pjmedia_delay_buf_create( pj_pool_t *pool,
					      const char *name,
					      unsigned clock_rate,
					      unsigned samples_per_frame,
					      unsigned channel_count,
					      unsigned max_delay,
					      unsigned options,
					      pjmedia_delay_buf **p_b)
{
    pjmedia_delay_buf *b;
    pj_status_t status;

    PJ_ASSERT_RETURN(pool && samples_per_frame && clock_rate && channel_count &&
		     p_b, PJ_EINVAL);
    PJ_ASSERT_RETURN(options==0, PJ_EINVAL);

    PJ_UNUSED_ARG(options);

    if (!name) {
	name = "delaybuf";
    }

    b = PJ_POOL_ZALLOC_T(pool, pjmedia_delay_buf);

    pj_ansi_strncpy(b->obj_name, name, PJ_MAX_OBJ_NAME-1);

    b->samples_per_frame = samples_per_frame;
    b->channel_count = channel_count;
    b->ptime = samples_per_frame * 1000 / clock_rate / channel_count;
    if (max_delay < b->ptime)
	max_delay = PJ_MAX(DEFAULT_MAX_DELAY, b->ptime);

    b->max_cnt = samples_per_frame * max_delay / b->ptime;
    b->eff_cnt = b->max_cnt >> 1;
    b->recalc_timer = RECALC_TIME;

    /* Create circular buffer */
    status = pjmedia_circ_buf_create(pool, b->max_cnt, &b->circ_buf);
    if (status != PJ_SUCCESS)
	return status;

    /* Create WSOLA */
    status = pjmedia_wsola_create(pool, clock_rate, samples_per_frame, 1,
				  PJMEDIA_WSOLA_NO_FADING, &b->wsola);
    if (status != PJ_SUCCESS)
	return status;

    /* Finally, create mutex */
    status = pj_lock_create_recursive_mutex(pool, b->obj_name, 
					    &b->lock);
    if (status != PJ_SUCCESS)
	return status;

    *p_b = b;

    TRACE__((b->obj_name,"Delay buffer created"));

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

示例9: ffmpeg_factory_refresh

/* API: refresh the list of devices */
static pj_status_t ffmpeg_factory_refresh(pjmedia_vid_dev_factory *f)
{
    ffmpeg_factory *ff = (ffmpeg_factory*)f;
    AVInputFormat *p;
    ffmpeg_dev_info *info;

    av_log_set_callback(&print_ffmpeg_log);
    av_log_set_level(AV_LOG_DEBUG);

    if (ff->dev_pool) {
        pj_pool_release(ff->dev_pool);
        ff->dev_pool = NULL;
    }

    /* TODO: this should enumerate devices, now it enumerates host APIs */
    ff->dev_count = 0;
    ff->dev_pool = pj_pool_create(ff->pf, "ffmpeg_cap_dev", 500, 500, NULL);

    p = av_iformat_next(NULL);
    while (p) {
        if (p->flags & AVFMT_NOFILE) {
            unsigned i;

            info = &ff->dev_info[ff->dev_count++];
            pj_bzero(info, sizeof(*info));
            pj_ansi_strncpy(info->base.name, "default", 
                            sizeof(info->base.name));
            pj_ansi_snprintf(info->base.driver, sizeof(info->base.driver),
                             "%s (ffmpeg)", p->name);
            info->base.dir = PJMEDIA_DIR_CAPTURE;
            info->base.has_callback = PJ_FALSE;

            info->host_api = p;

#if (defined(PJ_WIN32) && PJ_WIN32!=0) || \
    (defined(PJ_WIN64) && PJ_WIN64!=0)
            info->def_devname = "0";
#elif defined(PJ_LINUX) && PJ_LINUX!=0
            info->def_devname = "/dev/video0";
#endif

            /* Set supported formats, currently hardcoded to RGB24 only */
            info->base.caps = PJMEDIA_VID_DEV_CAP_FORMAT;
            info->base.fmt_cnt = 1;
            for (i = 0; i < info->base.fmt_cnt; ++i) {
                pjmedia_format *fmt = &info->base.fmt[i];

                fmt->id = PJMEDIA_FORMAT_RGB24;
                fmt->type = PJMEDIA_TYPE_VIDEO;
                fmt->detail_type = PJMEDIA_FORMAT_DETAIL_NONE;
            }
        }
        p = av_iformat_next(p);
    }

    return PJ_SUCCESS;
}
开发者ID:imace,项目名称:mbgapp,代码行数:58,代码来源:ffmpeg_dev.c

示例10: reset_dev_info

/* reset dev info */
static void reset_dev_info(struct avi_dev_info *adi)
{
    /* Close avi streams */
    if (adi->avi) {
	unsigned i, cnt;

	cnt = pjmedia_avi_streams_get_num_streams(adi->avi);
	for (i=0; i<cnt; ++i) {
	    pjmedia_avi_stream *as;

	    as = pjmedia_avi_streams_get_stream(adi->avi, i);
	    if (as) {
		pjmedia_port *port;
		port = pjmedia_avi_stream_get_port(as);
		pjmedia_port_destroy(port);
	    }
	}
	adi->avi = NULL;
    }

    if (adi->codec) {
        pjmedia_vid_codec_close(adi->codec);
        adi->codec = NULL;
    }

    if (adi->pool)
	pj_pool_release(adi->pool);

    pj_bzero(adi, sizeof(*adi));

    /* Fill up with *dummy" device info */
    pj_ansi_strncpy(adi->info.name, "AVI Player", sizeof(adi->info.name)-1);
    pj_ansi_strncpy(adi->info.driver, DRIVER_NAME, sizeof(adi->info.driver)-1);
    adi->info.dir = PJMEDIA_DIR_CAPTURE;
    adi->info.has_callback = PJ_FALSE;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:37,代码来源:avi_dev.c

示例11: PJ_DEF

/*
 * pj_mutex_lock()
 */
PJ_DEF(pj_status_t) pj_mutex_lock(pj_mutex_t *mutex)
{
#if PJ_HAS_THREADS
    pj_status_t status;

    PJ_CHECK_STACK();
    PJ_ASSERT_RETURN(mutex, PJ_EINVAL);

#if PJ_DEBUG
    PJ_LOG(6,(mutex->obj_name, "Mutex: thread %s is waiting (mutex owner=%s)", 
				pj_thread_this(mutex->inst_id)->obj_name,
				mutex->owner_name));
#else
    PJ_LOG(6,(mutex->obj_name, "Mutex: thread %s is waiting", 
				pj_thread_this(mutex->inst_id)->obj_name));
#endif

    status = pthread_mutex_lock( &mutex->mutex );


#if PJ_DEBUG
    if (status == PJ_SUCCESS) {
	mutex->owner = pj_thread_this(mutex->inst_id);
	pj_ansi_strncpy(mutex->owner_name, mutex->owner->obj_name, PJ_MAX_OBJ_NAME);
	++mutex->nesting_level;
    }

    PJ_LOG(6,(mutex->obj_name, 
	      (status==0 ? 
		"Mutex acquired by thread %s (level=%d)" : 
		"Mutex acquisition FAILED by %s (level=%d)"),
	      pj_thread_this(mutex->inst_id)->obj_name,
	      mutex->nesting_level));
#else
    PJ_LOG(6,(mutex->obj_name, 
	      (status==0 ? "Mutex acquired by thread %s" : "FAILED by %s"),
	      pj_thread_this(mutex->inst_id)->obj_name));
#endif

    if (status == 0)
	return PJ_SUCCESS;
    else
	return PJ_RETURN_OS_ERROR(status);
#else	/* PJ_HAS_THREADS */
    pj_assert( mutex == (pj_mutex_t*)1 );
    return PJ_SUCCESS;
#endif
}
开发者ID:Antares84,项目名称:asuswrt-merlin,代码行数:51,代码来源:os_core_unix.c

示例12: 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

示例13: PJ_DEF

/*
 * Internal function to initialize pool.
 */
PJ_DEF(void) pj_pool_init_int(  pj_pool_t *pool, 
				const char *name,
				pj_size_t increment_size,
				pj_pool_callback *callback)
{
    PJ_CHECK_STACK();

    pool->increment_size = increment_size;
    pool->callback = callback;

    if (name) {
	if (strchr(name, '%') != NULL) {
	    pj_ansi_snprintf(pool->obj_name, sizeof(pool->obj_name), 
			     name, pool);
	} else {
	    pj_ansi_strncpy(pool->obj_name, name, PJ_MAX_OBJ_NAME);
	}
    } else {
	pool->obj_name[0] = '\0';
    }
}
开发者ID:svn2github,项目名称:pjproject,代码行数:24,代码来源:pool.c

示例14: get_mixer_name

static void get_mixer_name(struct alsa_factory *af)
{
    snd_mixer_t *handle;
    snd_mixer_elem_t *elem;

    if (snd_mixer_open(&handle, 0) < 0)
	return;

    if (snd_mixer_attach(handle, "default") < 0) {
	snd_mixer_close(handle);
	return;
    }

    if (snd_mixer_selem_register(handle, NULL, NULL) < 0) {
	snd_mixer_close(handle);
	return;
    }

    if (snd_mixer_load(handle) < 0) {
	snd_mixer_close(handle);
	return;
    }

    for (elem = snd_mixer_first_elem(handle); elem;
	 elem = snd_mixer_elem_next(elem))
    {
	if (snd_mixer_selem_is_active(elem) &&
	    snd_mixer_selem_has_playback_volume(elem))
	{
	    pj_ansi_strncpy(af->pb_mixer_name, snd_mixer_selem_get_name(elem),
	    		    sizeof(af->pb_mixer_name));
	    TRACE_((THIS_FILE, "Playback mixer name: %s", af->pb_mixer_name));
	    break;
	}
    }
    snd_mixer_close(handle);
}
开发者ID:waspxyz,项目名称:pjproject-2.7.2,代码行数:37,代码来源:alsa_dev.c

示例15: PJ_DEF

/**
 * Create loopback transport.
 */
PJ_DEF(pj_status_t) pjmedia_transport_loop_create(pjmedia_endpt *endpt,
						  pjmedia_transport **p_tp)
{
    struct transport_loop *tp;
    pj_pool_t *pool;

    /* Sanity check */
    PJ_ASSERT_RETURN(endpt && p_tp, PJ_EINVAL);

    /* Create transport structure */
    pool = pjmedia_endpt_create_pool(endpt, "tploop", 512, 512);
    if (!pool)
	return PJ_ENOMEM;

    tp = PJ_POOL_ZALLOC_T(pool, struct transport_loop);
    tp->pool = pool;
    pj_ansi_strncpy(tp->base.name, tp->pool->obj_name, PJ_MAX_OBJ_NAME-1);
    tp->base.op = &transport_udp_op;
    tp->base.type = PJMEDIA_TRANSPORT_TYPE_UDP;

    /* Done */
    *p_tp = &tp->base;
    return PJ_SUCCESS;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:27,代码来源:transport_loop.c


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