Exemplo n.º 1
0
//========================================================
//	XCAP stack object definition
//
static tsk_object_t* _txcap_stack_create(tsk_object_t * self, va_list * app)
{
	txcap_stack_t *stack = self;
	if(stack){
		thttp_stack_callback_f callback;
		tsk_safeobj_init(stack);

		callback = va_arg(*app, thttp_stack_callback_f);
		stack->xui = tsk_strdup( va_arg(*app, const char*) );
		stack->password = tsk_strdup( va_arg(*app, const char*) );
		stack->xcap_root = tsk_strdup( va_arg(*app, const char*) );
		
		/* HTTP/HTTPS stack and session */
		stack->http_stack = thttp_stack_create(callback,
			THTTP_STACK_SET_NULL());
		stack->http_session = thttp_session_create(stack->http_stack ,
				THTTP_SESSION_SET_NULL());
		
		/* Options */
		stack->options = tsk_list_create();

		/* AUIDs */
		txcap_auids_init(&stack->auids);
	}
	return self;
}
Exemplo n.º 2
0
static tsk_object_t* tdav_video_jb_ctor(tsk_object_t * self, va_list * app)
{
	tdav_video_jb_t *jb = self;
	if(jb){
		if(!(jb->frames = tsk_list_create())){
			TSK_DEBUG_ERROR("Failed to create list");
			return tsk_null;
		}
		if(!(jb->decode_thread_cond = tsk_condwait_create())){
			TSK_DEBUG_ERROR("Failed to create condition var");
			return tsk_null;
		}
		jb->cb_data_fdd.type = tdav_video_jb_cb_data_type_fdd;
		jb->cb_data_rtp.type = tdav_video_jb_cb_data_type_rtp;

		jb->decode_last_seq_num_with_mark = -1;

		jb->fps = TDAV_VIDEO_JB_FPS_MAX;

		jb->rate = TDAV_VIDEO_JB_RATE;

		jb->latency_min = TDAV_VIDEO_JB_LATENCY_MIN;
		jb->latency_max = TDAV_VIDEO_JB_LATENCY_MAX;

		tsk_safeobj_init(jb);
	}
	return self;
}
Exemplo n.º 3
0
/** Initialize video consumer */
int tdav_consumer_video_init(tdav_consumer_video_t* self)
{
	int ret;

	if(!self){
		TSK_DEBUG_ERROR("Invalid parameter");
		return -1;
	}
	/* base */
	if((ret = tmedia_consumer_init(TMEDIA_CONSUMER(self)))){
		return ret;
	}

	/* self (should be update by prepare() by using the codec's info)*/
	TMEDIA_CONSUMER(self)->video.fps = TDAV_VIDEO_DEFAULT_FPS;
	TMEDIA_CONSUMER(self)->video.display.width = TDAV_VIDEO_DEFAULT_WIDTH;
	TMEDIA_CONSUMER(self)->video.display.height = TDAV_VIDEO_DEFAULT_HEIGHT;
	TMEDIA_CONSUMER(self)->video.display.auto_resize = TDAV_VIDEO_DEFAULT_AUTORESIZE;

	/* self:jitterbuffer */
	if(!self->jitterbuffer && !(self->jitterbuffer = tmedia_jitterbuffer_create(tmedia_video))){
		// -- TSK_DEBUG_WARN("Failed to create video jitter buffer");
	}
	if(self->jitterbuffer){
		tmedia_jitterbuffer_init(TMEDIA_JITTER_BUFFER(self->jitterbuffer));
	}

	tsk_safeobj_init(self);

	return 0;
}
Exemplo n.º 4
0
/** Initialize audio consumer */
int tdav_consumer_audio_init(tdav_consumer_audio_t* self)
{
	int ret;

	TSK_DEBUG_INFO("tdav_consumer_audio_init()");

	if(!self){
		TSK_DEBUG_ERROR("Invalid parameter");
		return -1;
	}
	/* base */
	if((ret = tmedia_consumer_init(TMEDIA_CONSUMER(self)))){
		return ret;
	}

	/* self (should be update by prepare() by using the codec's info)*/
	TMEDIA_CONSUMER(self)->audio.bits_per_sample = TDAV_BITS_PER_SAMPLE_DEFAULT;
	TMEDIA_CONSUMER(self)->audio.ptime = TDAV_PTIME_DEFAULT;
	TMEDIA_CONSUMER(self)->audio.in.channels = TDAV_CHANNELS_DEFAULT;
	TMEDIA_CONSUMER(self)->audio.in.rate = TDAV_RATE_DEFAULT;
	TMEDIA_CONSUMER(self)->audio.gain = TSK_MIN(tmedia_defaults_get_audio_consumer_gain(), TDAV_AUDIO_GAIN_MAX);

	tsk_safeobj_init(self);

	return 0;
}
Exemplo n.º 5
0
//=================================================================================================
//	DTLS socket object definition
//
static tsk_object_t* tnet_dtls_socket_ctor(tsk_object_t * self, va_list * app)
{
	tnet_dtls_socket_t *socket = self;
	if (socket){
		tsk_safeobj_init(socket);
	}
	return self;
}
//=================================================================================================
//	Transport context object definition
//
static tsk_object_t* transport_context_ctor(tsk_object_t * self, va_list * app)
{
	transport_context_t *context = self;
	if (context) {
		tsk_safeobj_init(context);
	}
	return self;
}
Exemplo n.º 7
0
//
//	Object definition for and AudioUnit instance
//
static tsk_object_t* tdav_audiounit_instance_ctor(tsk_object_t * self, va_list * app)
{
	tdav_audiounit_instance_t* inst = self;
	if(inst){
		tsk_safeobj_init(inst);
	}
	return self;
}
Exemplo n.º 8
0
//========================================================
//	SigComp compressor dispatcher object definition
//
static tsk_object_t* tcomp_compressordisp_ctor(tsk_object_t * self, va_list * app)
{
	tcomp_compressordisp_t *compressordisp = self;
	if(compressordisp){
		int i = 0;
		compressordisp->stateHandler = va_arg(*app, const tcomp_statehandler_t*);

		compressordisp->compressors[0] = tcomp_compressor_deflate_compress;	/* If you don't want deflate compressor then remove this line. */
		compressordisp->compressors[1] = tcomp_compressor_dummy_compress;	/* RFC 4896 [11. Uncompressed Bytecode]. */

		/* Initialize safeobject */
		tsk_safeobj_init(compressordisp);
	}
	else{
Exemplo n.º 9
0
/* constructor */
static tsk_object_t* _tdav_producer_video_v4l2_ctor(tsk_object_t *self, va_list * app)
{
    tdav_producer_video_v4l2_t *p_v4l2 = (tdav_producer_video_v4l2_t *)self;
    if (p_v4l2) {
        /* init base */
        tmedia_producer_init(TMEDIA_PRODUCER(p_v4l2));
        TMEDIA_PRODUCER(p_v4l2)->video.chroma = tmedia_chroma_yuv420p;
        /* init self with default values*/
        p_v4l2->fd = -1;
        TMEDIA_PRODUCER(p_v4l2)->video.fps = 15;
        TMEDIA_PRODUCER(p_v4l2)->video.width = 352;
        TMEDIA_PRODUCER(p_v4l2)->video.height = 288;

        tsk_safeobj_init(p_v4l2);
    }
    return self;
}
Exemplo n.º 10
0
static void* tcomp_manager_ctor(void * self, va_list * app)
{
	tcomp_manager_t *manager = self;
	if(manager)
	{
		manager->stateHandler = tcomp_statehandler_create();
		manager->dispatcher_compressor = tcomp_compressordisp_create(manager->stateHandler);
		manager->dispatcher_decompressor = tcomp_decompressordisp_create(manager->stateHandler);

		/* Initialize safeobject */
		tsk_safeobj_init(manager);
	}
	else{
		TSK_DEBUG_ERROR("Failed to create new manager.");
	}

	return self;
}
Exemplo n.º 11
0
static tsk_object_t* tdav_video_jb_ctor(tsk_object_t * self, va_list * app)
{
    tdav_video_jb_t *jb = self;
    if(jb) {
        if(!(jb->frames = tsk_list_create())) {
            TSK_DEBUG_ERROR("Failed to create list");
            return tsk_null;
        }
        if(!(jb->decode_thread_cond = tsk_condwait_create())) {
            TSK_DEBUG_ERROR("Failed to create condition var");
            return tsk_null;
        }
        jb->cb_data_fdd.type = tdav_video_jb_cb_data_type_fdd;
        jb->cb_data_rtp.type = tdav_video_jb_cb_data_type_rtp;

        tsk_safeobj_init(jb);
    }
    return self;
}