Beispiel #1
0
void handle_issues() {
	//receiver error during flight
	if (inflight && rec_err<0) {
		if (!emergency)
			t_err = rt_timer_read();

		emergency = 1;
		rec_close();
		rec_open();
	}
	
}
Beispiel #2
0
static void enc_uninit(MSFilter *f){
	EncData *d=(EncData*)f->data;
    IOFreeVirtMem(&d->mem_desc);
    IOFreePhyMem(&d->mem_desc);
    vpu_UnInit();

    if (d->flv->fd>=0)	
        rec_close(f,NULL);
    ms_free(d->flv->data);
    ms_free(d->flv);
    ms_free(d->enc);
	ms_free(d);
}
Beispiel #3
0
static int rec_open(MSFilter *f, void *arg){
	RecState *s=(RecState*)f->data;
	const char *filename=(const char*)arg;
	if (s->fd>=0) rec_close(f,NULL);
	ms_mutex_lock(&f->lock);
	s->fd=open(filename,O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR);
	if (s->fd<0){
		ms_warning("Cannot open %s: %s",filename,strerror(errno));
		ms_mutex_unlock(&f->lock);
		return -1;
	}
	s->state=Stopped;
	ms_mutex_unlock(&f->lock);
	return 0;
}
Beispiel #4
0
static int rec_open(MSFilter *f, void *arg){
	RecState *s=(RecState*)f->data;
	const char *filename=(const char*)arg;
	int flags;
	
	if (s->fd!=-1) rec_close(f,NULL);
	
	if (access(filename,R_OK|W_OK)==0){
		flags=O_WRONLY|O_BINARY;
		if (rec_get_length(filename,&s->size)>0){
			ms_message("Opening wav file in append mode, current data size is %i",s->size);
		}
	}else{
		flags=O_WRONLY|O_CREAT|O_TRUNC|O_BINARY;
		s->size=0;
	}
	s->fd=open(filename,flags, S_IRUSR|S_IWUSR);
	if (s->fd==-1){
		ms_warning("Cannot open %s: %s",filename,strerror(errno));
		return -1;
	}
	if (s->size>0){
		struct stat statbuf;
		if (fstat(s->fd,&statbuf)==0){
			if (lseek(s->fd,statbuf.st_size,SEEK_SET) == -1){
				int err = errno;
				ms_error("Could not lseek to end of file: %s",strerror(err));
			}
		}else ms_error("fstat() failed: %s",strerror(errno));
	}
	ms_message("MSFileRec: recording into %s",filename);
	ms_mutex_lock(&f->lock);
	s->state=MSRecorderPaused;
	ms_mutex_unlock(&f->lock);
	return 0;
}
Beispiel #5
0
static void rec_uninit(MSFilter *f){
	RecState *s=(RecState*)f->data;
	if (s->fd!=-1) rec_close(f,NULL);
	ms_free(s);
}
Beispiel #6
0
static void rec_uninit(MSFilter *f){
	RecState *s=(RecState*)f->data;
	if (s->fd!=INVALID_HANDLE_VALUE)	rec_close(f,NULL);
	ms_free(s);
}