コード例 #1
0
ファイル: capture_test.c プロジェクト: commshare/testSCCamera
void *thread_pop(void * camera){
	 camera_t *cam=(camera_t *)camera;
	 sc_frame_t *f;
	 int count=0;
	 zbfp=fopen("zbzb.yuv","wb");


	 slogi("pop ");
	 while(!cam->stopflag){
	 	if(count==0){
	 		sc_lock(&cam->q->mutex);
			slogi("wait for signal");
			pthread_cond_wait(&cam->q->cond,&cam->q->mutex);/*等待*/
			slogi("wake up");
			sc_unlock(&cam->q->mutex);
	 	}
	 	count++;
	 	int ret=queue_popfront(cam->q,&f);
		 if(ret==0 && f!=NULL){
		 	// slogi("pop ok delete it");
			  if(zbfp)
			  {
			  	 yuv_write(f->data, f->len, zbfp);
                // sc_write_onebyone(f->data, f->len, count);

			  }else{
				slogi("#####zbzb.yuv open fail#####");
			  }
			 delete_frame(f);}
		 if(ret==QEMPTY_POPFAIL || ret==QGNEL_FAIL ){//宁愿popfail,也不能让push数据放不进去而丢帧
				usleep(300);
		 }
	 }

}
コード例 #2
0
ファイル: frame.cpp プロジェクト: kuiwfly/kuiwfly
void delete_frame_list(struct frame_list_t *list) {
    assert(list!=NULL) ;
    int i = 0 ;
    pthread_mutex_destroy(&list->mutex) ;
    pthread_cond_destroy(&list->cond_empty) ;
    pthread_cond_destroy(&list->cond_full) ;

    while(list->list[i]){
        delete_frame((list->list[i++])) ;
    }
    free(list->list) ;
    list->list = NULL ;
}
コード例 #3
0
ファイル: flx_collector.cpp プロジェクト: arowM/felix
unsigned long flx_collector_t::reap ()
{
  unsigned long count = 0;
  Word_t next=(Word_t)NULL;
  int res = Judy1First(j_tmp,&next,&je);
  while(res) {
    delete_frame((void *)(void*)next);
    ++count;
    res = Judy1Next(j_tmp,&next,&je);
  }
  Judy1FreeArray(&j_tmp,&je);
  if(debug) {
    fprintf(stderr,"Reaped %lu objects\n",count);
    fprintf(stderr,"Still allocated %lu objects occupying %lu bytes\n", get_allocation_count(), get_allocation_amt());
  }
  return count;
}