comparison libvo/vo_fbdev.c @ 4756:75fe20ca2386

Screenshot on the fly
author nick
date Mon, 18 Feb 2002 18:37:39 +0000
parents c35d7ce151b3
children aee9c32349a9
comparison
equal deleted inserted replaced
4755:67c33b0fb847 4756:75fe20ca2386
31 #ifdef CONFIG_VIDIX 31 #ifdef CONFIG_VIDIX
32 #include "vosub_vidix.h" 32 #include "vosub_vidix.h"
33 #endif 33 #endif
34 #include "aspect.h" 34 #include "aspect.h"
35 35
36 #ifdef HAVE_PNG
37 extern vo_functions_t video_out_png;
38 #endif
39
36 LIBVO_EXTERN(fbdev) 40 LIBVO_EXTERN(fbdev)
37 41
38 static vo_info_t vo_info = { 42 static vo_info_t vo_info = {
39 "Framebuffer Device", 43 "Framebuffer Device",
40 "fbdev", 44 "fbdev",
85 89
86 static FILE *fp; 90 static FILE *fp;
87 static int line_num = 0; 91 static int line_num = 0;
88 static char *line; 92 static char *line;
89 static char *token[MAX_NR_TOKEN]; 93 static char *token[MAX_NR_TOKEN];
94 static uint32_t dstFourcc;
90 95
91 static int get_token(int num) 96 static int get_token(int num)
92 { 97 {
93 static int read_nextline = 1; 98 static int read_nextline = 1;
94 static int line_pos; 99 static int line_pos;
994 fb_bpp_we_want, fb_bpp); 999 fb_bpp_we_want, fb_bpp);
995 1000
996 switch (fb_bpp) { 1001 switch (fb_bpp) {
997 case 32: 1002 case 32:
998 draw_alpha_p = vo_draw_alpha_rgb32; 1003 draw_alpha_p = vo_draw_alpha_rgb32;
1004 dstFourcc = IMGFMT_BGR32;
999 break; 1005 break;
1000 case 24: 1006 case 24:
1001 draw_alpha_p = vo_draw_alpha_rgb24; 1007 draw_alpha_p = vo_draw_alpha_rgb24;
1008 dstFourcc = IMGFMT_BGR24;
1002 break; 1009 break;
1010 default:
1003 case 16: 1011 case 16:
1004 draw_alpha_p = vo_draw_alpha_rgb16; 1012 draw_alpha_p = vo_draw_alpha_rgb16;
1013 dstFourcc = IMGFMT_BGR16;
1005 break; 1014 break;
1006 case 15: 1015 case 15:
1007 draw_alpha_p = vo_draw_alpha_rgb15; 1016 draw_alpha_p = vo_draw_alpha_rgb15;
1017 dstFourcc = IMGFMT_BGR15;
1008 break; 1018 break;
1009 } 1019 }
1010 1020
1011 if (flip & ((((pixel_format & 0xff) + 7) / 8) != fb_pixel_size)) { 1021 if (flip & ((((pixel_format & 0xff) + 7) / 8) != fb_pixel_size)) {
1012 printf(FBDEV "Flipped output with depth conversion is not " 1022 printf(FBDEV "Flipped output with depth conversion is not "
1337 printf("vo_subdevice: initialization returns: %i\n",pre_init_err); 1347 printf("vo_subdevice: initialization returns: %i\n",pre_init_err);
1338 #endif 1348 #endif
1339 if(!pre_init_err) return (pre_init_err=(fb_preinit()?0:-1)); 1349 if(!pre_init_err) return (pre_init_err=(fb_preinit()?0:-1));
1340 } 1350 }
1341 1351
1352 #ifdef HAVE_PNG
1353 static int fbdev_screenshot(void)
1354 {
1355 uint32_t i;
1356 uint8_t *ptrs[fb_vinfo.yres];
1357 if(video_out_png.preinit(NULL))
1358 {
1359 printf("\nvo_fbdev: can't preinit vo_png\n");
1360 return 1;
1361 }
1362 if(!video_out_png.control(VOCTRL_QUERY_FORMAT, &dstFourcc))
1363 {
1364 printf("\nvo_fbdev: vo_png doesn't support: %s fourcc\n",vo_format_name(dstFourcc));
1365 return 1;
1366 }
1367 if(video_out_png.config(fb_vinfo.xres,
1368 fb_vinfo.yres,
1369 fb_vinfo.xres,
1370 fb_vinfo.yres,
1371 0,NULL,dstFourcc,NULL))
1372 {
1373 printf("\nvo_fbdev: can't configure vo_png\n");
1374 return 1;
1375 }
1376 ptrs[0] = L123123875;
1377 for(i=1;i<fb_vinfo.yres;i++)
1378 ptrs[i] = ptrs[i-1]+fb_line_len;
1379 if(video_out_png.draw_frame(ptrs))
1380 {
1381 printf("\nvo_fbdev: vo_png: error during dumping\n");
1382 return 1;
1383 }
1384
1385 video_out_png.uninit();
1386 if(verbose) printf("\nvo_fbdev: png output has been created\n");
1387 return 0;
1388 }
1389 #endif
1390
1342 static uint32_t control(uint32_t request, void *data, ...) 1391 static uint32_t control(uint32_t request, void *data, ...)
1343 { 1392 {
1344 switch (request) { 1393 switch (request) {
1345 case VOCTRL_QUERY_FORMAT: 1394 case VOCTRL_QUERY_FORMAT:
1346 return query_format(*((uint32_t*)data)); 1395 return query_format(*((uint32_t*)data));
1396 #ifdef HAVE_PNG
1397 case VOCTRL_SCREENSHOT:
1398 return fbdev_screenshot();
1399 break;
1400 #endif
1347 } 1401 }
1348 return VO_NOTIMPL; 1402 return VO_NOTIMPL;
1349 } 1403 }