comparison libvo/vo_vesa.c @ 6203:94330609dd5b

removed screenshot thingie - it will be moved to video filter layer
author alex
date Mon, 27 May 2002 15:45:02 +0000
parents e01c664def74
children 2cbf7d447bb2
comparison
equal deleted inserted replaced
6202:1e275c6cabb2 6203:94330609dd5b
944 if(verbose > 2) 944 if(verbose > 2)
945 printf("vo_subdevice: initialization returns: %i\n",pre_init_err); 945 printf("vo_subdevice: initialization returns: %i\n",pre_init_err);
946 return pre_init_err; 946 return pre_init_err;
947 } 947 }
948 948
949 #ifdef HAVE_PNG
950 static int vesa_screenshot(const char *fname)
951 {
952 uint32_t i,n;
953 uint8_t *ptrs[video_mode_info.YResolution];
954 if(video_out_png.preinit(NULL))
955 {
956 printf("\nvo_vesa: can't preinit vo_png\n");
957 return 1;
958 }
959 if(!video_out_png.control(VOCTRL_QUERY_FORMAT, &dstFourcc))
960 {
961 printf("\nvo_vesa: vo_png doesn't support: %s fourcc\n",vo_format_name(dstFourcc));
962 return 1;
963 }
964 if(video_out_png.config(HAS_DGA()?video_mode_info.XResolution:dstW,
965 HAS_DGA()?video_mode_info.YResolution:dstH,
966 HAS_DGA()?video_mode_info.XResolution:dstW,
967 HAS_DGA()?video_mode_info.YResolution:dstH,
968 0,NULL,dstFourcc,NULL))
969 {
970 printf("\nvo_vesa: can't configure vo_png\n");
971 return 1;
972 }
973 n = HAS_DGA()?video_mode_info.YResolution:dstH;
974 for(i=0;i<n;i++)
975 ptrs[i] = &dga_buffer[(HAS_DGA()?video_mode_info.XResolution:dstW)*i*PIXEL_SIZE()];
976 if(video_out_png.draw_frame(ptrs))
977 {
978 printf("\nvo_vesa: vo_png: error during dumping\n");
979 return 1;
980 }
981
982 video_out_png.uninit();
983 if(verbose) printf("\nvo_vesa: png output has been created\n");
984 return 0;
985 }
986
987
988 static char _home_name[FILENAME_MAX + 1];
989 static char * __get_home_filename(const char *progname)
990 {
991 char *p = getenv("HOME");
992
993 if (p == NULL || strlen(p) < 2) {
994 struct passwd *psw = getpwuid(getuid());
995 if (psw != NULL) p = psw->pw_dir;
996 }
997
998 if (p == NULL || strlen(p) > FILENAME_MAX - (strlen(progname) + 4))
999 p = "/tmp";
1000
1001 strcpy(_home_name, p);
1002 strcat(_home_name, "/.");
1003 return strcat(_home_name, progname);
1004 }
1005 #endif
1006
1007 static uint32_t control(uint32_t request, void *data, ...) 949 static uint32_t control(uint32_t request, void *data, ...)
1008 { 950 {
1009 switch (request) { 951 switch (request) {
1010 case VOCTRL_QUERY_FORMAT: 952 case VOCTRL_QUERY_FORMAT:
1011 return query_format(*((uint32_t*)data)); 953 return query_format(*((uint32_t*)data));
1012 #ifdef HAVE_PNG
1013 case VOCTRL_SCREENSHOT:
1014 return vesa_screenshot(__get_home_filename("mplayer_vesa_dump.png"));
1015 break;
1016 #endif
1017 } 954 }
1018 return VO_NOTIMPL; 955 return VO_NOTIMPL;
1019 } 956 }