Пример #1
0
static Errcode flow_save_frames(Image_file *ifile,
								Rcel *screen,
								ULONG num_frames,
								Errcode (*seek_frame)(int ix,void *seek_data),
								void *seek_data,
								Rcel *work_screen )
{
Errcode err = Success;
ULONG i;
Fli_frame *cbuf;
Flifile *flif = ((Flifile *)ifile);

	if(screen->width != 320 || screen->height != 200)
		return(Err_wrong_res);

	cbuf = NULL;
	for(i = 0;;++i)
	{
		if(NULL == (cbuf = pj_malloc(CBUF_SIZE)))
		{
			err = Err_no_memory;
			break;
		}
		if(i == 0)
		{
			if((err = flow_add_frame1(flif, cbuf, screen)) < Success)
				break;

			/* if only one frame terminate file and exit */

			if(num_frames <= 1)
			{
				err = flow_i_add_empty_ring(flif);
				break;
			}
		}
		else if(i < num_frames)
		{
			if((err = seek_frame(i,seek_data)) < Success)
				break;
			if((err = flow_add_next(flif,cbuf,work_screen,screen)) < Success)
				break;
		}
		else
		{
			/* if larger than one frame file re-seek to first frame */
			if((err = seek_frame(0,seek_data)) < Success)
				break;
			err = flow_add_ring(flif,cbuf,work_screen,screen);
			break; /* we are done ! */
		}
		pj_freez(&cbuf);
		pj_blitrect(screen,0,0,work_screen,0,0,320,200);
		pj_cmap_copy(screen->cmap, work_screen->cmap);
	}

	pj_freez(&cbuf);
	return(err);
}
JNIEXPORT jint JNICALL Java_com_chris_yanlong_PlayerView_seek_1frame
  (JNIEnv *env, jobject obj, jint handle ,jint progress_bar){

	 __android_log_print(ANDROID_LOG_INFO,"chris_magic", "seek frame ...");
	seek_frame((int)handle ,progress_bar);
}