void first_show() { Tjpeg *jp1 = malloc(sizeof(Tjpeg)); jp1->file_name = img_list->img_list[img_list->current_idx]; jp1 = get_image_buffer(jp1); draw_to_screen_begin_line(fb , jp1 ,50); free(jp1); }
static void init_camera(int i) { struct camera *c = get_camera(i); if (c->state == 0 && c->image) { /* The camera needs an offscreen render target. Initialize it. */ GLenum T = get_image_target(c->image); GLuint O = get_image_buffer(c->image); int w = get_image_w(c->image); int h = get_image_h(c->image); if (GL_has_framebuffer_object) { init_image(c->image); glGenFramebuffersEXT(1, &c->frame); glGenTextures (1, &c->depth); /* Initialize the depth render target. */ glBindTexture(T, c->depth); glTexImage2D(T, 0, GL_DEPTH_COMPONENT24, w, h, 0, GL_DEPTH_COMPONENT, GL_INT, NULL); glTexParameteri(T, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(T, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(T, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(T, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(T, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY); glTexParameteri(T, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); /* Attach the framebuffer render targets. */ opengl_push_framebuffer(c->frame); { glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, T, O, 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, T, c->depth, 0); } opengl_pop_framebuffer(); } } c->state = 1; }
static void *surface_thread(void *arg) { ASurface *surface = (ASurface *)arg; void *stream; AndroidSurfaceInfo src, dst; size_t size; LOG_TIME_DEFINE(buff); LOG_TIME_DEFINE(decode); running = 1; while(running == 1) { struct jpeg_frame *jpeg; LOG_TIME_START(buff); size = get_image_buffer(&stream); jpeg = stream; g_clear_screen_client = jpeg->encode_time; LOGD("Jerry: final g_clear_screen_client = %d", g_clear_screen_client); LOG_D("surface get buffer time delay: %d ms\n", (int)(timestamp() - jpeg->timestamp)); src.bits = stream + sizeof(struct jpeg_frame); LOG_TIME_END(buff); if((size > 0) && running) { LOG_TIME_START(decode); lib_ASurface_lock(surface, &dst); lib_ASurface_scaleToFullScreen_skia(surface, &src, &dst, size - sizeof(struct jpeg_frame)); lib_ASurface_unlockAndPost(surface); if(first_frame) { char msg[128]; first_frame = 0; frame_count = 0; last_time = timestamp(); sprintf(msg, "surface:%d:%d", jpeg->width, jpeg->height); } cal_fps(); LOG_TIME_END(decode); LOG_D("surface display time delay: %d ms, decode and display = %ld ms\n", (int)(timestamp() - jpeg->timestamp), LOG_TIME(decode) / 1000); release_image_buffer(); } // LOG_D("------get buff = %ld us, decode and display = %ld us-----\n", // LOG_TIME(buff), LOG_TIME(decode)); g_clear_screen_client = 0; } return ((void *)0); }
void show_next() { Tjpeg *jp = malloc(sizeof(Tjpeg)); jp->file_name = img_list->img_list[img_list->current_idx]; if(img_list->current_idx == ( img_list->length - 1)) { img_list->current_idx = 0; } else { img_list->current_idx ++; } jp = get_image_buffer(jp); draw_to_screen_begin_line(fb , jp , 50); free(jp); }
void show_privious() { Tjpeg *jp1 = malloc(sizeof(Tjpeg)); jp1->file_name = img_list->img_list[img_list->current_idx]; if(img_list->current_idx == 0) { img_list->current_idx = img_list->length - 1; } else { img_list->current_idx --; } jp1 = get_image_buffer(jp1); draw_to_screen_begin_line(fb , jp1 ,50); free(jp1); }
void *auto_display_pthread_fun() { srand( (unsigned)time( NULL ) ); // printf("Random number in the 0-99 range: %d\n", random (100)); int c_case; while(1) { Tjpeg *jp = malloc(sizeof(Tjpeg)); jp->file_name = img_list->img_list[img_list->current_idx]; if(img_list->current_idx == ( img_list->length - 1)) { img_list->current_idx = 0; } else { img_list->current_idx ++; } jp = get_image_buffer(jp); //c_case = rand() % 4; c_case = 4; switch(c_case) { case 0: //void draw_to_screen_up_to_down( Tframebuffer *fb , Tjpeg *jp ,int begin) draw_to_screen_up_to_down( fb , jp , 0); sleep(1); break; case 1: draw_to_screen_down_to_up( fb , jp , 0); sleep(1); break; case 2: draw_to_screen_left_to_right( fb , jp , 0); sleep(1); break; case 3: draw_to_screen_right_to_left( fb , jp , 0); sleep(1); break; case 4: draw_to_screen_up_to_down_plus( fb , jp , 0); sleep(1); break; case 5: break; case 6: break; case 7: break; case 8: break; } free(jp); } pthread_exit(NULL); }