Пример #1
0
cdvr_thmb_t *dvr_thmb_init(int screen_w, int screen_h)
{
	cdvr_thmb_t *dvr_thmb = NULL;
	disp_thmb_t *pthmb = NULL;
	int i;
	int s_w, s_h;
	int off_x=0, off_y=0;
	float scl_edg_x = 1.0, scl_edg_y = 1.0;

	if(!screen_w || !screen_h) {
		printf("screen width/height or file number error!");
		return NULL;
	}

	if(screen_h == 480) {
		s_w = 640;
		s_h = 426;
		off_x = 40;
		off_y = 27;
	}
	else {
		s_w = screen_w;
		s_h = screen_h;
	}

	scl_edg_x = (float)screen_w/320.0;
	scl_edg_y = (float)screen_h/240.0;

	dvr_thmb = (cdvr_thmb_t *) malloc(sizeof(cdvr_thmb_t));
	memset(dvr_thmb, 0, sizeof(cdvr_thmb_t));
	dvr_thmb->pVideoInfo = malloc(sizeof(video_Info_t));
	memset(dvr_thmb->pVideoInfo, 0, sizeof(video_Info_t));
	dvr_thmb->file_number = -1;

	dvr_thmb->disp_number = DEF_THMB_ROW * DEF_THMB_COLUMN;
	
	dvr_thmb->disp_page = -1;
	dvr_thmb->cur_idx = -1;
	dvr_thmb->cur_page = -1;
	dvr_thmb->cur_pageNum = -1;
	dvr_thmb->dispMode = -1;
	dvr_thmb->pVideoInfo->speed = 0;
	dvr_thmb->pVideoInfo->volume = ExtGpVideoEngineGetVolume();
	if(dvr_thmb->pVideoInfo->volume > 8) {
		dvr_thmb->pVideoInfo->volume = 8;
	}
	dvr_thmb->pVideoInfo->videoMode = VIDEO_OPEN;

	dvr_thmb->disp_bitmap.width = screen_w;
	dvr_thmb->disp_bitmap.height = screen_h;
	dvr_thmb->disp_bitmap.type = SP_BITMAP_RGB565;
	dvr_thmb->disp_bitmap.bpl = screen_w*2;
	dvr_thmb->disp_bitmap.validRect.x = 0;
	dvr_thmb->disp_bitmap.validRect.y = 0;
	dvr_thmb->disp_bitmap.validRect.width = screen_w;
	dvr_thmb->disp_bitmap.validRect.height = screen_h;
	//dvr_thmb->disp_bitmap.pData = gpChunkMemAlloc(dvr_thmb->disp_bitmap.width*dvr_thmb->disp_bitmap.height*2);

	for(i=0; i<dvr_thmb->disp_number; i++) {
		pthmb = &dvr_thmb->disp_thmb[i];
		pthmb->index = i;

		pthmb->bitmap.width = (float)((float)s_w - (float)DEF_THMB_EDGE_W*scl_edg_x*4)/DEF_THMB_COLUMN;
		//pthmb->bitmap.height = (float)((float)s_h - (float)DEF_THMB_EDGE_H*scl_edg_y*4)/DEF_THMB_ROW;
		pthmb->bitmap.height = (pthmb->bitmap.width*s_h)/s_w;
		int thmb_edge_h = (s_h - pthmb->bitmap.height*DEF_THMB_ROW) / (DEF_THMB_ROW+1);
		pthmb->x = off_x + (DEF_THMB_EDGE_W*scl_edg_x+ (i%DEF_THMB_COLUMN)* pthmb->bitmap.width + (i%DEF_THMB_COLUMN)*DEF_THMB_EDGE_W*scl_edg_x);
		//pthmb->y = off_y + (DEF_THMB_EDGE_H*scl_edg_y+ (i/DEF_THMB_ROW)* pthmb->bitmap.height + (i/DEF_THMB_ROW)*DEF_THMB_EDGE_H*scl_edg_y);
		pthmb->y = off_y + (thmb_edge_h + (i/DEF_THMB_ROW)* pthmb->bitmap.height + (i/DEF_THMB_ROW)*thmb_edge_h);

		pthmb->x &= (~0x01);
		pthmb->y &= (~0x01); 
		//pthmb->bitmap.width -= (float)DEF_THMB_EDGE_W*scl_edg_x*2;
		//pthmb->bitmap.height -= (float)DEF_THMB_EDGE_H*scl_edg_y*2;
		pthmb->bitmap.width &= (~0x01);
		pthmb->bitmap.height &= (~0x01);
		pthmb->bitmap.validRect.width = pthmb->bitmap.width;
		pthmb->bitmap.validRect.height = pthmb->bitmap.height;
		pthmb->bitmap.validRect.x = pthmb->x;
		pthmb->bitmap.validRect.y = pthmb->y;
		pthmb->bitmap.bpl = pthmb->bitmap.width*2;

		pthmb->bitmap.width = screen_w;
		pthmb->bitmap.height = screen_h;

		pthmb->bitmap.type = SP_BITMAP_RGB565;
		
		pthmb->bitmap.pData = NULL;
		printf("pri x %d y %d w %d h %d\n", pthmb->bitmap.validRect.x, pthmb->bitmap.validRect.y, pthmb->bitmap.validRect.width, pthmb->bitmap.validRect.height);
	}

	return dvr_thmb;;

}
Пример #2
0
cdvr_thmb_t *playback_init(int disp, int width, int height)
{
	int i, idx=0;
	pid_t cam_pid;
	char *argv[32];
	cdvr_thmb_t *pdvr = NULL;
	g_width = width;
	g_height = height;
	g_SetSpeed = -1;
	timeOut_count = 0;

	argv[idx++] = strdup("/system/app/cvrplayer");
	//argv[idx++] = strdup("/media/sdcardc1/cvrplayer");
	argv[idx++] = strdup("cvrplayer");
	
	argv[idx++] = strdup("-p");
	argv[idx++] = strdup(Memory_path);
	argv[idx++] = strdup("-d");
	argv[idx++] = (char *)malloc(32);

	sprintf(argv[idx-1], "%d", disp);

	argv[idx++] = strdup("-m"); //for filelist
	argv[idx++] = strdup("0");

	argv[idx++] = (char *)0;
	public_pipeinit(playback_receive_cmd_callback);
	signal(SIGCHLD, SIG_IGN);
	if((cam_pid = fork()) <0)
	{
		perror("creat pid fail\n");
		return NULL;
	}
	else if(cam_pid==0)
	{
		for(i=0; i<idx-1; i++) {
			printf("%s\n", argv[i]);
		}
		execv(argv[0], &argv[1]);
	}
	else {
		for(i=0; i<idx-1; i++) {
			free(argv[i]);
		}
		g_sys_vol = ExtGpVideoEngineGetVolume();
		g_cdvr = pdvr = dvr_thmb_init(width, height);
		if(!pdvr) {
    		printf("%s:%d\n", __FUNCTION__, __LINE__);
			return NULL;
		}
		usleep(200*1000);
    	printf("%s:%d\n", __FUNCTION__, __LINE__);

		do{
			dvr_thmb_get_info();
			if(pdvr->dispMode != -1) {
				printf("cvrplayer init ok!\n");
				break;
			}
			else {
				usleep(200 *1000);
			}
		}while(pdvr->dispMode == -1);

		if(pdvr->dispMode == DISP_FULL_SCREEN) {
    		printf("%s:%d init cvrplayer to FullScreen mode\n", __FUNCTION__, __LINE__);
			dvr_thmb_dispFullScreen(g_cdvr);
			FilelistGetPageLock();
		}
		else if (pdvr->dispMode == DISP_NO_FILE) {
    		printf("%s:%d no file mode\n", __FUNCTION__, __LINE__);
		}

		pdvr->pid = cam_pid;
	}
	return pdvr;
}
Пример #3
0
cdvr_thmb_t *dvr_thmb_init(int screen_w, int screen_h)
{
	int ret;
	cdvr_thmb_t *dvr_thmb = NULL;
	disp_thmb_t *pthmb = NULL;
	int i;
	float scl_edg_x = 1.0, scl_edg_y = 1.0;

	if(!screen_w || !screen_h) {
		printf("screen width/height or file number error!");
		return NULL;
	}
	
	scl_edg_x = (float)screen_w/320.0;
	scl_edg_y = (float)screen_h/240.0;
	
	dvr_thmb = (cdvr_thmb_t *) malloc(sizeof(cdvr_thmb_t));
	memset(dvr_thmb, 0, sizeof(cdvr_thmb_t));
	dvr_thmb->pVideoInfo = malloc(sizeof(video_Info_t));
	memset(dvr_thmb->pVideoInfo, 0, sizeof(video_Info_t));
	dvr_thmb->file_number = -1;

	dvr_thmb->disp_number = DEF_THMB_ROW * DEF_THMB_COLUMN;
	
	dvr_thmb->pUrl = NULL;
	dvr_thmb->pPath = NULL;
	dvr_thmb->dispMode = -1;
	dvr_thmb->disp_page = -1;
	dvr_thmb->cur_idx = -1;
	dvr_thmb->cur_page = -1;
	dvr_thmb->cur_pageNum = -1;
	dvr_thmb->pVideoInfo->speed = 0;
	dvr_thmb->pVideoInfo->frameRate = 0;
	dvr_thmb->sclIdx = 0;

	pthread_mutex_init(&dvr_thmb->pb_mutex, NULL);

	if(g_vid_vol) {
		dvr_thmb->pVideoInfo->volume = g_vid_vol;
	}
	else {
		dvr_thmb->pVideoInfo->volume = ExtGpVideoEngineGetVolume();
	}
	if(dvr_thmb->pVideoInfo->volume > 8) {
		dvr_thmb->pVideoInfo->volume = 8;
	}
	dvr_thmb->pVideoInfo->videoMode = VIDEO_OPEN;

	for(i=0; i<dvr_thmb->disp_number; i++) {
		pthmb = &dvr_thmb->disp_thmb[i];
		pthmb->index = i;
		//pthmb->row = i/DEF_THMB_ROW;
		//pthmb->column = i%DEF_THMB_COLUMN;
		pthmb->bitmap.width = (float)((float)screen_w - (float)DEF_THMB_EDGE_W*scl_edg_x*4)/DEF_THMB_COLUMN;
		//pthmb->bitmap.height = (float)((float)screen_h - (float)DEF_THMB_EDGE_H*scl_edg_y*4)/DEF_THMB_ROW;
		pthmb->bitmap.height = (pthmb->bitmap.width*screen_h)/screen_w;
		int thmb_edge_h = (screen_h - pthmb->bitmap.height*DEF_THMB_ROW) / (DEF_THMB_ROW+1);
		pthmb->x = (DEF_THMB_EDGE_W*scl_edg_x + (i%DEF_THMB_COLUMN)* pthmb->bitmap.width + (i%DEF_THMB_COLUMN)*DEF_THMB_EDGE_W*scl_edg_x);
		//pthmb->y = (DEF_THMB_EDGE_H*scl_edg_y + (i/DEF_THMB_ROW)* pthmb->bitmap.height + (i/DEF_THMB_ROW)*DEF_THMB_EDGE_H*scl_edg_y);
		pthmb->y = (thmb_edge_h + (i/DEF_THMB_ROW)* pthmb->bitmap.height + (i/DEF_THMB_ROW)*thmb_edge_h);
		if(screen_w == 640 ) {
			if(i<6) {
				pthmb->y += 2;
			}
			if(i%DEF_THMB_COLUMN == 2) {
				pthmb->x -= 4;
			}
			if(i%DEF_THMB_COLUMN == 1) {
				pthmb->x -= 4;
			}
		pthmb->x += 2;
		pthmb->y += 2; 
		pthmb->bitmap.width -= 4;
		pthmb->bitmap.height -= 4;			
		}
		pthmb->x &= (~0x01);
		pthmb->y &= (~0x01); 
		
		//pthmb->bitmap.width -= (float)DEF_THMB_EDGE_W*scl_edg_x*2;
		//pthmb->bitmap.height -= (float)DEF_THMB_EDGE_H*scl_edg_y*2;
		pthmb->bitmap.width &= (~0x01);
		pthmb->bitmap.height &= (~0x01);
		pthmb->bitmap.validRect.width = pthmb->bitmap.width;
		pthmb->bitmap.validRect.height = pthmb->bitmap.height;
		pthmb->bitmap.validRect.x = 0;
		pthmb->bitmap.validRect.y = 0;
		pthmb->bitmap.bpl = pthmb->bitmap.width*2;

		pthmb->bitmap.type = SP_BITMAP_RGB565;
		
		//pthmb->bitmap.pData = gpChunkMemAlloc(pthmb->bitmap.width*pthmb->bitmap.height*2);
		printf("osd x %d y %d w %d h %d\n", pthmb->x, pthmb->y, pthmb->bitmap.width, pthmb->bitmap.height);
	}

	return dvr_thmb;;

}
Пример #4
0
void playback_reboot(int w, int h)
{

	int i, idx=0;
	int disp = 0;
	pid_t cam_pid;
	char *argv[32];
	cdvr_thmb_t *pdvr = NULL;

	argv[idx++] = strdup("/system/app/cvrplayer");
	//argv[idx++] = strdup("/media/sdcardc1/cvrplayer");
	argv[idx++] = strdup("cvrplayer");
	
	argv[idx++] = strdup("-p");
	argv[idx++] = strdup(Memory_path);
	argv[idx++] = strdup("-d");
	argv[idx++] = (char *)malloc(32);
	/*if(HDMI_Check() == 1) { // for hdmi and tv check.
		disp = 6;
	}
	else if(TV_Check() == 1) {
		disp = 4;
	}
	else */{
		disp = 0;
	}
	sprintf(argv[idx-1], "%d", disp);
	
	argv[idx++] = (char *)0;
	pipeDelete();
	public_pipeinit(playback_receive_cmd_callback);

	signal(SIGCHLD, SIG_IGN);
	if((cam_pid = fork()) <0)
	{
		perror("creat pid fail\n");
		return ;
	}
	else if(cam_pid==0)
	{
		for(i=0; i<idx-1; i++) {
			printf("%s\n", argv[i]);
		}
		execv(argv[0], &argv[1]);
	}
	else {
		for(i=0; i<idx-1; i++) {
			free(argv[i]);
		}

		pdvr = g_cdvr;
		if (pdvr->dispMode == DISP_NO_FILE) {
			pdvr->pid = cam_pid;
    		printf("%s:%d no file mode\n", __FUNCTION__, __LINE__);
		}
		usleep(500*1000);

		dvr_thmb_set_info(pdvr);
		pdvr->pUrl = NULL;
		pdvr->pPath = NULL;
		pdvr->pVideoInfo->speed = 0;
		pdvr->sclIdx = 0;
		pdvr->pVideoInfo->volume = ExtGpVideoEngineGetVolume();
		if(pdvr->pVideoInfo->volume > 8) {
			pdvr->pVideoInfo->volume = 8;
		}
		pdvr->pVideoInfo->videoMode = VIDEO_OPEN;

		pdvr->pUrl = FilelistGetFileName(0);
		pdvr->pPath = FilelistGetFilePath(0);
		FilelistGetPageLock();

		if(pdvr->dispMode == DISP_THMB_SCREEN) {
			dvr_thmb_dispPage(g_cdvr);
		}
		else {
    		printf("%s:%d init cvrplayer to FullScreen mode\n", __FUNCTION__, __LINE__);
			dvr_thmb_dispFullScreen(g_cdvr);
		}

		pdvr->pid = cam_pid;
	}
	return ;
}