jint Java_ch_nuicell_ecam_CameraPreview_prepareCamera( JNIEnv* env,jobject thiz, jint videoid) { int ret; if(camerabase<0) { camerabase = checkCamerabase(); } ret = opendevice(camerabase + videoid); if(ret != ERROR_LOCAL) { ret = initdevice(); } if(ret != ERROR_LOCAL) { ret = startcapturing(); if(ret != SUCCESS_LOCAL) { stopcapturing(); uninitdevice (); closedevice (); LOGE("device resetted"); } } if(ret != ERROR_LOCAL) { rgb = (int *)malloc(sizeof(int) * (IMG_WIDTH*IMG_HEIGHT)); ybuf = (int *)malloc(sizeof(int) * (IMG_WIDTH*IMG_HEIGHT)); } return ret; }
jint Java_dk_itu_eyedroid_io_protocols_InputStreamUSBCamera_prepareCamera( JNIEnv* env,jobject thiz, jint videoid){ int ret; if(camerabase<0){ camerabase = checkCamerabase(); } ret = opendevice(camerabase + videoid); if(ret != ERROR_LOCAL){ ret = initdevice(); } if(ret != ERROR_LOCAL){ ret = startcapturing(); if(ret != SUCCESS_LOCAL){ stopcapturing(); uninitdevice (); closedevice (); LOGE("device resetted"); } } if(ret != ERROR_LOCAL){ rgb = (int *)malloc(sizeof(int) * (IMG_WIDTH*IMG_HEIGHT)); ybuf = (int *)malloc(sizeof(int) * (IMG_WIDTH*IMG_HEIGHT)); } return ret; }
void* beforedawn() { //allocate void* addr = birth(); //libboot initstdin( addr+0x000000); initstdout(addr+0x100000); initstdev( addr+0x200000); initstdrel(addr+0x300000); //libsoft initdevice(addr+0x400000); initdriver(addr+0x400000); //libsoft initsystem(addr+0x800000); initartery(addr+0x800000); //libuser initarena(addr+0xc00000); initactor(addr+0xc00000); return addr; }
jint Java_com_camera_simpledoublewebcams2_CameraPreview_prepareCamera(JNIEnv* env,jobject thiz, jint videoid){ int ret[CAMERANUM]; int i; if(camerabase<0){ camerabase = checkCamerabase(); } for(i=0 ; i<CAMERANUM ; i++){ ret[i] = opendevice(i, camerabase+videoid+i); if(ret[i] != ERROR_LOCAL){ ret[i] = initdevice(i); } if(ret[i] != ERROR_LOCAL){ ret[i] = startcapturing(i); } if(ret[i] != ERROR_LOCAL){ rgb[i] = (int *)malloc(sizeof(int) * (IMG_WIDTH*IMG_HEIGHT)); } } if(ret[0]==ERROR_LOCAL || ret[1]==ERROR_LOCAL ){ return ret[1]*2+ret[0]; }else{ return SUCCESS_LOCAL ; } }
int main(int argc, char* argv[]) { if(!initdevice()){ return -1; } // 你可以在做其他相关的事情 // ... char input[100] = {0}; while (scanf("%s", input)) { if ( !strcmp(input, "quit") ) { tx_nas_uninit(); break; } sleep(1); } }