Example #1
0
static void sdl_out_init(MSFilter  *f){
	SdlOut *obj=ms_new(SdlOut,1);
	obj->size.width = MS_VIDEO_SIZE_CIF_W;
	obj->size.height = MS_VIDEO_SIZE_CIF_H;
	obj->local_size.width = MS_VIDEO_SIZE_CIF_W;
	obj->local_size.height = MS_VIDEO_SIZE_CIF_H;
	obj->lsize_init=FALSE;
	obj->scale_factor=SCALE_FACTOR;
	obj->format=MS_RGB24;
	obj->screen=NULL;
	obj->overlay=NULL;
	obj->smallb=NULL;

#if !defined(WIN32) && !defined(__APPLE__)
	if (!sdl_initialized){

		/* Initialize the SDL library */
		if( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
			ms_error("Couldn't initialize SDL: %s", SDL_GetError());
			return;
		}
		/* Clean up on exit */
		atexit(SDL_Quit);
		sdl_initialized=TRUE;
	}
#endif
	f->data=obj;
}
static void dec_init(MSFilter *f) {
	DecData *d = (DecData*)ms_new(DecData,1);
	JNIEnv *jni_env = NULL;
	JavaVM *jvm = ms_get_jvm();

	(*jvm)->AttachCurrentThread(jvm, &jni_env, NULL);
	
	d->h264_construct_id = (*jni_env)->GetMethodID(jni_env, h264_codec_class, "<init>", "(IIIII)V");
	d->h264_decode_id = (*jni_env)->GetMethodID(jni_env, h264_codec_class, "decode", "([BI[B)I");
	d->h264_close_id = (*jni_env)->GetMethodID(jni_env, h264_codec_class, "close", "()V");

	d->input_data = (*jni_env)->NewByteArray(jni_env, VIDEO_DEC_MAX_WIDTH*VIDEO_DEC_MAX_HEIGHT*3/2); 
	d->input_data = (*jni_env)->NewGlobalRef(jni_env, d->input_data);
	d->output_data = (*jni_env)->NewByteArray(jni_env, VIDEO_DEC_MAX_WIDTH*VIDEO_DEC_MAX_HEIGHT*3/2);
	d->output_data = (*jni_env)->NewGlobalRef(jni_env, d->output_data);
	
	(*jvm)->DetachCurrentThread(jvm);	

	d->yuv_msg = NULL;
	d->sps = NULL;
	d->pps = NULL;
	rfc3984_init(&d->unpacker);
	d->packet_num = 0;
	d->bitstream_size = VIDEO_DEC_MAX_WIDTH*VIDEO_DEC_MAX_HEIGHT*3/2;
	d->bitstream = (uint8_t*)ms_malloc0(d->bitstream_size);
	d->IsFirstImageDec = FALSE;
	d->IsRecivedFirstIframe = FALSE;
	d->IsRecivedSps = FALSE;
	d->IsRecivedPps = FALSE;
	f->data = d;
}
Example #3
0
static void ms_udt_init(MSFilter *f){
	MsUDTState *s=ms_new(MsUDTState,1);;
	s->start_connect = FALSE;
	s->udt = NULL;
	s->session = NULL;
	f->data=s;
}
Example #4
0
static void speex_ec_init(MSFilter *f){
	SpeexECState *s=(SpeexECState *)ms_new(SpeexECState,1);

	s->samplerate=8000;
	ms_bufferizer_init(&s->delayed_ref);
	ms_bufferizer_init(&s->echo);
	ms_bufferizer_init(&s->ref);
	s->delay_ms=0;
	s->tail_length_ms=250;
	s->ecstate=NULL;
	s->framesize_at_8000=framesize;
	s->den = NULL;
	s->state_str=NULL;
	s->using_zeroes=FALSE;
	s->echostarted=FALSE;
	s->bypass_mode=FALSE;

#ifdef EC_DUMP
	{
		char *fname=ms_strdup_printf("%s/msspeexec-%p-echo.raw", EC_DUMP_PREFIX,f);
		s->echofile=fopen(fname,"w");
		ms_free(fname);
		fname=ms_strdup_printf("%s/msspeexec-%p-ref.raw", EC_DUMP_PREFIX,f);
		s->reffile=fopen(fname,"w");
		ms_free(fname);
		fname=ms_strdup_printf("%s/msspeexec-%p-clean.raw", EC_DUMP_PREFIX,f);
		s->cleanfile=fopen(fname,"w");
		ms_free(fname);
	}
#endif
	
	f->data=s;
}
static AlawEncData * alaw_enc_data_new(){
	AlawEncData *obj=(AlawEncData *)ms_new(AlawEncData,1);
	obj->bz=ms_bufferizer_new();
	obj->ptime=0;
	obj->ts=0;
	return obj;
}
Example #6
0
static void audio_player_init(MSFilter *f){
	StreamData *d=(StreamData*)ms_new(StreamData,1);
	d->nchannels = 1;
	d->rate = 8000;
	d->is=NULL;
	f->data=d;
}
Example #7
0
static void enc_init(MSFilter *f){
	EncState *s=(EncState *)ms_new(EncState,1);
	theora_info_init(&s->tinfo);
	s->tinfo.width=MS_VIDEO_SIZE_CIF_W;
	s->tinfo.height=MS_VIDEO_SIZE_CIF_H;
	s->tinfo.frame_width=MS_VIDEO_SIZE_CIF_W;
	s->tinfo.frame_height=MS_VIDEO_SIZE_CIF_H;
	s->tinfo.offset_x=0;
	s->tinfo.offset_y=0;
	s->tinfo.target_bitrate=500000;
	s->tinfo.pixelformat=OC_PF_420;
	s->tinfo.fps_numerator=15;
	s->tinfo.fps_denominator=1;
	s->tinfo.aspect_numerator=1;
	s->tinfo.aspect_denominator=1;
	s->tinfo.colorspace=OC_CS_UNSPECIFIED;
	s->tinfo.dropframes_p=0;
	s->tinfo.quick_p=1;
	s->tinfo.quality=63;
	s->tinfo.keyframe_auto_p=1;
	s->tinfo.keyframe_frequency=64;
	s->tinfo.keyframe_frequency_force=64;
	s->tinfo.keyframe_data_target_bitrate=s->tinfo.target_bitrate*1.2;
	s->tinfo.keyframe_auto_threshold=80;
	s->tinfo.keyframe_mindistance=8;
	s->tinfo.noise_sensitivity=1;
	s->packed_conf=NULL;
	s->start_time=0;
	s->conf_time=0;
	s->mtu=ms_get_payload_max_size()-6;
	s->nframes=0;
	f->data=s;
}
Example #8
0
static void receiver_init(MSFilter * f)
{
	ReceiverData *d = (ReceiverData *)ms_new(ReceiverData, 1);
	d->session = NULL;
	d->rate = 8000;
	f->data = d;
}
Example #9
0
static void enc_init(MSFilter *f){
	EncState *s=ms_new(EncState,1);
	s->state=gsm_create();
	s->ts=0;
	s->bufferizer=ms_bufferizer_new();
	f->data=s;
}
Example #10
0
static  MSSndCard *winsndcard_dup(MSSndCard *obj){
	MSSndCard *card=ms_snd_card_new(&winsnd_card_desc);
	card->name=ms_strdup(obj->name);
	card->data=ms_new(WinSndCard,1);
	memcpy(card->data,obj->data,sizeof(WinSndCard));
	return card;
}
Example #11
0
static void webrtc_aec_init(MSFilter *f)
{
	WebRTCAECState *s = (WebRTCAECState *) ms_new(WebRTCAECState, 1);

	s->samplerate = 8000;
	ms_bufferizer_init(&s->delayed_ref);
	ms_bufferizer_init(&s->echo);
	ms_bufferizer_init(&s->ref);
	s->delay_ms = 0;
	s->aecmInst = NULL;
	s->framesize = framesize;
	s->state_str = NULL;
	s->using_zeroes = FALSE;
	s->echostarted = FALSE;
	s->bypass_mode = FALSE;

#ifdef EC_DUMP
	{
		char *fname = ms_strdup_printf("%s/mswebrtcaec-%p-echo.raw", EC_DUMP_PREFIX, f);
		s->echofile = fopen(fname, "w");
		ms_free(fname);
		fname = ms_strdup_printf("%s/mswebrtcaec-%p-ref.raw", EC_DUMP_PREFIX, f);
		s->reffile = fopen(fname, "w");
		ms_free(fname);
		fname = ms_strdup_printf("%s/mswebrtcaec-%p-clean.raw", EC_DUMP_PREFIX, f);
		s->cleanfile = fopen(fname, "w");
		ms_free(fname);
	}
#endif

	f->data = s;
}
Example #12
0
static void dec_init(MSFilter *f){
	DecState *s=ms_new(DecState,1);
	s->nsamples=0;
	s->nbytes=0;
	s->ms_per_frame=0;
	f->data=s;
}
Example #13
0
static void au_init(MSSndCard *card){
	ms_debug("au_init");
	AUData *d=ms_new(AUData,1);
	//OSStatus auresult;
	d->bits=16;
	d->rate=PREFERRED_HW_SAMPLE_RATE;
	d->nchannels=1;
	
	d->read_started=FALSE;
	d->write_started=FALSE;
	d->bufferizer=ms_bufferizer_new();
	d->n_lost_frame=0;
	d->started=FALSE;
	d->io_unit_must_be_started=FALSE;
	qinit(&d->rq);
	d->readTimeStamp.mSampleTime=-1;
	ms_mutex_init(&d->mutex,NULL);
	
	if (strcmp(card->name,AU_CARD_SPEAKER)==0) {
		d->is_ringer=TRUE;
	} else {
		d->is_ringer=FALSE;
	}
	card->data=d;
}
Example #14
0
static void rec_init(MSFilter *f){
	RecState *s=ms_new(RecState,1);
	s->fd=-1;
	s->rate=8000;
	s->size=0;
	s->state=Closed;
	f->data=s;
}
Example #15
0
static void enc_init(MSFilter *f){
	EncState *s=(EncState *)ms_new(EncState, 1); /* alloc EncState object, count = 1 */
	memset(s, 0 , sizeof(*s));
	s->enc = bv16_encode_init(NULL);
	s->ts=0;
	s->bufferizer=ms_bufferizer_new();
	f->data=s;
}
Example #16
0
static void rec_init(MSFilter *f){
	RecState *s=ms_new(RecState,1);
	s->fd=INVALID_HANDLE_VALUE;
	s->rate=8000;
	s->size=0;
	s->state=Closed;
	f->data=s;
}
Example #17
0
void alsa_write_init(MSFilter *obj){
	AlsaWriteData *ad=ms_new(AlsaWriteData,1);
	ad->pcmdev=NULL;
	ad->handle=NULL;
	ad->rate=8000;
	ad->nchannels=1;
	obj->data=ad;
}
Example #18
0
static void dtmfgen_init(MSFilter *f){
	DtmfGenState *s=ms_new(DtmfGenState,1);
	s->rate=8000;
	s->dur=s->rate/10;
	s->pos=0;
	s->dtmf=0;
	f->data=s;
}
Example #19
0
MSConcealerTsContext* ms_concealer_ts_context_new(unsigned int max_plc_ts){
	MSConcealerTsContext *obj=(MSConcealerTsContext *) ms_new(MSConcealerTsContext,1);
	obj->sample_ts=-1;
	obj->plc_start_ts=-1;
	obj->total_number_for_plc=0;
	obj->max_plc_ts=max_plc_ts;
	return obj;
}
Example #20
0
static void dec_init(MSFilter *f){
	DecState *s=(DecState *)ms_new(DecState,1);
	s->ready=FALSE;
	theora_info_init(&s->tinfo);
	s->yuv=NULL;
	s->curframe=NULL;
	f->data=s;
}
Example #21
0
static void itc_source_init(MSFilter *f){
	SourceState *s=ms_new(SourceState,1);
	ms_mutex_init(&s->mutex,NULL);
	ms_queue_init(&s->q);
	s->rate=44100;
	s->nchannels=1;
	f->data=s;
}
Example #22
0
void static_image_init(MSFilter *f){
	SIData *d=(SIData*)ms_new(SIData,1);
	d->vsize.width=MS_VIDEO_SIZE_CIF_W;
	d->vsize.height=MS_VIDEO_SIZE_CIF_H;
	d->index=-1;
	d->lasttime=0;
	d->pic=NULL;
	f->data=d;
}
Example #23
0
static void video_player_init(MSFilter *f){
	StreamData *d=(StreamData*)ms_new(StreamData,1);
	d->vsize.width=MS_VIDEO_SIZE_CIF_W;
	d->vsize.height=MS_VIDEO_SIZE_CIF_H;
	d->fps=1;
	d->starttime=0;
	d->index =0;
	d->is=NULL;
	f->data=d;
}
static MSScalerContext *android_create_scaler_context(int src_w, int src_h, MSPixFmt src_fmt, int dst_w, int dst_h, MSPixFmt dst_fmt, int flags){
	AndroidScalerCtx *ctx=ms_new0(AndroidScalerCtx,1);
	int i;
	int tmp,prev;

	if (!premult_initd){
		init_premults();
		premult_initd=TRUE;
	}
	if (src_fmt!=MS_YUV420P && dst_fmt!=MS_RGB565){
		ms_fatal("FIXME: unsupported rescaling scheme.");
		ms_free(ctx);
		return NULL;
	}
	ctx->src_size.width=src_w;
	ctx->src_size.height=src_h;
	ctx->dst_size.width=dst_w;
	ctx->dst_size.height=dst_h;

	ctx->hscaled_img_stride=ROUND_UP(dst_w,PAD);
	ctx->unscaled_stride=ROUND_UP(src_w,PAD);
	for(i=0;i<3;++i){
		ctx->unscaled_2lines[i]=ms_new(int16_t,ROUND_UP(src_w,PAD)*2);
		ctx->hscaled_img[i]=ms_new(int16_t,ctx->hscaled_img_stride*dst_h);
	}
	ctx->w_inc=(src_w<<16)/dst_w;
	ctx->h_inc=(src_h<<16)/dst_h;
	/*compute the grid (map) for original lines into destination lines*/
	ctx->dst_w_padded=ROUND_UP(dst_w,PAD);
	ctx->hgrid=ms_new0(uint32_t,ctx->dst_w_padded);
	ctx->hcoeffs=ms_new0(int16_t,ctx->dst_w_padded);
	tmp=0;
	prev=0;
	for(i=0;i<dst_w;++i){
		int offset=(tmp>>16)*2;
		ctx->hgrid[i]=offset-prev;
		ctx->hcoeffs[i]=(tmp&0xffff)>>9;
		prev=offset;
		tmp+=ctx->w_inc;
	}

	return (MSScalerContext*)ctx;
}
Example #25
0
static void dtmfgen_init(MSFilter *f){
	DtmfGenState *s=(DtmfGenState *)ms_new(DtmfGenState,1);
	s->rate=8000;
	s->dur=s->rate/10;
	s->pos=0;
	s->dtmf=0;
	s->nosamples_time=0;
	s->silence=0;
	f->data=s;
}
Example #26
0
static ResampleData * resample_data_new() {
    ResampleData *obj=(ResampleData *)ms_new(ResampleData,1);
    obj->bz=ms_bufferizer_new();
    obj->ts=0;
    obj->input_rate=8000;
    obj->output_rate=16000;
    obj->handle=NULL;
    obj->nchannels=1;
    return obj;
}
Example #27
0
MSWebCam * ms_web_cam_new(MSWebCamDesc *desc){
	MSWebCam *obj=(MSWebCam *)ms_new(MSWebCam,1);
	obj->desc=desc;
	obj->name=NULL;
	obj->data=NULL;
	obj->id=NULL;
	if (desc->init!=NULL)
		desc->init(obj);
	return obj;
}
Example #28
0
MSSndCard * ms_snd_card_new_with_name(MSSndCardDesc *desc,const char* name) {
	MSSndCard *obj=(MSSndCard *)ms_new(MSSndCard,1);
	obj->desc=desc;
	obj->name=name?ms_strdup(name):NULL;
	obj->data=NULL;
	obj->id=NULL;
	obj->capabilities=MS_SND_CARD_CAP_CAPTURE|MS_SND_CARD_CAP_PLAYBACK;
	if (desc->init!=NULL)
		desc->init(obj);
	return obj;
}
Example #29
0
static void pixconv_init(MSFilter *f){
	PixConvState *s=(PixConvState *)ms_new(PixConvState,1);
	s->yuv_msg=NULL;
	s->size.width = MS_VIDEO_SIZE_CIF_W;
	s->size.height = MS_VIDEO_SIZE_CIF_H;
	s->in_fmt=PIX_FMT_YUV420P;
	s->out_fmt=PIX_FMT_YUV420P;
	s->sws_ctx=NULL;
	f->data=s;
	ms_ffmpeg_check_init();
}
Example #30
0
MSSndCard * ms_snd_card_new(MSSndCardDesc *desc){
	MSSndCard *obj=(MSSndCard *)ms_new(MSSndCard,1);
	obj->desc=desc;
	obj->name=NULL;
	obj->data=NULL;
	obj->id=NULL;
	obj->capabilities=MS_SND_CARD_CAP_CAPTURE|MS_SND_CARD_CAP_PLAYBACK;
	if (desc->init!=NULL)
		desc->init(obj);
	return obj;
}