annotate libvo/vo_x11.c @ 45:6f430f66dcd7

Postprocess switch changed to -pp
author gabucino
date Tue, 06 Mar 2001 10:33:27 +0000
parents 1fc618eba830
children 6ad0715dfac8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 #define DISP
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 * video_out_x11.c,X11 interface
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * Copyright ( C ) 1996,MPEG Software Simulation Group. All Rights Reserved.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * Hacked into mpeg2dec by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 * Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * 15 & 16 bpp support added by Franck Sicard <Franck.Sicard@solsoft.fr>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 #include <signal.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 LIBVO_EXTERN( x11 )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include <X11/Xlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #include <X11/Xutil.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include <X11/extensions/XShm.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 #include <errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #include "yuv2rgb.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
34 #include "x11_common.h"
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
35
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 static vo_info_t vo_info =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 "X11 ( XImage/Shm )",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 "x11",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 "Aaron Holtzman <aholtzma@ess.engr.uvic.ca>",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 /* private prototypes */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 static void Display_Image ( XImage * myximage,unsigned char *ImageData );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 /* since it doesn't seem to be defined on some platforms */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 int XShmGetEventBase( Display* );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 /* local data */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 static unsigned char *ImageData;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 /* X11 related variables */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 static Display *mDisplay;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 static Window mywindow;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 static GC mygc;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 static XImage *myximage;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 static int depth,bpp,mode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 static XWindowAttributes attribs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 static int X_already_started=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
62 //static int vo_dwidth,vo_dheight;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 #define SH_MEM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 #ifdef SH_MEM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 #include <sys/ipc.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 #include <sys/shm.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 #include <X11/extensions/XShm.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 //static int HandleXError _ANSI_ARGS_( ( Display * dpy,XErrorEvent * event ) );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 static void InstallXErrorHandler ( void );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 static void DeInstallXErrorHandler ( void );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 static int Shmem_Flag;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 static int Quiet_Flag;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 static XShmSegmentInfo Shminfo[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 static int gXErrorFlag;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 static int CompletionType=-1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 static void InstallXErrorHandler()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 //XSetErrorHandler( HandleXError );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 XFlush( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 static void DeInstallXErrorHandler()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 XSetErrorHandler( NULL );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 XFlush( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 static uint32_t image_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 static uint32_t image_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 static uint32_t image_format;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
100 static void check_events(){
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
101 int e=vo_x11_check_events(mDisplay);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 static uint32_t init( uint32_t width,uint32_t height,uint32_t d_width,uint32_t d_height,uint32_t fullscreen,char *title,uint32_t format )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 int screen;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 unsigned int fg,bg;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 char *hello=( title == NULL ) ? "X11 render" : title;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 char *name=":0.0";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 XSizeHints hint;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 XVisualInfo vinfo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 XEvent xev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 XGCValues xgcv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 Colormap theCmap;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 XSetWindowAttributes xswa;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 unsigned long xswamask;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 image_height=height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 image_width=width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 image_format=format;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 if ( X_already_started ) return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 if( !vo_init() ) return 0; // Can't open X11
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 if( getenv( "DISPLAY" ) ) name=getenv( "DISPLAY" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 mDisplay=XOpenDisplay( name );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 if ( mDisplay == NULL )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 fprintf( stderr,"Can not open display\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 screen=DefaultScreen( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 hint.x=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 hint.y=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 hint.width=image_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 hint.height=image_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 if ( fullscreen )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 hint.width=vo_screenwidth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 hint.height=vo_screenheight;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 }
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
146 vo_dwidth=hint.width;
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
147 vo_dheight=hint.height;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 hint.flags=PPosition | PSize;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 bg=WhitePixel( mDisplay,screen );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 fg=BlackPixel( mDisplay,screen );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 XGetWindowAttributes( mDisplay,DefaultRootWindow( mDisplay ),&attribs );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 depth=attribs.depth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 XMatchVisualInfo( mDisplay,screen,depth,TrueColor,&vinfo );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 theCmap =XCreateColormap( mDisplay,RootWindow( mDisplay,screen ),
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 vinfo.visual,AllocNone );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 xswa.background_pixel=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 xswa.border_pixel=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 xswa.colormap=theCmap;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 xswamask=CWBackPixel | CWBorderPixel |CWColormap;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 mywindow=XCreateWindow( mDisplay,RootWindow( mDisplay,screen ),
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 hint.x,hint.y,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 hint.width,hint.height,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 xswa.border_pixel,depth,CopyFromParent,vinfo.visual,xswamask,&xswa );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
172 if ( fullscreen ) vo_x11_decoration( mDisplay,mywindow,0 );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 XSelectInput( mDisplay,mywindow,StructureNotifyMask );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 XSetStandardProperties( mDisplay,mywindow,hello,hello,None,NULL,0,&hint );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 XMapWindow( mDisplay,mywindow );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 do { XNextEvent( mDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != mywindow );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 XSelectInput( mDisplay,mywindow,NoEventMask );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 XFlush( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 XSync( mDisplay,False );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 mygc=XCreateGC( mDisplay,mywindow,0L,&xgcv );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 #ifdef SH_MEM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 if ( XShmQueryExtension( mDisplay ) ) Shmem_Flag=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 Shmem_Flag=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 if ( !Quiet_Flag ) fprintf( stderr,"Shared memory not supported\nReverting to normal Xlib\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 if ( Shmem_Flag ) CompletionType=XShmGetEventBase( mDisplay ) + ShmCompletion;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 InstallXErrorHandler();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 if ( Shmem_Flag )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 myximage=XShmCreateImage( mDisplay,vinfo.visual,depth,ZPixmap,NULL,&Shminfo[0],width,image_height );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 if ( myximage == NULL )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 if ( myximage != NULL ) XDestroyImage( myximage );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 if ( !Quiet_Flag ) fprintf( stderr,"Shared memory error,disabling ( Ximage error )\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 goto shmemerror;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 Shminfo[0].shmid=shmget( IPC_PRIVATE,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 myximage->bytes_per_line * myximage->height ,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 IPC_CREAT | 0777 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 if ( Shminfo[0].shmid < 0 )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 XDestroyImage( myximage );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 if ( !Quiet_Flag )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 printf( "%s\n",strerror( errno ) );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 perror( strerror( errno ) );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 fprintf( stderr,"Shared memory error,disabling ( seg id error )\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 goto shmemerror;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 Shminfo[0].shmaddr=( char * ) shmat( Shminfo[0].shmid,0,0 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 if ( Shminfo[0].shmaddr == ( ( char * ) -1 ) )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 XDestroyImage( myximage );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 if ( Shminfo[0].shmaddr != ( ( char * ) -1 ) ) shmdt( Shminfo[0].shmaddr );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 if ( !Quiet_Flag ) fprintf( stderr,"Shared memory error,disabling ( address error )\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 goto shmemerror;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 myximage->data=Shminfo[0].shmaddr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 ImageData=( unsigned char * ) myximage->data;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 Shminfo[0].readOnly=False;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 XShmAttach( mDisplay,&Shminfo[0] );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 XSync( mDisplay,False );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 if ( gXErrorFlag )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 XDestroyImage( myximage );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 shmdt( Shminfo[0].shmaddr );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 if ( !Quiet_Flag ) fprintf( stderr,"Shared memory error,disabling.\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 gXErrorFlag=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 goto shmemerror;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 shmctl( Shminfo[0].shmid,IPC_RMID,0 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 if ( !Quiet_Flag ) fprintf( stderr,"Sharing memory.\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 shmemerror:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251 Shmem_Flag=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 myximage=XGetImage( mDisplay,mywindow,0,0,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 width,image_height,AllPlanes,ZPixmap );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 ImageData=myximage->data;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 #ifdef SH_MEM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 DeInstallXErrorHandler();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 bpp=myximage->bits_per_pixel;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 fprintf( stderr,"X11 color mask: R:%X G:%X B:%X\n",myximage->red_mask,myximage->green_mask,myximage->blue_mask );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 // If we have blue in the lowest bit then obviously RGB
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 #ifdef WORDS_BIGENDIAN
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 if ( myximage->byte_order != MSBFirst )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 if ( myximage->byte_order != LSBFirst )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 fprintf( stderr,"No support fon non-native XImage byte order!\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 if( format==IMGFMT_YV12 ) yuv2rgb_init( ( depth == 24 ) ? bpp : depth,mode );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 XSelectInput( mDisplay,mywindow,StructureNotifyMask | KeyPressMask );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281 X_already_started++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 // vo_initthread( mThread );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 static const vo_info_t* get_info( void )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 { return &vo_info; }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 static void Terminate_Display_Process( void )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 getchar(); /* wait for enter to remove window */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 #ifdef SH_MEM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 if ( Shmem_Flag )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 XShmDetach( mDisplay,&Shminfo[0] );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 XDestroyImage( myximage );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 shmdt( Shminfo[0].shmaddr );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 XDestroyWindow( mDisplay,mywindow );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303 XCloseDisplay( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 X_already_started=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 static void Display_Image( XImage *myximage,uint8_t *ImageData )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 #ifdef DISP
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310 #ifdef SH_MEM
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 if ( Shmem_Flag )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 XShmPutImage( mDisplay,mywindow,mygc,myximage,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 0,0,
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
315 ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 myximage->width,myximage->height,True );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317 XFlush( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 XPutImage( mDisplay,mywindow,mygc,myximage,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 0,0,
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
324 ( vo_dwidth - myximage->width ) / 2,( vo_dheight - myximage->height ) / 2,
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 myximage->width,myximage->height );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 XFlush( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
331 static void flip_page( void ){
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
332 check_events();
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
333 Display_Image( myximage,ImageData );
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
334 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 static uint32_t draw_slice( uint8_t *src[],int stride[],int w,int h,int x,int y )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338 uint8_t *dst;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 dst=ImageData + ( image_width * y + x ) * ( bpp/8 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 yuv2rgb( dst,src[0],src[1],src[2],w,h,image_width*( bpp/8 ),stride[0],stride[1] );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345 void rgb15to16_mmx( char* s0,char* d0,int count );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 #if 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348 static uint32_t draw_frame( uint8_t *src[] )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 if( image_format==IMGFMT_YV12 )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 yuv2rgb( ImageData,src[0],src[1],src[2],image_width,image_height,image_width*( bpp/8 ),image_width,image_width/2 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 int sbpp=( ( image_format&0xFF )+7 )/8;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
357 int dbpp=( bpp+7 )/8;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
358 char *d=ImageData;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359 char *s=src[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360 //printf( "sbpp=%d dbpp=%d depth=%d bpp=%d\n",sbpp,dbpp,depth,bpp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361 #if 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362 // flipped BGR
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 //printf( "Rendering flipped BGR frame bpp=%d src=%d dst=%d\n",bpp,sbpp,dbpp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 s+=sbpp*image_width*image_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
366 for( i=0;i<image_height;i++ )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368 s-=sbpp*image_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 if( sbpp==dbpp ) memcpy( d,s,sbpp*image_width );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 char *s2=s;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373 char *d2=d;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 char *e=s2+sbpp*image_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 while( s2<e )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 d2[0]=s2[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 d2[1]=s2[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 d2[2]=s2[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380 s2+=sbpp;d2+=dbpp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 d+=dbpp*image_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386 // memcpy( ImageData,src[0],image_width*image_height*bpp );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 if( sbpp==dbpp )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389 //Display_Image( myximage,s );return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390 #if 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391 if( depth==16 && image_format==( IMGFMT_BGR|15 ) ){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 // do 15bpp->16bpp
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393 #ifdef HAVE_MMX
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
394 rgb15to16_mmx( s,d,2*image_width*image_height );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396 unsigned short *s1=( unsigned short * )s;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 unsigned short *d1=( unsigned short * )d;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398 unsigned short *e=s1+image_width*image_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
399 while( s1<e )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401 register int x=*( s1++ );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 // rrrrrggggggbbbbb
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 // 0rrrrrgggggbbbbb
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
404 // 0111 1111 1110 0000=0x7FE0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 // 00000000000001 1111=0x001F
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406 *( d1++ )=( x&0x001F )|( ( x&0x7FE0 )<<1 );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
407 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
409 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412 { memcpy( d,s,sbpp*image_width*image_height ); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
413 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
416 char *e=s+sbpp*image_width*image_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 //printf( "libvo: using C 24->32bpp conversion\n" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418 while( s<e )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
420 d[0]=s[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421 d[1]=s[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422 d[2]=s[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 s+=sbpp;d+=dbpp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
425 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
428 //Display_Image( myximage,ImageData );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
433 static uint32_t query_format( uint32_t format )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
434 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
435 if( !vo_init() ) return 0; // Can't open X11
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
436 if( ( format&IMGFMT_BGR_MASK )==IMGFMT_BGR && ( format&0xFF )==vo_depthonscreen ) return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
437 switch( format )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
438 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
439 case IMGFMT_YV12: return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
440 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
442 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
443
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
444
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
446 uninit(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
448 printf("vo: uninit!\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452