Mercurial > mplayer.hg
comparison libvo/vo_x11.c @ 5935:5074aa8fae5a
printf to mp_msg
author | albeu |
---|---|
date | Thu, 02 May 2002 10:49:55 +0000 |
parents | 104fce2b92b6 |
children | f9fe22a52e80 |
comparison
equal
deleted
inserted
replaced
5934:42127864a2b3 | 5935:5074aa8fae5a |
---|---|
72 #include <sys/ipc.h> | 72 #include <sys/ipc.h> |
73 #include <sys/shm.h> | 73 #include <sys/shm.h> |
74 #include <X11/extensions/XShm.h> | 74 #include <X11/extensions/XShm.h> |
75 | 75 |
76 static int Shmem_Flag; | 76 static int Shmem_Flag; |
77 static int Quiet_Flag; | 77 //static int Quiet_Flag; Here also what is this for. It's used but isn't inited ? |
78 static XShmSegmentInfo Shminfo[1]; | 78 static XShmSegmentInfo Shminfo[1]; |
79 static int gXErrorFlag; | 79 static int gXErrorFlag; |
80 static int CompletionType=-1; | 80 static int CompletionType=-1; |
81 | 81 |
82 /* since it doesn't seem to be defined on some platforms */ | 82 /* since it doesn't seem to be defined on some platforms */ |
131 #ifdef HAVE_SHM | 131 #ifdef HAVE_SHM |
132 if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1; | 132 if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag=1; |
133 else | 133 else |
134 { | 134 { |
135 Shmem_Flag=0; | 135 Shmem_Flag=0; |
136 if ( !Quiet_Flag ) printf( "Shared memory not supported\nReverting to normal Xlib\n" ); | 136 mp_msg(MSGT_VO,MSGL_WARN, "Shared memory not supported\nReverting to normal Xlib\n" ); |
137 } | 137 } |
138 if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; | 138 if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion; |
139 | 139 |
140 if ( Shmem_Flag ) | 140 if ( Shmem_Flag ) |
141 { | 141 { |
142 myximage=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[0],image_width,image_height ); | 142 myximage=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[0],image_width,image_height ); |
143 if ( myximage == NULL ) | 143 if ( myximage == NULL ) |
144 { | 144 { |
145 if ( myximage != NULL ) XDestroyImage( myximage ); | 145 if ( myximage != NULL ) XDestroyImage( myximage ); |
146 if ( !Quiet_Flag ) printf( "Shared memory error,disabling ( Ximage error )\n" ); | 146 mp_msg(MSGT_VO,MSGL_WARN,"Shared memory error,disabling ( Ximage error )\n" ); |
147 goto shmemerror; | 147 goto shmemerror; |
148 } | 148 } |
149 Shminfo[0].shmid=shmget( IPC_PRIVATE, | 149 Shminfo[0].shmid=shmget( IPC_PRIVATE, |
150 myximage->bytes_per_line * myximage->height , | 150 myximage->bytes_per_line * myximage->height , |
151 IPC_CREAT | 0777 ); | 151 IPC_CREAT | 0777 ); |
152 if ( Shminfo[0].shmid < 0 ) | 152 if ( Shminfo[0].shmid < 0 ) |
153 { | 153 { |
154 XDestroyImage( myximage ); | 154 XDestroyImage( myximage ); |
155 if ( !Quiet_Flag ) | 155 mp_msg(MSGT_VO,MSGL_V, "%s\n",strerror( errno ) ); |
156 { | 156 //perror( strerror( errno ) ); |
157 printf( "%s\n",strerror( errno ) ); | 157 mp_msg(MSGT_VO,MSGL_WARN,"Shared memory error,disabling ( seg id error )\n" ); |
158 perror( strerror( errno ) ); | |
159 printf( "Shared memory error,disabling ( seg id error )\n" ); | |
160 } | |
161 goto shmemerror; | 158 goto shmemerror; |
162 } | 159 } |
163 Shminfo[0].shmaddr=( char * ) shmat( Shminfo[0].shmid,0,0 ); | 160 Shminfo[0].shmaddr=( char * ) shmat( Shminfo[0].shmid,0,0 ); |
164 | 161 |
165 if ( Shminfo[0].shmaddr == ( ( char * ) -1 ) ) | 162 if ( Shminfo[0].shmaddr == ( ( char * ) -1 ) ) |
166 { | 163 { |
167 XDestroyImage( myximage ); | 164 XDestroyImage( myximage ); |
168 if ( Shminfo[0].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[0].shmaddr ); | 165 if ( Shminfo[0].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[0].shmaddr ); |
169 if ( !Quiet_Flag ) printf( "Shared memory error,disabling ( address error )\n" ); | 166 mp_msg(MSGT_VO,MSGL_WARN, "Shared memory error,disabling ( address error )\n" ); |
170 goto shmemerror; | 167 goto shmemerror; |
171 } | 168 } |
172 myximage->data=Shminfo[0].shmaddr; | 169 myximage->data=Shminfo[0].shmaddr; |
173 ImageData=( unsigned char * ) myximage->data; | 170 ImageData=( unsigned char * ) myximage->data; |
174 Shminfo[0].readOnly=False; | 171 Shminfo[0].readOnly=False; |
178 | 175 |
179 if ( gXErrorFlag ) | 176 if ( gXErrorFlag ) |
180 { | 177 { |
181 XDestroyImage( myximage ); | 178 XDestroyImage( myximage ); |
182 shmdt( Shminfo[0].shmaddr ); | 179 shmdt( Shminfo[0].shmaddr ); |
183 if ( !Quiet_Flag ) printf( "Shared memory error,disabling.\n" ); | 180 mp_msg(MSGT_VO,MSGL_WARN, "Shared memory error,disabling.\n" ); |
184 gXErrorFlag=0; | 181 gXErrorFlag=0; |
185 goto shmemerror; | 182 goto shmemerror; |
186 } | 183 } |
187 else | 184 else |
188 shmctl( Shminfo[0].shmid,IPC_RMID,0 ); | 185 shmctl( Shminfo[0].shmid,IPC_RMID,0 ); |
189 | 186 |
190 { | 187 { |
191 static int firstTime=1; | 188 static int firstTime=1; |
192 if ( !Quiet_Flag && firstTime){ | 189 if ( firstTime){ |
193 printf( "Sharing memory.\n" ); | 190 mp_msg(MSGT_VO,MSGL_V, "Sharing memory.\n" ); |
194 firstTime=0; | 191 firstTime=0; |
195 } | 192 } |
196 } | 193 } |
197 } | 194 } |
198 else | 195 else |
413 // return -1; | 410 // return -1; |
414 } | 411 } |
415 | 412 |
416 #ifdef WORDS_BIGENDIAN | 413 #ifdef WORDS_BIGENDIAN |
417 if(mode==MODE_BGR && bpp!=32){ | 414 if(mode==MODE_BGR && bpp!=32){ |
418 printf("BGR%d not supported, please contact the developers\n", bpp); | 415 mp_msg(MSGT_VO,MSGL_ERR,"BGR%d not supported, please contact the developers\n", bpp); |
419 return -1; | 416 return -1; |
420 } | 417 } |
421 if(mode==MODE_RGB && bpp==32){ | 418 if(mode==MODE_RGB && bpp==32){ |
422 printf("RGB32 not supported on big-endian systems, please contact the developers\n"); | 419 mp_msg(MSGT_VO,MSGL_ERR,"RGB32 not supported on big-endian systems, please contact the developers\n"); |
423 return -1; | 420 return -1; |
424 } | 421 } |
425 #else | 422 #else |
426 if(mode==MODE_BGR){ | 423 if(mode==MODE_BGR){ |
427 printf("BGR not supported, please contact the developers\n"); | 424 mp_msg(MSGT_VO,MSGL_ERR,"BGR not supported, please contact the developers\n"); |
428 return -1; | 425 return -1; |
429 } | 426 } |
430 #endif | 427 #endif |
431 | 428 |
432 saver_off(mDisplay); | 429 saver_off(mDisplay); |
564 return(VO_TRUE); | 561 return(VO_TRUE); |
565 } | 562 } |
566 | 563 |
567 static uint32_t query_format( uint32_t format ) | 564 static uint32_t query_format( uint32_t format ) |
568 { | 565 { |
569 if(verbose > 2) | 566 mp_msg(MSGT_VO,MSGL_DBG2,"vo_x11: query_format was called: %x (%s)\n",format,vo_format_name(format)); |
570 printf("vo_x11: query_format was called: %x (%s)\n",format,vo_format_name(format)); | |
571 if (IMGFMT_IS_BGR(format)) | 567 if (IMGFMT_IS_BGR(format)) |
572 { | 568 { |
573 if (IMGFMT_BGR_DEPTH(format) == vo_depthonscreen) | 569 if (IMGFMT_BGR_DEPTH(format) == vo_depthonscreen) |
574 return 3|VFCAP_OSD|VFCAP_SWSCALE|VFCAP_FLIP; | 570 return 3|VFCAP_OSD|VFCAP_SWSCALE|VFCAP_FLIP; |
575 else | 571 else |
612 | 608 |
613 static uint32_t preinit(const char *arg) | 609 static uint32_t preinit(const char *arg) |
614 { | 610 { |
615 if(arg) | 611 if(arg) |
616 { | 612 { |
617 printf("vo_x11: Unknown subdevice: %s\n",arg); | 613 mp_msg(MSGT_VO,MSGL_ERR,"vo_x11: Unknown subdevice: %s\n",arg); |
618 return ENOSYS; | 614 return ENOSYS; |
619 } | 615 } |
620 | 616 |
621 #ifdef HAVE_NEW_GUI | 617 #ifdef HAVE_NEW_GUI |
622 if ( vo_window == None ) | 618 if ( vo_window == None ) |