comparison libvo/x11_common.c @ 6296:74115095d9fe

msg/i18n fixes and some printf->mp_msg
author arpi
date Mon, 03 Jun 2002 23:23:03 +0000
parents 1e275c6cabb2
children ad98962908ac
comparison
equal deleted inserted replaced
6295:3368f774d9a4 6296:74115095d9fe
126 visuals = XGetVisualInfo(dpy, 126 visuals = XGetVisualInfo(dpy,
127 VisualScreenMask | VisualClassMask, &visual_tmpl, 127 VisualScreenMask | VisualClassMask, &visual_tmpl,
128 &nvisuals); 128 &nvisuals);
129 if (visuals != NULL) { 129 if (visuals != NULL) {
130 for (i = 0; i < nvisuals; i++) { 130 for (i = 0; i < nvisuals; i++) {
131 if (verbose) 131 mp_msg(MSGT_VO,MSGL_V,"vo: X11 truecolor visual %#x, depth %d, R:%lX G:%lX B:%lX\n",
132 printf("vo: X11 truecolor visual %#x, depth %d, R:%lX G:%lX B:%lX\n",
133 visuals[i].visualid, visuals[i].depth, 132 visuals[i].visualid, visuals[i].depth,
134 visuals[i].red_mask, visuals[i].green_mask, 133 visuals[i].red_mask, visuals[i].green_mask,
135 visuals[i].blue_mask); 134 visuals[i].blue_mask);
136 /* 135 /*
137 * save the visual index and it's depth, if this is the first 136 * save the visual index and it's depth, if this is the first
161 #define MSGLEN 60 160 #define MSGLEN 60
162 char msg[MSGLEN]; 161 char msg[MSGLEN];
163 162
164 XGetErrorText(display, event->error_code, (char *)&msg, MSGLEN); 163 XGetErrorText(display, event->error_code, (char *)&msg, MSGLEN);
165 164
166 printf("X11 error: %s\n", msg); 165 mp_msg(MSGT_VO,MSGL_ERR,"X11 error: %s\n", msg);
167 166
168 if (verbose) 167 mp_msg(MSGT_VO,MSGL_V,"Type: %x, display: %x, resourceid: %x, serial: %x\n",
169 {
170 printf("Type: %x, display: %x, resourceid: %x, serial: %x\n",
171 event->type, event->display, event->resourceid, event->serial); 168 event->type, event->display, event->resourceid, event->serial);
172 printf("Error code: %x, request code: %x, minor code: %x\n", 169 mp_msg(MSGT_VO,MSGL_V,"Error code: %x, request code: %x, minor code: %x\n",
173 event->error_code, event->request_code, event->minor_code); 170 event->error_code, event->request_code, event->minor_code);
174 }
175 171
176 abort(); 172 abort();
177 //exit_player("X11 error"); 173 //exit_player("X11 error");
178 #undef MSGLEN 174 #undef MSGLEN
179 } 175 }
265 mDisplayName=strdup(":0.0"); 261 mDisplayName=strdup(":0.0");
266 #else 262 #else
267 dispName = XDisplayName(mDisplayName); 263 dispName = XDisplayName(mDisplayName);
268 #endif 264 #endif
269 265
270 if (verbose) 266 mp_msg(MSGT_VO,MSGL_V,"X11 opening display: %s\n", dispName);
271 printf("X11 opening display: %s\n", dispName);
272 267
273 mDisplay=XOpenDisplay(dispName); 268 mDisplay=XOpenDisplay(dispName);
274 if ( !mDisplay ) 269 if ( !mDisplay )
275 { 270 {
276 printf( "vo: couldn't open the X11 display (%s)!\n",dispName ); 271 mp_msg(MSGT_VO,MSGL_ERR,"vo: couldn't open the X11 display (%s)!\n",dispName );
277 return 0; 272 return 0;
278 } 273 }
279 mScreen=DefaultScreen( mDisplay ); // Screen ID. 274 mScreen=DefaultScreen( mDisplay ); // Screen ID.
280 mRootWin=RootWindow( mDisplay,mScreen );// Root window ID. 275 mRootWin=RootWindow( mDisplay,mScreen );// Root window ID.
281 276
343 * Maybe we should rename vo_depthonscreen to (or add) vo_bpp? 338 * Maybe we should rename vo_depthonscreen to (or add) vo_bpp?
344 */ 339 */
345 bpp=mXImage->bits_per_pixel; 340 bpp=mXImage->bits_per_pixel;
346 if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi 341 if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi
347 mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask; 342 mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask;
348 if(verbose) 343 mp_msg(MSGT_VO,MSGL_V,"vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n",
349 printf("vo: X11 color mask: %X (R:%lX G:%lX B:%lX)\n",
350 mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask); 344 mask,mXImage->red_mask,mXImage->green_mask,mXImage->blue_mask);
351 XDestroyImage( mXImage ); 345 XDestroyImage( mXImage );
352 } 346 }
353 if(((vo_depthonscreen+7)/8)==2){ 347 if(((vo_depthonscreen+7)/8)==2){
354 if(mask==0x7FFF) vo_depthonscreen=15; else 348 if(mask==0x7FFF) vo_depthonscreen=15; else
359 if ( strncmp(dispName, "unix:", 5) == 0) 353 if ( strncmp(dispName, "unix:", 5) == 0)
360 dispName += 4; 354 dispName += 4;
361 else if ( strncmp(dispName, "localhost:", 10) == 0) 355 else if ( strncmp(dispName, "localhost:", 10) == 0)
362 dispName += 9; 356 dispName += 9;
363 if (*dispName==':') mLocalDisplay=1; else mLocalDisplay=0; 357 if (*dispName==':') mLocalDisplay=1; else mLocalDisplay=0;
364 printf("vo: X11 running at %dx%d with depth %d and %d bits/pixel (\"%s\" => %s display)\n", 358 mp_msg(MSGT_VO,MSGL_INFO,"vo: X11 running at %dx%d with depth %d and %d bpp (\"%s\" => %s display)\n",
365 vo_screenwidth,vo_screenheight, 359 vo_screenwidth,vo_screenheight,
366 depth, vo_depthonscreen, 360 depth, vo_depthonscreen,
367 dispName,mLocalDisplay?"local":"remote"); 361 dispName,mLocalDisplay?"local":"remote");
368 362
369 vo_wm_type=vo_wm_detect(); 363 vo_wm_type=vo_wm_detect();
377 { 371 {
378 mp_msg(MSGT_VO, MSGL_V, "vo: x11 uninit called but X11 not inited..\n"); 372 mp_msg(MSGT_VO, MSGL_V, "vo: x11 uninit called but X11 not inited..\n");
379 return; 373 return;
380 } 374 }
381 // if( !vo_depthonscreen ) return; 375 // if( !vo_depthonscreen ) return;
382 printf("vo: uninit ...\n" ); 376 mp_msg(MSGT_VO,MSGL_V,"vo: uninit ...\n" );
383 XSetErrorHandler(NULL); 377 XSetErrorHandler(NULL);
384 XCloseDisplay( mDisplay ); 378 XCloseDisplay( mDisplay );
385 vo_depthonscreen = 0; 379 vo_depthonscreen = 0;
386 mDisplay=NULL; 380 mDisplay=NULL;
387 } 381 }
778 if (dpms_disabled) 772 if (dpms_disabled)
779 { 773 {
780 if (DPMSQueryExtension(mDisplay, &nothing, &nothing)) 774 if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
781 { 775 {
782 if (!DPMSEnable(mDisplay)) { // restoring power saving settings 776 if (!DPMSEnable(mDisplay)) { // restoring power saving settings
783 printf("DPMS not available?\n"); 777 mp_msg(MSGT_VO,MSGL_WARN,"DPMS not available?\n");
784 } else { 778 } else {
785 // DPMS does not seem to be enabled unless we call DPMSInfo 779 // DPMS does not seem to be enabled unless we call DPMSInfo
786 BOOL onoff; 780 BOOL onoff;
787 CARD16 state; 781 CARD16 state;
788 DPMSInfo(mDisplay, &state, &onoff); 782 DPMSInfo(mDisplay, &state, &onoff);
789 if (onoff) { 783 if (onoff) {
790 printf ("Successfully enabled DPMS\n"); 784 mp_msg(MSGT_VO,MSGL_INFO,"Successfully enabled DPMS\n");
791 } else { 785 } else {
792 printf ("Could not enable DPMS\n"); 786 mp_msg(MSGT_VO,MSGL_WARN,"Could not enable DPMS\n");
793 } 787 }
794 } 788 }
795 } 789 }
796 } 790 }
797 #endif 791 #endif
818 CARD16 state; 812 CARD16 state;
819 DPMSInfo(mDisplay, &state, &onoff); 813 DPMSInfo(mDisplay, &state, &onoff);
820 if (onoff) 814 if (onoff)
821 { 815 {
822 Status stat; 816 Status stat;
823 printf ("Disabling DPMS\n"); 817 mp_msg(MSGT_VO,MSGL_INFO,"Disabling DPMS\n");
824 dpms_disabled=1; 818 dpms_disabled=1;
825 stat = DPMSDisable(mDisplay); // monitor powersave off 819 stat = DPMSDisable(mDisplay); // monitor powersave off
826 printf ("stat: %d\n", stat); 820 mp_msg(MSGT_VO,MSGL_V,"DPMSDisable stat: %d\n", stat);
827 } 821 }
828 } 822 }
829 #endif 823 #endif
830 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp); 824 XGetScreenSaver(mDisplay, &timeout_save, &interval, &prefer_blank, &allow_exp);
831 if (timeout_save) 825 if (timeout_save)
855 849
856 int modecount; 850 int modecount;
857 851
858 if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) { 852 if (XF86VidModeQueryExtension(mDisplay, &vm_event, &vm_error)) {
859 XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev); 853 XF86VidModeQueryVersion(mDisplay, &vm_ver, &vm_rev);
860 printf("XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev); 854 mp_msg(MSGT_VO,MSGL_V,"XF86VidMode Extension v%i.%i\n", vm_ver, vm_rev);
861 have_vm=1; 855 have_vm=1;
862 } else 856 } else
863 printf("XF86VidMode Extenstion not available.\n"); 857 mp_msg(MSGT_VO,MSGL_WARN,"XF86VidMode Extenstion not available.\n");
864 858
865 if (have_vm) { 859 if (have_vm) {
866 if (vidmodes==NULL) 860 if (vidmodes==NULL)
867 XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes); 861 XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes);
868 j=0; 862 j=0;
876 *modeline_width=vidmodes[i]->hdisplay; 870 *modeline_width=vidmodes[i]->hdisplay;
877 *modeline_height=vidmodes[i]->vdisplay; 871 *modeline_height=vidmodes[i]->vdisplay;
878 j=i; 872 j=i;
879 } 873 }
880 874
881 printf("XF86VM: Selected video mode %dx%d for image size %dx%d.\n",*modeline_width, *modeline_height, X, Y); 875 mp_msg(MSGT_VO,MSGL_INFO,"XF86VM: Selected video mode %dx%d for image size %dx%d.\n",*modeline_width, *modeline_height, X, Y);
882 XF86VidModeLockModeSwitch(mDisplay,mScreen,0); 876 XF86VidModeLockModeSwitch(mDisplay,mScreen,0);
883 XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]); 877 XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]);
884 XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]); 878 XF86VidModeSwitchToMode(mDisplay,mScreen,vidmodes[j]);
885 X=(vo_screenwidth-*modeline_width)/2; 879 X=(vo_screenwidth-*modeline_width)/2;
886 Y=(vo_screenheight-*modeline_height)/2; 880 Y=(vo_screenheight-*modeline_height)/2;
902 free(vidmodes); vidmodes=NULL; 896 free(vidmodes); vidmodes=NULL;
903 XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes); 897 XF86VidModeGetAllModeLines(mDisplay,mScreen,&modecount,&vidmodes);
904 for (i=0; i<modecount; i++) 898 for (i=0; i<modecount; i++)
905 if ((vidmodes[i]->hdisplay == vo_screenwidth) && (vidmodes[i]->vdisplay == vo_screenheight)) 899 if ((vidmodes[i]->hdisplay == vo_screenwidth) && (vidmodes[i]->vdisplay == vo_screenheight))
906 { 900 {
907 printf("\nReturning to original mode %dx%d\n", vo_screenwidth, vo_screenheight); 901 mp_msg(MSGT_VO,MSGL_INFO,"\nReturning to original mode %dx%d\n", vo_screenwidth, vo_screenheight);
908 break; 902 break;
909 } 903 }
910 904
911 XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]); 905 XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);
912 XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]); 906 XF86VidModeSwitchToMode(dpy,screen,vidmodes[i]);